@abaplint/cli 2.113.218 → 2.113.220

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 +127 -22
  2. package/package.json +7 -7
package/build/cli.js CHANGED
@@ -15209,7 +15209,8 @@ class ModifyEntities {
15209
15209
  const updateFrom = (0, combi_1.seq)("UPDATE FROM", expressions_1.Source, (0, combi_1.opt)(relating));
15210
15210
  const deleteFrom = (0, combi_1.seq)("DELETE FROM", expressions_1.Source);
15211
15211
  const updateFields = (0, combi_1.seq)("UPDATE", fieldsWith);
15212
- const operation = (0, combi_1.alt)((0, combi_1.seq)("UPDATE SET FIELDS WITH", expressions_1.Source), (0, combi_1.seq)("CREATE SET FIELDS WITH", expressions_1.Source), updateFields, deleteFrom, updateFrom, create, execute, (0, combi_1.seq)("CREATE", (0, combi_1.opt)(by), (0, combi_1.optPrio)("AUTO FILL CID"), (0, combi_1.altPrio)(withh, fieldsWith)));
15212
+ const updateSetFields = (0, combi_1.seq)("UPDATE SET FIELDS WITH", expressions_1.Source);
15213
+ const operation = (0, combi_1.alt)(updateSetFields, (0, combi_1.seq)("CREATE SET FIELDS WITH", expressions_1.Source), updateFields, deleteFrom, updateFrom, create, execute, (0, combi_1.seq)("CREATE", (0, combi_1.opt)(by), (0, combi_1.optPrio)("AUTO FILL CID"), (0, combi_1.altPrio)(withh, fieldsWith)));
15213
15214
  const failed = (0, combi_1.seq)("FAILED", expressions_1.Target);
15214
15215
  const result = (0, combi_1.seq)("RESULT", expressions_1.Target);
15215
15216
  const mapped = (0, combi_1.seq)("MAPPED", expressions_1.Target);
@@ -15219,7 +15220,7 @@ class ModifyEntities {
15219
15220
  const create2 = (0, combi_1.seq)("CREATE", fieldsWith, (0, combi_1.opt)((0, combi_1.seq)("CREATE BY", expressions_1.AssociationName, fieldsWith)));
15220
15221
  const create3 = (0, combi_1.seq)("CREATE BY", expressions_1.AssociationName, fieldsWith);
15221
15222
  const create4 = (0, combi_1.seq)("CREATE FROM", expressions_1.Source, (0, combi_1.plus)((0, combi_1.seq)("CREATE BY", expressions_1.AssociationName, "FROM", expressions_1.Source)));
15222
- const entity = (0, combi_1.seq)("ENTITY", (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.alt)(expressions_1.NamespaceSimpleName, expressions_1.EntityAssociation), (0, combi_1.alt)(execute, create, updateFields, deleteFrom, updateFrom, create2, create3, create4));
15223
+ const entity = (0, combi_1.seq)("ENTITY", (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.alt)(expressions_1.NamespaceSimpleName, expressions_1.EntityAssociation), (0, combi_1.alt)(execute, create, updateFields, deleteFrom, updateSetFields, updateFrom, create2, create3, create4));
15223
15224
  return (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("MODIFY", (0, combi_1.alt)(entities, entity), end));
15224
15225
  }
15225
15226
  }
@@ -16161,7 +16162,8 @@ class ReadEntities {
16161
16162
  const result = (0, combi_1.seq)("RESULT", expressions_1.Target);
16162
16163
  const failed = (0, combi_1.seq)("FAILED", expressions_1.Target);
16163
16164
  const reported = (0, combi_1.seq)("REPORTED", expressions_1.Target);
16164
- const entity = (0, combi_1.seq)("ENTITY", expressions_1.NamespaceSimpleName, (0, combi_1.opt)((0, combi_1.seq)("BY", expressions_1.AssociationName)), (0, combi_1.alt)(fields, from, all), (0, combi_1.optPrio)(result));
16165
+ const foo = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.seq)("BY", expressions_1.AssociationName)), (0, combi_1.alt)(fields, from, all), (0, combi_1.optPrio)(result));
16166
+ const entity = (0, combi_1.seq)("ENTITY", expressions_1.NamespaceSimpleName, (0, combi_1.plus)(foo));
16165
16167
  const s = (0, combi_1.seq)("ENTITIES OF", expressions_1.NamespaceSimpleName, (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.plus)(entity), (0, combi_1.optPrio)((0, combi_1.seq)("LINK", expressions_1.Target)), (0, combi_1.optPrio)((0, combi_1.per)(failed, reported)));
