@abaplint/transpiler-cli 2.7.82 → 2.7.84

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 +152 -37
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -7573,7 +7573,8 @@ class TypeTableKey extends combi_1.Expression {
7573
7573
  const defaultKey = "DEFAULT KEY";
7574
7574
  const emptyKey = (0, combi_1.ver)(version_1.Version.v740sp02, "EMPTY KEY");
7575
7575
  const components = (0, combi_1.plus)((0, combi_1.alt)((0, combi_1.seq)("WITH", (0, combi_1.failStar)()), _1.FieldSub));
7576
- const key = (0, combi_1.seq)("WITH", (0, combi_1.opt)(uniqueness), (0, combi_1.altPrio)(defaultKey, emptyKey, (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("SORTED", "HASHED")), "KEY", (0, combi_1.alt)((0, combi_1.seq)(_1.Field, "COMPONENTS", components), components))), (0, combi_1.optPrio)("READ-ONLY"));
7576
+ const further = (0, combi_1.seq)((0, combi_1.alt)("WITHOUT", "WITH"), "FURTHER SECONDARY KEYS");
7577
+ const key = (0, combi_1.seq)("WITH", (0, combi_1.opt)(uniqueness), (0, combi_1.altPrio)(defaultKey, emptyKey, (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("SORTED", "HASHED")), "KEY", (0, combi_1.alt)((0, combi_1.seq)(_1.Field, "COMPONENTS", components), components))), (0, combi_1.optPrio)(further), (0, combi_1.optPrio)("READ-ONLY"));
7577
7578
  return key;
7578
7579
  }
7579
7580
  }
@@ -8666,7 +8667,7 @@ class CallFunction {
8666
8667
  const update = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.str)("IN UPDATE TASK"));
8667
8668
  const unit = (0, combi_1.seq)("UNIT", expressions_1.Source);
8668
8669
  const background = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.altPrio)("TASK", unit)));
8669
- const calling = (0, combi_1.seq)("CALLING", expressions_1.MethodName, "ON END OF TASK");
8670
+ const calling = (0, combi_1.seq)("CALLING", expressions_1.MethodSource, "ON END OF TASK");
8670
8671
  const performing = (0, combi_1.seq)("PERFORMING", expressions_1.FormName, "ON END OF TASK");
8671
8672
  const separate = (0, combi_1.str)("AS SEPARATE UNIT");
8672
8673
  const keeping = (0, combi_1.str)("KEEPING LOGICAL UNIT OF WORK");
@@ -15700,7 +15701,7 @@ class TypeMesh {
15700
15701
  const on = (0, combi_1.seq)("ON", expressions_1.NamespaceSimpleName, "=", expressions_1.NamespaceSimpleName, (0, combi_1.star)((0, combi_1.seq)("AND", expressions_1.NamespaceSimpleName, "=", expressions_1.NamespaceSimpleName)));
15701
15702
  const using = (0, combi_1.seq)("USING KEY", expressions_1.NamespaceSimpleName);
15702
15703
  const association = (0, combi_1.seq)("ASSOCIATION", expressions_1.NamespaceSimpleName, "TO", expressions_1.NamespaceSimpleName, (0, combi_1.plus)(on));
15703
- const ret = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("TYPES", expressions_1.NamespaceSimpleName, "TYPE", expressions_1.TypeName, (0, combi_1.plus)(association), (0, combi_1.opt)(using)));
15704
+ const ret = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("TYPES", expressions_1.NamespaceSimpleName, "TYPE", (0, combi_1.opt)("REF TO"), expressions_1.TypeName, (0, combi_1.plus)(association), (0, combi_1.opt)(using)));
15704
15705
  return ret;
15705
15706
  }
15706
15707
  }
