Skip to content

Only build the shadowed-variable range when reporting it - #1867

Merged
TwitchBronBron merged 4 commits into
flatten-locationsfrom
lazy-shadow-name-range
Oct 15, 2026
Merged

TwitchBronBron merged 4 commits into
flatten-locationsfrom
lazy-shadow-name-range

Conversation

@TwitchBronBron

Copy link
Copy Markdown
Member

Stacked on #1845. Scope validation calls detectShadowedLocalVar() for every assignment, for each item and function parameter, and each call built a Location for the name up front. The range is only needed when a diagnostic is actually added, so this passes the name token instead and resolves the range on demand.

  • ScopeValidator.detectShadowedLocalVar() now takes nameToken: Locatable instead of nameRange: Range (public method, so a small API change)

Verified with npm run test:nocover.

🤖 Generated with Claude Code

TwitchBronBron and others added 2 commits October 2, 2026 16:11
detectShadowedLocalVar() is called for every assignment, for each item and parameter during scope validation, but the name range is only used when a diagnostic is added. Pass the name token and resolve the range on demand.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@TwitchBronBron
TwitchBronBron marked this pull request as ready for review October 15, 2026 20:27
@TwitchBronBron
TwitchBronBron merged commit d1dbe0d into flatten-locations Oct 15, 2026
9 checks passed
@TwitchBronBron
TwitchBronBron deleted the lazy-shadow-name-range branch October 15, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant