@abaplint/cli 2.120.23 → 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 +57 -10
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -12681,7 +12681,7 @@ class ClassDefinition {
12681
12681
  const risk = (0, combi_1.seq)("RISK LEVEL", level);
12682
12682
  const time = (0, combi_1.altPrio)("LONG", "MEDIUM", "SHORT");
12683
12683
  const duration = (0, combi_1.seq)("DURATION", time);
12684
- const blah = (0, combi_1.per)(expressions_1.ClassGlobal, expressions_1.ClassFinal, "ABSTRACT", (0, combi_1.seq)("INHERITING FROM", expressions_1.SuperClassName), create, "FOR TESTING", risk, "SHARED MEMORY ENABLED", duration, (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("FOR BEHAVIOR OF", expressions_1.BehaviorDefinitionName), { also: combi_1.AlsoIn.OpenABAP }), expressions_1.ClassFriends);
12684
+ const blah = (0, combi_1.per)(expressions_1.ClassGlobal, expressions_1.ClassFinal, "ABSTRACT", (0, combi_1.seq)("INHERITING FROM", expressions_1.SuperClassName), create, "FOR TESTING", risk, "SHARED MEMORY ENABLED", duration, (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("FOR BEHAVIOR OF", expressions_1.BehaviorDefinitionName), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v758, (0, combi_1.seq)("FOR EVENTS OF", expressions_1.BehaviorDefinitionName)), expressions_1.ClassFriends);
12685
12685
  const def = (0, combi_1.seq)("DEFINITION", (0, combi_1.optPrio)(blah));
12686
12686
  return (0, combi_1.seq)("CLASS", expressions_1.ClassName, def);
12687
12687
  }
@@ -16650,6 +16650,7 @@ exports.MethodDef = void 0;
16650
16650
  const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
16651
16651
  const combi_1 = __webpack_require__(/*! ../combi */ "../core/build/src/abap/2_statements/combi.js");
16652
16652
  const expressions_1 = __webpack_require__(/*! ../expressions */ "../core/build/src/abap/2_statements/expressions/index.js");
