@abaplint/transpiler 2.12.24 → 2.12.25

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.
@@ -9,7 +9,10 @@ class ConstantTranspiler {
9
9
  this.addGet = addGet;
10
10
  }
11
11
  handleInteger(int, traversal) {
12
- const concat = int.concatTokens().trim();
12
+ let concat = int.concatTokens().trim().replace(/^0+/, "");
13
+ if (concat === "") {
14
+ concat = "0";
15
+ }
13
16
  const parsed = Number.parseInt(concat, 10);
14
17
  let code = "";
15
18
  if (concat.length > 18) {
@@ -496,7 +496,13 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
496
496
  }
497
497
  // handle aliases after initialization of carrier variables
498
498
  for (const a of def.getAliases() || []) {
499
- ret += "this." + a.getName().toLowerCase() + " = this." + Traversal.escapeNamespace(a.getComponent().replace("~", "$").toLowerCase()) + ";\n";
499
+ const thisName = `this.${a.getName().toLowerCase()}`;
500
+ const aliasName = "this." + Traversal.escapeNamespace(a.getComponent().replace("~", "$").toLowerCase());
501
+ ret += `if (${thisName} === undefined)\n`;
502
+ ret += thisName + " = " + aliasName + ";\n";
503
+ // or the method(if its a method) might be implemented as its aliased name
504
+ ret += `else if (${aliasName} === undefined)\n`;
505
+ ret += aliasName + " = " + thisName + ";\n";
500
506
  }
501
507
  // constants can be accessed both statically and via reference
502
508
  for (const c of def.getAttributes()?.getConstants() || []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.12.24",
3
+ "version": "2.12.25",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "author": "abaplint",
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "@abaplint/core": "^2.115.14",
32
+ "@abaplint/core": "^2.115.16",
33
33
  "source-map": "^0.7.6"
34
34
  },
35
35
  "devDependencies": {