@abaplint/transpiler 2.13.51 → 2.13.52
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.
|
@@ -26,6 +26,10 @@ class ValueBodyTranspiler {
|
|
|
26
26
|
let extraFields = "";
|
|
27
27
|
let baseCode = undefined;
|
|
28
28
|
const hasLines = body.findDirectExpression(core_1.Expressions.ValueBodyLine) !== undefined;
|
|
29
|
+
const outerLet = body.findDirectExpression(core_1.Expressions.Let);
|
|
30
|
+
const outerLetCode = outerLet === undefined
|
|
31
|
+
? undefined
|
|
32
|
+
: new let_1.LetTranspiler().transpile(outerLet, traversal).getCode();
|
|
29
33
|
const children = body.getChildren();
|
|
30
34
|
for (let i = 0; i < children.length; i++) {
|
|
31
35
|
const child = children[i];
|
|
@@ -68,10 +72,13 @@ class ValueBodyTranspiler {
|
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
i = idx - 1;
|
|
71
|
-
const result = this.buildForChain(forNodes, typ, traversal, body, baseCode);
|
|
75
|
+
const result = this.buildForChain(forNodes, typ, traversal, body, baseCode, outerLetCode);
|
|
72
76
|
ret = result.chunk;
|
|
73
77
|
post = result.post;
|
|
74
78
|
}
|
|
79
|
+
else if (child.get() instanceof core_1.Expressions.Let) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
75
82
|
else if (child instanceof core_1.Nodes.TokenNode && child.getFirstToken().getStr().toUpperCase() === "DEFAULT") {
|
|
76
83
|
// note: this is last in the body, so its okay to prepend and postpend
|
|
77
84
|
const sources = body.findDirectExpressions(core_1.Expressions.Source);
|
|
@@ -94,10 +101,10 @@ class ValueBodyTranspiler {
|
|
|
94
101
|
}
|
|
95
102
|
return ret.appendString(post);
|
|
96
103
|
}
|
|
97
|
-
buildForChain(forNodes, typ, traversal, body, baseCode) {
|
|
104
|
+
buildForChain(forNodes, typ, traversal, body, baseCode, outerLetCode) {
|
|
98
105
|
const val = baseCode ?? new type_name_or_infer_1.TypeNameOrInfer().transpile(typ, traversal).getCode();
|
|
99
106
|
const chunk = new chunk_1.Chunk();
|
|
100
|
-
const preLoopDecls = [];
|
|
107
|
+
const preLoopDecls = outerLetCode === undefined ? [] : [outerLetCode];
|
|
101
108
|
const descriptors = [];
|
|
102
109
|
const levelIndents = [];
|
|
103
110
|
let uniqueCounter = 1;
|