@abaplint/transpiler-cli 1.8.14 → 1.8.15
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.
- package/build/bundle.js +1 -1
- package/package.json +2 -2
package/build/bundle.js
CHANGED
|
@@ -14580,7 +14580,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
14580
14580
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
14581
14581
|
|
|
14582
14582
|
"use strict";
|
|
14583
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TryTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass TryTranspiler {\r\n transpile(node, traversal) {\r\n const ret = new chunk_1.Chunk();\r\n const catches = node.findDirectStructures(abaplint.Structures.Catch);\r\n let catchCode = this.buildCatchCode(catches, traversal);\r\n for (const c of node.getChildren()) {\r\n if (c.get() instanceof abaplint.Structures.Catch) {\r\n if (catchCode) {\r\n ret.appendChunk(catchCode);\r\n }\r\n catchCode = undefined;\r\n }\r\n else {\r\n ret.appendChunk(traversal.traverse(c));\r\n }\r\n }\r\n return ret;\r\n }\r\n buildCatchCode(nodes, traversal) {\r\n let ret = \"\";\r\n let first = true;\r\n if (nodes.length === 0) {\r\n return new chunk_1.Chunk(ret);\r\n }\r\n ret += `} catch (e) {\\n`;\r\n for (const n of nodes) {\r\n const catchStatement = n.findDirectStatement(abaplint.Statements.Catch);\r\n if (catchStatement === undefined) {\r\n throw \"TryTranspiler, unexpected structure\";\r\n }\r\n const catchNames = catchStatement.findDirectExpressions(abaplint.Expressions.ClassName).map(e => traversal.lookupClassOrInterface(e.concatTokens(), e.getFirstToken()));\r\n ret += first ? \"\" : \" else \";\r\n first = false;\r\n ret += \"if (\" + (catchNames === null || catchNames === void 0 ? void 0 : catchNames.map(n => \"e instanceof \" + n).join(\" || \")) + \") {\\n\";\r\n const intoNode = catchStatement.findExpressionAfterToken(\"INTO\");\r\n if (intoNode) {\r\n ret += traversal.traverse(intoNode).getCode() + \".set(e);\\n\";\r\n }\r\n const body = n.findDirectStructure(abaplint.Structures.Body);\r\n if (body) {\r\n ret += traversal.traverse(body).getCode();\r\n }\r\n ret += \"}\";\r\n }\r\n // \"else\" unhandled in this TRY-CATCH, or a javascript runtime error\r\n ret += ` else {\\n` +\r\n `throw e;\\n` +\r\n `}\\n`;\r\n return new chunk_1.Chunk(ret);\r\n }\r\n}\r\nexports.TryTranspiler = TryTranspiler;\r\n//# sourceMappingURL=try.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/structures/try.js?");
|
|
14583
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TryTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass TryTranspiler {\r\n transpile(node, traversal) {\r\n const ret = new chunk_1.Chunk();\r\n const catches = node.findDirectStructures(abaplint.Structures.Catch);\r\n let catchCode = this.buildCatchCode(catches, traversal);\r\n for (const c of node.getChildren()) {\r\n if (c.get() instanceof abaplint.Structures.Catch) {\r\n if (catchCode) {\r\n ret.appendChunk(catchCode);\r\n }\r\n catchCode = undefined;\r\n }\r\n else if (c.get() instanceof abaplint.Structures.Cleanup) {\r\n ret.appendString(`} finally {\\n// Transpiler todo: CLEANUP ignored\\n`);\r\n }\r\n else {\r\n ret.appendChunk(traversal.traverse(c));\r\n }\r\n }\r\n return ret;\r\n }\r\n buildCatchCode(nodes, traversal) {\r\n let ret = \"\";\r\n let first = true;\r\n if (nodes.length === 0) {\r\n return new chunk_1.Chunk(ret);\r\n }\r\n ret += `} catch (e) {\\n`;\r\n for (const n of nodes) {\r\n const catchStatement = n.findDirectStatement(abaplint.Statements.Catch);\r\n if (catchStatement === undefined) {\r\n throw \"TryTranspiler, unexpected structure\";\r\n }\r\n const catchNames = catchStatement.findDirectExpressions(abaplint.Expressions.ClassName).map(e => traversal.lookupClassOrInterface(e.concatTokens(), e.getFirstToken()));\r\n ret += first ? \"\" : \" else \";\r\n first = false;\r\n ret += \"if (\" + (catchNames === null || catchNames === void 0 ? void 0 : catchNames.map(n => \"e instanceof \" + n).join(\" || \")) + \") {\\n\";\r\n const intoNode = catchStatement.findExpressionAfterToken(\"INTO\");\r\n if (intoNode) {\r\n ret += traversal.traverse(intoNode).getCode() + \".set(e);\\n\";\r\n }\r\n const body = n.findDirectStructure(abaplint.Structures.Body);\r\n if (body) {\r\n ret += traversal.traverse(body).getCode();\r\n }\r\n ret += \"}\";\r\n }\r\n // \"else\" unhandled in this TRY-CATCH, or a javascript runtime error\r\n ret += ` else {\\n` +\r\n `throw e;\\n` +\r\n `}\\n`;\r\n return new chunk_1.Chunk(ret);\r\n }\r\n}\r\nexports.TryTranspiler = TryTranspiler;\r\n//# sourceMappingURL=try.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/structures/try.js?");
|
|
14584
14584
|
|
|
14585
14585
|
/***/ }),
|
|
14586
14586
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.15",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abap_transpile": "./abap_transpile"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"author": "abaplint",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@abaplint/transpiler": "^1.8.
|
|
27
|
+
"@abaplint/transpiler": "^1.8.15",
|
|
28
28
|
"@types/glob": "^7.2.0",
|
|
29
29
|
"glob": "^7.2.0",
|
|
30
30
|
"@types/progress": "^2.0.5",
|