@abaplint/transpiler-cli 2.11.21 → 2.11.22

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 +56 -17
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -4748,6 +4748,7 @@ __exportStar(__webpack_require__(/*! ./compare */ "./node_modules/@abaplint/core
4748
4748
  __exportStar(__webpack_require__(/*! ./component_chain_simple */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/component_chain_simple.js"), exports);
4749
4749
  __exportStar(__webpack_require__(/*! ./component_chain */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/component_chain.js"), exports);
4750
4750
  __exportStar(__webpack_require__(/*! ./component_compare_simple */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/component_compare_simple.js"), exports);
4751
+ __exportStar(__webpack_require__(/*! ./value_base */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/value_base.js"), exports);
4751
4752
  __exportStar(__webpack_require__(/*! ./component_compare_single */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/component_compare_single.js"), exports);
4752
4753
  __exportStar(__webpack_require__(/*! ./component_compare */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/component_compare.js"), exports);
4753
4754
  __exportStar(__webpack_require__(/*! ./component_cond_sub */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/component_cond_sub.js"), exports);
@@ -8529,6 +8530,28 @@ exports.Value = Value;
8529
8530
 
8530
8531
  /***/ }),
8531
8532
 
8533
+ /***/ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/value_base.js":
8534
+ /*!*******************************************************************************************!*\
8535
+ !*** ./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/value_base.js ***!
8536
+ \*******************************************************************************************/
8537
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
8538
+
8539
+ "use strict";
8540
+
8541
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
8542
+ exports.ValueBase = void 0;
8543
+ const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
8544
+ const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
8545
+ class ValueBase extends combi_1.Expression {
8546
+ getRunnable() {
8547
+ return (0, combi_1.seq)("BASE", _1.Source);
8548
+ }
8549
+ }
8550
+ exports.ValueBase = ValueBase;
8551
+ //# sourceMappingURL=value_base.js.map
8552
+
8553
+ /***/ }),
8554
+
8532
8555
  /***/ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/value_body.js":
8533
8556
  /*!*******************************************************************************************!*\
8534
8557
  !*** ./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/value_body.js ***!
@@ -8544,8 +8567,7 @@ const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src
8544
8567
  const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
8545
8568
  class ValueBody extends combi_1.Expression {
8546
8569
  getRunnable() {
8547
- const base = (0, combi_1.seq)("BASE", _1.Source);
8548
- const strucOrTab = (0, combi_1.seq)((0, combi_1.optPrio)(_1.Let), (0, combi_1.optPrio)(base), (0, combi_1.star)(_1.For), (0, combi_1.plusPrio)((0, combi_1.altPrio)(_1.FieldAssignment, _1.ValueBodyLine)));
8570
+ const strucOrTab = (0, combi_1.seq)((0, combi_1.optPrio)(_1.Let), (0, combi_1.optPrio)(_1.ValueBase), (0, combi_1.star)(_1.For), (0, combi_1.plusPrio)((0, combi_1.altPrio)(_1.FieldAssignment, _1.ValueBodyLine)));
8549
8571
  const tabdef = (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.altPrio)("OPTIONAL", (0, combi_1.seq)("DEFAULT", _1.Source)));
8550
8572
  return (0, combi_1.optPrio)((0, combi_1.altPrio)(strucOrTab, (0, combi_1.seq)(_1.Source, (0, combi_1.optPrio)(tabdef))));
8551
8573
  }
@@ -9147,7 +9169,7 @@ class Append {
9147
9169
  const fromIndex = (0, combi_1.seq)("FROM", expressions_1.Source);
9148
9170
  const toIndex = (0, combi_1.seq)("TO", expressions_1.Source);
9149
9171
  const toTarget = (0, combi_1.seq)("TO", expressions_1.Target);
9150
- const src = (0, combi_1.alt)(expressions_1.SimpleSource4, (0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source));
9172
+ const src = (0, combi_1.alt)(expressions_1.SimpleSource4, (0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source, version_1.Version.OpenABAP));
9151
9173
  return (0, combi_1.seq)("APPEND", (0, combi_1.altPrio)("INITIAL LINE", (0, combi_1.seq)((0, combi_1.optPrio)("LINES OF"), src)), (0, combi_1.optPrio)(fromIndex), (0, combi_1.opt)((0, combi_1.alt)((0, combi_1.seq)(toIndex, toTarget), toTarget)), (0, combi_1.opt)((0, combi_1.altPrio)(assigning, reference)), (0, combi_1.optPrio)("CASTING"), (0, combi_1.optPrio)(sorted));
9152
9174
  }
9153
9175
  }
@@ -13549,7 +13571,7 @@ class InsertInternal {
13549
13571
  const fromTo = (0, combi_1.opt)((0, combi_1.per)(from, to));
13550
13572
  const foo = (0, combi_1.alt)(intoTable, (0, combi_1.seq)(into, (0, combi_1.opt)((0, combi_1.per)(index, (0, combi_1.alt)(ref, assigning)))), (0, combi_1.per)(index, (0, combi_1.alt)(ref, assigning)));
13551
13573
  const lines = (0, combi_1.seq)("LINES OF", target, (0, combi_1.opt)(fromTo));
13552
- const src = (0, combi_1.alt)(expressions_1.SimpleSource4, (0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source));
13574
+ const src = (0, combi_1.alt)(expressions_1.SimpleSource4, (0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source, version_1.Version.OpenABAP));
13553
13575
  const tab = (0, combi_1.seq)("TABLE", expressions_1.Source);
13554
13576
  const ret = (0, combi_1.seq)("INSERT", (0, combi_1.altPrio)(tab, (0, combi_1.seq)((0, combi_1.altPrio)(initial, lines, src), foo)));
13555
13577
  return ret;
@@ -28044,7 +28066,7 @@ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@ab
28044
28066
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
28045
28067
  class ValueBody {
28046
28068
  static runSyntax(node, input, targetType) {
28047
- var _a;
28069
+ var _a, _b;
28048
28070
  if (node === undefined) {
28049
28071
  return targetType;
28050
28072
  }
@@ -28077,6 +28099,9 @@ class ValueBody {
28077
28099
  for (const s of node.findDirectExpressions(Expressions.Source)) {
28078
28100
  type = source_1.Source.runSyntax(s, input, type);
28079
28101
  }
28102
+ for (const s of ((_b = node.findDirectExpression(Expressions.ValueBase)) === null || _b === void 0 ? void 0 : _b.findDirectExpressions(Expressions.Source)) || []) {
28103
+ type = source_1.Source.runSyntax(s, input, type);
28104
+ }
28080
28105
  for (const foo of node.findDirectExpressions(Expressions.ValueBodyLine)) {
28081
28106
  if (!(targetType instanceof basic_1.TableType)
28082
28107
  && !(targetType instanceof basic_1.UnknownType)
@@ -53687,7 +53712,7 @@ class Registry {
53687
53712
  }
53688
53713
  static abaplintVersion() {
53689
53714
  // magic, see build script "version.sh"
53690
- return "2.113.166";
53715
+ return "2.113.167";
53691
53716
  }
53692
53717
  getDDICReferences() {
53693
53718
  return this.ddicReferences;
@@ -61022,7 +61047,7 @@ ${indentation} output = ${uniqueName}.\n`;
61022
61047
  return undefined;
61023
61048
  }
61024
61049
  outlineValue(low, high, lowFile, highSyntax) {
61025
- var _a, _b, _c;
61050
+ var _a, _b, _c, _d;
61026
61051
  if (!(low.get() instanceof _statement_1.Unknown)) {
61027
61052
  return undefined;
61028
61053
  }
@@ -61048,7 +61073,7 @@ ${indentation} output = ${uniqueName}.\n`;
61048
61073
  const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
61049
61074
  let indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
61050
61075
  let body = "";
61051
- const base = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findExpressionAfterToken("BASE");
61076
+ const base = (_b = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectExpression(Expressions.ValueBase)) === null || _b === void 0 ? void 0 : _b.findExpressionAfterToken("BASE");
61052
61077
  if (base) {
61053
61078
  body += indentation + uniqueName + " = " + base.concatTokens() + ".\n";
61054
61079
  }
@@ -61117,7 +61142,7 @@ ${indentation} output = ${uniqueName}.\n`;
61117
61142
  }
61118
61143
  }
61119
61144
  }
61120
- if (body === "" && ((_b = valueBody === null || valueBody === void 0 ? void 0 : valueBody.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase()) === "OPTIONAL") {
61145
+ if (body === "" && ((_c = valueBody === null || valueBody === void 0 ? void 0 : valueBody.getLastChild()) === null || _c === void 0 ? void 0 : _c.getFirstToken().getStr().toUpperCase()) === "OPTIONAL") {
61121
61146
  const fieldChain = valueBody.findFirstExpression(Expressions.FieldChain);
61122
61147
  const rowName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
61123
61148
  let tableExpression = undefined;
@@ -61136,7 +61161,7 @@ ${indentation} output = ${uniqueName}.\n`;
61136
61161
  }
61137
61162
  let condition = "";
61138
61163
  if ((tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.getChildren().length) === 3) {
61139
- condition = "INDEX " + ((_c = tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens());
61164
+ condition = "INDEX " + ((_d = tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.findDirectExpression(Expressions.Source)) === null || _d === void 0 ? void 0 : _d.concatTokens());
61140
61165
  }
61141
61166
  else {
61142
61167
  condition = "WITH KEY " + (tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.concatTokens().replace("[ ", "").replace(" ]", ""));
@@ -80096,11 +80121,7 @@ class SourceTranspiler {
80096
80121
  ret.appendString(")");
80097
80122
  }
80098
80123
  else if (c.get() instanceof core_1.Expressions.ValueBody) {
80099
- const typ = node.findFirstExpression(core_1.Expressions.TypeNameOrInfer);
80100
- if (typ === undefined) {
80101
- throw new Error("TypeNameOrInfer not found in ValueBody");
80102
- }
80103
- ret.appendChunk(new value_body_1.ValueBodyTranspiler().transpile(typ, c, traversal));
80124
+ continue;
80104
80125
  }
80105
80126
  else {
80106
80127
  ret.appendString("SourceUnknown-" + c.get().constructor.name);
@@ -80117,6 +80138,20 @@ class SourceTranspiler {
80117
80138
  ret.append("abap.builtin.boolc(", c, traversal);
80118
80139
  post.append(")", c, traversal);
80119
80140
  }
80141
+ else if (c instanceof core_1.Nodes.TokenNode && c.getFirstToken().getStr().toUpperCase() === "VALUE") {
80142
+ const typ = node.findDirectExpression(core_1.Expressions.TypeNameOrInfer);
80143
+ if (typ === undefined) {
80144
+ throw new Error("TypeNameOrInfer not found in ValueBody");
80145
+ }
80146
+ const valueBody = node.findDirectExpression(core_1.Expressions.ValueBody);
80147
+ if (valueBody) {
80148
+ ret.appendChunk(new value_body_1.ValueBodyTranspiler().transpile(typ, valueBody, traversal));
80149
+ }
80150
+ else {
80151
+ const context = new _1.TypeNameOrInfer().findType(typ, traversal);
80152
+ ret.appendString(transpile_types_1.TranspileTypes.toType(context));
80153
+ }
80154
+ }
80120
80155
  else if (c instanceof core_1.Nodes.TokenNode && c.getFirstToken().getStr().toUpperCase() === "REF") {
80121
80156
  const infer = node.findDirectExpression(core_1.Expressions.TypeNameOrInfer);
80122
80157
  if (infer?.concatTokens() !== "#") {
@@ -81175,7 +81210,7 @@ class ValueBodyTranspiler {
81175
81210
  if (!(typ.get() instanceof core_1.Expressions.TypeNameOrInfer)) {
81176
81211
  throw new Error("ValueBodyTranspiler, Expected TypeNameOrInfer");
81177
81212
  }
81178
- const ret = new chunk_1.Chunk().appendString(new type_name_or_infer_1.TypeNameOrInfer().transpile(typ, traversal).getCode());
81213
+ let ret = new chunk_1.Chunk().appendString(new type_name_or_infer_1.TypeNameOrInfer().transpile(typ, traversal).getCode());
81179
81214
  const context = new type_name_or_infer_1.TypeNameOrInfer().findType(typ, traversal);
81180
81215
  const hasLines = body.findDirectExpression(core_1.Expressions.ValueBodyLine) !== undefined;
81181
81216
  let extraFields = "";
@@ -81189,6 +81224,10 @@ class ValueBodyTranspiler {
81189
81224
  extraFields += transpiled;
81190
81225
  }
81191
81226
  }
81227
+ else if (child.get() instanceof core_1.Expressions.ValueBase && child instanceof core_1.Nodes.ExpressionNode) {
81228
+ const source = traversal.traverse(child.findDirectExpression(core_1.Expressions.Source));
81229
+ ret = new chunk_1.Chunk().appendString(source.getCode() + ".clone()");
81230
+ }
81192
81231
  else if (child.get() instanceof core_1.Expressions.ValueBodyLine && child instanceof core_1.Nodes.ExpressionNode) {
81193
81232
  if (!(context instanceof core_1.BasicTypes.TableType)) {
81194
81233
  throw new Error("ValueBodyTranspiler, Expected BasicTypes");
@@ -81197,7 +81236,7 @@ class ValueBodyTranspiler {
81197
81236
  ret.appendString(new value_body_line_1.ValueBodyLineTranspiler().transpile(rowType, child, traversal, extraFields).getCode());
81198
81237
  }
81199
81238
  else {
81200
- throw new Error("ValueBodyTranspiler, unknown " + child.get().constructor.name + " " + child.concatTokens());
81239
+ throw new Error("ValueBodyTranspiler, unknown " + child.get().constructor.name + " \"" + child.concatTokens()) + "\"";
81201
81240
  }
81202
81241
  }
81203
81242
  return ret;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.11.21",
3
+ "version": "2.11.22",
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.166",
31
- "@abaplint/transpiler": "^2.11.21",
30
+ "@abaplint/core": "^2.113.167",
31
+ "@abaplint/transpiler": "^2.11.22",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.2.1",
34
34
  "@types/progress": "^2.0.7",