@abaplint/transpiler-cli 2.13.72 → 2.13.73

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.
Files changed (2) hide show
  1. package/build/bundle.js +23 -6
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -115711,9 +115711,11 @@ class LoopTranspiler {
115711
115711
  unique = "";
115712
115712
  injectFrom = undefined;
115713
115713
  skipInto = undefined;
115714
+ atLast = undefined;
115714
115715
  constructor(options) {
115715
115716
  this.injectFrom = options?.injectFrom;
115716
115717
  this.skipInto = options?.skipInto;
115718
+ this.atLast = options?.atLast;
115717
115719
  }
115718
115720
  getTarget() {
115719
115721
  return this.unique;
@@ -115811,6 +115813,9 @@ class LoopTranspiler {
115811
115813
  }
115812
115814
  extra.push(`dynamicWhere: {condition: ${code}, evaluate: (name) => {try { return eval(name);} catch {}}}`);
115813
115815
  }
115816
+ if (this.atLast !== undefined) {
115817
+ extra.push(`atLast: (last) => { ${this.atLast} = last; }`);
115818
+ }
115814
115819
  const topEquals = {};
115815
115820
  for (const compare of whereNode?.findDirectExpressions(abaplint.Expressions.ComponentCompare) || []) {
115816
115821
  const op = compare.findDirectExpression(abaplint.Expressions.CompareOperator)?.concatTokens().toUpperCase();
@@ -121588,12 +121593,14 @@ const at_last_1 = __webpack_require__(/*! ./at_last */ "./node_modules/@abaplint
121588
121593
  const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
121589
121594
  const statements_1 = __webpack_require__(/*! ../statements */ "./node_modules/@abaplint/transpiler/build/src/statements/index.js");
121590
121595
  const at_1 = __webpack_require__(/*! ./at */ "./node_modules/@abaplint/transpiler/build/src/structures/at.js");
121596
+ const inline_1 = __webpack_require__(/*! ../inline */ "./node_modules/@abaplint/transpiler/build/src/inline.js");
121591
121597
  class LoopTranspiler {
121592
121598
  transpile(node, traversal) {
121593
121599
  const ret = new chunk_1.Chunk();
121594
121600
  let pre = "";
121595
121601
  let atFirst = undefined;
121596
121602
  let atLast = undefined;
121603
+ let atLastFlag = "";
121597
121604
  let loopStatement = undefined;
121598
121605
  let previous = "";
121599
121606
  let tabix = "";
@@ -121605,6 +121612,18 @@ class LoopTranspiler {
121605
121612
  break;
121606
121613
  }
121607
121614
  }
121615
+ const hasAtLast = (node.findDirectStructure(abaplint.Structures.Body)
121616
+ ?.findDirectStructures(abaplint.Structures.Normal) || [])
121617
+ .some(n => n.findDirectStructure(abaplint.Structures.AtLast) !== undefined);
121618
+ const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
121619
+ if (scope?.getIdentifier().stype === abaplint.ScopeType.Program
121620
+ || scope?.getIdentifier().stype === abaplint.ScopeType.SelectionEvent) {
121621
+ ret.appendString(inline_1.InlineDeclarations.buildDeclarations(node, traversal));
121622
+ }
121623
+ if (hasAtLast) {
121624
+ atLastFlag = unique_identifier_1.UniqueIdentifier.get();
121625
+ ret.appendString(`let ${atLastFlag} = false;\n`);
121626
+ }
121608
121627
  if (node.findDirectStatement(abaplint.Statements.Loop)?.findDirectTokenByText("GROUP") !== undefined) {
121609
121628
  return new chunk_1.Chunk(`throw new Error("transpiler todo, GROUP BY");`);
121610
121629
  }
@@ -121623,6 +121642,9 @@ class LoopTranspiler {
121623
121642
  }
121624
121643
  else if (n instanceof abaplint.Nodes.StructureNode && n.get() instanceof abaplint.Structures.AtLast) {
121625
121644
  atLast = new at_last_1.AtLastTranspiler().transpile(n, traversal);
121645
+ ret.appendString(`if (${atLastFlag}) {\n`);
121646
+ ret.appendChunk(atLast);
121647
+ ret.appendString("}\n");
121626
121648
  }
121627
121649
  else if (n instanceof abaplint.Nodes.StructureNode && n.get() instanceof abaplint.Structures.At) {
121628
121650
  ret.appendChunk(new at_1.AtTranspiler().transpile(n, traversal, previous, loopTarget, tabix, loopStatement));
@@ -121640,7 +121662,7 @@ class LoopTranspiler {
121640
121662
  ret.appendString(`let ${previous} = undefined;\n`);
121641
121663
  ret.appendString(`let ${tabix} = undefined;\n`);
121642
121664
  }
121643
- const loop = new statements_1.LoopTranspiler();
121665
+ const loop = new statements_1.LoopTranspiler({ atLast: atLastFlag || undefined });
121644
121666
  // LoopStatementTranspiler maps its own head, so no ensureStartMapping needed here
121645
121667
  ret.appendChunk(loop.transpile(c, traversal));
121646
121668
  ret.appendString("\n");
@@ -121665,11 +121687,6 @@ class LoopTranspiler {
121665
121687
  atted.appendString(pre);
121666
121688
  }
121667
121689
  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
121690
  return atted;
121674
121691
  }
121675
121692
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.13.72",
3
+ "version": "2.13.73",
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.72",
31
+ "@abaplint/transpiler": "^2.13.73",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.13.3",
34
34
  "@types/progress": "^2.0.7",