@abaplint/transpiler-cli 2.3.5 → 2.3.6

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.
Files changed (2) hide show
  1. package/build/bundle.js +1 -1
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -13546,7 +13546,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
13546
13546
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
13547
13547
 
13548
13548
  "use strict";
13549
- eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MethodSourceTranspiler = void 0;\r\n/* eslint-disable max-len */\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst traversal_1 = __webpack_require__(/*! ../traversal */ \"./node_modules/@abaplint/transpiler/build/src/traversal.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nclass MethodSourceTranspiler {\r\n constructor(prepend) {\r\n this.prepend = (prepend || \"\") + \"await \";\r\n }\r\n transpile(node, traversal) {\r\n const ret = new chunk_1.Chunk();\r\n const children = node.getChildren();\r\n let call = \"\";\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n const nextChild = children[i + 1];\r\n if (child.get() instanceof core_1.Expressions.ClassName) {\r\n call += traversal.lookupClassOrInterface(child.concatTokens(), child.getFirstToken());\r\n }\r\n else if (child.get() instanceof core_1.Expressions.Dynamic && (nextChild === null || nextChild === void 0 ? void 0 : nextChild.concatTokens()) === \"=>\") {\r\n const second = child.getChildren()[1];\r\n const lookupException = traversal.lookupClassOrInterface(\"'CX_SY_DYN_CALL_ILLEGAL_CLASS'\", child.getFirstToken(), true);\r\n if (second.get() instanceof core_1.Expressions.FieldChain && second instanceof core_1.Nodes.ExpressionNode) {\r\n const t = new _1.FieldChainTranspiler(true).transpile(second, traversal).getCode();\r\n call = traversal.lookupClassOrInterface(t, child.getFirstToken(), true);\r\n ret.appendString(`if (${call} === undefined && ${lookupException} === undefined) { throw \"CX_SY_DYN_CALL_ILLEGAL_CLASS not found\"; }\\n`);\r\n ret.appendString(`if (${call} === undefined) { throw new ${lookupException}(); }\\n`);\r\n }\r\n else if (second.get() instanceof core_1.Expressions.Constant) {\r\n call = traversal.lookupClassOrInterface(second.getFirstToken().getStr(), child.getFirstToken(), true);\r\n ret.appendString(`if (${call} === undefined && ${lookupException} === undefined) { throw \"CX_SY_DYN_CALL_ILLEGAL_CLASS not found\"; }\\n`);\r\n ret.appendString(`if (${call} === undefined) { throw new ${lookupException}(); }\\n`);\r\n }\r\n else {\r\n ret.appendString(\"MethodSourceTranspiler-Unexpected\");\r\n }\r\n }\r\n else if (child.get() instanceof core_1.Expressions.Dynamic) {\r\n const second = child.getChildren()[1];\r\n const lookupException = traversal.lookupClassOrInterface(\"'CX_SY_DYN_CALL_ILLEGAL_METHOD'\", child.getFirstToken(), true);\r\n if (second.get() instanceof core_1.Expressions.FieldChain) {\r\n if (call.endsWith(\".\")) {\r\n call = call.substring(0, call.length - 1);\r\n }\r\n call += \"[\";\r\n call += traversal.traverse(second).getCode();\r\n call += \".get().toLowerCase()]\";\r\n }\r\n else if (second.get() instanceof core_1.Expressions.Constant) {\r\n if (call === \"\") {\r\n call = \"this.\";\r\n }\r\n else if (call.endsWith(\".\") === false) {\r\n call += \".\";\r\n }\r\n call += second.getFirstToken().getStr().replace(/\\'/g, \"\").toLowerCase().replace(\"~\", \"$\");\r\n }\r\n else {\r\n ret.appendString(\"MethodSourceTranspiler-Unexpected\");\r\n }\r\n ret.appendString(`if (${call} === undefined && ${lookupException} === undefined) { throw \"CX_SY_DYN_CALL_ILLEGAL_METHOD not found\"; }\\n`);\r\n ret.appendString(`if (${call} === undefined) { throw new ${lookupException}(); }\\n`);\r\n }\r\n else if (child.get() instanceof core_1.Expressions.MethodName) {\r\n if (i === 0) {\r\n this.prepend += \"this.\";\r\n }\r\n const nameToken = child.getFirstToken();\r\n const m = traversal.findMethodReference(nameToken, traversal.findCurrentScopeByToken(nameToken));\r\n if (m) {\r\n call += m.name;\r\n }\r\n else {\r\n const methodName = traversal_1.Traversal.escapeClassName(child.concatTokens().toLowerCase().replace(\"~\", \"$\"));\r\n call += methodName;\r\n }\r\n }\r\n else if (child.concatTokens() === \"=>\") {\r\n call += \".\";\r\n }\r\n else if (child.concatTokens() === \"->\") {\r\n if (ret.getCode() !== \"super\") {\r\n call += \".get()\";\r\n }\r\n if (!(nextChild.get() instanceof core_1.Expressions.Dynamic)) {\r\n call += \".\";\r\n }\r\n }\r\n else if (child.get() instanceof core_1.Expressions.FieldChain) {\r\n call += traversal.traverse(child).getCode();\r\n }\r\n else {\r\n ret.appendString(\"MethodSourceTranspiler-\" + child.get().constructor.name + \"-todo\");\r\n }\r\n }\r\n ret.appendString(this.prepend);\r\n ret.appendString(call);\r\n return ret;\r\n }\r\n}\r\nexports.MethodSourceTranspiler = MethodSourceTranspiler;\r\n//# sourceMappingURL=method_source.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/expressions/method_source.js?");
13549
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MethodSourceTranspiler = void 0;\r\n/* eslint-disable max-len */\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst traversal_1 = __webpack_require__(/*! ../traversal */ \"./node_modules/@abaplint/transpiler/build/src/traversal.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nclass MethodSourceTranspiler {\r\n constructor(prepend) {\r\n this.prepend = (prepend || \"\") + \"await \";\r\n }\r\n transpile(node, traversal) {\r\n const ret = new chunk_1.Chunk();\r\n const children = node.getChildren();\r\n let call = \"\";\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n const nextChild = children[i + 1];\r\n if (child.get() instanceof core_1.Expressions.ClassName) {\r\n call += traversal.lookupClassOrInterface(child.concatTokens(), child.getFirstToken());\r\n }\r\n else if (child.get() instanceof core_1.Expressions.Dynamic && (nextChild === null || nextChild === void 0 ? void 0 : nextChild.concatTokens()) === \"=>\") {\r\n const second = child.getChildren()[1];\r\n const lookupException = traversal.lookupClassOrInterface(\"'CX_SY_DYN_CALL_ILLEGAL_CLASS'\", child.getFirstToken(), true);\r\n if (second.get() instanceof core_1.Expressions.FieldChain && second instanceof core_1.Nodes.ExpressionNode) {\r\n const t = new _1.FieldChainTranspiler(true).transpile(second, traversal).getCode();\r\n call = traversal.lookupClassOrInterface(t, child.getFirstToken(), true);\r\n ret.appendString(`if (${call} === undefined && ${lookupException} === undefined) { throw \"CX_SY_DYN_CALL_ILLEGAL_CLASS not found\"; }\\n`);\r\n ret.appendString(`if (${call} === undefined) { throw new ${lookupException}(); }\\n`);\r\n }\r\n else if (second.get() instanceof core_1.Expressions.Constant) {\r\n call = traversal.lookupClassOrInterface(second.getFirstToken().getStr(), child.getFirstToken(), true);\r\n ret.appendString(`if (${call} === undefined && ${lookupException} === undefined) { throw \"CX_SY_DYN_CALL_ILLEGAL_CLASS not found\"; }\\n`);\r\n ret.appendString(`if (${call} === undefined) { throw new ${lookupException}(); }\\n`);\r\n }\r\n else {\r\n ret.appendString(\"MethodSourceTranspiler-Unexpected\");\r\n }\r\n }\r\n else if (child.get() instanceof core_1.Expressions.Dynamic) {\r\n const second = child.getChildren()[1];\r\n const lookupException = traversal.lookupClassOrInterface(\"'CX_SY_DYN_CALL_ILLEGAL_METHOD'\", child.getFirstToken(), true);\r\n if (second.get() instanceof core_1.Expressions.FieldChain) {\r\n if (call.endsWith(\".\")) {\r\n call = call.substring(0, call.length - 1);\r\n }\r\n call += \"[\";\r\n call += traversal.traverse(second).getCode();\r\n call += \".get().toLowerCase()]\";\r\n }\r\n else if (second.get() instanceof core_1.Expressions.Constant) {\r\n if (call === \"\") {\r\n call = \"this.\";\r\n }\r\n else if (call.endsWith(\".\") === false) {\r\n call += \".\";\r\n }\r\n call += second.getFirstToken().getStr().replace(/\\'/g, \"\").toLowerCase().replace(\"~\", \"$\");\r\n }\r\n else {\r\n ret.appendString(\"MethodSourceTranspiler-Unexpected\");\r\n }\r\n ret.appendString(`if (${call} === undefined && ${lookupException} === undefined) { throw \"CX_SY_DYN_CALL_ILLEGAL_METHOD not found\"; }\\n`);\r\n ret.appendString(`if (${call} === undefined) { throw new ${lookupException}(); }\\n`);\r\n }\r\n else if (child.get() instanceof core_1.Expressions.MethodName) {\r\n if (i === 0) {\r\n this.prepend += \"this.\";\r\n }\r\n const nameToken = child.getFirstToken();\r\n const m = traversal.findMethodReference(nameToken, traversal.findCurrentScopeByToken(nameToken));\r\n if (m) {\r\n call += traversal_1.Traversal.escapeClassName(m.name.toLowerCase().replace(\"~\", \"$\"));\r\n }\r\n else {\r\n const methodName = traversal_1.Traversal.escapeClassName(child.concatTokens().toLowerCase().replace(\"~\", \"$\"));\r\n call += methodName;\r\n }\r\n }\r\n else if (child.concatTokens() === \"=>\") {\r\n call += \".\";\r\n }\r\n else if (child.concatTokens() === \"->\") {\r\n if (ret.getCode() !== \"super\") {\r\n call += \".get()\";\r\n }\r\n if (!(nextChild.get() instanceof core_1.Expressions.Dynamic)) {\r\n call += \".\";\r\n }\r\n }\r\n else if (child.get() instanceof core_1.Expressions.FieldChain) {\r\n call += traversal.traverse(child).getCode();\r\n }\r\n else {\r\n ret.appendString(\"MethodSourceTranspiler-\" + child.get().constructor.name + \"-todo\");\r\n }\r\n }\r\n ret.appendString(this.prepend);\r\n ret.appendString(call);\r\n return ret;\r\n }\r\n}\r\nexports.MethodSourceTranspiler = MethodSourceTranspiler;\r\n//# sourceMappingURL=method_source.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/expressions/method_source.js?");
13550
13550
 
13551
13551
  /***/ }),
13552
13552
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.3.5",
3
+ "version": "2.3.6",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,7 +25,7 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.3.5",
28
+ "@abaplint/transpiler": "^2.3.6",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",