-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a LookupScopeStatement
node
#1742
base: main
Are you sure you want to change the base?
Conversation
be142cd
to
c32c59b
Compare
This PR adds a new node type `LookupScopeStatement`, which can be used to adjust the lookup scope of symbols that are resolved in the current scope. Most prominent examples are Python's `global` and `nonlocal` statements. Support for python will be added in a later PR. This will only add the node and provides the basic functionality in the lookup.
a07e0b3
to
7718e61
Compare
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, however, I don't have a sufficiently deep understanding of how the lookup works to click "approve". I assume this PR will be discussed at the CPG hackathon?
|
||
// Add it to our scope | ||
for (symbol in symbols) { | ||
node.scope?.predefinedLookupScopes[symbol] = node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get this. Don't we want do do something with targetScope
? Or add the information to the symbol
?
What's the purpose of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are storing the node in predefinedLookupScopes so that it can later be retrieved by lookupSymbol.
This PR adds a new node type
LookupScopeStatement
, which can be used to adjust the lookup scope of symbols that are resolved in the current scope. Most prominent examples are Python'sglobal
andnonlocal
statements. There is also potentially aglobal
statement in PHP, although we do not support that language.Potentially, this could be re-used to for concepts that are similar in other languages as well.
Support for python will be added in a later PR. This will only add the node and provides the basic functionality in the lookup.