@abaplint/transpiler-cli 2.11.63 → 2.11.64

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 +15 -9
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -79368,8 +79368,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
79368
79368
  exports.FieldAssignmentTranspiler = void 0;
79369
79369
  const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
79370
79370
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
79371
+ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
79372
+ const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/transpiler/build/src/expressions/source.js");
79371
79373
  class FieldAssignmentTranspiler {
79372
- transpile(node, traversal) {
79374
+ transpile(node, traversal, context) {
79373
79375
  const ret = new chunk_1.Chunk();
79374
79376
  const field = node.findDirectExpression(core_1.Expressions.FieldSub);
79375
79377
  if (field === undefined) {
@@ -79379,7 +79381,11 @@ class FieldAssignmentTranspiler {
79379
79381
  if (source === undefined) {
79380
79382
  throw new Error("FieldAssignmentTranspiler, Expected Source");
79381
79383
  }
79382
- ret.appendString(`.setField("${field.concatTokens().toLowerCase()}", ${traversal.traverse(source).getCode()})`);
79384
+ if (context instanceof abaplint.BasicTypes.StructureType) {
79385
+ context = context.getComponentByName(field.concatTokens());
79386
+ }
79387
+ const sourc = new source_1.SourceTranspiler().transpile(source, traversal, context).getCode();
79388
+ ret.appendString(`.setField("${field.concatTokens().toLowerCase()}", ${sourc})`);
79383
79389
  return ret;
79384
79390
  }
79385
79391
  }
@@ -81628,7 +81634,7 @@ class StringTemplateSourceTranspiler {
81628
81634
  let post = ")";
81629
81635
  const formatting = node.findDirectExpression(core_1.Expressions.StringTemplateFormatting);
81630
81636
  if (formatting) {
81631
- const options = this.build(formatting, traversal, context);
81637
+ const options = this.build(formatting, traversal, context, node);
81632
81638
  if (options) {
81633
81639
  post = "," + options + ")";
81634
81640
  }
@@ -81640,7 +81646,7 @@ class StringTemplateSourceTranspiler {
81640
81646
  ret += pre + new _1.SourceTranspiler().transpile(c, traversal).getCode() + post;
81641
81647
  return new chunk_1.Chunk(ret);
81642
81648
  }
81643
- build(node, traversal, context) {
81649
+ build(node, traversal, context, _top) {
81644
81650
  let option = "";
81645
81651
  let count = 0;
81646
81652
  for (const c of node.getChildren()) {
@@ -81661,10 +81667,9 @@ class StringTemplateSourceTranspiler {
81661
81667
  }
81662
81668
  }
81663
81669
  if (option.startsWith(`"alpha":"in"`)) {
81664
- if (context === undefined) {
81665
- throw new Error("ALPHA = IN, context undefined");
81670
+ if (context !== undefined) {
81671
+ option += `, "alphaInContext": ` + transpile_types_1.TranspileTypes.toType(context);
81666
81672
  }
81667
- option += `, "alphaInContext": ` + transpile_types_1.TranspileTypes.toType(context);
81668
81673
  }
81669
81674
  if (option !== "") {
81670
81675
  return "{" + option + "}";
@@ -81956,7 +81961,7 @@ class ValueBodyTranspiler {
81956
81961
  const hasLines = body.findDirectExpression(core_1.Expressions.ValueBodyLine) !== undefined;
81957
81962
  for (const child of body.getChildren()) {
81958
81963
  if (child.get() instanceof core_1.Expressions.FieldAssignment && child instanceof core_1.Nodes.ExpressionNode) {
81959
- const transpiled = new field_assignment_1.FieldAssignmentTranspiler().transpile(child, traversal).getCode();
81964
+ const transpiled = new field_assignment_1.FieldAssignmentTranspiler().transpile(child, traversal, context).getCode();
81960
81965
  if (hasLines === false) {
81961
81966
  ret.appendString(transpiled);
81962
81967
  }
@@ -87247,7 +87252,8 @@ class MoveTranspiler {
87247
87252
  if (targetExpressions.length === 1
87248
87253
  && sourceExpression?.getChildren().length === 1
87249
87254
  && sourceExpression.findDirectExpression(abaplint.Expressions.StringTemplate)
87250
- && sourceExpression.concatTokens().toUpperCase().endsWith(" ALPHA = IN }|")) {
87255
+ && sourceExpression.concatTokens().toUpperCase().endsWith(" ALPHA = IN }|")
87256
+ && sourceExpression.concatTokens().toUpperCase().startsWith("|{")) {
87251
87257
  const target = targets[0].getCode();
87252
87258
  const tSource = traversal.traverse(sourceExpression.findFirstExpression(abaplint.Expressions.StringTemplateSource)?.findDirectExpression(abaplint.Expressions.Source));
87253
87259
  ret.appendString(target + `.set(abap.alphaIn(${tSource.getCode()}, ${target}, ${target}));`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.11.63",
3
+ "version": "2.11.64",
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.113.191",
31
- "@abaplint/transpiler": "^2.11.63",
31
+ "@abaplint/transpiler": "^2.11.64",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.3.0",
34
34
  "@types/progress": "^2.0.7",