16166
16168
  const byall = (0, combi_1.seq)("BY", expressions_1.AssociationName, all);
16167
16169
  const by = (0, combi_1.seq)("BY", expressions_1.AssociationName, fields);
@@ -21375,7 +21377,9 @@ class BuiltIn {
21375
21377
  // https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abennews-610-system.htm
21376
21378
  const id3 = new tokens_1.Identifier(new position_1.Position(this.row++, 1), "sy-repid");
21377
21379
  const syrepid = new _typed_identifier_1.TypedIdentifier(id3, BuiltIn.filename, new basic_1.CharacterType(40, { qualifiedName: "sy-repid" }), ["read_only" /* IdentifierMeta.ReadOnly */, "built-in" /* IdentifierMeta.BuiltIn */]);
21378
- return [sy, syst, syrepid];
21380
+ const id4 = new tokens_1.Identifier(new position_1.Position(this.row++, 1), "syst-repid");
21381
+ const systrepid = new _typed_identifier_1.TypedIdentifier(id4, BuiltIn.filename, new basic_1.CharacterType(40, { qualifiedName: "syst-repid" }), ["read_only" /* IdentifierMeta.ReadOnly */, "built-in" /* IdentifierMeta.BuiltIn */]);
21382
+ return [sy, syst, syrepid, systrepid];
21379
21383
  }
21380
21384
  buildConstant(name, type, value) {
21381
21385
  const id = new tokens_1.Identifier(new position_1.Position(this.row++, 1), name);
@@ -24395,7 +24399,7 @@ class BasicTypes {
24395
24399
  const name = typename.concatTokens();
24396
24400
  const type = (_d = this.input.scope.getDDIC().lookupDDLS(name)) === null || _d === void 0 ? void 0 : _d.type;
24397
24401
  if (type) {
24398
- return new Types.TableType(basic_1.VoidType.get("RapTodo"), options);
24402
+ return new Types.TableType(basic_1.VoidType.get("RAP-TODO"), options);
24399
24403
  }
24400
24404
  else if (this.input.scope.getDDIC().inErrorNamespace(name)) {
24401
24405
  return new Types.UnknownType(`DDLS ${name} not found`);
@@ -30682,7 +30686,7 @@ class ClassImplementation {
30682
30686
  }
30683
30687
  else {
30684
30688
  // todo: instead of the void type, do proper typing, ie. only empty constructor method
30685
- input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(new tokens_1.Identifier(new position_1.Position(1, 1), "super"), _builtin_1.BuiltIn.filename, basic_1.VoidType.get("noSuper")));
30689
+ input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(new tokens_1.Identifier(new position_1.Position(1, 1), "super"), _builtin_1.BuiltIn.filename, basic_1.VoidType.get("noSuperClass")));
30686
30690
  }
30687
30691
  input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(new tokens_1.Identifier(new position_1.Position(1, 1), "me"), _builtin_1.BuiltIn.filename, new basic_1.ObjectReferenceType(classDefinition)));
30688
30692
  helper.addAliasedAttributes(classDefinition); // todo, this is not correct, take care of instance vs static
@@ -41586,7 +41590,7 @@ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node
41586
41590
  class CDSFunctionInput extends combi_1.Expression {
41587
41591
  getRunnable() {
41588
41592
  const qualified = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)(_1.CDSParameters), (0, combi_1.starPrio)((0, combi_1.seq)(".", _1.CDSName, (0, combi_1.opt)(_1.CDSParameters))));
41589
- const input = (0, combi_1.altPrio)(_1.CDSCast, _1.CDSFunction, _1.CDSArithmetics, _1.CDSCase, _1.CDSString, qualified, _1.CDSInteger);
41593
+ const input = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSCast, _1.CDSFunction, _1.CDSCase, _1.CDSString, qualified, _1.CDSInteger);
41590
41594
  return input;
