@abaplint/transpiler 2.5.67 → 2.5.69
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.
|
@@ -64,7 +64,11 @@ class AssignTranspiler {
|
|
|
64
64
|
}
|
|
65
65
|
else if ((firstFirst === null || firstFirst === void 0 ? void 0 : firstFirst.get()) instanceof abaplint.Expressions.FieldChain && firstFirst instanceof abaplint.Nodes.ExpressionNode) {
|
|
66
66
|
const code = new expressions_1.FieldChainTranspiler(true).transpile(firstFirst, traversal).getCode();
|
|
67
|
-
options.push(`dynamicSource: (() => {
|
|
67
|
+
options.push(`dynamicSource: (() => {
|
|
68
|
+
const name = ${code}.toLowerCase().replace(/[~\\/]/g, "$").match(/[\\w\\$\\/]+/)[0];
|
|
69
|
+
try { return eval(name); } catch {}
|
|
70
|
+
try { return eval("this." + name); } catch {}
|
|
71
|
+
})()`);
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
else if ((first === null || first === void 0 ? void 0 : first.get()) instanceof abaplint.Expressions.Source && first instanceof abaplint.Nodes.ExpressionNode) {
|
package/build/src/traversal.js
CHANGED
|
@@ -174,11 +174,11 @@ class Traversal {
|
|
|
174
174
|
// TODO: visibility is wrong for classes
|
|
175
175
|
for (const a of (def === null || def === void 0 ? void 0 : def.getAttributes().getAll()) || []) {
|
|
176
176
|
const type = new transpile_types_1.TranspileTypes().toType(a.getType());
|
|
177
|
-
attr.push(`"${a.getName().toUpperCase()}": {"type": ${type}, "visibility": "U", "is_constant": " "}`);
|
|
177
|
+
attr.push(`"${a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "U", "is_constant": " "}`);
|
|
178
178
|
}
|
|
179
179
|
for (const a of (def === null || def === void 0 ? void 0 : def.getAttributes().getConstants()) || []) {
|
|
180
180
|
const type = new transpile_types_1.TranspileTypes().toType(a.getType());
|
|
181
|
-
attr.push(`"${a.getName().toUpperCase()}": {"type": ${type}, "visibility": "U", "is_constant": "X"}`);
|
|
181
|
+
attr.push(`"${a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "U", "is_constant": "X"}`);
|
|
182
182
|
}
|
|
183
183
|
return attr.join(",\n");
|
|
184
184
|
}
|