@abaplint/transpiler-cli 2.3.84 → 2.3.85
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 +3 -3
- package/package.json +2 -2
package/build/bundle.js
CHANGED
|
@@ -13975,7 +13975,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13975
13975
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13976
13976
|
|
|
13977
13977
|
"use strict";
|
|
13978
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.HandleABAP = void 0;\r\nconst abaplint = __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 requires_1 = __webpack_require__(/*! ../requires */ \"./node_modules/@abaplint/transpiler/build/src/requires.js\");\r\nconst rearranger_1 = __webpack_require__(/*! ../rearranger */ \"./node_modules/@abaplint/transpiler/build/src/rearranger.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass HandleABAP {\r\n constructor(options) {\r\n this.options = options;\r\n }\r\n runObject(obj, reg) {\r\n var _a, _b, _c;\r\n const spaghetti = new abaplint.SyntaxLogic(reg, obj).run().spaghetti;\r\n let ret = [];\r\n for (const file of obj.getSequencedFiles()) {\r\n const chunk = new chunk_1.Chunk();\r\n if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.addFilenames) === true) {\r\n chunk.appendString(\"// \" + file.getFilename() + \"\\n\");\r\n }\r\n const rearranged = new rearranger_1.Rearranger().run(obj.getType(), file.getStructure());\r\n const contents = new traversal_1.Traversal(spaghetti, file, obj, reg, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.unknownTypes) === \"runtimeError\").traverse(rearranged);\r\n chunk.appendChunk(contents);\r\n chunk.stripLastNewline();\r\n chunk.runIndentationLogic();\r\n const exports = this.findExports(file.getStructure());\r\n const filename = file.getFilename().replace(\".abap\", \".mjs\").toLowerCase();\r\n const output = {\r\n object: {\r\n name: obj.getName(),\r\n type: obj.getType(),\r\n },\r\n filename: filename,\r\n chunk: chunk,\r\n requires: new requires_1.Requires(reg).find(obj, spaghetti.getTop(), file.getFilename()),\r\n exports: exports,\r\n };\r\n ret.push(output);\r\n }\r\n ret = this.rearrangeClassLocals(obj, ret);\r\n if (((_c = this.options) === null || _c === void 0 ? void 0 : _c.addCommonJS) === true) {\r\n ret.map(output => output.chunk = this.addImportsAndExports(output));\r\n }\r\n return ret;\r\n }\r\n /** merges the locals def and imp into one mjs file */\r\n rearrangeClassLocals(obj, output) {\r\n const ret = [];\r\n if (obj.getType() !== \"CLAS\") {\r\n return output;\r\n }\r\n let imp = undefined;\r\n let def = undefined;\r\n for (const o of output) {\r\n if (o.filename.endsWith(\".clas.locals_imp.mjs\")) {\r\n imp = o;\r\n }\r\n else if (o.filename.endsWith(\".clas.locals_def.mjs\")) {\r\n def = o;\r\n }\r\n else {\r\n ret.push(o);\r\n }\r\n }\r\n if (def) {\r\n def.filename = def.filename.replace(\".locals_def.mjs\", \".locals.mjs\");\r\n }\r\n if (imp) {\r\n imp.filename = imp.filename.replace(\".locals_imp.mjs\", \".locals.mjs\");\r\n }\r\n if (imp && def) {\r\n // remove duplicates\r\n const requires = [...def.requires];\r\n for (const r of imp.requires) {\r\n if (requires.find(a => a.filename === r.filename && a.name === r.name) === undefined) {\r\n requires.push(r);\r\n }\r\n }\r\n const chunk = new chunk_1.Chunk().appendChunk(def.chunk).appendChunk(imp.chunk);\r\n ret.push({\r\n object: imp.object,\r\n filename: imp.filename,\r\n chunk: chunk,\r\n requires: requires,\r\n exports: def.exports.concat(imp.exports),\r\n });\r\n }\r\n else if (imp) {\r\n ret.push(imp);\r\n }\r\n else if (def) {\r\n ret.push(def);\r\n }\r\n return ret;\r\n }\r\n addImportsAndExports(output) {\r\n var _a;\r\n const contents = new chunk_1.Chunk();\r\n for (const r of output.requires) {\r\n const name = (_a = r.name) === null || _a === void 0 ? void 0 : _a.toLowerCase();\r\n const filename = r.filename.replace(\".abap\", \".mjs\");\r\n if (filename === output.filename) {\r\n continue;\r\n }\r\n if (name) {\r\n contents.appendString(\"const {\" + traversal_1.Traversal.escapeClassName(name) + \"} = await import(\\\"./\" + filename.replace(/#/g, \"%23\") + \"\\\");\\n\");\r\n }\r\n else {\r\n contents.appendString(\"await import(\\\"./\" + filename.replace(/#/g, \"%23\") + \"\\\");\\n\");\r\n }\r\n }\r\n contents.appendChunk(output.chunk);\r\n if (output.exports.length > 0) {\r\n contents.appendString(\"\\nexport {\" + output.exports.map(traversal_1.Traversal.escapeClassName).join(\", \") + \"};\");\r\n }\r\n return contents;\r\n }\r\n findExports(node) {\r\n var _a, _b;\r\n if (node === undefined) {\r\n return [];\r\n }\r\n const res = [];\r\n for (const c of node.findAllStatements(abaplint.Statements.ClassDefinition)) {\r\n const e = (_a = c.findFirstExpression(abaplint.Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();\r\n if (e) {\r\n res.push(e.toLowerCase());\r\n }\r\n }\r\n for (const c of node.findAllStatements(abaplint.Statements.Interface)) {\r\n const e = (_b = c.findFirstExpression(abaplint.Expressions.InterfaceName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();\r\n if (e) {\r\n res.push(e.toLowerCase());\r\n }\r\n }\r\n return res;\r\n }\r\n}\r\nexports.HandleABAP = HandleABAP;\r\n//# sourceMappingURL=handle_abap.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/handlers/handle_abap.js?");
|
|
13978
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.HandleABAP = void 0;\r\nconst abaplint = __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 requires_1 = __webpack_require__(/*! ../requires */ \"./node_modules/@abaplint/transpiler/build/src/requires.js\");\r\nconst rearranger_1 = __webpack_require__(/*! ../rearranger */ \"./node_modules/@abaplint/transpiler/build/src/rearranger.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass HandleABAP {\r\n constructor(options) {\r\n this.options = options;\r\n }\r\n runObject(obj, reg) {\r\n var _a, _b, _c;\r\n const spaghetti = new abaplint.SyntaxLogic(reg, obj).run().spaghetti;\r\n let ret = [];\r\n if (obj instanceof abaplint.Objects.Program && obj.isInclude() === true) {\r\n // includes are only compiled along with the programs where its used?\r\n return [];\r\n }\r\n for (const file of obj.getSequencedFiles()) {\r\n const chunk = new chunk_1.Chunk();\r\n if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.addFilenames) === true) {\r\n chunk.appendString(\"// \" + file.getFilename() + \"\\n\");\r\n }\r\n const rearranged = new rearranger_1.Rearranger().run(obj.getType(), file.getStructure());\r\n const contents = new traversal_1.Traversal(spaghetti, file, obj, reg, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.unknownTypes) === \"runtimeError\").traverse(rearranged);\r\n chunk.appendChunk(contents);\r\n chunk.stripLastNewline();\r\n chunk.runIndentationLogic();\r\n const exports = this.findExports(file.getStructure());\r\n const filename = file.getFilename().replace(\".abap\", \".mjs\").toLowerCase();\r\n const output = {\r\n object: {\r\n name: obj.getName(),\r\n type: obj.getType(),\r\n },\r\n filename: filename,\r\n chunk: chunk,\r\n requires: new requires_1.Requires(reg).find(obj, spaghetti.getTop(), file.getFilename()),\r\n exports: exports,\r\n };\r\n ret.push(output);\r\n }\r\n ret = this.rearrangeClassLocals(obj, ret);\r\n if (((_c = this.options) === null || _c === void 0 ? void 0 : _c.addCommonJS) === true) {\r\n ret.map(output => output.chunk = this.addImportsAndExports(output));\r\n }\r\n return ret;\r\n }\r\n /** merges the locals def and imp into one mjs file */\r\n rearrangeClassLocals(obj, output) {\r\n const ret = [];\r\n if (obj.getType() !== \"CLAS\") {\r\n return output;\r\n }\r\n let imp = undefined;\r\n let def = undefined;\r\n for (const o of output) {\r\n if (o.filename.endsWith(\".clas.locals_imp.mjs\")) {\r\n imp = o;\r\n }\r\n else if (o.filename.endsWith(\".clas.locals_def.mjs\")) {\r\n def = o;\r\n }\r\n else {\r\n ret.push(o);\r\n }\r\n }\r\n if (def) {\r\n def.filename = def.filename.replace(\".locals_def.mjs\", \".locals.mjs\");\r\n }\r\n if (imp) {\r\n imp.filename = imp.filename.replace(\".locals_imp.mjs\", \".locals.mjs\");\r\n }\r\n if (imp && def) {\r\n // remove duplicates\r\n const requires = [...def.requires];\r\n for (const r of imp.requires) {\r\n if (requires.find(a => a.filename === r.filename && a.name === r.name) === undefined) {\r\n requires.push(r);\r\n }\r\n }\r\n const chunk = new chunk_1.Chunk().appendChunk(def.chunk).appendChunk(imp.chunk);\r\n ret.push({\r\n object: imp.object,\r\n filename: imp.filename,\r\n chunk: chunk,\r\n requires: requires,\r\n exports: def.exports.concat(imp.exports),\r\n });\r\n }\r\n else if (imp) {\r\n ret.push(imp);\r\n }\r\n else if (def) {\r\n ret.push(def);\r\n }\r\n return ret;\r\n }\r\n addImportsAndExports(output) {\r\n var _a;\r\n const contents = new chunk_1.Chunk();\r\n for (const r of output.requires) {\r\n const name = (_a = r.name) === null || _a === void 0 ? void 0 : _a.toLowerCase();\r\n const filename = r.filename.replace(\".abap\", \".mjs\");\r\n if (filename === output.filename) {\r\n continue;\r\n }\r\n if (name) {\r\n contents.appendString(\"const {\" + traversal_1.Traversal.escapeClassName(name) + \"} = await import(\\\"./\" + filename.replace(/#/g, \"%23\") + \"\\\");\\n\");\r\n }\r\n else {\r\n contents.appendString(\"await import(\\\"./\" + filename.replace(/#/g, \"%23\") + \"\\\");\\n\");\r\n }\r\n }\r\n contents.appendChunk(output.chunk);\r\n if (output.exports.length > 0) {\r\n contents.appendString(\"\\nexport {\" + output.exports.map(traversal_1.Traversal.escapeClassName).join(\", \") + \"};\");\r\n }\r\n return contents;\r\n }\r\n findExports(node) {\r\n var _a, _b;\r\n if (node === undefined) {\r\n return [];\r\n }\r\n const res = [];\r\n for (const c of node.findAllStatements(abaplint.Statements.ClassDefinition)) {\r\n const e = (_a = c.findFirstExpression(abaplint.Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();\r\n if (e) {\r\n res.push(e.toLowerCase());\r\n }\r\n }\r\n for (const c of node.findAllStatements(abaplint.Statements.Interface)) {\r\n const e = (_b = c.findFirstExpression(abaplint.Expressions.InterfaceName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();\r\n if (e) {\r\n res.push(e.toLowerCase());\r\n }\r\n }\r\n return res;\r\n }\r\n}\r\nexports.HandleABAP = HandleABAP;\r\n//# sourceMappingURL=handle_abap.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/handlers/handle_abap.js?");
|
|
13979
13979
|
|
|
13980
13980
|
/***/ }),
|
|
13981
13981
|
|
|
@@ -14426,7 +14426,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
14426
14426
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
14427
14427
|
|
|
14428
14428
|
"use strict";
|
|
14429
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DataTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst transpile_types_1 = __webpack_require__(/*! ../transpile_types */ \"./node_modules/@abaplint/transpiler/build/src/transpile_types.js\");\r\nconst constant_1 = __webpack_require__(/*! ../expressions/constant */ \"./node_modules/@abaplint/transpiler/build/src/expressions/constant.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass DataTranspiler {\r\n transpile(node, traversal) {\r\n var _a;\r\n const token = (_a = node.findFirstExpression(abaplint.Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (token === undefined) {\r\n throw new Error(\"DataTranspiler, token not found\");\r\n }\r\n const scope = traversal.findCurrentScopeByToken(token);\r\n if (scope === undefined) {\r\n throw new Error(\"DataTranspiler, scope not found\");\r\n }\r\n const found = scope.findVariable(token.getStr());\r\n if (found === undefined) {\r\n throw new Error(\"DataTranspiler, var not found, \\\"\" + token.getStr() + \"\\\"\");\r\n }\r\n const value = DataTranspiler.buildValue(node, found.getName().toLowerCase(), traversal);\r\n const ret = new chunk_1.Chunk()\r\n .appendString(\"let \")\r\n .append(found.getName().toLowerCase(), token, traversal)\r\n .appendString(\" = \" + new transpile_types_1.TranspileTypes().toType(found.getType()))\r\n .append(\";\", node.getLastToken(), traversal)\r\n .append(value, node.getLastToken(), traversal);\r\n return ret;\r\n }\r\n static buildValue(node, name, traversal) {\r\n let value = \"\";\r\n const val = node.findFirstExpression(abaplint.Expressions.Value);\r\n if (val) {\r\n let int = val.findFirstExpression(abaplint.Expressions.Integer);\r\n if (int === undefined) {\r\n int = val.findFirstExpression(abaplint.Expressions.ConstantString);\r\n }\r\n if (int) {\r\n const escaped = new constant_1.ConstantTranspiler().escape(int.concatTokens());\r\n value = \"\\n\" + name + \".set(\" + escaped + \");\";\r\n }\r\n else if (val.getChildren()[1].get() instanceof abaplint.Expressions.SimpleFieldChain) {\r\n const s = new expressions_1.FieldChainTranspiler().transpile(val.getChildren()[1], traversal).getCode();\r\n value = \"\\n\" + name + \".set(\" + s + \");\";\r\n }\r\n }\r\n return value;\r\n }\r\n}\r\nexports.DataTranspiler = DataTranspiler;\r\n//# sourceMappingURL=data.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/data.js?");
|
|
14429
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DataTranspiler = void 0;\r\nconst abaplint = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst transpile_types_1 = __webpack_require__(/*! ../transpile_types */ \"./node_modules/@abaplint/transpiler/build/src/transpile_types.js\");\r\nconst constant_1 = __webpack_require__(/*! ../expressions/constant */ \"./node_modules/@abaplint/transpiler/build/src/expressions/constant.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass DataTranspiler {\r\n transpile(node, traversal) {\r\n var _a;\r\n const token = (_a = node.findFirstExpression(abaplint.Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (token === undefined) {\r\n throw new Error(\"DataTranspiler, token not found\");\r\n }\r\n const scope = traversal.findCurrentScopeByToken(token);\r\n if (scope === undefined) {\r\n throw new Error(\"DataTranspiler, scope not found: \" + node.concatTokens());\r\n }\r\n const found = scope.findVariable(token.getStr());\r\n if (found === undefined) {\r\n throw new Error(\"DataTranspiler, var not found, \\\"\" + token.getStr() + \"\\\"\");\r\n }\r\n const value = DataTranspiler.buildValue(node, found.getName().toLowerCase(), traversal);\r\n const ret = new chunk_1.Chunk()\r\n .appendString(\"let \")\r\n .append(found.getName().toLowerCase(), token, traversal)\r\n .appendString(\" = \" + new transpile_types_1.TranspileTypes().toType(found.getType()))\r\n .append(\";\", node.getLastToken(), traversal)\r\n .append(value, node.getLastToken(), traversal);\r\n return ret;\r\n }\r\n static buildValue(node, name, traversal) {\r\n let value = \"\";\r\n const val = node.findFirstExpression(abaplint.Expressions.Value);\r\n if (val) {\r\n let int = val.findFirstExpression(abaplint.Expressions.Integer);\r\n if (int === undefined) {\r\n int = val.findFirstExpression(abaplint.Expressions.ConstantString);\r\n }\r\n if (int) {\r\n const escaped = new constant_1.ConstantTranspiler().escape(int.concatTokens());\r\n value = \"\\n\" + name + \".set(\" + escaped + \");\";\r\n }\r\n else if (val.getChildren()[1].get() instanceof abaplint.Expressions.SimpleFieldChain) {\r\n const s = new expressions_1.FieldChainTranspiler().transpile(val.getChildren()[1], traversal).getCode();\r\n value = \"\\n\" + name + \".set(\" + s + \");\";\r\n }\r\n }\r\n return value;\r\n }\r\n}\r\nexports.DataTranspiler = DataTranspiler;\r\n//# sourceMappingURL=data.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/data.js?");
|
|
14430
14430
|
|
|
14431
14431
|
/***/ }),
|
|
14432
14432
|
|
|
@@ -15152,7 +15152,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
15152
15152
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
15153
15153
|
|
|
15154
15154
|
"use strict";
|
|
15155
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ReadTableTranspiler = void 0;\r\nconst abaplint = __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 expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nconst unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ \"./node_modules/@abaplint/transpiler/build/src/unique_identifier.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass ReadTableTranspiler {\r\n transpile(node, traversal) {\r\n let prefix = \"\";\r\n const s = node.findDirectExpression(abaplint.Expressions.SimpleSource2);\r\n const ret = traversal.traverse(s).getCode();\r\n const extra = [];\r\n const index = node.findExpressionAfterToken(\"INDEX\");\r\n if (index) {\r\n const s = new expressions_1.SourceTranspiler().transpile(index, traversal).getCode();\r\n extra.push(\"index: \" + s);\r\n }\r\n const from = node.findExpressionAfterToken(\"FROM\");\r\n if (from) {\r\n const s = new expressions_1.SourceTranspiler().transpile(from, traversal).getCode();\r\n extra.push(\"from: \" + s);\r\n }\r\n const rt = node.findDirectExpression(abaplint.Expressions.ReadTableTarget);\r\n const target = rt === null || rt === void 0 ? void 0 : rt.findDirectExpression(abaplint.Expressions.Target);\r\n const fs = rt === null || rt === void 0 ? void 0 : rt.findDirectExpression(abaplint.Expressions.FSTarget);\r\n if (rt && fs) {\r\n const name = new expressions_1.FieldSymbolTranspiler().transpile(fs, traversal).getCode();\r\n extra.push(\"assigning: \" + name);\r\n }\r\n else if (target) {\r\n const name = traversal.traverse(target).getCode();\r\n if (rt === null || rt === void 0 ? void 0 : rt.findDirectTokenByText(\"REFERENCE\")) {\r\n extra.push(\"referenceInto: \" + name);\r\n }\r\n else {\r\n extra.push(\"into: \" + name);\r\n }\r\n }\r\n const compare = node.findDirectExpression(abaplint.Expressions.ComponentCompareSimple);\r\n if (compare) {\r\n const conds = [];\r\n const count = compare.getChildren().length / 3;\r\n for (let i = 0; i < count; i++) {\r\n const left = compare.getChildren()[i * 3];\r\n const source = compare.getChildren()[(i * 3) + 2];\r\n const s = traversal.traverse(source).getCode();\r\n let field = left.concatTokens().toLowerCase();\r\n while (field.includes(\"->\")) {\r\n field = field.replace(\"->\", \".get().\");\r\n }\r\n while (field.includes(\"-\")) {\r\n field = field.replace(\"-\", \".get().\");\r\n }\r\n field = traversal_1.Traversal.escapeClassName(field);\r\n if (left.get() instanceof abaplint.Expressions.Dynamic\r\n && left instanceof abaplint.Nodes.ExpressionNode) {\r\n const concat = left.concatTokens().toLowerCase();\r\n field = concat.substring(2, concat.length - 2);\r\n }\r\n if (s.includes(\"await\")) {\r\n const id = unique_identifier_1.UniqueIdentifier.get();\r\n prefix += \"const \" + id + \" = \" + s + \";\\n\";\r\n conds.push(\"abap.compare.eq(i.\" + field + \", \" + id + \")\");\r\n }\r\n else {\r\n conds.push(\"abap.compare.eq(i.\" + field + \", \" + s + \")\");\r\n }\r\n }\r\n extra.push(\"withKey: (i) => {return \" + conds.join(\" && \") + \";}\");\r\n }\r\n let concat = \"\";\r\n if (extra.length > 0) {\r\n concat = \",{\" + extra.join(\",\") + \"}\";\r\n }\r\n return new chunk_1.Chunk()\r\n .append(prefix + \"abap.statements.readTable(\", node, traversal)\r\n .appendString(ret + concat)\r\n .append(\");\", node.getLastToken(), traversal);\r\n }\r\n}\r\nexports.ReadTableTranspiler = ReadTableTranspiler;\r\n//# sourceMappingURL=read_table.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/read_table.js?");
|
|
15155
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ReadTableTranspiler = void 0;\r\nconst abaplint = __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 expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/transpiler/build/src/expressions/index.js\");\r\nconst unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ \"./node_modules/@abaplint/transpiler/build/src/unique_identifier.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass ReadTableTranspiler {\r\n transpile(node, traversal) {\r\n let prefix = \"\";\r\n const s = node.findDirectExpression(abaplint.Expressions.SimpleSource2);\r\n const ret = traversal.traverse(s).getCode();\r\n const extra = [];\r\n const index = node.findExpressionAfterToken(\"INDEX\");\r\n if (index) {\r\n const s = new expressions_1.SourceTranspiler().transpile(index, traversal).getCode();\r\n extra.push(\"index: \" + s);\r\n }\r\n const from = node.findExpressionAfterToken(\"FROM\");\r\n if (from) {\r\n const s = new expressions_1.SourceTranspiler().transpile(from, traversal).getCode();\r\n extra.push(\"from: \" + s);\r\n }\r\n const rt = node.findDirectExpression(abaplint.Expressions.ReadTableTarget);\r\n const target = rt === null || rt === void 0 ? void 0 : rt.findDirectExpression(abaplint.Expressions.Target);\r\n const fs = rt === null || rt === void 0 ? void 0 : rt.findDirectExpression(abaplint.Expressions.FSTarget);\r\n if (rt && fs) {\r\n const name = new expressions_1.FieldSymbolTranspiler().transpile(fs, traversal).getCode();\r\n extra.push(\"assigning: \" + name);\r\n }\r\n else if (target) {\r\n const name = traversal.traverse(target).getCode();\r\n if (rt === null || rt === void 0 ? void 0 : rt.findDirectTokenByText(\"REFERENCE\")) {\r\n extra.push(\"referenceInto: \" + name);\r\n }\r\n else {\r\n extra.push(\"into: \" + name);\r\n }\r\n }\r\n const compare = node.findDirectExpression(abaplint.Expressions.ComponentCompareSimple);\r\n if (compare) {\r\n const conds = [];\r\n const count = compare.getChildren().length / 3;\r\n for (let i = 0; i < count; i++) {\r\n const left = compare.getChildren()[i * 3];\r\n const source = compare.getChildren()[(i * 3) + 2];\r\n const s = traversal.traverse(source).getCode();\r\n let field = left.concatTokens().toLowerCase();\r\n while (field.includes(\"->\")) {\r\n field = field.replace(\"->\", \".get().\");\r\n }\r\n while (field.includes(\"-\")) {\r\n field = field.replace(\"-\", \".get().\");\r\n }\r\n field = traversal_1.Traversal.escapeClassName(field).replace(\"~\", \"$\");\r\n if (left.get() instanceof abaplint.Expressions.Dynamic\r\n && left instanceof abaplint.Nodes.ExpressionNode) {\r\n const concat = left.concatTokens().toLowerCase();\r\n field = concat.substring(2, concat.length - 2);\r\n }\r\n if (s.includes(\"await\")) {\r\n const id = unique_identifier_1.UniqueIdentifier.get();\r\n prefix += \"const \" + id + \" = \" + s + \";\\n\";\r\n conds.push(\"abap.compare.eq(i.\" + field + \", \" + id + \")\");\r\n }\r\n else {\r\n conds.push(\"abap.compare.eq(i.\" + field + \", \" + s + \")\");\r\n }\r\n }\r\n extra.push(\"withKey: (i) => {return \" + conds.join(\" && \") + \";}\");\r\n }\r\n let concat = \"\";\r\n if (extra.length > 0) {\r\n concat = \",{\" + extra.join(\",\") + \"}\";\r\n }\r\n return new chunk_1.Chunk()\r\n .append(prefix + \"abap.statements.readTable(\", node, traversal)\r\n .appendString(ret + concat)\r\n .append(\");\", node.getLastToken(), traversal);\r\n }\r\n}\r\nexports.ReadTableTranspiler = ReadTableTranspiler;\r\n//# sourceMappingURL=read_table.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/statements/read_table.js?");
|
|
15156
15156
|
|
|
15157
15157
|
/***/ }),
|
|
15158
15158
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.85",
|
|
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.
|
|
28
|
+
"@abaplint/transpiler": "^2.3.85",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "=7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|