• 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
..
regress Loading commit data...
arrow-bare-rest-param.js Loading commit data...
arrow-bare-rest-param.out Loading commit data...
arrow-formal-parameters.js Loading commit data...
arrow-formal-parameters.out Loading commit data...
arrow-invalid-rest-2.js Loading commit data...
arrow-invalid-rest-2.out Loading commit data...
arrow-invalid-rest.js Loading commit data...
arrow-invalid-rest.out Loading commit data...
arrow-missing.js Loading commit data...
arrow-missing.out Loading commit data...
arrow-param-after-rest-2.js Loading commit data...
arrow-param-after-rest-2.out Loading commit data...
arrow-param-after-rest.js Loading commit data...
arrow-param-after-rest.out Loading commit data...
arrow-strict-eval-bare-parameter.js Loading commit data...
arrow-strict-eval-bare-parameter.out Loading commit data...
arrow-two-rest-params.js Loading commit data...
arrow-two-rest-params.out Loading commit data...
class-constructor-accessor.js Loading commit data...
class-constructor-accessor.out Loading commit data...
class-constructor-generator.js Loading commit data...
class-constructor-generator.out Loading commit data...
const-decl-no-init-sloppy.out Loading commit data...
const-decl-no-init.js Loading commit data...
const-decl-no-init.out Loading commit data...
const-decl-no-init2.js Loading commit data...
const-decl-no-init2.out Loading commit data...
default-parameter-tdz-arrow.js Loading commit data...
default-parameter-tdz-arrow.out Loading commit data...
default-parameter-tdz.js Loading commit data...
default-parameter-tdz.out Loading commit data...
destructuring-decl-no-init-array.js Loading commit data...
destructuring-decl-no-init-array.out Loading commit data...
destructuring-decl-no-init-array2.js Loading commit data...
destructuring-decl-no-init-array2.out Loading commit data...
destructuring-decl-no-init-obj.js Loading commit data...
destructuring-decl-no-init-obj.out Loading commit data...
destructuring-decl-no-init-obj2.js Loading commit data...
destructuring-decl-no-init-obj2.out Loading commit data...
destructuring-modify-const.js Loading commit data...
destructuring-modify-const.out Loading commit data...
export-duplicate-as.js Loading commit data...
export-duplicate-as.out Loading commit data...
export-duplicate-default.js Loading commit data...
export-duplicate-default.out Loading commit data...
export-duplicate.js Loading commit data...
export-duplicate.out Loading commit data...
for-in-let-loop-initializers-strict.js Loading commit data...
for-in-let-loop-initializers-strict.out Loading commit data...
for-in-loop-initializers-destructuring.js Loading commit data...
for-in-loop-initializers-destructuring.out Loading commit data...
for-in-loop-initializers-strict.js Loading commit data...
for-in-loop-initializers-strict.out Loading commit data...
for-loop-invalid-lhs.js Loading commit data...
for-loop-invalid-lhs.out Loading commit data...
for-of-let-loop-initializers.js Loading commit data...
for-of-let-loop-initializers.out Loading commit data...
for-of-loop-initializers-sloppy.js Loading commit data...
for-of-loop-initializers-sloppy.out Loading commit data...
for-of-loop-initializers-strict.js Loading commit data...
for-of-loop-initializers-strict.out Loading commit data...
for-of-throw-in-body.js Loading commit data...
for-of-throw-in-body.out Loading commit data...
formal-parameters-bad-rest.js Loading commit data...
formal-parameters-bad-rest.out Loading commit data...
formal-parameters-strict-body.js Loading commit data...
formal-parameters-strict-body.out Loading commit data...
formal-parameters-trailing-comma.js Loading commit data...
formal-parameters-trailing-comma.out Loading commit data...
function-sent-escaped.js Loading commit data...
function-sent-escaped.out Loading commit data...
import-as-eval.js Loading commit data...
import-as-eval.out Loading commit data...
import-as-redeclaration.js Loading commit data...
import-as-redeclaration.out Loading commit data...
import-as-reserved-word.js Loading commit data...
import-as-reserved-word.out Loading commit data...
import-eval.js Loading commit data...
import-eval.out Loading commit data...
import-redeclaration.js Loading commit data...
import-redeclaration.out Loading commit data...
import-reserved-word.js Loading commit data...
import-reserved-word.out Loading commit data...
instanceof-noncallable.js Loading commit data...
instanceof-noncallable.out Loading commit data...
instanceof-nonobject.js Loading commit data...
instanceof-nonobject.out Loading commit data...
invalid-spread-2.js Loading commit data...
invalid-spread-2.out Loading commit data...
invalid-spread.js Loading commit data...
invalid-spread.out Loading commit data...
isvar.js Loading commit data...
isvar.out Loading commit data...
let-lexical-name-in-array-prohibited.js Loading commit data...
let-lexical-name-in-array-prohibited.out Loading commit data...
let-lexical-name-in-object-prohibited.js Loading commit data...
let-lexical-name-in-object-prohibited.out Loading commit data...
let-lexical-name-prohibited.js Loading commit data...
let-lexical-name-prohibited.out Loading commit data...
message.gyp Loading commit data...
message.isolate Loading commit data...
message.status Loading commit data...
new-target-assignment.js Loading commit data...
new-target-assignment.out Loading commit data...
new-target-escaped.js Loading commit data...
new-target-escaped.out Loading commit data...
new-target-for-loop.js Loading commit data...
new-target-for-loop.out Loading commit data...
new-target-postfix-op.js Loading commit data...
new-target-postfix-op.out Loading commit data...
new-target-prefix-op.js Loading commit data...
new-target-prefix-op.out Loading commit data...
nf-yield-in-generator.js Loading commit data...
nf-yield-in-generator.out Loading commit data...
nf-yield-strict-in-generator.js Loading commit data...
nf-yield-strict-in-generator.out Loading commit data...
nf-yield-strict.js Loading commit data...
nf-yield-strict.out Loading commit data...
nfe-yield-generator.js Loading commit data...
nfe-yield-generator.out Loading commit data...
nfe-yield-strict.js Loading commit data...
nfe-yield-strict.out Loading commit data...
non-alphanum.js Loading commit data...
non-alphanum.out Loading commit data...
non-use-strict-hex-escape.js Loading commit data...
non-use-strict-hex-escape.out Loading commit data...
non-use-strict-octal-escape.js Loading commit data...
non-use-strict-octal-escape.out Loading commit data...
non-use-strict-uhex-escape.js Loading commit data...
non-use-strict-uhex-escape.out Loading commit data...
nonstrict-arguments.js Loading commit data...
nonstrict-arguments.out Loading commit data...
nonstrict-eval.js Loading commit data...
nonstrict-eval.out Loading commit data...
nonstrict-with.js Loading commit data...
nonstrict-with.out Loading commit data...
overwritten-builtins.js Loading commit data...
overwritten-builtins.out Loading commit data...
paren_in_arg_string.js Loading commit data...
paren_in_arg_string.out Loading commit data...
replacement-marker-as-argument.js Loading commit data...
replacement-marker-as-argument.out Loading commit data...
rest-param-class-setter-strict.js Loading commit data...
rest-param-class-setter-strict.out Loading commit data...
rest-param-object-setter-sloppy.js Loading commit data...
rest-param-object-setter-sloppy.out Loading commit data...
rest-param-object-setter-strict.js Loading commit data...
rest-param-object-setter-strict.out Loading commit data...
simple-throw.js Loading commit data...
simple-throw.out Loading commit data...
strict-formal-parameters.js Loading commit data...
strict-formal-parameters.out Loading commit data...
strict-octal-indirect-regexp.js Loading commit data...
strict-octal-indirect-regexp.out Loading commit data...
strict-octal-number.js Loading commit data...
strict-octal-number.out Loading commit data...
strict-octal-regexp.js Loading commit data...
strict-octal-regexp.out Loading commit data...
strict-octal-string.js Loading commit data...
strict-octal-string.out Loading commit data...
strict-octal-use-strict-after.js Loading commit data...
strict-octal-use-strict-after.out Loading commit data...
strict-octal-use-strict-before.js Loading commit data...
strict-octal-use-strict-before.out Loading commit data...
strict-with.js Loading commit data...
strict-with.out Loading commit data...
super-constructor-extra-statement.js Loading commit data...
super-constructor-extra-statement.out Loading commit data...
super-constructor.js Loading commit data...
super-constructor.out Loading commit data...
super-in-function.js Loading commit data...
super-in-function.out Loading commit data...
syntactic-tail-call-in-for-in.js Loading commit data...
syntactic-tail-call-in-for-in.out Loading commit data...
syntactic-tail-call-in-for-of.js Loading commit data...
syntactic-tail-call-in-for-of.out Loading commit data...
syntactic-tail-call-in-try-catch-finally.js Loading commit data...
syntactic-tail-call-in-try-catch-finally.out Loading commit data...
syntactic-tail-call-in-try-try-catch-finally.js Loading commit data...
syntactic-tail-call-in-try-try-catch-finally.out Loading commit data...
syntactic-tail-call-in-try.js Loading commit data...
syntactic-tail-call-in-try.out Loading commit data...
testcfg.py Loading commit data...
try-catch-finally-no-message.js Loading commit data...
try-catch-finally-no-message.out Loading commit data...
try-catch-finally-return-in-finally.js Loading commit data...
try-catch-finally-return-in-finally.out Loading commit data...
try-catch-finally-throw-in-catch-and-finally.js Loading commit data...
try-catch-finally-throw-in-catch-and-finally.out Loading commit data...
try-catch-finally-throw-in-catch.js Loading commit data...
try-catch-finally-throw-in-catch.out Loading commit data...
try-catch-finally-throw-in-finally.js Loading commit data...
try-catch-finally-throw-in-finally.out Loading commit data...
try-catch-lexical-conflict.js Loading commit data...
try-catch-lexical-conflict.out Loading commit data...
try-catch-variable-conflict.js Loading commit data...
try-catch-variable-conflict.out Loading commit data...
try-finally-return-in-finally.js Loading commit data...
try-finally-return-in-finally.out Loading commit data...
try-finally-throw-in-finally.js Loading commit data...
try-finally-throw-in-finally.out Loading commit data...
try-finally-throw-in-try-and-finally.js Loading commit data...
try-finally-throw-in-try-and-finally.out Loading commit data...
try-finally-throw-in-try.js Loading commit data...
try-finally-throw-in-try.out Loading commit data...
unicode-escape-invalid-2.js Loading commit data...
unicode-escape-invalid-2.out Loading commit data...
unicode-escape-invalid.js Loading commit data...
unicode-escape-invalid.out Loading commit data...
unicode-escape-undefined.js Loading commit data...
unicode-escape-undefined.out Loading commit data...
unterminated-arg-list.js Loading commit data...
unterminated-arg-list.out Loading commit data...
yield-in-arrow-param.js Loading commit data...
yield-in-arrow-param.out Loading commit data...
yield-in-generator-param.js Loading commit data...
yield-in-generator-param.out Loading commit data...