@abaplint/transpiler 2.13.75 → 2.13.76
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.
|
@@ -3,7 +3,7 @@ import { Chunk } from "../chunk";
|
|
|
3
3
|
import { Traversal } from "../traversal";
|
|
4
4
|
import { IExpressionTranspiler } from "./_expression_transpiler";
|
|
5
5
|
export declare class ComponentChainSimpleTranspiler implements IExpressionTranspiler {
|
|
6
|
-
private prefix;
|
|
6
|
+
private readonly prefix;
|
|
7
7
|
constructor(prefix?: string);
|
|
8
8
|
transpile(node: Nodes.ExpressionNode, traversal: Traversal): Chunk;
|
|
9
9
|
}
|
|
@@ -14,6 +14,7 @@ class ComponentChainSimpleTranspiler {
|
|
|
14
14
|
transpile(node, traversal) {
|
|
15
15
|
const offset = [];
|
|
16
16
|
let ret = new chunk_1.Chunk();
|
|
17
|
+
let prefix = this.prefix;
|
|
17
18
|
for (const c of node.getChildren()) {
|
|
18
19
|
const type = c.get();
|
|
19
20
|
if (type instanceof core_1.Expressions.ComponentName) {
|
|
@@ -23,11 +24,17 @@ class ComponentChainSimpleTranspiler {
|
|
|
23
24
|
field = interfaceName + "$" + field;
|
|
24
25
|
}
|
|
25
26
|
field = traversal_1.Traversal.escapeNamespace(field).replace("~", "$");
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
if (traversal_1.Traversal.isBracketComponent(field)) {
|
|
28
|
+
ret.append(prefix.replace(/\.$/, "") + `["${field}"]`, c, traversal);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
ret.append(prefix + field, c, traversal);
|
|
32
|
+
}
|
|
33
|
+
prefix = "";
|
|
28
34
|
}
|
|
29
35
|
else if (type instanceof core_1.Expressions.ArrowOrDash) {
|
|
30
|
-
ret.append(".get()
|
|
36
|
+
ret.append(".get()", c, traversal);
|
|
37
|
+
prefix = ".";
|
|
31
38
|
}
|
|
32
39
|
else if (c instanceof core_1.Nodes.ExpressionNode && c.get() instanceof core_1.Expressions.FieldOffset) {
|
|
33
40
|
offset.push("offset: " + new field_offset_1.FieldOffsetTranspiler().transpile(c, traversal).getCode());
|
|
@@ -97,10 +97,11 @@ class ReadTableTranspiler {
|
|
|
97
97
|
const source = compare.getChildren()[(i * 3) + 2];
|
|
98
98
|
const s = traversal.traverse(source).getCode();
|
|
99
99
|
let field = "";
|
|
100
|
+
let key = left.concatTokens().toLowerCase();
|
|
100
101
|
if (left.get() instanceof abaplint.Expressions.Dynamic
|
|
101
102
|
&& left instanceof abaplint.Nodes.ExpressionNode) {
|
|
102
|
-
|
|
103
|
-
field = "i." +
|
|
103
|
+
key = key.substring(2, key.length - 2);
|
|
104
|
+
field = "i." + key;
|
|
104
105
|
}
|
|
105
106
|
else if (left.get() instanceof abaplint.Expressions.ComponentChainSimple
|
|
106
107
|
&& left instanceof abaplint.Nodes.ExpressionNode) {
|
|
@@ -117,12 +118,12 @@ class ReadTableTranspiler {
|
|
|
117
118
|
prefix += "const " + id + " = " + s + ";\n";
|
|
118
119
|
withKey.push("abap.compare.eq(" + field + ", " + id + ")");
|
|
119
120
|
withKeyValue.push(`{key: (i) => {return ${field}}, value: ${id}}`);
|
|
120
|
-
withKeySimple.push(
|
|
121
|
+
withKeySimple.push(`${JSON.stringify(key)}: ${id}`);
|
|
121
122
|
}
|
|
122
123
|
else {
|
|
123
124
|
withKey.push("abap.compare.eq(" + field + ", " + s + ")");
|
|
124
125
|
withKeyValue.push(`{key: (i) => {return ${field}}, value: ${s}}`);
|
|
125
|
-
withKeySimple.push(
|
|
126
|
+
withKeySimple.push(`${JSON.stringify(key)}: ${s}`);
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
extra.push("withKey: (i) => {return " + withKey.join(" && ") + ";}");
|