Skip to content

Make resolveName ignore export specifiers without calling getSymbol#3532

Merged
JsonFreeman merged 1 commit into
release-1.5from
exportSpecifierScoping
Jun 17, 2015
Merged

Make resolveName ignore export specifiers without calling getSymbol#3532
JsonFreeman merged 1 commit into
release-1.5from
exportSpecifierScoping

Conversation

@JsonFreeman
Copy link
Copy Markdown
Contributor

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.

@JsonFreeman
Copy link
Copy Markdown
Contributor Author

Opened #3535 to track more general issue of whether export specifiers should contribute to scope.

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Jun 17, 2015

👍

JsonFreeman added a commit that referenced this pull request Jun 17, 2015
Make resolveName ignore export specifiers without calling getSymbol
@JsonFreeman JsonFreeman merged commit ab61bf2 into release-1.5 Jun 17, 2015
@JsonFreeman JsonFreeman deleted the exportSpecifierScoping branch June 17, 2015 22:05
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 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.

3 participants