@abaplint/transpiler-cli 2.11.44 → 2.11.46
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 +192 -39
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -6815,7 +6815,7 @@ class Source extends combi_1.Expression {
|
|
|
6815
6815
|
const conv = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("CONV", _1.TypeNameOrInfer, lparenNoSpace, _1.ConvBody, rparenNoSpace, (0, combi_1.optPrio)(after)), version_1.Version.OpenABAP);
|
|
6816
6816
|
const swit = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("SWITCH", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.SwitchBody, rparenNoSpace, (0, combi_1.optPrio)(after)));
|
|
6817
6817
|
const value = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("VALUE", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.ValueBody, rparenNoSpace, (0, combi_1.optPrio)(after)), version_1.Version.OpenABAP);
|
|
6818
|
-
const cond = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("COND", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.CondBody, rparenNoSpace, (0, combi_1.optPrio)(after)));
|
|
6818
|
+
const cond = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("COND", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.CondBody, rparenNoSpace, (0, combi_1.optPrio)(after)), version_1.Version.OpenABAP);
|
|
6819
6819
|
const reff = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("REF", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), Source, (0, combi_1.optPrio)("OPTIONAL"), rparen), version_1.Version.OpenABAP);
|
|
6820
6820
|
const exact = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("EXACT", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), Source, rparen, (0, combi_1.optPrio)(after)));
|
|
6821
6821
|
const filter = (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.seq)("FILTER", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.FilterBody, rparen));
|
|
@@ -14895,7 +14895,7 @@ class Raise {
|
|
|
14895
14895
|
const exporting = (0, combi_1.seq)("EXPORTING", expressions_1.ParameterListS);
|
|
14896
14896
|
const from = (0, combi_1.seq)("TYPE", expressions_1.ClassName, (0, combi_1.opt)((0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v750, (0, combi_1.alt)(mess, messid)), (0, combi_1.ver)(version_1.Version.v752, "USING MESSAGE"))), (0, combi_1.optPrio)(exporting));
|
|
14897
14897
|
const pre = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("RESUMABLE"), "EXCEPTION"), "SHORTDUMP");
|
|
14898
|
-
const clas = (0, combi_1.seq)(pre, (0, combi_1.altPrio)(from, (0, combi_1.ver)(version_1.Version.v752, expressions_1.Source), expressions_1.SimpleSource2));
|
|
14898
|
+
const clas = (0, combi_1.seq)(pre, (0, combi_1.altPrio)(from, (0, combi_1.ver)(version_1.Version.v752, expressions_1.Source, version_1.Version.OpenABAP), expressions_1.SimpleSource2));
|
|
14899
14899
|
const ret = (0, combi_1.seq)("RAISE", (0, combi_1.altPrio)(clas, expressions_1.ExceptionName));
|
|
14900
14900
|
return ret;
|
|
14901
14901
|
}
|
|
@@ -24851,7 +24851,7 @@ class FieldChain {
|
|
|
24851
24851
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, current.getFirstToken(), message));
|
|
24852
24852
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
24853
24853
|
}
|
|
24854
|
-
table_expression_1.TableExpression.runSyntax(current, input);
|
|
24854
|
+
table_expression_1.TableExpression.runSyntax(current, input, context);
|
|
24855
24855
|
if (!(context instanceof basic_1.VoidType)) {
|
|
24856
24856
|
context = context.getRowType();
|
|
24857
24857
|
}
|
|
@@ -27832,16 +27832,39 @@ exports.SwitchBody = SwitchBody;
|
|
|
27832
27832
|
|
|
27833
27833
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
27834
27834
|
exports.TableExpression = void 0;
|
|
27835
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
27835
27836
|
const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
27836
27837
|
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
27838
|
+
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
27839
|
+
const component_chain_1 = __webpack_require__(/*! ./component_chain */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_chain.js");
|
|
27837
27840
|
class TableExpression {
|
|
27838
|
-
static runSyntax(node, input) {
|
|
27841
|
+
static runSyntax(node, input, rowType) {
|
|
27839
27842
|
if (node === undefined) {
|
|
27840
27843
|
return;
|
|
27841
27844
|
}
|
|
27842
|
-
|
|
27845
|
+
let context = rowType;
|
|
27846
|
+
if (context instanceof basic_1.TableType) {
|
|
27847
|
+
context = context.getRowType();
|
|
27848
|
+
}
|
|
27849
|
+
if (node.getChildren().length === 3) {
|
|
27850
|
+
const s = node.findDirectExpression(Expressions.Source);
|
|
27851
|
+
source_1.Source.runSyntax(s, input, context);
|
|
27852
|
+
}
|
|
27853
|
+
else if (node.findDirectTokenByText("INDEX")) {
|
|
27854
|
+
const s = node.findDirectExpression(Expressions.Source);
|
|
27843
27855
|
source_1.Source.runSyntax(s, input);
|
|
27844
27856
|
}
|
|
27857
|
+
else {
|
|
27858
|
+
let fieldType = undefined;
|
|
27859
|
+
for (const c of node.getChildren()) {
|
|
27860
|
+
if (c instanceof nodes_1.ExpressionNode && c.get() instanceof Expressions.ComponentChainSimple) {
|
|
27861
|
+
fieldType = component_chain_1.ComponentChain.runSyntax(context, c, input);
|
|
27862
|
+
}
|
|
27863
|
+
else if (c instanceof nodes_1.ExpressionNode && c.get() instanceof Expressions.Source) {
|
|
27864
|
+
source_1.Source.runSyntax(c, input, fieldType);
|
|
27865
|
+
}
|
|
27866
|
+
}
|
|
27867
|
+
}
|
|
27845
27868
|
}
|
|
27846
27869
|
}
|
|
27847
27870
|
exports.TableExpression = TableExpression;
|
|
@@ -27959,7 +27982,7 @@ class Target {
|
|
|
27959
27982
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
27960
27983
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
27961
27984
|
}
|
|
27962
|
-
table_expression_1.TableExpression.runSyntax(current, input);
|
|
27985
|
+
table_expression_1.TableExpression.runSyntax(current, input, context);
|
|
27963
27986
|
if (!(context instanceof basic_1.VoidType)) {
|
|
27964
27987
|
context = context.getRowType();
|
|
27965
27988
|
}
|
|
@@ -31156,15 +31179,22 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modu
|
|
|
31156
31179
|
const assert_error_1 = __webpack_require__(/*! ../assert_error */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/assert_error.js");
|
|
31157
31180
|
class IncludeType {
|
|
31158
31181
|
runSyntax(node, input) {
|
|
31159
|
-
var _a, _b;
|
|
31182
|
+
var _a, _b, _c;
|
|
31160
31183
|
const components = [];
|
|
31161
31184
|
const iname = node.findFirstExpression(Expressions.TypeName);
|
|
31162
31185
|
if (iname === undefined) {
|
|
31163
31186
|
throw new assert_error_1.AssertError("IncludeType, unexpected node structure");
|
|
31164
31187
|
}
|
|
31165
31188
|
const name = iname.getFirstToken().getStr();
|
|
31189
|
+
const isStructure = node.findDirectTokenByText("STRUCTURE") !== undefined;
|
|
31166
31190
|
let ityp = new basic_types_1.BasicTypes(input).parseType(iname);
|
|
31167
|
-
|
|
31191
|
+
if (ityp instanceof basic_1.VoidType && isStructure) {
|
|
31192
|
+
const found = (_a = input.scope.findVariable(name)) === null || _a === void 0 ? void 0 : _a.getType();
|
|
31193
|
+
if (found) {
|
|
31194
|
+
ityp = found;
|
|
31195
|
+
}
|
|
31196
|
+
}
|
|
31197
|
+
const as = (_b = node.findExpressionAfterToken("AS")) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
31168
31198
|
if (as && ityp instanceof basic_1.StructureType) {
|
|
31169
31199
|
ityp = new basic_1.StructureType(ityp.getComponents().concat([{
|
|
31170
31200
|
name: as,
|
|
@@ -31172,7 +31202,18 @@ class IncludeType {
|
|
|
31172
31202
|
asInclude: true,
|
|
31173
31203
|
}]));
|
|
31174
31204
|
}
|
|
31175
|
-
|
|
31205
|
+
else if (ityp instanceof basic_1.TableType && isStructure) {
|
|
31206
|
+
ityp = ityp.getRowType();
|
|
31207
|
+
}
|
|
31208
|
+
else if (ityp instanceof basic_1.VoidType) {
|
|
31209
|
+
return ityp;
|
|
31210
|
+
}
|
|
31211
|
+
if (!(ityp instanceof basic_1.StructureType)) {
|
|
31212
|
+
const message = "not structured, " + name;
|
|
31213
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, iname.getFirstToken(), message));
|
|
31214
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
31215
|
+
}
|
|
31216
|
+
const suffix = (_c = node.findExpressionAfterToken("SUFFIX")) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
31176
31217
|
if (suffix && ityp instanceof basic_1.StructureType) {
|
|
31177
31218
|
const components = [];
|
|
31178
31219
|
for (const c of ityp.getComponents()) {
|
|
@@ -34132,9 +34173,7 @@ exports.Constants = Constants;
|
|
|
34132
34173
|
|
|
34133
34174
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
34134
34175
|
exports.Data = void 0;
|
|
34135
|
-
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
34136
34176
|
const data_1 = __webpack_require__(/*! ../statements/data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/data.js");
|
|
34137
|
-
const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
|
|
34138
34177
|
const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
34139
34178
|
const type_1 = __webpack_require__(/*! ../statements/type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/type.js");
|
|
34140
34179
|
const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
|
|
@@ -34143,9 +34182,10 @@ const Basic = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abap
|
|
|
34143
34182
|
const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
34144
34183
|
const Statements = __webpack_require__(/*! ../../2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
|
|
34145
34184
|
const Structures = __webpack_require__(/*! ../../3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
|
|
34185
|
+
const include_type_1 = __webpack_require__(/*! ../statements/include_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/include_type.js");
|
|
34146
34186
|
class Data {
|
|
34147
34187
|
static runSyntax(node, input) {
|
|
34148
|
-
var _a
|
|
34188
|
+
var _a;
|
|
34149
34189
|
const fouth = (_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.getChildren()[3];
|
|
34150
34190
|
const isCommonPart = fouth instanceof nodes_1.TokenNode && fouth.concatTokens() === "COMMON";
|
|
34151
34191
|
if (isCommonPart) {
|
|
@@ -34180,25 +34220,47 @@ class Data {
|
|
|
34180
34220
|
}
|
|
34181
34221
|
else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {
|
|
34182
34222
|
// INCLUDES
|
|
34183
|
-
|
|
34184
|
-
const
|
|
34223
|
+
/*
|
|
34224
|
+
const typeToken = c.findFirstExpression(Expressions.TypeName)?.getFirstToken();
|
|
34225
|
+
const typeName = typeToken?.getStr();
|
|
34226
|
+
|
|
34185
34227
|
let foundId = input.scope.findType(typeName);
|
|
34186
34228
|
if (foundId === undefined) {
|
|
34187
|
-
|
|
34229
|
+
foundId = input.scope.findVariable(typeName);
|
|
34188
34230
|
}
|
|
34189
|
-
|
|
34231
|
+
|
|
34232
|
+
let found = foundId?.getType();
|
|
34190
34233
|
if (found === undefined) {
|
|
34191
|
-
|
|
34192
|
-
|
|
34193
|
-
|
|
34194
|
-
|
|
34195
|
-
|
|
34196
|
-
|
|
34197
|
-
|
|
34234
|
+
const f = input.scope.getDDIC().lookupTableOrView(typeName).type;
|
|
34235
|
+
if (f instanceof TypedIdentifier) {
|
|
34236
|
+
found = f.getType();
|
|
34237
|
+
} else {
|
|
34238
|
+
found = f;
|
|
34239
|
+
}
|
|
34240
|
+
} else {
|
|
34241
|
+
input.scope.addReference(typeToken, foundId, ReferenceType.TypeReference, input.filename);
|
|
34198
34242
|
}
|
|
34199
|
-
|
|
34200
|
-
|
|
34243
|
+
if (found instanceof Basic.VoidType) {
|
|
34244
|
+
if (table === true) {
|
|
34245
|
+
const ttyp = new Basic.TableType(found, {withHeader: true, keyType: Basic.TableKeyType.default});
|
|
34246
|
+
return new TypedIdentifier(name, input.filename, ttyp);
|
|
34247
|
+
} else {
|
|
34248
|
+
return new TypedIdentifier(name, input.filename, found);
|
|
34249
|
+
}
|
|
34201
34250
|
}
|
|
34251
|
+
if (found instanceof Basic.UnknownType) {
|
|
34252
|
+
return new TypedIdentifier(name, input.filename, new Basic.UnknownType("unknown type, " + typeName));
|
|
34253
|
+
}
|
|
34254
|
+
if (found instanceof Basic.TableType && found.isWithHeader()) {
|
|
34255
|
+
found = found.getRowType();
|
|
34256
|
+
}
|
|
34257
|
+
if (!(found instanceof Basic.StructureType)) {
|
|
34258
|
+
const message = "not structured, " + typeName;
|
|
34259
|
+
input.issues.push(syntaxIssue(input, typeToken!, message));
|
|
34260
|
+
return new TypedIdentifier(name, input.filename, Basic.VoidType.get(CheckSyntaxKey));
|
|
34261
|
+
}
|
|
34262
|
+
*/
|
|
34263
|
+
const found = new include_type_1.IncludeType().runSyntax(c, input);
|
|
34202
34264
|
if (found instanceof Basic.VoidType) {
|
|
34203
34265
|
if (table === true) {
|
|
34204
34266
|
const ttyp = new Basic.TableType(found, { withHeader: true, keyType: Basic.TableKeyType.default });
|
|
@@ -34208,18 +34270,7 @@ class Data {
|
|
|
34208
34270
|
return new _typed_identifier_1.TypedIdentifier(name, input.filename, found);
|
|
34209
34271
|
}
|
|
34210
34272
|
}
|
|
34211
|
-
|
|
34212
|
-
return new _typed_identifier_1.TypedIdentifier(name, input.filename, new Basic.UnknownType("unknown type, " + typeName));
|
|
34213
|
-
}
|
|
34214
|
-
if (found instanceof Basic.TableType && found.isWithHeader()) {
|
|
34215
|
-
found = found.getRowType();
|
|
34216
|
-
}
|
|
34217
|
-
if (!(found instanceof Basic.StructureType)) {
|
|
34218
|
-
const message = "not structured, " + typeName;
|
|
34219
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, typeToken, message));
|
|
34220
|
-
return new _typed_identifier_1.TypedIdentifier(name, input.filename, Basic.VoidType.get(_syntax_input_1.CheckSyntaxKey));
|
|
34221
|
-
}
|
|
34222
|
-
for (const c of found.getComponents()) {
|
|
34273
|
+
for (const c of found) {
|
|
34223
34274
|
components.push(c);
|
|
34224
34275
|
}
|
|
34225
34276
|
}
|
|
@@ -53794,7 +53845,7 @@ class Registry {
|
|
|
53794
53845
|
}
|
|
53795
53846
|
static abaplintVersion() {
|
|
53796
53847
|
// magic, see build script "version.sh"
|
|
53797
|
-
return "2.113.
|
|
53848
|
+
return "2.113.184";
|
|
53798
53849
|
}
|
|
53799
53850
|
getDDICReferences() {
|
|
53800
53851
|
return this.ddicReferences;
|
|
@@ -61739,6 +61790,9 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
61739
61790
|
}
|
|
61740
61791
|
replaceLineFunctions(node, lowFile, highSyntax, highFile) {
|
|
61741
61792
|
var _a, _b;
|
|
61793
|
+
if (this.lowReg.getConfig().getVersion() === version_1.Version.OpenABAP) {
|
|
61794
|
+
return undefined;
|
|
61795
|
+
}
|
|
61742
61796
|
const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());
|
|
61743
61797
|
for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
|
|
61744
61798
|
if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {
|
|
@@ -78848,6 +78902,87 @@ exports.CondTranspiler = CondTranspiler;
|
|
|
78848
78902
|
|
|
78849
78903
|
/***/ }),
|
|
78850
78904
|
|
|
78905
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/cond_body.js":
|
|
78906
|
+
/*!******************************************************************************!*\
|
|
78907
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/cond_body.js ***!
|
|
78908
|
+
\******************************************************************************/
|
|
78909
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
78910
|
+
|
|
78911
|
+
"use strict";
|
|
78912
|
+
|
|
78913
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78914
|
+
exports.CondBodyTranspiler = void 0;
|
|
78915
|
+
const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
78916
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
78917
|
+
const type_name_or_infer_1 = __webpack_require__(/*! ./type_name_or_infer */ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js");
|
|
78918
|
+
const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
|
|
78919
|
+
const cond_1 = __webpack_require__(/*! ./cond */ "./node_modules/@abaplint/transpiler/build/src/expressions/cond.js");
|
|
78920
|
+
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/transpiler/build/src/expressions/source.js");
|
|
78921
|
+
class CondBodyTranspiler {
|
|
78922
|
+
transpile(typ, body, traversal) {
|
|
78923
|
+
if (!(typ.get() instanceof core_1.Expressions.TypeNameOrInfer)) {
|
|
78924
|
+
throw new Error("CondBodyTranspiler, Expected TypeNameOrInfer");
|
|
78925
|
+
}
|
|
78926
|
+
else if (body.findDirectExpression(core_1.Expressions.Let)) {
|
|
78927
|
+
throw new Error("CondBodyTranspiler, Let not supported, todo");
|
|
78928
|
+
}
|
|
78929
|
+
const whenThen = [];
|
|
78930
|
+
const expressions = [];
|
|
78931
|
+
for (const c of body.getChildren()) {
|
|
78932
|
+
if (c instanceof core_1.Nodes.TokenNode) {
|
|
78933
|
+
if (c.concatTokens() === "ELSE") {
|
|
78934
|
+
break;
|
|
78935
|
+
}
|
|
78936
|
+
}
|
|
78937
|
+
else {
|
|
78938
|
+
expressions.push(c);
|
|
78939
|
+
}
|
|
78940
|
+
}
|
|
78941
|
+
for (let i = 0; i < expressions.length; i = i + 2) {
|
|
78942
|
+
whenThen.push({ when: expressions[i], then: expressions[i + 1] });
|
|
78943
|
+
}
|
|
78944
|
+
const type = new type_name_or_infer_1.TypeNameOrInfer().findType(typ, traversal);
|
|
78945
|
+
const target = transpile_types_1.TranspileTypes.toType(type);
|
|
78946
|
+
const ret = new chunk_1.Chunk();
|
|
78947
|
+
ret.appendString("(" + target + ".set(");
|
|
78948
|
+
ret.appendString("await (async () => {\n");
|
|
78949
|
+
for (const { when, then } of whenThen) {
|
|
78950
|
+
let condition = "";
|
|
78951
|
+
if (when.get() instanceof core_1.Expressions.Cond) {
|
|
78952
|
+
condition = new cond_1.CondTranspiler().transpile(when, traversal).getCode();
|
|
78953
|
+
}
|
|
78954
|
+
else {
|
|
78955
|
+
throw new Error("CondBodyTranspiler, Expected Cond, todo, " + when.get().constructor.name);
|
|
78956
|
+
}
|
|
78957
|
+
let value = "";
|
|
78958
|
+
if (then.get() instanceof core_1.Expressions.Source) {
|
|
78959
|
+
value = new source_1.SourceTranspiler().transpile(then, traversal).getCode();
|
|
78960
|
+
}
|
|
78961
|
+
else {
|
|
78962
|
+
throw new Error("CondBodyTranspiler, Expected Source, todo, " + then.get().constructor.name);
|
|
78963
|
+
}
|
|
78964
|
+
ret.appendString(`if (${condition}) { return ${value}; }\n`);
|
|
78965
|
+
}
|
|
78966
|
+
const els = body.findExpressionAfterToken("ELSE");
|
|
78967
|
+
if (els) {
|
|
78968
|
+
if (!(els.get() instanceof core_1.Expressions.Source)) {
|
|
78969
|
+
throw new Error("CondBodyTranspiler, Expected Source, todo, " + els.get().constructor.name);
|
|
78970
|
+
}
|
|
78971
|
+
const value = new source_1.SourceTranspiler().transpile(els, traversal).getCode();
|
|
78972
|
+
ret.appendString(`return ${value};\n`);
|
|
78973
|
+
}
|
|
78974
|
+
else {
|
|
78975
|
+
ret.appendString(`return ${target};\n`);
|
|
78976
|
+
}
|
|
78977
|
+
ret.appendString("})()))");
|
|
78978
|
+
return ret;
|
|
78979
|
+
}
|
|
78980
|
+
}
|
|
78981
|
+
exports.CondBodyTranspiler = CondBodyTranspiler;
|
|
78982
|
+
//# sourceMappingURL=cond_body.js.map
|
|
78983
|
+
|
|
78984
|
+
/***/ }),
|
|
78985
|
+
|
|
78851
78986
|
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/cond_sub.js":
|
|
78852
78987
|
/*!*****************************************************************************!*\
|
|
78853
78988
|
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/cond_sub.js ***!
|
|
@@ -79509,6 +79644,7 @@ __exportStar(__webpack_require__(/*! ./let */ "./node_modules/@abaplint/transpil
|
|
|
79509
79644
|
__exportStar(__webpack_require__(/*! ./message_number */ "./node_modules/@abaplint/transpiler/build/src/expressions/message_number.js"), exports);
|
|
79510
79645
|
__exportStar(__webpack_require__(/*! ./method_call_body */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_body.js"), exports);
|
|
79511
79646
|
__exportStar(__webpack_require__(/*! ./method_call_chain */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_chain.js"), exports);
|
|
79647
|
+
__exportStar(__webpack_require__(/*! ./cond_body */ "./node_modules/@abaplint/transpiler/build/src/expressions/cond_body.js"), exports);
|
|
79512
79648
|
__exportStar(__webpack_require__(/*! ./method_call_param */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_param.js"), exports);
|
|
79513
79649
|
__exportStar(__webpack_require__(/*! ./new_object */ "./node_modules/@abaplint/transpiler/build/src/expressions/new_object.js"), exports);
|
|
79514
79650
|
__exportStar(__webpack_require__(/*! ./method_call */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call.js"), exports);
|
|
@@ -80464,6 +80600,9 @@ class SourceTranspiler {
|
|
|
80464
80600
|
else if (c.get() instanceof core_1.Expressions.CorrespondingBody) {
|
|
80465
80601
|
continue;
|
|
80466
80602
|
}
|
|
80603
|
+
else if (c.get() instanceof core_1.Expressions.CondBody) {
|
|
80604
|
+
continue;
|
|
80605
|
+
}
|
|
80467
80606
|
else {
|
|
80468
80607
|
ret.appendString("SourceUnknown$" + c.get().constructor.name);
|
|
80469
80608
|
}
|
|
@@ -80508,6 +80647,17 @@ class SourceTranspiler {
|
|
|
80508
80647
|
}
|
|
80509
80648
|
ret.appendChunk(new corresponding_body_1.CorrespondingBodyTranspiler().transpile(typ, correspondingBody, traversal));
|
|
80510
80649
|
}
|
|
80650
|
+
else if (c instanceof core_1.Nodes.TokenNode && c.getFirstToken().getStr().toUpperCase() === "COND") {
|
|
80651
|
+
const typ = node.findDirectExpression(core_1.Expressions.TypeNameOrInfer);
|
|
80652
|
+
if (typ === undefined) {
|
|
80653
|
+
throw new Error("TypeNameOrInfer not found in CondBody");
|
|
80654
|
+
}
|
|
80655
|
+
const condBody = node.findDirectExpression(core_1.Expressions.CondBody);
|
|
80656
|
+
if (condBody === undefined) {
|
|
80657
|
+
throw new Error("CondBody not found");
|
|
80658
|
+
}
|
|
80659
|
+
ret.appendChunk(new _1.CondBodyTranspiler().transpile(typ, condBody, traversal));
|
|
80660
|
+
}
|
|
80511
80661
|
else if (c instanceof core_1.Nodes.TokenNode && c.getFirstToken().getStr().toUpperCase() === "REF") {
|
|
80512
80662
|
const infer = node.findDirectExpression(core_1.Expressions.TypeNameOrInfer);
|
|
80513
80663
|
if (infer?.concatTokens() !== "#") {
|
|
@@ -87272,7 +87422,10 @@ class RaiseTranspiler {
|
|
|
87272
87422
|
const classNameToken = node.findFirstExpression(abaplint.Expressions.ClassName)?.getFirstToken();
|
|
87273
87423
|
const className = classNameToken?.getStr();
|
|
87274
87424
|
if (className === undefined) {
|
|
87275
|
-
|
|
87425
|
+
let s = node.findFirstExpression(abaplint.Expressions.SimpleSource2);
|
|
87426
|
+
if (s === undefined) {
|
|
87427
|
+
s = node.findFirstExpression(abaplint.Expressions.Source);
|
|
87428
|
+
}
|
|
87276
87429
|
if (s === undefined) {
|
|
87277
87430
|
const name = node.findFirstExpression(abaplint.Expressions.ExceptionName)?.concatTokens().toLowerCase();
|
|
87278
87431
|
return new chunk_1.Chunk().append(`throw new abap.ClassicError({classic: "${name}"});`, node, traversal);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.46",
|
|
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.184",
|
|
31
|
+
"@abaplint/transpiler": "^2.11.46",
|
|
32
32
|
"@types/glob": "^8.1.0",
|
|
33
33
|
"@types/node": "^24.3.0",
|
|
34
34
|
"@types/progress": "^2.0.7",
|