@abaplint/transpiler 2.5.74 → 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 lookupException = traversal.lookupClassOrInterface("'CX_SY_DYN_CALL_ILLEGAL_CLASS'", child.getFirstToken(), true);
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 && ${lookupException} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_CLASS not found"; }\n`);
30
- ret.appendString(`if (${call} === undefined) { throw new ${lookupException}(); }\n`);
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 && ${lookupException} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_CLASS not found"; }\n`);
35
- ret.appendString(`if (${call} === undefined) { throw new ${lookupException}(); }\n`);
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.5.74",
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.2",
31
+ "@abaplint/core": "^2.97.4",
32
32
  "source-map": "^0.7.4"
33
33
  },
34
34
  "devDependencies": {