-
Notifications
You must be signed in to change notification settings - Fork 12.9k
exported declarations now don't take the exclusive slot #37
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
Conversation
} | ||
exportSymbol.localSymbols.push(localSymbol); | ||
} | ||
localSymbol.exportSymbol = exportSymbol; | ||
} | ||
else { |
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.
What is this else block for?
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.
It is for import aliases. An exported import alias doesn't have a local symbol.
I definitely like that we can reason about the local and exported symbols as a single entity, but I think it would be good to go over the logic behind this change on the whiteboard before we accept it. I just want to make sure we've covered everything. |
if (!target.localSymbols) { | ||
target.localSymbols = []; | ||
} | ||
forEach(source.localSymbols, node => { target.localSymbols.push(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.
.concat?
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.
No, they're being added to an already existing array.
@JsonFreeman @ahejlsberg can you check the latest revision? |
Export and local symbol are used to mutually exclude each other so having exported and non exported declarations with the same name that can be merged lead to 'Duplicate identifier' and as a consequence these declarations were attached to a different symbols.
Such layout makes declaration analysis extremely inconvenient since there are no easy way to reconstruct actual sequence of declarations in program
This PR allows exported and non exported declarations to share local symbol.