@abaplint/cli 2.120.110 → 2.120.111

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/cli.js +726 -35
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -12209,7 +12209,7 @@ class AuthorityCheck {
12209
12209
  getMatcher() {
12210
12210
  const field = (0, combi_1.seq)("FIELD", expressions_1.Source);
12211
12211
  const id = (0, combi_1.seq)("ID", expressions_1.Source, (0, combi_1.alt)(field, "DUMMY"));
12212
- const ret = (0, combi_1.seq)("AUTHORITY-CHECK OBJECT", expressions_1.Source, (0, combi_1.opt)((0, combi_1.seq)("FOR USER", expressions_1.Source)), (0, combi_1.plus)(id));
12212
+ const ret = (0, combi_1.seq)("AUTHORITY-CHECK OBJECT", expressions_1.Source, (0, combi_1.opt)((0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, (0, combi_1.seq)("FOR USER", expressions_1.Source))), (0, combi_1.plus)(id));
12213
12213
  return (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, ret);
12214
12214
  }
12215
12215
  }
@@ -13102,7 +13102,7 @@ const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src
13102
13102
  class Commit {
13103
13103
  getMatcher() {
13104
13104
  const work = (0, combi_1.seq)("WORK", (0, combi_1.opt)("AND WAIT"));
13105
- return (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("COMMIT", (0, combi_1.alt)(work, expressions_1.DatabaseConnection)));
13105
+ return (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("COMMIT", (0, combi_1.alt)(work, (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, expressions_1.DatabaseConnection))));
13106
13106
  }
13107
13107
  }
13108
13108
  exports.Commit = Commit;
@@ -13411,9 +13411,9 @@ class Convert {
13411
13411
  const tim = (0, combi_1.seq)("TIME", expressions_1.Source);
13412
13412
  const stamp = (0, combi_1.seq)("INTO TIME STAMP", expressions_1.Target);
13413
13413
  const intoutc = (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("INTO UTCLONG", expressions_1.Target), { also: combi_1.AlsoIn.OpenABAP });
13414
- const invert = (0, combi_1.seq)("INTO INVERTED-DATE", expressions_1.Target);
13414
+ const invert = (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, (0, combi_1.seq)("INTO INVERTED-DATE", expressions_1.Target));
13415
13415
  const date = (0, combi_1.seq)((0, combi_1.per)(dat, tim), (0, combi_1.per)(daylightSource, stamp, zone, invert, intoutc));
13416
- const inv = (0, combi_1.seq)("INVERTED-DATE", expressions_1.Source, "INTO DATE", expressions_1.Target);
13416
+ const inv = (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, (0, combi_1.seq)("INVERTED-DATE", expressions_1.Source, "INTO DATE", expressions_1.Target));
13417
13417
  const utclong = (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("UTCLONG", expressions_1.Source, (0, combi_1.per)(zone, into, daylightTarget)), { also: combi_1.AlsoIn.OpenABAP });
13418
13418
  return (0, combi_1.seq)("CONVERT", (0, combi_1.alt)(time, date, inv, utclong));
13419
13419
  }
@@ -13981,13 +13981,14 @@ exports.Divide = Divide;
13981
13981
  Object.defineProperty(exports, "__esModule", ({ value: true }));
13982
13982
  exports.Do = void 0;
13983
13983
  const combi_1 = __webpack_require__(/*! ../combi */ "../core/build/src/abap/2_statements/combi.js");
13984
+ const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
13984
13985
  const expressions_1 = __webpack_require__(/*! ../expressions */ "../core/build/src/abap/2_statements/expressions/index.js");
13985
13986
  class Do {
13986
13987
  getMatcher() {
13987
13988
  const range = (0, combi_1.seq)("RANGE", expressions_1.Source);
13988
13989
  const vary = (0, combi_1.seq)("VARYING", expressions_1.Target, "FROM", expressions_1.Source, "NEXT", expressions_1.Source, (0, combi_1.optPrio)(range));
13989
13990
  const times = (0, combi_1.seq)(expressions_1.Source, "TIMES");
13990
- return (0, combi_1.seq)("DO", (0, combi_1.optPrio)((0, combi_1.per)((0, combi_1.plus)(vary), times)));
13991
+ return (0, combi_1.seq)("DO", (0, combi_1.optPrio)((0, combi_1.per)((0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, (0, combi_1.plus)(vary)), times)));
13991
13992
  }
13992
13993
  }
13993
13994
  exports.Do = Do;
@@ -14810,9 +14811,10 @@ exports.ExecSQL = ExecSQL;
14810
14811
  Object.defineProperty(exports, "__esModule", ({ value: true }));
14811
14812
  exports.Exit = void 0;
14812
14813
  const combi_1 = __webpack_require__(/*! ../combi */ "../core/build/src/abap/2_statements/combi.js");
14814
+ const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
14813
14815
  class Exit {
14814
14816
  getMatcher() {
14815
- return (0, combi_1.seq)("EXIT", (0, combi_1.opt)((0, combi_1.alt)("FROM SQL", "FROM STEP-LOOP")));
14817
+ return (0, combi_1.seq)("EXIT", (0, combi_1.opt)((0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, (0, combi_1.alt)("FROM SQL", "FROM STEP-LOOP"))));
14816
14818
  }
14817
14819
  }
14818
14820
  exports.Exit = Exit;
@@ -15685,8 +15687,9 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "../core/build/s
15685
15687
  const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
15686
15688
  class GetTime {
15687
15689
  getMatcher() {
15688
- const options = (0, combi_1.seq)((0, combi_1.alt)("STAMP FIELD", "FIELD"), expressions_1.Target);
15689
- return (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("GET TIME", (0, combi_1.opt)(options)));
15690
+ const stamp = (0, combi_1.seq)("GET TIME STAMP FIELD", expressions_1.Target);
15691
+ const time = (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, (0, combi_1.seq)("GET TIME", (0, combi_1.opt)((0, combi_1.seq)("FIELD", expressions_1.Target))));
15692
+ return (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.alt)(stamp, time));
15690
15693
  }
15691
15694
  }
15692
15695
  exports.GetTime = GetTime;
