Rust: Move local name resolution logic into shared library#21873
Draft
hvitved wants to merge 8 commits into
Draft
Rust: Move local name resolution logic into shared library#21873hvitved wants to merge 8 commits into
hvitved wants to merge 8 commits into
Conversation
Comment on lines
+88
to
+98
| /** | ||
| * An adjusted version of `ParentChild::getImmediateChild`, which makes the following | ||
| * two adjustments: | ||
| * | ||
| * 1. For conditions like `if cond body`, instead of letting `body` be the second child | ||
| * of `if`, we make it the last child of `cond`. This ensures that variables | ||
| * introduced in the `cond` scope are available in `body`. | ||
| * | ||
| * 2. A similar adjustment is made for `while` loops: the body of the loop is made a | ||
| * child of the loop condition instead of the loop itself. | ||
| */ |
| * 2. A similar adjustment is made for `while` loops: the body of the loop is made a | ||
| * child of the loop condition instead of the loop itself. | ||
| */ | ||
| int getRank(C parent, Ranked child) { |
| * `scope`. The pre-order numbering of the binding site of `v`, amongst | ||
| * all nodes nested under `scope`, is `ord`. | ||
| */ | ||
| private predicate variableDeclInScope(AstNode definingNode, string name, AstNode scope) { |
|
|
||
| /** A local access. */ | ||
| final class LocalAccess extends AstNodeFinal { | ||
| private string name; |
| pat = p.(Param).getPat() | ||
| ) | ||
| ) | ||
| ) |
| class NestedFunctionAccess extends LocalAccess { | ||
| private Function f; | ||
|
|
||
| NestedFunctionAccess() { nestedFunctionAccess(_, f, this) } |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.