@abaplint/transpiler-cli 2.11.45 → 2.11.46

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 +125 -6
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -6815,7 +6815,7 @@ class Source extends combi_1.Expression {
6815
6815
  const conv = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("CONV", _1.TypeNameOrInfer, lparenNoSpace, _1.ConvBody, rparenNoSpace, (0, combi_1.optPrio)(after)), version_1.Version.OpenABAP);
6816
6816
  const swit = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("SWITCH", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.SwitchBody, rparenNoSpace, (0, combi_1.optPrio)(after)));
6817
6817
  const value = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("VALUE", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.ValueBody, rparenNoSpace, (0, combi_1.optPrio)(after)), version_1.Version.OpenABAP);
6818
- const cond = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("COND", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.CondBody, rparenNoSpace, (0, combi_1.optPrio)(after)));
6818
+ const cond = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("COND", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.CondBody, rparenNoSpace, (0, combi_1.optPrio)(after)), version_1.Version.OpenABAP);
6819
6819
  const reff = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("REF", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), Source, (0, combi_1.optPrio)("OPTIONAL"), rparen), version_1.Version.OpenABAP);
6820
6820
  const exact = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("EXACT", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), Source, rparen, (0, combi_1.optPrio)(after)));
6821
6821
  const filter = (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.seq)("FILTER", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.FilterBody, rparen));
@@ -24851,7 +24851,7 @@ class FieldChain {
24851
24851
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, current.getFirstToken(), message));
24852
24852
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
24853
24853
  }
24854
- table_expression_1.TableExpression.runSyntax(current, input);
24854
+ table_expression_1.TableExpression.runSyntax(current, input, context);
24855
24855
  if (!(context instanceof basic_1.VoidType)) {
24856
24856
  context = context.getRowType();
24857
24857
  }
@@ -27832,16 +27832,39 @@ exports.SwitchBody = SwitchBody;
27832
27832
 
27833
27833
  Object.defineProperty(exports, "__esModule", ({ value: true }));
27834
27834
  exports.TableExpression = void 0;