41591
41595
  }
41592
41596
  }
@@ -54549,7 +54553,7 @@ class Registry {
54549
54553
  }
54550
54554
  static abaplintVersion() {
54551
54555
  // magic, see build script "version.sh"
54552
- return "2.113.218";
54556
+ return "2.113.220";
54553
54557
  }
54554
54558
  getDDICReferences() {
54555
54559
  return this.ddicReferences;
@@ -55856,6 +55860,7 @@ ENDINTERFACE.`,
55856
55860
  }
55857
55861
  issues.push(...this.checkTypes(stru, file));
55858
55862
  issues.push(...this.checkMethods(stru, file));
55863
+ issues.push(...this.checkEvents(stru, file));
55859
55864
  return issues;
55860
55865
  }
55861
55866
  check(fields, column, file) {
@@ -55915,6 +55920,26 @@ ENDINTERFACE.`,
55915
55920
  }
55916
55921
  return issues;
55917
55922
  }
55923
+ checkEvents(stru, file) {
55924
+ const issues = [];
55925
+ const events = stru.findAllStatements(Statements.Events);
55926
+ for (const e of events) {
55927
+ const fields = [];
55928
+ const params = e.findAllExpressions(Expressions.MethodParam);
55929
+ let column = 0;
55930
+ for (const p of params) {
55931
+ const children = p.getChildren();
55932
+ const name = children[children.length - 2];
55933
+ fields.push({
55934
+ nameEnd: name.getLastToken().getEnd(),
55935
+ after: p.findFirstExpression(Expressions.TypeParam).getFirstToken().getStart()
55936
+ });
55937
+ column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
55938
+ }
55939
+ issues.push(...this.check(fields, column, file));
55940
+ }
55941
+ return issues;
55942
+ }
55918
55943
  checkTypes(stru, file) {
55919
55944
  const issues = [];
55920
55945
  const types = stru.findAllStructuresRecursive(Structures.Types);
@@ -64689,20 +64714,51 @@ WRITE 'world'.`,
64689
64714
  ////////////////
64690
64715
  analyzeIf(file, node) {
64691
64716
  var _a;
64692
- if (node.getChildren().length !== 4) {
64717
+ const ifBody = node.findDirectStructure(Structures.Body);
64718
+ const elseIfBodies = node.findDirectStructures(Structures.ElseIf) || [];
64719
+ const elseBody = (_a = node.findDirectStructure(Structures.Else)) === null || _a === void 0 ? void 0 : _a.findDirectStructure(Structures.Body);
64720
+ if (elseBody === undefined) {
64693
64721
  return [];
64694
64722
  }
64695
- const ifBody = node.findDirectStructure(Structures.Body);
64696
- if (node.findDirectStructure(Structures.ElseIf)) {
64723
+ const ifFirst = ifBody === null || ifBody === void 0 ? void 0 : ifBody.getFirstChild();
64724
+ const elseFirst = elseBody === null || elseBody === void 0 ? void 0 : elseBody.getFirstChild();
64725
+ const ifLast = ifBody === null || ifBody === void 0 ? void 0 : ifBody.getLastChild();
64726
+ const elseLast = elseBody === null || elseBody === void 0 ? void 0 : elseBody.getLastChild();
64727
+ if (elseIfBodies.length > 0) {
64728
+ let firstMatch = true;
64729
+ let lastMatch = true;
64730
+ for (const elseif of elseIfBodies) {
64731
+ const elseifBody = elseif.findDirectStructure(Structures.Body);
64732
+ const elseifFirst = elseifBody === null || elseifBody === void 0 ? void 0 : elseifBody.getFirstChild();
64733
+ const elseifLast = elseifBody === null || elseifBody === void 0 ? void 0 : elseifBody.getLastChild();
64734
+ if (ifFirst === undefined
64735
+ || ifLast === undefined
64736
+ || elseLast === undefined
64737
+ || elseFirst === undefined) {
64738
+ return [];
64739
+ }
64740
+ if (elseifFirst === undefined
64741
+ || ifFirst.concatTokens() !== elseifFirst.concatTokens()
64742
+ || elseFirst.concatTokens() !== elseifFirst.concatTokens()) {
64743
+ firstMatch = false;
64744
+ }
64745
+ if (elseifLast === undefined
64746
+ || ifLast.concatTokens() !== elseifLast.concatTokens()
64747
+ || elseLast.concatTokens() !== elseifLast.concatTokens()) {
64748
+ lastMatch = false;
64749
+ }
64750
+ }
64751
+ if (firstMatch === true || lastMatch === true) {
64752
+ const message = "Identical contents";
64753
+ const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);
64754
+ return [issue];
64755
+ }
64697
64756
  return [];
64698
64757
  }
64699
- const elseBody = (_a = node.findDirectStructure(Structures.Else)) === null || _a === void 0 ? void 0 : _a.findDirectStructure(Structures.Body);
64700
- if (elseBody === undefined || ifBody === undefined) {
64758
+ else if (elseBody === undefined || ifBody === undefined) {
64701
64759
  return [];
64702
64760
  }
64703
64761
  {
64704
- const ifFirst = ifBody.getFirstChild();
64705
- const elseFirst = elseBody.getFirstChild();
64706
64762
  if (ifFirst === undefined || elseFirst === undefined || this.isChained(ifFirst)) {
64707
64763
  return [];
64708
64764
  }
@@ -64713,8 +64769,6 @@ WRITE 'world'.`,
64713
64769
  }
