• 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...
cctest Loading commit data...
fuzzer Loading commit data...
intl Loading commit data...
js-perf-test Loading commit data...
memory Loading commit data...
message Loading commit data...
mjsunit Loading commit data...
mozilla Loading commit data...
preparser Loading commit data...
promises-aplus Loading commit data...
simdjs Loading commit data...
test262 Loading commit data...
unittests Loading commit data...
webkit Loading commit data...
bot_default.gyp Loading commit data...
bot_default.isolate Loading commit data...
default.gyp Loading commit data...
default.isolate Loading commit data...
ignition.gyp Loading commit data...
ignition.isolate Loading commit data...
optimize_for_size.gyp Loading commit data...
optimize_for_size.isolate Loading commit data...
perf.gyp Loading commit data...
perf.isolate Loading commit data...