@abaplint/cli 2.119.16 → 2.119.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 +112 -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) {
@@ -30844,6 +30857,12 @@ class CallFunction {
30844
30857
  for (const s of node.findDirectExpressions(Expressions.Source)) {
30845
30858
  source_1.Source.runSyntax(s, input);
30846
30859
  }
30860
+ for (const d of node.findDirectExpressions(Expressions.Destination)) {
30861
+ const source = d.findFirstExpression(Expressions.Source);
30862
+ if (source) {
30863
+ source_1.Source.runSyntax(source, input);
30864
+ }
30865
+ }
30847
30866
  const fp = node.findDirectExpression(Expressions.FunctionParameters);
30848
30867
  if (fp) {
30849
30868
  function_parameters_1.FunctionParameters.runSyntax(fp, input);
@@ -32398,11 +32417,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
32398
32417
  exports.FetchNextCursor = void 0;
32399
32418
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
32400
32419
  const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
32420
+ const sql_source_1 = __webpack_require__(/*! ../expressions/sql_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_source.js");
32401
32421
  class FetchNextCursor {
32402
32422
  runSyntax(node, input) {
32403
32423
  for (const t of node.findAllExpressions(Expressions.Target)) {
32404
32424
  target_1.Target.runSyntax(t, input);
32405
32425
  }
32426
+ for (const s of node.findAllExpressions(Expressions.SQLSourceSimple)) {
32427
+ sql_source_1.SQLSource.runSyntax(s, input);
32428
+ }
32406
32429
  }
32407
32430
  }
32408
32431
  exports.FetchNextCursor = FetchNextCursor;
@@ -43305,6 +43328,7 @@ class Config {
43305
43328
  skipGeneratedProxyInterfaces: false,
43306
43329
  useApackDependencies: false,
43307
43330
  skipIncludesWithoutMain: false,
43331
+ errorOnDuplicateFilenames: false,
43308
43332
  },
43309
43333
  dependencies: [{
43310
43334
  url: "https://github.com/abaplint/deps",
@@ -43368,6 +43392,9 @@ class Config {
43368
43392
  if (this.config.global.skipIncludesWithoutMain === undefined) {
43369
43393
  this.config.global.skipIncludesWithoutMain = false;
43370
43394
  }
43395
+ if (this.config.global.errorOnDuplicateFilenames === undefined) {
43396
+ this.config.global.errorOnDuplicateFilenames = false;
43397
+ }
43371
43398
  this.checkVersion();
43372
43399
  }
43373
43400
  get() {
@@ -56285,7 +56312,7 @@ class Registry {
56285
56312
  }
56286
56313
  static abaplintVersion() {
56287
56314
  // magic, see build script "version.sh"
56288
- return "2.119.16";
56315
+ return "2.119.18";
56289
56316
  }
56290
56317
  getDDICReferences() {
56291
56318
  return this.ddicReferences;
@@ -56405,10 +56432,29 @@ class Registry {
56405
56432
  this.removeDependency(found);
56406
56433
  found = this.findOrCreate(f.getObjectName(), f.getObjectType());
56407
56434
  }
56435
+ if (this.conf.getGlobal().errorOnDuplicateFilenames === true) {
56436
+ this.checkDuplicateFilename(filename, found.getFiles());
56437
+ }
56408
56438
  found.addFile(f);
56409
56439
  }
56410
56440
  return this;
56411
56441
  }
56442
+ checkDuplicateFilename(filename, files) {
56443
+ const basename = Registry.filenameBasename(filename);
56444
+ if (basename === "PACKAGE.DEVC.XML") {
56445
+ return;
56446
+ }
56447
+ for (const existingFile of files) {
56448
+ if (Registry.filenameBasename(existingFile.getFilename()) === basename) {
56449
+ throw new Error("Duplicate filename: " + filename + " already exists as " + existingFile.getFilename());
56450
+ }
56451
+ }
56452
+ }
56453
+ static filenameBasename(filename) {
56454
+ const normalized = filename.replace(/\\/g, "/");
56455
+ const last = normalized.split("/").pop();
56456
+ return (last !== null && last !== void 0 ? last : normalized).toUpperCase();
56457
+ }
56412
56458
  addFiles(files) {
56413
56459
  this._addFiles(files, false);
56414
56460
  return this;
@@ -73623,10 +73669,6 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
73623
73669
  title: "Parser Error, bad EXCEPTIONS in CALL FUNCTION",
73624
73670
  shortDescription: `Checks for syntax not recognized by abaplint, related to EXCEPTIONS in CALL FUNCTION.`,
73625
73671
  tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],
73626
- /*
73627
- badExample: `IF ( foo = 'bar').`,
73628
- goodExample: `IF ( foo = 'bar' ).`,
73629
- */
73630
73672
  };
73631
73673
  }
73632
73674
  getConfig() {
@@ -73641,6 +73683,15 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
73641
73683
  if (!(statement.get() instanceof Statements.CallFunction)) {
73642
73684
  continue;
73643
73685
  }
73686
+ const exceptionTokens = this.findExceptionTokens(statement);
73687
+ if (exceptionTokens !== undefined
73688
+ && this.containsMixedExceptionSyntax(statement.findAllExpressions(Expressions.ParameterException))) {
73689
+ const message = "Bad EXCEPTIONS syntax in CALL FUNCTION";
73690
+ for (const token of exceptionTokens) {
73691
+ issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
73692
+ }
73693
+ continue;
73694
+ }
73644
73695
  for (const e of statement.findAllExpressions(Expressions.ParameterException)) {
73645
73696
  if (e.findDirectTokenByText("=") === undefined) {
73646
73697
  const message = "Bad EXCEPTIONS syntax in CALL FUNCTION";
@@ -73650,6 +73701,18 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
73650
73701
  }
73651
73702
  return issues;
73652
73703
  }
73704
+ containsMixedExceptionSyntax(exceptions) {
73705
+ return exceptions.some(e => e.findDirectTokenByText("=") === undefined)
73706
+ && exceptions.some(e => e.findDirectTokenByText("=") !== undefined);
73707
+ }
73708
+ findExceptionTokens(statement) {
73709
+ const tokens = statement.getTokens();
73710
+ const index = tokens.findIndex(t => t.getStr().toUpperCase() === "EXCEPTIONS");
73711
+ if (index === -1) {
73712
+ return undefined;
73713
+ }
73714
+ return tokens.slice(index).filter(t => t.getStr() !== ".");
73715
+ }
73653
73716
  }
73654
73717
  exports.ParserBadExceptions = ParserBadExceptions;
73655
73718
  //# sourceMappingURL=parser_bad_exceptions.js.map
@@ -77346,6 +77409,7 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@ab
77346
77409
  const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
77347
77410
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
77348
77411
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
77412
+ const include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ "./node_modules/@abaplint/core/build/src/utils/include_graph.js");
77349
77413
  class SuperclassFinalConf extends _basic_rule_config_1.BasicRuleConfig {
77350
77414
  }
77351
77415
  exports.SuperclassFinalConf = SuperclassFinalConf;
@@ -77353,6 +77417,7 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
77353
77417
  constructor() {
77354
77418
  super(...arguments);
77355
77419
  this.conf = new SuperclassFinalConf();
77420
+ this.graph = undefined;
77356
77421
  }
77357
77422
  getMetadata() {
77358
77423
  return {
@@ -77391,6 +77456,9 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
77391
77456
  }
77392
77457
  }
77393
77458
  }