@@ -19569,6 +19570,9 @@ class CurrentScope {
19569
19570
  if (this.current.getData().types[upper] !== undefined) {
19570
19571
  throw new Error(`Type name "${name}" already defined`);
19571
19572
  }
19573
+ else if (this.isOO() && this.current.getData().vars[upper] !== undefined) {
19574
+ throw new Error(`"${name}" already defined`);
19575
+ }
19572
19576
  this.current.getData().types[upper] = type;
19573
19577
  }
19574
19578
  addExtraLikeType(type) {
@@ -19618,6 +19622,9 @@ class CurrentScope {
19618
19622
  if (this.current.getData().vars[upper] !== undefined) {
19619
19623
  throw new Error(`Variable name "${name}" already defined`);
19620
19624
  }
19625
+ else if (this.isOO() && this.current.getData().types[upper] !== undefined) {
19626
+ throw new Error(`"${name}" already defined`);
19627
+ }
19621
19628
  this.current.getData().vars[upper] = identifier;
19622
19629
  }
19623
19630
  addIdentifier(identifier) {
@@ -19884,7 +19891,7 @@ class CurrentScope {
19884
19891
  while (curr !== undefined) {
19885
19892
  const stype = curr.getIdentifier().stype;
19886
19893
  if (stype === _scope_type_1.ScopeType.ClassDefinition
19887
- || stype === _scope_type_1.ScopeType.ClassImplementation
19894
+ // || stype === ScopeType.ClassImplementation
19888
19895
  || stype === _scope_type_1.ScopeType.Interface) {
19889
19896
  return true;
19890
19897
  }
@@ -20528,6 +20535,7 @@ exports.TypeUtils = void 0;
20528
20535
  const types_1 = __webpack_require__(/*! ../types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
20529
20536
  const basic_1 = __webpack_require__(/*! ../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
20530
20537
  const cgeneric_type_1 = __webpack_require__(/*! ../types/basic/cgeneric_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js");
20538
+ // todo: refactor to static? for performance
20531
20539
  class TypeUtils {
20532
20540
  constructor(scope) {
20533
20541
  this.scope = scope;
@@ -20734,7 +20742,7 @@ class TypeUtils {
20734
20742
  return false;
20735
20743
  }
20736
20744
  isAssignableStrict(source, target, calculated = false) {
20737
- var _a, _b, _c, _d, _e, _f, _g;
20745
+ var _a, _b, _c, _d, _e, _f, _g, _h;
20738
20746
  /*
20739
20747
  console.dir(source);
20740
20748
  console.dir(target);
@@ -20822,6 +20830,17 @@ class TypeUtils {
20822
20830
  return false;
20823
20831
  }
20824
20832
  }
20833
+ else if (source instanceof basic_1.IntegerType) {
20834
+ if (target instanceof basic_1.StringType) {
20835
+ return false;
20836
+ }
20837
+ else if (target instanceof basic_1.Integer8Type) {
20838
+ if (((_h = source.getAbstractTypeData()) === null || _h === void 0 ? void 0 : _h.derivedFromConstant) === true) {
20839
+ return true;
20840
+ }
20841
+ return false;
20842
+ }
20843
+ }
20825
20844
  else if (source instanceof basic_1.FloatType) {
20826
20845
  if (target instanceof basic_1.IntegerType) {
20827
20846
  return false;
@@ -22477,7 +22496,7 @@ class Constant {
22477
22496
  runSyntax(node) {
22478
22497
  // todo: ConcatenatedConstant is not used?
22479
22498
  if (node.findDirectExpression(expressions_1.Integer)) {
22480
- return basic_1.IntegerType.get();
22499
+ return basic_1.IntegerType.get({ derivedFromConstant: true });
22481
22500
  }
22482
22501
  else if (node.getFirstToken().getStr().startsWith("'")) {
22483
22502
  let len = node.getFirstToken().getStr().length - 2;
@@ -28368,6 +28387,7 @@ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_module
28368
28387
  const fstarget_1 = __webpack_require__(/*! ../expressions/fstarget */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/fstarget.js");
28369
28388
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
28370
28389
  const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js");
28390
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
28371
28391
  class InsertInternal {
28372
28392
  runSyntax(node, scope, filename) {
28373
28393
  let targetType;
@@ -28375,7 +28395,7 @@ class InsertInternal {
28375
28395
  if (t) {
28376
28396
  targetType = new target_1.Target().runSyntax(t, scope, filename);
28377
28397
  }
28378
- if (targetType instanceof basic_1.TableType) {
28398
+ if (targetType instanceof basic_1.TableType && node.findDirectTokenByText("LINES") === undefined) {
28379
28399
  targetType = targetType.getRowType();
28380
28400
  }
28381
28401
  let source = node.findDirectExpression(Expressions.SimpleSource4);
@@ -28393,6 +28413,9 @@ class InsertInternal {
28393
28413
  new fstarget_1.FSTarget().runSyntax(afterAssigning, scope, filename, sourceType);
28394
28414
  }
28395
28415
  }
28416
+ if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
28417
+ throw new Error("Types not compatible");
28418
+ }
28396
28419
  const afterInto = node.findExpressionAfterToken("INTO");
28397
28420
  if ((afterInto === null || afterInto === void 0 ? void 0 : afterInto.get()) instanceof Expressions.Target && sourceType) {
28398
28421
  const inline = afterInto.findDirectExpression(Expressions.InlineData);
@@ -30031,6 +30054,7 @@ const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modu
30031
30054
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
30032
30055
  class Sort {
30033
30056
  runSyntax(node, scope, filename) {
30057
+ var _a, _b;
30034
30058
  for (const s of node.findDirectExpressions(Expressions.Dynamic)) {
30035
30059
  new dynamic_1.Dynamic().runSyntax(s, scope, filename);
30036
30060
  }
@@ -30038,6 +30062,9 @@ class Sort {
30038
30062
  if (tnode) {
30039
30063
  const ttype = new target_1.Target().runSyntax(tnode, scope, filename);
30040
30064
  if (ttype instanceof basic_1.TableType) {
30065
+ if (((_b = (_a = ttype.getOptions()) === null || _a === void 0 ? void 0 : _a.primaryKey) === null || _b === void 0 ? void 0 : _b.type) === basic_1.TableAccessType.sorted) {
30066
+ throw new Error(`Sorted table, already sorted`);
30067
+ }
30041
30068
  const rowType = ttype.getRowType();
30042
30069
  if (!(rowType instanceof basic_1.VoidType)
30043
30070
  && !(rowType instanceof basic_1.UnknownType)
@@ -47792,7 +47819,7 @@ class Registry {
47792
47819
  }
47793
47820
  static abaplintVersion() {
47794
47821
  // magic, see build script "version.sh"
47795
- return "2.102.28";
47822
+ return "2.102.32";
47796
47823
  }
47797
47824
  getDDICReferences() {
47798
47825
  return this.ddicReferences;
@@ -70342,9 +70369,16 @@ exports.ComponentChainSimpleTranspiler = void 0;
70342
70369
  const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
70343
70370
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
70344
70371
  const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
70372
+ const field_length_1 = __webpack_require__(/*! ./field_length */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_length.js");
70373
+ const field_offset_1 = __webpack_require__(/*! ./field_offset */ "./node_modules/@abaplint/transpiler/build/src/expressions/field_offset.js");
70345
70374
  class ComponentChainSimpleTranspiler {
70375
+ constructor(prefix = "") {
70376
+ this.prefix = "";
70377
+ this.prefix = prefix;
70378
+ }
70346
70379
  transpile(node, traversal) {
70347
- const ret = new chunk_1.Chunk();
70380
+ const offset = [];
70381
+ let ret = new chunk_1.Chunk();
70348
70382
  for (const c of node.getChildren()) {
70349
70383
  const type = c.get();
70350
70384
  if (type instanceof core_1.Expressions.ComponentName) {
@@ -70354,11 +70388,26 @@ class ComponentChainSimpleTranspiler {
70354
70388
  field = interfaceName + "$" + field;
70355
70389
  }
70356
70390
  field = traversal_1.Traversal.escapeNamespace(field).replace("~", "$");
70357
- ret.append(field, c, traversal);
70391
+ ret.append(this.prefix + field, c, traversal);
70392
+ this.prefix = "";
70358
70393
  }
70359
70394
  else if (type instanceof core_1.Expressions.ArrowOrDash) {
70360
70395
  ret.append(".get().", c, traversal);
70361
70396
  }
70397
+ else if (c instanceof core_1.Nodes.ExpressionNode && c.get() instanceof core_1.Expressions.FieldOffset) {
70398
+ offset.push("offset: " + new field_offset_1.FieldOffsetTranspiler().transpile(c, traversal).getCode());
70399
+ }
70400
+ else if (c instanceof core_1.Nodes.ExpressionNode && c.get() instanceof core_1.Expressions.FieldLength) {
70401
+ const len = new field_length_1.FieldLengthTranspiler().transpile(c, traversal).getCode();
70402
+ if (len !== "*") {
70403
+ offset.push("length: " + len);
70404
+ }
70405
+ }
70406
+ }
70407
+ if (offset.length > 0) {
70408
+ const pre = "new abap.OffsetLength(";
70409
+ const post = ", {" + offset.join(", ") + "})";
70410
+ ret = new chunk_1.Chunk().appendString(pre).appendChunk(ret).appendString(post);
70362
70411
  }
70363
70412
  return ret;
70364
70413
  }
@@ -70380,45 +70429,49 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
70380
70429
  exports.ComponentCompareTranspiler = void 0;
70381
70430
  const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
70382
70431
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
70432
+ const component_chain_simple_1 = __webpack_require__(/*! ./component_chain_simple */ "./node_modules/@abaplint/transpiler/build/src/expressions/component_chain_simple.js");
70383
70433
  class ComponentCompareTranspiler {
70384
70434
  transpile(node, traversal) {
70385
70435
  const concat = node.concatTokens().toUpperCase();
70386
70436
  const pre = concat.startsWith("NOT") ? "!" : "";
70387
70437
  const componentExpression = node.findDirectExpression(core_1.Expressions.ComponentChainSimple);
70388
- const component = traversal.traverse(componentExpression).getCode();
70438
+ if (componentExpression === undefined) {
70439
+ throw new Error("unexpected, ComponentCompareTranspiler");
70440
+ }
70441
+ const component = new component_chain_simple_1.ComponentChainSimpleTranspiler("I.").transpile(componentExpression, traversal).getCode();
70389
70442
  if (node.findDirectExpression(core_1.Expressions.CompareOperator)) {
70390
70443
  const compare = traversal.traverse(node.findDirectExpression(core_1.Expressions.CompareOperator)).getCode();
70391
70444
  const source = traversal.traverse(node.findDirectExpression(core_1.Expressions.Source)).getCode();
70392
- return new chunk_1.Chunk(`(I) => {return ${pre}abap.compare.${compare}(I.${component}, ${source});}`);
70445
+ return new chunk_1.Chunk(`(I) => {return ${pre}abap.compare.${compare}(${component}, ${source});}`);
70393
70446
  }
70394
70447
  if ((concat.startsWith("NOT") && concat.endsWith("IS INITIAL"))
70395
70448
  || concat.endsWith("IS NOT INITIAL")) {
70396
- return new chunk_1.Chunk(`(I) => {return abap.compare.initial(I.${component}) === false;}`);
70449
+ return new chunk_1.Chunk(`(I) => {return abap.compare.initial(${component}) === false;}`);
70397
70450
  }
70398
70451
  else if (concat.endsWith("IS INITIAL")) {
70399
- return new chunk_1.Chunk(`(I) => {return abap.compare.initial(I.${component});}`);
70452
+ return new chunk_1.Chunk(`(I) => {return abap.compare.initial(${component});}`);
70400
70453
  }
70401
70454
  if (concat.startsWith((componentExpression === null || componentExpression === void 0 ? void 0 : componentExpression.concatTokens().toUpperCase()) + " IN ")) {
70402
70455
  const source = traversal.traverse(node.findDirectExpression(core_1.Expressions.Source)).getCode();
70403
- return new chunk_1.Chunk(`(I) => {return ${pre}abap.compare.in(I.${component}, ${source});}`);
70456
+ return new chunk_1.Chunk(`(I) => {return ${pre}abap.compare.in(${component}, ${source});}`);
70404
70457
  }
70405
70458
  else if (concat.startsWith((componentExpression === null || componentExpression === void 0 ? void 0 : componentExpression.concatTokens().toUpperCase()) + " NOT IN ")) {
70406
70459
  const source = traversal.traverse(node.findDirectExpression(core_1.Expressions.Source)).getCode();
70407
- return new chunk_1.Chunk(`(I) => {return !abap.compare.in(I.${component}, ${source});}`);
70460
+ return new chunk_1.Chunk(`(I) => {return !abap.compare.in(${component}, ${source});}`);
70408
70461
  }
70409
70462
  if ((concat.startsWith("NOT") && concat.endsWith("IS BOUND"))
70410
70463
  || concat.endsWith("IS NOT BOUND")) {
70411
- return new chunk_1.Chunk(`(I) => {return abap.compare.initial(I.${component});}`);
70464
+ return new chunk_1.Chunk(`(I) => {return abap.compare.initial(${component});}`);
70412
70465
  }
70413
70466
  else if (concat.endsWith("IS BOUND")) {
70414
- return new chunk_1.Chunk(`(I) => {return abap.compare.initial(I.${component}) === false;}`);
70467
+ return new chunk_1.Chunk(`(I) => {return abap.compare.initial(${component}) === false;}`);
70415
70468
  }
70416
70469
  if ((concat.startsWith("NOT") && concat.endsWith("IS ASSIGNED"))
70417
70470
  || concat.endsWith("IS NOT ASSIGNED")) {
70418
- return new chunk_1.Chunk(`(I) => {return abap.compare.assigned(I.${component}) === false;}`);
70471
+ return new chunk_1.Chunk(`(I) => {return abap.compare.assigned(${component}) === false;}`);
70419
70472
  }
70420
70473
  else if (concat.endsWith("IS ASSIGNED")) {
70421
- return new chunk_1.Chunk(`(I) => {return abap.compare.assigned(I.${component});}`);
70474
+ return new chunk_1.Chunk(`(I) => {return abap.compare.assigned(${component});}`);
70422
70475
  }
70423
70476
  return new chunk_1.Chunk("ComponentCompareTodo");
70424
70477
  }
@@ -70613,7 +70666,14 @@ class ConstantTranspiler {
70613
70666
  const int = node.findFirstExpression(core_1.Expressions.Integer);
70614
70667
  if (int) {
70615
70668
  const concat = int.concatTokens().trim();
70616
- let code = `new abap.types.Integer().set(${concat})`;
70669
+ const parsed = Number.parseInt(concat, 10);
70670
+ let code = "";
70671
+ if (parsed > 2147483647 || parsed < -2147483648) {
70672
+ code = `new abap.types.Integer8().set(${concat})`;
70673
+ }
70674
+ else {
70675
+ code = `new abap.types.Integer().set(${concat})`;
70676
+ }
70617
70677
  if (this.addGet === true) {
70618
70678
  code += ".get()";
70619
70679
  }
@@ -72618,7 +72678,7 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
72618
72678
  class TargetTranspiler {
72619
72679
  transpile(node, traversal) {
72620
72680
  const offset = [];
72621
- const ret = new chunk_1.Chunk();
72681
+ let ret = new chunk_1.Chunk();
72622
72682
  const children = node.getChildren();
72623
72683
  for (let i = 0; i < children.length; i++) {
72624
72684
  const c = children[i];
@@ -72678,16 +72738,12 @@ class TargetTranspiler {
72678
72738
  }
72679
72739
  }
72680
72740
  }
72681
- let pre = "";
72682
- let post = "";
72683
72741
  if (offset.length > 0) {
72684
- pre = "new abap.OffsetLength(";
72685
- post = ", {" + offset.join(", ") + "})";
72742
+ const pre = "new abap.OffsetLength(";
72743
+ const post = ", {" + offset.join(", ") + "})";
72744
+ ret = new chunk_1.Chunk().appendString(pre).appendChunk(ret).appendString(post);
72686
72745
  }
72687
- return new chunk_1.Chunk()
72688
- .appendString(pre)
72689
- .appendChunk(ret)
72690
- .appendString(post);
72746
+ return ret;
72691
72747
  }
72692
72748
  }
72693
72749
  exports.TargetTranspiler = TargetTranspiler;
@@ -75966,10 +76022,26 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
75966
76022
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
75967
76023
  const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
75968
76024
  class FormTranspiler {
75969
- transpile(node) {
76025
+ transpile(node, traversal) {
75970
76026
  unique_identifier_1.UniqueIdentifier.resetIndexBackup();
75971
76027
  const name = node.findFirstExpression(abaplint.Expressions.FormName).getFirstToken().getStr();
75972
- return new chunk_1.Chunk("async function " + name + "() {");
76028
+ const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
76029
+ const def = scope === null || scope === void 0 ? void 0 : scope.findFormDefinition(name);
76030
+ const ret = new chunk_1.Chunk("async function " + name + "(INPUT) {");
76031
+ const params = [];
76032
+ for (const p of (def === null || def === void 0 ? void 0 : def.getChangingParameters()) || []) {
76033
+ params.push(`let ${p.getName()} = INPUT.${p.getName()};`);
76034
+ }
76035
+ for (const p of (def === null || def === void 0 ? void 0 : def.getTablesParameters()) || []) {
76036
+ params.push(`let ${p.getName()} = INPUT.${p.getName()};`);
76037
+ }
76038
+ for (const p of (def === null || def === void 0 ? void 0 : def.getUsingParameters()) || []) {
76039
+ params.push(`let ${p.getName()} = INPUT.${p.getName()};`);
76040
+ }
76041
+ if (params.length > 0) {
76042
+ ret.appendString("\n" + params.join("\n"));
76043
+ }
76044
+ return ret;
75973
76045
  }
75974
76046
  }
75975
76047
  exports.FormTranspiler = FormTranspiler;
@@ -76787,7 +76859,11 @@ class LoopTranspiler {
76787
76859
  else if (compare.findDirectTokenByText("NOT")) {
76788
76860
  continue;
76789
76861
  }
76790
- const tchain = traversal.traverse(compare.findDirectExpression(abaplint.Expressions.ComponentChainSimple));
76862
+ const simple = compare.findDirectExpression(abaplint.Expressions.ComponentChainSimple);
76863
+ if ((simple === null || simple === void 0 ? void 0 : simple.getChildren().length) !== 1) {
76864
+ continue;
76865
+ }
76866
+ const tchain = traversal.traverse(simple);
76791
76867
  const tsource = traversal.traverse(compare.findDirectExpression(abaplint.Expressions.Source));
76792
76868
  topEquals[tchain.getCode()] = tsource.getCode();
76793
76869
  }
@@ -77410,19 +77486,58 @@ exports.ParameterTranspiler = ParameterTranspiler;
77410
77486
 
77411
77487
  Object.defineProperty(exports, "__esModule", ({ value: true }));
77412
77488
  exports.PerformTranspiler = void 0;
77489
+ /* eslint-disable max-len */
77413
77490
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
77414
77491
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
77415
77492
  class PerformTranspiler {
77416
- transpile(node, _traversal) {
77493
+ transpile(node, traversal) {
77494
+ var _a, _b, _c;
77417
77495
  const formName = node.findDirectExpression(abaplint.Expressions.FormName);
77418
77496
  if (formName === undefined) {
77419
77497
  return new chunk_1.Chunk(`throw new Error("PerformTranspiler FormName not found");`);
77420
77498
  }
77421
- // todo, parameters
77422
- if (node.concatTokens().toUpperCase().includes(" IN PROGRAM ")) {
77499
+ else if (node.concatTokens().toUpperCase().includes(" IN PROGRAM ")) {
77423
77500
  return new chunk_1.Chunk(`throw new Error("PerformTranspiler IN PROGRAM, transpiler todo");`);
77424
77501
  }
77425
- return new chunk_1.Chunk("await " + formName.concatTokens() + "();");
77502
+ let def = undefined;
77503
+ const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
77504
+ for (const r of (scope === null || scope === void 0 ? void 0 : scope.getData().references) || []) {
77505
+ if (r.referenceType === abaplint.ReferenceType.FormReference
77506
+ && r.position.getStart().equals(formName.getFirstToken().getStart())
77507
+ && r.resolved instanceof abaplint.Types.FormDefinition) {
77508
+ def = r.resolved;
77509
+ }
77510
+ }
77511
+ // todo: pass by VALUE()
77512
+ const params = [];
77513
+ let index = 0;
77514
+ for (const t of ((_a = node.findDirectExpression(abaplint.Expressions.PerformTables)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(abaplint.Expressions.Source)) || []) {
77515
+ const name = def === null || def === void 0 ? void 0 : def.getTablesParameters()[index].getName().toLowerCase();
77516
+ if (name === undefined) {
77517
+ continue;
77518
+ }
77519
+ params.push(`"${name}": ` + traversal.traverse(t).getCode());
77520
+ index++;
77521
+ }
77522
+ index = 0;
77523
+ for (const u of ((_b = node.findDirectExpression(abaplint.Expressions.PerformUsing)) === null || _b === void 0 ? void 0 : _b.findDirectExpressions(abaplint.Expressions.Source)) || []) {
77524
+ const name = def === null || def === void 0 ? void 0 : def.getUsingParameters()[index].getName().toLowerCase();
77525
+ if (name === undefined) {
77526
+ continue;
77527
+ }
77528
+ params.push(`"${name}": ` + traversal.traverse(u).getCode());
77529
+ index++;
77530
+ }
77531
+ index = 0;
77532
+ for (const c of ((_c = node.findDirectExpression(abaplint.Expressions.PerformChanging)) === null || _c === void 0 ? void 0 : _c.findDirectExpressions(abaplint.Expressions.Source)) || []) {
77533
+ const name = def === null || def === void 0 ? void 0 : def.getChangingParameters()[index].getName().toLowerCase();
77534
+ if (name === undefined) {
77535
+ continue;
77536
+ }
77537
+ params.push(`"${name}": ` + traversal.traverse(c).getCode());
77538
+ index++;
77539
+ }
77540
+ return new chunk_1.Chunk("await " + formName.concatTokens() + `({${params.join(",")}});`);
77426
77541
  }
77427
77542
  }
77428
77543
  exports.PerformTranspiler = PerformTranspiler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.7.82",
3
+ "version": "2.7.84",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -26,12 +26,12 @@
26
26
  "author": "abaplint",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@abaplint/transpiler": "^2.7.82",
29
+ "@abaplint/transpiler": "^2.7.84",
30
30
  "@types/glob": "^7.2.0",
31
31
  "glob": "=7.2.0",
32
32
  "@types/progress": "^2.0.5",
33
- "@types/node": "^20.5.6",
34
- "@abaplint/core": "^2.102.28",
33
+ "@types/node": "^20.5.7",
34
+ "@abaplint/core": "^2.102.32",
35
35
  "progress": "^2.0.3",
36
36
  "webpack": "^5.88.2",
37
37
  "webpack-cli": "^5.1.4",