@abaplint/cli 2.120.2 → 2.120.3

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 +65 -80
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -26953,6 +26953,7 @@ const basic_1 = __webpack_require__(/*! ../types/basic */ "../core/build/src/aba
26953
26953
  const ddic_1 = __webpack_require__(/*! ../../ddic */ "../core/build/src/ddic.js");
26954
26954
  const _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ "../core/build/src/abap/5_syntax/_object_oriented.js");
26955
26955
  const _reference_1 = __webpack_require__(/*! ./_reference */ "../core/build/src/abap/5_syntax/_reference.js");
26956
+ const tokens_1 = __webpack_require__(/*! ../1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
26956
26957
  class Procedural {
26957
26958
  constructor(reg, scope) {
26958
26959
  this.scope = scope;
@@ -27132,7 +27133,8 @@ class Procedural {
27132
27133
  continue;
27133
27134
  }
27134
27135
  else {
27135
- const type = new _typed_identifier_1.TypedIdentifier(nameToken, filename, found);
27136
+ const token = new tokens_1.Identifier(nameToken.getStart(), param.name);
27137
+ const type = new _typed_identifier_1.TypedIdentifier(token, filename, found, this.functionModuleParameterMeta(param));
27136
27138
  if (ignoreIfAlreadyExists === true) {
27137
27139
  const exists = this.scope.findVariable(param.name);
27138
27140
  if (exists === undefined) {
@@ -27146,6 +27148,25 @@ class Procedural {
27146
27148
  }
27147
27149
  }
27148
27150
  }
27151
+ functionModuleParameterMeta(param) {
27152
+ const ret = [];
27153
+ if (param.direction === types_1.FunctionModuleParameterDirection.importing) {
27154
+ ret.push("function_module_importing" /* IdentifierMeta.FunctionModuleImporting */);
27155
+ }
27156
+ else if (param.direction === types_1.FunctionModuleParameterDirection.exporting) {
27157
+ ret.push("function_module_exporting" /* IdentifierMeta.FunctionModuleExporting */);
27158
+ }
27159
+ else if (param.direction === types_1.FunctionModuleParameterDirection.changing) {
27160
+ ret.push("function_module_changing" /* IdentifierMeta.FunctionModuleChanging */);
27161
+ }
27162
+ else if (param.direction === types_1.FunctionModuleParameterDirection.tables) {
27163
+ ret.push("function_module_tables" /* IdentifierMeta.FunctionModuleTables */);
27164
+ }
27165
+ if (param.passByValue) {
27166
+ ret.push("pass_by_value" /* IdentifierMeta.PassByValue */);
27167
+ }
27168
+ return ret;
27169
+ }
27149
27170
  }
27150
27171
  exports.Procedural = Procedural;
27151
27172
  //# sourceMappingURL=_procedural.js.map
@@ -51704,6 +51725,7 @@ class FunctionModuleDefinition {
51704
51725
  type: param.TYP || param.DBFIELD,
51705
51726
  optional: param.OPTIONAL === "X",
51706
51727
  defaultValue: param.DEFAULT,
51728
+ passByValue: param.REFERENCE !== "X",
51707
51729
  });
51708
51730
  }
51709
51731
  }
@@ -51718,6 +51740,7 @@ class FunctionModuleDefinition {
51718
51740
  type: param.TYP || param.DBFIELD,
51719
51741
  optional: param.OPTIONAL === "X",
51720
51742
  defaultValue: param.DEFAULT,
51743
+ passByValue: param.REFERENCE !== "X",
51721
51744
  });
51722
51745
  }
51723
51746
  }
@@ -51732,6 +51755,7 @@ class FunctionModuleDefinition {
51732
51755
  type: param.TYP || param.DBFIELD,
51733
51756
  optional: true,
51734
51757
  defaultValue: undefined,
51758
+ passByValue: param.REFERENCE !== "X",
51735
51759
  });
51736
51760
  }
51737
51761
  }
@@ -51747,6 +51771,7 @@ class FunctionModuleDefinition {
51747
51771
  type: param.DBSTRUCT || param.TYP,
51748
51772
  optional: param.OPTIONAL === "X",
51749
51773
  defaultValue: undefined,
51774
+ passByValue: false,
51750
51775
  });
51751
51776
  }
51752
51777
  }
