Skip to content
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

Add workaround for Safari for loop lexical scope bug #567

Merged
merged 4 commits into from Jun 13, 2017

Commits on Jun 6, 2017

  1. Add workaround for Safari for loop lexical scope bug

    Safari raises a syntax error for a `let` or `const` declaration in a
    `for` loop initalization that shadows a parent function's parameter:
    
    ```js
    function a(b) {
      for (let b;;);
    }
    ```
    
    This is valid code, but Safari throws a syntax error. The bug has been
    [reported](https://bugs.webkit.org/show_bug.cgi?id=171041) and since
    [fixed](https://trac.webkit.org/changeset/217200/webkit/trunk/Source) in
    WebKit, so future versions of Safari will not have this problem.
    
    This modifies the scope tracker's `canUseInReferencedScopes` method to
    detect cases where a rename would trigger this bug and use a different
    name.
    
    Fixes babel#559
    btmills committed Jun 6, 2017
    Copy the full SHA
    9b61b04 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    40f0b4c View commit details
    Browse the repository at this point in the history
  3. More extensive tests

    btmills committed Jun 6, 2017
    Copy the full SHA
    75488d9 View commit details
    Browse the repository at this point in the history
  4. Better use path API

    btmills committed Jun 6, 2017
    Copy the full SHA
    4665255 View commit details
    Browse the repository at this point in the history