@abaplint/core 2.93.80 → 2.93.81

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.
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.93.80";
66
+ return "2.93.81";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -24,6 +24,7 @@ const tokens_1 = require("../abap/1_lexer/tokens");
24
24
  const include_graph_1 = require("../utils/include_graph");
25
25
  const objects_1 = require("../objects");
26
26
  const _builtin_1 = require("../abap/5_syntax/_builtin");
27
+ const _scope_type_1 = require("../abap/5_syntax/_scope_type");
27
28
  // todo: refactor each sub-rule to new classes?
28
29
  // todo: add configuration
29
30
  class DownportConf extends _basic_rule_config_1.BasicRuleConfig {
@@ -1967,16 +1968,29 @@ ${indentation} output = ${topTarget}.`;
1967
1968
  const issue = issue_1.Issue.atPosition(lowFile, pos, "Rename before outline", this.getMetadata().key, this.conf.severity, fix);
1968
1969
  throw new SkipToNextFile(issue);
1969
1970
  }
1970
- isDuplicateName(spag, name, pos) {
1971
- var _a;
1972
- let isDuplicate = false;
1973
- for (const child of ((_a = spag.getParent()) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {
1974
- const found = child.findVariable(name);
1975
- if ((found === null || found === void 0 ? void 0 : found.getStart().equals(pos)) === false) {
1976
- isDuplicate = true;
1971
+ findRecursiveDuplicate(spag, name, skip) {
1972
+ const found = spag.findVariable(name);
1973
+ if ((found === null || found === void 0 ? void 0 : found.getStart().equals(skip)) === false) {
1974
+ return found;
1975
+ }
1976
+ for (const child of (spag === null || spag === void 0 ? void 0 : spag.getChildren()) || []) {
1977
+ const sub = this.findRecursiveDuplicate(child, name, skip);
1978
+ if (sub) {
1979
+ return sub;
1977
1980
  }
1978
1981
  }
1979
- return isDuplicate;
1982
+ return undefined;
1983
+ }
1984
+ isDuplicateName(spag, name, pos) {
1985
+ let parent = spag.getParent();
1986
+ while ((parent === null || parent === void 0 ? void 0 : parent.getIdentifier().stype) === _scope_type_1.ScopeType.Let
1987
+ || (parent === null || parent === void 0 ? void 0 : parent.getIdentifier().stype) === _scope_type_1.ScopeType.For) {
1988
+ parent = parent.getParent();
1989
+ }
1990
+ if (parent === undefined) {
1991
+ return undefined;
1992
+ }
1993
+ return this.findRecursiveDuplicate(parent, name, pos) !== undefined;
1980
1994
  }
1981
1995
  findType(i, lowFile, highSyntax, ref = false) {
1982
1996
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.93.80",
3
+ "version": "2.93.81",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",