@abaplint/transpiler 2.5.73 → 2.5.75
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.
|
@@ -22,17 +22,24 @@ class MethodSourceTranspiler {
|
|
|
22
22
|
}
|
|
23
23
|
else if (child.get() instanceof core_1.Expressions.Dynamic && (nextChild === null || nextChild === void 0 ? void 0 : nextChild.concatTokens()) === "=>") {
|
|
24
24
|
const second = child.getChildren()[1];
|
|
25
|
-
const
|
|
25
|
+
const illegalClass = traversal.lookupClassOrInterface("'CX_SY_DYN_CALL_ILLEGAL_CLASS'", child.getFirstToken(), true);
|
|
26
|
+
const illegalMethod = traversal.lookupClassOrInterface("'CX_SY_DYN_CALL_ILLEGAL_METHOD'", child.getFirstToken(), true);
|
|
26
27
|
if (second.get() instanceof core_1.Expressions.FieldChain && second instanceof core_1.Nodes.ExpressionNode) {
|
|
27
28
|
const t = new _1.FieldChainTranspiler(true).transpile(second, traversal).getCode();
|
|
28
29
|
call = traversal.lookupClassOrInterface(t, child.getFirstToken(), true);
|
|
29
|
-
ret.appendString(`if (${call} === undefined && ${
|
|
30
|
-
ret.appendString(`if (${call} === undefined) { throw new ${
|
|
30
|
+
ret.appendString(`if (${call} === undefined && ${illegalClass} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_CLASS not found"; }\n`);
|
|
31
|
+
ret.appendString(`if (${call} === undefined) { throw new ${illegalClass}(); }\n`);
|
|
31
32
|
}
|
|
32
33
|
else if (second.get() instanceof core_1.Expressions.Constant) {
|
|
33
34
|
call = traversal.lookupClassOrInterface(second.getFirstToken().getStr(), child.getFirstToken(), true);
|
|
34
|
-
ret.appendString(`if (${call} === undefined && ${
|
|
35
|
-
ret.appendString(`if (${call} === undefined) { throw new ${
|
|
35
|
+
ret.appendString(`if (${call} === undefined && ${illegalClass} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_CLASS not found"; }\n`);
|
|
36
|
+
ret.appendString(`if (${call} === undefined) { throw new ${illegalClass}(); }\n`);
|
|
37
|
+
const name = children[i + 2];
|
|
38
|
+
if (name.get() instanceof core_1.Expressions.AttributeName) {
|
|
39
|
+
const suffix = "." + name.concatTokens().toLowerCase();
|
|
40
|
+
ret.appendString(`if (${call + suffix} === undefined && ${illegalMethod} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_METHOD not found"; }\n`);
|
|
41
|
+
ret.appendString(`if (${call + suffix} === undefined) { throw new ${illegalMethod}(); }\n`);
|
|
42
|
+
}
|
|
36
43
|
}
|
|
37
44
|
else {
|
|
38
45
|
ret.appendString("MethodSourceTranspiler-Unexpected");
|
package/build/src/traversal.js
CHANGED
|
@@ -289,6 +289,7 @@ class Traversal {
|
|
|
289
289
|
return undefined;
|
|
290
290
|
}
|
|
291
291
|
buildConstructorContents(scope, def) {
|
|
292
|
+
var _a, _b, _c;
|
|
292
293
|
let ret = "";
|
|
293
294
|
if (def.getSuperClass() !== undefined
|
|
294
295
|
&& def.getMethodDefinitions().getByName("CONSTRUCTOR") === undefined) {
|
|
@@ -297,7 +298,7 @@ class Traversal {
|
|
|
297
298
|
const cName = Traversal.escapeNamespace(def.getName().toLowerCase());
|
|
298
299
|
ret += "this.me = new abap.types.ABAPObject();\n";
|
|
299
300
|
ret += "this.me.set(this);\n";
|
|
300
|
-
for (const a of def.getAttributes().getAll()) {
|
|
301
|
+
for (const a of ((_a = def.getAttributes()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
|
|
301
302
|
if (a.getMeta().includes("static" /* abaplint.IdentifierMeta.Static */) === true) {
|
|
302
303
|
continue;
|
|
303
304
|
}
|
|
@@ -310,11 +311,11 @@ class Traversal {
|
|
|
310
311
|
ret += this.dataFromInterfaces(i.name, scope);
|
|
311
312
|
}
|
|
312
313
|
// handle aliases after initialization of carrier variables
|
|
313
|
-
for (const a of def.getAliases().getAll()) {
|
|
314
|
+
for (const a of ((_b = def.getAliases()) === null || _b === void 0 ? void 0 : _b.getAll()) || []) {
|
|
314
315
|
ret += "this." + a.getName().toLowerCase() + " = this." + Traversal.escapeNamespace(a.getComponent().replace("~", "$").toLowerCase()) + ";\n";
|
|
315
316
|
}
|
|
316
317
|
// constants can be accessed both statically and via reference
|
|
317
|
-
for (const c of def.getAttributes().getConstants()) {
|
|
318
|
+
for (const c of ((_c = def.getAttributes()) === null || _c === void 0 ? void 0 : _c.getConstants()) || []) {
|
|
318
319
|
ret += "this." + Traversal.escapeNamespace(c.getName().toLowerCase()) + " = " + cName + "." + Traversal.escapeNamespace(c.getName().toLowerCase()) + ";\n";
|
|
319
320
|
}
|
|
320
321
|
return ret;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.75",
|
|
4
4
|
"description": "Transpiler",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"author": "abaplint",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@abaplint/core": "^2.97.
|
|
31
|
+
"@abaplint/core": "^2.97.4",
|
|
32
32
|
"source-map": "^0.7.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|