-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[[FIX]] Account for implied closures
Some environments wrap code in an immediately-invoked function expression prior to evaluation. This behavior has an effect on global `var` declarations. Unlike in typical JavaScript source code, such statements in these contexts do *not* create new entries in the environment record, nor do they resolve to references to the global binding (where defined). Update the logic that tracks global definitions to account for such environments, avoiding issuing warning W079 ("Redefinition of '{a}'.") which is otherwise appropriate. Note: a far preferable solution would involve updating JSHint's scope tracking mechanism to create a new entry for this implicit function scope. Unfortunately the legacy implementation of the environmental options allowed for usage scenarios that are incompatible with that approach (specifically: enabling the environment options after the source text has been partially parsed).
- Loading branch information
1 parent
bb87ddf
commit c3b4d63
Showing
6 changed files
with
120 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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