@abaplint/transpiler-cli 2.11.39 → 2.11.40

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 +43 -4
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -4379,7 +4379,7 @@ class For extends combi_1.Expression {
4379
4379
  const t = (0, combi_1.alt)(_1.TargetField, _1.TargetFieldSymbol);
4380
4380
  const groups = (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.seq)("GROUPS", t, "OF", t, "IN", _1.Source, (0, combi_1.optPrio)(groupBy)));
4381
4381
  const f = (0, combi_1.seq)("FOR", (0, combi_1.alt)(itera, inn, groups), (0, combi_1.optPrio)(_1.Let));
4382
- return (0, combi_1.ver)(version_1.Version.v740sp05, f);
4382
+ return (0, combi_1.ver)(version_1.Version.v740sp05, f, version_1.Version.OpenABAP);
4383
4383
  }
4384
4384
  }
4385
4385
  exports.For = For;
@@ -53791,7 +53791,7 @@ class Registry {
53791
53791
  }
53792
53792
  static abaplintVersion() {
53793
53793
  // magic, see build script "version.sh"
53794
- return "2.113.180";
53794
+ return "2.113.181";
53795
53795
  }
53796
53796
  getDDICReferences() {
53797
53797
  return this.ddicReferences;
@@ -81626,6 +81626,8 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
81626
81626
  const type_name_or_infer_1 = __webpack_require__(/*! ./type_name_or_infer */ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js");
81627
81627
  const value_body_line_1 = __webpack_require__(/*! ./value_body_line */ "./node_modules/@abaplint/transpiler/build/src/expressions/value_body_line.js");
81628
81628
  const field_assignment_1 = __webpack_require__(/*! ./field_assignment */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_assignment.js");
81629
+ const statements_1 = __webpack_require__(/*! ../statements */ "./node_modules/@abaplint/transpiler/build/src/statements/index.js");
81630
+ const source_field_symbol_1 = __webpack_require__(/*! ./source_field_symbol */ "./node_modules/@abaplint/transpiler/build/src/expressions/source_field_symbol.js");
81629
81631
  class ValueBodyTranspiler {
81630
81632
  transpile(typ, body, traversal) {
81631
81633
  if (!(typ.get() instanceof core_1.Expressions.TypeNameOrInfer)) {
@@ -81633,8 +81635,9 @@ class ValueBodyTranspiler {
81633
81635
  }
81634
81636
  let ret = new chunk_1.Chunk().appendString(new type_name_or_infer_1.TypeNameOrInfer().transpile(typ, traversal).getCode());
81635
81637
  const context = new type_name_or_infer_1.TypeNameOrInfer().findType(typ, traversal);
81636
- const hasLines = body.findDirectExpression(core_1.Expressions.ValueBodyLine) !== undefined;
81638
+ let post = "";
81637
81639
  let extraFields = "";
81640
+ const hasLines = body.findDirectExpression(core_1.Expressions.ValueBodyLine) !== undefined;
81638
81641
  for (const child of body.getChildren()) {
81639
81642
  if (child.get() instanceof core_1.Expressions.FieldAssignment && child instanceof core_1.Nodes.ExpressionNode) {
81640
81643
  const transpiled = new field_assignment_1.FieldAssignmentTranspiler().transpile(child, traversal).getCode();
@@ -81660,11 +81663,47 @@ class ValueBodyTranspiler {
81660
81663
  const source = traversal.traverse(child);
81661
81664
  ret.appendString(".set(" + source.getCode() + ".clone())");
81662
81665
  }
81666
+ else if (child.get() instanceof core_1.Expressions.For && child instanceof core_1.Nodes.ExpressionNode) {
81667
+ if (child.getChildren().length !== 2) {
81668
+ throw new Error("ValueBody FOR todo, num");
81669
+ }
81670
+ const loop = child.findDirectExpression(core_1.Expressions.InlineLoopDefinition);
81671
+ if (loop === undefined) {
81672
+ throw new Error("ValueBody FOR todo");
81673
+ }
81674
+ else if (loop.getChildren().length !== 3) {
81675
+ throw new Error("ValueBody FOR todo, num loop");
81676
+ }
81677
+ let targetDeclare = "";
81678
+ let targetAction = "";
81679
+ const fs = loop.findDirectExpression(core_1.Expressions.TargetFieldSymbol);
81680
+ if (fs) {
81681
+ targetDeclare = new statements_1.FieldSymbolTranspiler().transpile(fs, traversal).getCode();
81682
+ const targetName = new source_field_symbol_1.SourceFieldSymbolTranspiler().transpile(fs, traversal).getCode();
81683
+ targetAction = `${targetName}.assign(unique1);`;
81684
+ }
81685
+ else {
81686
+ const field = traversal.traverse(loop.findDirectExpression(core_1.Expressions.TargetField));
81687
+ if (field === undefined) {
81688
+ throw new Error("ValueBody FOR empty field todo");
81689
+ }
81690
+ targetAction = `const ${field.getCode()} = unique1.clone();`;
81691
+ }
81692
+ const source = traversal.traverse(loop.findDirectExpression(core_1.Expressions.Source)).getCode();
81693
+ const val = new type_name_or_infer_1.TypeNameOrInfer().transpile(typ, traversal).getCode();
81694
+ ret = new chunk_1.Chunk().appendString(`await (async () => {
81695
+ ${targetDeclare}
81696
+ const VAL = ${val};
81697
+ for await (const unique1 of abap.statements.loop(${source})) {
81698
+ ${targetAction}
81699
+ VAL`);
81700
+ post = ";\n}\nreturn VAL;\n})()";
81701
+ }
81663
81702
  else {
81664
81703
  throw new Error("ValueBodyTranspiler, unknown " + child.get().constructor.name + " \"" + child.concatTokens()) + "\"";
81665
81704
  }
81666
81705
  }
81667
- return ret;
81706
+ return ret.appendString(post);
81668
81707
  }
81669
81708
  }
81670
81709
  exports.ValueBodyTranspiler = ValueBodyTranspiler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.11.39",
3
+ "version": "2.11.40",
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.180",
31
- "@abaplint/transpiler": "^2.11.39",
30
+ "@abaplint/core": "^2.113.181",
31
+ "@abaplint/transpiler": "^2.11.40",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.3.0",
34
34
  "@types/progress": "^2.0.7",