@@ -52599,14 +52624,14 @@ class MethodParameters {
52599
52624
  }
52600
52625
  }
52601
52626
  add(target, source, input, meta, abstractMethod) {
52602
- var _a, _b;
52627
+ var _a;
52603
52628
  for (const opt of source.findAllExpressions(Expressions.MethodParamOptional)) {
52604
52629
  const p = opt.findDirectExpression(Expressions.MethodParam);
52605
52630
  if (p === undefined) {
52606
52631
  continue;
52607
52632
  }
52608
52633
  const extraMeta = [];
52609
- if (p.getFirstToken().getStr().toUpperCase() === "VALUE" && ((_a = p.getChildren()[1]) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr()) === "(") {
52634
+ if (this.isPassByValue(p)) {
52610
52635
  extraMeta.push("pass_by_value" /* IdentifierMeta.PassByValue */);
52611
52636
  }
52612
52637
  else if (meta.includes("importing" /* IdentifierMeta.MethodImporting */)) {
@@ -52625,7 +52650,7 @@ class MethodParameters {
52625
52650
  else if (opt.findFirstExpression(Expressions.Default)) {
52626
52651
  const name = target[target.length - 1].getName().toUpperCase();
52627
52652
  this.optional.push(name);
52628
- const val = (_b = opt.findFirstExpression(Expressions.Default)) === null || _b === void 0 ? void 0 : _b.getLastChild();
52653
+ const val = (_a = opt.findFirstExpression(Expressions.Default)) === null || _a === void 0 ? void 0 : _a.getLastChild();
52629
52654
  if (val && val instanceof nodes_1.ExpressionNode) {
52630
52655
  this.defaults[name] = val;
52631
52656
  }
@@ -52636,9 +52661,15 @@ class MethodParameters {
52636
52661
  }
52637
52662
  const params = source.findAllExpressions(Expressions.MethodParam);
52638
52663
  for (const param of params) {
52639
- target.push(method_param_1.MethodParam.runSyntax(param, input, meta));
52664
+ const extraMeta = this.isPassByValue(param) ? ["pass_by_value" /* IdentifierMeta.PassByValue */] : [];
52665
+ target.push(method_param_1.MethodParam.runSyntax(param, input, [...meta, ...extraMeta]));
52640
52666
  }
52641
52667
  }
52668
+ isPassByValue(param) {
52669
+ var _a;
52670
+ return param.getFirstToken().getStr().toUpperCase() === "VALUE"
52671
+ && ((_a = param.getChildren()[1]) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr()) === "(";
52672
+ }
52642
52673
  }
52643
52674
  exports.MethodParameters = MethodParameters;
52644
52675
  //# sourceMappingURL=method_parameters.js.map
@@ -59512,10 +59543,10 @@ class ABAPObject extends _abstract_object_1.AbstractObject {
59512
59543
  return undefined;
59513
59544
  }
59514
59545
  getMainABAPFile() {
59515
- // todo, uris, https://github.com/abaplint/abaplint/issues/673
59516
59546
  const search = this.getName().replace(/\//g, "#").toLowerCase() + "." + this.getType().toLowerCase() + ".abap";
59547
+ const encodedSearch = search.replace(/#/g, "%23");
59517
59548
  for (const file of this.getABAPFiles()) {
59518
- if (file.getFilename().endsWith(search)) {
59549
+ if (file.getFilename().endsWith(search) || file.getFilename().endsWith(encodedSearch)) {
59519
59550
  return file;
59520
59551
  }
59521
59552
  }
@@ -68939,7 +68970,7 @@ class Registry {
68939
68970
  }
68940
68971
  static abaplintVersion() {
68941
68972
  // magic, see build script "version.js"
68942
- return "2.120.2";
68973
+ return "2.120.3";
68943
68974
  }
68944
68975
  getDDICReferences() {
68945
68976
  return this.ddicReferences;
@@ -73650,39 +73681,6 @@ exports.ClassicExceptionsOverlap = ClassicExceptionsOverlap;
73650
73681
 
73651
73682
  "use strict";
73652
73683
 
73653
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
73654
- if (k2 === undefined) k2 = k;
73655
- var desc = Object.getOwnPropertyDescriptor(m, k);
73656
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
73657
- desc = { enumerable: true, get: function() { return m[k]; } };
73658
- }
73659
- Object.defineProperty(o, k2, desc);
73660
- }) : (function(o, m, k, k2) {
73661
- if (k2 === undefined) k2 = k;
73662
- o[k2] = m[k];
73663
- }));
73664
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
73665
- Object.defineProperty(o, "default", { enumerable: true, value: v });
73666
- }) : function(o, v) {
73667
- o["default"] = v;
73668
- });
73669
- var __importStar = (this && this.__importStar) || (function () {
73670
- var ownKeys = function(o) {
73671
- ownKeys = Object.getOwnPropertyNames || function (o) {
73672
- var ar = [];
73673
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
73674
- return ar;
73675
- };
73676
- return ownKeys(o);
73677
- };
73678
- return function (mod) {
73679
- if (mod && mod.__esModule) return mod;
73680
- var result = {};
73681
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
73682
- __setModuleDefault(result, mod);
73683
- return result;
73684
- };
73685
- })();
73686
73684
  Object.defineProperty(exports, "__esModule", ({ value: true }));
73687
73685
  exports.ClearExportingParameters = exports.ClearExportingParametersConf = void 0;
73688
73686
  const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
@@ -73691,12 +73689,11 @@ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_i
73691
73689
  const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
73692
73690
  const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
73693
73691
  const _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
73692
+ const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
73694
73693
  const objects_1 = __webpack_require__(/*! ../objects */ "../core/build/src/objects/index.js");
73695
73694
  const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
73696
73695
  const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
73697
73696
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
73698
- const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
73699
- const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
73700
73697
  class ClearExportingParametersConf extends _basic_rule_config_1.BasicRuleConfig {
73701
73698
  constructor() {
73702
73699
  super(...arguments);
@@ -73729,7 +73726,7 @@ Reading and writing the parameter in the same statement (e.g. "ev_result = ev_re
73729
73726
  as the source is evaluated before the parameter is assigned.
73730
73727
  Objects containing parser or syntax errors are not reported.
73731
73728
 
73732
- Only class and interface method implementations are checked, function module parameters are currently not supported.`,
73729
+ Class and interface method implementations and function modules are checked.`,
73733
73730
  tags: [_irule_1.RuleTag.Styleguide],
73734
73731
  badExample: `CLASS lcl DEFINITION.
73735
73732
  PUBLIC SECTION.
@@ -73785,19 +73782,20 @@ ENDCLASS.`,
73785
73782
  return issues;
73786
73783
  }
73787
73784
  traverse(node, obj, issues) {
73788
- if (node.getIdentifier().stype === _scope_type_1.ScopeType.Method) {
73789
- this.checkMethod(node, obj, issues);
73785
+ if (node.getIdentifier().stype === _scope_type_1.ScopeType.Method
73786
+ || node.getIdentifier().stype === _scope_type_1.ScopeType.FunctionModule) {
73787
+ this.checkProcedure(node, obj, issues);
73790
73788
  }
73791
73789
  for (const child of node.getChildren()) {
73792
73790
  this.traverse(child, obj, issues);
73793
73791
  }
73794
73792
  }
73795
- checkMethod(node, obj, issues) {
73796
- const parameters = this.findExportingByReference(node, obj);
73793
+ checkProcedure(node, obj, issues) {
73794
+ const references = this.collectReferences(node);
73795
+ const parameters = this.findExportingByReference(node, references);
73797
73796
  if (parameters.length === 0) {
73798
73797
  return;
73799
73798
  }
73800
- const references = this.collectReferences(node);
73801
73799
  for (const parameter of parameters) {
73802
73800
  const issue = this.checkParameter(parameter, references, obj);
73803
73801
  if (issue !== undefined) {
@@ -73805,52 +73803,36 @@ ENDCLASS.`,
73805
73803
  }
73806
73804
  }
73807
73805
  }
73808
- findExportingByReference(node, obj) {
73806
+ findExportingByReference(node, references) {
73809
73807
  var _a;
73810
73808
  const ret = [];
73811
- const vars = node.getData().vars;
73812
- for (const name in vars) {
73813
- const parameter = vars[name];
73809
+ const candidates = new Set(Object.values(node.getData().vars));
73810
+ for (const reference of references) {
73811
+ if (reference.resolved instanceof _typed_identifier_1.TypedIdentifier) {
73812
+ candidates.add(reference.resolved);
73813
+ }
73814
+ }
73815
+ for (const parameter of candidates) {
73814
73816
  const meta = parameter.getMeta();
73815
- if (meta.includes("exporting" /* IdentifierMeta.MethodExporting */) === false
73817
+ const exporting = meta.includes("exporting" /* IdentifierMeta.MethodExporting */)
73818
+ || meta.includes("function_module_exporting" /* IdentifierMeta.FunctionModuleExporting */);
73819
+ if (exporting === false
73816
73820
  || meta.includes("pass_by_value" /* IdentifierMeta.PassByValue */) === true) {
73817
73821
  continue;
73818
73822
  }
73819
- else if ((_a = this.conf.skipNames) === null || _a === void 0 ? void 0 : _a.some(s => s.toUpperCase() === name.toUpperCase())) {
73823
+ else if ((_a = this.conf.skipNames) === null || _a === void 0 ? void 0 : _a.some(s => s.toUpperCase() === parameter.getName().toUpperCase())) {
73820
73824
  continue;
73821
73825
  }
73822
73826
  const type = parameter.getType();
73823
73827
  if (type instanceof basic_1.VoidType || type instanceof basic_1.UnknownType) {
73824
73828
  continue; // e.g. RAP magic parameters, or unresolved types
73825
73829
  }
73826
- else if (this.isPassByValue(parameter, obj) === true) {
73827
- continue; // VALUE(..) parameters are always initialized
73828
- }
73829
73830
  ret.push(parameter);
73830
73831
  }
73831
73832
  return ret;
73832
73833
  }
73833
- isPassByValue(parameter, obj) {
73834
- var _a;
73835
- // the PassByValue meta is not set for EXPORTING parameters, so determine it from the definition
73836
- const file = obj.getABAPFileByName(parameter.getFilename());
73837
- if (file === undefined) {
73838
- return false;
73839
- }
73840
- const statement = edit_helper_1.EditHelper.findStatement(parameter.getToken(), file);
73841
- if (statement === undefined) {
73842
- return false;
73843
- }
73844
- for (const param of statement.findAllExpressions(Expressions.MethodParam)) {
73845
- const nameToken = (_a = param.findFirstExpression(Expressions.MethodParamName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
73846
- if (nameToken !== undefined && nameToken.getStart().equals(parameter.getStart())) {
73847
- return param.getFirstToken().getStr().toUpperCase() === "VALUE";
73848
- }
73849
- }
73850
- return false;
73851
- }
73852
73834
  collectReferences(node) {
73853
- // methods do not nest, so all descendant scopes (FOR, LET, ...) belong to this method
73835
+ // procedures do not nest, so all descendant scopes (FOR, LET, ...) belong to this procedure
73854
73836
  const ret = [...node.getData().references];
73855
73837
  for (const child of node.getChildren()) {
73856
73838
  ret.push(...this.collectReferences(child));
@@ -73861,7 +73843,9 @@ ENDCLASS.`,
73861
73843
  let firstRead = undefined;
73862
73844
  let earliestWrite = undefined;
73863
73845
  for (const reference of references) {
73864
- if (reference.resolved === undefined || parameter.equals(reference.resolved) === false) {
73846
+ if (reference.resolved === undefined
73847
+ || parameter.equals(reference.resolved) === false
73848
+ || parameter.getName().toUpperCase() !== reference.resolved.getName().toUpperCase()) {
73865
73849
  continue;
73866
73850
  }
73867
73851
  const pos = reference.position.getStart();
@@ -93063,7 +93047,8 @@ ENDCLASS.`,
93063
93047
  }
93064
93048
  for (const v in vars) {
93065
93049
  const id = vars[v];
93066
- if (id.getMeta().includes("pass_by_value" /* IdentifierMeta.PassByValue */) === false) {
93050
+ if (id.getMeta().includes("importing" /* IdentifierMeta.MethodImporting */) === false
93051
+ || id.getMeta().includes("pass_by_value" /* IdentifierMeta.PassByValue */) === false) {
93067
93052
  continue;
93068
93053
  }
93069
93054
  else if (this.reg.isFileDependency(id.getFilename()) === true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.2",
3
+ "version": "2.120.3",
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.2",
42
+ "@abaplint/core": "^2.120.3",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",