@abaplint/transpiler-cli 2.8.23 → 2.8.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/bundle.js +692 -86
  2. package/package.json +5 -5
package/build/bundle.js CHANGED
@@ -535,6 +535,7 @@ class LexerStream {
535
535
  this.row = this.row + 1;
536
536
  }
537
537
  if (this.offset === this.raw.length) {
538
+ this.col = this.col - 1;
538
539
  return false;
539
540
  }
540
541
  this.col = this.col + 1;
@@ -7831,9 +7832,8 @@ class Target extends combi_1.Expression {
7831
7832
  const attr = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.InstanceArrow), attribute_name_1.AttributeName);
7832
7833
  const comp = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.Dash), _1.ComponentName);
7833
7834
  const something = (0, combi_1.starPrio)((0, combi_1.altPrio)(dereference_1.Dereference, attr, comp, _1.TableExpression));
7834
- const cast = (0, combi_1.seq)((0, combi_1.altPrio)(_1.Cast, _1.NewObject), _1.Arrow, _1.FieldAll);
7835
7835
  const clas = (0, combi_1.seq)(_1.ClassName, (0, combi_1.tok)(tokens_1.StaticArrow), attribute_name_1.AttributeName);
7836
- const start = (0, combi_1.altPrio)(cast, clas, _1.TargetField, _1.TargetFieldSymbol);
7836
+ const start = (0, combi_1.altPrio)(_1.Cast, _1.NewObject, clas, _1.TargetField, _1.TargetFieldSymbol);
7837
7837
  const fields = (0, combi_1.seq)((0, combi_1.optPrio)(_1.FieldOffset), (0, combi_1.optPrio)(_1.FieldLength));
7838
7838
  const optional = (0, combi_1.altPrio)(_1.TableBody, fields);
7839
7839
  return (0, combi_1.altPrio)(_1.InlineData, _1.InlineFS, (0, combi_1.seq)(start, something, optional));
@@ -10826,9 +10826,9 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
10826
10826
  const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
10827
10827
  class EditorCall {
10828
10828
  getMatcher() {
10829
- const title = (0, combi_1.seq)("TITLE", expressions_1.Source);
10829
+ const title = (0, combi_1.seq)("TITLE", expressions_1.SimpleSource3);
10830
10830
  const options = (0, combi_1.per)("DISPLAY-MODE", title);
10831
- const ret = (0, combi_1.seq)("EDITOR-CALL FOR", (0, combi_1.opt)("REPORT"), expressions_1.Source, (0, combi_1.opt)(options));
10831
+ const ret = (0, combi_1.seq)("EDITOR-CALL FOR", (0, combi_1.optPrio)("REPORT"), expressions_1.Source, (0, combi_1.optPrio)(options));
10832
10832
  return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
10833
10833
  }
10834
10834
  }
@@ -21617,6 +21617,16 @@ class TypeUtils {
21617
21617
  return false;
21618
21618
  }
21619
21619
  }
21620
+ else if (source instanceof basic_1.TableType) {
21621
+ if (target instanceof basic_1.TableType) {
21622
+ return this.isAssignableStrict(source.getRowType(), target.getRowType());
21623
+ }
21624
+ else if (target instanceof basic_1.UnknownType
21625
+ || target instanceof basic_1.AnyType
21626
+ || target instanceof basic_1.VoidType) {
21627
+ return true;
21628
+ }
21629
+ }
21620
21630
  return this.isAssignable(source, target);
21621
21631
  }
