@abaplint/core 2.86.5 → 2.86.6

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.
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.86.5";
71
+ return "2.86.6";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -267,6 +267,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
267
267
  if (found) {
268
268
  return found;
269
269
  }
270
+ found = this.replaceMethodConditional(high, lowFile, highSyntax);
271
+ if (found) {
272
+ return found;
273
+ }
270
274
  found = this.replaceTableExpression(high, lowFile, highSyntax);
271
275
  if (found) {
272
276
  return found;
@@ -1428,6 +1432,18 @@ ${indentation} output = ${topTarget}.`;
1428
1432
  }
1429
1433
  return undefined;
1430
1434
  }
1435
+ replaceMethodConditional(node, lowFile, _highSyntax) {
1436
+ for (const c of node.findAllExpressionsRecursive(Expressions.Compare)) {
1437
+ const chain = c.findDirectExpression(Expressions.MethodCallChain);
1438
+ if (chain === undefined) {
1439
+ continue;
1440
+ }
1441
+ const end = chain.getLastToken().getEnd();
1442
+ const fix = edit_helper_1.EditHelper.insertAt(lowFile, end, " IS NOT INITIAL");
1443
+ return issue_1.Issue.atToken(lowFile, chain.getFirstToken(), "Downport method conditional", this.getMetadata().key, this.conf.severity, fix);
1444
+ }
1445
+ return undefined;
1446
+ }
1431
1447
  replaceContains(node, lowFile, highSyntax) {
1432
1448
  const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());
1433
1449
  // only downport if its an single method call condition
@@ -141,12 +141,16 @@ class KeywordCase extends _abap_rule_1.ABAPRule {
141
141
  }
142
142
  }
143
143
  const skip = new Skip(this.getConfig());
144
+ let prev = undefined;
144
145
  for (const statement of file.getStatements()) {
145
146
  if (skip.skipStatement(statement) === true) {
146
147
  continue;
147
148
  }
148
149
  let result = this.traverse(statement, statement.get());
149
150
  if (result.length > 0) {
151
+ if (prev && result[0].token.getStart().equals(prev.getStart())) {
152
+ continue;
153
+ }
150
154
  if (statement.getColon() !== undefined) {
151
155
  // if its a chained statement, go token by token
152
156
  result = [result[0]];
@@ -156,6 +160,7 @@ class KeywordCase extends _abap_rule_1.ABAPRule {
156
160
  if (issues.length > MAX_ISSUES) {
157
161
  break;
158
162
  }
163
+ prev = result[0].token;
159
164
  }
160
165
  }
161
166
  return issues;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.86.5",
3
+ "version": "2.86.6",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",