@abaplint/transpiler-cli 2.13.15 → 2.13.17

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.
package/abap_transpile CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  require("./build/bundle");
package/build/bundle.js CHANGED
@@ -6602,8 +6602,9 @@ class SelectLoop extends combi_1.Expression {
6602
6602
  const into = (0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList);
6603
6603
  const perm = (0, combi_1.per)(_1.SQLFrom, where, sql_up_to_1.SQLUpTo, sql_order_by_1.SQLOrderBy, sql_having_1.SQLHaving, _1.SQLClient, bypass, _1.SQLGroupBy, _1.SQLForAllEntries, _1.DatabaseConnection, (0, combi_1.alt)(tab, sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList, packTab));
6604
6604
  const strict = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.ver)(version_1.Version.v750, sql_fields_loop_1.SQLFieldsLoop), (0, combi_1.optPrio)(_1.SQLForAllEntries), (0, combi_1.optPrio)((0, combi_1.seq)(where, (0, combi_1.optPrio)(sql_order_by_1.SQLOrderBy), into, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo))));
6605
- const aggr = (0, combi_1.seq)((0, combi_1.plusPrio)(_1.SQLAggregation), into, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), _1.SQLFrom, (0, combi_1.optPrio)(_1.SQLClient), (0, combi_1.optPrio)(where), _1.SQLGroupBy);
6606
- const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), sql_field_list_loop_1.SQLFieldListLoop, perm), strict, aggr), (0, combi_1.optPrio)(sql_hints_1.SQLHints));
6605
+ const aggrIntoBeforeFrom = (0, combi_1.seq)((0, combi_1.plusPrio)(_1.SQLAggregation), into, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), _1.SQLFrom, (0, combi_1.optPrio)(_1.SQLClient), (0, combi_1.optPrio)(where), _1.SQLGroupBy);
6606
+ const aggrIntoAfterFrom = (0, combi_1.seq)((0, combi_1.plusPrio)(_1.SQLAggregation), _1.SQLFrom, (0, combi_1.optPrio)(_1.SQLClient), into, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), (0, combi_1.optPrio)(where), _1.SQLGroupBy);
6607
+ const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), sql_field_list_loop_1.SQLFieldListLoop, perm), strict, aggrIntoBeforeFrom, aggrIntoAfterFrom), (0, combi_1.optPrio)(sql_hints_1.SQLHints));
6607
6608
  return ret;
6608
6609
  }
6609
6610
  }
@@ -7090,7 +7091,7 @@ class SQLCase extends combi_1.Expression {
7090
7091
  const val = (0, combi_1.altPrio)(sql_cond_1.SQLCond, constant_1.Constant, abap);
7091
7092
  const when = (0, combi_1.seq)("WHEN", val, "THEN", sourc, (0, combi_1.starPrio)(sub));
7092
7093
  const els = (0, combi_1.seq)("ELSE", sourc);
7093
- return (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("CASE", (0, combi_1.opt)((0, combi_1.altPrio)(sql_field_name_1.SQLFieldName, abap)), (0, combi_1.plusPrio)(when), (0, combi_1.optPrio)(els), "END"));
7094
+ return (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("CASE", (0, combi_1.opt)((0, combi_1.altPrio)(sql_field_name_1.SQLFieldName, abap)), (0, combi_1.plusPrio)(when), (0, combi_1.optPrio)(els), "END"), version_1.Version.OpenABAP);
7094
7095
  }
7095
7096
  }
7096
7097
  exports.SQLCase = SQLCase;
@@ -7308,9 +7309,12 @@ exports.SQLFieldList = void 0;
7308
7309
  const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
7309
7310
  const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
7310
7311
  const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
7312
+ const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
7311
7313
  class SQLFieldList extends combi_1.Expression {
7312
7314
  getRunnable() {
7313
- const nev = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.SQLField)), version_1.Version.OpenABAP);
7315
+ const as = (0, combi_1.seq)("AS", _1.SQLAsName);
7316
+ const commaParenField = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.SQLFieldName, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.WParenRight)), (0, combi_1.optPrio)(as));
7317
+ const nev = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.starPrio)((0, combi_1.seq)(",", (0, combi_1.altPrio)(_1.SQLField, commaParenField))), version_1.Version.OpenABAP);
7314
7318
  const old = (0, combi_1.starPrio)(_1.SQLField);
