@abaplint/cli 2.102.64 → 2.102.66

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 +37 -14
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -25507,6 +25507,7 @@ const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/c
25507
25507
  const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
25508
25508
  const method_parameters_1 = __webpack_require__(/*! ./method_parameters */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/method_parameters.js");
25509
25509
  const basic_types_1 = __webpack_require__(/*! ../basic_types */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js");
25510
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
25510
25511
  class NewObject {
25511
25512
  runSyntax(node, scope, targetType, filename) {
25512
25513
  let ret = undefined;
@@ -25588,7 +25589,10 @@ class NewObject {
25588
25589
  if (type === undefined) {
25589
25590
  throw new Error("NewObject, no default importing parameter found for constructor, " + name);
25590
25591
  }
25591
- new source_1.Source().runSyntax(source, scope, filename, type);
25592
+ const sourceType = new source_1.Source().runSyntax(source, scope, filename, type);
25593
+ if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, type) === false) {
25594
+ throw new Error(`NEW parameter type not compatible`);
25595
+ }
25592
25596
  }
25593
25597
  else if (parameters) {
25594
25598
  // parameters with names
@@ -25773,6 +25777,9 @@ class Select {
25773
25777
  const token = node.getFirstToken();
25774
25778
  const from = node.findDirectExpression(Expressions.SQLFrom);
25775
25779
  const dbSources = from ? new sql_from_1.SQLFrom().runSyntax(from, scope, filename) : [];
25780
+ if (dbSources.length === 0) {
25781
+ throw new Error(`Missing FROM`);
25782
+ }
25776
25783
  const fields = this.findFields(node);
25777
25784
  if (fields.length === 0
25778
25785
  && node.findDirectExpression(Expressions.SQLFieldListLoop) === undefined) {
@@ -28638,6 +28645,7 @@ const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@a
28638
28645
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
28639
28646
  const types_1 = __webpack_require__(/*! ../../types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
28640
28647
  const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
28648
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
28641
28649
  class CreateObject {
28642
28650
  runSyntax(node, scope, filename) {
28643
28651
  let cdef = undefined;
@@ -28661,7 +28669,7 @@ class CreateObject {
28661
28669
  }
28662
28670
  }
28663
28671
  // just recurse
28664
- for (const s of node.findAllExpressions(Expressions.Source)) {
28672
+ for (const s of node.findDirectExpressions(Expressions.Source)) {
28665
28673
  new source_1.Source().runSyntax(s, scope, filename);
28666
28674
  }
28667
28675
  let first = true;
@@ -28705,26 +28713,35 @@ class CreateObject {
28705
28713
  for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
28706
28714
  new dynamic_1.Dynamic().runSyntax(t, scope, filename);
28707
28715
  }
28708
- this.validateParameters(cdef, node, scope);
28716
+ this.validateParameters(cdef, node, scope, filename);
28709
28717
  }
28710
- validateParameters(cdef, node, scope) {
28711
- var _a, _b, _c;
28718
+ validateParameters(cdef, node, scope, filename) {
28719
+ var _a, _b, _c, _d;
28712
28720
  if (cdef === undefined) {
28721
+ const sources = (_a = node.findDirectExpression(Expressions.ParameterListS)) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Source);
28722
+ for (const s of sources || []) {
28723
+ new source_1.Source().runSyntax(s, scope, filename);
28724
+ }
28713
28725
  return;
28714
28726
  }
28715
28727
  const methodDef = new _object_oriented_1.ObjectOriented(scope).searchMethodName(cdef, "CONSTRUCTOR");
28716
- const methodParameters = (_a = methodDef.method) === null || _a === void 0 ? void 0 : _a.getParameters();
28728
+ const methodParameters = (_b = methodDef.method) === null || _b === void 0 ? void 0 : _b.getParameters();
28717
28729
  const allImporting = (methodParameters === null || methodParameters === void 0 ? void 0 : methodParameters.getImporting()) || [];
28718
28730
  const requiredImporting = new Set(methodParameters === null || methodParameters === void 0 ? void 0 : methodParameters.getRequiredParameters().map(i => i.getName().toUpperCase()));
28719
- // todo, validate types
28720
- for (const p of ((_b = node.findDirectExpression(Expressions.ParameterListS)) === null || _b === void 0 ? void 0 : _b.findAllExpressions(Expressions.ParameterS)) || []) {
28721
- const name = (_c = p.findDirectExpression(Expressions.ParameterName)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();
28731
+ for (const p of ((_c = node.findDirectExpression(Expressions.ParameterListS)) === null || _c === void 0 ? void 0 : _c.findAllExpressions(Expressions.ParameterS)) || []) {
28732
+ const name = (_d = p.findDirectExpression(Expressions.ParameterName)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();
28722
28733
  if (name === undefined) {
28723
28734
  continue;
28724
28735
  }
28725
- if ((allImporting === null || allImporting === void 0 ? void 0 : allImporting.some(p => p.getName().toUpperCase() === name)) === false) {
28736
+ const source = p.findDirectExpression(Expressions.Source);
28737
+ const sourceType = new source_1.Source().runSyntax(source, scope, filename);
28738
+ const found = allImporting === null || allImporting === void 0 ? void 0 : allImporting.find(p => p.getName().toUpperCase() === name);
28739
+ if (found === undefined) {
28726
28740
  throw new Error(`constructor parameter "${name}" does not exist`);
28727
28741
  }
28742
+ else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, found.getType()) === false) {
28743
+ throw new Error(`constructor parameter "${name}" type not compatible`);
28744
+ }
28728
28745
  requiredImporting.delete(name);
28729
28746
  }
28730
28747
  for (const r of requiredImporting.values()) {
@@ -50139,7 +50156,7 @@ class Registry {
50139
50156
  }
50140
50157
  static abaplintVersion() {
50141
50158
  // magic, see build script "version.sh"
50142
- return "2.102.64";
50159
+ return "2.102.66";
50143
50160
  }
50144
50161
  getDDICReferences() {
50145
50162
  return this.ddicReferences;
@@ -67398,6 +67415,7 @@ class SlowParameterPassing {
67398
67415
  key: "slow_parameter_passing",
67399
67416
  title: "Slow Parameter Passing",
67400
67417
  shortDescription: `Detects slow pass by value passing for methods where parameter is not changed`,
67418
+ extendedInformation: `Method parameters defined in interfaces is not checked`,
67401
67419
  tags: [_irule_1.RuleTag.Performance],
67402
67420
  };
67403
67421
  }
@@ -67420,17 +67438,22 @@ class SlowParameterPassing {
67420
67438
  const methods = this.listMethodNodes(top);
67421
67439
  for (const m of methods) {
67422
67440
  const vars = m.getData().vars;
67441
+ if (m.getIdentifier().sname.includes("~")) {
67442
+ // skip methods defined in interfaces
67443
+ // todo: checking for just "~" is not correct, there might be ALIASES
67444
+ continue;
67445
+ }
67423
67446
  for (const v in vars) {
67424
67447
  const id = vars[v];
67425
67448
  if (id.getMeta().includes("pass_by_value" /* IdentifierMeta.PassByValue */) === false) {
67426
67449
  continue;
67427
67450
  }
67451
+ else if (this.reg.isFileDependency(id.getFilename()) === true) {
67452
+ continue;
67453
+ }
67428
67454
  const writes = this.listWritePositions(m, id);
67429
67455
  if (writes.length === 0) {
67430
67456
  const message = "Parameter " + id.getName() + " passed by VALUE but not changed";
67431
- if (this.reg.isFileDependency(id.getFilename()) === true) {
67432
- continue;
67433
- }
67434
67457
  issues.push(issue_1.Issue.atIdentifier(id, message, this.getMetadata().key, this.getConfig().severity));
67435
67458
  }
67436
67459
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.64",
3
+ "version": "2.102.66",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,12 +38,12 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.64",
41
+ "@abaplint/core": "^2.102.66",
42
42
  "@types/chai": "^4.3.9",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.4",
45
45
  "@types/mocha": "^10.0.3",
46
- "@types/node": "^20.8.9",
46
+ "@types/node": "^20.8.10",
47
47
  "@types/progress": "^2.0.6",
48
48
  "chai": "^4.3.10",
49
49
  "chalk": "^5.3.0",