• littledan's avatar
    Improve parsing errors related to destructuring bind · 9d6ab46a
    littledan authored
    For destructuring bind, the parser needs to complain about things
    which are inappropriate to have on the left-hand side.
    
    Previously, regexp literals and template literals were let through
    the parser inappropriately. This patch turns those into errors.
    
    This patch also fixes off-by-one errors in reporting the location
    of this type of error for strings and numbers. Before the patch,
    the error would look like:
    
    d8> var {x: 3} = {x: 4}
    (d8):1: SyntaxError: Unexpected number
    var {x: 3} = {x: 4}
          ^
    SyntaxError: Unexpected number
    
    And with the patch, the error is
    
    d8> var {x: 3} = {x: 4}
    (d8):1: SyntaxError: Unexpected number
    var {x: 3} = {x: 4}
            ^
    SyntaxError: Unexpected number
    
    R=rossberg
    
    Review URL: https://codereview.chromium.org/1236803003
    
    Cr-Commit-Position: refs/heads/master@{#29661}
    9d6ab46a
test-parsing.cc 217 KB