@abaplint/transpiler-cli 2.13.14 → 2.13.15

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 +27 -6
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -81963,8 +81963,8 @@ class CorrespondingBodyTranspiler {
81963
81963
  const type = new type_name_or_infer_1.TypeNameOrInfer().findType(typ, traversal);
81964
81964
  let target = transpile_types_1.TranspileTypes.toType(type);
81965
81965
  let source;
81966
+ const isTableType = type instanceof core_1.BasicTypes.TableType;
81966
81967
  const mapping = [];
81967
- const mappingRow = { componentName: undefined, componentChain: undefined };
81968
81968
  for (const child of body.getChildren()) {
81969
81969
  const c = child.get();
81970
81970
  if (c instanceof core_1.Expressions.Source && child instanceof core_1.Nodes.ExpressionNode) {
@@ -81975,6 +81975,7 @@ class CorrespondingBodyTranspiler {
81975
81975
  target = `abap.statements.moveCorresponding(${source.getCode()}, ${target})`;
81976
81976
  }
81977
81977
  else if (c instanceof core_1.Expressions.CorrespondingBodyMapping && child instanceof core_1.Nodes.ExpressionNode) {
81978
+ let mappingRow = { componentName: undefined, componentChain: undefined };
81978
81979
  for (const cc of child.getChildren()) {
81979
81980
  if (cc.get() instanceof core_1.Expressions.ComponentName) {
81980
81981
  mappingRow.componentName = cc;
@@ -81982,6 +81983,7 @@ class CorrespondingBodyTranspiler {
81982
81983
  else if (cc.get() instanceof core_1.Expressions.ComponentChain) {
81983
81984
  mappingRow.componentChain = cc;
81984
81985
  mapping.push(mappingRow);
81986
+ mappingRow = { componentName: undefined, componentChain: undefined };
81985
81987
  }
81986
81988
  }
81987
81989
  }
@@ -81991,13 +81993,32 @@ class CorrespondingBodyTranspiler {
81991
81993
  }
81992
81994
  const ret = new chunk_1.Chunk();
81993
81995
  const id = unique_identifier_1.UniqueIdentifier.get();
81996
+ const sourceId = unique_identifier_1.UniqueIdentifier.get();
81994
81997
  ret.appendString("(await (async () => {\n");
81995
81998
  ret.appendString(`const ${id} = ${target};\n`);
81996
- ret.appendString(`abap.statements.moveCorresponding(${source.getCode()}, ${id});\n`);
81997
- for (const map of mapping) {
81998
- const componentName = map.componentName.concatTokens().toLowerCase();
81999
- const chain = new component_chain_1.ComponentChainTranspiler().transpile(map.componentChain, traversal).getCode();
82000
- ret.appendString(`${id}.get().${componentName}.set(${source.getCode()}.get().${chain});\n`);
81999
+ ret.appendString(`const ${sourceId} = ${source.getCode()};\n`);
82000
+ if (isTableType) {
82001
+ const rowTargetType = transpile_types_1.TranspileTypes.toType(type.getRowType());
82002
+ const sourceRowId = unique_identifier_1.UniqueIdentifier.get();
82003
+ const targetRowId = unique_identifier_1.UniqueIdentifier.get();
82004
+ ret.appendString(`for (const ${sourceRowId} of ${sourceId}.array()) {\n`);
82005
+ ret.appendString(`const ${targetRowId} = ${rowTargetType};\n`);
82006
+ ret.appendString(`abap.statements.moveCorresponding(${sourceRowId}, ${targetRowId});\n`);
82007
+ for (const map of mapping) {
82008
+ const componentName = map.componentName.concatTokens().toLowerCase();
82009
+ const chain = new component_chain_1.ComponentChainTranspiler().transpile(map.componentChain, traversal).getCode();
82010
+ ret.appendString(`${targetRowId}.get().${componentName}.set(${sourceRowId}.get().${chain});\n`);
82011
+ }
82012
+ ret.appendString(`abap.statements.insertInternal({table: ${id}, data: ${targetRowId}});\n`);
82013
+ ret.appendString("}\n");
82014
+ }
82015
+ else {
82016
+ ret.appendString(`abap.statements.moveCorresponding(${sourceId}, ${id});\n`);
82017
+ for (const map of mapping) {
82018
+ const componentName = map.componentName.concatTokens().toLowerCase();
82019
+ const chain = new component_chain_1.ComponentChainTranspiler().transpile(map.componentChain, traversal).getCode();
82020
+ ret.appendString(`${id}.get().${componentName}.set(${sourceId}.get().${chain});\n`);
82021
+ }
82001
82022
  }
82002
82023
  ret.appendString("return " + id + ";\n");
82003
82024
  ret.appendString("})())");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.13.14",
3
+ "version": "2.13.15",
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.119.1",
31
- "@abaplint/transpiler": "^2.13.14",
31
+ "@abaplint/transpiler": "^2.13.15",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.12.2",
34
34
  "@types/progress": "^2.0.7",