@abaplint/cli 2.120.24 → 2.120.25

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 +49 -8
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -27579,6 +27579,12 @@ class TypeUtils {
27579
27579
  if (source2 instanceof basic_1.HexType && this.isCalculated(node2) && source1 instanceof basic_1.IntegerType) {
27580
27580
  return false;
27581
27581
  }
27582
+ if (source1 instanceof basic_1.DateType && this.isCalculated(node2) && source2 instanceof basic_1.IntegerType) {
27583
+ return false;
27584
+ }
27585
+ if (source2 instanceof basic_1.DateType && this.isCalculated(node1) && source1 instanceof basic_1.IntegerType) {
27586
+ return false;
27587
+ }
27582
27588
  return true;
27583
27589
  }
27584
27590
  structureContainsString(structure) {
@@ -29576,6 +29582,7 @@ const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_s
29576
29582
  const method_call_chain_1 = __webpack_require__(/*! ./method_call_chain */ "../core/build/src/abap/5_syntax/expressions/method_call_chain.js");
29577
29583
  const source_field_symbol_1 = __webpack_require__(/*! ./source_field_symbol */ "../core/build/src/abap/5_syntax/expressions/source_field_symbol.js");
29578
29584
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
29585
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
29579
29586
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
29580
29587
  class Compare {
29581
29588
  static runSyntax(node, input) {
@@ -29593,7 +29600,15 @@ class Compare {
29593
29600
  if (node.findDirectExpression(Expressions.CompareOperator)
29594
29601
  && new _type_utils_1.TypeUtils(input.scope).isCompareable(sourceTypes[0], sourceTypes[1], sources[0], sources[1]) === false
29595
29602
  && sourceTypes.length === 2) {
29596
- const message = "Incompatible types for comparison";
29603
+ let message = "Incompatible types for comparison";
29604
+ if ((sourceTypes[0] instanceof basic_1.DateType
29605
+ && sourceTypes[1] instanceof basic_1.IntegerType
29606
+ && sources[1].findFirstExpression(Expressions.ArithOperator))
29607
+ || (sourceTypes[1] instanceof basic_1.DateType
29608
+ && sourceTypes[0] instanceof basic_1.IntegerType
29609
+ && sources[0].findFirstExpression(Expressions.ArithOperator))) {
29610
+ message = "Date cannot be compared with arithmetic result of type Integer";
29611
+ }
29597
29612
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
29598
29613
  }
29599
29614
  }
@@ -37625,7 +37640,12 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
37625
37640
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
37626
37641
  class Catch {
37627
37642
  runSyntax(node, input) {
37628
- var _a;
37643
+ var _a, _b, _c;
37644
+ const target = node.findDirectExpression(Expressions.Target);
37645
+ const inlineTarget = (_b = (_a = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
37646
+ if (inlineTarget && inlineTarget.getStr().length > 30) {
37647
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, inlineTarget, "Inline exception name longer than 30 characters"));
37648
+ }
37629
37649
  const names = new Set();
37630
37650
  for (const c of node.findDirectExpressions(Expressions.ClassName)) {
37631
37651
  const token = c.getFirstToken();
@@ -37649,9 +37669,8 @@ class Catch {
37649
37669
  }
37650
37670
  names.add(className);
37651
37671
  }
37652
- const target = node.findDirectExpression(Expressions.Target);
37653
37672
  if (target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData)) {
37654
- const token = (_a = target.findFirstExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
37673
+ const token = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.getFirstToken();
37655
37674
  if (token) {
37656
37675
  const classNames = Array.from(names);
37657
37676
  const unknownClass = classNames.find(name => input.scope.findClassDefinition(name) === undefined);
@@ -47601,6 +47620,7 @@ const include_type_1 = __webpack_require__(/*! ../statements/include_type */ "..
47601
47620
  const type_1 = __webpack_require__(/*! ../statements/type */ "../core/build/src/abap/5_syntax/statements/type.js");
47602
47621
  const Basic = __importStar(__webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js"));
47603
47622
  const _scope_type_1 = __webpack_require__(/*! ../_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
47623
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
47604
47624
  class Types {
47605
47625
  runSyntax(node, input, qualifiedNamePrefix) {
47606
47626
  const name = node.findFirstExpression(Expressions.NamespaceSimpleName).getFirstToken();
@@ -47615,6 +47635,9 @@ class Types {
47615
47635
  if (ctyp instanceof Statements.Type) {
47616
47636
  const found = new type_1.Type().runSyntax(c, input, qualifiedNamePrefix + name.getStr() + "-");
47617
47637
  if (found) {
47638
+ if (found.getName().length > 30) {
47639
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, found.getToken(), "Structure field name longer than 30 characters"));
47640
+ }
47618
47641
  components.push({ name: found.getName(), type: found.getType() });
47619
47642
  }
47620
47643
  }
@@ -47631,6 +47654,9 @@ class Types {
47631
47654
  else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Types) {
47632
47655
  const found = new Types().runSyntax(c, input, qualifiedNamePrefix + name.getStr() + "-");
47633
47656
  if (found) {
47657
+ if (found.getName().length > 30) {
47658
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, found.getToken(), "Structure field name longer than 30 characters"));
47659
+ }
47634
47660
  components.push({ name: found.getName(), type: found.getType() });
47635
47661
  }
47636
47662
  }
@@ -51731,7 +51757,7 @@ class ClassDefinition extends _identifier_1.Identifier {
51731
51757
  this.checkEventNameConflicts(input);
51732
51758
  this.checkClassNameLength(input);
51733
51759
  this.checkMethodNameLength(input);
51734
- this.checkClassConstructorStatic(input);
51760
+ this.checkClassConstructor(input);
51735
51761
  }
51736
51762
  getFriends() {
51737
51763
  return this.friends;
@@ -51801,11 +51827,17 @@ class ClassDefinition extends _identifier_1.Identifier {
51801
51827
  }
51802
51828
  }
51803
51829
  }
51804
- checkClassConstructorStatic(input) {
51830
+ checkClassConstructor(input) {
51805
51831
  for (const m of this.methodDefs.getAll()) {
51806
- if (m.getName().toUpperCase() === "CLASS_CONSTRUCTOR" && m.isStatic() === false) {
51832
+ if (m.getName().toUpperCase() !== "CLASS_CONSTRUCTOR") {
51833
+ continue;
51834
+ }
51835
+ if (m.isStatic() === false) {
51807
51836
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), "CLASS_CONSTRUCTOR must be static"));
51808
51837
  }
51838
+ else if (m.getVisibility() !== visibility_1.Visibility.Public) {
51839
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), "CLASS_CONSTRUCTOR must be declared in the public section"));
51840
+ }
51809
51841
  }
51810
51842
  }
51811
51843
  checkInterfaceVisibility(input, node) {
@@ -52970,6 +53002,7 @@ const _object_oriented_1 = __webpack_require__(/*! ../5_syntax/_object_oriented
52970
53002
  const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
52971
53003
  const identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ "../core/build/src/abap/1_lexer/tokens/identifier.js");
52972
53004
  const _scope_type_1 = __webpack_require__(/*! ../5_syntax/_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
53005
+ const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
52973
53006
  // todo:
52974
53007
  // this.exceptions = [];
52975
53008
  // also consider RAISING vs EXCEPTIONS
@@ -52992,6 +53025,7 @@ class MethodParameters {
52992
53025
  input.scope.push(_scope_type_1.ScopeType.MethodDefinition, "method definition", node.getStart(), input.filename);
52993
53026
  try {
52994
53027
  this.parse(node, input, parentName, abstractMethod);
53028
+ this.checkNameLengths(input);
52995
53029
  this.checkDuplicateNames();
52996
53030
  }
52997
53031
  finally {
@@ -53143,6 +53177,13 @@ class MethodParameters {
53143
53177
  names.add(name);
53144
53178
  }
53145
53179
  }
53180
+ checkNameLengths(input) {
53181
+ for (const parameter of this.getAll()) {
53182
+ if (parameter.getName().length > 30) {
53183
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, parameter.getToken(), "Method parameter name longer than 30 characters"));
53184
+ }
53185
+ }
53186
+ }
53146
53187
  workaroundRAP(node, input, parentName) {
53147
53188
  const resultName = node.findExpressionAfterToken("RESULT");
53148
53189
  const concat = node.concatTokens().toUpperCase();
@@ -69677,7 +69718,7 @@ class Registry {
69677
69718
  }
69678
69719
  static abaplintVersion() {
69679
69720
  // magic, see build script "version.js"
69680
- return "2.120.24";
69721
+ return "2.120.25";
69681
69722
  }
69682
69723
  getDDICReferences() {
69683
69724
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.24",
3
+ "version": "2.120.25",
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.24",
42
+ "@abaplint/core": "^2.120.25",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",