@abaplint/transpiler-cli 2.5.46 → 2.5.48
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 +106 -25
- package/package.json +4 -4
package/build/bundle.js
CHANGED
|
@@ -46211,7 +46211,7 @@ class Registry {
|
|
|
46211
46211
|
}
|
|
46212
46212
|
static abaplintVersion() {
|
|
46213
46213
|
// magic, see build script "version.sh"
|
|
46214
|
-
return "2.95.
|
|
46214
|
+
return "2.95.47";
|
|
46215
46215
|
}
|
|
46216
46216
|
getDDICReferences() {
|
|
46217
46217
|
return this.references;
|
|
@@ -50994,14 +50994,16 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
50994
50994
|
// actively editing the files
|
|
50995
50995
|
continue;
|
|
50996
50996
|
}
|
|
50997
|
+
if (highSyntax === undefined) {
|
|
50998
|
+
highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();
|
|
50999
|
+
}
|
|
51000
|
+
let containsUnknown = false;
|
|
50997
51001
|
for (let i = 0; i < lowStatements.length; i++) {
|
|
50998
51002
|
const low = lowStatements[i];
|
|
50999
51003
|
const high = highStatements[i];
|
|
51000
51004
|
if ((low.get() instanceof _statement_1.Unknown && !(high.get() instanceof _statement_1.Unknown))
|
|
51001
51005
|
|| high.findFirstExpression(Expressions.InlineData)) {
|
|
51002
|
-
|
|
51003
|
-
highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();
|
|
51004
|
-
}
|
|
51006
|
+
containsUnknown = true;
|
|
51005
51007
|
try {
|
|
51006
51008
|
const issue = this.checkStatement(low, high, lowFile, highSyntax, highFile);
|
|
51007
51009
|
if (issue) {
|
|
@@ -51019,6 +51021,18 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
51019
51021
|
}
|
|
51020
51022
|
}
|
|
51021
51023
|
}
|
|
51024
|
+
if (ret.length === 0 && containsUnknown) {
|
|
51025
|
+
// this is a hack in order not to change too many unit tests
|
|
51026
|
+
for (let i = 0; i < lowStatements.length; i++) {
|
|
51027
|
+
const high = highStatements[i];
|
|
51028
|
+
if (high.get() instanceof Statements.Data) {
|
|
51029
|
+
const issue = this.anonymousTableType(high, lowFile, highSyntax);
|
|
51030
|
+
if (issue) {
|
|
51031
|
+
ret.push(issue);
|
|
51032
|
+
}
|
|
51033
|
+
}
|
|
51034
|
+
}
|
|
51035
|
+
}
|
|
51022
51036
|
}
|
|
51023
51037
|
return ret;
|
|
51024
51038
|
}
|
|
@@ -51049,7 +51063,12 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
51049
51063
|
if (low.getFirstToken().getStart() instanceof position_1.VirtualPosition) {
|
|
51050
51064
|
return undefined;
|
|
51051
51065
|
}
|
|
51052
|
-
|
|
51066
|
+
// downport XSDBOOL() early, as it is valid 702 syntax
|
|
51067
|
+
let found = this.replaceXsdBool(high, lowFile, highSyntax);
|
|
51068
|
+
if (found) {
|
|
51069
|
+
return found;
|
|
51070
|
+
}
|
|
51071
|
+
found = this.downportEnum(low, high, lowFile, highSyntax, highFile);
|
|
51053
51072
|
if (found) {
|
|
51054
51073
|
return found;
|
|
51055
51074
|
}
|
|
@@ -51191,10 +51210,6 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
51191
51210
|
if (found) {
|
|
51192
51211
|
return found;
|
|
51193
51212
|
}
|
|
51194
|
-
found = this.replaceXsdBool(high, lowFile, highSyntax);
|
|
51195
|
-
if (found) {
|
|
51196
|
-
return found;
|
|
51197
|
-
}
|
|
51198
51213
|
found = this.replaceLineFunctions(high, lowFile, highSyntax, highFile);
|
|
51199
51214
|
if (found) {
|
|
51200
51215
|
return found;
|
|
@@ -51432,6 +51447,22 @@ ${indentation}`);
|
|
|
51432
51447
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
51433
51448
|
return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), "Outline SELECT @DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
51434
51449
|
}
|
|
51450
|
+
// the anonymous type minght be used in inferred type statements, define it so it can be referred
|
|
51451
|
+
anonymousTableType(high, lowFile, highSyntax) {
|
|
51452
|
+
if (!(high.get() instanceof Statements.Data)) {
|
|
51453
|
+
return undefined;
|
|
51454
|
+
}
|
|
51455
|
+
const tt = high.findFirstExpression(Expressions.TypeTable);
|
|
51456
|
+
if (tt === undefined) {
|
|
51457
|
+
return undefined;
|
|
51458
|
+
}
|
|
51459
|
+
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
51460
|
+
const code = `TYPES ${uniqueName} ${tt.concatTokens()}.\n`;
|
|
51461
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), code);
|
|
51462
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, tt.getFirstToken().getStart(), tt.getLastToken().getEnd(), "TYPE " + uniqueName);
|
|
51463
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
51464
|
+
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Add type for table definition", this.getMetadata().key, this.conf.severity, fix);
|
|
51465
|
+
}
|
|
51435
51466
|
downportMessage(high, lowFile, highSyntax) {
|
|
51436
51467
|
var _a, _b;
|
|
51437
51468
|
if (!(high.get() instanceof Statements.Message)) {
|
|
@@ -52624,7 +52655,12 @@ ${indentation} output = ${topTarget}.`;
|
|
|
52624
52655
|
const s = (_a = init.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
52625
52656
|
const t = (_b = init.findFirstExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
52626
52657
|
if (s) {
|
|
52627
|
-
|
|
52658
|
+
if (s.toUpperCase().startsWith("VALUE #")) {
|
|
52659
|
+
body += indentation + `DATA(${name}) = ${s.replace("#", type)}.\n`;
|
|
52660
|
+
}
|
|
52661
|
+
else {
|
|
52662
|
+
body += indentation + `DATA(${name}) = ${s}.\n`;
|
|
52663
|
+
}
|
|
52628
52664
|
}
|
|
52629
52665
|
else {
|
|
52630
52666
|
body += indentation + `DATA ${name} TYPE ${t}.\n`;
|
|
@@ -52679,6 +52715,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
52679
52715
|
if (firstToken.getStr().toUpperCase() !== "VALUE") {
|
|
52680
52716
|
continue;
|
|
52681
52717
|
}
|
|
52718
|
+
const valueBody = s.findDirectExpression(Expressions.ValueBody);
|
|
52682
52719
|
let type = this.findType(s, lowFile, highSyntax);
|
|
52683
52720
|
if (type === undefined) {
|
|
52684
52721
|
if (high.get() instanceof Statements.Move && high.findDirectExpression(Expressions.Source) === s) {
|
|
@@ -52691,7 +52728,6 @@ ${indentation} output = ${topTarget}.`;
|
|
|
52691
52728
|
else {
|
|
52692
52729
|
type = "TYPE " + type;
|
|
52693
52730
|
}
|
|
52694
|
-
const valueBody = s.findDirectExpression(Expressions.ValueBody);
|
|
52695
52731
|
const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
|
|
52696
52732
|
let indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
52697
52733
|
let body = "";
|
|
@@ -52704,6 +52740,11 @@ ${indentation} output = ${topTarget}.`;
|
|
|
52704
52740
|
let added = false;
|
|
52705
52741
|
let data = "";
|
|
52706
52742
|
let previous = undefined;
|
|
52743
|
+
if ((valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.ValueBodyLine)) !== undefined) {
|
|
52744
|
+
structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
|
|
52745
|
+
const extra = (valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.For)) ? " " : "";
|
|
52746
|
+
data = indentation + extra + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\n`;
|
|
52747
|
+
}
|
|
52707
52748
|
for (const a of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {
|
|
52708
52749
|
if (a.get() instanceof Expressions.FieldAssignment) {
|
|
52709
52750
|
if (added === false) {
|
|
@@ -52730,10 +52771,6 @@ ${indentation} output = ${topTarget}.`;
|
|
|
52730
52771
|
if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.ValueBodyLine) {
|
|
52731
52772
|
let skip = false;
|
|
52732
52773
|
for (const b of (a === null || a === void 0 ? void 0 : a.getChildren()) || []) {
|
|
52733
|
-
if (b.concatTokens() === "(" && added === false) {
|
|
52734
|
-
structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
|
|
52735
|
-
data = indentation + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\n`;
|
|
52736
|
-
}
|
|
52737
52774
|
if (b.get() instanceof Expressions.FieldAssignment) {
|
|
52738
52775
|
if (added === false) {
|
|
52739
52776
|
body += data;
|
|
@@ -68234,6 +68271,7 @@ __exportStar(__webpack_require__(/*! ./source_field_symbol */ "./node_modules/@a
|
|
|
68234
68271
|
__exportStar(__webpack_require__(/*! ./source_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field.js"), exports);
|
|
68235
68272
|
__exportStar(__webpack_require__(/*! ./source */ "./node_modules/@abaplint/transpiler/build/src/expressions/source.js"), exports);
|
|
68236
68273
|
__exportStar(__webpack_require__(/*! ./sql_cond */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_cond.js"), exports);
|
|
68274
|
+
__exportStar(__webpack_require__(/*! ./sql_field */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field.js"), exports);
|
|
68237
68275
|
__exportStar(__webpack_require__(/*! ./sql_from */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from.js"), exports);
|
|
68238
68276
|
__exportStar(__webpack_require__(/*! ./sql_join */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_join.js"), exports);
|
|
68239
68277
|
__exportStar(__webpack_require__(/*! ./sql_source_simple */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_source_simple.js"), exports);
|
|
@@ -69175,6 +69213,33 @@ exports.SQLCondTranspiler = SQLCondTranspiler;
|
|
|
69175
69213
|
|
|
69176
69214
|
/***/ }),
|
|
69177
69215
|
|
|
69216
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field.js":
|
|
69217
|
+
/*!******************************************************************************!*\
|
|
69218
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/sql_field.js ***!
|
|
69219
|
+
\******************************************************************************/
|
|
69220
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
69221
|
+
|
|
69222
|
+
"use strict";
|
|
69223
|
+
|
|
69224
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
69225
|
+
exports.SQLField = void 0;
|
|
69226
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
69227
|
+
class SQLField {
|
|
69228
|
+
transpile(node, _traversal) {
|
|
69229
|
+
const chunk = new chunk_1.Chunk();
|
|
69230
|
+
let concat = node.concatTokens();
|
|
69231
|
+
if (concat.includes("~") && concat.split("~")[0].includes("/")) {
|
|
69232
|
+
concat = "'" + concat.replace("~", "'~");
|
|
69233
|
+
}
|
|
69234
|
+
chunk.appendString(concat);
|
|
69235
|
+
return chunk;
|
|
69236
|
+
}
|
|
69237
|
+
}
|
|
69238
|
+
exports.SQLField = SQLField;
|
|
69239
|
+
//# sourceMappingURL=sql_field.js.map
|
|
69240
|
+
|
|
69241
|
+
/***/ }),
|
|
69242
|
+
|
|
69178
69243
|
/***/ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from.js":
|
|
69179
69244
|
/*!*****************************************************************************!*\
|
|
69180
69245
|
!*** ./node_modules/@abaplint/transpiler/build/src/expressions/sql_from.js ***!
|
|
@@ -69193,6 +69258,7 @@ class SQLFromTranspiler {
|
|
|
69193
69258
|
const chunk = new chunk_1.Chunk();
|
|
69194
69259
|
for (const c of node.getChildren()) {
|
|
69195
69260
|
if (c instanceof abaplint.Nodes.TokenNode) {
|
|
69261
|
+
// keywords
|
|
69196
69262
|
chunk.appendString(c.concatTokens() + " ");
|
|
69197
69263
|
}
|
|
69198
69264
|
else if (c.get() instanceof abaplint.Expressions.SQLJoin) {
|
|
@@ -69200,7 +69266,15 @@ class SQLFromTranspiler {
|
|
|
69200
69266
|
chunk.appendString(" ");
|
|
69201
69267
|
}
|
|
69202
69268
|
else {
|
|
69203
|
-
|
|
69269
|
+
if (c.findFirstExpression(abaplint.Expressions.Dynamic)) {
|
|
69270
|
+
chunk.appendString(c.concatTokens() + " ");
|
|
69271
|
+
}
|
|
69272
|
+
else if (c.concatTokens().includes("/")) {
|
|
69273
|
+
chunk.appendString("'" + c.concatTokens() + "' ");
|
|
69274
|
+
}
|
|
69275
|
+
else {
|
|
69276
|
+
chunk.appendString(c.concatTokens() + " ");
|
|
69277
|
+
}
|
|
69204
69278
|
}
|
|
69205
69279
|
}
|
|
69206
69280
|
return chunk;
|
|
@@ -74600,14 +74674,17 @@ class SelectTranspiler {
|
|
|
74600
74674
|
let select = "SELECT ";
|
|
74601
74675
|
const fieldList = node.findFirstExpression(abaplint.Expressions.SQLFieldList)
|
|
74602
74676
|
|| node.findFirstExpression(abaplint.Expressions.SQLFieldListLoop);
|
|
74603
|
-
|
|
74604
|
-
|
|
74605
|
-
|
|
74606
|
-
|
|
74607
|
-
|
|
74608
|
-
|
|
74677
|
+
const fields = [];
|
|
74678
|
+
for (const f of (fieldList === null || fieldList === void 0 ? void 0 : fieldList.getChildren()) || []) {
|
|
74679
|
+
if (f instanceof abaplint.Nodes.ExpressionNode && f.get() instanceof abaplint.Expressions.SQLField) {
|
|
74680
|
+
const code = new expressions_1.SQLField().transpile(f, traversal).getCode();
|
|
74681
|
+
fields.push(code);
|
|
74682
|
+
}
|
|
74683
|
+
else {
|
|
74684
|
+
fields.push(f.concatTokens());
|
|
74685
|
+
}
|
|
74609
74686
|
}
|
|
74610
|
-
select += " ";
|
|
74687
|
+
select += fields.join(", ") + " ";
|
|
74611
74688
|
const from = node.findFirstExpression(abaplint.Expressions.SQLFrom);
|
|
74612
74689
|
if (from) {
|
|
74613
74690
|
select += new sql_from_1.SQLFromTranspiler().transpile(from, traversal).getCode();
|
|
@@ -74661,6 +74738,10 @@ class SelectTranspiler {
|
|
|
74661
74738
|
const faeTranspiled = new expressions_1.SQLSourceTranspiler().transpile(fn, traversal).getCode();
|
|
74662
74739
|
select = select.replace(new RegExp(" " + escapeRegExp(faeTranspiled), "g"), " " + unique);
|
|
74663
74740
|
select = select.replace(unique + ".get().table_line.get()", unique + ".get()"); // there can be only one?
|
|
74741
|
+
let by = `Object.keys(${target}.getRowType().get())`;
|
|
74742
|
+
if (keys.length > 0) {
|
|
74743
|
+
by = JSON.stringify(keys);
|
|
74744
|
+
}
|
|
74664
74745
|
const code = `if (${faeTranspiled}.array().length === 0) {
|
|
74665
74746
|
throw "FAE, todo, empty table";
|
|
74666
74747
|
} else {
|
|
@@ -74668,8 +74749,8 @@ class SelectTranspiler {
|
|
|
74668
74749
|
for await (const ${unique} of abap.statements.loop(${faeTranspiled})) {
|
|
74669
74750
|
await abap.statements.select(${target}, {select: "${select.trim()}"${extra}}, {appending: true});
|
|
74670
74751
|
}
|
|
74671
|
-
abap.statements.sort(${target}, {by:
|
|
74672
|
-
await abap.statements.deleteInternal(${target}, {adjacent: true});
|
|
74752
|
+
abap.statements.sort(${target}, {by: ${by}.map(k => { return {component: k}; })});
|
|
74753
|
+
await abap.statements.deleteInternal(${target}, {adjacent: true, by: ${by}});
|
|
74673
74754
|
abap.builtin.sy.get().dbcnt.set(${target}.array().length);
|
|
74674
74755
|
}`;
|
|
74675
74756
|
return new chunk_1.Chunk().append(code, node, traversal);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.48",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abap_transpile": "./abap_transpile"
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"author": "abaplint",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@abaplint/transpiler": "^2.5.
|
|
28
|
+
"@abaplint/transpiler": "^2.5.48",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "=7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|
|
32
|
-
"@types/node": "^18.15.
|
|
33
|
-
"@abaplint/core": "^2.95.
|
|
32
|
+
"@types/node": "^18.15.5",
|
|
33
|
+
"@abaplint/core": "^2.95.47",
|
|
34
34
|
"progress": "^2.0.3",
|
|
35
35
|
"webpack": "^5.76.2",
|
|
36
36
|
"webpack-cli": "^5.0.1",
|