-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved scope handling in
ScopedWalker
(#1308)
This PR simplifies and improves the scope handling in the `ScopedWalker`. Previously, the walker tried to enter/leave scopes with a certain heuristic when nodes were iterated or their parent changed. While this worked for most cases, it could diverge from the actual scoping that was established during a frontend run. One such example was when method declarations were declared outside the AST of a class (a common use-case in Go or C++). In this case, the walker left the record scope open after existing the function, since it did not know of its existence (only of the existence of the function scope). I therefore changed the behaviour in a way that the walker "jumps" directly to the scope of the node, which is recorded in its `scope` variable. I suspect, that at the time of wiriting of the old behaviour, we did not have the `scope` variable yet. This now guarantees that exactly the scope that the frontend intended for the given variable is now "replayed" in the walker
- Loading branch information
Showing
5 changed files
with
17 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters