@abaplint/transpiler-cli 2.5.33 → 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.
- package/build/bundle.js +21 -11
- package/package.json +2 -2
package/build/bundle.js
CHANGED
|
@@ -76000,7 +76000,20 @@ class ClassImplementationTranspiler {
|
|
|
76000
76000
|
}
|
|
76001
76001
|
// this is not correct, ABAP does not invocate the class constructor at require time,
|
|
76002
76002
|
// but this will probably work
|
|
76003
|
-
if (
|
|
76003
|
+
if (traversal.getCurrentObject().getType() === "CLAS") {
|
|
76004
|
+
// gather call of all class constructors together for a global class, also local classes
|
|
76005
|
+
// as they might use the global class
|
|
76006
|
+
if (cdef.isGlobal() === true) {
|
|
76007
|
+
for (const f of traversal.getCurrentObject().getABAPFiles()) {
|
|
76008
|
+
for (const def of f.getInfo().listClassDefinitions()) {
|
|
76009
|
+
if (def.methods.some(m => m.name.toLowerCase() === "class_constructor")) {
|
|
76010
|
+
ret += "await " + traversal.lookupClassOrInterface(def.name, node.getFirstToken()) + ".class_constructor();\n";
|
|
76011
|
+
}
|
|
76012
|
+
}
|
|
76013
|
+
}
|
|
76014
|
+
}
|
|
76015
|
+
}
|
|
76016
|
+
else if (cdef.getMethodDefinitions().getByName("class_constructor")) {
|
|
76004
76017
|
ret += "await " + traversal_1.Traversal.escapeNamespace(node.getFirstToken().getStr().toLowerCase()) + ".class_constructor();\n";
|
|
76005
76018
|
}
|
|
76006
76019
|
return ret;
|
|
@@ -76223,7 +76236,7 @@ class FunctionModuleTranspiler {
|
|
|
76223
76236
|
const scope = traversal.findCurrentScopeByToken(node.getLastToken());
|
|
76224
76237
|
let ret = "";
|
|
76225
76238
|
for (const p of module.getParameters()) {
|
|
76226
|
-
ret += `// ${p.direction} ${p.name} ${p.type}\n`;
|
|
76239
|
+
ret += `// ${p.direction} ${p.name} ${p.type} ${p.optional}\n`;
|
|
76227
76240
|
let direction = p.direction;
|
|
76228
76241
|
if (direction === "importing") {
|
|
76229
76242
|
direction = "exporting";
|
|
@@ -76237,15 +76250,12 @@ class FunctionModuleTranspiler {
|
|
|
76237
76250
|
name += "_";
|
|
76238
76251
|
}
|
|
76239
76252
|
ret += `let ${name} = INPUT.${direction}?.${name};\n`;
|
|
76240
|
-
|
|
76241
|
-
|
|
76242
|
-
|
|
76243
|
-
|
|
76244
|
-
|
|
76245
|
-
|
|
76246
|
-
${name} = ${new transpile_types_1.TranspileTypes().toType(type)};
|
|
76247
|
-
}\n`;
|
|
76248
|
-
}
|
|
76253
|
+
const type = (_c = scope === null || scope === void 0 ? void 0 : scope.findVariable(name)) === null || _c === void 0 ? void 0 : _c.getType();
|
|
76254
|
+
if (type !== undefined && p.optional === true) {
|
|
76255
|
+
// todo, set DEFAULT value
|
|
76256
|
+
ret += `if (${name} === undefined) {
|
|
76257
|
+
${name} = ${new transpile_types_1.TranspileTypes().toType(type)};
|
|
76258
|
+
}\n`;
|
|
76249
76259
|
}
|
|
76250
76260
|
}
|
|
76251
76261
|
return ret;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.35",
|
|
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.5.
|
|
28
|
+
"@abaplint/transpiler": "^2.5.35",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "=7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|