@@ -17525,7 +17528,7 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "../core/build/s
17525
17528
  class Perform {
17526
17529
  getMatcher() {
17527
17530
  const level = (0, combi_1.seq)("LEVEL", Expressions.Source);
17528
- const commit = (0, combi_1.alt)((0, combi_1.seq)("ON COMMIT", (0, combi_1.opt)(level)), "ON ROLLBACK");
17531
+ const commit = (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, (0, combi_1.alt)((0, combi_1.seq)("ON COMMIT", (0, combi_1.opt)(level)), "ON ROLLBACK"));
17529
17532
  const short = (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, (0, combi_1.seq)(Expressions.FormName, (0, combi_1.tok)(tokens_1.ParenLeft), Expressions.IncludeName, (0, combi_1.tok)(tokens_1.ParenRightW)));
17530
17533
  const program = (0, combi_1.seq)("IN PROGRAM", (0, combi_1.opt)((0, combi_1.alt)(Expressions.Dynamic, Expressions.IncludeName)));
17531
17534
  const found = (0, combi_1.str)("IF FOUND");
@@ -18382,7 +18385,7 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "../core/build/s
18382
18385
  const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
18383
18386
  class Rollback {
18384
18387
  getMatcher() {
18385
- return (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("ROLLBACK", (0, combi_1.altPrio)("WORK", expressions_1.DatabaseConnection)));
18388
+ return (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("ROLLBACK", (0, combi_1.altPrio)("WORK", (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, expressions_1.DatabaseConnection))));
18386
18389
  }
18387
18390
  }
18388
18391
  exports.Rollback = Rollback;
@@ -20338,7 +20341,7 @@ class Wait {
20338
20341
  const type = (0, combi_1.seq)("FOR", (0, combi_1.per)(channels, push, tasks));
20339
20342
  const until = (0, combi_1.seq)((0, combi_1.opt)(type), "UNTIL", expressions_1.Cond, (0, combi_1.opt)(up));
20340
20343
  const ret = (0, combi_1.seq)("WAIT", (0, combi_1.alt)(until, up));
20341
- return (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, ret);
20344
+ return (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, ret);
20342
20345
  }
20343
20346
  }
20344
20347
  exports.Wait = Wait;
@@ -26235,6 +26238,9 @@ class CurrentScope {
26235
26238
  this.localFriends = new Map();
26236
26239
  /** types of the FOR and LET names used in a procedure, key is the scope node of the procedure */
26237
26240
  this.localNameTypes = new WeakMap();
26241
+ /** row type of the members of a group, key is the identifier of the group variable,
26242
+ * a LOOP AT ... GROUP BY binds the group until its ENDLOOP */
26243
+ this.groupMemberTypes = new Map();
26238
26244
  this.current = undefined;
26239
26245
  this.parentObj = obj;
26240
26246
  this.reg = reg;
@@ -26767,6 +26773,18 @@ class CurrentScope {
26767
26773
  && type.isGeneric() === false
26768
26774
  && type.toText(0).includes("Unknown type") === false;
26769
26775
  }
26776
+ setGroupMemberType(group, rowType) {
26777
+ this.groupMemberTypes.set(CurrentScope.groupKey(group), rowType);
26778
+ }
26779
+ findGroupMemberType(group) {
26780
+ return this.groupMemberTypes.get(CurrentScope.groupKey(group));
26781
+ }
26782
+ removeGroupMemberType(group) {
26783
+ this.groupMemberTypes.delete(CurrentScope.groupKey(group));
26784
+ }
26785
+ static groupKey(group) {
26786
+ return group.getFilename() + ":" + group.getStart().getRow() + ":" + group.getStart().getCol();
26787
+ }
26770
26788
  getEnclosingMethodName() {
26771
26789
  let curr = this.current;
26772
26790
  while (curr !== undefined) {
@@ -33415,6 +33433,7 @@ const _scope_type_1 = __webpack_require__(/*! ../_scope_type */ "../core/build/s
33415
33433
  const component_cond_1 = __webpack_require__(/*! ./component_cond */ "../core/build/src/abap/5_syntax/expressions/component_cond.js");
33416
33434
  const cond_1 = __webpack_require__(/*! ./cond */ "../core/build/src/abap/5_syntax/expressions/cond.js");
33417
33435
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
33436
+ const loop_group_by_1 = __webpack_require__(/*! ./loop_group_by */ "../core/build/src/abap/5_syntax/expressions/loop_group_by.js");
33418
33437
  const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
33419
33438
  const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
33420
33439
  const let_1 = __webpack_require__(/*! ./let */ "../core/build/src/abap/5_syntax/expressions/let.js");
@@ -33442,18 +33461,19 @@ class For {
33442
33461
  for (const f of inlineField) {
33443
33462
  inline_field_definition_1.InlineFieldDefinition.runSyntax(f, input);
33444
33463
  }
33464
+ let groupsSource = undefined;
33445
33465
  if (groupsToken !== undefined) {
33446
33466
  const message = input.scope.checkLocalName(groupsToken.getStr(), undefined);
33447
33467
  if (message !== undefined) {
33448
33468
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, groupsToken, message));
33449
33469
  return scoped;
33450
33470
  }
33451
- const type = basic_1.VoidType.get("todoGroupBy");
33452
- const identifier = new _typed_identifier_1.TypedIdentifier(groupsToken, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
33453
- input.scope.addIdentifier(identifier);
33454
- input.scope.addReference(groupsToken, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
33471
+ groupsSource = this.runGroups(node, groupsToken, input);
33455
33472
  }
33456
33473
  for (const s of node.findDirectExpressions(Expressions.Source)) {
33474
+ if (s === groupsSource) {
33475
+ continue;
33476
+ }
33457
33477
  source_1.Source.runSyntax(s, input);
33458
33478
  }
33459
33479
  for (const s of node.findDirectExpressions(Expressions.ComponentCond)) {
@@ -33467,6 +33487,32 @@ class For {
33467
33487
  }
33468
33488
  return scoped;
33469
33489
  }
33490
+ /** FOR GROUPS group OF wa IN itab GROUP BY key, returns the itab source */
33491
+ static runGroups(node, groupsToken, input) {
33492
+ var _a;
33493
+ const tableSource = node.findExpressionAfterToken("IN");
33494
+ let rowType = basic_1.VoidType.get("ForGroups");
33495
+ if ((tableSource === null || tableSource === void 0 ? void 0 : tableSource.get()) instanceof Expressions.Source) {
33496
+ const tableType = source_1.Source.runSyntax(tableSource, input);
33497
+ if (tableType instanceof basic_1.TableType) {
33498
+ rowType = tableType.getRowType();
33499
+ }
33500
+ }
33501
+ const waToken = (_a = node.findExpressionAfterToken("OF")) === null || _a === void 0 ? void 0 : _a.getFirstToken();
33502
+ if (waToken !== undefined) {
33503
+ const wa = new _typed_identifier_1.TypedIdentifier(waToken, input.filename, rowType, ["inline" /* IdentifierMeta.InlineDefinition */]);
33504
+ input.scope.addIdentifier(wa);
33505
+ input.scope.addReference(waToken, wa, _reference_1.ReferenceType.DataWriteReference, input.filename);
33506
+ }
33507
+ const keyType = node.findDirectTokenByText("BY") !== undefined
33508
+ ? loop_group_by_1.LoopGroupBy.runKey(node, input)
33509
+ : basic_1.VoidType.get("ForGroups");
33510
+ const group = new _typed_identifier_1.TypedIdentifier(groupsToken, input.filename, keyType, ["inline" /* IdentifierMeta.InlineDefinition */]);
33511
+ input.scope.addIdentifier(group);
33512
+ input.scope.addReference(groupsToken, group, _reference_1.ReferenceType.DataWriteReference, input.filename);
33513
+ input.scope.setGroupMemberType(group, rowType);
33514
+ return (tableSource === null || tableSource === void 0 ? void 0 : tableSource.get()) instanceof Expressions.Source ? tableSource : undefined;
33515
+ }
33470
33516
  }
33471
33517
  exports.For = For;
33472
33518
  //# sourceMappingURL=for.js.map
@@ -34056,6 +34102,7 @@ const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/
34056
34102
  const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
34057
34103
  const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
34058
34104
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
34105
+ const loop_group_by_1 = __webpack_require__(/*! ./loop_group_by */ "../core/build/src/abap/5_syntax/expressions/loop_group_by.js");
34059
34106
  class InlineLoopDefinition {
34060
34107
  static runSyntax(node, input) {
34061
34108
  if (node === undefined) {
@@ -34068,8 +34115,12 @@ class InlineLoopDefinition {
34068
34115
  const source = node.findDirectExpression(Expressions.Source);
34069
34116
  if (source && target) {
34070
34117
  const sourceType = source_1.Source.runSyntax(source, input);
34071
- let rowType = undefined;
34072
- if (sourceType instanceof basic_1.TableType) {
34118
+ const inGroup = node.concatTokens().toUpperCase().includes(" IN GROUP ");
34119
+ let rowType = inGroup ? loop_group_by_1.LoopGroupBy.findMemberType(source, input) : undefined;
34120
+ if (rowType !== undefined) {
34121
+ // FOR ... IN GROUP, the members have the row type of the grouped table
34122
+ }
34123
+ else if (sourceType instanceof basic_1.TableType) {
34073
34124
  rowType = sourceType.getRowType();
34074
34125
  }
34075
34126
  else if (sourceType instanceof basic_1.VoidType) {
@@ -34081,7 +34132,7 @@ class InlineLoopDefinition {
34081
34132
  return;
34082
34133
  }
34083
34134
  if (rowType === undefined
34084
- && node.concatTokens().toUpperCase().includes(" IN GROUP ")
34135
+ && inGroup
34085
34136
  && sourceType !== undefined) {
34086
34137
  rowType = sourceType;
34087
34138
  }
@@ -34227,34 +34278,144 @@ var __importStar = (this && this.__importStar) || (function () {
34227
34278
  Object.defineProperty(exports, "__esModule", ({ value: true }));
34228
34279
  exports.LoopGroupBy = void 0;
34229
34280
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
34281
+ const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
34230
34282
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
34231
- const component_compare_1 = __webpack_require__(/*! ./component_compare */ "../core/build/src/abap/5_syntax/expressions/component_compare.js");
34283
+ const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
34232
34284
  const inline_data_1 = __webpack_require__(/*! ./inline_data */ "../core/build/src/abap/5_syntax/expressions/inline_data.js");
34233
34285
  const fstarget_1 = __webpack_require__(/*! ./fstarget */ "../core/build/src/abap/5_syntax/expressions/fstarget.js");
34234
34286
  const target_1 = __webpack_require__(/*! ./target */ "../core/build/src/abap/5_syntax/expressions/target.js");
34235
34287
  const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_syntax/expressions/source.js");
34288
+ const field_chain_1 = __webpack_require__(/*! ./field_chain */ "../core/build/src/abap/5_syntax/expressions/field_chain.js");
34236
34289
  class LoopGroupBy {
34237
- static runSyntax(node, input) {
34238
- for (const t of node.findAllExpressions(Expressions.Target)) {
34239
- const inline = t.findDirectExpression(Expressions.InlineData);
34290
+ /**
34291
+ * @param rowType row type of the grouped table, the type of the members of each group
34292
+ * @param representative the row target of the LOOP, it is the group when GROUP BY has no target
34293
+ */
34294
+ static runSyntax(node, input, rowType, representative) {
34295
+ var _a;
34296
+ const keyType = this.runKey(node, input);
34297
+ const groupTarget = node.findDirectExpression(Expressions.LoopGroupByTarget);
34298
+ const target = groupTarget === null || groupTarget === void 0 ? void 0 : groupTarget.findDirectExpression(Expressions.Target);
34299
+ const fsTarget = groupTarget === null || groupTarget === void 0 ? void 0 : groupTarget.findDirectExpression(Expressions.FSTarget);
34300
+ if (target) {
34301
+ const inline = target.findDirectExpression(Expressions.InlineData);
34240
34302
  if (inline) {
34241
- inline_data_1.InlineData.runSyntax(inline, input, basic_1.VoidType.get("todoGroupBy"));
34303
+ const isReference = (groupTarget === null || groupTarget === void 0 ? void 0 : groupTarget.findDirectTokenByText("REFERENCE")) !== undefined;
34304
+ inline_data_1.InlineData.runSyntax(inline, input, isReference ? new basic_1.DataReference(keyType) : keyType);
34242
34305
  }
34243
34306
  else {
34244
- target_1.Target.runSyntax(t, input);
34307
+ target_1.Target.runSyntax(target, input);
34245
34308
  }
34246
34309
  }
34247
- for (const t of node.findAllExpressions(Expressions.FSTarget)) {
34248
- fstarget_1.FSTarget.runSyntax(t, input, basic_1.VoidType.get("todoGroupBy"));
34310
+ else if (fsTarget) {
34311
+ fstarget_1.FSTarget.runSyntax(fsTarget, input, keyType);
34312
+ }
34313
+ // bind the group until ENDLOOP, see unbind(), also when the row type is unknown
34314
+ const group = this.findTargetIdentifier((_a = target !== null && target !== void 0 ? target : fsTarget) !== null && _a !== void 0 ? _a : representative, input.scope);
34315
+ if (group) {
34316
+ input.scope.setGroupMemberType(group, rowType !== null && rowType !== void 0 ? rowType : basic_1.VoidType.get("GroupMember"));
34317
+ }
34318
+ }
34319
+ /** the row target of a LOOP, it is the group when GROUP BY has no target */
34320
+ static findRepresentative(loop) {
34321
+ var _a;
34322
+ const loopTarget = loop.findDirectExpression(Expressions.LoopTarget);
34323
+ return (_a = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.findDirectExpression(Expressions.Target)) !== null && _a !== void 0 ? _a : loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.findDirectExpression(Expressions.FSTarget);
34324
+ }
34325
+ /** called at the end of a LOOP structure, the group of a LOOP AT ... GROUP BY is not bound after its ENDLOOP */
34326
+ static unbind(loop, scope) {
34327
+ var _a, _b;
34328
+ const groupBy = loop.findDirectExpression(Expressions.LoopGroupBy);
34329
+ if (groupBy === undefined) {
34330
+ return;
34331
+ }
34332
+ const groupTarget = groupBy.findDirectExpression(Expressions.LoopGroupByTarget);
34333
+ const node = (_b = (_a = groupTarget === null || groupTarget === void 0 ? void 0 : groupTarget.findDirectExpression(Expressions.Target)) !== null && _a !== void 0 ? _a : groupTarget === null || groupTarget === void 0 ? void 0 : groupTarget.findDirectExpression(Expressions.FSTarget)) !== null && _b !== void 0 ? _b : this.findRepresentative(loop);
34334
+ const group = this.findTargetIdentifier(node, scope);
34335
+ if (group) {
34336
+ scope.removeGroupMemberType(group);
34337
+ }
34338
+ }
34339
+ /** LOOP AT GROUP group, the name of the group when it is a variable that no enclosing group loop binds */
34340
+ static findUnboundGroup(source, input) {
34341
+ if (source === undefined) {
34342
+ return undefined;
34343
+ }
34344
+ const name = this.groupName(source);
34345
+ const found = input.scope.findVariable(name);
34346
+ if (found === undefined || input.scope.findGroupMemberType(found) !== undefined) {
34347
+ return undefined;
34249
34348
  }
34250
- for (const t of node.findDirectExpressions(Expressions.Source)) {
34251
- source_1.Source.runSyntax(t, input, basic_1.VoidType.get("todoGroupBy"));
34349
+ return name;
34350
+ }
34351
+ /** type of the group key, from GROUP BY expr or GROUP BY ( name = expr ... ) */
34352
+ static runKey(node, input) {
34353
+ const components = node.findDirectExpressions(Expressions.LoopGroupByComponent);
34354
+ if (components.length === 0) {
34355
+ // LOOP: the key is the first child of LoopGroupBy, FOR GROUPS: the key follows GROUP BY
34356
+ const key = node.get() instanceof Expressions.LoopGroupBy ? node.getFirstChild() : node.findExpressionAfterToken("BY");
34357
+ let type = undefined;
34358
+ if (key instanceof nodes_1.ExpressionNode && key.get() instanceof Expressions.Source) {
34359
+ type = source_1.Source.runSyntax(key, input);
34360
+ }
34361
+ else if (key instanceof nodes_1.ExpressionNode && key.get() instanceof Expressions.FieldChain) {
34362
+ type = field_chain_1.FieldChain.runSyntax(key, input, _reference_1.ReferenceType.DataReadReference);
34363
+ }
34364
+ return type !== null && type !== void 0 ? type : basic_1.VoidType.get("GroupKey");
34252
34365
  }
34253
- for (const c of node.findDirectExpressions(Expressions.LoopGroupByComponent)) {
34254
- for (const t of c.findDirectExpressions(Expressions.ComponentCompareSingle)) {
34255
- component_compare_1.ComponentCompare.runSyntax(t, input);
34366
+ const fields = [];
34367
+ let dynamic = false;
34368
+ for (const c of components) {
34369
+ const single = c.findDirectExpression(Expressions.ComponentCompareSingle);
34370
+ if (single) {
34371
+ const source = single.findDirectExpression(Expressions.Source);
34372
+ const type = source ? source_1.Source.runSyntax(source, input) : undefined;
34373
+ const name = single.findDirectExpression(Expressions.ComponentChainSimple);
34374
+ if (name === undefined) {
34375
+ dynamic = true;
34376
+ continue;
34377
+ }
34378
+ fields.push({ name: name.concatTokens(), type: type !== null && type !== void 0 ? type : basic_1.VoidType.get("GroupKey") });
34256
34379
  }
34380
+ else {
34381
+ // GROUP SIZE and GROUP INDEX
34382
+ const name = c.findDirectExpression(Expressions.ComponentName);
34383
+ if (name) {
34384
+ fields.push({ name: name.concatTokens(), type: basic_1.IntegerType.get() });
34385
+ }
34386
+ }
34387
+ }
34388
+ if (dynamic === true || fields.length === 0) {
34389
+ return basic_1.VoidType.get("GroupKey");
34390
+ }
34391
+ return new basic_1.StructureType(fields);
34392
+ }
34393
+ /** the group variable in LOOP AT GROUP group and FOR ... IN GROUP group */
34394
+ static findMemberType(source, input) {
34395
+ if (source === undefined) {
34396
+ return undefined;
34397
+ }
34398
+ const found = input.scope.findVariable(this.groupName(source));
34399
+ return found ? input.scope.findGroupMemberType(found) : undefined;
34400
+ }
34401
+ static groupName(source) {
34402
+ return source.concatTokens().replace(/\s/g, "").replace(/->\*$/, "");
34403
+ }
34404
+ static findTargetIdentifier(node, scope) {
34405
+ var _a;
34406
+ var _b, _c;
34407
+ if (node === undefined) {
34408
+ return undefined;
34409
+ }
34410
+ const inline = (_b = node.findDirectExpression(Expressions.InlineData)) !== null && _b !== void 0 ? _b : node.findDirectExpression(Expressions.InlineFS);
34411
+ let name;
34412
+ if (inline) {
34413
+ name = (_a = ((_c = inline.findFirstExpression(Expressions.TargetField)) !== null && _c !== void 0 ? _c : inline.findFirstExpression(Expressions.TargetFieldSymbol))) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
34257
34414
  }
34415
+ else if (node.getChildren().length === 1) {
34416
+ name = node.getFirstToken().getStr();
34417
+ }
34418
+ return scope.findVariable(name);
34258
34419
  }
34259
34420
  }
34260
34421
  exports.LoopGroupBy = LoopGroupBy;
@@ -36047,6 +36208,8 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src
36047
36208
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
36048
36209
  const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
36049
36210
  const _check_database_fields_1 = __webpack_require__(/*! ./_check_database_fields */ "../core/build/src/abap/5_syntax/expressions/_check_database_fields.js");
36211
+ const field_chain_1 = __webpack_require__(/*! ./field_chain */ "../core/build/src/abap/5_syntax/expressions/field_chain.js");
36212
+ const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
36050
36213
  const isSimple = /^\w+$/;
36051
36214
  // SQL functions where the result has the same type as the first argument
36052
36215
  const sameTypeAsFirstArgument = new Set(["UPPER", "LOWER", "LTRIM", "RTRIM"]);
@@ -36255,7 +36418,7 @@ class Select {
36255
36418
  if (intoStructure) {
36256
36419
  const inlineList = intoStructure.findAllExpressions(Expressions.InlineData);
36257
36420
  if (inlineList.length === 1) {
36258
- inline_data_1.InlineData.runSyntax(inlineList[0], input, this.buildStructureType(fields, dbSources, input.scope, from));
36421
+ inline_data_1.InlineData.runSyntax(inlineList[0], input, this.buildStructureType(fields, dbSources, input, from));
36259
36422
  }
36260
36423
  else {
36261
36424
  for (const inline of inlineList) {
@@ -36322,13 +36485,19 @@ class Select {
36322
36485
  return basic_1.IntegerType.get();
36323
36486
  }
36324
36487
  }
36325
- static buildStructureType(fields, dbSources, scope, from) {
36488
+ static buildStructureType(fields, dbSources, input, from) {
36326
36489
  var _a, _b, _c, _d, _e, _f;
36490
+ const scope = input.scope;
36327
36491
  if (fields.length === 1 && dbSources.length === 1) {
36328
36492
  // COUNT( * ) yields an integer regardless of the (possibly dynamic) table
36329
36493
  if (/^count\(\s*\*\s*\)$/i.test(fields[0].code)) {
36330
36494
  return this.countResultType(scope);
36331
36495
  }
36496
+ // a host variable yields its own type regardless of the table
36497
+ const hostType = this.findHostFieldType(fields[0], input);
36498
+ if (hostType) {
36499
+ return hostType;
36500
+ }
36332
36501
  const dbType = (_a = dbSources[0]) === null || _a === void 0 ? void 0 : _a.parseType(scope.getRegistry());
36333
36502
  if (dbType === undefined) {
36334
36503
  const name = ((_b = dbSources[0]) === null || _b === void 0 ? void 0 : _b.getName()) || "buildStructureTypeError";
@@ -36480,6 +36649,30 @@ class Select {
36480
36649
  }
36481
36650
  return components;
36482
36651
  }
36652
+ /** returns the type of the field list entry if it is a single ABAP host variable, "@var" or "@( var )" */
36653
+ static findHostFieldType(field, input) {
36654
+ var _a;
36655
+ if (!(field.expression.get() instanceof Expressions.SQLField)) {
36656
+ return undefined;
36657
+ }
36658
+ const children = field.expression.getChildren().filter(c => !(c.get() instanceof Expressions.SQLAsName) && c.concatTokens().toUpperCase() !== "AS");
36659
+ if (!(((_a = children[0]) === null || _a === void 0 ? void 0 : _a.get()) instanceof tokens_1.WAt)) {
36660
+ return undefined;
36661
+ }
36662
+ // "@var" has two children, "@( var )" has four, anything else is an expression
36663
+ const chain = children.length === 2 ? children[1] : children.length === 4 ? children[2] : undefined;
36664
+ if (!(chain instanceof nodes_1.ExpressionNode) || !(chain.get() instanceof Expressions.SimpleFieldChain2)) {
36665
+ return undefined;
36666
+ }
36667
+ // only resolve the type here, errors for the host variable are not reported by this lookup
36668
+ const issues = [];
36669
+ const type = field_chain_1.FieldChain.runSyntax(chain, Object.assign(Object.assign({}, input), { issues }));
36670
+ // a generic host type cannot type the inline declaration, keep it voided
36671
+ if (issues.length > 0 || type === undefined || type.isGeneric()) {
36672
+ return undefined;
36673
+ }
36674
+ return type;
36675
+ }
36483
36676
  /** returns the SQLFunction node if the field list entry is a single SQL function call */
36484
36677
  static findFunctionColumn(field, requireAlias = true) {
36485
36678
  if (requireAlias === true && field.as === "") {
@@ -45000,6 +45193,17 @@ class Loop {
45000
45193
  }
45001
45194
  if (sourceType instanceof basic_1.TableType) {
45002
45195
  rowType = sourceType.getRowType();
45196
+ }
45197
+ else if (concat.startsWith("LOOP AT GROUP ")) {
45198
+ const unbound = loop_group_by_1.LoopGroupBy.findUnboundGroup(firstSource, input);
45199
+ if (unbound !== undefined) {
45200
+ const message = `No group is bound to "${unbound}"`;
45201
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
45202
+ return;
45203
+ }
45204
+ rowType = loop_group_by_1.LoopGroupBy.findMemberType(firstSource, input);
45205
+ }
45206
+ if (rowType) {
45003
45207
  sourceType = rowType;
45004
45208
  if (targetConcat === null || targetConcat === void 0 ? void 0 : targetConcat.startsWith("REFERENCE INTO ")) {
45005
45209
  sourceType = new basic_1.DataReference(sourceType);
@@ -45085,7 +45289,7 @@ class Loop {
45085
45289
  }
45086
45290
  const group = node.findDirectExpression(Expressions.LoopGroupBy);
45087
45291
  if (group) {
45088
- loop_group_by_1.LoopGroupBy.runSyntax(group, input);
45292
+ loop_group_by_1.LoopGroupBy.runSyntax(group, input, rowType, loop_group_by_1.LoopGroupBy.findRepresentative(node));
45089
45293
  }
45090
45294
  }
45091
45295
  }
@@ -45735,6 +45939,7 @@ const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/
45735
45939
  const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
45736
45940
  class Move {
45737
45941
  runSyntax(node, input) {
45942
+ var _a;
45738
45943
  const targets = node.findDirectExpressions(Expressions.Target);
45739
45944
  const firstTarget = targets[0];
45740
45945
  const inline = firstTarget === null || firstTarget === void 0 ? void 0 : firstTarget.findDirectExpression(Expressions.InlineData);
@@ -45775,6 +45980,13 @@ class Move {
45775
45980
  sourceType = dereference_1.Dereference.runSyntax(node, sourceType, input);
45776
45981
  }
45777
45982
  if (inline) {
45983
+ // the length of a text symbol depends on the text pool, "DATA(x) = TEXT-abc." does not compile
45984
+ const sourceChildren = (_a = source === null || source === void 0 ? void 0 : source.getChildren()) !== null && _a !== void 0 ? _a : [];
45985
+ if (sourceChildren.length === 1 && sourceChildren[0].get() instanceof Expressions.TextElement) {
45986
+ const message = `"${source.concatTokens().toUpperCase()}" has a generic type that cannot be used for declarations`;
45987
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, source.getFirstToken(), message));
45988
+ return;
45989
+ }
45778
45990
  if (sourceType instanceof basic_1.PackedType && (source === null || source === void 0 ? void 0 : source.findDirectExpression(Expressions.ArithOperator))) {
45779
45991
  sourceType = new basic_1.PackedType(8, 0);
45780
45992
  }
@@ -51025,6 +51237,7 @@ const statics_1 = __webpack_require__(/*! ./structures/statics */ "../core/build
51025
51237
  const constants_1 = __webpack_require__(/*! ./structures/constants */ "../core/build/src/abap/5_syntax/structures/constants.js");
51026
51238
  const cleanup_1 = __webpack_require__(/*! ./structures/cleanup */ "../core/build/src/abap/5_syntax/structures/cleanup.js");
51027
51239
  const try_1 = __webpack_require__(/*! ./structures/try */ "../core/build/src/abap/5_syntax/structures/try.js");
51240
+ const loop_group_by_1 = __webpack_require__(/*! ./expressions/loop_group_by */ "../core/build/src/abap/5_syntax/expressions/loop_group_by.js");
51028
51241
  const class_definition_1 = __webpack_require__(/*! ../types/class_definition */ "../core/build/src/abap/types/class_definition.js");
51029
51242
  const interface_definition_1 = __webpack_require__(/*! ../types/interface_definition */ "../core/build/src/abap/types/interface_definition.js");
51030
51243
  const delete_memory_1 = __webpack_require__(/*! ./statements/delete_memory */ "../core/build/src/abap/5_syntax/statements/delete_memory.js");
@@ -51450,6 +51663,12 @@ class SyntaxLogic {
51450
51663
  if (loop === true) {
51451
51664
  this.loopTables.pop();
51452
51665
  }
51666
+ if (node instanceof nodes_1.StructureNode && node.get() instanceof Structures.Loop) {
51667
+ const loopStatement = node.findDirectStatement(Statements.Loop);
51668
+ if (loopStatement) {
51669
+ loop_group_by_1.LoopGroupBy.unbind(loopStatement, this.scope);
51670
+ }
51671
+ }
51453
51672
  if (node instanceof nodes_1.StructureNode) {
51454
51673
  this.sortedLines.leave(node);
51455
51674
  }
@@ -55653,6 +55872,7 @@ const Expressions = __importStar(__webpack_require__(/*! ../2_statements/express
55653
55872
  const events_1 = __webpack_require__(/*! ../2_statements/statements/events */ "../core/build/src/abap/2_statements/statements/events.js");
55654
55873
  const expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js");
55655
55874
  const method_param_1 = __webpack_require__(/*! ../5_syntax/expressions/method_param */ "../core/build/src/abap/5_syntax/expressions/method_param.js");
55875
+ const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
55656
55876
  class EventDefinition extends _identifier_1.Identifier {
55657
55877
  constructor(node, _visibility, input) {
55658
55878
  if (!(node.get() instanceof events_1.Events)) {
@@ -55675,10 +55895,21 @@ class EventDefinition extends _identifier_1.Identifier {
55675
55895
  }
55676
55896
  ///////////////
55677
55897
  parse(node, input) {
55898
+ var _a;
55899
+ var _b;
55678
55900
  for (const e of node.findAllExpressions(expressions_1.MethodParam)) {
55901
+ if (this.isPassByValue(e) === false) {
55902
+ const name = (_b = (_a = e.findDirectExpression(Expressions.MethodParamName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) !== null && _b !== void 0 ? _b : "";
55903
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, e.getFirstToken(), "Event parameter " + name + " must be passed by VALUE"));
55904
+ }
55679
55905
  this.parameters.push(method_param_1.MethodParam.runSyntax(e, input, []));
55680
55906
  }
55681
55907
  }
55908
+ // event parameters can only be passed by value
55909
+ isPassByValue(param) {
55910
+ const first = param.getFirstToken().getStr().toUpperCase();
55911
+ return first === "VALUE" || first === "!VALUE";
55912
+ }
55682
55913
  }
55683
55914
  exports.EventDefinition = EventDefinition;
55684
55915
  //# sourceMappingURL=event_definition.js.map
@@ -55854,6 +56085,13 @@ class FunctionModuleDefinition {
55854
56085
  isGlobalParameters() {
55855
56086
  return this.globalParameters;
55856
56087
  }
56088
+ /** the classic exceptions, or the exception classes if isClassBasedExceptions() */
56089
+ getExceptions() {
56090
+ return this.exceptions;
56091
+ }
56092
+ isClassBasedExceptions() {
56093
+ return this.classBasedExceptions;
56094
+ }
55857
56095
  ///////////////
55858
56096
  parse(data) {
55859
56097
  if (data.FUNCNAME === undefined) {
@@ -55863,6 +56101,8 @@ class FunctionModuleDefinition {
55863
56101
  this.description = data.SHORT_TEXT;
55864
56102
  this.parameters = [];
55865
56103
  this.globalParameters = data.GLOBAL_FLAG === "X";
56104
+ this.exceptions = [];
56105
+ this.classBasedExceptions = data.EXCEPTION_CLASSES === "X";
55866
56106
  this.moduleType = FunctionModuleType.regular;
55867
56107
  if (data.REMOTE_CALL === "R") {
55868
56108
  this.moduleType = FunctionModuleType.remote;
@@ -55931,6 +56171,13 @@ class FunctionModuleDefinition {
55931
56171
  });
55932
56172
  }
55933
56173
  }
56174
+ if (data.EXCEPTION) {
56175
+ for (const exception of (0, xml_utils_1.xmlToArray)(data.EXCEPTION.RSEXC)) {
56176
+ if (typeof exception.EXCEPTION === "string") {
56177
+ this.exceptions.push(exception.EXCEPTION);
56178
+ }
56179
+ }
56180
+ }
55934
56181
  }
55935
56182
  }
55936
56183
  exports.FunctionModuleDefinition = FunctionModuleDefinition;
@@ -74063,7 +74310,7 @@ class Registry {
74063
74310
  }
74064
74311
  static abaplintVersion() {
74065
74312
  // magic, see build script "version.js"
74066
- return "2.120.110";
74313
+ return "2.120.111";
74067
74314
  }
74068
74315
  getDDICReferences() {
74069
74316
  return this.ddicReferences;
@@ -89332,6 +89579,11 @@ ${indentation} output = ${uniqueName}.\n`;
89332
89579
  if (this.lowReg.getConfig().isOpenABAP()) {
89333
89580
  return undefined;
89334
89581
  }
89582
+ else if (node.get() instanceof Statements.Loop
89583
+ && node.concatTokens().toUpperCase().startsWith("LOOP AT GROUP ")) {
89584
+ // rewritten by the LOOP GROUP downport, the inline target is outlined afterwards
89585
+ return undefined;
89586
+ }
89335
89587
  for (const i of node.findAllExpressionsRecursive(Expressions.InlineData)) {
89336
89588
  const nameToken = (_a = i.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
89337
89589
  if (nameToken === undefined) {
@@ -92520,6 +92772,155 @@ exports.FullyTypeITabs = FullyTypeITabs;
92520
92772
 
92521
92773
  /***/ },
92522
92774
 
92775
+ /***/ "../core/build/src/rules/function_module_parameter_names.js"
92776
+ /*!******************************************************************!*\
92777
+ !*** ../core/build/src/rules/function_module_parameter_names.js ***!
92778
+ \******************************************************************/
92779
+ (__unused_webpack_module, exports, __webpack_require__) {
92780
+
92781
+ "use strict";
92782
+
92783
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
92784
+ exports.FunctionModuleParameterNames = exports.FunctionModuleParameterNamesConf = void 0;
92785
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
92786
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
92787
+ const function_group_1 = __webpack_require__(/*! ../objects/function_group */ "../core/build/src/objects/function_group.js");
92788
+ const _naming_rule_config_1 = __webpack_require__(/*! ./_naming_rule_config */ "../core/build/src/rules/_naming_rule_config.js");
92789
+ const name_validator_1 = __webpack_require__(/*! ../utils/name_validator */ "../core/build/src/utils/name_validator.js");
92790
+ const function_module_definition_1 = __webpack_require__(/*! ../abap/types/function_module_definition */ "../core/build/src/abap/types/function_module_definition.js");
92791
+ const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
92792
+ class FunctionModuleParameterNamesConf extends _naming_rule_config_1.NamingRuleConfig {
92793
+ constructor() {
92794
+ super(...arguments);
92795
+ /** The pattern for importing parameters */
92796
+ this.importing = "^I._.+$";
92797
+ /** The pattern for exporting parameters */
92798
+ this.exporting = "^E._.+$";
92799
+ /** The pattern for changing parameters */
92800
+ this.changing = "^C._.+$";
92801
+ /** The pattern for tables parameters */
92802
+ this.tables = "^T._.+$";
92803
+ }
92804
+ }
92805
+ exports.FunctionModuleParameterNamesConf = FunctionModuleParameterNamesConf;
92806
+ class FunctionModuleParameterNames {
92807
+ constructor() {
92808
+ this.conf = new FunctionModuleParameterNamesConf();
92809
+ this.regex = this.compile();
92810
+ }
92811
+ getMetadata() {
92812
+ return {
92813
+ key: "function_module_parameter_names",
92814
+ title: "Function module parameter naming conventions",
92815
+ shortDescription: `Allows you to enforce a pattern, such as a prefix, for function module parameter names`,
92816
+ extendedInformation: `Checks the parameters of function modules in function groups,
92817
+ with a separate pattern for importing, exporting, changing and tables parameters.`,
92818
+ tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],
92819
+ badExample: `FUNCTION z_get_name.
92820
+ *" IMPORTING
92821
+ *" VALUE(CUSTOMER) TYPE STRING
92822
+ *" EXPORTING
92823
+ *" VALUE(NAME) TYPE STRING
92824
+ ENDFUNCTION.`,
92825
+ goodExample: `FUNCTION z_get_name.
92826
+ *" IMPORTING
92827
+ *" VALUE(IV_CUSTOMER) TYPE STRING
92828
+ *" EXPORTING
92829
+ *" VALUE(EV_NAME) TYPE STRING
92830
+ ENDFUNCTION.`,
92831
+ };
92832
+ }
92833
+ getDescription(expected, actual) {
92834
+ return this.conf.patternKind === "required" ?
92835
+ "Function module parameter name does not match pattern " + expected + ": " + actual :
92836
+ "Function module parameter name must not match pattern " + expected + ": " + actual;
92837
+ }
92838
+ getConfig() {
92839
+ return this.conf;
92840
+ }
92841
+ setConfig(conf) {
92842
+ this.conf = conf;
92843
+ this.regex = this.compile();
92844
+ }
92845
+ compile() {
92846
+ return {
92847
+ importing: new RegExp(this.conf.importing, "i"),
92848
+ exporting: new RegExp(this.conf.exporting, "i"),
92849
+ changing: new RegExp(this.conf.changing, "i"),
92850
+ tables: new RegExp(this.conf.tables, "i"),
92851
+ ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(this.conf),
92852
+ };
92853
+ }
92854
+ initialize(_reg) {
92855
+ return this;
92856
+ }
92857
+ run(obj) {
92858
+ if (this.conf.patternKind === undefined) {
92859
+ this.conf.patternKind = "required";
92860
+ }
92861
+ if (!(obj instanceof function_group_1.FunctionGroup)) {
92862
+ return [];
92863
+ }
92864
+ let ret = [];
92865
+ for (const module of obj.getModules()) {
92866
+ ret = ret.concat(this.checkModule(obj, module));
92867
+ }
92868
+ return ret;
92869
+ }
92870
+ checkModule(obj, module) {
92871
+ const ret = [];
92872
+ for (const p of module.getParameters()) {
92873
+ let expected;
92874
+ let regex;
92875
+ switch (p.direction) {
92876
+ case function_module_definition_1.FunctionModuleParameterDirection.importing:
92877
+ expected = this.conf.importing;
92878
+ regex = this.regex.importing;
92879
+ break;
92880
+ case function_module_definition_1.FunctionModuleParameterDirection.exporting:
92881
+ expected = this.conf.exporting;
92882
+ regex = this.regex.exporting;
92883
+ break;
92884
+ case function_module_definition_1.FunctionModuleParameterDirection.changing:
92885
+ expected = this.conf.changing;
92886
+ regex = this.regex.changing;
92887
+ break;
92888
+ case function_module_definition_1.FunctionModuleParameterDirection.tables:
92889
+ expected = this.conf.tables;
92890
+ regex = this.regex.tables;
92891
+ break;
92892
+ default:
92893
+ continue;
92894
+ }
92895
+ const issue = this.checkParameter(obj, module, p, expected, regex);
92896
+ if (issue) {
92897
+ ret.push(issue);
92898
+ }
92899
+ }
92900
+ return ret;
92901
+ }
92902
+ checkParameter(obj, module, param, expected, regex) {
92903
+ if (!name_validator_1.NameValidator.violatesRule(param.name, regex, this.conf, this.regex.ignorePatterns)) {
92904
+ return undefined;
92905
+ }
92906
+ // the parameter is only defined in the XML, so report at the start of the module file, if it exists
92907
+ const file = this.findModuleFile(obj, module) || obj.getMainABAPFile();
92908
+ if (file === undefined) {
92909
+ return undefined;
92910
+ }
92911
+ const message = this.getDescription(expected, param.name);
92912
+ return issue_1.Issue.atPosition(file, new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);
92913
+ }
92914
+ findModuleFile(obj, module) {
92915
+ const search = "." + module.getName().toLowerCase().replace(/\//g, "#") + ".abap";
92916
+ return obj.getABAPFiles().find(f => f.getFilename().toLowerCase().endsWith(search));
92917
+ }
92918
+ }
92919
+ exports.FunctionModuleParameterNames = FunctionModuleParameterNames;
92920
+ //# sourceMappingURL=function_module_parameter_names.js.map
92921
+
92922
+ /***/ },
92923
+
92523
92924
  /***/ "../core/build/src/rules/function_module_recommendations.js"
92524
92925
  /*!******************************************************************!*\
92525
92926
  !*** ../core/build/src/rules/function_module_recommendations.js ***!
@@ -94968,6 +95369,7 @@ __exportStar(__webpack_require__(/*! ./forbidden_void_type */ "../core/build/src
94968
95369
  __exportStar(__webpack_require__(/*! ./form_tables_obsolete */ "../core/build/src/rules/form_tables_obsolete.js"), exports);
94969
95370
  __exportStar(__webpack_require__(/*! ./fully_type_constants */ "../core/build/src/rules/fully_type_constants.js"), exports);
94970
95371
  __exportStar(__webpack_require__(/*! ./fully_type_itabs */ "../core/build/src/rules/fully_type_itabs.js"), exports);
95372
+ __exportStar(__webpack_require__(/*! ./function_module_parameter_names */ "../core/build/src/rules/function_module_parameter_names.js"), exports);
94971
95373
  __exportStar(__webpack_require__(/*! ./function_module_recommendations */ "../core/build/src/rules/function_module_recommendations.js"), exports);
94972
95374
  __exportStar(__webpack_require__(/*! ./functional_writing */ "../core/build/src/rules/functional_writing.js"), exports);
94973
95375
  __exportStar(__webpack_require__(/*! ./generic_regex */ "../core/build/src/rules/generic_regex.js"), exports);
@@ -95096,6 +95498,7 @@ __exportStar(__webpack_require__(/*! ./try_without_catch */ "../core/build/src/r
95096
95498
  __exportStar(__webpack_require__(/*! ./type_form_parameters */ "../core/build/src/rules/type_form_parameters.js"), exports);
95097
95499
  __exportStar(__webpack_require__(/*! ./types_naming */ "../core/build/src/rules/types_naming.js"), exports);
95098
95500
  __exportStar(__webpack_require__(/*! ./uncaught_exception */ "../core/build/src/rules/uncaught_exception.js"), exports);
95501
+ __exportStar(__webpack_require__(/*! ./unhandled_classic_exception */ "../core/build/src/rules/unhandled_classic_exception.js"), exports);
95099
95502
  __exportStar(__webpack_require__(/*! ./unit_test_assertions */ "../core/build/src/rules/unit_test_assertions.js"), exports);
95100
95503
  __exportStar(__webpack_require__(/*! ./unknown_types */ "../core/build/src/rules/unknown_types.js"), exports);
95101
95504
  __exportStar(__webpack_require__(/*! ./unnecessary_chaining */ "../core/build/src/rules/unnecessary_chaining.js"), exports);
@@ -113465,6 +113868,294 @@ exports.UncaughtException = UncaughtException;
113465
113868
 
113466
113869
  /***/ },
113467
113870
 
113871
+ /***/ "../core/build/src/rules/unhandled_classic_exception.js"
113872
+ /*!**************************************************************!*\
113873
+ !*** ../core/build/src/rules/unhandled_classic_exception.js ***!
113874
+ \**************************************************************/
113875
+ (__unused_webpack_module, exports, __webpack_require__) {
113876
+
113877
+ "use strict";
113878
+
113879
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
113880
+ if (k2 === undefined) k2 = k;
113881
+ var desc = Object.getOwnPropertyDescriptor(m, k);
113882
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
113883
+ desc = { enumerable: true, get: function() { return m[k]; } };
113884
+ }
113885
+ Object.defineProperty(o, k2, desc);
113886
+ }) : (function(o, m, k, k2) {
113887
+ if (k2 === undefined) k2 = k;
113888
+ o[k2] = m[k];
113889
+ }));
113890
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
113891
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
113892
+ }) : function(o, v) {
113893
+ o["default"] = v;
113894
+ });
113895
+ var __importStar = (this && this.__importStar) || (function () {
113896
+ var ownKeys = function(o) {
113897
+ ownKeys = Object.getOwnPropertyNames || function (o) {
113898
+ var ar = [];
113899
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
113900
+ return ar;
113901
+ };
113902
+ return ownKeys(o);
113903
+ };
113904
+ return function (mod) {
113905
+ if (mod && mod.__esModule) return mod;
113906
+ var result = {};
113907
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
113908
+ __setModuleDefault(result, mod);
113909
+ return result;
113910
+ };
113911
+ })();
113912
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
113913
+ exports.UnhandledClassicException = exports.UnhandledClassicExceptionConf = void 0;
113914
+ const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
113915
+ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
113916
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
113917
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
113918
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
113919
+ const severity_1 = __webpack_require__(/*! ../severity */ "../core/build/src/severity.js");
113920
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
113921
+ const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
113922
+ const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
113923
+ const types_1 = __webpack_require__(/*! ../abap/types */ "../core/build/src/abap/types/index.js");
113924
+ const virtual_position_1 = __webpack_require__(/*! ../virtual_position */ "../core/build/src/virtual_position.js");
113925
+ class UnhandledClassicExceptionConf extends _basic_rule_config_1.BasicRuleConfig {
113926
+ constructor() {
113927
+ super(...arguments);
113928
+ this.severity = severity_1.Severity.Warning;
113929
+ /** Report an EXCEPTIONS list without OTHERS, unless the method or function module is known and all its exceptions are listed */
113930
+ this.missingOthers = true;
113931
+ /** Report a call without EXCEPTIONS, including a functional call, of a method or function module that declares classic exceptions */
113932
+ this.missingExceptions = true;
113933
+ /** missingExceptions: do not report a method call whose arguments are all literals or me, like describe_by_name( 'T100' ) */
113934
+ this.allowLiteralArguments = true;
113935
+ }
113936
+ }
113937
+ exports.UnhandledClassicExceptionConf = UnhandledClassicExceptionConf;
113938
+ class UnhandledClassicException extends _abap_rule_1.ABAPRule {
113939
+ constructor() {
113940
+ super(...arguments);
113941
+ this.conf = new UnhandledClassicExceptionConf();
113942
+ }
113943
+ getMetadata() {
113944
+ return {
113945
+ key: "unhandled_classic_exception",
113946
+ title: "Unhandled classic exception",
113947
+ shortDescription: `Finds calls that do not map every classic exception the callee can raise`,
113948
+ extendedInformation: `A classic exception that is raised with RAISE and not mapped in the EXCEPTIONS addition of the call
113949
+ ends in the runtime error RAISE_EXCEPTION. TRY ... CATCH cx_root does not catch it.
113950
+
113951
+ missingOthers: reports CALL FUNCTION and method calls with an EXCEPTIONS list without OTHERS.
113952
+ Not reported if the function module or method is known and every exception it declares is listed,
113953
+ for CALL FUNCTION ... DESTINATION this includes SYSTEM_FAILURE and COMMUNICATION_FAILURE.
113954
+ CALL FUNCTION ... STARTING NEW TASK, IN UPDATE TASK and IN BACKGROUND are not checked.
113955
+
113956
+ missingExceptions: reports calls without EXCEPTIONS of a method or function module that declares classic exceptions,
113957
+ this includes functional calls, which cannot have EXCEPTIONS.
113958
+ With allowLiteralArguments, a method call whose arguments are all literals or me is not reported.
113959
+
113960
+ Signatures are taken from the registry, including dependencies. Methods and function modules that are not
113961
+ found (void) are only checked by missingOthers.
113962
+
113963
+ Does not report any issues if the code contains syntax errors`,
113964
+ tags: [_irule_1.RuleTag.Syntax],
113965
+ badExample: `CALL FUNCTION 'Z_READ'
113966
+ EXCEPTIONS
113967
+ not_found = 1.
113968
+
113969
+ lo_type = cl_abap_typedescr=>describe_by_name( lv_name ).`,
113970
+ goodExample: `CALL FUNCTION 'Z_READ'
113971
+ EXCEPTIONS
113972
+ not_found = 1
113973
+ OTHERS = 2.
113974
+
113975
+ cl_abap_typedescr=>describe_by_name(
113976
+ EXPORTING
113977
+ p_name = lv_name
113978
+ RECEIVING
113979
+ p_descr_ref = lo_type
113980
+ EXCEPTIONS
113981
+ type_not_found = 1
113982
+ OTHERS = 2 ).`,
113983
+ };
113984
+ }
113985
+ initialize(reg) {
113986
+ super.initialize(reg);
113987
+ this.functionModules = undefined;
113988
+ return this;
113989
+ }
113990
+ getConfig() {
113991
+ return this.conf;
113992
+ }
113993
+ setConfig(conf) {
113994
+ this.conf = conf;
113995
+ }
113996
+ runParsed(file, obj) {
113997
+ var _a;
113998
+ if (obj.getType() === "INTF" || file.getStructure() === undefined) {
113999
+ return [];
114000
+ }
114001
+ const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
114002
+ if (syntax.issues.length > 0) {
114003
+ return [];
114004
+ }
114005
+ const methods = new Map();
114006
+ this.findMethodReferences(syntax.spaghetti.getTop(), file.getFilename(), methods);
114007
+ const issues = [];
114008
+ for (const statement of file.getStatements()) {
114009
+ if (statement.get() instanceof Statements.CallFunction) {
114010
+ issues.push(...this.checkCallFunction(statement, file));
114011
+ continue;
114012
+ }
114013
+ if (statement.get() instanceof Statements.Call) {
114014
+ const source = statement.findDirectExpression(Expressions.MethodSource);
114015
+ const body = statement.findDirectExpression(Expressions.MethodCallBody);
114016
+ const nameNode = source === null || source === void 0 ? void 0 : source.getLastChild();
114017
+ if (nameNode) {
114018
+ const token = nameNode.getFirstToken();
114019
+ const callee = nameNode.get() instanceof Expressions.Dynamic ? undefined : this.findMethod(methods, token);
114020
+ const issue = this.checkCall(file, token, callee, body === null || body === void 0 ? void 0 : body.findDirectExpression(Expressions.MethodParameters), (body === null || body === void 0 ? void 0 : body.findDirectTokenByText("EXCEPTION-TABLE")) !== undefined, false, this.onlyLiterals(body));
114021
+ if (issue) {
114022
+ issues.push(issue);
114023
+ }
114024
+ }
114025
+ }
114026
+ for (const call of statement.findAllExpressionsRecursive(Expressions.MethodCall)) {
114027
+ const token = (_a = call.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
114028
+ if (token === undefined) {
114029
+ continue;
114030
+ }
114031
+ const param = call.findDirectExpression(Expressions.MethodCallParam);
114032
+ const parameters = param === null || param === void 0 ? void 0 : param.findDirectExpression(Expressions.MethodParameters);
114033
+ const issue = this.checkCall(file, token, this.findMethod(methods, token), parameters, false, false, this.onlyLiterals(param));
114034
+ if (issue) {
114035
+ issues.push(issue);
114036
+ }
114037
+ }
114038
+ }
114039
+ return issues;
114040
+ }
114041
+ checkCallFunction(statement, file) {
114042
+ if (statement.findDirectTokenByText("STARTING")
114043
+ || statement.findDirectTokenByText("UPDATE")
114044
+ || statement.findDirectTokenByText("BACKGROUND")) {
114045
+ return [];
114046
+ }
114047
+ const nameNode = statement.findDirectExpression(Expressions.FunctionName);
114048
+ if (nameNode === undefined) {
114049
+ return [];
114050
+ }
114051
+ let callee = undefined;
114052
+ if (nameNode.findFirstExpression(Expressions.FieldChain) === undefined) {
114053
+ const name = nameNode.concatTokens().replace(/'/g, "").replace(/`/g, "");
114054
+ const module = this.findFunctionModule(name);
114055
+ if (module) {
114056
+ callee = {
114057
+ name: module.getName(),
114058
+ exceptions: module.isClassBasedExceptions() ? [] : module.getExceptions().map(e => e.toUpperCase()),
114059
+ };
114060
+ }
114061
+ }
114062
+ const issue = this.checkCall(file, nameNode.getFirstToken(), callee, statement.findDirectExpression(Expressions.FunctionParameters), statement.findDirectTokenByText("EXCEPTION-TABLE") !== undefined, statement.findDirectExpression(Expressions.Destination) !== undefined, false);
114063
+ return issue ? [issue] : [];
114064
+ }
114065
+ checkCall(file, token, callee, parameters, exceptionTable, destination, onlyLiterals) {
114066
+ if (exceptionTable === true) {
114067
+ return undefined;
114068
+ }
114069
+ const list = parameters === null || parameters === void 0 ? void 0 : parameters.findDirectExpression(Expressions.ParameterListExceptions);
114070
+ if (list === undefined) {
114071
+ if (this.conf.missingExceptions === false
114072
+ || callee === undefined
114073
+ || callee.exceptions.length === 0
114074
+ || (this.conf.allowLiteralArguments === true && onlyLiterals === true)) {
114075
+ return undefined;
114076
+ }
114077
+ const message = `Classic exceptions of "${callee.name}" not handled: ${callee.exceptions.join(", ")}, call it with EXCEPTIONS`;
114078
+ return issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);
114079
+ }
114080
+ if (this.conf.missingOthers === false) {
114081
+ return undefined;
114082
+ }
114083
+ const listed = list.findDirectExpressions(Expressions.ParameterException)
114084
+ .map(e => e.getFirstChild().concatTokens().toUpperCase());
114085
+ if (listed.includes("OTHERS")) {
114086
+ return undefined;
114087
+ }
114088
+ const position = parameters.findDirectTokenByText("EXCEPTIONS") || list.getFirstToken();
114089
+ if (callee === undefined) {
114090
+ const message = "EXCEPTIONS without OTHERS, an exception that is not listed ends in a runtime error";
114091
+ return issue_1.Issue.atToken(file, position, message, this.getMetadata().key, this.conf.severity);
114092
+ }
114093
+ const expected = [...callee.exceptions];
114094
+ if (destination === true) {
114095
+ expected.push("SYSTEM_FAILURE", "COMMUNICATION_FAILURE");
114096
+ }
114097
+ const missing = expected.filter(e => listed.includes(e) === false);
114098
+ if (missing.length === 0) {
114099
+ return undefined;
114100
+ }
114101
+ const message = `EXCEPTIONS without OTHERS, not mapped: ${missing.join(", ")}`;
114102
+ return issue_1.Issue.atToken(file, position, message, this.getMetadata().key, this.conf.severity);
114103
+ }
114104
+ /** true if the call has arguments and all of them are literals or me, like describe_by_name( 'T100' ) */
114105
+ onlyLiterals(node) {
114106
+ if (node === undefined || node.findFirstExpression(Expressions.MethodCall) !== undefined) {
114107
+ return false;
114108
+ }
114109
+ const sources = node.findAllExpressions(Expressions.Source);
114110
+ return sources.length > 0
114111
+ && sources.every(s => { var _a; return (s.getChildren().length === 1 && ((_a = s.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Constant)
114112
+ || s.concatTokens().toUpperCase() === "ME"; });
114113
+ }
114114
+ findMethod(methods, token) {
114115
+ const method = methods.get(UnhandledClassicException.positionKey(token.getStart()));
114116
+ if (method === undefined) {
114117
+ return undefined;
114118
+ }
114119
+ return {
114120
+ name: method.getName(),
114121
+ exceptions: method.getExceptions().map(e => e.toUpperCase()),
114122
+ };
114123
+ }
114124
+ findMethodReferences(node, filename, found) {
114125
+ for (const r of node.getData().references) {
114126
+ if (r.referenceType === _reference_1.ReferenceType.MethodReference
114127
+ && r.position.getFilename() === filename
114128
+ && r.resolved instanceof types_1.MethodDefinition) {
114129
+ found.set(UnhandledClassicException.positionKey(r.position.getStart()), r.resolved);
114130
+ }
114131
+ }
114132
+ for (const child of node.getChildren()) {
114133
+ this.findMethodReferences(child, filename, found);
114134
+ }
114135
+ }
114136
+ findFunctionModule(name) {
114137
+ if (this.functionModules === undefined) {
114138
+ this.functionModules = new Map();
114139
+ for (const fugr of this.reg.getObjectsByType("FUGR")) {
114140
+ for (const module of fugr.getModules()) {
114141
+ this.functionModules.set(module.getName().toUpperCase(), module);
114142
+ }
114143
+ }
114144
+ }
114145
+ return this.functionModules.get(name.toUpperCase());
114146
+ }
114147
+ static positionKey(p) {
114148
+ if (p instanceof virtual_position_1.VirtualPosition) {
114149
+ return p.getRow() + ":" + p.getCol() + ":" + p.vrow + ":" + p.vcol;
114150
+ }
114151
+ return p.getRow() + ":" + p.getCol();
114152
+ }
114153
+ }
114154
+ exports.UnhandledClassicException = UnhandledClassicException;
114155
+ //# sourceMappingURL=unhandled_classic_exception.js.map
114156
+
114157
+ /***/ },
114158
+
113468
114159
  /***/ "../core/build/src/rules/unit_test_assertions.js"
113469
114160
  /*!*******************************************************!*\
113470
114161
  !*** ../core/build/src/rules/unit_test_assertions.js ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.110",
3
+ "version": "2.120.111",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.110",
42
+ "@abaplint/core": "^2.120.111",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",