21622
21632
  isAssignable(source, target) {
@@ -22849,6 +22859,7 @@ const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ ".
22849
22859
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
22850
22860
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
22851
22861
  const basic_types_1 = __webpack_require__(/*! ../basic_types */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js");
22862
+ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
22852
22863
  class Cast {
22853
22864
  runSyntax(node, scope, targetType, filename) {
22854
22865
  const sourceNode = node.findDirectExpression(Expressions.Source);
@@ -22875,6 +22886,7 @@ class Cast {
22875
22886
  const found = scope.findObjectDefinition(typeName);
22876
22887
  if (found) {
22877
22888
  tt = new basic_1.ObjectReferenceType(found, { qualifiedName: typeName });
22889
+ scope.addReference(typeExpression.getFirstToken(), found, _reference_1.ReferenceType.ObjectOrientedReference, filename);
22878
22890
  }
22879
22891
  }
22880
22892
  else {
@@ -25432,6 +25444,7 @@ const _scope_type_1 = __webpack_require__(/*! ../_scope_type */ "./node_modules/
25432
25444
  const sql_source_1 = __webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_source.js");
25433
25445
  const sql_compare_1 = __webpack_require__(/*! ./sql_compare */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_compare.js");
25434
25446
  const sql_order_by_1 = __webpack_require__(/*! ./sql_order_by */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_order_by.js");
25447
+ const dynamic_1 = __webpack_require__(/*! ./dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
25435
25448
  const isSimple = /^\w+$/;
25436
25449
  class Select {
25437
25450
  runSyntax(node, scope, filename, skipImplicitInto = false) {
@@ -25442,7 +25455,7 @@ class Select {
25442
25455
  if (from === undefined) {
25443
25456
  throw new Error(`Missing FROM`);
25444
25457
  }
25445
- const fields = this.findFields(node);
25458
+ const fields = this.findFields(node, scope, filename);
25446
25459
  if (fields.length === 0
25447
25460
  && node.findDirectExpression(Expressions.SQLFieldListLoop) === undefined) {
25448
25461
  throw new Error(`fields missing`);
@@ -25600,17 +25613,20 @@ class Select {
25600
25613
  }
25601
25614
  return new basic_1.VoidType("SELECT_todo");
25602
25615
  }
25603
- findFields(node) {
25604
- var _a;
25616
+ findFields(node, scope, filename) {
25617
+ var _a, _b;
25605
25618
  let expr = undefined;
25606
25619
  const ret = [];
25607
25620
  expr = node.findFirstExpression(Expressions.SQLFieldList);
25608
25621
  if (expr === undefined) {
25609
25622
  expr = node.findDirectExpression(Expressions.SQLFieldListLoop);
25610
25623
  }
25624
+ if (((_a = expr === null || expr === void 0 ? void 0 : expr.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
25625
+ new dynamic_1.Dynamic().runSyntax(expr.getFirstChild(), scope, filename);
25626
+ }
25611
25627
  for (const field of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressionsMulti([Expressions.SQLField, Expressions.SQLFieldName])) || []) {
25612
25628
  let code = field.concatTokens().toUpperCase();
25613
- const as = ((_a = field.findDirectExpression(Expressions.SQLAsName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
25629
+ const as = ((_b = field.findDirectExpression(Expressions.SQLAsName)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
25614
25630
  if (as !== "") {
25615
25631
  code = code.replace(" AS " + as, "");
25616
25632
  }
@@ -26052,13 +26068,18 @@ exports.SQLCompare = void 0;
26052
26068
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
26053
26069
  const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
26054
26070
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
26071
+ const dynamic_1 = __webpack_require__(/*! ./dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
26055
26072
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
26056
26073
  const sql_source_1 = __webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_source.js");
26057
26074
  class SQLCompare {
26058
26075
  runSyntax(node, scope, filename, tables) {
26059
- var _a;
26076
+ var _a, _b;
26060
26077
  let sourceType;
26061
26078
  let token;
26079
+ if (((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
26080
+ new dynamic_1.Dynamic().runSyntax(node.getFirstChild(), scope, filename);
26081
+ return;
26082
+ }
26062
26083
  for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
26063
26084
  new source_1.Source().runSyntax(s, scope, filename);
26064
26085
  }
@@ -26084,7 +26105,7 @@ class SQLCompare {
26084
26105
  }
26085
26106
  }
26086
26107
  }
26087
- const fieldName = (_a = node.findDirectExpression(Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
26108
+ const fieldName = (_b = node.findDirectExpression(Expressions.SQLFieldName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
26088
26109
  if (fieldName && sourceType && token) {
26089
26110
  // check compatibility for rule sql_value_conversion
26090
26111
  const targetType = this.findType(fieldName, tables, scope);
@@ -26397,6 +26418,7 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@a
26397
26418
  const table_expression_1 = __webpack_require__(/*! ./table_expression */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/table_expression.js");
26398
26419
  const expressions_1 = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
26399
26420
  const field_length_1 = __webpack_require__(/*! ./field_length */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_length.js");
26421
+ const cast_1 = __webpack_require__(/*! ./cast */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/cast.js");
26400
26422
  class Target {
26401
26423
  runSyntax(node, scope, filename) {
26402
26424
  const concat = node.concatTokens();
@@ -26528,6 +26550,13 @@ class Target {
26528
26550
  return new unknown_type_1.UnknownType(name + " unknown, Target");
26529
26551
  }
26530
26552
  }
26553
+ else if (node.get() instanceof Expressions.Cast && node instanceof nodes_1.ExpressionNode) {
26554
+ const ret = new cast_1.Cast().runSyntax(node, scope, undefined, filename);
26555
+ if (ret instanceof unknown_type_1.UnknownType) {
26556
+ throw new Error("CAST, uknown type");
26557
+ }
26558
+ return ret;
26559
+ }
26531
26560
  return new unknown_type_1.UnknownType("unknown target type");
26532
26561
  }
26533
26562
  }
@@ -28823,6 +28852,33 @@ exports.Do = Do;
28823
28852
 
28824
28853
  /***/ }),
28825
28854
 
28855
+ /***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/editor_call.js":
28856
+ /*!***************************************************************************************!*\
28857
+ !*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/editor_call.js ***!
28858
+ \***************************************************************************************/
28859
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
28860
+
28861
+ "use strict";
28862
+
28863
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
28864
+ exports.EditorCall = void 0;
28865
+ const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
28866
+ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
28867
+ class EditorCall {
28868
+ runSyntax(node, scope, filename) {
28869
+ for (const s of node.findDirectExpressions(Expressions.Source)) {
28870
+ new source_1.Source().runSyntax(s, scope, filename);
28871
+ }
28872
+ for (const t of node.findDirectExpressions(Expressions.SimpleSource3)) {
28873
+ new source_1.Source().runSyntax(t, scope, filename);
28874
+ }
28875
+ }
28876
+ }
28877
+ exports.EditorCall = EditorCall;
28878
+ //# sourceMappingURL=editor_call.js.map
28879
+
28880
+ /***/ }),
28881
+
28826
28882
  /***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/else_if.js":
28827
28883
  /*!***********************************************************************************!*\
28828
28884
  !*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/else_if.js ***!
@@ -32636,6 +32692,7 @@ const close_dataset_1 = __webpack_require__(/*! ./statements/close_dataset */ ".
32636
32692
  const get_run_time_1 = __webpack_require__(/*! ./statements/get_run_time */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/get_run_time.js");
32637
32693
  const update_database_1 = __webpack_require__(/*! ./statements/update_database */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/update_database.js");
32638
32694
  const add_1 = __webpack_require__(/*! ./statements/add */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/add.js");
32695
+ const editor_call_1 = __webpack_require__(/*! ./statements/editor_call */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/editor_call.js");
32639
32696
  const subtract_1 = __webpack_require__(/*! ./statements/subtract */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/subtract.js");
32640
32697
  const add_corresponding_1 = __webpack_require__(/*! ./statements/add_corresponding */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/add_corresponding.js");
32641
32698
  const subtract_corresponding_1 = __webpack_require__(/*! ./statements/subtract_corresponding */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/subtract_corresponding.js");
@@ -32811,6 +32868,7 @@ if (Object.keys(map).length === 0) {
32811
32868
  addToMap(new translate_1.Translate());
32812
32869
  addToMap(new modify_internal_1.ModifyInternal());
32813
32870
  addToMap(new read_textpool_1.ReadTextpool());
32871
+ addToMap(new editor_call_1.EditorCall());
32814
32872
  }
32815
32873
  // -----------------------------------
32816
32874
  class SyntaxLogic {
@@ -40177,8 +40235,8 @@ exports.MemoryFile = MemoryFile;
40177
40235
  "use strict";
40178
40236
 
40179
40237
  Object.defineProperty(exports, "__esModule", ({ value: true }));
40180
- exports.Visibility = exports.Info = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
40181
- exports.RuleTag = exports.Severity = void 0;
40238
+ exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
40239
+ exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = void 0;
40182
40240
  const issue_1 = __webpack_require__(/*! ./issue */ "./node_modules/@abaplint/core/build/src/issue.js");
40183
40241
  Object.defineProperty(exports, "Issue", ({ enumerable: true, get: function () { return issue_1.Issue; } }));
40184
40242
  const config_1 = __webpack_require__(/*! ./config */ "./node_modules/@abaplint/core/build/src/config.js");
@@ -40279,6 +40337,10 @@ const cyclomatic_complexity_stats_1 = __webpack_require__(/*! ./utils/cyclomatic
40279
40337
  Object.defineProperty(exports, "CyclomaticComplexityStats", ({ enumerable: true, get: function () { return cyclomatic_complexity_stats_1.CyclomaticComplexityStats; } }));
40280
40338
  const skip_logic_1 = __webpack_require__(/*! ./skip_logic */ "./node_modules/@abaplint/core/build/src/skip_logic.js");
40281
40339
  Object.defineProperty(exports, "SkipLogic", ({ enumerable: true, get: function () { return skip_logic_1.SkipLogic; } }));
40340
+ const diagnostics_1 = __webpack_require__(/*! ./lsp/diagnostics */ "./node_modules/@abaplint/core/build/src/lsp/diagnostics.js");
40341
+ Object.defineProperty(exports, "Diagnostics", ({ enumerable: true, get: function () { return diagnostics_1.Diagnostics; } }));
40342
+ const _edit_1 = __webpack_require__(/*! ./lsp/_edit */ "./node_modules/@abaplint/core/build/src/lsp/_edit.js");
40343
+ Object.defineProperty(exports, "LSPEdit", ({ enumerable: true, get: function () { return _edit_1.LSPEdit; } }));
40282
40344
  //# sourceMappingURL=index.js.map
40283
40345
 
40284
40346
  /***/ }),
@@ -40311,8 +40373,8 @@ class Issue {
40311
40373
  severity,
40312
40374
  });
40313
40375
  }
40314
- static atStatement(file, statement, message, key, severity, fix) {
40315
- return this.atRange(file, statement.getStart(), statement.getEnd(), message, key, severity, fix);
40376
+ static atStatement(file, statement, message, key, severity, fix, alternativeFixes) {
40377
+ return this.atRange(file, statement.getStart(), statement.getEnd(), message, key, severity, fix, alternativeFixes);
40316
40378
  }
40317
40379
  static atPosition(file, start, message, key, severity, fix) {
40318
40380
  const row = start.getRow();
@@ -40324,7 +40386,7 @@ class Issue {
40324
40386
  key,
40325
40387
  start,
40326
40388
  end,
40327
- fix,
40389
+ defaultFix: fix,
40328
40390
  severity,
40329
40391
  });
40330
40392
  }
@@ -40338,11 +40400,11 @@ class Issue {
40338
40400
  key,
40339
40401
  start,
40340
40402
  end,
40341
- fix,
40403
+ defaultFix: fix,
40342
40404
  severity,
40343
40405
  });
40344
40406
  }
40345
- static atRange(file, start, end, message, key, severity, fix) {
40407
+ static atRange(file, start, end, message, key, severity, fix, alternativeFixes) {
40346
40408
  severity = severity !== null && severity !== void 0 ? severity : severity_1.Severity.Error;
40347
40409
  return new Issue({
40348
40410
  filename: file.getFilename(),
@@ -40350,8 +40412,9 @@ class Issue {
40350
40412
  key,
40351
40413
  start,
40352
40414
  end,
40353
- fix,
40415
+ defaultFix: fix,
40354
40416
  severity,
40417
+ alternativeFixes,
40355
40418
  });
40356
40419
  }
40357
40420
  static atToken(file, token, message, key, severity, fix) {
@@ -40363,7 +40426,7 @@ class Issue {
40363
40426
  start: token.getStart(),
40364
40427
  end: token.getEnd(),
40365
40428
  severity,
40366
- fix,
40429
+ defaultFix: fix,
40367
40430
  });
40368
40431
  }
40369
40432
  static atIdentifier(identifier, message, key, severity, fix) {
@@ -40375,14 +40438,14 @@ class Issue {
40375
40438
  start: identifier.getStart(),
40376
40439
  end: identifier.getEnd(),
40377
40440
  severity,
40378
- fix,
40441
+ defaultFix: fix,
40379
40442
  });
40380
40443
  }
40381
40444
  constructor(data) {
40382
40445
  this.data = data;
40383
40446
  if (this.data.start instanceof virtual_position_1.VirtualPosition) {
40384
40447
  // no quick fixes inside macros
40385
- this.data.fix = undefined;
40448
+ this.data.defaultFix = undefined;
40386
40449
  }
40387
40450
  if (this.data.start.getCol() < 1) {
40388
40451
  throw new Error("issue, start col < 1");
@@ -40409,8 +40472,11 @@ class Issue {
40409
40472
  getFilename() {
40410
40473
  return this.data.filename;
40411
40474
  }
40412
- getFix() {
40413
- return this.data.fix;
40475
+ getDefaultFix() {
40476
+ return this.data.defaultFix;
40477
+ }
40478
+ getAlternativeFixes() {
40479
+ return this.data.alternativeFixes;
40414
40480
  }
40415
40481
  getSeverity() {
40416
40482
  return this.data.severity;
@@ -40445,22 +40511,6 @@ class LSPEdit {
40445
40511
  }
40446
40512
  return workspace;
40447
40513
  }
40448
- /*
40449
- public static mapEditsDocument(edit: IEdit): LServer.WorkspaceEdit {
40450
- const workspace: LServer.WorkspaceEdit = {documentChanges: []};
40451
- for (const filename in edit) {
40452
- const doc: LServer.VersionedTextDocumentIdentifier = {uri: filename, version: 1};
40453
-
40454
- const e = LServer.TextDocumentEdit.create(doc, this.mapText(edit[filename]));
40455
- workspace.documentChanges?.push(e);
40456
- }
40457
- // @ts-ignore
40458
- console.dir(workspace.documentChanges![0].edits[0]);
40459
- // @ts-ignore
40460
- console.dir(workspace.documentChanges![0].edits[1]);
40461
- return workspace;
40462
- }
40463
- */
40464
40514
  static mapEdit(edit) {
40465
40515
  const workspace = { changes: {} };
40466
40516
  for (const filename in edit) {
@@ -40963,27 +41013,37 @@ class CodeActions {
40963
41013
  const shown = new Set();
40964
41014
  const ret = [];
40965
41015
  for (const i of issues) {
40966
- const fix = i.getFix();
40967
- if (fix === undefined) {
40968
- continue;
40969
- }
40970
- if (totals[i.getKey()] === undefined) {
40971
- totals[i.getKey()] = 1;
40972
- }
40973
- else {
40974
- totals[i.getKey()]++;
41016
+ const fix = i.getDefaultFix();
41017
+ if (fix !== undefined) {
41018
+ if (totals[i.getKey()] === undefined) {
41019
+ totals[i.getKey()] = 1;
41020
+ }
41021
+ else {
41022
+ totals[i.getKey()]++;
41023
+ }
41024
+ if (this.inRange(i, params.range) === true) {
41025
+ ret.push({
41026
+ title: "Apply fix, " + i.getKey(),
41027
+ kind: LServer.CodeActionKind.QuickFix,
41028
+ diagnostics: [diagnostics_1.Diagnostics.mapDiagnostic(i)],
41029
+ isPreferred: true,
41030
+ edit: _edit_1.LSPEdit.mapEdit(fix),
41031
+ });
41032
+ shown.add(i.getKey());
41033
+ }
40975
41034
  }
40976
- if (this.inRange(i, params.range) === false) {
40977
- continue;
41035
+ for (const alternative of i.getAlternativeFixes() || []) {
41036
+ if (this.inRange(i, params.range) === true) {
41037
+ ret.push({
41038
+ title: alternative.description,
41039
+ kind: LServer.CodeActionKind.QuickFix,
41040
+ diagnostics: [diagnostics_1.Diagnostics.mapDiagnostic(i)],
41041
+ isPreferred: true,
41042
+ edit: _edit_1.LSPEdit.mapEdit(alternative.edit),
41043
+ });
41044
+ shown.add(i.getKey());
41045
+ }
40978
41046
  }
40979
- ret.push({
40980
- title: "Apply fix, " + i.getKey(),
40981
- kind: LServer.CodeActionKind.QuickFix,
40982
- diagnostics: [diagnostics_1.Diagnostics.mapDiagnostic(i)],
40983
- isPreferred: true,
40984
- edit: _edit_1.LSPEdit.mapEdit(fix),
40985
- });
40986
- shown.add(i.getKey());
40987
41047
  }
40988
41048
  for (const s of shown) {
40989
41049
  if (totals[s] > 1) {
@@ -40998,7 +41058,7 @@ class CodeActions {
40998
41058
  const diagnostics = [];
40999
41059
  const fixes = [];
41000
41060
  for (const i of issues) {
41001
- const fix = i.getFix();
41061
+ const fix = i.getDefaultFix();
41002
41062
  if (fix === undefined) {
41003
41063
  continue;
41004
41064
  }
@@ -44793,15 +44853,42 @@ class EnhancementImplementation extends _abstract_object_1.AbstractObject {
44793
44853
  getType() {
44794
44854
  return "ENHO";
44795
44855
  }
44856
+ setDirty() {
44857
+ this.parsedXML = undefined;
44858
+ super.setDirty();
44859
+ }
44796
44860
  getAllowedNaming() {
44797
44861
  return {
44798
44862
  maxLength: 30,
44799
44863
  allowNamespace: true,
44800
44864
  };
44801
44865
  }
44866
+ getClassName() {
44867
+ var _a;
44868
+ this.parse();
44869
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.className;
44870
+ }
44802
44871
  getDescription() {
44803
- // todo
44804
- return undefined;
44872
+ var _a;
44873
+ this.parse();
44874
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.description;
44875
+ }
44876
+ parse() {
44877
+ if (this.parsedXML) {
44878
+ return { updated: false, runtime: 0 };
44879
+ }
44880
+ const start = Date.now();
44881
+ this.parsedXML = {};
44882
+ const parsed = super.parseRaw2();
44883
+ if (parsed === undefined
44884
+ || parsed.abapGit === undefined
44885
+ || parsed.abapGit["asx:abap"]["asx:values"] === undefined) {
44886
+ return { updated: false, runtime: 0 };
44887
+ }
44888
+ this.parsedXML.className = parsed.abapGit["asx:abap"]["asx:values"].CLASS;
44889
+ this.parsedXML.description = parsed.abapGit["asx:abap"]["asx:values"].SHORTTEXT;
44890
+ const end = Date.now();
44891
+ return { updated: true, runtime: end - start };
44805
44892
  }
44806
44893
  }
44807
44894
  exports.EnhancementImplementation = EnhancementImplementation;
@@ -44941,6 +45028,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
44941
45028
  exports.ExtensionIndex = void 0;
44942
45029
  const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "./node_modules/@abaplint/core/build/src/objects/_abstract_object.js");
44943
45030
  class ExtensionIndex extends _abstract_object_1.AbstractObject {
45031
+ constructor() {
45032
+ super(...arguments);
45033
+ this.parsedXML = undefined;
45034
+ }
44944
45035
  getType() {
44945
45036
  return "XINX";
44946
45037
  }
@@ -44950,9 +45041,38 @@ class ExtensionIndex extends _abstract_object_1.AbstractObject {
44950
45041
  allowNamespace: true,
44951
45042
  };
44952
45043
  }
45044
+ setDirty() {
45045
+ this.parsedXML = undefined;
45046
+ super.setDirty();
45047
+ }
44953
45048
  getDescription() {
44954
- // todo
44955
- return undefined;
45049
+ var _a;
45050
+ this.parse();
45051
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.ddtext;
45052
+ }
45053
+ getTableName() {
45054
+ var _a;
45055
+ this.parse();
45056
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.sqltab;
45057
+ }
45058
+ parse() {
45059
+ var _a, _b, _c, _d, _e;
45060
+ if (this.parsedXML !== undefined) {
45061
+ return { updated: false, runtime: 0 };
45062
+ }
45063
+ const start = Date.now();
45064
+ this.parsedXML = {};
45065
+ const parsed = super.parseRaw2();
45066
+ if (parsed === undefined) {
45067
+ return { updated: false, runtime: 0 };
45068
+ }
45069
+ const xinx = (_c = (_b = (_a = parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]) === null || _b === void 0 ? void 0 : _b["asx:values"]) === null || _c === void 0 ? void 0 : _c.XINX;
45070
+ this.parsedXML = {
45071
+ sqltab: (_d = xinx === null || xinx === void 0 ? void 0 : xinx.DD12V) === null || _d === void 0 ? void 0 : _d.SQLTAB,
45072
+ ddtext: (_e = xinx === null || xinx === void 0 ? void 0 : xinx.DD12V) === null || _e === void 0 ? void 0 : _e.DDTEXT,
45073
+ };
45074
+ const end = Date.now();
45075
+ return { updated: true, runtime: end - start };
44956
45076
  }
44957
45077
  }
44958
45078
  exports.ExtensionIndex = ExtensionIndex;
@@ -48910,12 +49030,14 @@ class Table extends _abstract_object_1.AbstractObject {
48910
49030
  }
48911
49031
  getAllowedNaming() {
48912
49032
  let length = 30;
49033
+ const regex = /^((\/[A-Z_\d]{3,8}\/)|[a-zA-Z0-9]{3})\w+$/;
48913
49034
  if (this.getTableCategory() === TableCategory.Transparent) {
48914
49035
  length = 16;
48915
49036
  }
48916
49037
  return {
48917
49038
  maxLength: length,
48918
49039
  allowNamespace: true,
49040
+ customRegex: regex,
48919
49041
  };
48920
49042
  }
48921
49043
  setDirty() {
@@ -49427,15 +49549,43 @@ class Transaction extends _abstract_object_1.AbstractObject {
49427
49549
  getType() {
49428
49550
  return "TRAN";
49429
49551
  }
49552
+ setDirty() {
49553
+ this.parsedXML = undefined;
49554
+ super.setDirty();
49555
+ }
49430
49556
  getAllowedNaming() {
49431
49557
  return {
49432
49558
  maxLength: 20,
49433
49559
  allowNamespace: true,
49434
49560
  };
49435
49561
  }
49562
+ getProgramName() {
49563
+ var _a;
49564
+ this.parse();
49565
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.programName;
49566
+ }
49436
49567
  getDescription() {
49437
- // todo
49438
- return undefined;
49568
+ var _a;
49569
+ this.parse();
49570
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.description;
49571
+ }
49572
+ parse() {
49573
+ var _a, _b;
49574
+ if (this.parsedXML) {
49575
+ return { updated: false, runtime: 0 };
49576
+ }
49577
+ const start = Date.now();
49578
+ this.parsedXML = {};
49579
+ const parsed = super.parseRaw2();
49580
+ if (parsed === undefined
49581
+ || parsed.abapGit === undefined
49582
+ || parsed.abapGit["asx:abap"]["asx:values"] === undefined) {
49583
+ return { updated: false, runtime: 0 };
49584
+ }
49585
+ this.parsedXML.description = (_a = parsed.abapGit["asx:abap"]["asx:values"].TSTCT) === null || _a === void 0 ? void 0 : _a.TTEXT;
49586
+ this.parsedXML.programName = (_b = parsed.abapGit["asx:abap"]["asx:values"].TSTC) === null || _b === void 0 ? void 0 : _b.PGMNA;
49587
+ const end = Date.now();
49588
+ return { updated: true, runtime: end - start };
49439
49589
  }
49440
49590
  }
49441
49591
  exports.Transaction = Transaction;
@@ -50383,7 +50533,7 @@ class Registry {
50383
50533
  }
50384
50534
  static abaplintVersion() {
50385
50535
  // magic, see build script "version.sh"
50386
- return "2.106.5";
50536
+ return "2.108.8";
50387
50537
  }
50388
50538
  getDDICReferences() {
50389
50539
  return this.ddicReferences;
@@ -50705,6 +50855,8 @@ https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abencharacter_set_gui
50705
50855
 
50706
50856
  Checkes files with extensions ".abap" and ".asddls"`,
50707
50857
  tags: [_irule_1.RuleTag.SingleFile],
50858
+ badExample: `WRITE '뽑'.`,
50859
+ goodExample: `WRITE cl_abap_conv_in_ce=>uccp( 'BF51' ).`,
50708
50860
  };
50709
50861
  }
50710
50862
  initialize(_reg) {
@@ -51401,6 +51553,273 @@ exports.AlignParameters = AlignParameters;
51401
51553
 
51402
51554
  /***/ }),
51403
51555
 
51556
+ /***/ "./node_modules/@abaplint/core/build/src/rules/align_pseudo_comments.js":
51557
+ /*!******************************************************************************!*\
51558
+ !*** ./node_modules/@abaplint/core/build/src/rules/align_pseudo_comments.js ***!
51559
+ \******************************************************************************/
51560
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
51561
+
51562
+ "use strict";
51563
+
51564
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
51565
+ exports.AlignPseudoComments = exports.AlignPseudoCommentsConf = void 0;
51566
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
51567
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
51568
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
51569
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
51570
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
51571
+ const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
51572
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
51573
+ class AlignPseudoCommentsConf extends _basic_rule_config_1.BasicRuleConfig {
51574
+ }
51575
+ exports.AlignPseudoCommentsConf = AlignPseudoCommentsConf;
51576
+ class AlignPseudoComments extends _abap_rule_1.ABAPRule {
51577
+ constructor() {
51578
+ super(...arguments);
51579
+ this.conf = new AlignPseudoCommentsConf();
51580
+ }
51581
+ getMetadata() {
51582
+ return {
51583
+ key: "align_pseudo_comments",
51584
+ title: "Align pseudo comments",
51585
+ shortDescription: `Align code inspector pseudo comments in statements`,
51586
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix],
51587
+ badExample: `WRITE 'sdf'. "#EC sdf`,
51588
+ goodExample: `WRITE 'sdf'. "#EC sdf`,
51589
+ };
51590
+ }
51591
+ getConfig() {
51592
+ return this.conf;
51593
+ }
51594
+ setConfig(conf) {
51595
+ this.conf = conf;
51596
+ }
51597
+ runParsed(file) {
51598
+ const issues = [];
51599
+ let previousEnd = undefined;
51600
+ for (const statement of file.getStatements()) {
51601
+ if (!(statement.get() instanceof _statement_1.Comment)) {
51602
+ previousEnd = statement.getLastToken().getEnd();
51603
+ continue;
51604
+ }
51605
+ const commentLength = statement.concatTokens().length;
51606
+ const firstCommentToken = statement.getFirstToken();
51607
+ if (firstCommentToken.getStr().startsWith(`"#`) === false) {
51608
+ continue;
51609
+ }
51610
+ else if (previousEnd === undefined) {
51611
+ continue;
51612
+ }
51613
+ let expectedColumn = 61;
51614
+ if (commentLength > 10) {
51615
+ expectedColumn = 72 - commentLength;
51616
+ }
51617
+ const col = firstCommentToken.getStart().getCol();
51618
+ if (previousEnd.getCol() < expectedColumn && col !== expectedColumn) {
51619
+ let fix = undefined;
51620
+ if (col < expectedColumn) {
51621
+ fix = edit_helper_1.EditHelper.insertAt(file, firstCommentToken.getStart(), " ".repeat(expectedColumn - col));
51622
+ }
51623
+ else {
51624
+ const from = new position_1.Position(firstCommentToken.getStart().getRow(), expectedColumn);
51625
+ fix = edit_helper_1.EditHelper.deleteRange(file, from, firstCommentToken.getStart());
51626
+ }
51627
+ const message = "Align pseudo comment to column " + expectedColumn;
51628
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));
51629
+ }
51630
+ }
51631
+ return issues;
51632
+ }
51633
+ }
51634
+ exports.AlignPseudoComments = AlignPseudoComments;
51635
+ //# sourceMappingURL=align_pseudo_comments.js.map
51636
+
51637
+ /***/ }),
51638
+
51639
+ /***/ "./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js":
51640
+ /*!*******************************************************************************!*\
51641
+ !*** ./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js ***!
51642
+ \*******************************************************************************/
51643
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
51644
+
51645
+ "use strict";
51646
+
51647
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
51648
+ exports.AlignTypeExpressions = exports.AlignTypeExpressionsConf = void 0;
51649
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
51650
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
51651
+ const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
51652
+ const ddic_1 = __webpack_require__(/*! ../ddic */ "./node_modules/@abaplint/core/build/src/ddic.js");
51653
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
51654
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
51655
+ const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
51656
+ const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
51657
+ const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
51658
+ const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
51659
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
51660
+ class AlignTypeExpressionsConf extends _basic_rule_config_1.BasicRuleConfig {
51661
+ constructor() {
51662
+ super(...arguments);
51663
+ /** Ignore global exception classes */
51664
+ this.ignoreExceptions = true;
51665
+ }
51666
+ }
51667
+ exports.AlignTypeExpressionsConf = AlignTypeExpressionsConf;
51668
+ class AlignTypeExpressions extends _abap_rule_1.ABAPRule {
51669
+ constructor() {
51670
+ super(...arguments);
51671
+ this.conf = new AlignTypeExpressionsConf();
51672
+ }
51673
+ getMetadata() {
51674
+ return {
51675
+ key: "align_type_expressions",
51676
+ title: "Align TYPE expressions",
51677
+ shortDescription: `Align TYPE expressions in statements`,
51678
+ extendedInformation: `
51679
+ Currently works for METHODS + BEGIN OF
51680
+
51681
+ If BEGIN OF has an INCLUDE TYPE its ignored
51682
+
51683
+ Also note that clean ABAP does not recommend aligning TYPE clauses:
51684
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-align-type-clauses`,
51685
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix],
51686
+ badExample: `
51687
+ TYPES: BEGIN OF foo,
51688
+ bar TYPE i,
51689
+ foobar TYPE i,
51690
+ END OF foo.
51691
+
51692
+ INTERFACE lif.
51693
+ METHODS bar
51694
+ IMPORTING
51695
+ foo TYPE i
51696
+ foobar TYPE i.
51697
+ ENDINTERFACE.`,
51698
+ goodExample: `
51699
+ TYPES: BEGIN OF foo,
51700
+ bar TYPE i,
51701
+ foobar TYPE i,
51702
+ END OF foo.
51703
+
51704
+ INTERFACE lif.
51705
+ METHODS bar
51706
+ IMPORTING
51707
+ foo TYPE i
51708
+ foobar TYPE i.
51709
+ ENDINTERFACE.`,
51710
+ };
51711
+ }
51712
+ getConfig() {
51713
+ return this.conf;
51714
+ }
51715
+ setConfig(conf) {
51716
+ this.conf = conf;
51717
+ }
51718
+ runParsed(file, obj) {
51719
+ const issues = [];
51720
+ const stru = file.getStructure();
51721
+ if (stru === undefined) {
51722
+ return issues; // parser error
51723
+ }
51724
+ const ddic = new ddic_1.DDIC(this.reg);
51725
+ if (obj instanceof objects_1.Class) {
51726
+ const definition = obj.getClassDefinition();
51727
+ if (definition === undefined) {
51728
+ return [];
51729
+ }
51730
+ else if (this.conf.ignoreExceptions && ddic.isException(definition, obj)) {
51731
+ return [];
51732
+ }
51733
+ }
51734
+ issues.push(...this.checkTypes(stru, file));
51735
+ issues.push(...this.checkMethods(stru, file));
51736
+ return issues;
51737
+ }
51738
+ check(fields, column, file) {
51739
+ const issues = [];
51740
+ const rows = new Set();
51741
+ for (const f of fields) {
51742
+ const row = f.after.getRow();
51743
+ if (rows.has(row)) {
51744
+ return [];
51745
+ }
51746
+ rows.add(row);
51747
+ }
51748
+ for (const f of fields) {
51749
+ if (f.after.getCol() === column) {
51750
+ continue;
51751
+ }
51752
+ let fix = undefined;
51753
+ if (f.after.getCol() < column) {
51754
+ fix = edit_helper_1.EditHelper.insertAt(file, f.after, " ".repeat(column - f.after.getCol()));
51755
+ }
51756
+ else {
51757
+ fix = edit_helper_1.EditHelper.deleteRange(file, new position_1.Position(f.after.getRow(), column), f.after);
51758
+ }
51759
+ const message = `Align TYPE expressions to column ${column}`;
51760
+ const issue = issue_1.Issue.atPosition(file, f.after, message, this.getMetadata().key, this.conf.severity, fix);
51761
+ issues.push(issue);
51762
+ }
51763
+ return issues;
51764
+ }
51765
+ checkMethods(stru, file) {
51766
+ const issues = [];
51767
+ const methods = stru.findAllStatements(Statements.MethodDef);
51768
+ for (const m of methods) {
51769
+ const fields = [];
51770
+ const params = m.findAllExpressions(Expressions.MethodParam);
51771
+ let column = 0;
51772
+ for (const p of params) {
51773
+ const children = p.getChildren();
51774
+ const name = children[children.length - 2];
51775
+ fields.push({
51776
+ nameEnd: name.getLastToken().getEnd(),
51777
+ after: p.findFirstExpression(Expressions.TypeParam).getFirstToken().getStart()
51778
+ });
51779
+ column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
51780
+ }
51781
+ const ret = m.findFirstExpression(Expressions.MethodDefReturning);
51782
+ if (ret) {
51783
+ const children = ret.getChildren();
51784
+ const name = children[children.length - 2];
51785
+ fields.push({
51786
+ nameEnd: name.getLastToken().getEnd(),
51787
+ after: ret.findFirstExpression(Expressions.TypeParam).getFirstToken().getStart()
51788
+ });
51789
+ column = Math.max(column, name.getLastToken().getEnd().getCol() + 1);
51790
+ }
51791
+ issues.push(...this.check(fields, column, file));
51792
+ }
51793
+ return issues;
51794
+ }
51795
+ checkTypes(stru, file) {
51796
+ const issues = [];
51797
+ const types = stru.findAllStructuresRecursive(Structures.Types);
51798
+ for (const t of types) {
51799
+ if (t.findDirectStatement(Statements.IncludeType)) {
51800
+ continue;
51801
+ }
51802
+ const fields = [];
51803
+ let column = 0;
51804
+ const st = t.findDirectStatements(Statements.Type);
51805
+ for (const s of st) {
51806
+ const name = s.getChildren()[1];
51807
+ fields.push({
51808
+ nameEnd: name.getLastToken().getEnd(),
51809
+ after: s.getChildren()[2].getFirstToken().getStart()
51810
+ });
51811
+ column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
51812
+ }
51813
+ issues.push(...this.check(fields, column, file));
51814
+ }
51815
+ return issues;
51816
+ }
51817
+ }
51818
+ exports.AlignTypeExpressions = AlignTypeExpressions;
51819
+ //# sourceMappingURL=align_type_expressions.js.map
51820
+
51821
+ /***/ }),
51822
+
51404
51823
  /***/ "./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js":
51405
51824
  /*!******************************************************************************!*\
51406
51825
  !*** ./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js ***!
@@ -51932,7 +52351,8 @@ STATICS BEGIN OF bar.
51932
52351
  INCLUDE STRUCTURE syst.
51933
52352
  STATICS END OF bar.`,
51934
52353
  goodExample: `DATA BEGIN OF foo.
51935
- INCLUDE STRUCTURE dselc.
52354
+ DATA field TYPE i.
52355
+ INCLUDE STRUCTURE dselc.
51936
52356
  DATA END OF foo.`,
51937
52357
  };
51938
52358
  }
@@ -52413,7 +52833,7 @@ https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenchained_statement
52413
52833
  }
52414
52834
  let prevFix;
52415
52835
  if (previousRow === colon.getStart().getRow()) {
52416
- prevFix = (_a = issues.pop()) === null || _a === void 0 ? void 0 : _a.getFix();
52836
+ prevFix = (_a = issues.pop()) === null || _a === void 0 ? void 0 : _a.getDefaultFix();
52417
52837
  }
52418
52838
  const fix = this.getFix(file, statement, statementNode, prevFix);
52419
52839
  const message = "Chain mainly declarations";
@@ -52942,6 +53362,7 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
52942
53362
  const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
52943
53363
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
52944
53364
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
53365
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
52945
53366
  class CheckSubrcConf extends _basic_rule_config_1.BasicRuleConfig {
52946
53367
  constructor() {
52947
53368
  super(...arguments);
@@ -52988,6 +53409,12 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
52988
53409
  setConfig(conf) {
52989
53410
  this.conf = conf;
52990
53411
  }
53412
+ buildFix(file, statement) {
53413
+ return {
53414
+ description: "Add ##SUBRC_OK",
53415
+ edit: edit_helper_1.EditHelper.insertAt(file, statement.getLastToken().getStart(), " ##SUBRC_OK"),
53416
+ };
53417
+ }
52991
53418
  runParsed(file) {
52992
53419
  const issues = [];
52993
53420
  const statements = file.getStatements();
@@ -53002,11 +53429,13 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
53002
53429
  if (config.openDataset === true
53003
53430
  && statement.get() instanceof Statements.OpenDataset
53004
53431
  && this.isChecked(i, statements) === false) {
53432
+ // it doesnt make sense to ignore the subrc for open dataset, so no quick fix
53005
53433
  issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
53006
53434
  }
53007
53435
  else if (config.authorityCheck === true
53008
53436
  && statement.get() instanceof Statements.AuthorityCheck
53009
53437
  && this.isChecked(i, statements) === false) {
53438
+ // it doesnt make sense to ignore the subrc for authority checks, so no quick fix
53010
53439
  issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
53011
53440
  }
53012
53441
  else if (config.selectSingle === true
@@ -53018,7 +53447,8 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
53018
53447
  if (concat.startsWith("SELECT SINGLE @ABAP_TRUE FROM ")) {
53019
53448
  continue;
53020
53449
  }
53021
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
53450
+ const fix = this.buildFix(file, statement);
53451
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
53022
53452
  }
53023
53453
  else if (config.selectTable === true
53024
53454
  && statement.get() instanceof Statements.Select
@@ -53027,42 +53457,49 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
53027
53457
  && statement.concatTokens().toUpperCase().startsWith("SELECT COUNT(*) ") === false
53028
53458
  && this.isChecked(i, statements) === false
53029
53459
  && this.checksDbcnt(i, statements) === false) {
53030
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
53460
+ const fix = this.buildFix(file, statement);
53461
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
53031
53462
  }
53032
53463
  else if (config.updateDatabase === true
53033
53464
  && statement.get() instanceof Statements.UpdateDatabase
53034
53465
  && this.isChecked(i, statements) === false
53035
53466
  && this.checksDbcnt(i, statements) === false) {
53036
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
53467
+ const fix = this.buildFix(file, statement);
53468
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
53037
53469
  }
53038
53470
  else if (config.insertDatabase === true
53039
53471
  && statement.get() instanceof Statements.InsertDatabase
53040
53472
  && this.isChecked(i, statements) === false
53041
53473
  && this.checksDbcnt(i, statements) === false) {
53042
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
53474
+ const fix = this.buildFix(file, statement);
53475
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
53043
53476
  }
53044
53477
  else if (config.modifyDatabase === true
53045
53478
  && statement.get() instanceof Statements.ModifyDatabase
53046
53479
  && this.isChecked(i, statements) === false
53047
53480
  && this.checksDbcnt(i, statements) === false) {
53048
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
53481
+ const fix = this.buildFix(file, statement);
53482
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
53049
53483
  }
53050
53484
  else if (config.readTable === true
53051
53485
  && statement.get() instanceof Statements.ReadTable
53052
53486
  && this.isChecked(i, statements) === false) {
53053
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
53487
+ const fix = this.buildFix(file, statement);
53488
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
53054
53489
  }
53055
53490
  else if (config.assign === true
53056
53491
  && statement.get() instanceof Statements.Assign
53057
53492
  && this.isSimpleAssign(statement) === false
53058
53493
  && this.isChecked(i, statements) === false) {
53059
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
53494
+ const fix = this.buildFix(file, statement);
53495
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
53060
53496
  }
53061
53497
  else if (config.find === true
53062
53498
  && statement.get() instanceof Statements.Find
53063
53499
  && this.isExemptedFind(statement) === false
53064
53500
  && this.isChecked(i, statements) === false) {
53065
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
53501
+ const fix = this.buildFix(file, statement);
53502
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
53066
53503
  }
53067
53504
  }
53068
53505
  return issues;
@@ -53787,6 +54224,7 @@ class CommentedCode extends _abap_rule_1.ABAPRule {
53787
54224
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#delete-code-instead-of-commenting-it
53788
54225
  https://docs.abapopenchecks.org/checks/14/`,
53789
54226
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
54227
+ badExample: `* WRITE 'hello world'.`,
53790
54228
  };
53791
54229
  }
53792
54230
  getMessage() {
@@ -54098,6 +54536,8 @@ class ContainsTab extends _abap_rule_1.ABAPRule {
54098
54536
  https://docs.abapopenchecks.org/checks/09/
54099
54537
  https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#indent-and-snap-to-tab`,
54100
54538
  tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
54539
+ badExample: `\tWRITE 'hello world'.`,
54540
+ goodExample: ` WRITE 'hello world'.`,
54101
54541
  };
54102
54542
  }
54103
54543
  getMessage() {
@@ -55567,6 +56007,10 @@ Make sure to test the downported code, it might not always be completely correct
55567
56007
  if (found) {
55568
56008
  return found;
55569
56009
  }
56010
+ found = this.downportMessageSource(high, lowFile, highSyntax);
56011
+ if (found) {
56012
+ return found;
56013
+ }
55570
56014
  found = this.downportMessage(high, lowFile, highSyntax);
55571
56015
  if (found) {
55572
56016
  return found;
@@ -55921,6 +56365,22 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
55921
56365
  }
55922
56366
  return undefined;
55923
56367
  }
56368
+ downportMessageSource(high, lowFile, highSyntax) {
56369
+ if (!(high.get() instanceof Statements.Message)) {
56370
+ return undefined;
56371
+ }
56372
+ const source = high.findExpressionAfterToken("MESSAGE");
56373
+ if ((source === null || source === void 0 ? void 0 : source.get()) instanceof Expressions.Source) {
56374
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
56375
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
56376
+ const firstToken = high.getFirstToken();
56377
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA(${uniqueName}) = ${source.concatTokens()}.\n` + indentation);
56378
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
56379
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
56380
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline message source", this.getMetadata().key, this.conf.severity, fix);
56381
+ }
56382
+ return undefined;
56383
+ }
55924
56384
  replaceInsertExpression(high, lowFile, highSyntax) {
55925
56385
  if (!(high.get() instanceof Statements.InsertInternal)) {
55926
56386
  return undefined;
@@ -58255,6 +58715,8 @@ class EmptyStatement extends _abap_rule_1.ABAPRule {
58255
58715
  title: "Remove empty statement",
58256
58716
  shortDescription: `Checks for empty statements (an empty statement is a single dot)`,
58257
58717
  tags: [_irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
58718
+ badExample: `WRITE 'hello world'..`,
58719
+ goodExample: `WRITE 'hello world'.`,
58258
58720
  };
58259
58721
  }
58260
58722
  getConfig() {
@@ -58305,6 +58767,8 @@ class EmptyStructureConf extends _basic_rule_config_1.BasicRuleConfig {
58305
58767
  super(...arguments);
58306
58768
  /** Checks for empty LOOP blocks */
58307
58769
  this.loop = true;
58770
+ /** Allow empty LOOP if subrc is checked after the loop */
58771
+ this.loopAllowIfSubrc = true;
58308
58772
  /** Checks for empty IF blocks */
58309
58773
  this.if = true;
58310
58774
  /** Checks for empty WHILE blocks */
@@ -58337,6 +58801,14 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
58337
58801
  shortDescription: `Checks that the code does not contain empty blocks.`,
58338
58802
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#no-empty-if-branches`,
58339
58803
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
58804
+ badExample: `IF foo = bar.
58805
+ ENDIF.
58806
+
58807
+ DO 2 TIMES.
58808
+ ENDDO.`,
58809
+ goodExample: `LOOP AT itab WHERE qty = 0 OR date > sy-datum.
58810
+ ENDLOOP.
58811
+ result = xsdbool( sy-subrc = 0 ).`,
58340
58812
  };
58341
58813
  }
58342
58814
  getDescription(name) {
@@ -58354,15 +58826,13 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
58354
58826
  if (stru === undefined) {
58355
58827
  return [];
58356
58828
  }
58357
- for (const statement of file.getStatements()) {
58829
+ const statements = file.getStatements();
58830
+ for (const statement of statements) {
58358
58831
  if (statement.get() instanceof _statement_1.Unknown) {
58359
58832
  return []; // contains parser errors
58360
58833
  }
58361
58834
  }
58362
58835
  const candidates = [];
58363
- if (this.getConfig().loop === true) {
58364
- candidates.push(...stru.findAllStructuresRecursive(Structures.Loop));
58365
- }
58366
58836
  if (this.getConfig().while === true) {
58367
58837
  candidates.push(...stru.findAllStructuresRecursive(Structures.While));
58368
58838
  }
@@ -58398,6 +58868,22 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
58398
58868
  }
58399
58869
  }
58400
58870
  }
58871
+ if (this.getConfig().loop === true) {
58872
+ const loops = stru.findAllStructuresRecursive(Structures.Loop);
58873
+ for (const loop of loops) {
58874
+ if (loop.getChildren().length === 2) {
58875
+ const endloopStatement = loop.getLastChild();
58876
+ const endloopIndex = statements.findIndex((s) => s === endloopStatement);
58877
+ const afterEndloop = statements[endloopIndex + 1];
58878
+ if (afterEndloop !== undefined && afterEndloop.concatTokens().toUpperCase().includes("SY-SUBRC")) {
58879
+ continue;
58880
+ }
58881
+ const token = loop.getFirstToken();
58882
+ const issue = issue_1.Issue.atToken(file, token, this.getDescription(loop.get().constructor.name), this.getMetadata().key, this.conf.severity);
58883
+ issues.push(issue);
58884
+ }
58885
+ }
58886
+ }
58401
58887
  if (this.getConfig().if === true) {
58402
58888
  const tries = stru.findAllStructuresRecursive(Structures.If)
58403
58889
  .concat(stru.findAllStructuresRecursive(Structures.Else))
@@ -60643,6 +61129,24 @@ class Indentation extends _abap_rule_1.ABAPRule {
60643
61129
  title: "Indentation",
60644
61130
  shortDescription: `Checks indentation`,
60645
61131
  tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
61132
+ badExample: `CLASS lcl DEFINITION.
61133
+ PRIVATE SECTION.
61134
+ METHODS constructor.
61135
+ ENDCLASS.
61136
+
61137
+ CLASS lcl IMPLEMENTATION.
61138
+ METHOD constructor.
61139
+ ENDMETHOD.
61140
+ ENDCLASS.`,
61141
+ goodExample: `CLASS lcl DEFINITION.
61142
+ PRIVATE SECTION.
61143
+ METHODS constructor.
61144
+ ENDCLASS.
61145
+
61146
+ CLASS lcl IMPLEMENTATION.
61147
+ METHOD constructor.
61148
+ ENDMETHOD.
61149
+ ENDCLASS.`,
60646
61150
  };
60647
61151
  }
60648
61152
  getConfig() {
@@ -60754,6 +61258,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
60754
61258
  __exportStar(__webpack_require__(/*! ./7bit_ascii */ "./node_modules/@abaplint/core/build/src/rules/7bit_ascii.js"), exports);
60755
61259
  __exportStar(__webpack_require__(/*! ./abapdoc */ "./node_modules/@abaplint/core/build/src/rules/abapdoc.js"), exports);
60756
61260
  __exportStar(__webpack_require__(/*! ./align_parameters */ "./node_modules/@abaplint/core/build/src/rules/align_parameters.js"), exports);
61261
+ __exportStar(__webpack_require__(/*! ./align_pseudo_comments */ "./node_modules/@abaplint/core/build/src/rules/align_pseudo_comments.js"), exports);
61262
+ __exportStar(__webpack_require__(/*! ./align_type_expressions */ "./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js"), exports);
60757
61263
  __exportStar(__webpack_require__(/*! ./allowed_object_naming */ "./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js"), exports);
60758
61264
  __exportStar(__webpack_require__(/*! ./allowed_object_types */ "./node_modules/@abaplint/core/build/src/rules/allowed_object_types.js"), exports);
60759
61265
  __exportStar(__webpack_require__(/*! ./ambiguous_statement */ "./node_modules/@abaplint/core/build/src/rules/ambiguous_statement.js"), exports);
@@ -61455,6 +61961,8 @@ class KeywordCase extends _abap_rule_1.ABAPRule {
61455
61961
  shortDescription: `Checks that keywords have the same case. Non-keywords must be lower case.`,
61456
61962
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-your-pretty-printer-team-settings`,
61457
61963
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
61964
+ badExample: `write 'hello world'.`,
61965
+ goodExample: `WRITE 'hello world'.`,
61458
61966
  };
61459
61967
  }
61460
61968
  getConfig() {
@@ -61542,8 +62050,11 @@ class KeywordCase extends _abap_rule_1.ABAPRule {
61542
62050
  /** returns a list of tokens which violates the keyword_case rule */
61543
62051
  traverse(s, parent) {
61544
62052
  let ret = [];
61545
- for (const child of s.getChildren()) {
62053
+ const children = s.getChildren();
62054
+ for (let i = 0; i < children.length; i++) {
62055
+ const child = children[i];
61546
62056
  if (child instanceof nodes_1.TokenNodeRegex) {
62057
+ const next = children[i + 1];
61547
62058
  if (this.conf.ignoreLowerClassImplmentationStatement
61548
62059
  && parent instanceof Statements.ClassImplementation) {
61549
62060
  continue;
@@ -61551,7 +62062,7 @@ class KeywordCase extends _abap_rule_1.ABAPRule {
61551
62062
  const str = child.get().getStr();
61552
62063
  const upper = str.toUpperCase();
61553
62064
  // todo, this is a hack, the parser should recongize OTHERS/TEXT as a keyword
61554
- if (upper === "OTHERS" || upper === "TEXT") {
62065
+ if (upper === "OTHERS" || (upper === "TEXT" && (next === null || next === void 0 ? void 0 : next.concatTokens()) === "-")) {
61555
62066
  continue;
61556
62067
  }
61557
62068
  if (this.conf.ignoreFunctionModuleName === true
@@ -62116,6 +62627,12 @@ class LocalVariableNames extends _abap_rule_1.ABAPRule {
62116
62627
  Allows you to enforce a pattern, such as a prefix, for local variables, constants and field symbols.
62117
62628
  Regexes are case-insensitive.`,
62118
62629
  tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],
62630
+ badExample: `FORM bar.
62631
+ DATA foo.
62632
+ ENDFORM.`,
62633
+ goodExample: `FORM bar.
62634
+ DATA lv_foo.
62635
+ ENDFORM.`,
62119
62636
  };
62120
62637
  }
62121
62638
  getDescription(expected, actual) {
@@ -63089,6 +63606,15 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obscu
63089
63606
 
63090
63607
  Interface method names are ignored`,
63091
63608
  tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
63609
+ badExample: `CLASS lcl DEFINITION.
63610
+ PUBLIC SECTION.
63611
+ METHODS matches.
63612
+ ENDCLASS.
63613
+
63614
+ CLASS lcl IMPLEMENTATION.
63615
+ METHOD matches.
63616
+ ENDMETHOD.
63617
+ ENDCLASS.`,
63092
63618
  };
63093
63619
  }
63094
63620
  getConfig() {
@@ -63278,6 +63804,13 @@ class MixReturning extends _abap_rule_1.ABAPRule {
63278
63804
  // eslint-disable-next-line max-len
63279
63805
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-either-returning-or-exporting-or-changing-but-not-a-combination`,
63280
63806
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
63807
+ badExample: `CLASS lcl DEFINITION.
63808
+ PUBLIC SECTION.
63809
+ METHODS
63810
+ foobar
63811
+ EXPORTING foo TYPE i
63812
+ RETURNING VALUE(rv_string) TYPE string.
63813
+ ENDCLASS.`,
63281
63814
  };
63282
63815
  }
63283
63816
  getMessage() {
@@ -64109,6 +64642,7 @@ class NoPrefixesConf extends _basic_rule_config_1.BasicRuleConfig {
64109
64642
  this.types = "^TY_";
64110
64643
  /** importing, exporting, returning and changing parameters, case insensitive regex */
64111
64644
  this.methodParameters = "^[ICER].?_";
64645
+ this.allowIsPrefixBoolean = true;
64112
64646
  // todo, public localClass: string = "";
64113
64647
  // todo, public localInterface: string = "";
64114
64648
  // todo, public functionModuleParameters: string = "";
@@ -64253,12 +64787,18 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
64253
64787
  return ret;
64254
64788
  }
64255
64789
  checkMethodParameters(topNode, regex, file) {
64790
+ var _a, _b;
64256
64791
  const ret = [];
64257
64792
  for (const method of topNode.findAllStatements(Statements.MethodDef)) {
64258
- for (const def of method.findAllExpressions(Expressions.MethodParamName)) {
64259
- const name = def.concatTokens();
64260
- if (name !== "" && name.match(regex)) {
64261
- const issue = issue_1.Issue.atToken(file, def.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64793
+ for (const param of method.findAllExpressionsMulti([Expressions.MethodDefReturning, Expressions.MethodParam])) {
64794
+ const nameToken = param === null || param === void 0 ? void 0 : param.findFirstExpression(Expressions.MethodParamName);
64795
+ const type = (_b = (_a = param === null || param === void 0 ? void 0 : param.findFirstExpression(Expressions.TypeParam)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === null || _b === void 0 ? void 0 : _b.toUpperCase();
64796
+ if (this.getConfig().allowIsPrefixBoolean === true && (type === null || type === void 0 ? void 0 : type.endsWith("TYPE ABAP_BOOL"))) {
64797
+ continue;
64798
+ }
64799
+ const name = nameToken === null || nameToken === void 0 ? void 0 : nameToken.concatTokens();
64800
+ if (nameToken && name && name !== "" && name.match(regex)) {
64801
+ const issue = issue_1.Issue.atToken(file, nameToken.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64262
64802
  ret.push(issue);
64263
64803
  }
64264
64804
  }
@@ -66567,6 +67107,10 @@ class PreferReturningToExporting extends _abap_rule_1.ABAPRule {
66567
67107
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-returning-to-exporting
66568
67108
  https://docs.abapopenchecks.org/checks/44/`,
66569
67109
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
67110
+ badExample: `CLASS lcl DEFINITION.
67111
+ PUBLIC SECTION.
67112
+ METHODS test EXPORTING ev_foo TYPE i.
67113
+ ENDCLASS.`,
66570
67114
  };
66571
67115
  }
66572
67116
  getConfig() {
@@ -66734,6 +67278,10 @@ class PreferredCompareOperator extends _abap_rule_1.ABAPRule {
66734
67278
  title: "Preferred compare operator",
66735
67279
  shortDescription: `Configure undesired operator variants`,
66736
67280
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
67281
+ badExample: `IF foo EQ bar.
67282
+ ENDIF.`,
67283
+ goodExample: `IF foo = bar.
67284
+ ENDIF.`,
66737
67285
  };
66738
67286
  }
66739
67287
  getDescription(operator) {
@@ -67447,6 +67995,8 @@ add ORDER BY PRIMARY KEY if in doubt
67447
67995
 
67448
67996
  If the target is a sorted/hashed table, no issue is reported`,
67449
67997
  tags: [_irule_1.RuleTag.SingleFile],
67998
+ badExample: `SELECT * FROM db INTO TABLE @DATA(tab).`,
67999
+ goodExample: `SELECT * FROM db INTO TABLE @DATA(tab) ORDER BY PRIMARY KEY.`,
67450
68000
  };
67451
68001
  }
67452
68002
  getConfig() {
@@ -69464,6 +70014,8 @@ class TypesNaming extends _abap_rule_1.ABAPRule {
69464
70014
  shortDescription: `Allows you to enforce a pattern for TYPES definitions`,
69465
70015
  extendedInformation: `Does not run for TYPE POOLS`,
69466
70016
  tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],
70017
+ badExample: `TYPES foo TYPE i.`,
70018
+ goodExample: `TYPES ty_foo TYPE i.`,
69467
70019
  };
69468
70020
  }
69469
70021
  getConfig() {
@@ -70648,6 +71200,7 @@ Skips:
70648
71200
  `,
70649
71201
  tags: [],
70650
71202
  pragma: "##CALLED",
71203
+ pseudoComment: "EC CALLED",
70651
71204
  };
70652
71205
  }
70653
71206
  getConfig() {
@@ -70724,11 +71277,32 @@ Skips:
70724
71277
  if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {
70725
71278
  continue;
70726
71279
  }
71280
+ else if (this.suppressedbyPseudo(statement, file)) {
71281
+ continue;
71282
+ }
70727
71283
  const message = "Method \"" + i.identifier.getName() + "\" not used";
70728
71284
  issues.push(issue_1.Issue.atIdentifier(i.identifier, message, this.getMetadata().key, this.conf.severity));
70729
71285
  }
70730
71286
  return issues;
70731
71287
  }
71288
+ suppressedbyPseudo(statement, file) {
71289
+ if (statement === undefined) {
71290
+ return false;
71291
+ }
71292
+ if (file === undefined) {
71293
+ return false;
71294
+ }
71295
+ let next = false;
71296
+ for (const s of file.getStatements()) {
71297
+ if (next === true && s.get() instanceof _statement_1.Comment) {
71298
+ return s.concatTokens().includes(this.getMetadata().pseudoComment + "");
71299
+ }
71300
+ if (s === statement) {
71301
+ next = true;
71302
+ }
71303
+ }
71304
+ return false;
71305
+ }
70732
71306
  searchGlobalSubclasses(obj) {
70733
71307
  var _a, _b;
70734
71308
  if (this.wa.getLength() === 0
@@ -70839,6 +71413,7 @@ class UnusedTypes {
70839
71413
  extendedInformation: `Unused types are not reported if the object contains parser or syntax errors.`,
70840
71414
  tags: [_irule_1.RuleTag.Quickfix],
70841
71415
  pragma: "##NEEDED",
71416
+ pseudoComment: "EC NEEDED",
70842
71417
  };
70843
71418
  }
70844
71419
  getConfig() {
@@ -70906,11 +71481,32 @@ class UnusedTypes {
70906
71481
  if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {
70907
71482
  continue;
70908
71483
  }
71484
+ else if (this.suppressedbyPseudo(statement, file)) {
71485
+ continue;
71486
+ }
70909
71487
  const fix = this.buildFix(file, statement);
70910
71488
  ret.push(issue_1.Issue.atIdentifier(t, message, this.getMetadata().key, this.conf.severity, fix));
70911
71489
  }
70912
71490
  return ret;
70913
71491
  }
71492
+ suppressedbyPseudo(statement, file) {
71493
+ if (statement === undefined) {
71494
+ return false;
71495
+ }
71496
+ if (file === undefined) {
71497
+ return false;
71498
+ }
71499
+ let next = false;
71500
+ for (const s of file.getStatements()) {
71501
+ if (next === true && s.get() instanceof _statement_1.Comment) {
71502
+ return s.concatTokens().includes(this.getMetadata().pseudoComment + "");
71503
+ }
71504
+ if (s === statement) {
71505
+ next = true;
71506
+ }
71507
+ }
71508
+ return false;
71509
+ }
70914
71510
  ////////////////////////////
70915
71511
  traverse(node, obj, add) {
70916
71512
  if (node.getIdentifier().stype !== _scope_type_1.ScopeType.BuiltIn) {
@@ -71395,6 +71991,16 @@ class UseClassBasedExceptions extends _abap_rule_1.ABAPRule {
71395
71991
  shortDescription: `Use class based exceptions, checks interface and class definitions`,
71396
71992
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-class-based-exceptions`,
71397
71993
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
71994
+ badExample: `INTERFACE lif.
71995
+ METHODS load_data
71996
+ EXCEPTIONS
71997
+ invalid_parameter.
71998
+ ENDINTERFACE.`,
71999
+ goodExample: `INTERFACE lif.
72000
+ METHODS load_data
72001
+ RAISING
72002
+ cx_something.
72003
+ ENDINTERFACE.`,
71398
72004
  };
71399
72005
  }
71400
72006
  getMessage() {