Destructuring object outside of var declaration

Isiah Meadows isiahmeadows at gmail.com
Sun Nov 13 20:33:42 UTC 2016


Okay. Is it a spec bug then? Throwing a ReferenceError is surprising and
odd IMHO.

On Sun, Nov 13, 2016, 14:45 Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:

> On Nov 13, 2016, at 10:49 AM, Isiah Meadows <isiahmeadows at gmail.com>
> wrote:
>
> Firefox likely has a parser bug (it should never throw a ReferenceError in
> that situation).
>
> FireFox is correct, Chrome is wrong. See the second early error rule at
> http://www.ecma-international.org/ecma-262/7.0/index.html#sec-assignment-operators-static-semantics-early-errors
>
>
>
>
>    - It is an early Reference
>    <http://www.ecma-international.org/ecma-262/7.0/index.html#sec-reference-specification-type> Error
>    if LeftHandSideExpression
>    <http://www.ecma-international.org/ecma-262/7.0/index.html#prod-LeftHandSideExpression> is
>    neither an ObjectLiteral
>    <http://www.ecma-international.org/ecma-262/7.0/index.html#prod-ObjectLiteral> nor
>    an ArrayLiteral
>    <http://www.ecma-international.org/ecma-262/7.0/index.html#prod-ArrayLiteral> and
>    IsValidSimpleAssignmentTarget of LeftHandSideExpression
>    <http://www.ecma-international.org/ecma-262/7.0/index.html#prod-LeftHandSideExpression>
>     is false.
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161113/5ceec208/attachment.html>


More information about the es-discuss mailing list