@abaplint/transpiler 2.5.34 → 2.5.35

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.
@@ -101,7 +101,20 @@ class ClassImplementationTranspiler {
101
101
  }
102
102
  // this is not correct, ABAP does not invocate the class constructor at require time,
103
103
  // but this will probably work
104
- if (cdef.getMethodDefinitions().getByName("class_constructor")) {
104
+ if (traversal.getCurrentObject().getType() === "CLAS") {
105
+ // gather call of all class constructors together for a global class, also local classes
106
+ // as they might use the global class
107
+ if (cdef.isGlobal() === true) {
108
+ for (const f of traversal.getCurrentObject().getABAPFiles()) {
109
+ for (const def of f.getInfo().listClassDefinitions()) {
110
+ if (def.methods.some(m => m.name.toLowerCase() === "class_constructor")) {
111
+ ret += "await " + traversal.lookupClassOrInterface(def.name, node.getFirstToken()) + ".class_constructor();\n";
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ else if (cdef.getMethodDefinitions().getByName("class_constructor")) {
105
118
  ret += "await " + traversal_1.Traversal.escapeNamespace(node.getFirstToken().getStr().toLowerCase()) + ".class_constructor();\n";
106
119
  }
107
120
  return ret;
@@ -45,7 +45,7 @@ class FunctionModuleTranspiler {
45
45
  const scope = traversal.findCurrentScopeByToken(node.getLastToken());
46
46
  let ret = "";
47
47
  for (const p of module.getParameters()) {
48
- ret += `// ${p.direction} ${p.name} ${p.type}\n`;
48
+ ret += `// ${p.direction} ${p.name} ${p.type} ${p.optional}\n`;
49
49
  let direction = p.direction;
50
50
  if (direction === "importing") {
51
51
  direction = "exporting";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.5.34",
3
+ "version": "2.5.35",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",