• adamk's avatar
    Properly disallow 'yield' in class expressions and arrow parameters · 9e9abcff
    adamk authored
    Yield expressions are not allowed in formal parameter initializers of
    generators, but we weren't properly catching the case where the yield
    expression appeared in the 'extends' clause of a class expression.
    
    They also aren't allowed in arrow functions, which we were failing to
    catch due to not looking at the obscurely-named "FormalParameterInitializerError"
    bit of ExpressionClassifier.
    
    This patch passes along an ExpressionClassifier when parsing class
    expressions and accumulates the proper error for that case.
    
    For the arrow function case, the fix is simply to check for the
    "formal parameter initializer" error once we know we've parsed
    an arrow function. The error message used for this has also
    been made specific to yield expressions.
    
    Tests are added both for the error case and the non-error cases (where
    yield is used in such a position inside the class body).
    
    BUG=v8:4966, v8:4968, v8:4974
    LOG=n
    
    Review-Url: https://codereview.chromium.org/1941823003
    Cr-Commit-Position: refs/heads/master@{#35957}
    9e9abcff
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
docs Loading commit data...
gypfiles Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party/binutils Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
Makefile Loading commit data...
Makefile.android Loading commit data...
Makefile.nacl Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...