@abaplint/cli 2.120.24 → 2.120.26

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 +114 -40
  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) {
@@ -29097,6 +29103,51 @@ exports.BasicTypes = BasicTypes;
29097
29103
 
29098
29104
  /***/ },
29099
29105
 
29106
+ /***/ "../core/build/src/abap/5_syntax/expressions/_check_database_fields.js"
29107
+ /*!*****************************************************************************!*\
29108
+ !*** ../core/build/src/abap/5_syntax/expressions/_check_database_fields.js ***!
29109
+ \*****************************************************************************/
29110
+ (__unused_webpack_module, exports, __webpack_require__) {
29111
+
29112
+ "use strict";
29113
+
29114
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
29115
+ exports.checkDatabaseFields = checkDatabaseFields;
29116
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
29117
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
29118
+ function checkDatabaseFields(fields, dbSources, input, token) {
29119
+ if (dbSources.length > 1) {
29120
+ return;
29121
+ }
29122
+ const first = dbSources[0];
29123
+ if (first === undefined) {
29124
+ // then its voided
29125
+ return;
29126
+ }
29127
+ const type = first.parseType(input.scope.getRegistry());
29128
+ if (type instanceof basic_1.VoidType || type instanceof basic_1.UnknownType) {
29129
+ return;
29130
+ }
29131
+ if (!(type instanceof basic_1.StructureType)) {
29132
+ const message = "checkFields, expected structure, " + type.constructor.name;
29133
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
29134
+ return;
29135
+ }
29136
+ for (const field of fields) {
29137
+ if (field === "*") {
29138
+ continue;
29139
+ }
29140
+ if (/^\w+$/.test(field) && type.getComponentByName(field) === undefined) {
29141
+ const message = `checkFields, field ${field} not found`;
29142
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
29143
+ return;
29144
+ }
29145
+ }
29146
+ }
29147
+ //# sourceMappingURL=_check_database_fields.js.map
29148
+
29149
+ /***/ },
29150
+
29100
29151
  /***/ "../core/build/src/abap/5_syntax/expressions/_check_offset_length.js"
29101
29152
  /*!***************************************************************************!*\
29102
29153
  !*** ../core/build/src/abap/5_syntax/expressions/_check_offset_length.js ***!
@@ -29576,6 +29627,7 @@ const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_s
29576
29627
  const method_call_chain_1 = __webpack_require__(/*! ./method_call_chain */ "../core/build/src/abap/5_syntax/expressions/method_call_chain.js");
29577
29628
  const source_field_symbol_1 = __webpack_require__(/*! ./source_field_symbol */ "../core/build/src/abap/5_syntax/expressions/source_field_symbol.js");
