@abaplint/cli 2.119.16 → 2.119.17

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 +79 -17
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -7174,10 +7174,11 @@ exports.Or = Or;
7174
7174
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7175
7175
  exports.ParameterException = void 0;
7176
7176
  const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
7177
+ const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
7177
7178
  const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
7178
7179
  class ParameterException extends combi_1.Expression {
7179
7180
  getRunnable() {
7180
- const name = (0, combi_1.altPrio)("OTHERS", _1.ParameterName);
7181
+ const name = (0, combi_1.altPrio)("OTHERS", (0, combi_1.seq)(_1.ParameterName, (0, combi_1.tok)(tokens_1.Dash), _1.ComponentName), _1.ParameterName);
7181
7182
  return (0, combi_1.seq)(name, (0, combi_1.optPrio)((0, combi_1.seq)("=", (0, combi_1.altPrio)(_1.Integer, _1.SimpleFieldChain), (0, combi_1.optPrio)((0, combi_1.seq)("MESSAGE", _1.Target)))));
7182
7183
  }
7183
7184
  }
@@ -23595,6 +23596,7 @@ const table_type_1 = __webpack_require__(/*! ../types/basic/table_type */ "./nod
23595
23596
  const enum_type_1 = __webpack_require__(/*! ../types/basic/enum_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/enum_type.js");
23596
23597
  const cgeneric_type_1 = __webpack_require__(/*! ../types/basic/cgeneric_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js");
23597
23598
  const Expressions = __webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
23599
+ const nodes_1 = __webpack_require__(/*! ../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
23598
23600
  // todo: refactor to static? for performance
23599
23601
  class TypeUtils {
23600
23602
  constructor(scope) {
@@ -23845,6 +23847,18 @@ class TypeUtils {
23845
23847
  return false;
23846
23848
  }
23847
23849
  */
23850
+ var _a;
23851
+ if (node.getChildren().length === 4
23852
+ && node.getFirstChild() instanceof nodes_1.TokenNodeRegex
23853
+ && ((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) === "BOOLC") {
23854
+ return true;
23855
+ }
23856
+ if (node.getChildren().length >= 3) {
23857
+ const second = node.getChildren()[1];
23858
+ if (second.getFirstToken().getStr() === "&&") {
23859
+ return true;
23860
+ }
23861
+ }
23848
23862
  const calculated = node.findFirstExpression(Expressions.MethodCallChain) !== undefined
23849
23863
  || node.findFirstExpression(Expressions.StringTemplate) !== undefined
23850
23864
  || node.findFirstExpression(Expressions.ArithOperator) !== undefined;
@@ -23858,7 +23872,7 @@ class TypeUtils {
23858
23872
  return this.isAssignable(source, target);
23859
23873
  }
23860
23874
  isAssignableStrict(source, target, node) {
23861
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
23875
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
23862
23876
  const calculated = node ? this.isCalculated(node) : false;
23863
23877
  /*
23864
23878
  console.dir(source);
@@ -23917,16 +23931,15 @@ class TypeUtils {
23917
23931
  else if (source instanceof basic_1.StringType) {
23918
23932
  if (target instanceof basic_1.StructureType && this.structureContainsString(target)) {
23919
23933
  return false;
23920
- /*
23921
- } else if (target instanceof CharacterType) {
23922
- if (source.getAbstractTypeData()?.derivedFromConstant === true) {
23923
- return true;
23934
+ }
23935
+ else if (target instanceof basic_1.CharacterType) {
23936
+ if (((_g = source.getAbstractTypeData()) === null || _g === void 0 ? void 0 : _g.derivedFromConstant) === true) {
23937
+ return true;
23924
23938
  }
23925
23939
  return false;
23926
- */
23927
23940
  }
23928
23941
  else if (target instanceof basic_1.IntegerType) {
23929
- if (((_g = source.getAbstractTypeData()) === null || _g === void 0 ? void 0 : _g.derivedFromConstant) === true) {
23942
+ if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
23930
23943
  return true;
23931
23944
  }
23932
23945
  return false;
@@ -23936,7 +23949,7 @@ class TypeUtils {
23936
23949
  return false;
23937
23950
  }
23938
23951
  else if (target instanceof basic_1.XSequenceType || target instanceof basic_1.XStringType) {
23939
- if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
23952
+ if (((_j = source.getAbstractTypeData()) === null || _j === void 0 ? void 0 : _j.derivedFromConstant) === true) {
23940
23953
  return true;
23941
23954
  }
23942
23955
  return false;
@@ -23980,7 +23993,7 @@ class TypeUtils {
23980
23993
  return false;
23981
23994
  }
23982
23995
  else if (target instanceof basic_1.Integer8Type || target instanceof basic_1.PackedType) {
23983
- if (((_j = source.getAbstractTypeData()) === null || _j === void 0 ? void 0 : _j.derivedFromConstant) === true) {
23996
+ if (((_k = source.getAbstractTypeData()) === null || _k === void 0 ? void 0 : _k.derivedFromConstant) === true) {
23984
23997
  return true;
23985
23998
  }
23986
23999
  return false;
@@ -26251,8 +26264,8 @@ class FieldChain {
26251
26264
  && node.findDirectExpression(Expressions.ComponentName)) {
26252
26265
  // workaround for names with dashes, eg. "sy-repid"
26253
26266
  const concat = node.concatTokens().replace(/ /g, "");
26254
- const offset = ((_b = node.findDirectExpression(Expressions.FieldOffset)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
26255
- const length = ((_c = node.findDirectExpression(Expressions.FieldLength)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "";
26267
+ const offset = ((_b = node.findDirectExpression(Expressions.FieldOffset)) === null || _b === void 0 ? void 0 : _b.concatTokens().replace(/ /g, "")) || "";
26268
+ const length = ((_c = node.findDirectExpression(Expressions.FieldLength)) === null || _c === void 0 ? void 0 : _c.concatTokens().replace(/ /g, "")) || "";
26256
26269
  const found = input.scope.findVariable(concat.replace(offset, "").replace(length, ""));
26257
26270
  if (found) {
26258
26271
  if (refType) {
@@ -56285,7 +56298,7 @@ class Registry {
56285
56298
  }
56286
56299
  static abaplintVersion() {
56287
56300
  // magic, see build script "version.sh"
56288
- return "2.119.16";
56301
+ return "2.119.17";
56289
56302
  }
56290
56303
  getDDICReferences() {
56291
56304
  return this.ddicReferences;
@@ -73623,10 +73636,6 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
73623
73636
  title: "Parser Error, bad EXCEPTIONS in CALL FUNCTION",
73624
73637
  shortDescription: `Checks for syntax not recognized by abaplint, related to EXCEPTIONS in CALL FUNCTION.`,
73625
73638
  tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],
73626
- /*
73627
- badExample: `IF ( foo = 'bar').`,
73628
- goodExample: `IF ( foo = 'bar' ).`,
73629
- */
73630
73639
  };
73631
73640
  }
73632
73641
  getConfig() {
@@ -73641,6 +73650,15 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
73641
73650
  if (!(statement.get() instanceof Statements.CallFunction)) {
73642
73651
  continue;
73643
73652
  }
73653
+ const exceptionTokens = this.findExceptionTokens(statement);
73654
+ if (exceptionTokens !== undefined
73655
+ && this.containsMixedExceptionSyntax(statement.findAllExpressions(Expressions.ParameterException))) {
73656
+ const message = "Bad EXCEPTIONS syntax in CALL FUNCTION";
73657
+ for (const token of exceptionTokens) {
73658
+ issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
73659
+ }
73660
+ continue;
73661
+ }
73644
73662
  for (const e of statement.findAllExpressions(Expressions.ParameterException)) {
73645
73663
  if (e.findDirectTokenByText("=") === undefined) {
73646
73664
  const message = "Bad EXCEPTIONS syntax in CALL FUNCTION";
@@ -73650,6 +73668,18 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
73650
73668
  }
73651
73669
  return issues;
73652
73670
  }
73671
+ containsMixedExceptionSyntax(exceptions) {
73672
+ return exceptions.some(e => e.findDirectTokenByText("=") === undefined)
73673
+ && exceptions.some(e => e.findDirectTokenByText("=") !== undefined);
73674
+ }
73675
+ findExceptionTokens(statement) {
73676
+ const tokens = statement.getTokens();
73677
+ const index = tokens.findIndex(t => t.getStr().toUpperCase() === "EXCEPTIONS");
73678
+ if (index === -1) {
73679
+ return undefined;
73680
+ }
73681
+ return tokens.slice(index).filter(t => t.getStr() !== ".");
73682
+ }
73653
73683
  }
73654
73684
  exports.ParserBadExceptions = ParserBadExceptions;
73655
73685
  //# sourceMappingURL=parser_bad_exceptions.js.map
@@ -77346,6 +77376,7 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@ab
77346
77376
  const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
77347
77377
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
77348
77378
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
77379
+ const include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ "./node_modules/@abaplint/core/build/src/utils/include_graph.js");
77349
77380
  class SuperclassFinalConf extends _basic_rule_config_1.BasicRuleConfig {
77350
77381
  }
77351
77382
  exports.SuperclassFinalConf = SuperclassFinalConf;
@@ -77353,6 +77384,7 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
77353
77384
  constructor() {
77354
77385
  super(...arguments);
77355
77386
  this.conf = new SuperclassFinalConf();
77387
+ this.graph = undefined;
77356
77388
  }
77357
77389
  getMetadata() {
77358
77390
  return {
@@ -77391,6 +77423,9 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
77391
77423
  }
77392
77424
  }
77393
77425
  }
77426
+ if (found === undefined && obj instanceof Objects.Program) {
77427
+ found = this.findInRelatedProgramIncludes(file, sup);
77428
+ }
77394
77429
  if (found === undefined) {
77395
77430
  const clas = this.reg.getObject("CLAS", sup);
77396
77431
  if (clas) {
@@ -77410,6 +77445,33 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
77410
77445
  }
77411
77446
  return output;
77412
77447
  }
77448
+ findInRelatedProgramIncludes(file, superClassName) {
77449
+ if (this.graph === undefined) {
77450
+ this.graph = new include_graph_1.IncludeGraph(this.reg);
77451
+ }
77452
+ const mainFilenames = this.graph.listMainForInclude(file.getFilename());
77453
+ if (mainFilenames.length === 0) {
77454
+ return undefined;
77455
+ }
77456
+ for (const object of this.reg.getObjectsByType("PROG")) {
77457
+ if (!(object instanceof Objects.Program)) {
77458
+ continue;
77459
+ }
77460
+ const programFile = object.getMainABAPFile();
77461
+ if (programFile === undefined) {
77462
+ continue;
77463
+ }
77464
+ const programMainFilenames = this.graph.listMainForInclude(programFile.getFilename());
77465
+ if (mainFilenames.some(filename => programMainFilenames.includes(filename)) === false) {
77466
+ continue;
77467
+ }
77468
+ const found = programFile.getInfo().getClassDefinitionByName(superClassName);
77469
+ if (found !== undefined) {
77470
+ return found;
77471
+ }
77472
+ }
77473
+ return undefined;
77474
+ }
77413
77475
  }
77414
77476
  exports.SuperclassFinal = SuperclassFinal;
77415
77477
  //# sourceMappingURL=superclass_final.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.119.16",
3
+ "version": "2.119.17",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.119.16",
41
+ "@abaplint/core": "^2.119.17",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",