27835
+ const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
27835
27836
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
27836
27837
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
27838
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
27839
+ const component_chain_1 = __webpack_require__(/*! ./component_chain */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/component_chain.js");
27837
27840
  class TableExpression {
27838
- static runSyntax(node, input) {
27841
+ static runSyntax(node, input, rowType) {
27839
27842
  if (node === undefined) {
27840
27843
  return;
27841
27844
  }
27842
- for (const s of node.findDirectExpressions(Expressions.Source)) {
27845
+ let context = rowType;
27846
+ if (context instanceof basic_1.TableType) {
27847
+ context = context.getRowType();
27848
+ }
27849
+ if (node.getChildren().length === 3) {
27850
+ const s = node.findDirectExpression(Expressions.Source);
27851
+ source_1.Source.runSyntax(s, input, context);
27852
+ }
27853
+ else if (node.findDirectTokenByText("INDEX")) {
27854
+ const s = node.findDirectExpression(Expressions.Source);
27843
27855
  source_1.Source.runSyntax(s, input);
27844
27856
  }
27857
+ else {
27858
+ let fieldType = undefined;
27859
+ for (const c of node.getChildren()) {
27860
+ if (c instanceof nodes_1.ExpressionNode && c.get() instanceof Expressions.ComponentChainSimple) {
27861
+ fieldType = component_chain_1.ComponentChain.runSyntax(context, c, input);
27862
+ }
27863
+ else if (c instanceof nodes_1.ExpressionNode && c.get() instanceof Expressions.Source) {
27864
+ source_1.Source.runSyntax(c, input, fieldType);
27865
+ }
27866
+ }
27867
+ }
27845
27868
  }
27846
27869
  }
27847
27870
  exports.TableExpression = TableExpression;
@@ -27959,7 +27982,7 @@ class Target {
27959
27982
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
27960
27983
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
27961
27984
  }
27962
- table_expression_1.TableExpression.runSyntax(current, input);
27985
+ table_expression_1.TableExpression.runSyntax(current, input, context);
27963
27986
  if (!(context instanceof basic_1.VoidType)) {
27964
27987
  context = context.getRowType();
27965
27988
  }
@@ -53822,7 +53845,7 @@ class Registry {
53822
53845
  }
53823
53846
  static abaplintVersion() {
53824
53847
  // magic, see build script "version.sh"
53825
- return "2.113.183";
53848
+ return "2.113.184";
53826
53849
  }
53827
53850
  getDDICReferences() {
53828
53851
  return this.ddicReferences;
@@ -78879,6 +78902,87 @@ exports.CondTranspiler = CondTranspiler;
78879
78902
 
78880
78903
  /***/ }),
78881
78904
 
78905
+ /***/ "./node_modules/@abaplint/transpiler/build/src/expressions/cond_body.js":
78906
+ /*!******************************************************************************!*\
78907
+ !*** ./node_modules/@abaplint/transpiler/build/src/expressions/cond_body.js ***!
78908
+ \******************************************************************************/
78909
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
78910
+
78911
+ "use strict";
78912
+
78913
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
78914
+ exports.CondBodyTranspiler = void 0;
78915
+ const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
78916
+ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
78917
+ const type_name_or_infer_1 = __webpack_require__(/*! ./type_name_or_infer */ "./node_modules/@abaplint/transpiler/build/src/expressions/type_name_or_infer.js");
78918
+ const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
78919
+ const cond_1 = __webpack_require__(/*! ./cond */ "./node_modules/@abaplint/transpiler/build/src/expressions/cond.js");
78920
+ const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/transpiler/build/src/expressions/source.js");
78921
+ class CondBodyTranspiler {
78922
+ transpile(typ, body, traversal) {
78923
+ if (!(typ.get() instanceof core_1.Expressions.TypeNameOrInfer)) {
78924
+ throw new Error("CondBodyTranspiler, Expected TypeNameOrInfer");
78925
+ }
78926
+ else if (body.findDirectExpression(core_1.Expressions.Let)) {
78927
+ throw new Error("CondBodyTranspiler, Let not supported, todo");
78928
+ }
78929
+ const whenThen = [];
78930
+ const expressions = [];
78931
+ for (const c of body.getChildren()) {
78932
+ if (c instanceof core_1.Nodes.TokenNode) {
78933
+ if (c.concatTokens() === "ELSE") {
78934
+ break;
78935
+ }
78936
+ }
78937
+ else {
78938
+ expressions.push(c);
78939
+ }
78940
+ }
78941
+ for (let i = 0; i < expressions.length; i = i + 2) {
78942
+ whenThen.push({ when: expressions[i], then: expressions[i + 1] });
78943
+ }
78944
+ const type = new type_name_or_infer_1.TypeNameOrInfer().findType(typ, traversal);
78945
+ const target = transpile_types_1.TranspileTypes.toType(type);
78946
+ const ret = new chunk_1.Chunk();
78947
+ ret.appendString("(" + target + ".set(");
78948
+ ret.appendString("await (async () => {\n");
78949
+ for (const { when, then } of whenThen) {
78950
+ let condition = "";
78951
+ if (when.get() instanceof core_1.Expressions.Cond) {
78952
+ condition = new cond_1.CondTranspiler().transpile(when, traversal).getCode();
78953
+ }
78954
+ else {
78955
+ throw new Error("CondBodyTranspiler, Expected Cond, todo, " + when.get().constructor.name);
78956
+ }
78957
+ let value = "";
78958
+ if (then.get() instanceof core_1.Expressions.Source) {
78959
+ value = new source_1.SourceTranspiler().transpile(then, traversal).getCode();
78960
+ }
78961
+ else {
78962
+ throw new Error("CondBodyTranspiler, Expected Source, todo, " + then.get().constructor.name);
78963
+ }
78964
+ ret.appendString(`if (${condition}) { return ${value}; }\n`);
78965
+ }
78966
+ const els = body.findExpressionAfterToken("ELSE");
78967
+ if (els) {
78968
+ if (!(els.get() instanceof core_1.Expressions.Source)) {
78969
+ throw new Error("CondBodyTranspiler, Expected Source, todo, " + els.get().constructor.name);
78970
+ }
78971
+ const value = new source_1.SourceTranspiler().transpile(els, traversal).getCode();
78972
+ ret.appendString(`return ${value};\n`);
78973
+ }
78974
+ else {
78975
+ ret.appendString(`return ${target};\n`);
78976
+ }
78977
+ ret.appendString("})()))");
78978
+ return ret;
78979
+ }
78980
+ }
78981
+ exports.CondBodyTranspiler = CondBodyTranspiler;
78982
+ //# sourceMappingURL=cond_body.js.map
78983
+
78984
+ /***/ }),
78985
+
78882
78986
  /***/ "./node_modules/@abaplint/transpiler/build/src/expressions/cond_sub.js":
