• littledan's avatar
    Destructuring array without initializer throws an exception · 2e7077e0
    littledan authored
    Previously, cases like
      var [foo]
    led to a parser crash because the parser tried to do something with
    the initializer, which was not syntactically present.
    
    This patch fixes the parser issue (implicitly creating an undefined
    initializer) and inserts a check for array destructuring that the
    right-hand side is coercible to an object, so it can have iterator
    methods called on it safely.
    
    BUG=v8:4462
    LOG=Y
    R=adamk
    
    Review URL: https://codereview.chromium.org/1384413002
    
    Cr-Commit-Position: refs/heads/master@{#31128}
    2e7077e0
destructuring.js 29.3 KB