@abaplint/core 2.101.23 → 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.
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +44 -0
- package/package.json +1 -1
package/build/src/registry.js
CHANGED
|
@@ -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)) {
|
|
@@ -2148,6 +2189,9 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
2148
2189
|
indentation + `IF sy-subrc = 0.\n` +
|
|
2149
2190
|
indentation + ` ${uniqueName} = ${rowName}${after}.\n` +
|
|
2150
2191
|
indentation + `ENDIF.\n`;
|
|
2192
|
+
if (type.includes("LIKE DATA(")) {
|
|
2193
|
+
type = `LIKE LINE OF ${tabName}`;
|
|
2194
|
+
}
|
|
2151
2195
|
}
|
|
2152
2196
|
if (end !== "") {
|
|
2153
2197
|
indentation = indentation.substring(2);
|