@abaplint/cli 2.120.100 → 2.120.102

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 +378 -5
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -27839,6 +27839,167 @@ exports.Procedural = Procedural;
27839
27839
 
27840
27840
  /***/ },
27841
27841
 
27842
+ /***/ "../core/build/src/abap/5_syntax/_raise_message.js"
27843
+ /*!*********************************************************!*\
27844
+ !*** ../core/build/src/abap/5_syntax/_raise_message.js ***!
27845
+ \*********************************************************/
27846
+ (__unused_webpack_module, exports, __webpack_require__) {
27847
+
27848
+ "use strict";
27849
+
27850
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
27851
+ if (k2 === undefined) k2 = k;
27852
+ var desc = Object.getOwnPropertyDescriptor(m, k);
27853
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27854
+ desc = { enumerable: true, get: function() { return m[k]; } };
27855
+ }
27856
+ Object.defineProperty(o, k2, desc);
27857
+ }) : (function(o, m, k, k2) {
27858
+ if (k2 === undefined) k2 = k;
27859
+ o[k2] = m[k];
27860
+ }));
27861
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27862
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
27863
+ }) : function(o, v) {
27864
+ o["default"] = v;
27865
+ });
27866
+ var __importStar = (this && this.__importStar) || (function () {
27867
+ var ownKeys = function(o) {
27868
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27869
+ var ar = [];
27870
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27871
+ return ar;
27872
+ };
27873
+ return ownKeys(o);
27874
+ };
27875
+ return function (mod) {
27876
+ if (mod && mod.__esModule) return mod;
27877
+ var result = {};
27878
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
27879
+ __setModuleDefault(result, mod);
27880
+ return result;
27881
+ };
27882
+ })();
27883
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
27884
+ exports.RaiseMessage = void 0;
27885
+ const Expressions = __importStar(__webpack_require__(/*! ../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
27886
+ const nodes_1 = __webpack_require__(/*! ../nodes */ "../core/build/src/abap/nodes/index.js");
27887
+ const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
27888
+ const T100_INTERFACES = new Set(["IF_T100_MESSAGE", "IF_T100_DYN_MSG"]);
27889
+ // the root exception classes, they implement IF_MESSAGE and IF_SERIALIZABLE_OBJECT, but not the T100 interfaces
27890
+ const ROOT_EXCEPTIONS = new Set(["CX_ROOT", "CX_STATIC_CHECK", "CX_DYNAMIC_CHECK", "CX_NO_CHECK"]);
27891
+ /** RAISE EXCEPTION TYPE cx MESSAGE ... and THROW cx( MESSAGE ... ) require the exception class to implement
27892
+ * IF_T100_MESSAGE or IF_T100_DYN_MSG, and with RAISE EXCEPTION the constructor parameter TEXTID cannot be
27893
+ * passed in addition to MESSAGE, see the ABAP keyword documentation for RAISE EXCEPTION, MESSAGE.
27894
+ * The interface check only reports when the full class hierarchy is known, void classes and void interfaces
27895
+ * in the hierarchy are skipped, except for the root exception classes. */
27896
+ class RaiseMessage {
27897
+ static checkRaise(node, input) {
27898
+ var _a, _b, _c;
27899
+ var _d;
27900
+ const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
27901
+ if (classTok === undefined || RaiseMessage.hasMessage(node) === false) {
27902
+ return;
27903
+ }
27904
+ for (const p of (_d = (_b = node.findDirectExpression(Expressions.ParameterListS)) === null || _b === void 0 ? void 0 : _b.findDirectExpressions(Expressions.ParameterS)) !== null && _d !== void 0 ? _d : []) {
27905
+ const name = (_c = p.findDirectExpression(Expressions.ParameterName)) === null || _c === void 0 ? void 0 : _c.getFirstToken();
27906
+ if ((name === null || name === void 0 ? void 0 : name.getStr().toUpperCase()) === "TEXTID") {
27907
+ const message = "RAISE EXCEPTION with MESSAGE, TEXTID cannot be passed";
27908
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, name, message));
27909
+ return;
27910
+ }
27911
+ }
27912
+ RaiseMessage.checkClass(classTok.getStr(), input, classTok);
27913
+ }
27914
+ static checkThrow(node, input) {
27915
+ var _a;
27916
+ const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
27917
+ if (classTok === undefined || node.findDirectExpression(Expressions.MessageSource) === undefined) {
27918
+ return;
27919
+ }
27920
+ RaiseMessage.checkClass(classTok.getStr(), input, classTok);
27921
+ }
27922
+ /** MESSAGE msg or MESSAGE ID, but not USING MESSAGE */
27923
+ static hasMessage(node) {
27924
+ const children = node.getChildren();
27925
+ for (let i = 0; i < children.length; i++) {
27926
+ const c = children[i];
27927
+ if (c instanceof nodes_1.TokenNode && c.getFirstToken().getStr().toUpperCase() === "MESSAGE") {
27928
+ const previous = children[i - 1];
27929
+ if (previous === undefined || previous.getFirstToken().getStr().toUpperCase() !== "USING") {
27930
+ return true;
27931
+ }
27932
+ }
27933
+ }
27934
+ return false;
27935
+ }
27936
+ static checkClass(className, input, classTok) {
27937
+ const def = input.scope.findClassDefinition(className);
27938
+ if (def === undefined) {
27939
+ return;
27940
+ }
27941
+ if (RaiseMessage.isT100(def, input.scope, new Set()) === false) {
27942
+ const message = "Exception class " + def.getName().toUpperCase() +
27943
+ " must implement IF_T100_MESSAGE or IF_T100_DYN_MSG to be raised with MESSAGE";
27944
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, classTok, message));
27945
+ }
27946
+ }
27947
+ /** true or false when known, undefined when the hierarchy contains void parts */
27948
+ static isT100(def, scope, visited) {
27949
+ var _a;
27950
+ const upper = def.getName().toUpperCase();
27951
+ if (visited.has(upper)) {
27952
+ return undefined;
27953
+ }
27954
+ visited.add(upper);
27955
+ let unknown = false;
27956
+ const interfaces = def.getImplementing().map(i => i.name.toUpperCase());
27957
+ const seen = new Set();
27958
+ while (interfaces.length > 0) {
27959
+ const name = interfaces.pop();
27960
+ if (seen.has(name)) {
27961
+ continue;
27962
+ }
27963
+ seen.add(name);
27964
+ if (T100_INTERFACES.has(name)) {
27965
+ return true;
27966
+ }
27967
+ const idef = scope.findInterfaceDefinition(name);
27968
+ if (idef === undefined) {
27969
+ unknown = true;
27970
+ }
27971
+ else {
27972
+ interfaces.push(...idef.getImplementing().map(i => i.name.toUpperCase()));
27973
+ }
27974
+ }
27975
+ const superName = (_a = def.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
27976
+ if (superName !== undefined) {
27977
+ const superDef = scope.findClassDefinition(superName);
27978
+ if (superDef !== undefined) {
27979
+ const res = RaiseMessage.isT100(superDef, scope, visited);
27980
+ if (res === true) {
27981
+ return true;
27982
+ }
27983
+ else if (res === undefined) {
27984
+ unknown = true;
27985
+ }
27986
+ }
27987
+ else if (ROOT_EXCEPTIONS.has(superName) === false) {
27988
+ unknown = true;
27989
+ }
27990
+ }
27991
+ else if (ROOT_EXCEPTIONS.has(upper) === false) {
27992
+ // not an exception class, reported elsewhere or not at all
27993
+ unknown = true;
27994
+ }
27995
+ return unknown ? undefined : false;
27996
+ }
27997
+ }
27998
+ exports.RaiseMessage = RaiseMessage;
27999
+ //# sourceMappingURL=_raise_message.js.map
28000
+
28001
+ /***/ },
28002
+
27842
28003
  /***/ "../core/build/src/abap/5_syntax/_reference.js"
