@abaplint/transpiler-cli 2.11.11 → 2.11.13

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 +148 -43
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -5039,7 +5039,7 @@ class InlineData extends combi_1.Expression {
5039
5039
  const left = (0, combi_1.tok)(tokens_1.ParenLeft);
5040
5040
  const data = (0, combi_1.seq)("DATA", left, _1.TargetField, right);
5041
5041
  const final = (0, combi_1.seq)("FINAL", left, _1.TargetField, right);
5042
- return (0, combi_1.altPrio)((0, combi_1.ver)(version_1.Version.v740sp02, data), (0, combi_1.ver)(version_1.Version.v757, final));
5042
+ return (0, combi_1.altPrio)((0, combi_1.ver)(version_1.Version.v740sp02, data, version_1.Version.OpenABAP), (0, combi_1.ver)(version_1.Version.v757, final, version_1.Version.OpenABAP));
5043
5043
  }
5044
5044
  }
5045
5045
  exports.InlineData = InlineData;
@@ -27050,7 +27050,10 @@ class Source {
27050
27050
  console.dir(foundType);
27051
27051
  console.dir(s);
27052
27052
  */
27053
- if (foundType === undefined && s) {
27053
+ if (foundType && foundType.isGeneric() && s) {
27054
+ foundType = new basic_1.DataReference(s);
27055
+ }
27056
+ else if (foundType === undefined && s) {
27054
27057
  foundType = new basic_1.DataReference(s);
27055
27058
  }
27056
27059
  else if (foundType && targetType === undefined) {
@@ -53687,7 +53690,7 @@ class Registry {
53687
53690
  }
53688
53691
  static abaplintVersion() {
53689
53692
  // magic, see build script "version.sh"
53690
- return "2.113.158";
53693
+ return "2.113.160";
53691
53694
  }
53692
53695
  getDDICReferences() {
53693
53696
  return this.ddicReferences;
@@ -79226,8 +79229,6 @@ __exportStar(__webpack_require__(/*! ./field_length */ "./node_modules/@abaplint
79226
79229
  __exportStar(__webpack_require__(/*! ./field_offset */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_offset.js"), exports);
79227
79230
  __exportStar(__webpack_require__(/*! ./field_symbol */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_symbol.js"), exports);
79228
79231
  __exportStar(__webpack_require__(/*! ./function_exporting */ "./node_modules/@abaplint/transpiler/build/src/expressions/function_exporting.js"), exports);
79229
- __exportStar(__webpack_require__(/*! ./source_field_symbol_chain */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field_symbol_chain.js"), exports);
79230
- __exportStar(__webpack_require__(/*! ./type_name_or_infer */ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js"), exports);
79231
79232
  __exportStar(__webpack_require__(/*! ./function_parameters */ "./node_modules/@abaplint/transpiler/build/src/expressions/function_parameters.js"), exports);
79232
79233
  __exportStar(__webpack_require__(/*! ./message_number */ "./node_modules/@abaplint/transpiler/build/src/expressions/message_number.js"), exports);
79233
79234
  __exportStar(__webpack_require__(/*! ./method_call_body */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_body.js"), exports);
@@ -79246,6 +79247,7 @@ __exportStar(__webpack_require__(/*! ./simple_source1 */ "./node_modules/@abapli
79246
79247
  __exportStar(__webpack_require__(/*! ./simple_source2 */ "./node_modules/@abaplint/transpiler/build/src/expressions/simple_source2.js"), exports);
79247
79248
  __exportStar(__webpack_require__(/*! ./simple_source3 */ "./node_modules/@abaplint/transpiler/build/src/expressions/simple_source3.js"), exports);
79248
79249
  __exportStar(__webpack_require__(/*! ./simple_source4 */ "./node_modules/@abaplint/transpiler/build/src/expressions/simple_source4.js"), exports);
79250
+ __exportStar(__webpack_require__(/*! ./source_field_symbol_chain */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field_symbol_chain.js"), exports);
79249
79251
  __exportStar(__webpack_require__(/*! ./source_field_symbol */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field_symbol.js"), exports);
79250
79252
  __exportStar(__webpack_require__(/*! ./source_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field.js"), exports);
79251
79253
  __exportStar(__webpack_require__(/*! ./source */ "./node_modules/@abaplint/transpiler/build/src/expressions/source.js"), exports);
@@ -79257,8 +79259,8 @@ __exportStar(__webpack_require__(/*! ./sql_field_name */ "./node_modules/@abapli
79257
79259
  __exportStar(__webpack_require__(/*! ./sql_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field.js"), exports);
79258
79260
  __exportStar(__webpack_require__(/*! ./sql_from_source */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from_source.js"), exports);
79259
79261
  __exportStar(__webpack_require__(/*! ./sql_from */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from.js"), exports);
79260
- __exportStar(__webpack_require__(/*! ./sql_into_structure */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_into_structure.js"), exports);
79261
79262
  __exportStar(__webpack_require__(/*! ./sql_into_list */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_into_list.js"), exports);
79263
+ __exportStar(__webpack_require__(/*! ./sql_into_structure */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_into_structure.js"), exports);
79262
79264
  __exportStar(__webpack_require__(/*! ./sql_join */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_join.js"), exports);
79263
79265
  __exportStar(__webpack_require__(/*! ./sql_order_by */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_order_by.js"), exports);
79264
79266
  __exportStar(__webpack_require__(/*! ./sql_source_simple */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_source_simple.js"), exports);
@@ -79266,7 +79268,9 @@ __exportStar(__webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/t
79266
79268
  __exportStar(__webpack_require__(/*! ./sql_target */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_target.js"), exports);
79267
79269
  __exportStar(__webpack_require__(/*! ./string_template_source */ "./node_modules/@abaplint/transpiler/build/src/expressions/string_template_source.js"), exports);
79268
79270
  __exportStar(__webpack_require__(/*! ./string_template */ "./node_modules/@abaplint/transpiler/build/src/expressions/string_template.js"), exports);
79271
+ __exportStar(__webpack_require__(/*! ./target_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/target_field.js"), exports);
79269
79272
  __exportStar(__webpack_require__(/*! ./target */ "./node_modules/@abaplint/transpiler/build/src/expressions/target.js"), exports);
79273
+ __exportStar(__webpack_require__(/*! ./type_name_or_infer */ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js"), exports);
79270
79274
  //# sourceMappingURL=index.js.map
79271
79275
 
79272
79276
  /***/ }),
@@ -80071,9 +80075,9 @@ class SourceTranspiler {
80071
80075
  const scope = traversal.findCurrentScopeByToken(infer.getFirstToken());
80072
80076
  const inferType = traversal.lookupInferred(infer, scope);
80073
80077
  if (inferType === undefined) {
80074
- throw new Error("transpiler: REF # todo, lookupInferred");
80078
+ throw new Error("transpiler: REF # todo, lookupInferred, " + node.concatTokens());
80075
80079
  }
80076
- const typ = new transpile_types_1.TranspileTypes().toType(inferType);
80080
+ const typ = transpile_types_1.TranspileTypes.toType(inferType);
80077
80081
  if (typ.startsWith("new abap.types.DataReference(") === false) {
80078
80082
  throw new Error("transpiler: REF # unexpected type");
80079
80083
  }
@@ -80333,7 +80337,7 @@ class SQLCondTranspiler {
80333
80337
  const conversionField = traversal.isSQLConversion(source.getFirstToken());
80334
80338
  if (conversionField) {
80335
80339
  const field = (table?.parseType(traversal.reg)).getComponentByName(conversionField);
80336
- ret += "'\" + " + new transpile_types_1.TranspileTypes().toType(field) + ".set(" + concat + ").get() + \"'";
80340
+ ret += "'\" + " + transpile_types_1.TranspileTypes.toType(field) + ".set(" + concat + ").get() + \"'";
80337
80341
  }
80338
80342
  else if (concat.startsWith("`")) {
80339
80343
  ret += "'" + concat.substring(1, concat.length - 1) + "'";
@@ -81029,6 +81033,27 @@ exports.TargetTranspiler = TargetTranspiler;
81029
81033
 
81030
81034
  /***/ }),
81031
81035
 
81036
+ /***/ "./node_modules/@abaplint/transpiler/build/src/expressions/target_field.js":
81037
+ /*!*********************************************************************************!*\
81038
+ !*** ./node_modules/@abaplint/transpiler/build/src/expressions/target_field.js ***!
81039
+ \*********************************************************************************/
81040
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
81041
+
81042
+ "use strict";
81043
+
81044
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
81045
+ exports.TargetFieldTranspiler = void 0;
81046
+ const field_chain_1 = __webpack_require__(/*! ./field_chain */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_chain.js");
81047
+ class TargetFieldTranspiler {
81048
+ transpile(node, traversal) {
81049
+ return new field_chain_1.FieldChainTranspiler().transpile(node, traversal);
81050
+ }
81051
+ }
81052
+ exports.TargetFieldTranspiler = TargetFieldTranspiler;
81053
+ //# sourceMappingURL=target_field.js.map
81054
+
81055
+ /***/ }),
81056
+
81032
81057
  /***/ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js":
81033
81058
  /*!***************************************************************************************!*\
81034
81059
  !*** ./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js ***!
@@ -81055,7 +81080,7 @@ class TypeNameOrInfer {
81055
81080
  throw new Error("TypeNameOrInfer, type not found: " + node.concatTokens());
81056
81081
  }
81057
81082
  const ret = new chunk_1.Chunk();
81058
- ret.appendString(new transpile_types_1.TranspileTypes().toType(type));
81083
+ ret.appendString(transpile_types_1.TranspileTypes.toType(type));
81059
81084
  return ret;
81060
81085
  }
81061
81086
  }
@@ -81265,7 +81290,7 @@ class HandleDataElement {
81265
81290
  }
81266
81291
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
81267
81292
  "objectType": "DTEL",
81268
- "type": ${new transpile_types_1.TranspileTypes().toType(type)},
81293
+ "type": ${transpile_types_1.TranspileTypes.toType(type)},
81269
81294
  "domain": ${JSON.stringify(obj.getDomainName())},
81270
81295
  "fixedValues": ${JSON.stringify(fixedValues)},
81271
81296
  };`);
@@ -81547,7 +81572,7 @@ class HandleTable {
81547
81572
  const type = obj.parseType(reg);
81548
81573
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
81549
81574
  "objectType": "TABL",
81550
- "type": ${new transpile_types_1.TranspileTypes().toType(type)},
81575
+ "type": ${transpile_types_1.TranspileTypes.toType(type)},
81551
81576
  "keyFields": ${JSON.stringify(obj.listKeys(reg))},
81552
81577
  };`);
81553
81578
  const output = {
@@ -81589,7 +81614,7 @@ class HandleTableType {
81589
81614
  const type = obj.parseType(reg);
81590
81615
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
81591
81616
  "objectType": "TTYP",
81592
- "type": ${new transpile_types_1.TranspileTypes().toType(type)},
81617
+ "type": ${transpile_types_1.TranspileTypes.toType(type)},
81593
81618
  };`);
81594
81619
  const output = {
81595
81620
  object: {
@@ -81640,7 +81665,7 @@ class HandleTypePool {
81640
81665
  for (const v in spaghettiNode?.getData().vars) {
81641
81666
  const abs = spaghettiNode.getData().vars[v];
81642
81667
  const name = `pool['${v.toLowerCase()}']`;
81643
- chunk.appendString(`${name} = ${new transpile_types_1.TranspileTypes().toType(abs.getType())};\n`);
81668
+ chunk.appendString(`${name} = ${transpile_types_1.TranspileTypes.toType(abs.getType())};\n`);
81644
81669
  chunk.appendString(traversal_1.Traversal.setValues(abs, name));
81645
81670
  // yea, this is a mess
81646
81671
  for (const cons of abapFile.getStructure()?.findAllStructures(abaplint.Structures.Constants) || []) {
@@ -81652,7 +81677,7 @@ class HandleTypePool {
81652
81677
  }
81653
81678
  for (const t in spaghettiNode?.getData().types) {
81654
81679
  const abs = spaghettiNode.getData().types[t];
81655
- chunk.appendString(`pool['${t.toLowerCase()}'] = ${new transpile_types_1.TranspileTypes().toType(abs.getType())};\n`);
81680
+ chunk.appendString(`pool['${t.toLowerCase()}'] = ${transpile_types_1.TranspileTypes.toType(abs.getType())};\n`);
81656
81681
  }
81657
81682
  chunk.appendString(`abap.TypePools['${obj.getName()}'] = pool;`);
81658
81683
  const output = {
@@ -81695,7 +81720,7 @@ class HandleView {
81695
81720
  const type = obj.parseType(reg);
81696
81721
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
81697
81722
  "objectType": "VIEW",
81698
- "type": ${new transpile_types_1.TranspileTypes().toType(type)},
81723
+ "type": ${transpile_types_1.TranspileTypes.toType(type)},
81699
81724
  };`);
81700
81725
  // todo, "keyFields": ${JSON.stringify(obj.listKeys())},
81701
81726
  const output = {
@@ -82019,6 +82044,42 @@ exports.Initialization = Initialization;
82019
82044
 
82020
82045
  /***/ }),
82021
82046
 
82047
+ /***/ "./node_modules/@abaplint/transpiler/build/src/inline.js":
82048
+ /*!***************************************************************!*\
82049
+ !*** ./node_modules/@abaplint/transpiler/build/src/inline.js ***!
82050
+ \***************************************************************/
82051
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
82052
+
82053
+ "use strict";
82054
+
82055
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
82056
+ exports.InlineDeclarations = void 0;
82057
+ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
82058
+ const transpile_types_1 = __webpack_require__(/*! ./transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
82059
+ class InlineDeclarations {
82060
+ static buildDeclarations(node, traversal) {
82061
+ const expressions = node.findAllExpressionsRecursive(abaplint.Expressions.InlineData);
82062
+ let result = "";
82063
+ for (const expression of expressions) {
82064
+ const name = expression.findFirstExpression(abaplint.Expressions.TargetField)?.concatTokens();
82065
+ if (name === undefined) {
82066
+ throw new Error("InlineDeclarations: no target field found");
82067
+ }
82068
+ const scope = traversal.findCurrentScopeByToken(expression.getFirstToken());
82069
+ const variable = scope?.findVariable(name);
82070
+ if (variable === undefined) {
82071
+ throw new Error("InlineDeclarations: no variable found");
82072
+ }
82073
+ result += transpile_types_1.TranspileTypes.declare(variable) + "\n";
82074
+ }
82075
+ return result;
82076
+ }
82077
+ }
82078
+ exports.InlineDeclarations = InlineDeclarations;
82079
+ //# sourceMappingURL=inline.js.map
82080
+
82081
+ /***/ }),
82082
+
82022
82083
  /***/ "./node_modules/@abaplint/transpiler/build/src/keywords.js":
82023
82084
  /*!*****************************************************************!*\
82024
82085
  !*** ./node_modules/@abaplint/transpiler/build/src/keywords.js ***!
@@ -83543,7 +83604,7 @@ class CreateDataTranspiler {
83543
83604
  if (typeNameNode) {
83544
83605
  const id = traversal.findCurrentScopeByToken(typeNameNode.getFirstToken())?.findType(typeNameNode.concatTokens());
83545
83606
  if (id) {
83546
- options.push(`"type": ` + new transpile_types_1.TranspileTypes().toType(id.getType()));
83607
+ options.push(`"type": ` + transpile_types_1.TranspileTypes.toType(id.getType()));
83547
83608
  }
83548
83609
  else {
83549
83610
  options.push(`"typeName": "${typeNameNode.concatTokens().toUpperCase()}"`);
@@ -83724,7 +83785,7 @@ class DataTranspiler {
83724
83785
  const ret = new chunk_1.Chunk()
83725
83786
  .appendString("let ")
83726
83787
  .appendString(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(found.getName().toLowerCase())))
83727
- .appendString(" = " + new transpile_types_1.TranspileTypes().toType(found.getType()))
83788
+ .appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType()))
83728
83789
  .appendString(";")
83729
83790
  .appendString(value);
83730
83791
  return ret;
@@ -84574,7 +84635,7 @@ class FieldSymbolTranspiler {
84574
84635
  return new chunk_1.Chunk()
84575
84636
  .appendString("let ")
84576
84637
  .appendString(new field_symbol_1.FieldSymbolTranspiler().transpile(name, traversal).getCode())
84577
- .appendString(" = new abap.types.FieldSymbol(" + new transpile_types_1.TranspileTypes().toType(found.getType()) + ");");
84638
+ .appendString(" = new abap.types.FieldSymbol(" + transpile_types_1.TranspileTypes.toType(found.getType()) + ");");
84578
84639
  }
84579
84640
  throw new Error("FieldSymbolTranspiler, name not found");
84580
84641
  }
@@ -85488,6 +85549,14 @@ class LoopTranspiler {
85488
85549
  getTarget() {
85489
85550
  return this.unique;
85490
85551
  }
85552
+ determineInto(node) {
85553
+ const loopTarget = node.findDirectExpression(abaplint.Expressions.LoopTarget);
85554
+ let into = loopTarget?.findDirectExpression(abaplint.Expressions.Target);
85555
+ if (into?.getFirstChild()?.get() instanceof abaplint.Expressions.InlineData) {
85556
+ into = into.findFirstExpression(abaplint.Expressions.TargetField);
85557
+ }
85558
+ return into;
85559
+ }
85491
85560
  transpile(node, traversal) {
85492
85561
  if (!(node.get() instanceof abaplint.Statements.Loop)) {
85493
85562
  throw new Error("LoopTranspiler, unexpected node");
@@ -85496,7 +85565,7 @@ class LoopTranspiler {
85496
85565
  const source = traversal.traverse(loopSource).getCode();
85497
85566
  this.unique = unique_identifier_1.UniqueIdentifier.get();
85498
85567
  let target = "";
85499
- const into = node.findDirectExpression(abaplint.Expressions.LoopTarget)?.findDirectExpression(abaplint.Expressions.Target);
85568
+ const into = this.determineInto(node);
85500
85569
  if (into && this.skipInto !== true) {
85501
85570
  const concat = node.concatTokens().toUpperCase();
85502
85571
  const t = traversal.traverse(into).getCode();
@@ -85798,7 +85867,7 @@ class MethodImplementationTranspiler {
85798
85867
  const passByValue = identifier.getMeta().includes("pass_by_value" /* abaplint.IdentifierMeta.PassByValue */);
85799
85868
  const type = identifier.getType();
85800
85869
  if (identifier.getMeta().includes("exporting" /* abaplint.IdentifierMeta.MethodExporting */)) {
85801
- after += `let ${varPrefixed} = ${unique}?.${varName} || ${new transpile_types_1.TranspileTypes().toType(identifier.getType())};\n`;
85870
+ after += `let ${varPrefixed} = ${unique}?.${varName} || ${transpile_types_1.TranspileTypes.toType(identifier.getType())};\n`;
85802
85871
  }
85803
85872
  else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
85804
85873
  && parameterDefault === undefined
@@ -85809,31 +85878,31 @@ class MethodImplementationTranspiler {
85809
85878
  if (identifier.getType().getQualifiedName() !== undefined && identifier.getType().getQualifiedName() !== "") {
85810
85879
  after += `if (${varPrefixed}?.getQualifiedName === undefined || ${varPrefixed}.getQualifiedName() !== "${identifier.getType().getQualifiedName()?.toUpperCase()}") { ${varPrefixed} = undefined; }\n`;
85811
85880
  }
85812
- after += `if (${varPrefixed} === undefined) { ${varPrefixed} = ${new transpile_types_1.TranspileTypes().toType(identifier.getType())}.set(${unique}.${varName}); }\n`;
85881
+ after += `if (${varPrefixed} === undefined) { ${varPrefixed} = ${transpile_types_1.TranspileTypes.toType(identifier.getType())}.set(${unique}.${varName}); }\n`;
85813
85882
  }
85814
85883
  else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
85815
85884
  && type.isGeneric() === true) {
85816
85885
  if (isOptional === true) {
85817
- after += `let ${varPrefixed} = ${unique}?.${varName} || ${new transpile_types_1.TranspileTypes().toType(identifier.getType())};\n`;
85886
+ after += `let ${varPrefixed} = ${unique}?.${varName} || ${transpile_types_1.TranspileTypes.toType(identifier.getType())};\n`;
85818
85887
  }
85819
85888
  else {
85820
85889
  after += `let ${varPrefixed} = ${unique}?.${varName};\n`;
85821
85890
  }
85822
85891
  if (type instanceof abaplint.BasicTypes.NumericGenericType) {
85823
85892
  after += `if (${varPrefixed}.constructor.name === "Character") {
85824
- ${varPrefixed} = ${new transpile_types_1.TranspileTypes().toType(identifier.getType())};
85893
+ ${varPrefixed} = ${transpile_types_1.TranspileTypes.toType(identifier.getType())};
85825
85894
  ${varPrefixed}.set(${unique}?.${varName});
85826
85895
  }\n`;
85827
85896
  }
85828
85897
  }
85829
85898
  else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
85830
85899
  && type.isGeneric() === false) {
85831
- after += new transpile_types_1.TranspileTypes().declare(identifier) + "\n";
85900
+ after += transpile_types_1.TranspileTypes.declare(identifier) + "\n";
85832
85901
  // note: it might be nessesary to do a type conversion, eg char is passed to xstring parameter
85833
85902
  after += "if (" + unique + " && " + unique + "." + varName + ") {" + varPrefixed + ".set(" + unique + "." + varName + ");}\n";
85834
85903
  }
85835
85904
  else {
85836
- after += new transpile_types_1.TranspileTypes().declare(identifier) + "\n";
85905
+ after += transpile_types_1.TranspileTypes.declare(identifier) + "\n";
85837
85906
  after += "if (" + unique + " && " + unique + "." + varName + ") {" + varPrefixed + " = " + unique + "." + varName + ";}\n";
85838
85907
  }
85839
85908
  if (parameterDefault) {
@@ -85847,7 +85916,7 @@ class MethodImplementationTranspiler {
85847
85916
  }
85848
85917
  }
85849
85918
  else if (identifier.getMeta().includes("returning" /* abaplint.IdentifierMeta.MethodReturning */)) {
85850
- after = after + new transpile_types_1.TranspileTypes().declare(identifier) + "\n";
85919
+ after = after + transpile_types_1.TranspileTypes.declare(identifier) + "\n";
85851
85920
  }
85852
85921
  }
85853
85922
  if (after.length > 0) { // argh
@@ -86546,7 +86615,7 @@ class RangesTranspiler {
86546
86615
  const ret = new chunk_1.Chunk()
86547
86616
  .appendString("let ")
86548
86617
  .appendString(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(found.getName().toLowerCase())))
86549
- .appendString(" = " + new transpile_types_1.TranspileTypes().toType(found.getType()))
86618
+ .appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType()))
86550
86619
  .appendString(";");
86551
86620
  return ret;
86552
86621
  }
@@ -87833,7 +87902,7 @@ class TablesTranspiler {
87833
87902
  const ret = new chunk_1.Chunk()
87834
87903
  .appendString("let ")
87835
87904
  .append(found.getName().toLowerCase(), token, traversal)
87836
- .appendString(" = " + new transpile_types_1.TranspileTypes().toType(found.getType()))
87905
+ .appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType()))
87837
87906
  .append(";", node.getLastToken(), traversal);
87838
87907
  return ret;
87839
87908
  }
@@ -88610,7 +88679,7 @@ class ClassImplementationTranspiler {
88610
88679
  const prefix = traversal_1.Traversal.escapeNamespace(cdef.getName().toLowerCase()) + ".";
88611
88680
  let ret = "";
88612
88681
  for (const ty of cdef.getTypeDefinitions().getAll()) {
88613
- ret += new transpile_types_1.TranspileTypes().declareStaticSkipVoid(prefix, ty.type);
88682
+ ret += transpile_types_1.TranspileTypes.declareStaticSkipVoid(prefix, ty.type);
88614
88683
  }
88615
88684
  return ret;
88616
88685
  }
@@ -88648,7 +88717,7 @@ class ClassImplementationTranspiler {
88648
88717
  const staticAttributes = this.findStaticAttributes(cdef, scope, traversal);
88649
88718
  for (const attr of staticAttributes) {
88650
88719
  const name = traversal_1.Traversal.escapeNamespace(clasName) + "." + traversal_1.Traversal.escapeNamespace(attr.prefix) + traversal_1.Traversal.escapeNamespace(attr.identifier.getName().toLowerCase());
88651
- ret += name + " = " + new transpile_types_1.TranspileTypes().toType(attr.identifier.getType()) + ";\n";
88720
+ ret += name + " = " + transpile_types_1.TranspileTypes.toType(attr.identifier.getType()) + ";\n";
88652
88721
  ret += traversal.setValues(attr.identifier, name);
88653
88722
  }
88654
88723
  for (const alias of cdef.getAliases()) {
@@ -88875,6 +88944,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
88875
88944
  exports.FormTranspiler = void 0;
88876
88945
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
88877
88946
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
88947
+ const inline_1 = __webpack_require__(/*! ../inline */ "./node_modules/@abaplint/transpiler/build/src/inline.js");
88878
88948
  class FormTranspiler {
88879
88949
  transpile(node, traversal) {
88880
88950
  const formName = node.findFirstStatement(abaplint.Statements.Form)
@@ -88882,6 +88952,10 @@ class FormTranspiler {
88882
88952
  const ret = new chunk_1.Chunk();
88883
88953
  for (const c of node.getChildren()) {
88884
88954
  ret.appendChunk(traversal.traverse(c));
88955
+ if (c.get() instanceof abaplint.Statements.Form) {
88956
+ const declare = inline_1.InlineDeclarations.buildDeclarations(node, traversal);
88957
+ ret.appendString(declare);
88958
+ }
88885
88959
  }
88886
88960
  if (formName && traversal.getCurrentObject().getType() === "PROG") {
88887
88961
  ret.appendString(`abap.Forms['PROG-${traversal.getCurrentObject().getName().toUpperCase()}-${formName}'] = ${formName?.toLowerCase()};`);
@@ -88964,7 +89038,7 @@ class FunctionModuleTranspiler {
88964
89038
  if (type !== undefined && p.optional === true) {
88965
89039
  // todo, set DEFAULT value
88966
89040
  ret += `if (${name} === undefined) {
88967
- ${name} = ${new transpile_types_1.TranspileTypes().toType(type)};
89041
+ ${name} = ${transpile_types_1.TranspileTypes.toType(type)};
88968
89042
  }\n`;
88969
89043
  }
88970
89044
  }
@@ -89014,6 +89088,7 @@ __exportStar(__webpack_require__(/*! ./interface */ "./node_modules/@abaplint/tr
89014
89088
  __exportStar(__webpack_require__(/*! ./loop */ "./node_modules/@abaplint/transpiler/build/src/structures/loop.js"), exports);
89015
89089
  __exportStar(__webpack_require__(/*! ./module */ "./node_modules/@abaplint/transpiler/build/src/structures/module.js"), exports);
89016
89090
  __exportStar(__webpack_require__(/*! ./select */ "./node_modules/@abaplint/transpiler/build/src/structures/select.js"), exports);
89091
+ __exportStar(__webpack_require__(/*! ./method */ "./node_modules/@abaplint/transpiler/build/src/structures/method.js"), exports);
89017
89092
  __exportStar(__webpack_require__(/*! ./try */ "./node_modules/@abaplint/transpiler/build/src/structures/try.js"), exports);
89018
89093
  __exportStar(__webpack_require__(/*! ./types */ "./node_modules/@abaplint/transpiler/build/src/structures/types.js"), exports);
89019
89094
  __exportStar(__webpack_require__(/*! ./when */ "./node_modules/@abaplint/transpiler/build/src/structures/when.js"), exports);
@@ -89069,7 +89144,7 @@ class InterfaceTranspiler {
89069
89144
  const prefix = traversal_1.Traversal.escapeNamespace(idef.getName().toLowerCase()) + ".";
89070
89145
  let ret = "";
89071
89146
  for (const ty of idef.getTypeDefinitions().getAll()) {
89072
- ret += new transpile_types_1.TranspileTypes().declareStaticSkipVoid(prefix, ty.type);
89147
+ ret += transpile_types_1.TranspileTypes.declareStaticSkipVoid(prefix, ty.type);
89073
89148
  }
89074
89149
  return ret;
89075
89150
  }
@@ -89095,7 +89170,7 @@ class InterfaceTranspiler {
89095
89170
  }
89096
89171
  const interfaceName = traversal_1.Traversal.escapeNamespace(node.getFirstToken().getStr().toLowerCase());
89097
89172
  const name = interfaceName + "." + interfaceName + "$" + n.toLowerCase();
89098
- ret += name + " = " + new transpile_types_1.TranspileTypes().toType(identifier.getType()) + ";\n";
89173
+ ret += name + " = " + transpile_types_1.TranspileTypes.toType(identifier.getType()) + ";\n";
89099
89174
  const alias = idef?.getAliases().find(a => a.getName().toUpperCase() === n.toUpperCase());
89100
89175
  if (alias) {
89101
89176
  // todo: this is an evil workaround, should be fixed in abaplint instead
@@ -89222,6 +89297,37 @@ exports.LoopTranspiler = LoopTranspiler;
89222
89297
 
89223
89298
  /***/ }),
89224
89299
 
89300
+ /***/ "./node_modules/@abaplint/transpiler/build/src/structures/method.js":
89301
+ /*!**************************************************************************!*\
89302
+ !*** ./node_modules/@abaplint/transpiler/build/src/structures/method.js ***!
89303
+ \**************************************************************************/
89304
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
89305
+
89306
+ "use strict";
89307
+
89308
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
89309
+ exports.MethodTranspiler = void 0;
89310
+ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
89311
+ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
89312
+ const inline_1 = __webpack_require__(/*! ../inline */ "./node_modules/@abaplint/transpiler/build/src/inline.js");
89313
+ class MethodTranspiler {
89314
+ transpile(node, traversal) {
89315
+ const ret = new chunk_1.Chunk();
89316
+ for (const c of node.getChildren()) {
89317
+ ret.appendChunk(traversal.traverse(c));
89318
+ if (c.get() instanceof abaplint.Statements.MethodImplementation) {
89319
+ const declare = inline_1.InlineDeclarations.buildDeclarations(node, traversal);
89320
+ ret.appendString(declare);
89321
+ }
89322
+ }
89323
+ return ret;
89324
+ }
89325
+ }
89326
+ exports.MethodTranspiler = MethodTranspiler;
89327
+ //# sourceMappingURL=method.js.map
89328
+
89329
+ /***/ }),
89330
+
89225
89331
  /***/ "./node_modules/@abaplint/transpiler/build/src/structures/module.js":
89226
89332
  /*!**************************************************************************!*\
89227
89333
  !*** ./node_modules/@abaplint/transpiler/build/src/structures/module.js ***!
@@ -89489,13 +89595,12 @@ exports.TranspileTypes = void 0;
89489
89595
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
89490
89596
  const traversal_1 = __webpack_require__(/*! ./traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
89491
89597
  const featureHexUInt8 = false;
89492
- // todo: change this class to static for performance?
89493
89598
  class TranspileTypes {
89494
- declare(t) {
89599
+ static declare(t) {
89495
89600
  const type = t.getType();
89496
89601
  return "let " + traversal_1.Traversal.prefixVariable(t.getName().toLowerCase()) + " = " + this.toType(type) + ";";
89497
89602
  }
89498
- declareStaticSkipVoid(pre, t) {
89603
+ static declareStaticSkipVoid(pre, t) {
89499
89604
  const type = t.getType();
89500
89605
  const code = this.toType(type);
89501
89606
  // todo, this should look at the configuration, for runtime vs compile time errors
@@ -89504,7 +89609,7 @@ class TranspileTypes {
89504
89609
  }
89505
89610
  return pre + t.getName().toLowerCase() + " = " + code + ";\n";
89506
89611
  }
89507
- toType(type) {
89612
+ static toType(type) {
89508
89613
  let resolved = "";
89509
89614
  let extra = "";
89510
89615
  if (type instanceof abaplint.BasicTypes.ObjectReferenceType
@@ -89927,7 +90032,7 @@ class Traversal {
89927
90032
  for (const m of methodDefinitions.getAll()) {
89928
90033
  const parameters = [];
89929
90034
  for (const p of m.getParameters().getAll()) {
89930
- const type = new transpile_types_1.TranspileTypes().toType(p.getType());
90035
+ const type = transpile_types_1.TranspileTypes.toType(p.getType());
89931
90036
  const optional = m.getParameters().getOptional().includes(p.getName()) ? "X" : " ";
89932
90037
  parameters.push(`"${p.getName().toUpperCase()}": {"type": () => {return ${type};}, "is_optional": "${optional}"}`);
89933
90038
  }
@@ -89952,13 +90057,13 @@ class Traversal {
89952
90057
  return attr;
89953
90058
  }
89954
90059
  for (const a of def.getAttributes()?.getAll() || []) {
89955
- const type = new transpile_types_1.TranspileTypes().toType(a.getType());
90060
+ const type = transpile_types_1.TranspileTypes.toType(a.getType());
89956
90061
  const runtime = this.mapVisibility(a.getVisibility());
89957
90062
  const isClass = a.getMeta().includes("static" /* abaplint.IdentifierMeta.Static */) ? "X" : " ";
89958
90063
  attr.add(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": " ", "is_class": "${isClass}"}`);
89959
90064
  }
89960
90065
  for (const a of def.getAttributes()?.getConstants() || []) {
89961
- const type = new transpile_types_1.TranspileTypes().toType(a.getType());
90066
+ const type = transpile_types_1.TranspileTypes.toType(a.getType());
89962
90067
  let runtime = "";
89963
90068
  switch (a.getVisibility()) {
89964
90069
  case abaplint.Visibility.Private:
@@ -90141,7 +90246,7 @@ class Traversal {
90141
90246
  escaped = "#" + escaped;
90142
90247
  }
90143
90248
  const name = "this." + escaped;
90144
- ret += name + " = " + new transpile_types_1.TranspileTypes().toType(a.getType()) + ";\n";
90249
+ ret += name + " = " + transpile_types_1.TranspileTypes.toType(a.getType()) + ";\n";
90145
90250
  ret += this.setValues(a, name);
90146
90251
  if (escaped?.startsWith("#")) {
90147
90252
  ret += `this.FRIENDS_ACCESS_INSTANCE["${escaped.replace("#", "")}"] = ${name};\n`;
@@ -90278,7 +90383,7 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
90278
90383
  ret += "if (this." + n + " === undefined) this." + n + " = " + cname + "." + n + ";\n";
90279
90384
  }
90280
90385
  else {
90281
- ret += "if (this." + n + " === undefined) this." + n + " = " + new transpile_types_1.TranspileTypes().toType(a.getType()) + ";\n";
90386
+ ret += "if (this." + n + " === undefined) this." + n + " = " + transpile_types_1.TranspileTypes.toType(a.getType()) + ";\n";
90282
90387
  }
90283
90388
  }
90284
90389
  for (const i of intf?.getImplementing() || []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.11.11",
3
+ "version": "2.11.13",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -27,8 +27,8 @@
27
27
  "author": "abaplint",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@abaplint/core": "^2.113.158",
31
- "@abaplint/transpiler": "^2.11.11",
30
+ "@abaplint/core": "^2.113.160",
31
+ "@abaplint/transpiler": "^2.11.13",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.2.1",
34
34
  "@types/progress": "^2.0.7",