7315
7319
  return (0, combi_1.altPrio)("*", _1.Dynamic, (0, combi_1.seq)(_1.SQLField, (0, combi_1.alt)(nev, old)));
7316
7320
  }
@@ -7459,14 +7463,15 @@ class SQLFrom extends combi_1.Expression {
7459
7463
  const joins = (0, combi_1.starPrio)((0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), _1.SQLJoin));
7460
7464
  // No opening parens
7461
7465
  const from0 = (0, combi_1.seq)("FROM", _1.SQLFromSource, joins);
7462
- // 1 to 6 opening parens, with up to that many closing parens at the end
7466
+ // 1 to 7 opening parens, with up to that many closing parens at the end
7463
7467
  const from1 = (0, combi_1.seq)("FROM", (0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFromSource, joins, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)));
7464
7468
  const from2 = (0, combi_1.seq)("FROM", (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFromSource, joins, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)));
7465
7469
  const from3 = (0, combi_1.seq)("FROM", (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFromSource, joins, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)));
7466
7470
  const from4 = (0, combi_1.seq)("FROM", (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFromSource, joins, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)));
7467
7471
  const from5 = (0, combi_1.seq)("FROM", (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFromSource, joins, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)));
7468
7472
  const from6 = (0, combi_1.seq)("FROM", (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFromSource, joins, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)));
7469
- const source = (0, combi_1.altPrio)(from6, from5, from4, from3, from2, from1, from0);
7473
+ const from7 = (0, combi_1.seq)("FROM", (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFromSource, joins, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)));
7474
+ const source = (0, combi_1.altPrio)(from7, from6, from5, from4, from3, from2, from1, from0);
7470
7475
  return source;
7471
7476
  }
7472
7477
  }
@@ -7548,7 +7553,9 @@ class SQLFunction extends combi_1.Expression {
7548
7553
  const dats_add_months = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)((0, combi_1.regex)(/^dats_add_months$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
7549
7554
  const ltrim = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^ltrim$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
7550
7555
  const rtrim = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^rtrim$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
7551
- return (0, combi_1.altPrio)(uuid, abs, ceil, floor, cast, div, mod, coalesce, concat, replace, length, lower, upper, round, concat_with_space, ltrim, rtrim, substring, dats_is_valid, dats_days_between, dats_add_days, dats_add_months);
7556
+ const right = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^right$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
7557
+ const left = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.regex)(/^left$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
7558
+ return (0, combi_1.altPrio)(uuid, abs, ceil, floor, cast, div, mod, coalesce, concat, replace, length, lower, upper, round, concat_with_space, ltrim, rtrim, right, left, substring, dats_is_valid, dats_days_between, dats_add_days, dats_add_months);
7552
7559
  }
7553
7560
  }
7554
7561
  exports.SQLFunction = SQLFunction;
