Make resolveName ignore export specifiers without calling getSymbol#3532
Merged
Conversation
Contributor
Author
|
Opened #3535 to track more general issue of whether export specifiers should contribute to scope. |
Contributor
|
👍 |
JsonFreeman
added a commit
that referenced
this pull request
Jun 17, 2015
Make resolveName ignore export specifiers without calling getSymbol
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #3514 in release-1.5.
Export specifiers never put a symbol in scope in a module. Right now, resolveName calls getSymbol on the exports of the module, and if it finds an export specifier, dismisses it and keeps going. The problem is that getSymbol may try to resolveAlias on the export specifier, which would indirectly detect a circular reference if the target of the export specifier is outside the module.
The fix in this PR is to detect if the symbol in resolveName is an export specifier without calling getSymbol. Other than that, this PR is intended to keep the behavior pretty much the same.
This highlights an interesting difference between export modifiers and export specifiers when it comes to declaration merging of ambient external modules. I will open an issue to track this behavior discussion (#3535).
Another potential fix is to create two different symbol tables for the exports of external modules, one for loose exports that are put into scope, and one for strict exports that do not. That is a much deeper and invasive change though, and is likely not appropriate for release-1.5.