@abaplint/transpiler 2.3.122 → 2.3.123
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/statements/loop.js +22 -2
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ const expressions_1 = require("../expressions");
|
|
|
7
7
|
const chunk_1 = require("../chunk");
|
|
8
8
|
class LoopTranspiler {
|
|
9
9
|
transpile(node, traversal) {
|
|
10
|
-
var _a, _b;
|
|
10
|
+
var _a, _b, _c;
|
|
11
11
|
if (!(node.get() instanceof abaplint.Statements.Loop)) {
|
|
12
12
|
throw new Error("LoopTranspiler, unexpected node");
|
|
13
13
|
}
|
|
@@ -66,12 +66,32 @@ class LoopTranspiler {
|
|
|
66
66
|
extra.push(`usingKey: "${keyNode.concatTokens()}"`);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const whereNode = node.
|
|
69
|
+
const whereNode = node.findDirectExpression(abaplint.Expressions.ComponentCond);
|
|
70
70
|
if (whereNode) {
|
|
71
71
|
const where = traversal.traverse(whereNode).getCode();
|
|
72
72
|
// todo, evil workaround removing "await",
|
|
73
73
|
extra.push("where: async " + where);
|
|
74
74
|
}
|
|
75
|
+
const topEquals = {};
|
|
76
|
+
for (const compare of (whereNode === null || whereNode === void 0 ? void 0 : whereNode.findDirectExpressions(abaplint.Expressions.ComponentCompare)) || []) {
|
|
77
|
+
const op = (_c = compare.findDirectExpression(abaplint.Expressions.CompareOperator)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();
|
|
78
|
+
if (op !== "=" && op !== "EQ") {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
else if (compare.findDirectTokenByText("NOT")) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
const tchain = traversal.traverse(compare.findDirectExpression(abaplint.Expressions.ComponentChainSimple));
|
|
85
|
+
const tsource = traversal.traverse(compare.findDirectExpression(abaplint.Expressions.Source));
|
|
86
|
+
topEquals[tchain.getCode()] = tsource.getCode();
|
|
87
|
+
}
|
|
88
|
+
if (Object.keys(topEquals).length > 0) {
|
|
89
|
+
const fields = [];
|
|
90
|
+
for (const n in topEquals) {
|
|
91
|
+
fields.push(`"${n}": ` + topEquals[n]);
|
|
92
|
+
}
|
|
93
|
+
extra.push("topEquals: {" + fields.join(",") + "}");
|
|
94
|
+
}
|
|
75
95
|
let concat = "";
|
|
76
96
|
if (extra.length > 0) {
|
|
77
97
|
concat = ",{" + extra.join(",") + "}";
|