27843
28004
  /*!*****************************************************!*\
27844
28005
  !*** ../core/build/src/abap/5_syntax/_reference.js ***!
@@ -30618,7 +30779,19 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
30618
30779
  // a syntax error. Other types, a dynamic offset or length and "*" (undefined) are left alone, as is
30619
30780
  // length 0. The offset is applied first, so the length is compared to what remains after the offset.
30620
30781
  // A substring of a date, time or numeric text field has type n; its bounds are not checked.
30782
+ // An offset or length on a numeric field (i, int8, p, f, decfloat) is a syntax error, whatever its value,
30783
+ // except a length without offset covering the full packed field, eg. "lv_p(5)" for "lv_p(5) TYPE p".
30621
30784
  function substringType(context, offset, length, node, input) {
30785
+ const numericName = numericTypeName(context);
30786
+ if (context instanceof basic_1.PackedType && offset === undefined && length === context.getLength()) {
30787
+ // the offset is checked in a separate call before the length, so this is a length without offset
30788
+ return context;
30789
+ }
30790
+ else if (numericName !== undefined) {
30791
+ const message = `Offset or length specification not possible on a field of numeric type "${numericName}"`;
30792
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
30793
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
30794
+ }
30622
30795
  if (context instanceof basic_1.DateType || context instanceof basic_1.TimeType || context instanceof basic_1.NumericType) {
30623
30796
  return numericSubstringType(context, offset, length);
30624
30797
  }
@@ -30644,6 +30817,30 @@ function substringType(context, offset, length, node, input) {
30644
30817
  }
30645
30818
  return context;
30646
30819
  }
30820
+ function numericTypeName(context) {
30821
+ if (context instanceof basic_1.IntegerType) {
30822
+ return "I";
30823
+ }
30824
+ else if (context instanceof basic_1.Integer8Type) {
30825
+ return "INT8";
30826
+ }
30827
+ else if (context instanceof basic_1.PackedType) {
30828
+ return "P";
30829
+ }
30830
+ else if (context instanceof basic_1.FloatType || context instanceof basic_1.FloatingPointType) {
30831
+ return "F";
30832
+ }
30833
+ else if (context instanceof basic_1.DecFloat16Type) {
30834
+ return "DECFLOAT16";
30835
+ }
30836
+ else if (context instanceof basic_1.DecFloat34Type) {
30837
+ return "DECFLOAT34";
30838
+ }
30839
+ else if (context instanceof basic_1.DecFloatType) {
30840
+ return "DECFLOAT";
30841
+ }
30842
+ return undefined;
30843
+ }
30647
30844
  function numericSubstringType(context, offset, length) {
30648
30845
  const hasOffset = offset !== undefined && offset > 0;
30649
30846
  const hasLength = length !== undefined && length > 0;
@@ -31783,6 +31980,7 @@ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expr
31783
31980
  const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_syntax/expressions/source.js");
31784
31981
  const let_1 = __webpack_require__(/*! ./let */ "../core/build/src/abap/5_syntax/expressions/let.js");
