@abaplint/cli 2.102.7 → 2.102.9

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 +43 -8
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -19249,7 +19249,12 @@ class BuiltInMethod extends _identifier_1.Identifier {
19249
19249
  this.row = row;
19250
19250
  }
19251
19251
  getRequiredParameters() {
19252
- return [];
19252
+ const ret = [];
19253
+ for (const i in this.method.mandatory) {
19254
+ const id = new tokens_1.Identifier(new position_1.Position(this.row, 1), i);
19255
+ ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, this.method.mandatory[i]));
19256
+ }
19257
+ return ret;
19253
19258
  }
19254
19259
  getOptional() {
19255
19260
  throw new Error("BuiltInMethod->Method not implemented.");
@@ -27640,10 +27645,15 @@ const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ ".
27640
27645
  const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
27641
27646
  class ClassLocalFriends {
27642
27647
  runSyntax(node, scope, filename) {
27643
- const found = node.findDirectExpression(Expressions.ClassName);
27648
+ const classNames = node.findAllExpressions(Expressions.ClassName);
27649
+ const found = classNames[0];
27644
27650
  if (found) {
27645
27651
  const token = found.getFirstToken();
27646
27652
  const name = token.getStr();
27653
+ if (scope.getParentObj().getType() === "CLAS"
27654
+ && name.toUpperCase() !== scope.getParentObj().getName().toUpperCase()) {
27655
+ throw new Error(`Befriending must be ` + scope.getParentObj().getName().toUpperCase());
27656
+ }
27647
27657
  const def = scope.findClassDefinition(name);
27648
27658
  if (def) {
27649
27659
  scope.addReference(token, def, _reference_1.ReferenceType.ObjectOrientedReference, filename);
@@ -27652,6 +27662,14 @@ class ClassLocalFriends {
27652
27662
  throw new Error(`Class ${name.toUpperCase()} not found`);
27653
27663
  }
27654
27664
  }
27665
+ for (let i = 1; i < classNames.length; i++) {
27666
+ const className = classNames[i].concatTokens();
27667
+ // make sure to check also DEFINITION DEFERRED
27668
+ const found = scope.existsObject(className);
27669
+ if (found.found === false) {
27670
+ throw new Error(`Class ${className.toUpperCase()} not found`);
27671
+ }
27672
+ }
27655
27673
  }
27656
27674
  }
27657
27675
  exports.ClassLocalFriends = ClassLocalFriends;
@@ -48538,7 +48556,7 @@ class Registry {
48538
48556
  }
48539
48557
  static abaplintVersion() {
48540
48558
  // magic, see build script "version.sh"
48541
- return "2.102.7";
48559
+ return "2.102.9";
48542
48560
  }
48543
48561
  getDDICReferences() {
48544
48562
  return this.ddicReferences;
@@ -52457,6 +52475,9 @@ class CyclomaticComplexity {
52457
52475
  }
52458
52476
  setConfig(conf) {
52459
52477
  this.conf = conf;
52478
+ if (this.conf.max === undefined) {
52479
+ this.conf.max = new CyclomaticComplexityConf().max;
52480
+ }
52460
52481
  }
52461
52482
  initialize(_reg) {
52462
52483
  return this;
@@ -53433,13 +53454,12 @@ Make sure to test the downported code, it might not always be completely correct
53433
53454
  }
53434
53455
  }
53435
53456
  }
53436
- else if (ret.length === 0 && / xsdbool\(/i.test(lowFile.getRaw())) {
53457
+ if (ret.length === 0 && lowFile.getRaw().includes(" xsdbool( ")) {
53437
53458
  for (let i = 0; i < lowStatements.length; i++) {
53438
53459
  const high = highStatements[i];
53439
53460
  const issue = this.replaceXsdBool(high, lowFile, highSyntax);
53440
53461
  if (issue) {
53441
53462
  ret.push(issue);
53442
- break;
53443
53463
  }
53444
53464
  }
53445
53465
  }
@@ -53474,11 +53494,13 @@ Make sure to test the downported code, it might not always be completely correct
53474
53494
  return undefined;
53475
53495
  }
53476
53496
  // downport XSDBOOL() early, as it is valid 702 syntax
53497
+ /*
53477
53498
  let found = this.replaceXsdBool(high, lowFile, highSyntax);
53478
53499
  if (found) {
53479
- return found;
53500
+ return found;
53480
53501
  }
53481
- found = this.downportEnum(low, high, lowFile, highSyntax, highFile);
53502
+ */
53503
+ let found = this.downportEnum(low, high, lowFile, highSyntax, highFile);
53482
53504
  if (found) {
53483
53505
  return found;
53484
53506
  }
@@ -55716,7 +55738,20 @@ ${indentation} output = ${uniqueName}.\n`;
55716
55738
  if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference
55717
55739
  && r.position.getName().toUpperCase() === "XSDBOOL") {
55718
55740
  const token = r.position.getToken();
55719
- const fix = edit_helper_1.EditHelper.replaceRange(lowFile, token.getStart(), token.getEnd(), "boolc");
55741
+ let source = undefined;
55742
+ for (const s of node.findAllExpressions(Expressions.Source)) {
55743
+ if (s.getFirstToken().getStart().equals(token.getStart())) {
55744
+ source = s;
55745
+ break;
55746
+ }
55747
+ }
55748
+ const children = source === null || source === void 0 ? void 0 : source.getChildren();
55749
+ if (source === undefined || (children === null || children === void 0 ? void 0 : children.length) !== 4) {
55750
+ continue;
55751
+ }
55752
+ // make sure to convert to the correct type, RTTI might be used on the result of XSDBOOL
55753
+ const code = "CONV xsdboolean( boolc( " + children[2].concatTokens() + " ) )";
55754
+ const fix = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), code);
55720
55755
  return issue_1.Issue.atToken(lowFile, token, "Use BOOLC", this.getMetadata().key, this.conf.severity, fix);
55721
55756
  }
55722
55757
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.7",
3
+ "version": "2.102.9",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.7",
41
+ "@abaplint/core": "^2.102.9",
42
42
  "@types/chai": "^4.3.5",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",
@@ -47,7 +47,7 @@
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.7",
49
49
  "chalk": "^5.3.0",
50
- "eslint": "^8.45.0",
50
+ "eslint": "^8.46.0",
51
51
  "glob": "^7.2.3",
52
52
  "json5": "^2.2.3",
53
53
  "memfs": "^4.2.0",