@abaplint/transpiler 2.6.17 → 2.6.18

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.
@@ -13,6 +13,6 @@ export declare class Chunk {
13
13
  stripLastNewline(): void;
14
14
  getCode(): string;
15
15
  toString(): string;
16
- runIndentationLogic(): this;
16
+ runIndentationLogic(ignoreSourceMap?: boolean): this;
17
17
  getMap(generatedFilename: string): string;
18
18
  }
@@ -108,10 +108,13 @@ class Chunk {
108
108
  toString() {
109
109
  throw "error, dont toString a Chunk";
110
110
  }
111
- runIndentationLogic() {
111
+ runIndentationLogic(ignoreSourceMap = false) {
112
112
  let i = 0;
113
113
  let line = 1;
114
114
  const output = [];
115
+ if (ignoreSourceMap === true) {
116
+ this.mappings = [];
117
+ }
115
118
  for (const l of this.raw.split("\n")) {
116
119
  if (l.startsWith("}")) {
117
120
  i = i - 1;
@@ -11,7 +11,7 @@ class HandleABAP {
11
11
  this.options = options;
12
12
  }
13
13
  runObject(obj, reg) {
14
- var _a, _b;
14
+ var _a, _b, _c;
15
15
  let ret = [];
16
16
  if (obj instanceof abaplint.Objects.Program && obj.isInclude() === true) {
17
17
  // includes are only compiled along with the programs where its used?
@@ -27,7 +27,7 @@ class HandleABAP {
27
27
  const contents = new traversal_1.Traversal(spaghetti, file, obj, reg, this.options).traverse(rearranged);
28
28
  chunk.appendChunk(contents);
29
29
  chunk.stripLastNewline();
30
- chunk.runIndentationLogic();
30
+ chunk.runIndentationLogic((_b = this.options) === null || _b === void 0 ? void 0 : _b.ignoreSourceMap);
31
31
  const exports = this.findExports(file.getStructure());
32
32
  const filename = file.getFilename().replace(".abap", ".mjs").toLowerCase();
33
33
  const output = {
@@ -43,7 +43,7 @@ class HandleABAP {
43
43
  ret.push(output);
44
44
  }
45
45
  ret = this.rearrangeClassLocals(obj, ret);
46
- if (((_b = this.options) === null || _b === void 0 ? void 0 : _b.addCommonJS) === true) {
46
+ if (((_c = this.options) === null || _c === void 0 ? void 0 : _c.addCommonJS) === true) {
47
47
  ret.map(output => output.chunk = this.addImportsAndExports(output));
48
48
  }
49
49
  return ret;
@@ -7,7 +7,7 @@ const expressions_1 = require("../expressions");
7
7
  const chunk_1 = require("../chunk");
8
8
  class AssignTranspiler {
9
9
  transpile(node, traversal) {
10
- var _a;
10
+ var _a, _b;
11
11
  const assignSource = node.findDirectExpression(abaplint.Expressions.AssignSource);
12
12
  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())) || [];
13
13
  const fs = new expressions_1.FieldSymbolTranspiler().transpile(node.findDirectExpression(abaplint.Expressions.FSTarget), traversal).getCode();
@@ -59,8 +59,13 @@ class AssignTranspiler {
59
59
  if ((first === null || first === void 0 ? void 0 : first.get()) instanceof abaplint.Expressions.Dynamic && first instanceof abaplint.Nodes.ExpressionNode) {
60
60
  const firstFirst = first.getChildren()[1];
61
61
  if ((firstFirst === null || firstFirst === void 0 ? void 0 : firstFirst.get()) instanceof abaplint.Expressions.Constant) {
62
- const s = firstFirst.getFirstToken().getStr().toLowerCase().match(/\w+/);
63
- options.push(`dynamicSource: (() => {try { return ${s}; } catch {}})()`);
62
+ const s = (_b = firstFirst.getFirstToken().getStr().toLowerCase().match(/\w+/)) === null || _b === void 0 ? void 0 : _b.toString();
63
+ if (s === "me") {
64
+ options.push(`dynamicSource: this.me`);
65
+ }
66
+ else {
67
+ options.push(`dynamicSource: (() => {try { return ${s}; } catch {}})()`);
68
+ }
64
69
  }
65
70
  else if ((firstFirst === null || firstFirst === void 0 ? void 0 : firstFirst.get()) instanceof abaplint.Expressions.FieldChain && firstFirst instanceof abaplint.Nodes.ExpressionNode) {
66
71
  const code = new expressions_1.FieldChainTranspiler(true).transpile(firstFirst, traversal).getCode();
@@ -55,4 +55,6 @@ export interface ITranspilerOptions {
55
55
  keywords?: string[];
56
56
  /** dont insert into REPOSRC */
57
57
  skipReposrc?: boolean;
58
+ /** ignore source map */
59
+ ignoreSourceMap?: boolean;
58
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.6.17",
3
+ "version": "2.6.18",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",