31785
31982
  const cond_1 = __webpack_require__(/*! ./cond */ "../core/build/src/abap/5_syntax/expressions/cond.js");
31983
+ const _raise_message_1 = __webpack_require__(/*! ../_raise_message */ "../core/build/src/abap/5_syntax/_raise_message.js");
31786
31984
  class CondBody {
31787
31985
  static runSyntax(node, input, targetType) {
31788
31986
  if (node === undefined) {
@@ -31793,6 +31991,9 @@ class CondBody {
31793
31991
  if (l) {
31794
31992
  scoped = let_1.Let.runSyntax(l, input);
31795
31993
  }
31994
+ for (const t of node.findDirectExpressions(Expressions.Throw)) {
31995
+ _raise_message_1.RaiseMessage.checkThrow(t, input);
31996
+ }
31796
31997
  for (const s of node.findDirectExpressions(Expressions.Cond)) {
31797
31998
  cond_1.Cond.runSyntax(s, input);
31798
31999
  }
@@ -36433,8 +36634,9 @@ class Source {
36433
36634
  /** The calculation type of an arithmetic expression is the most general of the
36434
36635
  * operand types. An operand of type c, n, d, t or string is converted into it and
36435
36636
  * never becomes the result: "lv_f * '0.25'" is a float, not a character field of
36436
- * length four. Returns undefined when neither operand is numeric, leaving the
36437
- * decision to the caller. */
36637
+ * length four. Date and time operands count as numbers of days and seconds, type i:
36638
+ * "lv_end - lv_start" is a number of days, not a date. Returns undefined when neither
36639
+ * operand is numeric, leaving the decision to the caller. */
36438
36640
  static calculationType(left, right) {
36439
36641
  if (left === undefined || right === undefined) {
36440
36642
  return undefined;
@@ -36446,12 +36648,27 @@ class Source {
36446
36648
  else if (right instanceof basic_1.VoidType || right instanceof unknown_type_1.UnknownType) {
36447
36649
  return right;
36448
36650
  }
36651
+ const dateOrTime = left instanceof basic_1.DateType || left instanceof basic_1.TimeType
36652
+ || right instanceof basic_1.DateType || right instanceof basic_1.TimeType;
36653
+ if (left instanceof basic_1.DateType || left instanceof basic_1.TimeType) {
36654
+ left = basic_1.IntegerType.get();
36655
+ }
36656
+ if (right instanceof basic_1.DateType || right instanceof basic_1.TimeType) {
36657
+ right = basic_1.IntegerType.get();
36658
+ }
36449
36659
  const leftRank = this.numericRank(left);
36450
36660
  const rightRank = this.numericRank(right);
36451
36661
  if (leftRank === undefined && rightRank === undefined) {
36452
36662
  return undefined;
36453
36663
  }
36454
- else if (rightRank === undefined) {
36664
+ // a character-like operand next to a date or time counts as p: "lv_date + '5'" is p
36665
+ if (leftRank === undefined && this.isCharacterLike(left) && dateOrTime) {
36666
+ return rightRank >= 3 ? right : new basic_1.PackedType(8, 0);
36667
+ }
36668
+ else if (rightRank === undefined && this.isCharacterLike(right) && dateOrTime) {
36669
+ return leftRank >= 3 ? left : new basic_1.PackedType(8, 0);
36670
+ }
36671
+ if (rightRank === undefined) {
36455
36672
  return left;
36456
36673
  }
36457
36674
  else if (leftRank === undefined) {
@@ -36459,6 +36676,9 @@ class Source {
36459
36676
  }
36460
36677
  return leftRank >= rightRank ? left : right;
36461
36678
  }
36679
+ static isCharacterLike(type) {
36680
+ return type instanceof basic_1.CharacterType || type instanceof basic_1.NumericType || type instanceof basic_1.StringType;
36681
+ }
36462
36682
  static numericRank(type) {
36463
36683
  if (type instanceof basic_1.DecFloat34Type) {
36464
36684
  return 6;
@@ -37366,6 +37586,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
37366
37586
  exports.SwitchBody = void 0;
37367
37587
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
37368
37588
  const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_syntax/expressions/source.js");
37589
+ const _raise_message_1 = __webpack_require__(/*! ../_raise_message */ "../core/build/src/abap/5_syntax/_raise_message.js");
37369
37590
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
37370
37591
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
37371
37592
  class SwitchBody {
@@ -37373,6 +37594,9 @@ class SwitchBody {
37373
37594
  if (node === undefined) {
37374
37595
  return;
37375
37596
  }
37597
+ for (const t of node.findDirectExpressions(Expressions.Throw)) {
37598
+ _raise_message_1.RaiseMessage.checkThrow(t, input);
37599
+ }
37376
37600
  const thenSource = node.findExpressionAfterToken("THEN");
37377
37601
  if (!((thenSource === null || thenSource === void 0 ? void 0 : thenSource.get()) instanceof Expressions.Source)) {
37378
37602
  const message = "SwitchBody, unexpected";
@@ -44314,6 +44538,7 @@ var __importStar = (this && this.__importStar) || (function () {
44314
44538
  Object.defineProperty(exports, "__esModule", ({ value: true }));
44315
44539
  exports.Loop = void 0;
44316
44540
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
44541
+ const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
44317
44542
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
44318
44543
  const target_1 = __webpack_require__(/*! ../expressions/target */ "../core/build/src/abap/5_syntax/expressions/target.js");
44319
44544
  const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build/src/abap/5_syntax/expressions/source.js");
@@ -44425,6 +44650,17 @@ class Loop {
44425
44650
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
44426
44651
  return;
44427
44652
  }
44653
+ if (key.type === basic_1.TableAccessType.sorted && key.keyFields.length > 0) {
44654
+ // the first component of a sorted secondary key must be compared with = or IS INITIAL
44655
+ // in a part of the condition joined by AND, otherwise the WHERE cannot be optimized
44656
+ const first = key.keyFields[0].toUpperCase();
44657
+ if (this.hasKeyCompare(cond, first) === false) {
44658
+ const message = "Loop, WHERE cannot be optimized for secondary key " + name +
44659
+ ", key component " + first + " needs a comparison with = or IS INITIAL joined by AND";
44660
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
44661
+ return;
44662
+ }
44663
+ }
44428
44664
  if (!(0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v740sp02)) {
44429
44665
  const compares = cond.findAllExpressionsRecursive(Expressions.ComponentCompare).map(c => c.concatTokens().toUpperCase());
44430
44666
  for (const keyField of key.keyFields) {
@@ -44465,6 +44701,31 @@ class Loop {
44465
44701
  loop_group_by_1.LoopGroupBy.runSyntax(group, input);
44466
44702
  }
44467
44703
  }
44704
+ // true if a conjunct reachable through AND only, ie. not under OR or NOT, compares the component with = or IS INITIAL
44705
+ hasKeyCompare(cond, component) {
44706
+ if (cond.findDirectTokenByText("OR") !== undefined) {
44707
+ return false;
44708
+ }
44709
+ for (const child of cond.getChildren()) {
44710
+ if (child.get() instanceof Expressions.ComponentCompare && child instanceof nodes_1.ExpressionNode) {
44711
+ const concat = child.concatTokens().toUpperCase().replace(/\s+/g, " ");
44712
+ if (concat.startsWith(component + " = ")
44713
+ || concat.startsWith(component + " EQ ")
44714
+ || concat === component + " IS INITIAL") {
44715
+ return true;
44716
+ }
44717
+ }
44718
+ else if (child.get() instanceof Expressions.ComponentCondSub
44719
+ && child instanceof nodes_1.ExpressionNode
44720
+ && child.findDirectTokenByText("NOT") === undefined) {
44721
+ const sub = child.findDirectExpression(Expressions.ComponentCond);
44722
+ if (sub !== undefined && this.hasKeyCompare(sub, component)) {
44723
+ return true;
44724
+ }
44725
+ }
44726
+ }
44727
+ return false;
44728
+ }
44468
44729
  }
44469
44730
  exports.Loop = Loop;
44470
44731
  //# sourceMappingURL=loop.js.map
@@ -45832,6 +46093,7 @@ const raise_with_1 = __webpack_require__(/*! ../expressions/raise_with */ "../co
45832
46093
  const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "../core/build/src/abap/5_syntax/_object_oriented.js");
45833
46094
  const method_parameters_1 = __webpack_require__(/*! ../expressions/method_parameters */ "../core/build/src/abap/5_syntax/expressions/method_parameters.js");
45834
46095
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
46096
+ const _raise_message_1 = __webpack_require__(/*! ../_raise_message */ "../core/build/src/abap/5_syntax/_raise_message.js");
45835
46097
  class Raise {
45836
46098
  runSyntax(node, input) {
45837
46099
  // todo
@@ -45891,6 +46153,7 @@ class Raise {
45891
46153
  if (param) {
45892
46154
  new method_parameters_1.MethodParameters().checkExporting(param, input, method, true);
45893
46155
  }
46156
+ _raise_message_1.RaiseMessage.checkRaise(node, input);
45894
46157
  for (const s of node.findDirectExpressions(Expressions.RaiseWith)) {
45895
46158
  raise_with_1.RaiseWith.runSyntax(s, input);
45896
46159
  }
@@ -49878,6 +50141,107 @@ exports.Statics = Statics;
49878
50141
 
49879
50142
  /***/ },
49880
50143
 
50144
+ /***/ "../core/build/src/abap/5_syntax/structures/try.js"
50145
+ /*!*********************************************************!*\
50146
+ !*** ../core/build/src/abap/5_syntax/structures/try.js ***!
50147
+ \*********************************************************/
50148
+ (__unused_webpack_module, exports, __webpack_require__) {
50149
+
50150
+ "use strict";
50151
+
50152
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
50153
+ if (k2 === undefined) k2 = k;
50154
+ var desc = Object.getOwnPropertyDescriptor(m, k);
50155
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
50156
+ desc = { enumerable: true, get: function() { return m[k]; } };
50157
+ }
50158
+ Object.defineProperty(o, k2, desc);
50159
+ }) : (function(o, m, k, k2) {
50160
+ if (k2 === undefined) k2 = k;
50161
+ o[k2] = m[k];
50162
+ }));
50163
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
50164
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
50165
+ }) : function(o, v) {
50166
+ o["default"] = v;
50167
+ });
50168
+ var __importStar = (this && this.__importStar) || (function () {
50169
+ var ownKeys = function(o) {
50170
+ ownKeys = Object.getOwnPropertyNames || function (o) {
50171
+ var ar = [];
50172
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
50173
+ return ar;
50174
+ };
50175
+ return ownKeys(o);
50176
+ };
50177
+ return function (mod) {
50178
+ if (mod && mod.__esModule) return mod;
50179
+ var result = {};
50180
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
50181
+ __setModuleDefault(result, mod);
50182
+ return result;
50183
+ };
50184
+ })();
50185
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
50186
+ exports.Try = void 0;
50187
+ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
50188
+ const Statements = __importStar(__webpack_require__(/*! ../../2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
50189
+ const Structures = __importStar(__webpack_require__(/*! ../../3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
50190
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
50191
+ // "special exceptions must be caught before general exceptions", a CATCH of a class that inherits
50192
+ // from a class named in an earlier CATCH of the same TRY can never be reached, this is a syntax error
50193
+ // only reported when the lineage of the later class is known up to the earlier class, void classes are skipped
50194
+ class Try {
50195
+ static runSyntax(node, input) {
50196
+ const caught = new Set();
50197
+ for (const catchStructure of node.findDirectStructures(Structures.Catch)) {
50198
+ const statement = catchStructure.findDirectStatement(Statements.Catch);
50199
+ if (statement === undefined) {
50200
+ continue;
50201
+ }
50202
+ const names = [];
50203
+ for (const c of statement.findDirectExpressions(Expressions.ClassName)) {
50204
+ const token = c.getFirstToken();
50205
+ const className = token.getStr().toUpperCase();
50206
+ names.push(className);
50207
+ if (caught.size === 0) {
50208
+ continue;
50209
+ }
50210
+ const superclass = this.findCaughtSuperclass(className, caught, input);
50211
+ if (superclass !== undefined) {
50212
+ const message = `CATCH of ${className} after the CATCH of its superclass ${superclass}`;
50213
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
50214
+ return;
50215
+ }
50216
+ }
50217
+ for (const name of names) {
50218
+ caught.add(name);
50219
+ }
50220
+ }
50221
+ }
50222
+ static findCaughtSuperclass(className, caught, input) {
50223
+ var _a;
50224
+ const visited = new Set([className]);
50225
+ let current = input.scope.findClassDefinition(className);
50226
+ while (current !== undefined) {
50227
+ const superclass = (_a = current.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
50228
+ if (superclass === undefined || visited.has(superclass)) {
50229
+ return undefined;
50230
+ }
50231
+ else if (caught.has(superclass)) {
50232
+ return superclass;
50233
+ }
50234
+ visited.add(superclass);
50235
+ current = input.scope.findClassDefinition(superclass);
50236
+ }
50237
+ return undefined;
50238
+ }
50239
+ }
50240
+ exports.Try = Try;
50241
+ //# sourceMappingURL=try.js.map
50242
+
50243
+ /***/ },
50244
+
49881
50245
  /***/ "../core/build/src/abap/5_syntax/structures/type_enum.js"
49882
50246
  /*!***************************************************************!*\
49883
50247
  !*** ../core/build/src/abap/5_syntax/structures/type_enum.js ***!
@@ -50285,6 +50649,7 @@ const types_1 = __webpack_require__(/*! ./structures/types */ "../core/build/src
50285
50649
  const statics_1 = __webpack_require__(/*! ./structures/statics */ "../core/build/src/abap/5_syntax/structures/statics.js");
50286
50650
  const constants_1 = __webpack_require__(/*! ./structures/constants */ "../core/build/src/abap/5_syntax/structures/constants.js");
50287
50651
  const cleanup_1 = __webpack_require__(/*! ./structures/cleanup */ "../core/build/src/abap/5_syntax/structures/cleanup.js");
50652
+ const try_1 = __webpack_require__(/*! ./structures/try */ "../core/build/src/abap/5_syntax/structures/try.js");
50288
50653
  const class_definition_1 = __webpack_require__(/*! ../types/class_definition */ "../core/build/src/abap/types/class_definition.js");
50289
50654
  const interface_definition_1 = __webpack_require__(/*! ../types/interface_definition */ "../core/build/src/abap/types/interface_definition.js");
50290
50655
  const delete_memory_1 = __webpack_require__(/*! ./statements/delete_memory */ "../core/build/src/abap/5_syntax/statements/delete_memory.js");
@@ -50770,6 +51135,9 @@ class SyntaxLogic {
50770
51135
  else if (stru instanceof Structures.Cleanup) {
50771
51136
  cleanup_1.Cleanup.runSyntax(node, input);
50772
51137
  }
51138
+ else if (stru instanceof Structures.Try) {
51139
+ try_1.Try.runSyntax(node, input);
51140
+ }
50773
51141
  return false;
50774
51142
  }
50775
51143
  updateScopeStatement(node) {
@@ -73230,7 +73598,7 @@ class Registry {
73230
73598
  }
73231
73599
  static abaplintVersion() {
73232
73600
  // magic, see build script "version.js"
73233
- return "2.120.100";
73601
+ return "2.120.102";
73234
73602
  }
73235
73603
  getDDICReferences() {
73236
73604
  return this.ddicReferences;
@@ -90858,13 +91226,18 @@ class FullyTypeConstants extends _abap_rule_1.ABAPRule {
90858
91226
  if ((stat.get() instanceof Statements.Constant
90859
91227
  || (this.conf.checkData === true && stat.get() instanceof Statements.Data))
90860
91228
  && !this.isTyped(stat)) {
91229
+ if (stat.get() instanceof Statements.Data && stat.findDirectExpression(expressions_1.DataDefinition) === undefined) {
91230
+ // unnamed field, eg. "DATA (10)." inside DATA BEGIN OF, cannot be typed
91231
+ continue;
91232
+ }
90861
91233
  const type = stat.get() instanceof Statements.Constant ? "constant definition" : "data definition";
90862
91234
  let token = (_a = stat.findFirstExpression(expressions_1.NamespaceSimpleName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
90863
91235
  if (token === undefined) {
90864
91236
  token = (_b = stat.findFirstExpression(expressions_1.DefinitionName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
90865
91237
  }
90866
91238
  if (token === undefined) {
90867
- throw new Error("fully type constants, unexpected node");
91239
+ const start = stat.getFirstToken().getStart();
91240
+ throw new Error(`fully type constants: unexpected node, ${file.getFilename()}, row ${start.getRow()}, col ${start.getCol()}, statement "${stat.concatTokens()}"`);
90868
91241
  }
90869
91242
  issues.push(issue_1.Issue.atToken(file, token, this.getDescription(type), this.getMetadata().key, this.conf.severity));
90870
91243
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.100",
3
+ "version": "2.120.102",
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.100",
42
+ "@abaplint/core": "^2.120.102",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",