77459
+ if (found === undefined && obj instanceof Objects.Program) {
77460
+ found = this.findInRelatedProgramIncludes(file, sup);
77461
+ }
77394
77462
  if (found === undefined) {
77395
77463
  const clas = this.reg.getObject("CLAS", sup);
77396
77464
  if (clas) {
@@ -77410,6 +77478,33 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
77410
77478
  }
77411
77479
  return output;
77412
77480
  }
77481
+ findInRelatedProgramIncludes(file, superClassName) {
77482
+ if (this.graph === undefined) {
77483
+ this.graph = new include_graph_1.IncludeGraph(this.reg);
77484
+ }
77485
+ const mainFilenames = this.graph.listMainForInclude(file.getFilename());
77486
+ if (mainFilenames.length === 0) {
77487
+ return undefined;
77488
+ }
77489
+ for (const object of this.reg.getObjectsByType("PROG")) {
77490
+ if (!(object instanceof Objects.Program)) {
77491
+ continue;
77492
+ }
77493
+ const programFile = object.getMainABAPFile();
77494
+ if (programFile === undefined) {
77495
+ continue;
77496
+ }
77497
+ const programMainFilenames = this.graph.listMainForInclude(programFile.getFilename());
77498
+ if (mainFilenames.some(filename => programMainFilenames.includes(filename)) === false) {
77499
+ continue;
77500
+ }
77501
+ const found = programFile.getInfo().getClassDefinitionByName(superClassName);
77502
+ if (found !== undefined) {
77503
+ return found;
77504
+ }
77505
+ }
77506
+ return undefined;
77507
+ }
77413
77508
  }
77414
77509
  exports.SuperclassFinal = SuperclassFinal;
77415
77510
  //# 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.18",
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.18",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",