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

Fix typeof Symbol.prototype #3686

Merged
merged 2 commits into from Sep 20, 2016
Merged

Commits on Aug 30, 2016

  1. formatting

    brainlock committed Aug 30, 2016
    Configuration menu
    Copy the full SHA
    dd01831 View commit details
    Browse the repository at this point in the history
  2. fix typeof Symbol.prototype

    Babel uses a helper function to return the correct value for `typeof
    obj` when obj is a Symbol and support for Symbol has been polyfilled.
    
    This function assumes that `obj.constructor === Symbol` implies `typeof
    obj === 'symbol'`.
    
    This isn't true when obj is `Symbol.prototype`. In that case (REPL from
    node 6, the same holds in Firefox):
    
    ```
    > Symbol.prototype.constructor === Symbol
    true
    > typeof Symbol.prototype
    'object'
    >
    ```
    
    AFAICS, that's the only case where the assumption doesn't hold.
    
    The test added by this patch fails only on node 0.10, as 0.12 already
    has a native implementation of Symbol and the polyfill code doesn't run.
    
    This caused a problem in core-js when it's compiled with babel (the
    issue was isolated by @skozin here:
    zloirock/core-js#189 (comment)).
    brainlock committed Aug 30, 2016
    Configuration menu
    Copy the full SHA
    c93dffb View commit details
    Browse the repository at this point in the history