@abaplint/transpiler-cli 2.6.27 → 2.6.29

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 +20 -7
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -71472,7 +71472,8 @@ class AssignTranspiler {
71472
71472
  }
71473
71473
  }
71474
71474
  else if ((first === null || first === void 0 ? void 0 : first.get()) instanceof abaplint.Expressions.Source && first instanceof abaplint.Nodes.ExpressionNode) {
71475
- const name = first.concatTokens().toLowerCase();
71475
+ // const name = first.concatTokens().toLowerCase();
71476
+ const name = new expressions_1.SourceTranspiler().transpile(first, traversal).getCode();
71476
71477
  options.push(`dynamicSource: (() => {
71477
71478
  try { return ${name}; } catch {}
71478
71479
  try { return this.${name}; } catch {}
@@ -74371,7 +74372,7 @@ class MethodImplementationTranspiler {
74371
74372
  if (methodName.toUpperCase() === "CONSTRUCTOR" && classDef) {
74372
74373
  // note that all ABAP identifiers are lower cased, sometimes the kernel does magic, so it needs to know the method input name
74373
74374
  unique = "INPUT";
74374
- after = traversal.buildConstructorContents(scope.getParent(), classDef);
74375
+ // after = traversal.buildConstructorContents(scope.getParent(), classDef);
74375
74376
  methodName = "constructor_";
74376
74377
  }
74377
74378
  const methodDef = this.findMethodParameters(scope);
@@ -76694,10 +76695,13 @@ class ClassImplementationTranspiler {
76694
76695
  const ret = new chunk_1.Chunk();
76695
76696
  for (const c of node.getChildren()) {
76696
76697
  ret.appendChunk(traversal.traverse(c));
76698
+ if (c.get() instanceof abaplint.Statements.ClassImplementation) {
76699
+ ret.appendString(this.buildConstructor(node.getFirstStatement(), traversal));
76700
+ }
76697
76701
  if (c instanceof abaplint.Nodes.StatementNode
76698
76702
  && c.get() instanceof abaplint.Statements.ClassImplementation
76699
76703
  && this.hasConstructor(node) === false) {
76700
- ret.appendString(this.buildConstructor(c, traversal));
76704
+ ret.appendString("async constructor_(INPUT) {\nif (super.constructor_) { await super.constructor_(INPUT); }\nreturn this;\n}\n");
76701
76705
  }
76702
76706
  }
76703
76707
  ret.appendString(this.buildStatic(node.findFirstExpression(abaplint.Expressions.ClassName), traversal));
@@ -76811,6 +76815,9 @@ class ClassImplementationTranspiler {
76811
76815
  }
76812
76816
  buildConstructor(node, traversal) {
76813
76817
  var _a;
76818
+ if (node === undefined) {
76819
+ throw new Error("buildConstructor node undefined");
76820
+ }
76814
76821
  const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
76815
76822
  const token = (_a = node.findFirstExpression(abaplint.Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
76816
76823
  if (token === undefined) {
@@ -76824,7 +76831,8 @@ class ClassImplementationTranspiler {
76824
76831
  if (ret === "") {
76825
76832
  return ret;
76826
76833
  }
76827
- return "async constructor_(INPUT) {\n" + ret + "return this;\n}\n";
76834
+ // note: for CALL TRANSFORMATION, its nice that the values are initialized by the JS constructor,
76835
+ return "constructor() {\n" + ret + "}\n";
76828
76836
  }
76829
76837
  }
76830
76838
  exports.ClassImplementationTranspiler = ClassImplementationTranspiler;
@@ -78022,10 +78030,15 @@ class Traversal {
78022
78030
  buildConstructorContents(scope, def) {
78023
78031
  var _a, _b, _c;
78024
78032
  let ret = "";
78025
- if (def.getSuperClass() !== undefined
78026
- && def.getMethodDefinitions().getByName("CONSTRUCTOR") === undefined) {
78027
- ret += `await super.constructor_(INPUT);\n`;
78033
+ if (def.getSuperClass() !== undefined || def.getName().toUpperCase() === "CX_ROOT") {
78034
+ ret += "super();\n";
78028
78035
  }
78036
+ /*
78037
+ if (def.getSuperClass() !== undefined
78038
+ && def.getMethodDefinitions().getByName("CONSTRUCTOR") === undefined) {
78039
+ ret += `await super.constructor_(INPUT);\n`;
78040
+ }
78041
+ */
78029
78042
  const cName = Traversal.escapeNamespace(def.getName().toLowerCase());
78030
78043
  ret += "this.me = new abap.types.ABAPObject();\n";
78031
78044
  ret += "this.me.set(this);\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.6.27",
3
+ "version": "2.6.29",
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.27",
28
+ "@abaplint/transpiler": "^2.6.29",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",