78883
78987
  /*!*****************************************************************************!*\
78884
78988
  !*** ./node_modules/@abaplint/transpiler/build/src/expressions/cond_sub.js ***!
@@ -79540,6 +79644,7 @@ __exportStar(__webpack_require__(/*! ./let */ "./node_modules/@abaplint/transpil
79540
79644
  __exportStar(__webpack_require__(/*! ./message_number */ "./node_modules/@abaplint/transpiler/build/src/expressions/message_number.js"), exports);
79541
79645
  __exportStar(__webpack_require__(/*! ./method_call_body */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_body.js"), exports);
79542
79646
  __exportStar(__webpack_require__(/*! ./method_call_chain */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_chain.js"), exports);
79647
+ __exportStar(__webpack_require__(/*! ./cond_body */ "./node_modules/@abaplint/transpiler/build/src/expressions/cond_body.js"), exports);
79543
79648
  __exportStar(__webpack_require__(/*! ./method_call_param */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call_param.js"), exports);
79544
79649
  __exportStar(__webpack_require__(/*! ./new_object */ "./node_modules/@abaplint/transpiler/build/src/expressions/new_object.js"), exports);
79545
79650
  __exportStar(__webpack_require__(/*! ./method_call */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call.js"), exports);
@@ -80495,6 +80600,9 @@ class SourceTranspiler {
80495
80600
  else if (c.get() instanceof core_1.Expressions.CorrespondingBody) {
80496
80601
  continue;
80497
80602
  }
80603
+ else if (c.get() instanceof core_1.Expressions.CondBody) {
80604
+ continue;
80605
+ }
80498
80606
  else {
80499
80607
  ret.appendString("SourceUnknown$" + c.get().constructor.name);
80500
80608
  }
@@ -80539,6 +80647,17 @@ class SourceTranspiler {
80539
80647
  }
80540
80648
  ret.appendChunk(new corresponding_body_1.CorrespondingBodyTranspiler().transpile(typ, correspondingBody, traversal));
80541
80649
  }
80650
+ else if (c instanceof core_1.Nodes.TokenNode && c.getFirstToken().getStr().toUpperCase() === "COND") {
80651
+ const typ = node.findDirectExpression(core_1.Expressions.TypeNameOrInfer);
80652
+ if (typ === undefined) {
80653
+ throw new Error("TypeNameOrInfer not found in CondBody");
80654
+ }
80655
+ const condBody = node.findDirectExpression(core_1.Expressions.CondBody);
80656
+ if (condBody === undefined) {
80657
+ throw new Error("CondBody not found");
80658
+ }
80659
+ ret.appendChunk(new _1.CondBodyTranspiler().transpile(typ, condBody, traversal));
80660
+ }
80542
80661
  else if (c instanceof core_1.Nodes.TokenNode && c.getFirstToken().getStr().toUpperCase() === "REF") {
80543
80662
  const infer = node.findDirectExpression(core_1.Expressions.TypeNameOrInfer);
80544
80663
  if (infer?.concatTokens() !== "#") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.11.45",
3
+ "version": "2.11.46",
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.183",
31
- "@abaplint/transpiler": "^2.11.45",
30
+ "@abaplint/core": "^2.113.184",
31
+ "@abaplint/transpiler": "^2.11.46",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.3.0",
34
34
  "@types/progress": "^2.0.7",