64714
64770
  }
64715
64771
  {
64716
- const ifLast = ifBody.getLastChild();
64717
- const elseLast = elseBody.getLastChild();
64718
64772
  if (ifLast === undefined || elseLast === undefined || this.isChained(ifLast)) {
64719
64773
  return [];
64720
64774
  }
@@ -65143,7 +65197,15 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
65143
65197
  const issue = issue_1.Issue.atIdentifier(found, "Do not implement abstract method \"" + md.name + "\"", this.getMetadata().key, this.conf.severity);
65144
65198
  ret.push(issue);
65145
65199
  }
65146
- continue;
65200
+ if (def.isAbstract) {
65201
+ continue;
65202
+ }
65203
+ else {
65204
+ const message = "Abstract methods can only be defined in abstract classes.";
65205
+ const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);
65206
+ ret.push(issue);
65207
+ break;
65208
+ }
65147
65209
  }
65148
65210
  if (impl === undefined) {
65149
65211
  const message = "Class implementation for \"" + def.name + "\" not found";
@@ -65247,7 +65309,15 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
65247
65309
  }
65248
65310
  for (const m of this.findInterfaceMethods(idef)) {
65249
65311
  if (this.isAbstract(m, interfaceInfo, def)) {
65250
- continue;
65312
+ if (def.isAbstract) {
65313
+ continue;
65314
+ }
65315
+ else {
65316
+ const message = "Abstract methods can only be defined in abstract classes.";
65317
+ const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);
65318
+ ret.push(issue);
65319
+ break;
65320
+ }
65251
65321
  }
