@abaplint/core 2.101.24 → 2.101.26

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.26";
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;
@@ -1598,15 +1602,12 @@ ${indentation}${uniqueName}`;
1598
1602
  if (!(low.get() instanceof _statement_1.Unknown)) {
1599
1603
  return undefined;
1600
1604
  }
1601
- else if (!(high.get() instanceof Statements.Move)) {
1602
- return undefined;
1603
- }
1604
1605
  for (const child of high.findAllExpressionsRecursive(Expressions.StringTemplate)) {
1605
1606
  const templateTokens = child.getChildren();
1606
1607
  if (templateTokens.length !== 3
1607
1608
  || templateTokens[0].getFirstToken().getStr() !== "|{"
1608
1609
  || templateTokens[2].getFirstToken().getStr() !== "}|") {
1609
- return undefined;
1610
+ continue;
1610
1611
  }
1611
1612
  const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);
1612
1613
  const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();
@@ -2023,6 +2024,43 @@ ${indentation} output = ${uniqueName}.\n`;
2023
2024
  }
2024
2025
  return undefined;
2025
2026
  }
2027
+ outlineCorresponding(low, high, lowFile, highSyntax) {
2028
+ var _a;
2029
+ if (!(low.get() instanceof _statement_1.Unknown)) {
2030
+ return undefined;
2031
+ }
2032
+ const allSources = high.findAllExpressionsRecursive(Expressions.Source);
2033
+ for (const s of allSources) {
2034
+ const firstToken = s.getFirstToken();
2035
+ if (firstToken.getStr().toUpperCase() !== "CORRESPONDING") {
2036
+ continue;
2037
+ }
2038
+ const correspondingBody = s.findDirectExpression(Expressions.CorrespondingBody);
2039
+ const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
2040
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
2041
+ let type = this.findType(s, lowFile, highSyntax);
2042
+ if (type === undefined) {
2043
+ if (high.get() instanceof Statements.Move && high.findDirectExpression(Expressions.Source) === s) {
2044
+ type = "LIKE " + ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens());
2045
+ }
2046
+ if (type === undefined) {
2047
+ continue;
2048
+ }
2049
+ }
2050
+ else {
2051
+ type = "TYPE " + type;
2052
+ }
2053
+ const abap = `DATA ${uniqueName} ${type}.\n` +
2054
+ indentation + `CLEAR ${uniqueName}.\n` + // might be called inside a loop
2055
+ indentation + `MOVE-CORRESPONDING ${correspondingBody === null || correspondingBody === void 0 ? void 0 : correspondingBody.concatTokens()} TO ${uniqueName}.\n` +
2056
+ indentation;
2057
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
2058
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), s.getLastToken().getEnd(), uniqueName);
2059
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
2060
+ return issue_1.Issue.atToken(lowFile, firstToken, "Downport CORRESPONDING", this.getMetadata().key, this.conf.severity, fix);
2061
+ }
2062
+ return undefined;
2063
+ }
2026
2064
  outlineValue(low, high, lowFile, highSyntax) {
2027
2065
  var _a, _b, _c;
2028
2066
  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.26",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -63,7 +63,7 @@
63
63
  "typescript": "^5.1.3"
64
64
  },
65
65
  "dependencies": {
66
- "fast-xml-parser": "^4.2.4",
66
+ "fast-xml-parser": "^4.2.5",
67
67
  "json5": "^2.2.3",
68
68
  "vscode-languageserver-types": "^3.17.3"
69
69
  }