@abaplint/transpiler-cli 2.11.45 → 2.11.47
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 +139 -13
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -6514,7 +6514,7 @@ class Select extends combi_1.Expression {
|
|
|
6514
6514
|
const where = (0, combi_1.seq)("WHERE", _1.SQLCond);
|
|
6515
6515
|
const offset = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("OFFSET", _1.SQLSource));
|
|
6516
6516
|
const bypass = (0, combi_1.str)("BYPASSING BUFFER");
|
|
6517
|
-
const fields = (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields);
|
|
6517
|
+
const fields = (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields, version_1.Version.OpenABAP);
|
|
6518
6518
|
// todo, HINTS cannot be anywhere, need an expression dedicated for strict sql
|
|
6519
6519
|
const perm = (0, combi_1.per)(_1.SQLFrom, into, _1.SQLForAllEntries, where, _1.SQLOrderBy, sql_up_to_1.SQLUpTo, offset, _1.SQLClient, _1.SQLHaving, bypass, sql_group_by_1.SQLGroupBy, fields, _1.DatabaseConnection, _1.SQLHints);
|
|
6520
6520
|
const permSingle = (0, combi_1.per)(_1.SQLFrom, (0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList), where, _1.SQLClient, bypass, sql_group_by_1.SQLGroupBy, fields, _1.DatabaseConnection, _1.SQLHints);
|
|
@@ -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));
|
|
@@ -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
|
}
|
|
@@ -53822,7 +53845,7 @@ class Registry {
|
|
|
53822
53845
|
}
|
|
53823
53846
|
static abaplintVersion() {
|
|
53824
53847
|
// magic, see build script "version.sh"
|
|
53825
|
-
return "2.113.
|
|
53848
|
+
return "2.113.185";
|
|
53826
53849
|
}
|
|
53827
53850
|
getDDICReferences() {
|
|
53828
53851
|
return this.ddicReferences;
|
|
@@ -74840,7 +74863,9 @@ ENDFORM.`,
|
|
|
74840
74863
|
continue;
|
|
74841
74864
|
}
|
|
74842
74865
|
const prev = statements[i - 1];
|
|
74843
|
-
if (prev
|
|
74866
|
+
if (prev
|
|
74867
|
+
&& prev.get() instanceof Statements.Return
|
|
74868
|
+
&& prev.getChildren().length === 2) {
|
|
74844
74869
|
if (this.conf.allowEmpty === true && statementCounter === 2) {
|
|
74845
74870
|
continue;
|
|
74846
74871
|
}
|
|
@@ -74851,6 +74876,7 @@ ENDFORM.`,
|
|
|
74851
74876
|
const prevprev = statements[i - 2];
|
|
74852
74877
|
if (prev && prevprev
|
|
74853
74878
|
&& prevprev.get() instanceof Statements.Return
|
|
74879
|
+
&& prevprev.getChildren().length === 2
|
|
74854
74880
|
&& prev.get() instanceof Statements.EndIf) {
|
|
74855
74881
|
const fix = edit_helper_1.EditHelper.deleteStatement(file, prevprev);
|
|
74856
74882
|
issues.push(issue_1.Issue.atStatement(file, prevprev, message, this.getMetadata().key, this.getConfig().severity, fix));
|
|
@@ -78879,6 +78905,87 @@ exports.CondTranspiler = CondTranspiler;
|
|
|
78879
78905
|
|
|
78880
78906
|
/***/ }),
|
|
78881
78907
|
|
|
78908
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/cond_body.js":
|
|
78909
|
+
/*!******************************************************************************!*\
|
|
78910
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/cond_body.js ***!
|
|
78911
|
+
\******************************************************************************/
|
|
78912
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
78913
|
+
|
|
78914
|
+
"use strict";
|
|
78915
|
+
|
|
78916
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78917
|
+
exports.CondBodyTranspiler = void 0;
|
|
78918
|
+
const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
78919
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
78920
|
+
const type_name_or_infer_1 = __webpack_require__(/*! ./type_name_or_infer */ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js");
|
|
78921
|
+
const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
|
|
78922
|
+
const cond_1 = __webpack_require__(/*! ./cond */ "./node_modules/@abaplint/transpiler/build/src/expressions/cond.js");
|
|
78923
|
+
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/transpiler/build/src/expressions/source.js");
|
|
78924
|
+
class CondBodyTranspiler {
|
|
78925
|
+
transpile(typ, body, traversal) {
|
|
78926
|
+
if (!(typ.get() instanceof core_1.Expressions.TypeNameOrInfer)) {
|
|
78927
|
+
throw new Error("CondBodyTranspiler, Expected TypeNameOrInfer");
|
|
78928
|
+
}
|
|
78929
|
+
else if (body.findDirectExpression(core_1.Expressions.Let)) {
|
|
78930
|
+
throw new Error("CondBodyTranspiler, Let not supported, todo");
|
|
78931
|
+
}
|
|
78932
|
+
const whenThen = [];
|
|
78933
|
+
const expressions = [];
|
|
78934
|
+
for (const c of body.getChildren()) {
|
|
78935
|
+
if (c instanceof core_1.Nodes.TokenNode) {
|
|
78936
|
+
if (c.concatTokens() === "ELSE") {
|
|
78937
|
+
break;
|
|
78938
|
+
}
|
|
78939
|
+
}
|
|
78940
|
+
else {
|
|
78941
|
+
expressions.push(c);
|
|
78942
|
+
}
|
|
78943
|
+
}
|
|
78944
|
+
for (let i = 0; i < expressions.length; i = i + 2) {
|
|
78945
|
+
whenThen.push({ when: expressions[i], then: expressions[i + 1] });
|
|
78946
|
+
}
|
|
78947
|
+
const type = new type_name_or_infer_1.TypeNameOrInfer().findType(typ, traversal);
|
|
78948
|
+
const target = transpile_types_1.TranspileTypes.toType(type);
|
|
78949
|
+
const ret = new chunk_1.Chunk();
|
|
78950
|
+
ret.appendString("(" + target + ".set(");
|
|
78951
|
+
ret.appendString("await (async () => {\n");
|
|
78952
|
+
for (const { when, then } of whenThen) {
|
|
78953
|
+
let condition = "";
|
|
78954
|
+
if (when.get() instanceof core_1.Expressions.Cond) {
|
|
78955
|
+
condition = new cond_1.CondTranspiler().transpile(when, traversal).getCode();
|
|
78956
|
+
}
|
|
78957
|
+
else {
|
|
78958
|
+
throw new Error("CondBodyTranspiler, Expected Cond, todo, " + when.get().constructor.name);
|
|
78959
|
+
}
|
|
78960
|
+
let value = "";
|
|
78961
|
+
if (then.get() instanceof core_1.Expressions.Source) {
|
|
78962
|
+
value = new source_1.SourceTranspiler().transpile(then, traversal).getCode();
|
|
78963
|
+
}
|
|
78964
|
+
else {
|
|
78965
|
+
throw new Error("CondBodyTranspiler, Expected Source, todo, " + then.get().constructor.name);
|
|
78966
|
+
}
|
|
78967
|
+
ret.appendString(`if (${condition}) { return ${value}; }\n`);
|
|
78968
|
+
}
|
|
78969
|
+
const els = body.findExpressionAfterToken("ELSE");
|
|
78970
|
+
if (els) {
|
|
78971
|
+
if (!(els.get() instanceof core_1.Expressions.Source)) {
|
|
78972
|
+
throw new Error("CondBodyTranspiler, Expected Source, todo, " + els.get().constructor.name);
|
|
78973
|
+
}
|
|
78974
|
+
const value = new source_1.SourceTranspiler().transpile(els, traversal).getCode();
|
|
78975
|
+
ret.appendString(`return ${value};\n`);
|
|
78976
|
+
}
|
|
78977
|
+
else {
|
|
78978
|
+
ret.appendString(`return ${target};\n`);
|
|
78979
|
+
}
|
|
78980
|
+
ret.appendString("})()))");
|
|
78981
|
+
return ret;
|
|
78982
|
+
}
|
|
78983
|
+
}
|
|
78984
|
+
exports.CondBodyTranspiler = CondBodyTranspiler;
|
|
78985
|
+
//# sourceMappingURL=cond_body.js.map
|
|
78986
|
+
|
|
78987
|
+
/***/ }),
|
|
78988
|
+
|
|
78882
78989
|
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/cond_sub.js":
|
|
78883
78990
|
/*!*****************************************************************************!*\
|
|
78884
78991
|
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/cond_sub.js ***!
|
|
@@ -79540,6 +79647,7 @@ __exportStar(__webpack_require__(/*! ./let */ "./node_modules/@abaplint/transpil
|
|
|
79540
79647
|
__exportStar(__webpack_require__(/*! ./message_number */ "./node_modules/@abaplint/transpiler/build/src/expressions/message_number.js"), exports);
|
|
79541
79648
|
__exportStar(__webpack_require__(/*! ./method_call_body */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_body.js"), exports);
|
|
79542
79649
|
__exportStar(__webpack_require__(/*! ./method_call_chain */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_chain.js"), exports);
|
|
79650
|
+
__exportStar(__webpack_require__(/*! ./cond_body */ "./node_modules/@abaplint/transpiler/build/src/expressions/cond_body.js"), exports);
|
|
79543
79651
|
__exportStar(__webpack_require__(/*! ./method_call_param */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_param.js"), exports);
|
|
79544
79652
|
__exportStar(__webpack_require__(/*! ./new_object */ "./node_modules/@abaplint/transpiler/build/src/expressions/new_object.js"), exports);
|
|
79545
79653
|
__exportStar(__webpack_require__(/*! ./method_call */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call.js"), exports);
|
|
@@ -80495,6 +80603,9 @@ class SourceTranspiler {
|
|
|
80495
80603
|
else if (c.get() instanceof core_1.Expressions.CorrespondingBody) {
|
|
80496
80604
|
continue;
|
|
80497
80605
|
}
|
|
80606
|
+
else if (c.get() instanceof core_1.Expressions.CondBody) {
|
|
80607
|
+
continue;
|
|
80608
|
+
}
|
|
80498
80609
|
else {
|
|
80499
80610
|
ret.appendString("SourceUnknown$" + c.get().constructor.name);
|
|
80500
80611
|
}
|
|
@@ -80539,6 +80650,17 @@ class SourceTranspiler {
|
|
|
80539
80650
|
}
|
|
80540
80651
|
ret.appendChunk(new corresponding_body_1.CorrespondingBodyTranspiler().transpile(typ, correspondingBody, traversal));
|
|
80541
80652
|
}
|
|
80653
|
+
else if (c instanceof core_1.Nodes.TokenNode && c.getFirstToken().getStr().toUpperCase() === "COND") {
|
|
80654
|
+
const typ = node.findDirectExpression(core_1.Expressions.TypeNameOrInfer);
|
|
80655
|
+
if (typ === undefined) {
|
|
80656
|
+
throw new Error("TypeNameOrInfer not found in CondBody");
|
|
80657
|
+
}
|
|
80658
|
+
const condBody = node.findDirectExpression(core_1.Expressions.CondBody);
|
|
80659
|
+
if (condBody === undefined) {
|
|
80660
|
+
throw new Error("CondBody not found");
|
|
80661
|
+
}
|
|
80662
|
+
ret.appendChunk(new _1.CondBodyTranspiler().transpile(typ, condBody, traversal));
|
|
80663
|
+
}
|
|
80542
80664
|
else if (c instanceof core_1.Nodes.TokenNode && c.getFirstToken().getStr().toUpperCase() === "REF") {
|
|
80543
80665
|
const infer = node.findDirectExpression(core_1.Expressions.TypeNameOrInfer);
|
|
80544
80666
|
if (infer?.concatTokens() !== "#") {
|
|
@@ -102905,12 +103027,8 @@ function writeObjects(outputFiles, config, outputFolder, files) {
|
|
|
102905
103027
|
fs.writeFileSync(outputFolder + path.sep + output.filename, contents);
|
|
102906
103028
|
}
|
|
102907
103029
|
}
|
|
102908
|
-
async function
|
|
102909
|
-
console.log("Transpiler CLI");
|
|
102910
|
-
const config = config_1.TranspilerConfig.find(process.argv[2]);
|
|
103030
|
+
async function build(config, files) {
|
|
102911
103031
|
const libFiles = await loadLib(config);
|
|
102912
|
-
const files = await file_operations_1.FileOperations.loadFiles(config);
|
|
102913
|
-
console.log("\nBuilding");
|
|
102914
103032
|
const t = new Transpiler.Transpiler(config.options);
|
|
102915
103033
|
const reg = new abaplint.Registry();
|
|
102916
103034
|
for (const f of files) {
|
|
@@ -102921,6 +103039,14 @@ async function run() {
|
|
|
102921
103039
|
}
|
|
102922
103040
|
reg.parse();
|
|
102923
103041
|
const output = await t.run(reg, new Progress());
|
|
103042
|
+
return output;
|
|
103043
|
+
}
|
|
103044
|
+
async function run() {
|
|
103045
|
+
console.log("Transpiler CLI");
|
|
103046
|
+
const config = config_1.TranspilerConfig.find(process.argv[2]);
|
|
103047
|
+
const files = await file_operations_1.FileOperations.loadFiles(config);
|
|
103048
|
+
console.log("\nBuilding");
|
|
103049
|
+
const output = await build(config, files);
|
|
102924
103050
|
console.log("\nOutput");
|
|
102925
103051
|
const outputFolder = config.output_folder;
|
|
102926
103052
|
if (!fs.existsSync(outputFolder)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.47",
|
|
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.185",
|
|
31
|
+
"@abaplint/transpiler": "^2.11.47",
|
|
32
32
|
"@types/glob": "^8.1.0",
|
|
33
33
|
"@types/node": "^24.3.0",
|
|
34
34
|
"@types/progress": "^2.0.7",
|