@abaplint/transpiler-cli 2.2.6 → 2.2.7

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
@@ -15295,7 +15295,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
15295
15295
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
15296
15296
 
15297
15297
  "use strict";
15298
- 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?");
15298
+ 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 const cleanup = node.findDirectStructures(abaplint.Structures.Cleanup);\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 if (c.get() instanceof abaplint.Statements.Try\r\n || c.get() instanceof abaplint.Statements.EndTry) {\r\n if (catches.length === 0 && cleanup.length === 0) {\r\n continue;\r\n }\r\n ret.appendChunk(traversal.traverse(c));\r\n }\r\n else {\r\n ret.appendChunk(traversal.traverse(c));\r\n }\r\n }\r\n return ret;\r\n }\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?");
15299
15299
 
15300
15300
  /***/ }),
15301
15301
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
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.2.6",
28
+ "@abaplint/transpiler": "^2.2.7",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",