@abaplint/transpiler 2.7.111 → 2.7.113

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.
@@ -41,13 +41,19 @@ class MethodImplementationTranspiler {
41
41
  unique = "INPUT";
42
42
  }
43
43
  const parameterDefault = methodDef === null || methodDef === void 0 ? void 0 : methodDef.getParameterDefault(varName);
44
- after = after + new transpile_types_1.TranspileTypes().declare(identifier) + "\n";
44
+ // const isOptional = methodDef?.getOptional().includes(varName.toUpperCase());
45
+ const passByValue = identifier.getMeta().includes("pass_by_value" /* abaplint.IdentifierMeta.PassByValue */);
45
46
  const type = identifier.getType();
46
- if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
47
- && type.isGeneric() === false) {
47
+ if (identifier.getMeta().includes("exporting" /* abaplint.IdentifierMeta.MethodExporting */)) {
48
+ after += `let ${varName} = ${unique}?.${varName} || ${new transpile_types_1.TranspileTypes().toType(identifier.getType())};\n`;
49
+ }
50
+ else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */) && type.isGeneric() === false) {
51
+ after += new transpile_types_1.TranspileTypes().declare(identifier) + "\n";
52
+ // note: it might be nessesary to do a type conversion, eg char is passed to xstring parameter
48
53
  after += "if (" + unique + " && " + unique + "." + varName + ") {" + varName + ".set(" + unique + "." + varName + ");}\n";
49
54
  }
50
55
  else {
56
+ after += new transpile_types_1.TranspileTypes().declare(identifier) + "\n";
51
57
  after += "if (" + unique + " && " + unique + "." + varName + ") {" + varName + " = " + unique + "." + varName + ";}\n";
52
58
  }
53
59
  if (parameterDefault) {
@@ -109,7 +115,7 @@ class MethodImplementationTranspiler {
109
115
  else {
110
116
  throw new Error("MethodImplementationTranspiler, unknown default param type");
111
117
  }
112
- if (identifier.getMeta().includes("pass_by_value" /* abaplint.IdentifierMeta.PassByValue */)) {
118
+ if (passByValue === true) {
113
119
  after += "if (" + unique + " === undefined || " + unique + "." + varName + " === undefined) {" + varName + ".set(" + val + ");}\n";
114
120
  }
115
121
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.7.111",
3
+ "version": "2.7.113",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",