@abaplint/transpiler-cli 2.11.12 → 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.
- package/build/bundle.js +143 -41
- 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;
|
|
@@ -53690,7 +53690,7 @@ class Registry {
|
|
|
53690
53690
|
}
|
|
53691
53691
|
static abaplintVersion() {
|
|
53692
53692
|
// magic, see build script "version.sh"
|
|
53693
|
-
return "2.113.
|
|
53693
|
+
return "2.113.160";
|
|
53694
53694
|
}
|
|
53695
53695
|
getDDICReferences() {
|
|
53696
53696
|
return this.ddicReferences;
|
|
@@ -79229,8 +79229,6 @@ __exportStar(__webpack_require__(/*! ./field_length */ "./node_modules/@abaplint
|
|
|
79229
79229
|
__exportStar(__webpack_require__(/*! ./field_offset */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_offset.js"), exports);
|
|
79230
79230
|
__exportStar(__webpack_require__(/*! ./field_symbol */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_symbol.js"), exports);
|
|
79231
79231
|
__exportStar(__webpack_require__(/*! ./function_exporting */ "./node_modules/@abaplint/transpiler/build/src/expressions/function_exporting.js"), exports);
|
|
79232
|
-
__exportStar(__webpack_require__(/*! ./source_field_symbol_chain */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field_symbol_chain.js"), exports);
|
|
79233
|
-
__exportStar(__webpack_require__(/*! ./type_name_or_infer */ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js"), exports);
|
|
79234
79232
|
__exportStar(__webpack_require__(/*! ./function_parameters */ "./node_modules/@abaplint/transpiler/build/src/expressions/function_parameters.js"), exports);
|
|
79235
79233
|
__exportStar(__webpack_require__(/*! ./message_number */ "./node_modules/@abaplint/transpiler/build/src/expressions/message_number.js"), exports);
|
|
79236
79234
|
__exportStar(__webpack_require__(/*! ./method_call_body */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_body.js"), exports);
|
|
@@ -79249,6 +79247,7 @@ __exportStar(__webpack_require__(/*! ./simple_source1 */ "./node_modules/@abapli
|
|
|
79249
79247
|
__exportStar(__webpack_require__(/*! ./simple_source2 */ "./node_modules/@abaplint/transpiler/build/src/expressions/simple_source2.js"), exports);
|
|
79250
79248
|
__exportStar(__webpack_require__(/*! ./simple_source3 */ "./node_modules/@abaplint/transpiler/build/src/expressions/simple_source3.js"), exports);
|
|
79251
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);
|
|
79252
79251
|
__exportStar(__webpack_require__(/*! ./source_field_symbol */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field_symbol.js"), exports);
|
|
79253
79252
|
__exportStar(__webpack_require__(/*! ./source_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field.js"), exports);
|
|
79254
79253
|
__exportStar(__webpack_require__(/*! ./source */ "./node_modules/@abaplint/transpiler/build/src/expressions/source.js"), exports);
|
|
@@ -79260,8 +79259,8 @@ __exportStar(__webpack_require__(/*! ./sql_field_name */ "./node_modules/@abapli
|
|
|
79260
79259
|
__exportStar(__webpack_require__(/*! ./sql_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field.js"), exports);
|
|
79261
79260
|
__exportStar(__webpack_require__(/*! ./sql_from_source */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from_source.js"), exports);
|
|
79262
79261
|
__exportStar(__webpack_require__(/*! ./sql_from */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from.js"), exports);
|
|
79263
|
-
__exportStar(__webpack_require__(/*! ./sql_into_structure */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_into_structure.js"), exports);
|
|
79264
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);
|
|
79265
79264
|
__exportStar(__webpack_require__(/*! ./sql_join */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_join.js"), exports);
|
|
79266
79265
|
__exportStar(__webpack_require__(/*! ./sql_order_by */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_order_by.js"), exports);
|
|
79267
79266
|
__exportStar(__webpack_require__(/*! ./sql_source_simple */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_source_simple.js"), exports);
|
|
@@ -79269,7 +79268,9 @@ __exportStar(__webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/t
|
|
|
79269
79268
|
__exportStar(__webpack_require__(/*! ./sql_target */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_target.js"), exports);
|
|
79270
79269
|
__exportStar(__webpack_require__(/*! ./string_template_source */ "./node_modules/@abaplint/transpiler/build/src/expressions/string_template_source.js"), exports);
|
|
79271
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);
|
|
79272
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);
|
|
79273
79274
|
//# sourceMappingURL=index.js.map
|
|
79274
79275
|
|
|
79275
79276
|
/***/ }),
|
|
@@ -80076,7 +80077,7 @@ class SourceTranspiler {
|
|
|
80076
80077
|
if (inferType === undefined) {
|
|
80077
80078
|
throw new Error("transpiler: REF # todo, lookupInferred, " + node.concatTokens());
|
|
80078
80079
|
}
|
|
80079
|
-
const typ =
|
|
80080
|
+
const typ = transpile_types_1.TranspileTypes.toType(inferType);
|
|
80080
80081
|
if (typ.startsWith("new abap.types.DataReference(") === false) {
|
|
80081
80082
|
throw new Error("transpiler: REF # unexpected type");
|
|
80082
80083
|
}
|
|
@@ -80336,7 +80337,7 @@ class SQLCondTranspiler {
|
|
|
80336
80337
|
const conversionField = traversal.isSQLConversion(source.getFirstToken());
|
|
80337
80338
|
if (conversionField) {
|
|
80338
80339
|
const field = (table?.parseType(traversal.reg)).getComponentByName(conversionField);
|
|
80339
|
-
ret += "'\" + " +
|
|
80340
|
+
ret += "'\" + " + transpile_types_1.TranspileTypes.toType(field) + ".set(" + concat + ").get() + \"'";
|
|
80340
80341
|
}
|
|
80341
80342
|
else if (concat.startsWith("`")) {
|
|
80342
80343
|
ret += "'" + concat.substring(1, concat.length - 1) + "'";
|
|
@@ -81032,6 +81033,27 @@ exports.TargetTranspiler = TargetTranspiler;
|
|
|
81032
81033
|
|
|
81033
81034
|
/***/ }),
|
|
81034
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
|
+
|
|
81035
81057
|
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js":
|
|
81036
81058
|
/*!***************************************************************************************!*\
|
|
81037
81059
|
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js ***!
|
|
@@ -81058,7 +81080,7 @@ class TypeNameOrInfer {
|
|
|
81058
81080
|
throw new Error("TypeNameOrInfer, type not found: " + node.concatTokens());
|
|
81059
81081
|
}
|
|
81060
81082
|
const ret = new chunk_1.Chunk();
|
|
81061
|
-
ret.appendString(
|
|
81083
|
+
ret.appendString(transpile_types_1.TranspileTypes.toType(type));
|
|
81062
81084
|
return ret;
|
|
81063
81085
|
}
|
|
81064
81086
|
}
|
|
@@ -81268,7 +81290,7 @@ class HandleDataElement {
|
|
|
81268
81290
|
}
|
|
81269
81291
|
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
81270
81292
|
"objectType": "DTEL",
|
|
81271
|
-
"type": ${
|
|
81293
|
+
"type": ${transpile_types_1.TranspileTypes.toType(type)},
|
|
81272
81294
|
"domain": ${JSON.stringify(obj.getDomainName())},
|
|
81273
81295
|
"fixedValues": ${JSON.stringify(fixedValues)},
|
|
81274
81296
|
};`);
|
|
@@ -81550,7 +81572,7 @@ class HandleTable {
|
|
|
81550
81572
|
const type = obj.parseType(reg);
|
|
81551
81573
|
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
81552
81574
|
"objectType": "TABL",
|
|
81553
|
-
"type": ${
|
|
81575
|
+
"type": ${transpile_types_1.TranspileTypes.toType(type)},
|
|
81554
81576
|
"keyFields": ${JSON.stringify(obj.listKeys(reg))},
|
|
81555
81577
|
};`);
|
|
81556
81578
|
const output = {
|
|
@@ -81592,7 +81614,7 @@ class HandleTableType {
|
|
|
81592
81614
|
const type = obj.parseType(reg);
|
|
81593
81615
|
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
81594
81616
|
"objectType": "TTYP",
|
|
81595
|
-
"type": ${
|
|
81617
|
+
"type": ${transpile_types_1.TranspileTypes.toType(type)},
|
|
81596
81618
|
};`);
|
|
81597
81619
|
const output = {
|
|
81598
81620
|
object: {
|
|
@@ -81643,7 +81665,7 @@ class HandleTypePool {
|
|
|
81643
81665
|
for (const v in spaghettiNode?.getData().vars) {
|
|
81644
81666
|
const abs = spaghettiNode.getData().vars[v];
|
|
81645
81667
|
const name = `pool['${v.toLowerCase()}']`;
|
|
81646
|
-
chunk.appendString(`${name} = ${
|
|
81668
|
+
chunk.appendString(`${name} = ${transpile_types_1.TranspileTypes.toType(abs.getType())};\n`);
|
|
81647
81669
|
chunk.appendString(traversal_1.Traversal.setValues(abs, name));
|
|
81648
81670
|
// yea, this is a mess
|
|
81649
81671
|
for (const cons of abapFile.getStructure()?.findAllStructures(abaplint.Structures.Constants) || []) {
|
|
@@ -81655,7 +81677,7 @@ class HandleTypePool {
|
|
|
81655
81677
|
}
|
|
81656
81678
|
for (const t in spaghettiNode?.getData().types) {
|
|
81657
81679
|
const abs = spaghettiNode.getData().types[t];
|
|
81658
|
-
chunk.appendString(`pool['${t.toLowerCase()}'] = ${
|
|
81680
|
+
chunk.appendString(`pool['${t.toLowerCase()}'] = ${transpile_types_1.TranspileTypes.toType(abs.getType())};\n`);
|
|
81659
81681
|
}
|
|
81660
81682
|
chunk.appendString(`abap.TypePools['${obj.getName()}'] = pool;`);
|
|
81661
81683
|
const output = {
|
|
@@ -81698,7 +81720,7 @@ class HandleView {
|
|
|
81698
81720
|
const type = obj.parseType(reg);
|
|
81699
81721
|
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
81700
81722
|
"objectType": "VIEW",
|
|
81701
|
-
"type": ${
|
|
81723
|
+
"type": ${transpile_types_1.TranspileTypes.toType(type)},
|
|
81702
81724
|
};`);
|
|
81703
81725
|
// todo, "keyFields": ${JSON.stringify(obj.listKeys())},
|
|
81704
81726
|
const output = {
|
|
@@ -82022,6 +82044,42 @@ exports.Initialization = Initialization;
|
|
|
82022
82044
|
|
|
82023
82045
|
/***/ }),
|
|
82024
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
|
+
|
|
82025
82083
|
/***/ "./node_modules/@abaplint/transpiler/build/src/keywords.js":
|
|
82026
82084
|
/*!*****************************************************************!*\
|
|
82027
82085
|
!*** ./node_modules/@abaplint/transpiler/build/src/keywords.js ***!
|
|
@@ -83546,7 +83604,7 @@ class CreateDataTranspiler {
|
|
|
83546
83604
|
if (typeNameNode) {
|
|
83547
83605
|
const id = traversal.findCurrentScopeByToken(typeNameNode.getFirstToken())?.findType(typeNameNode.concatTokens());
|
|
83548
83606
|
if (id) {
|
|
83549
|
-
options.push(`"type": ` +
|
|
83607
|
+
options.push(`"type": ` + transpile_types_1.TranspileTypes.toType(id.getType()));
|
|
83550
83608
|
}
|
|
83551
83609
|
else {
|
|
83552
83610
|
options.push(`"typeName": "${typeNameNode.concatTokens().toUpperCase()}"`);
|
|
@@ -83727,7 +83785,7 @@ class DataTranspiler {
|
|
|
83727
83785
|
const ret = new chunk_1.Chunk()
|
|
83728
83786
|
.appendString("let ")
|
|
83729
83787
|
.appendString(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(found.getName().toLowerCase())))
|
|
83730
|
-
.appendString(" = " +
|
|
83788
|
+
.appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType()))
|
|
83731
83789
|
.appendString(";")
|
|
83732
83790
|
.appendString(value);
|
|
83733
83791
|
return ret;
|
|
@@ -84577,7 +84635,7 @@ class FieldSymbolTranspiler {
|
|
|
84577
84635
|
return new chunk_1.Chunk()
|
|
84578
84636
|
.appendString("let ")
|
|
84579
84637
|
.appendString(new field_symbol_1.FieldSymbolTranspiler().transpile(name, traversal).getCode())
|
|
84580
|
-
.appendString(" = new abap.types.FieldSymbol(" +
|
|
84638
|
+
.appendString(" = new abap.types.FieldSymbol(" + transpile_types_1.TranspileTypes.toType(found.getType()) + ");");
|
|
84581
84639
|
}
|
|
84582
84640
|
throw new Error("FieldSymbolTranspiler, name not found");
|
|
84583
84641
|
}
|
|
@@ -85491,6 +85549,14 @@ class LoopTranspiler {
|
|
|
85491
85549
|
getTarget() {
|
|
85492
85550
|
return this.unique;
|
|
85493
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
|
+
}
|
|
85494
85560
|
transpile(node, traversal) {
|
|
85495
85561
|
if (!(node.get() instanceof abaplint.Statements.Loop)) {
|
|
85496
85562
|
throw new Error("LoopTranspiler, unexpected node");
|
|
@@ -85499,7 +85565,7 @@ class LoopTranspiler {
|
|
|
85499
85565
|
const source = traversal.traverse(loopSource).getCode();
|
|
85500
85566
|
this.unique = unique_identifier_1.UniqueIdentifier.get();
|
|
85501
85567
|
let target = "";
|
|
85502
|
-
const into =
|
|
85568
|
+
const into = this.determineInto(node);
|
|
85503
85569
|
if (into && this.skipInto !== true) {
|
|
85504
85570
|
const concat = node.concatTokens().toUpperCase();
|
|
85505
85571
|
const t = traversal.traverse(into).getCode();
|
|
@@ -85801,7 +85867,7 @@ class MethodImplementationTranspiler {
|
|
|
85801
85867
|
const passByValue = identifier.getMeta().includes("pass_by_value" /* abaplint.IdentifierMeta.PassByValue */);
|
|
85802
85868
|
const type = identifier.getType();
|
|
85803
85869
|
if (identifier.getMeta().includes("exporting" /* abaplint.IdentifierMeta.MethodExporting */)) {
|
|
85804
|
-
after += `let ${varPrefixed} = ${unique}?.${varName} || ${
|
|
85870
|
+
after += `let ${varPrefixed} = ${unique}?.${varName} || ${transpile_types_1.TranspileTypes.toType(identifier.getType())};\n`;
|
|
85805
85871
|
}
|
|
85806
85872
|
else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
|
|
85807
85873
|
&& parameterDefault === undefined
|
|
@@ -85812,31 +85878,31 @@ class MethodImplementationTranspiler {
|
|
|
85812
85878
|
if (identifier.getType().getQualifiedName() !== undefined && identifier.getType().getQualifiedName() !== "") {
|
|
85813
85879
|
after += `if (${varPrefixed}?.getQualifiedName === undefined || ${varPrefixed}.getQualifiedName() !== "${identifier.getType().getQualifiedName()?.toUpperCase()}") { ${varPrefixed} = undefined; }\n`;
|
|
85814
85880
|
}
|
|
85815
|
-
after += `if (${varPrefixed} === undefined) { ${varPrefixed} = ${
|
|
85881
|
+
after += `if (${varPrefixed} === undefined) { ${varPrefixed} = ${transpile_types_1.TranspileTypes.toType(identifier.getType())}.set(${unique}.${varName}); }\n`;
|
|
85816
85882
|
}
|
|
85817
85883
|
else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
|
|
85818
85884
|
&& type.isGeneric() === true) {
|
|
85819
85885
|
if (isOptional === true) {
|
|
85820
|
-
after += `let ${varPrefixed} = ${unique}?.${varName} || ${
|
|
85886
|
+
after += `let ${varPrefixed} = ${unique}?.${varName} || ${transpile_types_1.TranspileTypes.toType(identifier.getType())};\n`;
|
|
85821
85887
|
}
|
|
85822
85888
|
else {
|
|
85823
85889
|
after += `let ${varPrefixed} = ${unique}?.${varName};\n`;
|
|
85824
85890
|
}
|
|
85825
85891
|
if (type instanceof abaplint.BasicTypes.NumericGenericType) {
|
|
85826
85892
|
after += `if (${varPrefixed}.constructor.name === "Character") {
|
|
85827
|
-
${varPrefixed} = ${
|
|
85893
|
+
${varPrefixed} = ${transpile_types_1.TranspileTypes.toType(identifier.getType())};
|
|
85828
85894
|
${varPrefixed}.set(${unique}?.${varName});
|
|
85829
85895
|
}\n`;
|
|
85830
85896
|
}
|
|
85831
85897
|
}
|
|
85832
85898
|
else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
|
|
85833
85899
|
&& type.isGeneric() === false) {
|
|
85834
|
-
after +=
|
|
85900
|
+
after += transpile_types_1.TranspileTypes.declare(identifier) + "\n";
|
|
85835
85901
|
// note: it might be nessesary to do a type conversion, eg char is passed to xstring parameter
|
|
85836
85902
|
after += "if (" + unique + " && " + unique + "." + varName + ") {" + varPrefixed + ".set(" + unique + "." + varName + ");}\n";
|
|
85837
85903
|
}
|
|
85838
85904
|
else {
|
|
85839
|
-
after +=
|
|
85905
|
+
after += transpile_types_1.TranspileTypes.declare(identifier) + "\n";
|
|
85840
85906
|
after += "if (" + unique + " && " + unique + "." + varName + ") {" + varPrefixed + " = " + unique + "." + varName + ";}\n";
|
|
85841
85907
|
}
|
|
85842
85908
|
if (parameterDefault) {
|
|
@@ -85850,7 +85916,7 @@ class MethodImplementationTranspiler {
|
|
|
85850
85916
|
}
|
|
85851
85917
|
}
|
|
85852
85918
|
else if (identifier.getMeta().includes("returning" /* abaplint.IdentifierMeta.MethodReturning */)) {
|
|
85853
|
-
after = after +
|
|
85919
|
+
after = after + transpile_types_1.TranspileTypes.declare(identifier) + "\n";
|
|
85854
85920
|
}
|
|
85855
85921
|
}
|
|
85856
85922
|
if (after.length > 0) { // argh
|
|
@@ -86549,7 +86615,7 @@ class RangesTranspiler {
|
|
|
86549
86615
|
const ret = new chunk_1.Chunk()
|
|
86550
86616
|
.appendString("let ")
|
|
86551
86617
|
.appendString(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(found.getName().toLowerCase())))
|
|
86552
|
-
.appendString(" = " +
|
|
86618
|
+
.appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType()))
|
|
86553
86619
|
.appendString(";");
|
|
86554
86620
|
return ret;
|
|
86555
86621
|
}
|
|
@@ -87836,7 +87902,7 @@ class TablesTranspiler {
|
|
|
87836
87902
|
const ret = new chunk_1.Chunk()
|
|
87837
87903
|
.appendString("let ")
|
|
87838
87904
|
.append(found.getName().toLowerCase(), token, traversal)
|
|
87839
|
-
.appendString(" = " +
|
|
87905
|
+
.appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType()))
|
|
87840
87906
|
.append(";", node.getLastToken(), traversal);
|
|
87841
87907
|
return ret;
|
|
87842
87908
|
}
|
|
@@ -88613,7 +88679,7 @@ class ClassImplementationTranspiler {
|
|
|
88613
88679
|
const prefix = traversal_1.Traversal.escapeNamespace(cdef.getName().toLowerCase()) + ".";
|
|
88614
88680
|
let ret = "";
|
|
88615
88681
|
for (const ty of cdef.getTypeDefinitions().getAll()) {
|
|
88616
|
-
ret +=
|
|
88682
|
+
ret += transpile_types_1.TranspileTypes.declareStaticSkipVoid(prefix, ty.type);
|
|
88617
88683
|
}
|
|
88618
88684
|
return ret;
|
|
88619
88685
|
}
|
|
@@ -88651,7 +88717,7 @@ class ClassImplementationTranspiler {
|
|
|
88651
88717
|
const staticAttributes = this.findStaticAttributes(cdef, scope, traversal);
|
|
88652
88718
|
for (const attr of staticAttributes) {
|
|
88653
88719
|
const name = traversal_1.Traversal.escapeNamespace(clasName) + "." + traversal_1.Traversal.escapeNamespace(attr.prefix) + traversal_1.Traversal.escapeNamespace(attr.identifier.getName().toLowerCase());
|
|
88654
|
-
ret += name + " = " +
|
|
88720
|
+
ret += name + " = " + transpile_types_1.TranspileTypes.toType(attr.identifier.getType()) + ";\n";
|
|
88655
88721
|
ret += traversal.setValues(attr.identifier, name);
|
|
88656
88722
|
}
|
|
88657
88723
|
for (const alias of cdef.getAliases()) {
|
|
@@ -88878,6 +88944,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
88878
88944
|
exports.FormTranspiler = void 0;
|
|
88879
88945
|
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
88880
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");
|
|
88881
88948
|
class FormTranspiler {
|
|
88882
88949
|
transpile(node, traversal) {
|
|
88883
88950
|
const formName = node.findFirstStatement(abaplint.Statements.Form)
|
|
@@ -88885,6 +88952,10 @@ class FormTranspiler {
|
|
|
88885
88952
|
const ret = new chunk_1.Chunk();
|
|
88886
88953
|
for (const c of node.getChildren()) {
|
|
88887
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
|
+
}
|
|
88888
88959
|
}
|
|
88889
88960
|
if (formName && traversal.getCurrentObject().getType() === "PROG") {
|
|
88890
88961
|
ret.appendString(`abap.Forms['PROG-${traversal.getCurrentObject().getName().toUpperCase()}-${formName}'] = ${formName?.toLowerCase()};`);
|
|
@@ -88967,7 +89038,7 @@ class FunctionModuleTranspiler {
|
|
|
88967
89038
|
if (type !== undefined && p.optional === true) {
|
|
88968
89039
|
// todo, set DEFAULT value
|
|
88969
89040
|
ret += `if (${name} === undefined) {
|
|
88970
|
-
${name} = ${
|
|
89041
|
+
${name} = ${transpile_types_1.TranspileTypes.toType(type)};
|
|
88971
89042
|
}\n`;
|
|
88972
89043
|
}
|
|
88973
89044
|
}
|
|
@@ -89017,6 +89088,7 @@ __exportStar(__webpack_require__(/*! ./interface */ "./node_modules/@abaplint/tr
|
|
|
89017
89088
|
__exportStar(__webpack_require__(/*! ./loop */ "./node_modules/@abaplint/transpiler/build/src/structures/loop.js"), exports);
|
|
89018
89089
|
__exportStar(__webpack_require__(/*! ./module */ "./node_modules/@abaplint/transpiler/build/src/structures/module.js"), exports);
|
|
89019
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);
|
|
89020
89092
|
__exportStar(__webpack_require__(/*! ./try */ "./node_modules/@abaplint/transpiler/build/src/structures/try.js"), exports);
|
|
89021
89093
|
__exportStar(__webpack_require__(/*! ./types */ "./node_modules/@abaplint/transpiler/build/src/structures/types.js"), exports);
|
|
89022
89094
|
__exportStar(__webpack_require__(/*! ./when */ "./node_modules/@abaplint/transpiler/build/src/structures/when.js"), exports);
|
|
@@ -89072,7 +89144,7 @@ class InterfaceTranspiler {
|
|
|
89072
89144
|
const prefix = traversal_1.Traversal.escapeNamespace(idef.getName().toLowerCase()) + ".";
|
|
89073
89145
|
let ret = "";
|
|
89074
89146
|
for (const ty of idef.getTypeDefinitions().getAll()) {
|
|
89075
|
-
ret +=
|
|
89147
|
+
ret += transpile_types_1.TranspileTypes.declareStaticSkipVoid(prefix, ty.type);
|
|
89076
89148
|
}
|
|
89077
89149
|
return ret;
|
|
89078
89150
|
}
|
|
@@ -89098,7 +89170,7 @@ class InterfaceTranspiler {
|
|
|
89098
89170
|
}
|
|
89099
89171
|
const interfaceName = traversal_1.Traversal.escapeNamespace(node.getFirstToken().getStr().toLowerCase());
|
|
89100
89172
|
const name = interfaceName + "." + interfaceName + "$" + n.toLowerCase();
|
|
89101
|
-
ret += name + " = " +
|
|
89173
|
+
ret += name + " = " + transpile_types_1.TranspileTypes.toType(identifier.getType()) + ";\n";
|
|
89102
89174
|
const alias = idef?.getAliases().find(a => a.getName().toUpperCase() === n.toUpperCase());
|
|
89103
89175
|
if (alias) {
|
|
89104
89176
|
// todo: this is an evil workaround, should be fixed in abaplint instead
|
|
@@ -89225,6 +89297,37 @@ exports.LoopTranspiler = LoopTranspiler;
|
|
|
89225
89297
|
|
|
89226
89298
|
/***/ }),
|
|
89227
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
|
+
|
|
89228
89331
|
/***/ "./node_modules/@abaplint/transpiler/build/src/structures/module.js":
|
|
89229
89332
|
/*!**************************************************************************!*\
|
|
89230
89333
|
!*** ./node_modules/@abaplint/transpiler/build/src/structures/module.js ***!
|
|
@@ -89492,13 +89595,12 @@ exports.TranspileTypes = void 0;
|
|
|
89492
89595
|
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
89493
89596
|
const traversal_1 = __webpack_require__(/*! ./traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
89494
89597
|
const featureHexUInt8 = false;
|
|
89495
|
-
// todo: change this class to static for performance?
|
|
89496
89598
|
class TranspileTypes {
|
|
89497
|
-
declare(t) {
|
|
89599
|
+
static declare(t) {
|
|
89498
89600
|
const type = t.getType();
|
|
89499
89601
|
return "let " + traversal_1.Traversal.prefixVariable(t.getName().toLowerCase()) + " = " + this.toType(type) + ";";
|
|
89500
89602
|
}
|
|
89501
|
-
declareStaticSkipVoid(pre, t) {
|
|
89603
|
+
static declareStaticSkipVoid(pre, t) {
|
|
89502
89604
|
const type = t.getType();
|
|
89503
89605
|
const code = this.toType(type);
|
|
89504
89606
|
// todo, this should look at the configuration, for runtime vs compile time errors
|
|
@@ -89507,7 +89609,7 @@ class TranspileTypes {
|
|
|
89507
89609
|
}
|
|
89508
89610
|
return pre + t.getName().toLowerCase() + " = " + code + ";\n";
|
|
89509
89611
|
}
|
|
89510
|
-
toType(type) {
|
|
89612
|
+
static toType(type) {
|
|
89511
89613
|
let resolved = "";
|
|
89512
89614
|
let extra = "";
|
|
89513
89615
|
if (type instanceof abaplint.BasicTypes.ObjectReferenceType
|
|
@@ -89930,7 +90032,7 @@ class Traversal {
|
|
|
89930
90032
|
for (const m of methodDefinitions.getAll()) {
|
|
89931
90033
|
const parameters = [];
|
|
89932
90034
|
for (const p of m.getParameters().getAll()) {
|
|
89933
|
-
const type =
|
|
90035
|
+
const type = transpile_types_1.TranspileTypes.toType(p.getType());
|
|
89934
90036
|
const optional = m.getParameters().getOptional().includes(p.getName()) ? "X" : " ";
|
|
89935
90037
|
parameters.push(`"${p.getName().toUpperCase()}": {"type": () => {return ${type};}, "is_optional": "${optional}"}`);
|
|
89936
90038
|
}
|
|
@@ -89955,13 +90057,13 @@ class Traversal {
|
|
|
89955
90057
|
return attr;
|
|
89956
90058
|
}
|
|
89957
90059
|
for (const a of def.getAttributes()?.getAll() || []) {
|
|
89958
|
-
const type =
|
|
90060
|
+
const type = transpile_types_1.TranspileTypes.toType(a.getType());
|
|
89959
90061
|
const runtime = this.mapVisibility(a.getVisibility());
|
|
89960
90062
|
const isClass = a.getMeta().includes("static" /* abaplint.IdentifierMeta.Static */) ? "X" : " ";
|
|
89961
90063
|
attr.add(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": " ", "is_class": "${isClass}"}`);
|
|
89962
90064
|
}
|
|
89963
90065
|
for (const a of def.getAttributes()?.getConstants() || []) {
|
|
89964
|
-
const type =
|
|
90066
|
+
const type = transpile_types_1.TranspileTypes.toType(a.getType());
|
|
89965
90067
|
let runtime = "";
|
|
89966
90068
|
switch (a.getVisibility()) {
|
|
89967
90069
|
case abaplint.Visibility.Private:
|
|
@@ -90144,7 +90246,7 @@ class Traversal {
|
|
|
90144
90246
|
escaped = "#" + escaped;
|
|
90145
90247
|
}
|
|
90146
90248
|
const name = "this." + escaped;
|
|
90147
|
-
ret += name + " = " +
|
|
90249
|
+
ret += name + " = " + transpile_types_1.TranspileTypes.toType(a.getType()) + ";\n";
|
|
90148
90250
|
ret += this.setValues(a, name);
|
|
90149
90251
|
if (escaped?.startsWith("#")) {
|
|
90150
90252
|
ret += `this.FRIENDS_ACCESS_INSTANCE["${escaped.replace("#", "")}"] = ${name};\n`;
|
|
@@ -90281,7 +90383,7 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
|
|
|
90281
90383
|
ret += "if (this." + n + " === undefined) this." + n + " = " + cname + "." + n + ";\n";
|
|
90282
90384
|
}
|
|
90283
90385
|
else {
|
|
90284
|
-
ret += "if (this." + n + " === undefined) this." + n + " = " +
|
|
90386
|
+
ret += "if (this." + n + " === undefined) this." + n + " = " + transpile_types_1.TranspileTypes.toType(a.getType()) + ";\n";
|
|
90285
90387
|
}
|
|
90286
90388
|
}
|
|
90287
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.
|
|
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.
|
|
31
|
-
"@abaplint/transpiler": "^2.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",
|