@@ -22439,6 +22446,8 @@ var ScopeType;
22439
22446
  (function (ScopeType) {
22440
22447
  ScopeType["BuiltIn"] = "_builtin";
22441
22448
  ScopeType["Dummy"] = "_dummy";
22449
+ // definitions inside this one are local
22450
+ ScopeType["SelectionEvent"] = "selection_event";
22442
22451
  ScopeType["Global"] = "_global";
22443
22452
  ScopeType["Program"] = "_program";
22444
22453
  ScopeType["TypePool"] = "_type_pool";
@@ -22920,7 +22929,15 @@ class TypeUtils {
22920
22929
  }
22921
22930
  }
22922
22931
  else if (source instanceof basic_1.TableType) {
22923
- if (target instanceof basic_1.TableType) {
22932
+ if (source.getRowType() instanceof basic_1.AnyType) {
22933
+ // then its a generic table, todo: add top level generic table type?
22934
+ return true;
22935
+ }
22936
+ else if (target instanceof basic_1.TableType && target.getRowType() instanceof basic_1.AnyType) {
22937
+ // then its a generic table, todo: add top level generic table type?
22938
+ return true;
22939
+ }
22940
+ else if (target instanceof basic_1.TableType) {
22924
22941
  const sourceKeyType = source.getOptions().keyType;
22925
22942
  const targetKeyType = target.getOptions().keyType;
22926
22943
  if (sourceKeyType !== targetKeyType
@@ -27500,7 +27517,7 @@ class Select {
27500
27517
  if (type === undefined) {
27501
27518
  return basic_1.VoidType.get("SELECT_todo6");
27502
27519
  }
27503
- components.push({ name: field.code, type });
27520
+ components.push({ name: field.as || field.code, type });
27504
27521
  }
27505
27522
  return new basic_1.TableType(new basic_1.StructureType(components), tableOptions, undefined);
27506
27523
  }
@@ -27512,6 +27529,9 @@ class Select {
27512
27529
  const ret = [];
27513
27530
  if (node.get() instanceof Expressions.SelectLoop) {
27514
27531
  expr = node.findFirstExpression(Expressions.SQLFieldListLoop);
27532
+ if (expr === undefined) {
27533
+ expr = node;
27534
+ }
27515
27535
  }
27516
27536
  else {
27517
27537
  expr = node.findFirstExpression(Expressions.SQLFieldList);
@@ -27519,7 +27539,8 @@ class Select {
27519
27539
  if (((_a = expr === null || expr === void 0 ? void 0 : expr.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
27520
27540
  dynamic_1.Dynamic.runSyntax(expr.getFirstChild(), input);
27521
27541
  }
27522
- for (const field of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressionsMulti([Expressions.SQLField, Expressions.SQLFieldName])) || []) {
27542
+ // eslint-disable-next-line max-len
27543
+ for (const field of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressionsMulti([Expressions.SQLField, Expressions.SQLFieldName, Expressions.SQLAggregation])) || []) {
27523
27544
  let code = field.concatTokens().toUpperCase();
27524
27545
  const as = ((_b = field.findDirectExpression(Expressions.SQLAsName)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
27525
27546
  if (as !== "") {
@@ -27608,6 +27629,7 @@ const assert_error_1 = __webpack_require__(/*! ../assert_error */ "./node_module
27608
27629
  // TODO: refactor all these method parameters to objects, this is getting messy
27609
27630
  class Source {
27610
27631
  static runSyntax(node, input, targetType, writeReference = false, allowGenericDeference = false) {
27632
+ var _a;
27611
27633
  if (node === undefined) {
27612
27634
  return undefined;
27613
27635
  }
@@ -27685,12 +27707,13 @@ class Source {
27685
27707
  {
27686
27708
  const foundType = this.determineType(node, input, targetType);
27687
27709
  const bodyType = conv_body_1.ConvBody.runSyntax(node.findDirectExpression(Expressions.ConvBody), input);
27710
+ const inferred = (_a = node.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.concatTokens();
27688
27711
  if (new _type_utils_1.TypeUtils(input.scope).isConvable(foundType, bodyType) === false) {
27689
27712
  const message = `CONV: Types not compatible, ${foundType === null || foundType === void 0 ? void 0 : foundType.constructor.name}, ${bodyType === null || bodyType === void 0 ? void 0 : bodyType.constructor.name}`;
27690
27713
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
27691
27714
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
27692
27715
  }
27693
- else if (foundType === null || foundType === void 0 ? void 0 : foundType.isGeneric()) {
27716
+ else if ((foundType === null || foundType === void 0 ? void 0 : foundType.isGeneric()) && inferred !== "#") {
27694
27717
  const message = "Cannot CONV to generic type";
27695
27718
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
27696
27719
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
@@ -31706,6 +31729,42 @@ exports.GetParameter = GetParameter;
31706
31729
 
31707
31730
  /***/ },
31708
31731
 
31732
+ /***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/get_pf_status.js"
31733
+ /*!*****************************************************************************************!*\
31734
+ !*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/get_pf_status.js ***!
31735
+ \*****************************************************************************************/
31736
+ (__unused_webpack_module, exports, __webpack_require__) {
31737
+
31738
+ "use strict";
31739
+
31740
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
31741
+ exports.GetPFStatus = void 0;
31742
+ const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
31743
+ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
31744
+ const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
31745
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
31746
+ const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js");
31747
+ class GetPFStatus {
31748
+ runSyntax(node, input) {
31749
+ for (const s of node.findDirectExpressions(Expressions.Source)) {
31750
+ source_1.Source.runSyntax(s, input);
31751
+ }
31752
+ for (const t of node.findDirectExpressions(Expressions.Target)) {
31753
+ const inline = t === null || t === void 0 ? void 0 : t.findDirectExpression(Expressions.InlineData);
31754
+ if (inline) {
31755
+ inline_data_1.InlineData.runSyntax(inline, input, basic_1.VoidType.get("GET_PF_STATUS"));
31756
+ }
31757
+ else {
31758
+ target_1.Target.runSyntax(t, input);
31759
+ }
31760
+ }
31761
+ }
31762
+ }
31763
+ exports.GetPFStatus = GetPFStatus;
31764
+ //# sourceMappingURL=get_pf_status.js.map
31765
+
31766
+ /***/ },
31767
+
31709
31768
  /***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/get_reference.js"
31710
31769
  /*!*****************************************************************************************!*\
31711
31770
  !*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/get_reference.js ***!
@@ -32996,16 +33055,21 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modu
32996
33055
  const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
32997
33056
  class Parameter {
32998
33057
  runSyntax(node, input) {
32999
- var _a;
33000
- const nameToken = (_a = node.findFirstExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
33058
+ const nameExpression = node.findFirstExpression(Expressions.FieldSub);
33059
+ if (nameExpression === undefined) {
33060
+ return;
33061
+ }
33062
+ let nameToken = nameExpression.getFirstToken();
33063
+ // FieldSub can include dashes and optional length, eg p-tcode or p_table(4).
33064
+ if (nameExpression.getChildren().length > 1) {
33065
+ const fullName = nameExpression.concatTokens().replace(/\(.+$/, "").replace(/\[\]$/, "");
33066
+ nameToken = new tokens_1.Identifier(nameToken.getStart(), fullName);
33067
+ }
33001
33068
  if (nameToken && nameToken.getStr().length > 8) {
33002
33069
  const message = "Parameter name too long, " + nameToken.getStr();
33003
33070
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
33004
33071
  return;
33005
33072
  }
33006
- else if (nameToken === undefined) {
33007
- return;
33008
- }
33009
33073
  if (node.findDirectTokenByText("RADIOBUTTON") && node.findDirectTokenByText("LENGTH")) {
33010
33074
  const message = "RADIOBUTTON and LENGTH not possible together";
33011
33075
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
@@ -33812,23 +33876,28 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modu
33812
33876
  const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
33813
33877
  class SelectOption {
33814
33878
  runSyntax(node, input) {
33815
- var _a;
33816
- const nameToken = (_a = node.findFirstExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
33879
+ const nameExpression = node.findFirstExpression(Expressions.FieldSub);
33880
+ if (nameExpression === undefined) {
33881
+ return;
33882
+ }
33883
+ let nameToken = nameExpression.getFirstToken();
33884
+ // FieldSub can include dashes and optional length, eg s-matnr or s_name(10).
33885
+ if (nameExpression.getChildren().length > 1) {
33886
+ const fullName = nameExpression.concatTokens().replace(/\(.+$/, "").replace(/\[\]$/, "");
33887
+ nameToken = new tokens_1.Identifier(nameToken.getStart(), fullName);
33888
+ }
33817
33889
  if (nameToken && nameToken.getStr().length > 8) {
33818
33890
  const message = "Select-option name too long, " + nameToken.getStr();
33819
33891
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameToken, message));
33820
33892
  return;
33821
33893
  }
33822
- else if (nameToken === undefined) {
33823
- return;
33824
- }
33825
33894
  for (const d of node.findDirectExpressions(Expressions.Dynamic)) {
33826
33895
  dynamic_1.Dynamic.runSyntax(d, input);
33827
33896
  input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, basic_1.VoidType.get("DYNAMIC_SELECT_OPTION")));
33828
33897
  return;
33829
33898
  }
33830
- const nameExpression = node.findFirstExpression(Expressions.FieldChain);
33831
- let found = new basic_types_1.BasicTypes(input).resolveLikeName(nameExpression);
33899
+ const nameChain = node.findFirstExpression(Expressions.FieldChain);
33900
+ let found = new basic_types_1.BasicTypes(input).resolveLikeName(nameChain);
33832
33901
  if (found) {
33833
33902
  if (found instanceof basic_1.StructureType) {
33834
33903
  let length = 0;
@@ -34751,6 +34820,7 @@ const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ ".
34751
34820
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
34752
34821
  const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js");
34753
34822
  const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
34823
+ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
34754
34824
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
34755
34825
  class WhenType {
34756
34826
  runSyntax(node, input) {
@@ -34760,19 +34830,21 @@ class WhenType {
34760
34830
  return undefined;
34761
34831
  }
34762
34832
  let type = undefined;
34763
- const className = nameToken.getStr();
34764
- const found = input.scope.findObjectDefinition(className);
34765
- if (found === undefined && input.scope.getDDIC().inErrorNamespace(className) === false) {
34833
+ const className = nameToken.getStr().toUpperCase();
34834
+ const found = input.scope.existsObject(className);
34835
+ if (found === null || found === void 0 ? void 0 : found.id) {
34836
+ type = new basic_1.ObjectReferenceType(found.id);
34837
+ input.scope.addReference(nameToken, found.id, _reference_1.ReferenceType.ObjectOrientedReference, input.filename);
34838
+ }
34839
+ else if (input.scope.getDDIC().inErrorNamespace(className) === false) {
34766
34840
  type = basic_1.VoidType.get(className);
34841
+ input.scope.addReference(nameToken, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, input.filename, { ooName: className, ooType: "Void" });
34767
34842
  }
34768
- else if (found === undefined) {
34843
+ else {
34769
34844
  const message = "Class " + className + " not found";
34770
34845
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameToken, message));
34771
34846
  return;
34772
34847
  }
34773
- else {
34774
- type = new basic_1.ObjectReferenceType(found);
34775
- }
34776
34848
  const target = node === null || node === void 0 ? void 0 : node.findDirectExpression(Expressions.Target);
34777
34849
  const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
34778
34850
  if (inline) {
@@ -35523,6 +35595,7 @@ const read_report_1 = __webpack_require__(/*! ./statements/read_report */ "./nod
35523
35595
  const authority_check_1 = __webpack_require__(/*! ./statements/authority_check */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/authority_check.js");
35524
35596
  const insert_report_1 = __webpack_require__(/*! ./statements/insert_report */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/insert_report.js");
35525
35597
  const get_reference_1 = __webpack_require__(/*! ./statements/get_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/get_reference.js");
35598
+ const get_pf_status_1 = __webpack_require__(/*! ./statements/get_pf_status */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/get_pf_status.js");
35526
35599
  const insert_database_1 = __webpack_require__(/*! ./statements/insert_database */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/insert_database.js");
35527
35600
  const delete_database_1 = __webpack_require__(/*! ./statements/delete_database */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/delete_database.js");
35528
35601
  const import_dynpro_1 = __webpack_require__(/*! ./statements/import_dynpro */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/import_dynpro.js");
@@ -35591,6 +35664,7 @@ const commit_entities_1 = __webpack_require__(/*! ./statements/commit_entities *
35591
35664
  const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
35592
35665
  const assert_error_1 = __webpack_require__(/*! ./assert_error */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/assert_error.js");
35593
35666
  const field_group_1 = __webpack_require__(/*! ./statements/field_group */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/field_group.js");
35667
+ const stuff_1 = __webpack_require__(/*! ../../stuff */ "./node_modules/@abaplint/core/build/src/stuff.js");
35594
35668
  // -----------------------------------
35595
35669
  const map = {};
35596
35670
  function addToMap(handler) {
@@ -35676,6 +35750,7 @@ if (Object.keys(map).length === 0) {
35676
35750
  addToMap(new if_1.If());
35677
35751
  addToMap(new log_point_1.LogPoint());
35678
35752
  addToMap(new while_1.While());
35753
+ addToMap(new get_pf_status_1.GetPFStatus());
35679
35754
  addToMap(new with_1.With());
35680
35755
  addToMap(new with_loop_1.WithLoop());
35681
35756
  addToMap(new call_transformation_1.CallTransformation());
@@ -35844,6 +35919,9 @@ class SyntaxLogic {
35844
35919
  updateScopeStructure(node) {
35845
35920
  const filename = this.currentFile.getFilename();
35846
35921
  const stru = node.get();
35922
+ if (this.scope.getType() === _scope_type_1.ScopeType.SelectionEvent && this.isSelectionEventBoundaryStructure(stru)) {
35923
+ this.scope.pop(node.getFirstToken().getStart());
35924
+ }
35847
35925
  const input = {
35848
35926
  scope: this.scope,
35849
35927
  filename,
@@ -35883,6 +35961,7 @@ class SyntaxLogic {
35883
35961
  updateScopeStatement(node) {
35884
35962
  const filename = this.currentFile.getFilename();
35885
35963
  const s = node.get();
35964
+ this.updateSelectionEventScope(node);
35886
35965
  const input = {
35887
35966
  scope: this.scope,
35888
35967
  filename,
@@ -35928,6 +36007,28 @@ class SyntaxLogic {
35928
36007
  }
35929
36008
  }
35930
36009
  }
36010
+ updateSelectionEventScope(node) {
36011
+ const statement = node.get();
36012
+ if (this.scope.getType() === _scope_type_1.ScopeType.SelectionEvent && this.isSelectionEventBoundary(statement)) {
36013
+ this.scope.pop(node.getFirstToken().getStart());
36014
+ }
36015
+ if (this.opensSelectionEventScope(statement)) {
36016
+ this.scope.push(_scope_type_1.ScopeType.SelectionEvent, statement.constructor.name, node.getFirstToken().getStart(), this.currentFile.getFilename());
36017
+ }
36018
+ }
36019
+ opensSelectionEventScope(statement) {
36020
+ return statement instanceof Statements.AtSelectionScreen;
36021
+ }
36022
+ isSelectionEventBoundary(statement) {
36023
+ return stuff_1.SELECTION_EVENTS.some(event => statement instanceof event)
36024
+ || statement instanceof Statements.Form
36025
+ || statement instanceof Statements.Module
36026
+ || statement instanceof Statements.FunctionModule;
36027
+ }
36028
+ isSelectionEventBoundaryStructure(structure) {
36029
+ return structure instanceof Structures.ClassDefinition
36030
+ || structure instanceof Structures.Interface;
36031
+ }
35931
36032
  }
35932
36033
  exports.SyntaxLogic = SyntaxLogic;
35933
36034
  //# sourceMappingURL=syntax.js.map
@@ -39252,7 +39353,7 @@ class ClassDefinition extends _identifier_1.Identifier {
39252
39353
  input.scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, input.filename);
39253
39354
  }
39254
39355
  else {
39255
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, name.toUpperCase() + " does not exist"));
39356
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, "Friend class " + name.toUpperCase() + " does not exist"));
39256
39357
  }
39257
39358
  result.push(name);
39258
39359
  }
@@ -55053,7 +55154,7 @@ class Registry {
55053
55154
  }
55054
55155
  static abaplintVersion() {
55055
55156
  // magic, see build script "version.sh"
55056
- return "2.119.1";
55157
+ return "2.119.11";
55057
55158
  }
55058
55159
  getDDICReferences() {
55059
55160
  return this.ddicReferences;
@@ -67589,6 +67690,7 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
67589
67690
  const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
67590
67691
  const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
67591
67692
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
67693
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
67592
67694
  class KeepSingleParameterCallsOnOneLineConf extends _basic_rule_config_1.BasicRuleConfig {
67593
67695
  constructor() {
67594
67696
  super(...arguments);
@@ -67608,7 +67710,7 @@ class KeepSingleParameterCallsOnOneLine extends _abap_rule_1.ABAPRule {
67608
67710
  title: "Keep single parameters on one line",
67609
67711
  shortDescription: `Keep single parameter calls on one line`,
67610
67712
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-single-parameter-calls-on-one-line`,
67611
- tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
67713
+ tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
67612
67714
  badExample: `call_method(\n 2 ).`,
67613
67715
  goodExample: `call_method( 2 ).`,
67614
67716
  };
@@ -67684,7 +67786,8 @@ class KeepSingleParameterCallsOnOneLine extends _abap_rule_1.ABAPRule {
67684
67786
  }
67685
67787
  }
67686
67788
  const message = "Keep single parameter on one line";
67687
- return [issue_1.Issue.atToken(file, c.getFirstToken(), message, this.getMetadata().key, this.conf.severity)];
67789
+ const fix = edit_helper_1.EditHelper.replaceRange(file, c.getFirstToken().getStart(), c.getLastToken().getEnd(), c.concatTokens());
67790
+ return [issue_1.Issue.atToken(file, c.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix)];
67688
67791
  }
67689
67792
  return [];
67690
67793
  }
@@ -68775,6 +68878,7 @@ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/co
68775
68878
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
68776
68879
  const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
68777
68880
  const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
68881
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
68778
68882
  const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
68779
68883
  const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
68780
68884
  const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
@@ -68792,6 +68896,7 @@ class MainFileContents {
68792
68896
  key: "main_file_contents",
68793
68897
  title: "Main file contents",
68794
68898
  shortDescription: `Checks related to report declarations.`,
68899
+ tags: [_irule_1.RuleTag.Syntax],
68795
68900
  extendedInformation: `Does not run if the target version is Cloud
68796
68901
 
68797
68902
  * PROGs must begin with "REPORT <name>." or "PROGRAM <name>.
@@ -72552,6 +72657,19 @@ This rule makes sure the spaces are consistently required across the language.`,
72552
72657
  return issues;
72553
72658
  }
72554
72659
  missingSpace(statement) {
72660
+ {
72661
+ const tokens = statement.getTokens();
72662
+ for (let i = 1; i < tokens.length; i++) {
72663
+ const prev = tokens[i - 1];
72664
+ const current = tokens[i];
72665
+ if (prev.getStr() === ")"
72666
+ && current.getStr() === "="
72667
+ && prev.getRow() === current.getRow()
72668
+ && prev.getEnd().getCol() === current.getStart().getCol()) {
72669
+ return current.getStart();
72670
+ }
72671
+ }
72672
+ }
72555
72673
  const found = statement.findAllExpressionsMulti([
72556
72674
  Expressions.CondSub, Expressions.SQLCond, Expressions.ValueBodyLine,
72557
72675
  Expressions.NewObject, Expressions.Cond, Expressions.ComponentCond,
@@ -95397,6 +95515,25 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
95397
95515
  static setValues(identifier, name) {
95398
95516
  const val = identifier.getValue();
95399
95517
  let ret = "";
95518
+ // abaplint can use this sentinel for enum-like class constants. Synthesize
95519
+ // deterministic member values so the enum fields have distinct runtime values.
95520
+ if (val === "novalueClassAttributeEnum") {
95521
+ const type = identifier.getType();
95522
+ if (type instanceof abaplint.BasicTypes.StructureType) {
95523
+ let index = 0;
95524
+ for (const component of type.getComponents()) {
95525
+ const fieldName = component.name.toLowerCase();
95526
+ ret += Traversal.prefixVariable(name)
95527
+ + ".get()["
95528
+ + JSON.stringify(fieldName)
95529
+ + "].set("
95530
+ + index
95531
+ + ");\n";
95532
+ index++;
95533
+ }
95534
+ }
95535
+ return ret;
95536
+ }
95400
95537
  const handle = (val, name) => {
95401
95538
  if (typeof val === "string") {
95402
95539
  const e = expressions_1.ConstantTranspiler.escape(val);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.13.15",
3
+ "version": "2.13.17",
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.119.1",
31
- "@abaplint/transpiler": "^2.13.15",
30
+ "@abaplint/core": "^2.119.11",
31
+ "@abaplint/transpiler": "^2.13.17",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.12.2",
34
34
  "@types/progress": "^2.0.7",