@abaplint/transpiler-cli 2.6.17 → 2.6.19

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 +18 -8
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -67228,10 +67228,13 @@ class Chunk {
67228
67228
  toString() {
67229
67229
  throw "error, dont toString a Chunk";
67230
67230
  }
67231
- runIndentationLogic() {
67231
+ runIndentationLogic(ignoreSourceMap = false) {
67232
67232
  let i = 0;
67233
67233
  let line = 1;
67234
67234
  const output = [];
67235
+ if (ignoreSourceMap === true) {
67236
+ this.mappings = [];
67237
+ }
67235
67238
  for (const l of this.raw.split("\n")) {
67236
67239
  if (l.startsWith("}")) {
67237
67240
  i = i - 1;
@@ -70124,7 +70127,7 @@ class HandleABAP {
70124
70127
  this.options = options;
70125
70128
  }
70126
70129
  runObject(obj, reg) {
70127
- var _a, _b;
70130
+ var _a, _b, _c;
70128
70131
  let ret = [];
70129
70132
  if (obj instanceof abaplint.Objects.Program && obj.isInclude() === true) {
70130
70133
  // includes are only compiled along with the programs where its used?
@@ -70140,7 +70143,7 @@ class HandleABAP {
70140
70143
  const contents = new traversal_1.Traversal(spaghetti, file, obj, reg, this.options).traverse(rearranged);
70141
70144
  chunk.appendChunk(contents);
70142
70145
  chunk.stripLastNewline();
70143
- chunk.runIndentationLogic();
70146
+ chunk.runIndentationLogic((_b = this.options) === null || _b === void 0 ? void 0 : _b.ignoreSourceMap);
70144
70147
  const exports = this.findExports(file.getStructure());
70145
70148
  const filename = file.getFilename().replace(".abap", ".mjs").toLowerCase();
70146
70149
  const output = {
@@ -70156,7 +70159,7 @@ class HandleABAP {
70156
70159
  ret.push(output);
70157
70160
  }
70158
70161
  ret = this.rearrangeClassLocals(obj, ret);
70159
- if (((_b = this.options) === null || _b === void 0 ? void 0 : _b.addCommonJS) === true) {
70162
+ if (((_c = this.options) === null || _c === void 0 ? void 0 : _c.addCommonJS) === true) {
70160
70163
  ret.map(output => output.chunk = this.addImportsAndExports(output));
70161
70164
  }
70162
70165
  return ret;
@@ -71242,7 +71245,7 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
71242
71245
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
71243
71246
  class AssignTranspiler {
71244
71247
  transpile(node, traversal) {
71245
- var _a;
71248
+ var _a, _b;
71246
71249
  const assignSource = node.findDirectExpression(abaplint.Expressions.AssignSource);
71247
71250
  const sources = (assignSource === null || assignSource === void 0 ? void 0 : assignSource.findDirectExpressions(abaplint.Expressions.Source).map(e => new expressions_1.SourceTranspiler(false).transpile(e, traversal).getCode())) || [];
71248
71251
  const fs = new expressions_1.FieldSymbolTranspiler().transpile(node.findDirectExpression(abaplint.Expressions.FSTarget), traversal).getCode();
@@ -71294,8 +71297,11 @@ class AssignTranspiler {
71294
71297
  if ((first === null || first === void 0 ? void 0 : first.get()) instanceof abaplint.Expressions.Dynamic && first instanceof abaplint.Nodes.ExpressionNode) {
71295
71298
  const firstFirst = first.getChildren()[1];
71296
71299
  if ((firstFirst === null || firstFirst === void 0 ? void 0 : firstFirst.get()) instanceof abaplint.Expressions.Constant) {
71297
- const s = firstFirst.getFirstToken().getStr().toLowerCase().match(/\w+/);
71298
- options.push(`dynamicSource: (() => {try { return ${s}; } catch {}})()`);
71300
+ const s = (_b = firstFirst.getFirstToken().getStr().toLowerCase().match(/\w+/)) === null || _b === void 0 ? void 0 : _b.toString();
71301
+ options.push(`dynamicSource: (() => {
71302
+ try { return ${s}; } catch {}
71303
+ try { return this.${s}; } catch {}
71304
+ })()`);
71299
71305
  }
71300
71306
  else if ((firstFirst === null || firstFirst === void 0 ? void 0 : firstFirst.get()) instanceof abaplint.Expressions.FieldChain && firstFirst instanceof abaplint.Nodes.ExpressionNode) {
71301
71307
  const code = new expressions_1.FieldChainTranspiler(true).transpile(firstFirst, traversal).getCode();
@@ -71307,7 +71313,11 @@ class AssignTranspiler {
71307
71313
  }
71308
71314
  }
71309
71315
  else if ((first === null || first === void 0 ? void 0 : first.get()) instanceof abaplint.Expressions.Source && first instanceof abaplint.Nodes.ExpressionNode) {
71310
- options.push(`dynamicSource: (() => {try { return ${first.concatTokens()}; } catch {}})()`);
71316
+ const name = first.concatTokens().toLowerCase();
71317
+ options.push(`dynamicSource: (() => {
71318
+ try { return ${name}; } catch {}
71319
+ try { return this.${name}; } catch {}
71320
+ })()`);
71311
71321
  }
71312
71322
  }
71313
71323
  if (concat.endsWith(" CASTING.") || concat.includes(" CASTING TYPE ")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.6.17",
3
+ "version": "2.6.19",
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.6.17",
28
+ "@abaplint/transpiler": "^2.6.19",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",