29578
29629
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
29630
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
29579
29631
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
29580
29632
  class Compare {
29581
29633
  static runSyntax(node, input) {
@@ -29593,7 +29645,15 @@ class Compare {
29593
29645
  if (node.findDirectExpression(Expressions.CompareOperator)
29594
29646
  && new _type_utils_1.TypeUtils(input.scope).isCompareable(sourceTypes[0], sourceTypes[1], sources[0], sources[1]) === false
29595
29647
  && sourceTypes.length === 2) {
29596
- const message = "Incompatible types for comparison";
29648
+ let message = "Incompatible types for comparison";
29649
+ if ((sourceTypes[0] instanceof basic_1.DateType
29650
+ && sourceTypes[1] instanceof basic_1.IntegerType
29651
+ && sources[1].findFirstExpression(Expressions.ArithOperator))
29652
+ || (sourceTypes[1] instanceof basic_1.DateType
29653
+ && sourceTypes[0] instanceof basic_1.IntegerType
29654
+ && sources[0].findFirstExpression(Expressions.ArithOperator))) {
29655
+ message = "Date cannot be compared with arithmetic result of type Integer";
29656
+ }
29597
29657
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
29598
29658
  }
29599
29659
  }
@@ -33737,6 +33797,7 @@ const dynamic_1 = __webpack_require__(/*! ./dynamic */ "../core/build/src/abap/5
33737
33797
  const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
33738
33798
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
33739
33799
  const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
33800
+ const _check_database_fields_1 = __webpack_require__(/*! ./_check_database_fields */ "../core/build/src/abap/5_syntax/expressions/_check_database_fields.js");
33740
33801
  const isSimple = /^\w+$/;
33741
33802
  class Select {
33742
33803
  static runSyntax(node, input, skipImplicitInto = false, selectLoop = false) {
@@ -33761,7 +33822,7 @@ class Select {
33761
33822
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
33762
33823
  return;
33763
33824
  }
33764
- this.checkFields(fields, dbSources, input, node);
33825
+ (0, _check_database_fields_1.checkDatabaseFields)(fields.map(field => field.code), dbSources, input, node.getFirstToken());
33765
33826
  const intoExpression = this.handleInto(node, input, fields, dbSources);
33766
33827
  const fae = node.findDirectExpression(Expressions.SQLForAllEntries);
33767
33828
  if (fae) {
@@ -33988,35 +34049,6 @@ class Select {
33988
34049
  }
33989
34050
  return undefined;
33990
34051
  }
33991
- static checkFields(fields, dbSources, input, node) {
33992
- if (dbSources.length > 1) {
33993
- return;
33994
- }
33995
- const first = dbSources[0];
33996
- if (first === undefined) {
33997
- // then its voided
33998
- return;
33999
- }
34000
- const type = first.parseType(input.scope.getRegistry());
34001
- if (type instanceof basic_1.VoidType || type instanceof basic_1.UnknownType) {
34002
- return;
34003
- }
34004
- if (!(type instanceof basic_1.StructureType)) {
34005
- const message = "checkFields, expected structure, " + type.constructor.name;
34006
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
34007
- return;
34008
- }
34009
- for (const field of fields) {
34010
- if (field.code === "*") {
34011
- continue;
34012
- }
34013
- if (isSimple.test(field.code) && type.getComponentByName(field.code) === undefined) {
34014
- const message = `checkFields, field ${field.code} not found`;
34015
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
34016
- return;
34017
- }
34018
- }
34019
- }
34020
34052
  static countResultType(scope) {
34021
34053
  if ((0, version_1.releaseAtLeast)(scope.getRelease(), version_1.Release.v750)
34022
34054
  || scope.getOpenABAP()
@@ -37625,7 +37657,12 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
37625
37657
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
37626
37658
  class Catch {
37627
37659
  runSyntax(node, input) {
37628
- var _a;
37660
+ var _a, _b, _c;
37661
+ const target = node.findDirectExpression(Expressions.Target);
37662
+ 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();
37663
+ if (inlineTarget && inlineTarget.getStr().length > 30) {
37664
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, inlineTarget, "Inline exception name longer than 30 characters"));
37665
+ }
37629
37666
  const names = new Set();
37630
37667
  for (const c of node.findDirectExpressions(Expressions.ClassName)) {
37631
37668
  const token = c.getFirstToken();
@@ -37649,9 +37686,8 @@ class Catch {
37649
37686
  }
37650
37687
  names.add(className);
37651
37688
  }
37652
- const target = node.findDirectExpression(Expressions.Target);
37653
37689
  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();
37690
+ const token = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.getFirstToken();
37655
37691
  if (token) {
37656
37692
  const classNames = Array.from(names);
37657
37693
  const unknownClass = classNames.find(name => input.scope.findClassDefinition(name) === undefined);
@@ -39365,6 +39401,7 @@ const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expr
39365
39401
  const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build/src/abap/5_syntax/expressions/source.js");
39366
39402
  const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "../core/build/src/abap/5_syntax/expressions/dynamic.js");
39367
39403
  const database_table_1 = __webpack_require__(/*! ../expressions/database_table */ "../core/build/src/abap/5_syntax/expressions/database_table.js");
39404
+ const _check_database_fields_1 = __webpack_require__(/*! ../expressions/_check_database_fields */ "../core/build/src/abap/5_syntax/expressions/_check_database_fields.js");
39368
39405
  class DeleteDatabase {
39369
39406
  runSyntax(node, input) {
39370
39407
  for (const s of node.findAllExpressions(Expressions.Source)) {
@@ -39378,7 +39415,14 @@ class DeleteDatabase {
39378
39415
  }
39379
39416
  const dbtab = node.findFirstExpression(Expressions.DatabaseTable);
39380
39417
  if (dbtab !== undefined) {
39381
- database_table_1.DatabaseTable.runSyntax(dbtab, input);
39418
+ const dbSource = database_table_1.DatabaseTable.runSyntax(dbtab, input);
39419
+ const fields = node.findAllExpressions(Expressions.SQLCompare)
39420
+ .map(compare => { var _a; return (_a = compare.findDirectExpression(Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase(); })
39421
+ .filter(field => field !== undefined);
39422
+ for (const orderBy of node.findAllExpressions(Expressions.SQLOrderBy)) {
39423
+ fields.push(...orderBy.findAllExpressions(Expressions.SQLFieldName).map(field => field.concatTokens().toUpperCase()));
39424
+ }
39425
+ (0, _check_database_fields_1.checkDatabaseFields)(fields, [dbSource], input, node.getFirstToken());
39382
39426
  }
39383
39427
  }
39384
39428
  }
@@ -46323,11 +46367,19 @@ const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifie
46323
46367
  const identifier_1 = __webpack_require__(/*! ../../1_lexer/tokens/identifier */ "../core/build/src/abap/1_lexer/tokens/identifier.js");
46324
46368
  const database_table_1 = __webpack_require__(/*! ../expressions/database_table */ "../core/build/src/abap/5_syntax/expressions/database_table.js");
46325
46369
  const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "../core/build/src/abap/5_syntax/expressions/dynamic.js");
46370
+ const _check_database_fields_1 = __webpack_require__(/*! ../expressions/_check_database_fields */ "../core/build/src/abap/5_syntax/expressions/_check_database_fields.js");
46326
46371
  class UpdateDatabase {
46327
46372
  runSyntax(node, input) {
46328
46373
  const dbtab = node.findFirstExpression(Expressions.DatabaseTable);
46329
46374
  if (dbtab !== undefined) {
46330
- database_table_1.DatabaseTable.runSyntax(dbtab, input);
46375
+ const dbSource = database_table_1.DatabaseTable.runSyntax(dbtab, input);
46376
+ const fields = node.findAllExpressions(Expressions.SQLFieldAndValue)
46377
+ .flatMap(fieldAndValue => fieldAndValue.findDirectExpressions(Expressions.SQLFieldName))
46378
+ .map(field => field.concatTokens().toUpperCase());
46379
+ fields.push(...node.findAllExpressions(Expressions.SQLCompare)
46380
+ .map(compare => { var _a; return (_a = compare.findDirectExpression(Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase(); })
46381
+ .filter(field => field !== undefined));
46382
+ (0, _check_database_fields_1.checkDatabaseFields)(fields, [dbSource], input, node.getFirstToken());
46331
46383
  }
46332
46384
  const tableName = node.findDirectExpression(Expressions.DatabaseTable);
46333
46385
  const tokenName = tableName === null || tableName === void 0 ? void 0 : tableName.getFirstToken();
@@ -47601,6 +47653,7 @@ const include_type_1 = __webpack_require__(/*! ../statements/include_type */ "..
47601
47653
  const type_1 = __webpack_require__(/*! ../statements/type */ "../core/build/src/abap/5_syntax/statements/type.js");
47602
47654
  const Basic = __importStar(__webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js"));
47603
47655
  const _scope_type_1 = __webpack_require__(/*! ../_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
47656
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
47604
47657
  class Types {
47605
47658
  runSyntax(node, input, qualifiedNamePrefix) {
47606
47659
  const name = node.findFirstExpression(Expressions.NamespaceSimpleName).getFirstToken();
@@ -47615,6 +47668,9 @@ class Types {
47615
47668
  if (ctyp instanceof Statements.Type) {
47616
47669
  const found = new type_1.Type().runSyntax(c, input, qualifiedNamePrefix + name.getStr() + "-");
47617
47670
  if (found) {
47671
+ if (found.getName().length > 30) {
47672
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, found.getToken(), "Structure field name longer than 30 characters"));
47673
+ }
47618
47674
  components.push({ name: found.getName(), type: found.getType() });
47619
47675
  }
47620
47676
  }
@@ -47631,6 +47687,9 @@ class Types {
47631
47687
  else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Types) {
47632
47688
  const found = new Types().runSyntax(c, input, qualifiedNamePrefix + name.getStr() + "-");
47633
47689
  if (found) {
47690
+ if (found.getName().length > 30) {
47691
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, found.getToken(), "Structure field name longer than 30 characters"));
47692
+ }
47634
47693
  components.push({ name: found.getName(), type: found.getType() });
47635
47694
  }
47636
47695
  }
@@ -51731,7 +51790,7 @@ class ClassDefinition extends _identifier_1.Identifier {
51731
51790
  this.checkEventNameConflicts(input);
51732
51791
  this.checkClassNameLength(input);
51733
51792
  this.checkMethodNameLength(input);
51734
- this.checkClassConstructorStatic(input);
51793
+ this.checkClassConstructor(input);
51735
51794
  }
51736
51795
  getFriends() {
51737
51796
  return this.friends;
@@ -51801,11 +51860,17 @@ class ClassDefinition extends _identifier_1.Identifier {
51801
51860
  }
51802
51861
  }
51803
51862
  }
51804
- checkClassConstructorStatic(input) {
51863
+ checkClassConstructor(input) {
51805
51864
  for (const m of this.methodDefs.getAll()) {
51806
- if (m.getName().toUpperCase() === "CLASS_CONSTRUCTOR" && m.isStatic() === false) {
51865
+ if (m.getName().toUpperCase() !== "CLASS_CONSTRUCTOR") {
51866
+ continue;
51867
+ }
51868
+ if (m.isStatic() === false) {
51807
51869
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), "CLASS_CONSTRUCTOR must be static"));
51808
51870
  }
51871
+ else if (m.getVisibility() !== visibility_1.Visibility.Public) {
51872
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), "CLASS_CONSTRUCTOR must be declared in the public section"));
51873
+ }
51809
51874
  }
51810
51875
  }
51811
51876
  checkInterfaceVisibility(input, node) {
@@ -52970,6 +53035,7 @@ const _object_oriented_1 = __webpack_require__(/*! ../5_syntax/_object_oriented
52970
53035
  const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
52971
53036
  const identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ "../core/build/src/abap/1_lexer/tokens/identifier.js");
52972
53037
  const _scope_type_1 = __webpack_require__(/*! ../5_syntax/_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
53038
+ const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
52973
53039
  // todo:
52974
53040
  // this.exceptions = [];
52975
53041
  // also consider RAISING vs EXCEPTIONS
@@ -52992,6 +53058,7 @@ class MethodParameters {
52992
53058
  input.scope.push(_scope_type_1.ScopeType.MethodDefinition, "method definition", node.getStart(), input.filename);
52993
53059
  try {
52994
53060
  this.parse(node, input, parentName, abstractMethod);
53061
+ this.checkNameLengths(input);
52995
53062
  this.checkDuplicateNames();
52996
53063
  }
52997
53064
  finally {
@@ -53143,6 +53210,13 @@ class MethodParameters {
53143
53210
  names.add(name);
53144
53211
  }
53145
53212
  }
53213
+ checkNameLengths(input) {
53214
+ for (const parameter of this.getAll()) {
53215
+ if (parameter.getName().length > 30) {
53216
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, parameter.getToken(), "Method parameter name longer than 30 characters"));
53217
+ }
53218
+ }
53219
+ }
53146
53220
  workaroundRAP(node, input, parentName) {
53147
53221
  const resultName = node.findExpressionAfterToken("RESULT");
53148
53222
  const concat = node.concatTokens().toUpperCase();
@@ -69677,7 +69751,7 @@ class Registry {
69677
69751
  }
69678
69752
  static abaplintVersion() {
69679
69753
  // magic, see build script "version.js"
69680
- return "2.120.24";
69754
+ return "2.120.26";
69681
69755
  }
69682
69756
  getDDICReferences() {
69683
69757
  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.26",
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.26",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",