@abaplint/transpiler 1.8.19 → 1.8.20
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.
|
@@ -12,7 +12,7 @@ class StringTemplateSourceTranspiler {
|
|
|
12
12
|
let get = true;
|
|
13
13
|
const next = node.findDirectExpression(core_1.Expressions.StringTemplateFormatting);
|
|
14
14
|
if (next) {
|
|
15
|
-
const options = this.build(next);
|
|
15
|
+
const options = this.build(next, traversal);
|
|
16
16
|
if (options) {
|
|
17
17
|
pre = "abap.templateFormatting(";
|
|
18
18
|
post = "," + options + ")";
|
|
@@ -26,16 +26,23 @@ class StringTemplateSourceTranspiler {
|
|
|
26
26
|
ret += pre + new _1.SourceTranspiler(get).transpile(c, traversal).getCode() + post;
|
|
27
27
|
return new chunk_1.Chunk(ret);
|
|
28
28
|
}
|
|
29
|
-
build(node) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
build(node, traversal) {
|
|
30
|
+
let option = "";
|
|
31
|
+
for (const c of node.getChildren()) {
|
|
32
|
+
if (c instanceof core_1.Nodes.TokenNode) {
|
|
33
|
+
if (c.getFirstToken().getStr() === "=") {
|
|
34
|
+
option += ":";
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
option += `"` + c.concatTokens().toLowerCase() + `"`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else if (c.get() instanceof core_1.Expressions.Source) {
|
|
41
|
+
option += new _1.SourceTranspiler(true).transpile(c, traversal).getCode();
|
|
42
|
+
}
|
|
36
43
|
}
|
|
37
|
-
|
|
38
|
-
return "{
|
|
44
|
+
if (option !== "") {
|
|
45
|
+
return "{" + option + "}";
|
|
39
46
|
}
|
|
40
47
|
return undefined;
|
|
41
48
|
}
|