• Daniel Ehrenberg's avatar
    [parser] Prohibit async functions and generators in invalid contexts · ee15703e
    Daniel Ehrenberg authored
    Async functions and generator declarations are only permitted as
    StatementListItems, not as ExpressionStatements, and therefore not
    as the entire body of an if statement, etc. Previously, they were
    incorrectly permitted. However, ChakraCore and SpiderMonkey seem
    to ban them in this context, and the feature was introduced relatively
    recently, so it is likely to be web-compatible to ship the prohibition.
    
    This patch also unifies the error message wording of async functions
    and generators to ordinary functions, explaining more clearly what
    the issue is.
    
    Bug: v8:4483
    Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
    Change-Id: I31ed7818d6ab3e7e325031bfabb933dbf4512143
    Reviewed-on: https://chromium-review.googlesource.com/568979
    Commit-Queue: Daniel Ehrenberg <littledan@chromium.org>
    Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#46770}
    ee15703e
messages.h 45.9 KB