@abaplint/core 2.101.24 → 2.101.25

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.
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.101.24";
68
+ return "2.101.25";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -430,6 +430,10 @@ Make sure to test the downported code, it might not always be completely correct
430
430
  return found;
431
431
  }
432
432
  }
433
+ found = this.outlineCorresponding(low, high, lowFile, highSyntax);
434
+ if (found) {
435
+ return found;
436
+ }
433
437
  found = this.downportSelectFields(low, high, lowFile, highSyntax);
434
438
  if (found) {
435
439
  return found;
@@ -2023,6 +2027,43 @@ ${indentation} output = ${uniqueName}.\n`;
2023
2027
  }
2024
2028
  return undefined;
2025
2029
  }
2030
+ outlineCorresponding(low, high, lowFile, highSyntax) {
2031
+ var _a;
2032
+ if (!(low.get() instanceof _statement_1.Unknown)) {
2033
+ return undefined;
2034
+ }
2035
+ const allSources = high.findAllExpressionsRecursive(Expressions.Source);
2036
+ for (const s of allSources) {
2037
+ const firstToken = s.getFirstToken();
2038
+ if (firstToken.getStr().toUpperCase() !== "CORRESPONDING") {
2039
+ continue;
2040
+ }
2041
+ const correspondingBody = s.findDirectExpression(Expressions.CorrespondingBody);
2042
+ const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
2043
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
2044
+ let type = this.findType(s, lowFile, highSyntax);
2045
+ if (type === undefined) {
2046
+ if (high.get() instanceof Statements.Move && high.findDirectExpression(Expressions.Source) === s) {
2047
+ type = "LIKE " + ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens());
2048
+ }
2049
+ if (type === undefined) {
2050
+ continue;
2051
+ }
2052
+ }
2053
+ else {
2054
+ type = "TYPE " + type;
2055
+ }
2056
+ const abap = `DATA ${uniqueName} ${type}.\n` +
2057
+ indentation + `CLEAR ${uniqueName}.\n` + // might be called inside a loop
2058
+ indentation + `MOVE-CORRESPONDING ${correspondingBody === null || correspondingBody === void 0 ? void 0 : correspondingBody.concatTokens()} TO ${uniqueName}.\n` +
2059
+ indentation;
2060
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
2061
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), s.getLastToken().getEnd(), uniqueName);
2062
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
2063
+ return issue_1.Issue.atToken(lowFile, firstToken, "Downport CORRESPONDING", this.getMetadata().key, this.conf.severity, fix);
2064
+ }
2065
+ return undefined;
2066
+ }
2026
2067
  outlineValue(low, high, lowFile, highSyntax) {
2027
2068
  var _a, _b, _c;
2028
2069
  if (!(low.get() instanceof _statement_1.Unknown)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.101.24",
3
+ "version": "2.101.25",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",