@abaplint/cli 2.105.16 → 2.105.18

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/cli.js +118 -18
  2. package/package.json +6 -6
package/build/cli.js CHANGED
@@ -7196,7 +7196,7 @@ const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/co
7196
7196
  const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
7197
7197
  class RaiseWith extends combi_1.Expression {
7198
7198
  getRunnable() {
7199
- const wit = (0, combi_1.seq)("WITH", _1.Source, (0, combi_1.opt)(_1.Source), (0, combi_1.opt)(_1.Source), (0, combi_1.opt)(_1.Source));
7199
+ const wit = (0, combi_1.seq)("WITH", _1.SimpleSource3, (0, combi_1.opt)(_1.SimpleSource3), (0, combi_1.opt)(_1.SimpleSource3), (0, combi_1.opt)(_1.SimpleSource3));
7200
7200
  return wit;
7201
7201
  }
7202
7202
  }
@@ -21373,11 +21373,11 @@ class CurrentScope {
21373
21373
  }
21374
21374
  this.addNamedIdentifier(identifier.getName(), identifier);
21375
21375
  }
21376
- addDeferred(token) {
21376
+ addDeferred(token, type) {
21377
21377
  if (token === undefined) {
21378
21378
  return;
21379
21379
  }
21380
- this.current.getData().deferred[token.getStr().toUpperCase()] = token;
21380
+ this.current.getData().deferred[token.getStr().toUpperCase()] = { token, ooType: type };
21381
21381
  }
21382
21382
  addListPrefix(identifiers, prefix) {
21383
21383
  for (const id of identifiers) {
@@ -21482,7 +21482,16 @@ class CurrentScope {
21482
21482
  }
21483
21483
  const def = (_c = this.current) === null || _c === void 0 ? void 0 : _c.findDeferred(name);
21484
21484
  if (def !== undefined) {
21485
- return { id: def };
21485
+ let rttiName = prefixRTTI;
21486
+ switch (def.ooType) {
21487
+ case "INTF":
21488
+ rttiName = rttiName + "\\INTERFACE=" + name;
21489
+ break;
21490
+ default:
21491
+ rttiName = rttiName + "\\CLASS=" + name;
21492
+ break;
21493
+ }
21494
+ return { id: def.id, ooType: def.ooType, RTTIName: rttiName };
21486
21495
  }
21487
21496
  return undefined;
21488
21497
  }
@@ -21512,6 +21521,11 @@ class CurrentScope {
21512
21521
  if (typePoolName.length <= 1 || typePoolName.length > 5) {
21513
21522
  return undefined;
21514
21523
  }
21524
+ if (this.parentObj.getType() === "TYPE"
21525
+ && this.parentObj.getName().toUpperCase() === typePoolName.toUpperCase()) {
21526
+ // dont recurse into itself
21527
+ return undefined;
21528
+ }
21515
21529
  const typePool = this.reg.getObject("TYPE", typePoolName);
21516
21530
  if (typePool === undefined) {
21517
21531
  return undefined;
@@ -21529,6 +21543,11 @@ class CurrentScope {
21529
21543
  if (typePoolName.length <= 2 || typePoolName.length > 5) {
21530
21544
  return undefined;
21531
21545
  }
21546
+ if (this.parentObj.getType() === "TYPE"
21547
+ && this.parentObj.getName().toUpperCase() === typePoolName.toUpperCase()) {
21548
+ // dont recurse into itself
21549
+ return undefined;
21550
+ }
21532
21551
  if (new ddic_1.DDIC(this.reg).lookupNoVoid(name) !== undefined) {
21533
21552
  // this is tricky, it should not do recursion when parsing the type pool itself,
21534
21553
  // think about DTEL ABAP_ENCOD vs TYPE ABAP
@@ -26283,7 +26302,7 @@ const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ ".
26283
26302
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
26284
26303
  class RaiseWith {
26285
26304
  runSyntax(node, scope, filename) {
26286
- for (const f of node.findDirectExpressions(Expressions.Source)) {
26305
+ for (const f of node.findDirectExpressions(Expressions.SimpleSource3)) {
26287
26306
  new source_1.Source().runSyntax(f, scope, filename);
26288
26307
  }
26289
26308
  }
@@ -26743,6 +26762,11 @@ class Source {
26743
26762
  else {
26744
26763
  this.addIfInferred(node, scope, filename, foundType);
26745
26764
  }
26765
+ children.shift();
26766
+ children.shift();
26767
+ children.shift();
26768
+ children.shift();
26769
+ this.traverseRemainingChildren(children, scope, filename);
26746
26770
  return foundType ? foundType : bodyType;
26747
26771
  }
26748
26772
  case "CONV":
@@ -26859,6 +26883,12 @@ class Source {
26859
26883
  return context;
26860
26884
  }
26861
26885
  ////////////////////////////////
26886
+ traverseRemainingChildren(children, scope, filename) {
26887
+ const last = children[children.length - 1];
26888
+ if (last && last.get() instanceof Expressions.Source) {
26889
+ new Source().runSyntax(last, scope, filename);
26890
+ }
26891
+ }
26862
26892
  infer(context, found) {
26863
26893
  if (context instanceof basic_1.FloatType && found instanceof basic_1.IntegerType) {
26864
26894
  return context;
@@ -27880,7 +27910,10 @@ class SpaghettiScopeNode extends ScopeData {
27880
27910
  while (search !== undefined) {
27881
27911
  const found = search.getData().deferred[name.toUpperCase()];
27882
27912
  if (found) {
27883
- return new _identifier_1.Identifier(found, search.identifier.filename);
27913
+ return {
27914
+ id: new _identifier_1.Identifier(found.token, search.identifier.filename),
27915
+ ooType: found.ooType,
27916
+ };
27884
27917
  }
27885
27918
  search = search.getParent();
27886
27919
  }
@@ -28781,7 +28814,7 @@ class ClassDeferred {
28781
28814
  runSyntax(node, scope, _filename) {
28782
28815
  var _a;
28783
28816
  const name = (_a = node.findFirstExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
28784
- scope.addDeferred(name);
28817
+ scope.addDeferred(name, "CLAS");
28785
28818
  }
28786
28819
  }
28787
28820
  exports.ClassDeferred = ClassDeferred;
@@ -30591,7 +30624,7 @@ class InterfaceDeferred {
30591
30624
  runSyntax(node, scope, _filename) {
30592
30625
  var _a;
30593
30626
  const name = (_a = node.findFirstExpression(Expressions.InterfaceName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
30594
- scope.addDeferred(name);
30627
+ scope.addDeferred(name, "INTF");
30595
30628
  }
30596
30629
  }
30597
30630
  exports.InterfaceDeferred = InterfaceDeferred;
@@ -30959,13 +30992,33 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
30959
30992
  const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
30960
30993
  const fstarget_1 = __webpack_require__(/*! ../expressions/fstarget */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/fstarget.js");
30961
30994
  const component_cond_1 = __webpack_require__(/*! ../expressions/component_cond */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_cond.js");
30995
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
30962
30996
  class ModifyInternal {
30963
30997
  runSyntax(node, scope, filename) {
30964
30998
  for (const s of node.findDirectExpressions(Expressions.Source)) {
30965
30999
  new source_1.Source().runSyntax(s, scope, filename);
30966
31000
  }
30967
- for (const t of node.findDirectExpressions(Expressions.Target)) {
30968
- new target_1.Target().runSyntax(t, scope, filename);
31001
+ // there is only one
31002
+ const targetExpression = node.findFirstExpression(Expressions.Target);
31003
+ if (targetExpression) {
31004
+ // it might be a dynamic target
31005
+ const targetType = new target_1.Target().runSyntax(targetExpression, scope, filename);
31006
+ if (targetType instanceof basic_1.VoidType
31007
+ || targetType instanceof basic_1.AnyType
31008
+ || targetType instanceof basic_1.UnknownType) {
31009
+ // ok
31010
+ }
31011
+ else if (targetType instanceof basic_1.TableType) {
31012
+ if (node.findDirectTokenByText("TABLE")
31013
+ && node.findDirectTokenByText("INDEX")
31014
+ && targetType.isWithHeader() === false) {
31015
+ // MODIFY TABLE INDEX
31016
+ throw new Error("Table does not have header line");
31017
+ }
31018
+ }
31019
+ else {
31020
+ throw new Error("Not an internal table");
31021
+ }
30969
31022
  }
30970
31023
  const target = node.findDirectExpression(Expressions.FSTarget);
30971
31024
  if (target) {
@@ -31203,6 +31256,9 @@ class Parameter {
31203
31256
  if (nameToken && nameToken.getStr().length > 8) {
31204
31257
  throw new Error("Parameter name too long, " + nameToken.getStr());
31205
31258
  }
31259
+ if (node.findDirectTokenByText("RADIOBUTTON") && node.findDirectTokenByText("LENGTH")) {
31260
+ throw new Error("RADIOBUTTON and LENGTH not possible together");
31261
+ }
31206
31262
  const bfound = new basic_types_1.BasicTypes(filename, scope).parseType(node);
31207
31263
  if (nameToken && bfound) {
31208
31264
  scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, bfound));
@@ -34519,6 +34575,32 @@ class ExpressionNode extends _abstract_node_1.AbstractNode {
34519
34575
  }
34520
34576
  throw new Error("ExpressionNode, getFirstToken, no children");
34521
34577
  }
34578
+ concatTokensWithLinebreaks() {
34579
+ let str = "";
34580
+ let prev;
34581
+ for (const token of this.getTokens()) {
34582
+ if (token instanceof tokens_1.Pragma) {
34583
+ continue;
34584
+ }
34585
+ if (str === "") {
34586
+ str = token.getStr();
34587
+ }
34588
+ else if (prev && prev.getStr().length + prev.getCol() === token.getCol()
34589
+ && prev.getRow() === token.getRow()) {
34590
+ str = str + token.getStr();
34591
+ }
34592
+ else {
34593
+ if (prev && prev.getRow() !== token.getRow()) {
34594
+ str = str + "\n" + token.getStr();
34595
+ }
34596
+ else {
34597
+ str = str + " " + token.getStr();
34598
+ }
34599
+ }
34600
+ prev = token;
34601
+ }
34602
+ return str;
34603
+ }
34522
34604
  concatTokens() {
34523
34605
  let str = "";
34524
34606
  let prev;
@@ -51167,7 +51249,7 @@ class Registry {
51167
51249
  }
51168
51250
  static abaplintVersion() {
51169
51251
  // magic, see build script "version.sh"
51170
- return "2.105.16";
51252
+ return "2.105.18";
51171
51253
  }
51172
51254
  getDDICReferences() {
51173
51255
  return this.ddicReferences;
@@ -52427,6 +52509,7 @@ const expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions *
52427
52509
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
52428
52510
  const version_1 = __webpack_require__(/*! ../version */ "./node_modules/@abaplint/core/build/src/version.js");
52429
52511
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
52512
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
52430
52513
  class AvoidUseConf extends _basic_rule_config_1.BasicRuleConfig {
52431
52514
  constructor() {
52432
52515
  super(...arguments);
@@ -52436,11 +52519,11 @@ class AvoidUseConf extends _basic_rule_config_1.BasicRuleConfig {
52436
52519
  this.define = true;
52437
52520
  /** Detects statics */
52438
52521
  this.statics = true;
52439
- /** Detects DEFAULT KEY definitions, from version v740sp02 and up */
52522
+ /** Detects DEFAULT KEY definitions, from version v740sp02 and up. Use pseudo comment DEFAULT_KEY to ignore */
52440
52523
  this.defaultKey = true;
52441
52524
  /** Detects BREAK and BREAK-POINTS */
52442
52525
  this.break = true;
52443
- /** Detects TEST SEAMS */
52526
+ /** Detects TEST SEAMS. Use pseudo comment TEST_SEAM_USAGE to ignore */
52444
52527
  this.testSeams = true;
52445
52528
  /** Detects DESCRIBE TABLE LINES, use lines() instead */
52446
52529
  this.describeLines = true;
@@ -52488,7 +52571,9 @@ BREAK points`,
52488
52571
  var _a;
52489
52572
  const issues = [];
52490
52573
  let isStaticsBlock = false;
52491
- for (const statementNode of file.getStatements()) {
52574
+ const statements = file.getStatements();
52575
+ for (let i = 0; i < statements.length; i++) {
52576
+ const statementNode = statements[i];
52492
52577
  const statement = statementNode.get();
52493
52578
  let message = undefined;
52494
52579
  let fix = undefined;
@@ -52516,6 +52601,10 @@ BREAK points`,
52516
52601
  message = "EXPORT TO DATABASE";
52517
52602
  }
52518
52603
  else if (this.conf.testSeams && statement instanceof Statements.TestSeam) {
52604
+ const next = statements[i + 1];
52605
+ if ((next === null || next === void 0 ? void 0 : next.get()) instanceof _statement_1.Comment && next.concatTokens().includes("EC TEST_SEAM_USAGE")) {
52606
+ continue;
52607
+ }
52519
52608
  message = "TEST-SEAM";
52520
52609
  }
52521
52610
  else if (this.conf.statics && statement instanceof Statements.Static && isStaticsBlock === false) {
@@ -52535,6 +52624,10 @@ BREAK points`,
52535
52624
  const tt = (_a = statementNode.findFirstExpression(expressions_1.TypeTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.TypeTableKey);
52536
52625
  const token = tt === null || tt === void 0 ? void 0 : tt.findDirectTokenByText("DEFAULT");
52537
52626
  if (tt && token) {
52627
+ const next = statements[i + 1];
52628
+ if ((next === null || next === void 0 ? void 0 : next.get()) instanceof _statement_1.Comment && next.concatTokens().includes("EC DEFAULT_KEY")) {
52629
+ continue;
52630
+ }
52538
52631
  message = "DEFAULT KEY";
52539
52632
  issues.push(issue_1.Issue.atToken(file, token, this.getDescription(message), this.getMetadata().key, this.conf.severity));
52540
52633
  }
@@ -56966,7 +57059,7 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
56966
57059
  }
56967
57060
  startToken = node.getFirstToken();
56968
57061
  }
56969
- const withs = ((_f = node.findDirectExpression(Expressions.RaiseWith)) === null || _f === void 0 ? void 0 : _f.findDirectExpressions(Expressions.Source)) || [];
57062
+ const withs = ((_f = node.findDirectExpression(Expressions.RaiseWith)) === null || _f === void 0 ? void 0 : _f.findDirectExpressions(Expressions.SimpleSource3)) || [];
56970
57063
  const className = ((_g = node.findDirectExpression(Expressions.ClassName)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || "ERROR";
56971
57064
  const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
56972
57065
  const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
@@ -57354,7 +57447,7 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
57354
57447
  const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
57355
57448
  let code = `CLEAR ${target.concatTokens()}.\n`;
57356
57449
  for (const fieldAssignment of fieldAssignments) {
57357
- code += indentation + target.concatTokens() + "-" + fieldAssignment.concatTokens() + `.\n`;
57450
+ code += indentation + target.concatTokens() + "-" + fieldAssignment.concatTokensWithLinebreaks() + `.\n`;
57358
57451
  }
57359
57452
  code = code.trimEnd();
57360
57453
  const start = high.getFirstToken().getStart();
@@ -58024,7 +58117,7 @@ ${indentation} output = ${uniqueName}.\n`;
58024
58117
  body += data;
58025
58118
  added = true;
58026
58119
  }
58027
- body += indentation + structureName + "-" + b.concatTokens() + ".\n";
58120
+ body += indentation + structureName + "-" + b.concatTokensWithLinebreaks() + ".\n";
58028
58121
  }
58029
58122
  else if (b.get() instanceof Expressions.Source) {
58030
58123
  // note: it wont work with APPEND for Hashed/Sorted Tables, so use INSERT,
@@ -63586,6 +63679,7 @@ exports.MethodImplementedTwice = MethodImplementedTwice;
63586
63679
  Object.defineProperty(exports, "__esModule", ({ value: true }));
63587
63680
  exports.MethodLength = exports.MethodLengthConf = void 0;
63588
63681
  const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
63682
+ const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
63589
63683
  const method_length_stats_1 = __webpack_require__(/*! ../utils/method_length_stats */ "./node_modules/@abaplint/core/build/src/utils/method_length_stats.js");
63590
63684
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
63591
63685
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
@@ -63647,6 +63741,12 @@ Abstract methods without statements are considered okay.`,
63647
63741
  return this;
63648
63742
  }
63649
63743
  run(obj) {
63744
+ var _a;
63745
+ if (this.conf.ignoreTestClasses === true
63746
+ && obj instanceof Objects.Class
63747
+ && ((_a = obj.getClassDefinition()) === null || _a === void 0 ? void 0 : _a.isForTesting) === true) {
63748
+ return [];
63749
+ }
63650
63750
  const methodStats = method_length_stats_1.MethodLengthStats.run(obj);
63651
63751
  const methodIssues = this.check(methodStats, "METHOD");
63652
63752
  let formIssues = [];
@@ -70618,7 +70718,7 @@ class UnnecessaryChaining extends _abap_rule_1.ABAPRule {
70618
70718
  j = 1;
70619
70719
  let prevStatement = statements[i - j];
70620
70720
  while ((prevStatement === null || prevStatement === void 0 ? void 0 : prevStatement.get()) instanceof _statement_1.Comment) {
70621
- j--;
70721
+ j++;
70622
70722
  prevStatement = statements[i - j];
70623
70723
  }
70624
70724
  const next = nextStatement === null || nextStatement === void 0 ? void 0 : nextStatement.getColon();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.105.16",
3
+ "version": "2.105.18",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,24 +38,24 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.105.16",
41
+ "@abaplint/core": "^2.105.18",
42
42
  "@types/chai": "^4.3.11",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.6",
46
- "@types/node": "^20.11.16",
46
+ "@types/node": "^20.11.19",
47
47
  "@types/progress": "^2.0.7",
48
48
  "chai": "^4.4.1",
49
49
  "chalk": "^5.3.0",
50
50
  "eslint": "^8.56.0",
51
51
  "glob": "^7.2.3",
52
52
  "json5": "^2.2.3",
53
- "memfs": "^4.6.0",
53
+ "memfs": "^4.7.6",
54
54
  "minimist": "^1.2.8",
55
- "mocha": "^10.2.0",
55
+ "mocha": "^10.3.0",
56
56
  "progress": "^2.0.3",
57
57
  "typescript": "^5.3.3",
58
- "webpack": "^5.90.1",
58
+ "webpack": "^5.90.2",
59
59
  "webpack-cli": "^5.1.4",
60
60
  "xml-js": "^1.6.11"
61
61
  },