65252
65322
  if (this.isImplemented(m, def, impl) === false) {
65253
65323
  const message = "Implement method \"" + m.method.name + "\" from interface \"" + m.objectName + "\"";
@@ -70662,6 +70732,7 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@ab
70662
70732
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
70663
70733
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
70664
70734
  const version_1 = __webpack_require__(/*! ../version */ "./node_modules/@abaplint/core/build/src/version.js");
70735
+ const __1 = __webpack_require__(/*! .. */ "./node_modules/@abaplint/core/build/src/index.js");
70665
70736
  class Parser702ChainingConf extends _basic_rule_config_1.BasicRuleConfig {
70666
70737
  }
70667
70738
  exports.Parser702ChainingConf = Parser702ChainingConf;
@@ -70673,7 +70744,7 @@ class Parser702Chaining extends _abap_rule_1.ABAPRule {
70673
70744
  getMetadata() {
70674
70745
  return {
70675
70746
  key: "parser_702_chaining",
70676
- title: "Parser Error, bad chanining on 702",
70747
+ title: "Parser Error, bad chaining on 702",
70677
70748
  shortDescription: `ABAP on 702 does not allow for method chaining with IMPORTING/EXPORTING/CHANGING keywords,
70678
70749
  this rule finds these and reports errors.
70679
70750
  Only active on target version 702 and below.`,
@@ -70714,13 +70785,47 @@ Only active on target version 702 and below.`,
70714
70785
  || param.findDirectTokenByText("CHANGING")
70715
70786
  || param.findDirectTokenByText("EXCEPTIONS")) {
70716
70787
  const message = "This kind of method chaining not possible in 702";
70717
- const issue = issue_1.Issue.atPosition(file, param.getFirstToken().getStart(), message, this.getMetadata().key, this.conf.severity);
70718
- issues.push(issue);
70788
+ this.pushIssue(message, file, param, issues);
70719
70789
  }
70720
70790
  }
70721
70791
  }
70792
+ // after a value assignment (move statement whose source is a method call, or method parameter assignment),
70793
+ // there can't be any EXPORTING/IMPORTING/CHANGING/EXCEPTIONS
70794
+ for (const statement of file.getStatements()) {
70795
+ if (!(statement.get() instanceof __1.Statements.Move)) {
70796
+ continue;
70797
+ }
70798
+ const source = statement.findDirectExpression(Expressions.Source);
70799
+ if (source === undefined) {
70800
+ continue;
70801
+ }
70802
+ this.ensureSourceHasNoProceduralKeywords(source, file, issues);
70803
+ }
70804
+ for (const methodParameters of stru.findAllExpressions(Expressions.MethodParameters)) {
70805
+ for (const params of methodParameters.findAllExpressions(Expressions.ParameterS)) {
70806
+ const source = params.findDirectExpression(Expressions.Source);
70807
+ if (source === undefined) {
70808
+ continue;
70809
+ }
70810
+ this.ensureSourceHasNoProceduralKeywords(source, file, issues);
70811
+ }
70812
+ }
70722
70813
  return issues;
70723
70814
  }
70815
+ ensureSourceHasNoProceduralKeywords(source, file, issues) {
70816
+ const forbiddenTokens = ["EXPORTING", "IMPORTING", "CHANGING", "EXCEPTIONS"];
70817
+ for (const param of source.findAllExpressions(Expressions.MethodParameters)) {
70818
+ const usedForbiddenToken = forbiddenTokens.find(text => param.findDirectTokenByText(text));
70819
+ if (usedForbiddenToken) {
70820
+ const message = `Unexpected word ${usedForbiddenToken} in functional method call`;
70821
+ this.pushIssue(message, file, param, issues);
70822
+ }
70823
+ }
70824
+ }
70825
+ pushIssue(message, file, node, issues) {
70826
+ const issue = issue_1.Issue.atPosition(file, node.getFirstToken().getStart(), message, this.getMetadata().key, this.conf.severity);
70827
+ issues.push(issue);
70828
+ }
70724
70829
  }
70725
70830
  exports.Parser702Chaining = Parser702Chaining;
70726
70831
  //# sourceMappingURL=parser_702_chaining.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.113.218",
3
+ "version": "2.113.220",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,11 +38,11 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.113.217",
41
+ "@abaplint/core": "^2.113.220",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",
45
- "@types/node": "^24.5.2",
45
+ "@types/node": "^24.6.2",
46
46
  "@types/progress": "^2.0.7",
47
47
  "chai": "^4.5.0",
48
48
  "p-limit": "^3.1.0",
@@ -50,12 +50,12 @@
50
50
  "eslint": "^9.36.0",
51
51
  "glob": "^11.0.3",
52
52
  "json5": "^2.2.3",
53
- "memfs": "^4.46.1",
53
+ "memfs": "^4.48.1",
54
54
  "minimist": "^1.2.8",
55
- "mocha": "^11.7.2",
55
+ "mocha": "^11.7.4",
56
56
  "progress": "^2.0.3",
57
- "typescript": "^5.9.2",
58
- "webpack": "^5.101.3",
57
+ "typescript": "^5.9.3",
58
+ "webpack": "^5.102.0",
59
59
  "webpack-cli": "^6.0.1",
60
60
  "xml-js": "^1.6.11"
61
61
  }