@abaplint/core 2.86.4 → 2.86.5
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 +20 -12
- package/package.json +1 -1
package/build/src/registry.js
CHANGED
|
@@ -894,15 +894,19 @@ ${indentation} output = ${topTarget}.`;
|
|
|
894
894
|
return undefined;
|
|
895
895
|
}
|
|
896
896
|
outlineFor(forLoop, indentation, lowFile, highSyntax) {
|
|
897
|
-
var _a, _b, _c, _d;
|
|
897
|
+
var _a, _b, _c, _d, _e;
|
|
898
898
|
let body = "";
|
|
899
899
|
let end = "";
|
|
900
900
|
const loopSource = (_a = forLoop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
901
901
|
const loopTargetField = (_b = forLoop.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
902
|
+
let cond = ((_c = forLoop.findDirectExpression(Expressions.ComponentCond)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "";
|
|
903
|
+
if (cond !== "") {
|
|
904
|
+
cond = " WHERE " + cond;
|
|
905
|
+
}
|
|
902
906
|
if (forLoop.findDirectTokenByText("UNTIL")
|
|
903
907
|
|| forLoop.findDirectTokenByText("WHILE")) {
|
|
904
908
|
const fieldDef = forLoop.findDirectExpression(Expressions.InlineFieldDefinition);
|
|
905
|
-
const field = (
|
|
909
|
+
const field = (_d = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.findFirstExpression(Expressions.Field)) === null || _d === void 0 ? void 0 : _d.concatTokens();
|
|
906
910
|
body += indentation + "DATA " + field + " TYPE i.\n";
|
|
907
911
|
const second = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.getChildren()[2];
|
|
908
912
|
if ((second === null || second === void 0 ? void 0 : second.get()) instanceof Expressions.Source) {
|
|
@@ -915,12 +919,12 @@ ${indentation} output = ${topTarget}.`;
|
|
|
915
919
|
end += indentation + "ENDWHILE";
|
|
916
920
|
}
|
|
917
921
|
else if (loopTargetField) {
|
|
918
|
-
body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField}).\n`;
|
|
922
|
+
body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField})${cond}.\n`;
|
|
919
923
|
end = "ENDLOOP";
|
|
920
924
|
}
|
|
921
925
|
else if (loopTargetField === undefined) {
|
|
922
|
-
const loopTargetFieldSymbol = (
|
|
923
|
-
body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol}).\n`;
|
|
926
|
+
const loopTargetFieldSymbol = (_e = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _e === void 0 ? void 0 : _e.concatTokens();
|
|
927
|
+
body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol})${cond}.\n`;
|
|
924
928
|
end = "ENDLOOP";
|
|
925
929
|
}
|
|
926
930
|
const l = forLoop.findDirectExpression(Expressions.Let);
|
|
@@ -1023,12 +1027,12 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1023
1027
|
name = init.getFirstToken().getStr();
|
|
1024
1028
|
body += indentation + `DATA(${name}) = ${(_a = reduceBody.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens()}.\n`;
|
|
1025
1029
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1030
|
+
let end = "";
|
|
1031
|
+
for (const forLoop of (reduceBody === null || reduceBody === void 0 ? void 0 : reduceBody.findDirectExpressions(Expressions.For)) || []) {
|
|
1032
|
+
const outlineFor = this.outlineFor(forLoop, indentation, lowFile, highSyntax);
|
|
1033
|
+
body += outlineFor.body;
|
|
1034
|
+
end = outlineFor.end + `.\n` + end;
|
|
1029
1035
|
}
|
|
1030
|
-
const outlineFor = this.outlineFor(forLoop, indentation, lowFile, highSyntax);
|
|
1031
|
-
body += outlineFor.body;
|
|
1032
1036
|
const next = reduceBody.findDirectExpression(Expressions.ReduceNext);
|
|
1033
1037
|
if (next === undefined) {
|
|
1034
1038
|
continue;
|
|
@@ -1048,7 +1052,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1048
1052
|
body += concat;
|
|
1049
1053
|
}
|
|
1050
1054
|
}
|
|
1051
|
-
body += indentation +
|
|
1055
|
+
body += indentation + end;
|
|
1052
1056
|
body += indentation + `${uniqueName} = ${name}.\n`;
|
|
1053
1057
|
const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
|
|
1054
1058
|
body +
|
|
@@ -1348,6 +1352,10 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1348
1352
|
if (i.getFirstToken().getStr().toUpperCase() !== "CONV") {
|
|
1349
1353
|
continue;
|
|
1350
1354
|
}
|
|
1355
|
+
const end = i.findDirectTokenByText(")");
|
|
1356
|
+
if (end === undefined) {
|
|
1357
|
+
continue;
|
|
1358
|
+
}
|
|
1351
1359
|
const body = (_a = i.findDirectExpression(Expressions.ConvBody)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
1352
1360
|
if (body === undefined) {
|
|
1353
1361
|
continue;
|
|
@@ -1359,7 +1367,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1359
1367
|
indent + `${uniqueName} = ${body}.\n` +
|
|
1360
1368
|
indent;
|
|
1361
1369
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);
|
|
1362
|
-
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(),
|
|
1370
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), end.getEnd(), uniqueName);
|
|
1363
1371
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
1364
1372
|
return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport CONV", this.getMetadata().key, this.conf.severity, fix);
|
|
1365
1373
|
}
|