@abaplint/transpiler-cli 2.13.72 → 2.13.74
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 +33 -8
- package/package.json +2 -2
package/build/bundle.js
CHANGED
|
@@ -104760,7 +104760,11 @@ class FieldLengthTranspiler {
|
|
|
104760
104760
|
}
|
|
104761
104761
|
else if (c instanceof core_1.Nodes.TokenNode) {
|
|
104762
104762
|
if (c.get() instanceof core_1.Tokens.Identifier) {
|
|
104763
|
-
|
|
104763
|
+
let value = c.getFirstToken().getStr();
|
|
104764
|
+
if (/^0+\d+$/.test(value)) {
|
|
104765
|
+
value = value.replace(/^0+/, "") || "0";
|
|
104766
|
+
}
|
|
104767
|
+
ret += value;
|
|
104764
104768
|
}
|
|
104765
104769
|
}
|
|
104766
104770
|
}
|
|
@@ -104796,7 +104800,11 @@ class FieldOffsetTranspiler {
|
|
|
104796
104800
|
}
|
|
104797
104801
|
else if (c instanceof core_1.Nodes.TokenNode) {
|
|
104798
104802
|
if (c.get() instanceof core_1.Tokens.Identifier) {
|
|
104799
|
-
|
|
104803
|
+
let value = c.getFirstToken().getStr().toLowerCase();
|
|
104804
|
+
if (/^0+\d+$/.test(value)) {
|
|
104805
|
+
value = value.replace(/^0+/, "") || "0";
|
|
104806
|
+
}
|
|
104807
|
+
ret += value;
|
|
104800
104808
|
}
|
|
104801
104809
|
}
|
|
104802
104810
|
}
|
|
@@ -115711,9 +115719,11 @@ class LoopTranspiler {
|
|
|
115711
115719
|
unique = "";
|
|
115712
115720
|
injectFrom = undefined;
|
|
115713
115721
|
skipInto = undefined;
|
|
115722
|
+
atLast = undefined;
|
|
115714
115723
|
constructor(options) {
|
|
115715
115724
|
this.injectFrom = options?.injectFrom;
|
|
115716
115725
|
this.skipInto = options?.skipInto;
|
|
115726
|
+
this.atLast = options?.atLast;
|
|
115717
115727
|
}
|
|
115718
115728
|
getTarget() {
|
|
115719
115729
|
return this.unique;
|
|
@@ -115811,6 +115821,9 @@ class LoopTranspiler {
|
|
|
115811
115821
|
}
|
|
115812
115822
|
extra.push(`dynamicWhere: {condition: ${code}, evaluate: (name) => {try { return eval(name);} catch {}}}`);
|
|
115813
115823
|
}
|
|
115824
|
+
if (this.atLast !== undefined) {
|
|
115825
|
+
extra.push(`atLast: (last) => { ${this.atLast} = last; }`);
|
|
115826
|
+
}
|
|
115814
115827
|
const topEquals = {};
|
|
115815
115828
|
for (const compare of whereNode?.findDirectExpressions(abaplint.Expressions.ComponentCompare) || []) {
|
|
115816
115829
|
const op = compare.findDirectExpression(abaplint.Expressions.CompareOperator)?.concatTokens().toUpperCase();
|
|
@@ -121588,12 +121601,14 @@ const at_last_1 = __webpack_require__(/*! ./at_last */ "./node_modules/@abaplint
|
|
|
121588
121601
|
const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
|
|
121589
121602
|
const statements_1 = __webpack_require__(/*! ../statements */ "./node_modules/@abaplint/transpiler/build/src/statements/index.js");
|
|
121590
121603
|
const at_1 = __webpack_require__(/*! ./at */ "./node_modules/@abaplint/transpiler/build/src/structures/at.js");
|
|
121604
|
+
const inline_1 = __webpack_require__(/*! ../inline */ "./node_modules/@abaplint/transpiler/build/src/inline.js");
|
|
121591
121605
|
class LoopTranspiler {
|
|
121592
121606
|
transpile(node, traversal) {
|
|
121593
121607
|
const ret = new chunk_1.Chunk();
|
|
121594
121608
|
let pre = "";
|
|
121595
121609
|
let atFirst = undefined;
|
|
121596
121610
|
let atLast = undefined;
|
|
121611
|
+
let atLastFlag = "";
|
|
121597
121612
|
let loopStatement = undefined;
|
|
121598
121613
|
let previous = "";
|
|
121599
121614
|
let tabix = "";
|
|
@@ -121605,6 +121620,18 @@ class LoopTranspiler {
|
|
|
121605
121620
|
break;
|
|
121606
121621
|
}
|
|
121607
121622
|
}
|
|
121623
|
+
const hasAtLast = (node.findDirectStructure(abaplint.Structures.Body)
|
|
121624
|
+
?.findDirectStructures(abaplint.Structures.Normal) || [])
|
|
121625
|
+
.some(n => n.findDirectStructure(abaplint.Structures.AtLast) !== undefined);
|
|
121626
|
+
const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
|
|
121627
|
+
if (scope?.getIdentifier().stype === abaplint.ScopeType.Program
|
|
121628
|
+
|| scope?.getIdentifier().stype === abaplint.ScopeType.SelectionEvent) {
|
|
121629
|
+
ret.appendString(inline_1.InlineDeclarations.buildDeclarations(node, traversal));
|
|
121630
|
+
}
|
|
121631
|
+
if (hasAtLast) {
|
|
121632
|
+
atLastFlag = unique_identifier_1.UniqueIdentifier.get();
|
|
121633
|
+
ret.appendString(`let ${atLastFlag} = false;\n`);
|
|
121634
|
+
}
|
|
121608
121635
|
if (node.findDirectStatement(abaplint.Statements.Loop)?.findDirectTokenByText("GROUP") !== undefined) {
|
|
121609
121636
|
return new chunk_1.Chunk(`throw new Error("transpiler todo, GROUP BY");`);
|
|
121610
121637
|
}
|
|
@@ -121623,6 +121650,9 @@ class LoopTranspiler {
|
|
|
121623
121650
|
}
|
|
121624
121651
|
else if (n instanceof abaplint.Nodes.StructureNode && n.get() instanceof abaplint.Structures.AtLast) {
|
|
121625
121652
|
atLast = new at_last_1.AtLastTranspiler().transpile(n, traversal);
|
|
121653
|
+
ret.appendString(`if (${atLastFlag}) {\n`);
|
|
121654
|
+
ret.appendChunk(atLast);
|
|
121655
|
+
ret.appendString("}\n");
|
|
121626
121656
|
}
|
|
121627
121657
|
else if (n instanceof abaplint.Nodes.StructureNode && n.get() instanceof abaplint.Structures.At) {
|
|
121628
121658
|
ret.appendChunk(new at_1.AtTranspiler().transpile(n, traversal, previous, loopTarget, tabix, loopStatement));
|
|
@@ -121640,7 +121670,7 @@ class LoopTranspiler {
|
|
|
121640
121670
|
ret.appendString(`let ${previous} = undefined;\n`);
|
|
121641
121671
|
ret.appendString(`let ${tabix} = undefined;\n`);
|
|
121642
121672
|
}
|
|
121643
|
-
const loop = new statements_1.LoopTranspiler();
|
|
121673
|
+
const loop = new statements_1.LoopTranspiler({ atLast: atLastFlag || undefined });
|
|
121644
121674
|
// LoopStatementTranspiler maps its own head, so no ensureStartMapping needed here
|
|
121645
121675
|
ret.appendChunk(loop.transpile(c, traversal));
|
|
121646
121676
|
ret.appendString("\n");
|
|
@@ -121665,11 +121695,6 @@ class LoopTranspiler {
|
|
|
121665
121695
|
atted.appendString(pre);
|
|
121666
121696
|
}
|
|
121667
121697
|
atted.appendChunk(ret);
|
|
121668
|
-
if (atLast) {
|
|
121669
|
-
atted.appendString("if (abap.builtin.sy.get().subrc.get() === 0) {\n");
|
|
121670
|
-
atted.appendChunk(atLast);
|
|
121671
|
-
atted.appendString("}\n");
|
|
121672
|
-
}
|
|
121673
121698
|
return atted;
|
|
121674
121699
|
}
|
|
121675
121700
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.74",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@abaplint/core": "^2.120.42",
|
|
31
|
-
"@abaplint/transpiler": "^2.13.
|
|
31
|
+
"@abaplint/transpiler": "^2.13.74",
|
|
32
32
|
"@types/glob": "^8.1.0",
|
|
33
33
|
"@types/node": "^24.13.3",
|
|
34
34
|
"@types/progress": "^2.0.7",
|