16653
+ const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
16653
16654
  class MethodDef {
16654
16655
  getMatcher() {
16655
16656
  const def = (0, combi_1.ver)(version_1.Release.v740sp08, (0, combi_1.seq)("DEFAULT", (0, combi_1.altPrio)("FAIL", "IGNORE")), { also: combi_1.AlsoIn.OpenABAP });
@@ -16663,6 +16664,9 @@ class MethodDef {
16663
16664
  const modify = (0, combi_1.alt)((0, combi_1.seq)("FOR ACTION", expressions_1.TypeName, (0, combi_1.optPrio)(result)), (0, combi_1.seq)("FOR CREATE", (0, combi_1.alt)(expressions_1.TypeName, expressions_1.EntityAssociation)), (0, combi_1.seq)("FOR DELETE", expressions_1.TypeName), (0, combi_1.seq)("FOR UPDATE", expressions_1.TypeName));
16664
16665
  const forRead = (0, combi_1.seq)("FOR READ", (0, combi_1.alt)(expressions_1.TypeName, expressions_1.EntityAssociation), (0, combi_1.optPrio)(full), result, (0, combi_1.optPrio)(link));
16665
16666
  const forfunction = (0, combi_1.seq)("FOR FUNCTION", expressions_1.TypeName, result);
16667
+ const entityEventReference = (0, combi_1.seq)("REFERENCE", (0, combi_1.tok)(tokens_1.ParenLeft), expressions_1.MethodParamName, (0, combi_1.tok)(tokens_1.ParenRightW));
16668
+ const entityEventParameter = (0, combi_1.seq)((0, combi_1.altPrio)(entityEventReference, expressions_1.MethodParamName), "FOR", expressions_1.TypeName);
16669
+ const entityEvent = (0, combi_1.seq)((0, combi_1.optPrio)("FINAL"), "FOR ENTITY EVENT", (0, combi_1.optPrio)("IMPORTING"), (0, combi_1.plus)(entityEventParameter));
16666
16670
  const behavior = (0, combi_1.altPrio)("DDL OBJECT OPTIONS CDS SESSION CLIENT REQUIRED", // todo, this is only from version something
16667
16671
  (0, combi_1.seq)("TABLE FUNCTION", expressions_1.NamespaceSimpleName), // todo, this is only from version something
16668
16672
  (0, combi_1.seq)("VALIDATE ON SAVE IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("MODIFY", (0, combi_1.opt)("IMPORTING"), (0, combi_1.plus)((0, combi_1.seq)(expressions_1.MethodParamName, modify))), (0, combi_1.seq)("PRECHECK IMPORTING", expressions_1.MethodParamName, modify), (0, combi_1.seq)("DETERMINATION", expressions_1.TypeName, "IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("VALIDATION", expressions_1.TypeName, "IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("NUMBERING IMPORTING", expressions_1.MethodParamName, modify), (0, combi_1.seq)("READ IMPORTING", expressions_1.MethodParamName, (0, combi_1.altPrio)(forRead, forfunction)), (0, combi_1.seq)("FEATURES IMPORTING", expressions_1.MethodParamName, "REQUEST", expressions_1.NamespaceSimpleName, "FOR", expressions_1.NamespaceSimpleName, result), (0, combi_1.seq)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR CREATE", expressions_1.TypeName, expressions_1.MethodParamName, "FOR UPDATE", expressions_1.TypeName, expressions_1.MethodParamName, "FOR DELETE", expressions_1.TypeName), (0, combi_1.seq)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR READ", expressions_1.TypeName, result), (0, combi_1.seq)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR UPDATE", expressions_1.TypeName), (0, combi_1.seq)((0, combi_1.alt)("BEHAVIOR", "LOCK"), "IMPORTING", expressions_1.MethodParamName, "FOR LOCK", expressions_1.TypeName), (0, combi_1.seq)("DETERMINE", (0, combi_1.alt)("ON MODIFY", "ON SAVE"), "IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("GLOBAL AUTHORIZATION IMPORTING REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result), (0, combi_1.seq)("GLOBAL FEATURES IMPORTING REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result), (0, combi_1.seq)((0, combi_1.seq)((0, combi_1.opt)("INSTANCE"), "AUTHORIZATION IMPORTING"), expressions_1.MethodParamName, "REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result), (0, combi_1.seq)("INSTANCE FEATURES IMPORTING", expressions_1.MethodParamName, "REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result));
@@ -16670,7 +16674,9 @@ class MethodDef {
16670
16674
  // AMDP OPTIONS clause blocked in KeyUser
16671
16675
  const amdp = (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("AMDP OPTIONS", (0, combi_1.optPrio)("READ-ONLY"), "CDS SESSION CLIENT", (0, combi_1.alt)("CURRENT", "DEPENDENT"), (0, combi_1.optPrio)(expressions_1.MethodDefImporting), (0, combi_1.optPrio)(expressions_1.MethodDefExporting), (0, combi_1.optPrio)(expressions_1.MethodDefRaising)));
16672
16676
  // FOR DDL OBJECT / FOR TABLE FUNCTION / FOR SCALAR FUNCTION blocked in KeyUser
16673
- const ret = (0, combi_1.seq)((0, combi_1.altPrio)("CLASS-METHODS", "METHODS"), expressions_1.MethodName, (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.optPrio)(expressions_1.Abstract), (0, combi_1.optPrio)(def), expressions_1.EventHandler), parameters, testing, (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("FOR", behavior)), amdp, "NOT AT END OF MODE", (0, combi_1.optPrio)(expressions_1.Redefinition)));
16677
+ const regular = (0, combi_1.seq)((0, combi_1.altPrio)("CLASS-METHODS", "METHODS"), expressions_1.MethodName, (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.optPrio)(expressions_1.Abstract), (0, combi_1.optPrio)(def), expressions_1.EventHandler), parameters, testing, (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("FOR", behavior)), amdp, "NOT AT END OF MODE", (0, combi_1.optPrio)(expressions_1.Redefinition)));
16678
+ // RAP event handlers are instance methods; CLASS-METHODS is not allowed.
16679
+ const ret = (0, combi_1.alt)((0, combi_1.seq)("METHODS", expressions_1.MethodName, (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, entityEvent)), regular);
16674
16680
  return ret;
16675
16681
  }
16676
16682
  }
@@ -27573,6 +27579,12 @@ class TypeUtils {
27573
27579
  if (source2 instanceof basic_1.HexType && this.isCalculated(node2) && source1 instanceof basic_1.IntegerType) {
27574
27580
  return false;
27575
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
+ }
27576
27588
  return true;
27577
27589
  }
