Skip to content

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

Closed
wants to merge 5 commits into from

Conversation

vladima
Copy link
Contributor

@vladima vladima commented Jul 17, 2014

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.

function foo(...); // symbol 1
export function foo(...); // symbol 2
function foo(...) // symbol 1

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.

}
exportSymbol.localSymbols.push(localSymbol);
}
localSymbol.exportSymbol = exportSymbol;
}
else {
Copy link
Contributor

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?

Copy link
Member

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.

@ahejlsberg
Copy link
Member

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); });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.concat?

Copy link
Member

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.

@vladima
Copy link
Contributor Author

vladima commented Jul 18, 2014

@JsonFreeman @ahejlsberg can you check the latest revision?

@vladima vladima closed this Jul 28, 2014
@vladima vladima deleted the exports branch August 3, 2014 05:40
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants