@abaplint/core 2.113.218 → 2.113.219

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.
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.218";
70
+ return "2.113.219";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -77,7 +77,15 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
77
77
  const issue = issue_1.Issue.atIdentifier(found, "Do not implement abstract method \"" + md.name + "\"", this.getMetadata().key, this.conf.severity);
78
78
  ret.push(issue);
79
79
  }
80
- continue;
80
+ if (def.isAbstract) {
81
+ continue;
82
+ }
83
+ else {
84
+ const message = "Abstract methods can only be defined in abstract classes.";
85
+ const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);
86
+ ret.push(issue);
87
+ break;
88
+ }
81
89
  }
82
90
  if (impl === undefined) {
83
91
  const message = "Class implementation for \"" + def.name + "\" not found";
@@ -181,7 +189,15 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
181
189
  }
182
190
  for (const m of this.findInterfaceMethods(idef)) {
183
191
  if (this.isAbstract(m, interfaceInfo, def)) {
184
- continue;
192
+ if (def.isAbstract) {
193
+ continue;
194
+ }
195
+ else {
196
+ const message = "Abstract methods can only be defined in abstract classes.";
197
+ const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);
198
+ ret.push(issue);
199
+ break;
200
+ }
185
201
  }
186
202
  if (this.isImplemented(m, def, impl) === false) {
187
203
  const message = "Implement method \"" + m.method.name + "\" from interface \"" + m.objectName + "\"";
@@ -7,6 +7,7 @@ const _abap_rule_1 = require("./_abap_rule");
7
7
  const _basic_rule_config_1 = require("./_basic_rule_config");
8
8
  const _irule_1 = require("./_irule");
9
9
  const version_1 = require("../version");
10
+ const __1 = require("..");
10
11
  class Parser702ChainingConf extends _basic_rule_config_1.BasicRuleConfig {
11
12
  }
12
13
  exports.Parser702ChainingConf = Parser702ChainingConf;
@@ -18,7 +19,7 @@ class Parser702Chaining extends _abap_rule_1.ABAPRule {
18
19
  getMetadata() {
19
20
  return {
20
21
  key: "parser_702_chaining",
21
- title: "Parser Error, bad chanining on 702",
22
+ title: "Parser Error, bad chaining on 702",
22
23
  shortDescription: `ABAP on 702 does not allow for method chaining with IMPORTING/EXPORTING/CHANGING keywords,
23
24
  this rule finds these and reports errors.
24
25
  Only active on target version 702 and below.`,
@@ -59,13 +60,47 @@ Only active on target version 702 and below.`,
59
60
  || param.findDirectTokenByText("CHANGING")
60
61
  || param.findDirectTokenByText("EXCEPTIONS")) {
61
62
  const message = "This kind of method chaining not possible in 702";
62
- const issue = issue_1.Issue.atPosition(file, param.getFirstToken().getStart(), message, this.getMetadata().key, this.conf.severity);
63
- issues.push(issue);
63
+ this.pushIssue(message, file, param, issues);
64
64
  }
65
65
  }
66
66
  }
67
+ // after a value assignment (move statement whose source is a method call, or method parameter assignment),
68
+ // there can't be any EXPORTING/IMPORTING/CHANGING/EXCEPTIONS
69
+ for (const statement of file.getStatements()) {
70
+ if (!(statement.get() instanceof __1.Statements.Move)) {
71
+ continue;
72
+ }
73
+ const source = statement.findDirectExpression(Expressions.Source);
74
+ if (source === undefined) {
75
+ continue;
76
+ }
77
+ this.ensureSourceHasNoProceduralKeywords(source, file, issues);
78
+ }
79
+ for (const methodParameters of stru.findAllExpressions(Expressions.MethodParameters)) {
80
+ for (const params of methodParameters.findAllExpressions(Expressions.ParameterS)) {
81
+ const source = params.findDirectExpression(Expressions.Source);
82
+ if (source === undefined) {
83
+ continue;
84
+ }
85
+ this.ensureSourceHasNoProceduralKeywords(source, file, issues);
86
+ }
87
+ }
67
88
  return issues;
68
89
  }
90
+ ensureSourceHasNoProceduralKeywords(source, file, issues) {
91
+ const forbiddenTokens = ["EXPORTING", "IMPORTING", "CHANGING", "EXCEPTIONS"];
92
+ for (const param of source.findAllExpressions(Expressions.MethodParameters)) {
93
+ const usedForbiddenToken = forbiddenTokens.find(text => param.findDirectTokenByText(text));
94
+ if (usedForbiddenToken) {
95
+ const message = `Unexpected word ${usedForbiddenToken} in functional method call`;
96
+ this.pushIssue(message, file, param, issues);
97
+ }
98
+ }
99
+ }
100
+ pushIssue(message, file, node, issues) {
101
+ const issue = issue_1.Issue.atPosition(file, node.getFirstToken().getStart(), message, this.getMetadata().key, this.conf.severity);
102
+ issues.push(issue);
103
+ }
69
104
  }
70
105
  exports.Parser702Chaining = Parser702Chaining;
71
106
  //# sourceMappingURL=parser_702_chaining.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.218",
3
+ "version": "2.113.219",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -50,17 +50,17 @@
50
50
  },
51
51
  "homepage": "https://abaplint.org",
52
52
  "devDependencies": {
53
- "@microsoft/api-extractor": "^7.52.13",
53
+ "@microsoft/api-extractor": "^7.52.15",
54
54
  "@types/chai": "^4.3.20",
55
55
  "@types/mocha": "^10.0.10",
56
- "@types/node": "^24.5.2",
56
+ "@types/node": "^24.6.2",
57
57
  "chai": "^4.5.0",
58
58
  "eslint": "^9.36.0",
59
- "mocha": "^11.7.2",
59
+ "mocha": "^11.7.4",
60
60
  "c8": "^10.1.3",
61
61
  "source-map-support": "^0.5.21",
62
62
  "ts-json-schema-generator": "^2.4.0",
63
- "typescript": "^5.9.2"
63
+ "typescript": "^5.9.3"
64
64
  },
65
65
  "dependencies": {
66
66
  "fast-xml-parser": "^5.2.5",