-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Get rid of MDEF and LDEF [WIP] #2555
Conversation
@@ -1037,7 +1037,7 @@ def process_import_over_existing_name(self, | |||
imported_id: str, existing_symbol: SymbolTableNode, | |||
module_symbol: SymbolTableNode, | |||
import_node: ImportBase) -> bool: | |||
if (existing_symbol.kind in (LDEF, GDEF, MDEF) and | |||
if (existing_symbol.kind in (GDEF, GDEF, GDEF) and |
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.
== GDEF
if self.is_func_scope(): | ||
kind = LDEF | ||
kind = GDEF | ||
self.add_symbol(defn.name, SymbolTableNode(kind, defn.info), defn) |
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.
Inline kind
I think GDEF should not exist at all, and the type of node kind should be an Optional. This resolves the naming problem and the fact that it appears almost everywhere, adding little information to the code. |
Possibly, but that might be a separate refactoring. I like to have stepping stones along the way. Also this PR is disruptive enough as it is (causing everyone else merge conflicts). |
Let's wait a bit before merging this -- I'm trying to remember if there are additional use cases for which the distinction may be still useful. |
Let's not do this, it'll just cause merge conflicts and @JukkaL thinks the information might be useful for some additional ideas he has. |
Here's some new code that's testing for MDEF: |
@JukkaL what do you think? Note that the 'kind' of a node can have a number of values, it's just that all plain variables are now GDEF. This came up in #2553 (comment).
@elazarg what do you think? GDEF isn't the greatest name, but I couldn't really come up with a better one, and DEF feels too short/ambiguous.