@abaplint/transpiler 2.10.4 → 2.10.6

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.
@@ -78,7 +78,8 @@ if (e.classic) {
78
78
  switch (e.classic.toUpperCase()) {\n`;
79
79
  for (const e of node.findAllExpressions(abaplint.Expressions.ParameterException)) {
80
80
  const name = e.getFirstToken().getStr().toUpperCase();
81
- const value = e.findFirstExpression(abaplint.Expressions.SimpleName)?.getFirstToken().getStr().toUpperCase();
81
+ // todo, also handle SimpleChain,
82
+ const value = e.findFirstExpression(abaplint.Expressions.Integer)?.getFirstToken().getStr().toUpperCase();
82
83
  if (value === undefined) {
83
84
  continue;
84
85
  }
@@ -110,7 +110,7 @@ class MethodImplementationTranspiler {
110
110
  throw new Error(`Method name "then" not allowed`);
111
111
  }
112
112
  const superDef = traversal.findClassDefinition(classDef?.getSuperClass(), scope);
113
- for (const a of superDef?.getAliases().getAll() || []) {
113
+ for (const a of superDef?.getAliases() || []) {
114
114
  if (a.getName().toLowerCase() === methodName) {
115
115
  methodName = a.getComponent().replace("~", "$").toLowerCase();
116
116
  }
@@ -94,7 +94,7 @@ class ClassImplementationTranspiler {
94
94
  ret += name + " = " + new transpile_types_1.TranspileTypes().toType(attr.identifier.getType()) + ";\n";
95
95
  ret += traversal.setValues(attr.identifier, name);
96
96
  }
97
- for (const alias of cdef.getAliases().getAll()) {
97
+ for (const alias of cdef.getAliases()) {
98
98
  const isStatic = staticAttributes.some(s => s.prefix.replace("$", "~") + s.identifier.getName() === alias.getComponent());
99
99
  if (isStatic === false) {
100
100
  continue;
@@ -57,10 +57,14 @@ class InterfaceTranspiler {
57
57
  || identifier.getMeta().includes("read_only" /* abaplint.IdentifierMeta.ReadOnly */) === false) {
58
58
  continue;
59
59
  }
60
+ else if (n.includes("~")) {
61
+ // from implemented interface
62
+ continue;
63
+ }
60
64
  const interfaceName = traversal_1.Traversal.escapeNamespace(node.getFirstToken().getStr().toLowerCase());
61
65
  const name = interfaceName + "." + interfaceName + "$" + n.toLowerCase();
62
66
  ret += name + " = " + new transpile_types_1.TranspileTypes().toType(identifier.getType()) + ";\n";
63
- const alias = idef?.getAliases().getAll().find(a => a.getName().toUpperCase() === n.toUpperCase());
67
+ const alias = idef?.getAliases().find(a => a.getName().toUpperCase() === n.toUpperCase());
64
68
  if (alias) {
65
69
  // todo: this is an evil workaround, should be fixed in abaplint instead
66
70
  ret += interfaceName + "." + alias.getComponent().split("~")[0].toLowerCase() + "$" + n.toLowerCase() + " = " + name + ";\n";
@@ -392,7 +392,7 @@ class Traversal {
392
392
  ret += this.aliasesFromInterfaces(i.name, scope, cName);
393
393
  }
394
394
  // handle aliases after initialization of carrier variables
395
- for (const a of def.getAliases()?.getAll() || []) {
395
+ for (const a of def.getAliases() || []) {
396
396
  ret += "this." + a.getName().toLowerCase() + " = this." + Traversal.escapeNamespace(a.getComponent().replace("~", "$").toLowerCase()) + ";\n";
397
397
  }
398
398
  // constants can be accessed both statically and via reference
@@ -455,7 +455,7 @@ class Traversal {
455
455
  aliasesFromInterfaces(name, scope, cname) {
456
456
  let ret = "";
457
457
  const intf = this.findInterfaceDefinition(name, scope);
458
- for (const a of intf?.getAliases().getAll() || []) {
458
+ for (const a of intf?.getAliases() || []) {
459
459
  const iname = Traversal.escapeNamespace(intf?.getName().toLowerCase());
460
460
  const aname = Traversal.escapeNamespace(a.getName().toLowerCase());
461
461
  const cname = Traversal.escapeNamespace(a.getComponent().toLowerCase().replace("~", "$"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.10.4",
3
+ "version": "2.10.6",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -29,15 +29,15 @@
29
29
  "author": "abaplint",
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "@abaplint/core": "^2.110.6",
32
+ "@abaplint/core": "^2.112.9",
33
33
  "source-map": "^0.7.4"
34
34
  },
35
35
  "devDependencies": {
36
- "@types/chai": "^4.3.16",
36
+ "@types/chai": "^4.3.17",
37
37
  "@types/mocha": "^10.0.7",
38
- "chai": "^4.4.1",
39
- "mocha": "^10.6.0",
38
+ "chai": "^4.5.0",
39
+ "mocha": "^10.7.0",
40
40
  "source-map-support": "^0.5.21",
41
- "typescript": "^5.5.3"
41
+ "typescript": "^5.5.4"
42
42
  }
43
43
  }