@abaplint/transpiler-cli 2.11.12 → 2.11.14
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 +165 -42
- 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;
|
|
@@ -5066,7 +5066,7 @@ class InlineFS extends combi_1.Expression {
|
|
|
5066
5066
|
const right = (0, combi_1.tok)(tokens_1.ParenRightW);
|
|
5067
5067
|
const left = (0, combi_1.tok)(tokens_1.ParenLeft);
|
|
5068
5068
|
const fs = (0, combi_1.seq)("FIELD-SYMBOL", left, _1.TargetFieldSymbol, right);
|
|
5069
|
-
return (0, combi_1.ver)(version_1.Version.v740sp02, fs);
|
|
5069
|
+
return (0, combi_1.ver)(version_1.Version.v740sp02, fs, version_1.Version.OpenABAP);
|
|
5070
5070
|
}
|
|
5071
5071
|
}
|
|
5072
5072
|
exports.InlineFS = InlineFS;
|
|
@@ -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.162";
|
|
53694
53694
|
}
|
|
53695
53695
|
getDDICReferences() {
|
|
53696
53696
|
return this.ddicReferences;
|
|
@@ -61276,6 +61276,9 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
61276
61276
|
outlineData(node, lowFile, highSyntax) {
|
|
61277
61277
|
// hmm, no guard here, as DATA(SDF) is valid in 702
|
|
61278
61278
|
var _a, _b;
|
|
61279
|
+
if (this.lowReg.getConfig().getVersion() === version_1.Version.OpenABAP) {
|
|
61280
|
+
return undefined;
|
|
61281
|
+
}
|
|
61279
61282
|
for (const i of node.findAllExpressionsRecursive(Expressions.InlineData)) {
|
|
61280
61283
|
const nameToken = (_a = i.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
61281
61284
|
if (nameToken === undefined) {
|
|
@@ -79229,8 +79232,6 @@ __exportStar(__webpack_require__(/*! ./field_length */ "./node_modules/@abaplint
|
|
|
79229
79232
|
__exportStar(__webpack_require__(/*! ./field_offset */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_offset.js"), exports);
|
|
79230
79233
|
__exportStar(__webpack_require__(/*! ./field_symbol */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_symbol.js"), exports);
|
|
79231
79234
|
__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
79235
|
__exportStar(__webpack_require__(/*! ./function_parameters */ "./node_modules/@abaplint/transpiler/build/src/expressions/function_parameters.js"), exports);
|
|
79235
79236
|
__exportStar(__webpack_require__(/*! ./message_number */ "./node_modules/@abaplint/transpiler/build/src/expressions/message_number.js"), exports);
|
|
79236
79237
|
__exportStar(__webpack_require__(/*! ./method_call_body */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_body.js"), exports);
|
|
@@ -79249,6 +79250,7 @@ __exportStar(__webpack_require__(/*! ./simple_source1 */ "./node_modules/@abapli
|
|
|
79249
79250
|
__exportStar(__webpack_require__(/*! ./simple_source2 */ "./node_modules/@abaplint/transpiler/build/src/expressions/simple_source2.js"), exports);
|
|
79250
79251
|
__exportStar(__webpack_require__(/*! ./simple_source3 */ "./node_modules/@abaplint/transpiler/build/src/expressions/simple_source3.js"), exports);
|
|
79251
79252
|
__exportStar(__webpack_require__(/*! ./simple_source4 */ "./node_modules/@abaplint/transpiler/build/src/expressions/simple_source4.js"), exports);
|
|
79253
|
+
__exportStar(__webpack_require__(/*! ./source_field_symbol_chain */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field_symbol_chain.js"), exports);
|
|
79252
79254
|
__exportStar(__webpack_require__(/*! ./source_field_symbol */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field_symbol.js"), exports);
|
|
79253
79255
|
__exportStar(__webpack_require__(/*! ./source_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field.js"), exports);
|
|
79254
79256
|
__exportStar(__webpack_require__(/*! ./source */ "./node_modules/@abaplint/transpiler/build/src/expressions/source.js"), exports);
|
|
@@ -79260,8 +79262,8 @@ __exportStar(__webpack_require__(/*! ./sql_field_name */ "./node_modules/@abapli
|
|
|
79260
79262
|
__exportStar(__webpack_require__(/*! ./sql_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field.js"), exports);
|
|
79261
79263
|
__exportStar(__webpack_require__(/*! ./sql_from_source */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from_source.js"), exports);
|
|
79262
79264
|
__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
79265
|
__exportStar(__webpack_require__(/*! ./sql_into_list */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_into_list.js"), exports);
|
|
79266
|
+
__exportStar(__webpack_require__(/*! ./sql_into_structure */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_into_structure.js"), exports);
|
|
79265
79267
|
__exportStar(__webpack_require__(/*! ./sql_join */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_join.js"), exports);
|
|
79266
79268
|
__exportStar(__webpack_require__(/*! ./sql_order_by */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_order_by.js"), exports);
|
|
79267
79269
|
__exportStar(__webpack_require__(/*! ./sql_source_simple */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_source_simple.js"), exports);
|
|
@@ -79269,7 +79271,9 @@ __exportStar(__webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/t
|
|
|
79269
79271
|
__exportStar(__webpack_require__(/*! ./sql_target */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_target.js"), exports);
|
|
79270
79272
|
__exportStar(__webpack_require__(/*! ./string_template_source */ "./node_modules/@abaplint/transpiler/build/src/expressions/string_template_source.js"), exports);
|
|
79271
79273
|
__exportStar(__webpack_require__(/*! ./string_template */ "./node_modules/@abaplint/transpiler/build/src/expressions/string_template.js"), exports);
|
|
79274
|
+
__exportStar(__webpack_require__(/*! ./target_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/target_field.js"), exports);
|
|
79272
79275
|
__exportStar(__webpack_require__(/*! ./target */ "./node_modules/@abaplint/transpiler/build/src/expressions/target.js"), exports);
|
|
79276
|
+
__exportStar(__webpack_require__(/*! ./type_name_or_infer */ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js"), exports);
|
|
79273
79277
|
//# sourceMappingURL=index.js.map
|
|
79274
79278
|
|
|
79275
79279
|
/***/ }),
|
|
@@ -80076,7 +80080,7 @@ class SourceTranspiler {
|
|
|
80076
80080
|
if (inferType === undefined) {
|
|
80077
80081
|
throw new Error("transpiler: REF # todo, lookupInferred, " + node.concatTokens());
|
|
80078
80082
|
}
|
|
80079
|
-
const typ =
|
|
80083
|
+
const typ = transpile_types_1.TranspileTypes.toType(inferType);
|
|
80080
80084
|
if (typ.startsWith("new abap.types.DataReference(") === false) {
|
|
80081
80085
|
throw new Error("transpiler: REF # unexpected type");
|
|
80082
80086
|
}
|
|
@@ -80336,7 +80340,7 @@ class SQLCondTranspiler {
|
|
|
80336
80340
|
const conversionField = traversal.isSQLConversion(source.getFirstToken());
|
|
80337
80341
|
if (conversionField) {
|
|
80338
80342
|
const field = (table?.parseType(traversal.reg)).getComponentByName(conversionField);
|
|
80339
|
-
ret += "'\" + " +
|
|
80343
|
+
ret += "'\" + " + transpile_types_1.TranspileTypes.toType(field) + ".set(" + concat + ").get() + \"'";
|
|
80340
80344
|
}
|
|
80341
80345
|
else if (concat.startsWith("`")) {
|
|
80342
80346
|
ret += "'" + concat.substring(1, concat.length - 1) + "'";
|
|
@@ -80950,6 +80954,14 @@ class TargetTranspiler {
|
|
|
80950
80954
|
ret.append(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(prefix)), c, traversal);
|
|
80951
80955
|
context = scope?.findVariable(c.getFirstToken().getStr())?.getType();
|
|
80952
80956
|
}
|
|
80957
|
+
else if (c.get() instanceof core_1.Expressions.InlineData && c instanceof core_1.Nodes.ExpressionNode) {
|
|
80958
|
+
const targetField = c.findDirectExpression(core_1.Expressions.TargetField);
|
|
80959
|
+
if (targetField === undefined) {
|
|
80960
|
+
throw new Error("TargetTranspiler: InlineData Target field not found");
|
|
80961
|
+
}
|
|
80962
|
+
ret.append(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(targetField?.concatTokens())), c, traversal);
|
|
80963
|
+
context = scope?.findVariable(targetField.getFirstToken().getStr())?.getType();
|
|
80964
|
+
}
|
|
80953
80965
|
else if (c.get() instanceof core_1.Expressions.ClassName) {
|
|
80954
80966
|
const name = traversal.lookupClassOrInterface(c.getFirstToken().getStr(), c.getFirstToken());
|
|
80955
80967
|
ret.append(name, c, traversal);
|
|
@@ -81032,6 +81044,27 @@ exports.TargetTranspiler = TargetTranspiler;
|
|
|
81032
81044
|
|
|
81033
81045
|
/***/ }),
|
|
81034
81046
|
|
|
81047
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/target_field.js":
|
|
81048
|
+
/*!*********************************************************************************!*\
|
|
81049
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/target_field.js ***!
|
|
81050
|
+
\*********************************************************************************/
|
|
81051
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
81052
|
+
|
|
81053
|
+
"use strict";
|
|
81054
|
+
|
|
81055
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
81056
|
+
exports.TargetFieldTranspiler = void 0;
|
|
81057
|
+
const field_chain_1 = __webpack_require__(/*! ./field_chain */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_chain.js");
|
|
81058
|
+
class TargetFieldTranspiler {
|
|
81059
|
+
transpile(node, traversal) {
|
|
81060
|
+
return new field_chain_1.FieldChainTranspiler().transpile(node, traversal);
|
|
81061
|
+
}
|
|
81062
|
+
}
|
|
81063
|
+
exports.TargetFieldTranspiler = TargetFieldTranspiler;
|
|
81064
|
+
//# sourceMappingURL=target_field.js.map
|
|
81065
|
+
|
|
81066
|
+
/***/ }),
|
|
81067
|
+
|
|
81035
81068
|
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js":
|
|
81036
81069
|
/*!***************************************************************************************!*\
|
|
81037
81070
|
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js ***!
|
|
@@ -81058,7 +81091,7 @@ class TypeNameOrInfer {
|
|
|
81058
81091
|
throw new Error("TypeNameOrInfer, type not found: " + node.concatTokens());
|
|
81059
81092
|
}
|
|
81060
81093
|
const ret = new chunk_1.Chunk();
|
|
81061
|
-
ret.appendString(
|
|
81094
|
+
ret.appendString(transpile_types_1.TranspileTypes.toType(type));
|
|
81062
81095
|
return ret;
|
|
81063
81096
|
}
|
|
81064
81097
|
}
|
|
@@ -81268,7 +81301,7 @@ class HandleDataElement {
|
|
|
81268
81301
|
}
|
|
81269
81302
|
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
81270
81303
|
"objectType": "DTEL",
|
|
81271
|
-
"type": ${
|
|
81304
|
+
"type": ${transpile_types_1.TranspileTypes.toType(type)},
|
|
81272
81305
|
"domain": ${JSON.stringify(obj.getDomainName())},
|
|
81273
81306
|
"fixedValues": ${JSON.stringify(fixedValues)},
|
|
81274
81307
|
};`);
|
|
@@ -81550,7 +81583,7 @@ class HandleTable {
|
|
|
81550
81583
|
const type = obj.parseType(reg);
|
|
81551
81584
|
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
81552
81585
|
"objectType": "TABL",
|
|
81553
|
-
"type": ${
|
|
81586
|
+
"type": ${transpile_types_1.TranspileTypes.toType(type)},
|
|
81554
81587
|
"keyFields": ${JSON.stringify(obj.listKeys(reg))},
|
|
81555
81588
|
};`);
|
|
81556
81589
|
const output = {
|
|
@@ -81592,7 +81625,7 @@ class HandleTableType {
|
|
|
81592
81625
|
const type = obj.parseType(reg);
|
|
81593
81626
|
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
81594
81627
|
"objectType": "TTYP",
|
|
81595
|
-
"type": ${
|
|
81628
|
+
"type": ${transpile_types_1.TranspileTypes.toType(type)},
|
|
81596
81629
|
};`);
|
|
81597
81630
|
const output = {
|
|
81598
81631
|
object: {
|
|
@@ -81643,7 +81676,7 @@ class HandleTypePool {
|
|
|
81643
81676
|
for (const v in spaghettiNode?.getData().vars) {
|
|
81644
81677
|
const abs = spaghettiNode.getData().vars[v];
|
|
81645
81678
|
const name = `pool['${v.toLowerCase()}']`;
|
|
81646
|
-
chunk.appendString(`${name} = ${
|
|
81679
|
+
chunk.appendString(`${name} = ${transpile_types_1.TranspileTypes.toType(abs.getType())};\n`);
|
|
81647
81680
|
chunk.appendString(traversal_1.Traversal.setValues(abs, name));
|
|
81648
81681
|
// yea, this is a mess
|
|
81649
81682
|
for (const cons of abapFile.getStructure()?.findAllStructures(abaplint.Structures.Constants) || []) {
|
|
@@ -81655,7 +81688,7 @@ class HandleTypePool {
|
|
|
81655
81688
|
}
|
|
81656
81689
|
for (const t in spaghettiNode?.getData().types) {
|
|
81657
81690
|
const abs = spaghettiNode.getData().types[t];
|
|
81658
|
-
chunk.appendString(`pool['${t.toLowerCase()}'] = ${
|
|
81691
|
+
chunk.appendString(`pool['${t.toLowerCase()}'] = ${transpile_types_1.TranspileTypes.toType(abs.getType())};\n`);
|
|
81659
81692
|
}
|
|
81660
81693
|
chunk.appendString(`abap.TypePools['${obj.getName()}'] = pool;`);
|
|
81661
81694
|
const output = {
|
|
@@ -81698,7 +81731,7 @@ class HandleView {
|
|
|
81698
81731
|
const type = obj.parseType(reg);
|
|
81699
81732
|
const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
|
|
81700
81733
|
"objectType": "VIEW",
|
|
81701
|
-
"type": ${
|
|
81734
|
+
"type": ${transpile_types_1.TranspileTypes.toType(type)},
|
|
81702
81735
|
};`);
|
|
81703
81736
|
// todo, "keyFields": ${JSON.stringify(obj.listKeys())},
|
|
81704
81737
|
const output = {
|
|
@@ -82022,6 +82055,52 @@ exports.Initialization = Initialization;
|
|
|
82022
82055
|
|
|
82023
82056
|
/***/ }),
|
|
82024
82057
|
|
|
82058
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/inline.js":
|
|
82059
|
+
/*!***************************************************************!*\
|
|
82060
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/inline.js ***!
|
|
82061
|
+
\***************************************************************/
|
|
82062
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
82063
|
+
|
|
82064
|
+
"use strict";
|
|
82065
|
+
|
|
82066
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
82067
|
+
exports.InlineDeclarations = void 0;
|
|
82068
|
+
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
82069
|
+
const transpile_types_1 = __webpack_require__(/*! ./transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
|
|
82070
|
+
const statements_1 = __webpack_require__(/*! ./statements */ "./node_modules/@abaplint/transpiler/build/src/statements/index.js");
|
|
82071
|
+
class InlineDeclarations {
|
|
82072
|
+
static buildDeclarations(node, traversal) {
|
|
82073
|
+
const inlineDataExpressions = node.findAllExpressionsRecursive(abaplint.Expressions.InlineData);
|
|
82074
|
+
let result = "";
|
|
82075
|
+
for (const expression of inlineDataExpressions) {
|
|
82076
|
+
const name = expression.findFirstExpression(abaplint.Expressions.TargetField)?.concatTokens();
|
|
82077
|
+
if (name === undefined) {
|
|
82078
|
+
throw new Error("InlineDeclarations: no target data field found");
|
|
82079
|
+
}
|
|
82080
|
+
const scope = traversal.findCurrentScopeByToken(expression.getFirstToken());
|
|
82081
|
+
const variable = scope?.findVariable(name);
|
|
82082
|
+
if (variable === undefined) {
|
|
82083
|
+
throw new Error("InlineDeclarations: no variable found");
|
|
82084
|
+
}
|
|
82085
|
+
result += transpile_types_1.TranspileTypes.declare(variable) + "\n";
|
|
82086
|
+
}
|
|
82087
|
+
// todo: declare DATA and FSes according to when they appear in the code
|
|
82088
|
+
const inlineFieldSymbols = node.findAllExpressionsRecursive(abaplint.Expressions.InlineFS);
|
|
82089
|
+
for (const expression of inlineFieldSymbols) {
|
|
82090
|
+
const target = expression.findFirstExpression(abaplint.Expressions.TargetFieldSymbol);
|
|
82091
|
+
if (target === undefined) {
|
|
82092
|
+
throw new Error("InlineDeclarations: no target fs field found");
|
|
82093
|
+
}
|
|
82094
|
+
result += new statements_1.FieldSymbolTranspiler().transpile(target, traversal).getCode();
|
|
82095
|
+
}
|
|
82096
|
+
return result;
|
|
82097
|
+
}
|
|
82098
|
+
}
|
|
82099
|
+
exports.InlineDeclarations = InlineDeclarations;
|
|
82100
|
+
//# sourceMappingURL=inline.js.map
|
|
82101
|
+
|
|
82102
|
+
/***/ }),
|
|
82103
|
+
|
|
82025
82104
|
/***/ "./node_modules/@abaplint/transpiler/build/src/keywords.js":
|
|
82026
82105
|
/*!*****************************************************************!*\
|
|
82027
82106
|
!*** ./node_modules/@abaplint/transpiler/build/src/keywords.js ***!
|
|
@@ -83546,7 +83625,7 @@ class CreateDataTranspiler {
|
|
|
83546
83625
|
if (typeNameNode) {
|
|
83547
83626
|
const id = traversal.findCurrentScopeByToken(typeNameNode.getFirstToken())?.findType(typeNameNode.concatTokens());
|
|
83548
83627
|
if (id) {
|
|
83549
|
-
options.push(`"type": ` +
|
|
83628
|
+
options.push(`"type": ` + transpile_types_1.TranspileTypes.toType(id.getType()));
|
|
83550
83629
|
}
|
|
83551
83630
|
else {
|
|
83552
83631
|
options.push(`"typeName": "${typeNameNode.concatTokens().toUpperCase()}"`);
|
|
@@ -83727,7 +83806,7 @@ class DataTranspiler {
|
|
|
83727
83806
|
const ret = new chunk_1.Chunk()
|
|
83728
83807
|
.appendString("let ")
|
|
83729
83808
|
.appendString(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(found.getName().toLowerCase())))
|
|
83730
|
-
.appendString(" = " +
|
|
83809
|
+
.appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType()))
|
|
83731
83810
|
.appendString(";")
|
|
83732
83811
|
.appendString(value);
|
|
83733
83812
|
return ret;
|
|
@@ -84577,7 +84656,7 @@ class FieldSymbolTranspiler {
|
|
|
84577
84656
|
return new chunk_1.Chunk()
|
|
84578
84657
|
.appendString("let ")
|
|
84579
84658
|
.appendString(new field_symbol_1.FieldSymbolTranspiler().transpile(name, traversal).getCode())
|
|
84580
|
-
.appendString(" = new abap.types.FieldSymbol(" +
|
|
84659
|
+
.appendString(" = new abap.types.FieldSymbol(" + transpile_types_1.TranspileTypes.toType(found.getType()) + ");");
|
|
84581
84660
|
}
|
|
84582
84661
|
throw new Error("FieldSymbolTranspiler, name not found");
|
|
84583
84662
|
}
|
|
@@ -85491,6 +85570,14 @@ class LoopTranspiler {
|
|
|
85491
85570
|
getTarget() {
|
|
85492
85571
|
return this.unique;
|
|
85493
85572
|
}
|
|
85573
|
+
determineInto(node) {
|
|
85574
|
+
const loopTarget = node.findDirectExpression(abaplint.Expressions.LoopTarget);
|
|
85575
|
+
let into = loopTarget?.findDirectExpression(abaplint.Expressions.Target);
|
|
85576
|
+
if (into?.getFirstChild()?.get() instanceof abaplint.Expressions.InlineData) {
|
|
85577
|
+
into = into.findFirstExpression(abaplint.Expressions.TargetField);
|
|
85578
|
+
}
|
|
85579
|
+
return into;
|
|
85580
|
+
}
|
|
85494
85581
|
transpile(node, traversal) {
|
|
85495
85582
|
if (!(node.get() instanceof abaplint.Statements.Loop)) {
|
|
85496
85583
|
throw new Error("LoopTranspiler, unexpected node");
|
|
@@ -85499,7 +85586,7 @@ class LoopTranspiler {
|
|
|
85499
85586
|
const source = traversal.traverse(loopSource).getCode();
|
|
85500
85587
|
this.unique = unique_identifier_1.UniqueIdentifier.get();
|
|
85501
85588
|
let target = "";
|
|
85502
|
-
const into =
|
|
85589
|
+
const into = this.determineInto(node);
|
|
85503
85590
|
if (into && this.skipInto !== true) {
|
|
85504
85591
|
const concat = node.concatTokens().toUpperCase();
|
|
85505
85592
|
const t = traversal.traverse(into).getCode();
|
|
@@ -85801,7 +85888,7 @@ class MethodImplementationTranspiler {
|
|
|
85801
85888
|
const passByValue = identifier.getMeta().includes("pass_by_value" /* abaplint.IdentifierMeta.PassByValue */);
|
|
85802
85889
|
const type = identifier.getType();
|
|
85803
85890
|
if (identifier.getMeta().includes("exporting" /* abaplint.IdentifierMeta.MethodExporting */)) {
|
|
85804
|
-
after += `let ${varPrefixed} = ${unique}?.${varName} || ${
|
|
85891
|
+
after += `let ${varPrefixed} = ${unique}?.${varName} || ${transpile_types_1.TranspileTypes.toType(identifier.getType())};\n`;
|
|
85805
85892
|
}
|
|
85806
85893
|
else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
|
|
85807
85894
|
&& parameterDefault === undefined
|
|
@@ -85812,31 +85899,31 @@ class MethodImplementationTranspiler {
|
|
|
85812
85899
|
if (identifier.getType().getQualifiedName() !== undefined && identifier.getType().getQualifiedName() !== "") {
|
|
85813
85900
|
after += `if (${varPrefixed}?.getQualifiedName === undefined || ${varPrefixed}.getQualifiedName() !== "${identifier.getType().getQualifiedName()?.toUpperCase()}") { ${varPrefixed} = undefined; }\n`;
|
|
85814
85901
|
}
|
|
85815
|
-
after += `if (${varPrefixed} === undefined) { ${varPrefixed} = ${
|
|
85902
|
+
after += `if (${varPrefixed} === undefined) { ${varPrefixed} = ${transpile_types_1.TranspileTypes.toType(identifier.getType())}.set(${unique}.${varName}); }\n`;
|
|
85816
85903
|
}
|
|
85817
85904
|
else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
|
|
85818
85905
|
&& type.isGeneric() === true) {
|
|
85819
85906
|
if (isOptional === true) {
|
|
85820
|
-
after += `let ${varPrefixed} = ${unique}?.${varName} || ${
|
|
85907
|
+
after += `let ${varPrefixed} = ${unique}?.${varName} || ${transpile_types_1.TranspileTypes.toType(identifier.getType())};\n`;
|
|
85821
85908
|
}
|
|
85822
85909
|
else {
|
|
85823
85910
|
after += `let ${varPrefixed} = ${unique}?.${varName};\n`;
|
|
85824
85911
|
}
|
|
85825
85912
|
if (type instanceof abaplint.BasicTypes.NumericGenericType) {
|
|
85826
85913
|
after += `if (${varPrefixed}.constructor.name === "Character") {
|
|
85827
|
-
${varPrefixed} = ${
|
|
85914
|
+
${varPrefixed} = ${transpile_types_1.TranspileTypes.toType(identifier.getType())};
|
|
85828
85915
|
${varPrefixed}.set(${unique}?.${varName});
|
|
85829
85916
|
}\n`;
|
|
85830
85917
|
}
|
|
85831
85918
|
}
|
|
85832
85919
|
else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
|
|
85833
85920
|
&& type.isGeneric() === false) {
|
|
85834
|
-
after +=
|
|
85921
|
+
after += transpile_types_1.TranspileTypes.declare(identifier) + "\n";
|
|
85835
85922
|
// note: it might be nessesary to do a type conversion, eg char is passed to xstring parameter
|
|
85836
85923
|
after += "if (" + unique + " && " + unique + "." + varName + ") {" + varPrefixed + ".set(" + unique + "." + varName + ");}\n";
|
|
85837
85924
|
}
|
|
85838
85925
|
else {
|
|
85839
|
-
after +=
|
|
85926
|
+
after += transpile_types_1.TranspileTypes.declare(identifier) + "\n";
|
|
85840
85927
|
after += "if (" + unique + " && " + unique + "." + varName + ") {" + varPrefixed + " = " + unique + "." + varName + ";}\n";
|
|
85841
85928
|
}
|
|
85842
85929
|
if (parameterDefault) {
|
|
@@ -85850,7 +85937,7 @@ class MethodImplementationTranspiler {
|
|
|
85850
85937
|
}
|
|
85851
85938
|
}
|
|
85852
85939
|
else if (identifier.getMeta().includes("returning" /* abaplint.IdentifierMeta.MethodReturning */)) {
|
|
85853
|
-
after = after +
|
|
85940
|
+
after = after + transpile_types_1.TranspileTypes.declare(identifier) + "\n";
|
|
85854
85941
|
}
|
|
85855
85942
|
}
|
|
85856
85943
|
if (after.length > 0) { // argh
|
|
@@ -86549,7 +86636,7 @@ class RangesTranspiler {
|
|
|
86549
86636
|
const ret = new chunk_1.Chunk()
|
|
86550
86637
|
.appendString("let ")
|
|
86551
86638
|
.appendString(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(found.getName().toLowerCase())))
|
|
86552
|
-
.appendString(" = " +
|
|
86639
|
+
.appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType()))
|
|
86553
86640
|
.appendString(";");
|
|
86554
86641
|
return ret;
|
|
86555
86642
|
}
|
|
@@ -87836,7 +87923,7 @@ class TablesTranspiler {
|
|
|
87836
87923
|
const ret = new chunk_1.Chunk()
|
|
87837
87924
|
.appendString("let ")
|
|
87838
87925
|
.append(found.getName().toLowerCase(), token, traversal)
|
|
87839
|
-
.appendString(" = " +
|
|
87926
|
+
.appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType()))
|
|
87840
87927
|
.append(";", node.getLastToken(), traversal);
|
|
87841
87928
|
return ret;
|
|
87842
87929
|
}
|
|
@@ -88613,7 +88700,7 @@ class ClassImplementationTranspiler {
|
|
|
88613
88700
|
const prefix = traversal_1.Traversal.escapeNamespace(cdef.getName().toLowerCase()) + ".";
|
|
88614
88701
|
let ret = "";
|
|
88615
88702
|
for (const ty of cdef.getTypeDefinitions().getAll()) {
|
|
88616
|
-
ret +=
|
|
88703
|
+
ret += transpile_types_1.TranspileTypes.declareStaticSkipVoid(prefix, ty.type);
|
|
88617
88704
|
}
|
|
88618
88705
|
return ret;
|
|
88619
88706
|
}
|
|
@@ -88651,7 +88738,7 @@ class ClassImplementationTranspiler {
|
|
|
88651
88738
|
const staticAttributes = this.findStaticAttributes(cdef, scope, traversal);
|
|
88652
88739
|
for (const attr of staticAttributes) {
|
|
88653
88740
|
const name = traversal_1.Traversal.escapeNamespace(clasName) + "." + traversal_1.Traversal.escapeNamespace(attr.prefix) + traversal_1.Traversal.escapeNamespace(attr.identifier.getName().toLowerCase());
|
|
88654
|
-
ret += name + " = " +
|
|
88741
|
+
ret += name + " = " + transpile_types_1.TranspileTypes.toType(attr.identifier.getType()) + ";\n";
|
|
88655
88742
|
ret += traversal.setValues(attr.identifier, name);
|
|
88656
88743
|
}
|
|
88657
88744
|
for (const alias of cdef.getAliases()) {
|
|
@@ -88878,6 +88965,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
88878
88965
|
exports.FormTranspiler = void 0;
|
|
88879
88966
|
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
88880
88967
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
88968
|
+
const inline_1 = __webpack_require__(/*! ../inline */ "./node_modules/@abaplint/transpiler/build/src/inline.js");
|
|
88881
88969
|
class FormTranspiler {
|
|
88882
88970
|
transpile(node, traversal) {
|
|
88883
88971
|
const formName = node.findFirstStatement(abaplint.Statements.Form)
|
|
@@ -88885,6 +88973,10 @@ class FormTranspiler {
|
|
|
88885
88973
|
const ret = new chunk_1.Chunk();
|
|
88886
88974
|
for (const c of node.getChildren()) {
|
|
88887
88975
|
ret.appendChunk(traversal.traverse(c));
|
|
88976
|
+
if (c.get() instanceof abaplint.Statements.Form) {
|
|
88977
|
+
const declare = inline_1.InlineDeclarations.buildDeclarations(node, traversal);
|
|
88978
|
+
ret.appendString(declare);
|
|
88979
|
+
}
|
|
88888
88980
|
}
|
|
88889
88981
|
if (formName && traversal.getCurrentObject().getType() === "PROG") {
|
|
88890
88982
|
ret.appendString(`abap.Forms['PROG-${traversal.getCurrentObject().getName().toUpperCase()}-${formName}'] = ${formName?.toLowerCase()};`);
|
|
@@ -88967,7 +89059,7 @@ class FunctionModuleTranspiler {
|
|
|
88967
89059
|
if (type !== undefined && p.optional === true) {
|
|
88968
89060
|
// todo, set DEFAULT value
|
|
88969
89061
|
ret += `if (${name} === undefined) {
|
|
88970
|
-
${name} = ${
|
|
89062
|
+
${name} = ${transpile_types_1.TranspileTypes.toType(type)};
|
|
88971
89063
|
}\n`;
|
|
88972
89064
|
}
|
|
88973
89065
|
}
|
|
@@ -89017,6 +89109,7 @@ __exportStar(__webpack_require__(/*! ./interface */ "./node_modules/@abaplint/tr
|
|
|
89017
89109
|
__exportStar(__webpack_require__(/*! ./loop */ "./node_modules/@abaplint/transpiler/build/src/structures/loop.js"), exports);
|
|
89018
89110
|
__exportStar(__webpack_require__(/*! ./module */ "./node_modules/@abaplint/transpiler/build/src/structures/module.js"), exports);
|
|
89019
89111
|
__exportStar(__webpack_require__(/*! ./select */ "./node_modules/@abaplint/transpiler/build/src/structures/select.js"), exports);
|
|
89112
|
+
__exportStar(__webpack_require__(/*! ./method */ "./node_modules/@abaplint/transpiler/build/src/structures/method.js"), exports);
|
|
89020
89113
|
__exportStar(__webpack_require__(/*! ./try */ "./node_modules/@abaplint/transpiler/build/src/structures/try.js"), exports);
|
|
89021
89114
|
__exportStar(__webpack_require__(/*! ./types */ "./node_modules/@abaplint/transpiler/build/src/structures/types.js"), exports);
|
|
89022
89115
|
__exportStar(__webpack_require__(/*! ./when */ "./node_modules/@abaplint/transpiler/build/src/structures/when.js"), exports);
|
|
@@ -89072,7 +89165,7 @@ class InterfaceTranspiler {
|
|
|
89072
89165
|
const prefix = traversal_1.Traversal.escapeNamespace(idef.getName().toLowerCase()) + ".";
|
|
89073
89166
|
let ret = "";
|
|
89074
89167
|
for (const ty of idef.getTypeDefinitions().getAll()) {
|
|
89075
|
-
ret +=
|
|
89168
|
+
ret += transpile_types_1.TranspileTypes.declareStaticSkipVoid(prefix, ty.type);
|
|
89076
89169
|
}
|
|
89077
89170
|
return ret;
|
|
89078
89171
|
}
|
|
@@ -89098,7 +89191,7 @@ class InterfaceTranspiler {
|
|
|
89098
89191
|
}
|
|
89099
89192
|
const interfaceName = traversal_1.Traversal.escapeNamespace(node.getFirstToken().getStr().toLowerCase());
|
|
89100
89193
|
const name = interfaceName + "." + interfaceName + "$" + n.toLowerCase();
|
|
89101
|
-
ret += name + " = " +
|
|
89194
|
+
ret += name + " = " + transpile_types_1.TranspileTypes.toType(identifier.getType()) + ";\n";
|
|
89102
89195
|
const alias = idef?.getAliases().find(a => a.getName().toUpperCase() === n.toUpperCase());
|
|
89103
89196
|
if (alias) {
|
|
89104
89197
|
// todo: this is an evil workaround, should be fixed in abaplint instead
|
|
@@ -89225,6 +89318,37 @@ exports.LoopTranspiler = LoopTranspiler;
|
|
|
89225
89318
|
|
|
89226
89319
|
/***/ }),
|
|
89227
89320
|
|
|
89321
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/structures/method.js":
|
|
89322
|
+
/*!**************************************************************************!*\
|
|
89323
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/structures/method.js ***!
|
|
89324
|
+
\**************************************************************************/
|
|
89325
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
89326
|
+
|
|
89327
|
+
"use strict";
|
|
89328
|
+
|
|
89329
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89330
|
+
exports.MethodTranspiler = void 0;
|
|
89331
|
+
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
89332
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
89333
|
+
const inline_1 = __webpack_require__(/*! ../inline */ "./node_modules/@abaplint/transpiler/build/src/inline.js");
|
|
89334
|
+
class MethodTranspiler {
|
|
89335
|
+
transpile(node, traversal) {
|
|
89336
|
+
const ret = new chunk_1.Chunk();
|
|
89337
|
+
for (const c of node.getChildren()) {
|
|
89338
|
+
ret.appendChunk(traversal.traverse(c));
|
|
89339
|
+
if (c.get() instanceof abaplint.Statements.MethodImplementation) {
|
|
89340
|
+
const declare = inline_1.InlineDeclarations.buildDeclarations(node, traversal);
|
|
89341
|
+
ret.appendString(declare);
|
|
89342
|
+
}
|
|
89343
|
+
}
|
|
89344
|
+
return ret;
|
|
89345
|
+
}
|
|
89346
|
+
}
|
|
89347
|
+
exports.MethodTranspiler = MethodTranspiler;
|
|
89348
|
+
//# sourceMappingURL=method.js.map
|
|
89349
|
+
|
|
89350
|
+
/***/ }),
|
|
89351
|
+
|
|
89228
89352
|
/***/ "./node_modules/@abaplint/transpiler/build/src/structures/module.js":
|
|
89229
89353
|
/*!**************************************************************************!*\
|
|
89230
89354
|
!*** ./node_modules/@abaplint/transpiler/build/src/structures/module.js ***!
|
|
@@ -89492,13 +89616,12 @@ exports.TranspileTypes = void 0;
|
|
|
89492
89616
|
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
89493
89617
|
const traversal_1 = __webpack_require__(/*! ./traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
89494
89618
|
const featureHexUInt8 = false;
|
|
89495
|
-
// todo: change this class to static for performance?
|
|
89496
89619
|
class TranspileTypes {
|
|
89497
|
-
declare(t) {
|
|
89620
|
+
static declare(t) {
|
|
89498
89621
|
const type = t.getType();
|
|
89499
89622
|
return "let " + traversal_1.Traversal.prefixVariable(t.getName().toLowerCase()) + " = " + this.toType(type) + ";";
|
|
89500
89623
|
}
|
|
89501
|
-
declareStaticSkipVoid(pre, t) {
|
|
89624
|
+
static declareStaticSkipVoid(pre, t) {
|
|
89502
89625
|
const type = t.getType();
|
|
89503
89626
|
const code = this.toType(type);
|
|
89504
89627
|
// todo, this should look at the configuration, for runtime vs compile time errors
|
|
@@ -89507,7 +89630,7 @@ class TranspileTypes {
|
|
|
89507
89630
|
}
|
|
89508
89631
|
return pre + t.getName().toLowerCase() + " = " + code + ";\n";
|
|
89509
89632
|
}
|
|
89510
|
-
toType(type) {
|
|
89633
|
+
static toType(type) {
|
|
89511
89634
|
let resolved = "";
|
|
89512
89635
|
let extra = "";
|
|
89513
89636
|
if (type instanceof abaplint.BasicTypes.ObjectReferenceType
|
|
@@ -89930,7 +90053,7 @@ class Traversal {
|
|
|
89930
90053
|
for (const m of methodDefinitions.getAll()) {
|
|
89931
90054
|
const parameters = [];
|
|
89932
90055
|
for (const p of m.getParameters().getAll()) {
|
|
89933
|
-
const type =
|
|
90056
|
+
const type = transpile_types_1.TranspileTypes.toType(p.getType());
|
|
89934
90057
|
const optional = m.getParameters().getOptional().includes(p.getName()) ? "X" : " ";
|
|
89935
90058
|
parameters.push(`"${p.getName().toUpperCase()}": {"type": () => {return ${type};}, "is_optional": "${optional}"}`);
|
|
89936
90059
|
}
|
|
@@ -89955,13 +90078,13 @@ class Traversal {
|
|
|
89955
90078
|
return attr;
|
|
89956
90079
|
}
|
|
89957
90080
|
for (const a of def.getAttributes()?.getAll() || []) {
|
|
89958
|
-
const type =
|
|
90081
|
+
const type = transpile_types_1.TranspileTypes.toType(a.getType());
|
|
89959
90082
|
const runtime = this.mapVisibility(a.getVisibility());
|
|
89960
90083
|
const isClass = a.getMeta().includes("static" /* abaplint.IdentifierMeta.Static */) ? "X" : " ";
|
|
89961
90084
|
attr.add(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": " ", "is_class": "${isClass}"}`);
|
|
89962
90085
|
}
|
|
89963
90086
|
for (const a of def.getAttributes()?.getConstants() || []) {
|
|
89964
|
-
const type =
|
|
90087
|
+
const type = transpile_types_1.TranspileTypes.toType(a.getType());
|
|
89965
90088
|
let runtime = "";
|
|
89966
90089
|
switch (a.getVisibility()) {
|
|
89967
90090
|
case abaplint.Visibility.Private:
|
|
@@ -90144,7 +90267,7 @@ class Traversal {
|
|
|
90144
90267
|
escaped = "#" + escaped;
|
|
90145
90268
|
}
|
|
90146
90269
|
const name = "this." + escaped;
|
|
90147
|
-
ret += name + " = " +
|
|
90270
|
+
ret += name + " = " + transpile_types_1.TranspileTypes.toType(a.getType()) + ";\n";
|
|
90148
90271
|
ret += this.setValues(a, name);
|
|
90149
90272
|
if (escaped?.startsWith("#")) {
|
|
90150
90273
|
ret += `this.FRIENDS_ACCESS_INSTANCE["${escaped.replace("#", "")}"] = ${name};\n`;
|
|
@@ -90281,7 +90404,7 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
|
|
|
90281
90404
|
ret += "if (this." + n + " === undefined) this." + n + " = " + cname + "." + n + ";\n";
|
|
90282
90405
|
}
|
|
90283
90406
|
else {
|
|
90284
|
-
ret += "if (this." + n + " === undefined) this." + n + " = " +
|
|
90407
|
+
ret += "if (this." + n + " === undefined) this." + n + " = " + transpile_types_1.TranspileTypes.toType(a.getType()) + ";\n";
|
|
90285
90408
|
}
|
|
90286
90409
|
}
|
|
90287
90410
|
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.14",
|
|
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.162",
|
|
31
|
+
"@abaplint/transpiler": "^2.11.14",
|
|
32
32
|
"@types/glob": "^8.1.0",
|
|
33
33
|
"@types/node": "^24.2.1",
|
|
34
34
|
"@types/progress": "^2.0.7",
|