27578
27590
  structureContainsString(structure) {
@@ -29570,6 +29582,7 @@ const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_s
29570
29582
  const method_call_chain_1 = __webpack_require__(/*! ./method_call_chain */ "../core/build/src/abap/5_syntax/expressions/method_call_chain.js");
29571
29583
  const source_field_symbol_1 = __webpack_require__(/*! ./source_field_symbol */ "../core/build/src/abap/5_syntax/expressions/source_field_symbol.js");
29572
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");
29573
29586
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
29574
29587
  class Compare {
29575
29588
  static runSyntax(node, input) {
@@ -29587,7 +29600,15 @@ class Compare {
29587
29600
  if (node.findDirectExpression(Expressions.CompareOperator)
29588
29601
  && new _type_utils_1.TypeUtils(input.scope).isCompareable(sourceTypes[0], sourceTypes[1], sources[0], sources[1]) === false
29589
29602
  && sourceTypes.length === 2) {
29590
- 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
+ }
29591
29612
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
29592
29613
  }
29593
29614
  }
@@ -37619,7 +37640,12 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
37619
37640
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
37620
37641
  class Catch {
37621
37642
  runSyntax(node, input) {
37622
- 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
+ }
37623
37649
  const names = new Set();
37624
37650
  for (const c of node.findDirectExpressions(Expressions.ClassName)) {
37625
37651
  const token = c.getFirstToken();
@@ -37643,9 +37669,8 @@ class Catch {
37643
37669
  }
37644
37670
  names.add(className);
37645
37671
  }
37646
- const target = node.findDirectExpression(Expressions.Target);
37647
37672
  if (target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData)) {
37648
- 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();
37649
37674
  if (token) {
37650
37675
  const classNames = Array.from(names);
37651
37676
  const unknownClass = classNames.find(name => input.scope.findClassDefinition(name) === undefined);
@@ -47595,6 +47620,7 @@ const include_type_1 = __webpack_require__(/*! ../statements/include_type */ "..
47595
47620
  const type_1 = __webpack_require__(/*! ../statements/type */ "../core/build/src/abap/5_syntax/statements/type.js");
47596
47621
  const Basic = __importStar(__webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js"));
47597
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");
47598
47624
  class Types {
47599
47625
  runSyntax(node, input, qualifiedNamePrefix) {
47600
47626
  const name = node.findFirstExpression(Expressions.NamespaceSimpleName).getFirstToken();
@@ -47609,6 +47635,9 @@ class Types {
47609
47635
  if (ctyp instanceof Statements.Type) {
47610
47636
  const found = new type_1.Type().runSyntax(c, input, qualifiedNamePrefix + name.getStr() + "-");
47611
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
+ }
47612
47641
  components.push({ name: found.getName(), type: found.getType() });
47613
47642
  }
47614
47643
  }
@@ -47625,6 +47654,9 @@ class Types {
47625
47654
  else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Types) {
47626
47655
  const found = new Types().runSyntax(c, input, qualifiedNamePrefix + name.getStr() + "-");
47627
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
+ }
47628
47660
  components.push({ name: found.getName(), type: found.getType() });
47629
47661
  }
47630
47662
  }
@@ -51725,7 +51757,7 @@ class ClassDefinition extends _identifier_1.Identifier {
51725
51757
  this.checkEventNameConflicts(input);
51726
51758
  this.checkClassNameLength(input);
51727
51759
  this.checkMethodNameLength(input);
51728
- this.checkClassConstructorStatic(input);
51760
+ this.checkClassConstructor(input);
51729
51761
  }
51730
51762
  getFriends() {
51731
51763
  return this.friends;
@@ -51795,11 +51827,17 @@ class ClassDefinition extends _identifier_1.Identifier {
51795
51827
  }
51796
51828
  }
51797
51829
  }
51798
- checkClassConstructorStatic(input) {
51830
+ checkClassConstructor(input) {
51799
51831
  for (const m of this.methodDefs.getAll()) {
51800
- if (m.getName().toUpperCase() === "CLASS_CONSTRUCTOR" && m.isStatic() === false) {
51832
+ if (m.getName().toUpperCase() !== "CLASS_CONSTRUCTOR") {
51833
+ continue;
51834
+ }
51835
+ if (m.isStatic() === false) {
51801
51836
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), "CLASS_CONSTRUCTOR must be static"));
51802
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
+ }
51803
51841
  }
51804
51842
  }
51805
51843
  checkInterfaceVisibility(input, node) {
@@ -52964,6 +53002,7 @@ const _object_oriented_1 = __webpack_require__(/*! ../5_syntax/_object_oriented
52964
53002
  const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
52965
53003
  const identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ "../core/build/src/abap/1_lexer/tokens/identifier.js");
52966
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");
52967
53006
  // todo:
52968
53007
  // this.exceptions = [];
52969
53008
  // also consider RAISING vs EXCEPTIONS
@@ -52986,6 +53025,7 @@ class MethodParameters {
52986
53025
  input.scope.push(_scope_type_1.ScopeType.MethodDefinition, "method definition", node.getStart(), input.filename);
52987
53026
  try {
52988
53027
  this.parse(node, input, parentName, abstractMethod);
53028
+ this.checkNameLengths(input);
52989
53029
  this.checkDuplicateNames();
52990
53030
  }
52991
53031
  finally {
@@ -53137,6 +53177,13 @@ class MethodParameters {
53137
53177
  names.add(name);
53138
53178
  }
53139
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
+ }
53140
53187
  workaroundRAP(node, input, parentName) {
53141
53188
  const resultName = node.findExpressionAfterToken("RESULT");
53142
53189
  const concat = node.concatTokens().toUpperCase();
@@ -69671,7 +69718,7 @@ class Registry {
69671
69718
  }
69672
69719
  static abaplintVersion() {
69673
69720
  // magic, see build script "version.js"
69674
- return "2.120.23";
69721
+ return "2.120.25";
69675
69722
  }
69676
69723
  getDDICReferences() {
69677
69724
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.23",
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.23",
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",