diff --git a/test/language/expressions/arrow-function/param-dflt-yield-expr.js b/test/language/expressions/arrow-function/param-dflt-yield-expr.js new file mode 100644 index 0000000000000000000000000000000000000000..20e6786187cbc9d7884a0da0e708cad753a7cd77 --- /dev/null +++ b/test/language/expressions/arrow-function/param-dflt-yield-expr.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-arrow-function-definitions +es6id: 14.2 +description: > + The `yield` token is interpreted contextually outside of strict mode +info: | + ArrowFunction[In, Yield] : + + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + 14.2.1 Static Semantics: Early Errors# + + ArrowFunction : ArrowParameters=>ConciseBody + + - It is a Syntax Error if ArrowParameters Contains YieldExpression is true. +features: [generators, default-parameters] +negative: SyntaxError +---*/ + +function *g() { + (x = yield) => {}; +} diff --git a/test/language/expressions/arrow-function/param-dflt-yield-id-non-strict.js b/test/language/expressions/arrow-function/param-dflt-yield-id-non-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..90ce97b2a76794d5cd147295d601f6179e84ffb2 --- /dev/null +++ b/test/language/expressions/arrow-function/param-dflt-yield-id-non-strict.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-arrow-function-definitions +es6id: 14.2 +description: > + The `yield` token is interpreted as an IdentifierReference outside of strict + mode and outside of generator function bodies. +info: | + ArrowFunction[In, Yield] : + + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] +features: [default-parameters] +flags: [onlyStrict] +negative: SyntaxError +---*/ + +var yield = 23; +var f, paramValue; + +f = (x = yield) => { paramValue = x; }; + +f(); + +assert.sameValue(paramValue, 23); diff --git a/test/language/expressions/arrow-function/param-dflt-yield-id-strict.js b/test/language/expressions/arrow-function/param-dflt-yield-id-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..0e84b4b3fd428e9b49ce17ca6a06e846d8bb8016 --- /dev/null +++ b/test/language/expressions/arrow-function/param-dflt-yield-id-strict.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-arrow-function-definitions +es6id: 14.2 +description: > + The `yield` token is interpreted as a FutureReservedWord within strict mode +info: | + ArrowFunction[In, Yield] : + + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] +features: [default-parameters] +flags: [onlyStrict] +negative: SyntaxError +---*/ + +(x = yield) => {}; diff --git a/test/language/expressions/class/gen-method-param-dflt-yield.js b/test/language/expressions/class/gen-method-param-dflt-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..da350ddbba0f55d6f00d0c00a6fd48ee7cd00ff1 --- /dev/null +++ b/test/language/expressions/class/gen-method-param-dflt-yield.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression cannot be used within the FormalParameters of a generator + function +info: | + GeneratorMethod[Yield]: + + * PropertyName[?Yield] ( StrictFormalParameters[Yield] ) { GeneratorBody } + + YieldExpression cannot be used within the FormalParameters of a generator + function because any expressions that are part of FormalParameters are + evaluated before the resulting generator object is in a resumable state. +features: [generators, default-parameters] +negative: SyntaxError +---*/ + +0, class { + *g(x = yield) {} +}; diff --git a/test/language/expressions/class/method-param-dflt-yield.js b/test/language/expressions/class/method-param-dflt-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..378e0e02f024d0255377372419344382692ea7ee --- /dev/null +++ b/test/language/expressions/class/method-param-dflt-yield.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-method-definitions +es6id: 14.3 +description: > + YieldExpression cannot be used within the FormalParameters of a class method +info: | + MethodDefinition[Yield] : + + PropertyName[?Yield] ( StrictFormalParameters ) { FunctionBody } +features: [generators, default-parameters] +negative: SyntaxError +---*/ + +0, class { + m(x = yield) {} +}; diff --git a/test/language/expressions/class/static-gen-method-param-dflt-yield.js b/test/language/expressions/class/static-gen-method-param-dflt-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..c24810c3bb6ba945a5c64e286671eaee9287a7dc --- /dev/null +++ b/test/language/expressions/class/static-gen-method-param-dflt-yield.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression cannot be used within the FormalParameters of a generator + function +info: | + GeneratorMethod[Yield]: + + * PropertyName[?Yield] ( StrictFormalParameters[Yield] ) { GeneratorBody } + + YieldExpression cannot be used within the FormalParameters of a generator + function because any expressions that are part of FormalParameters are + evaluated before the resulting generator object is in a resumable state. +features: [generators, default-parameters] +negative: SyntaxError +---*/ + +0, class { + static *g(x = yield) {} +}; diff --git a/test/language/expressions/class/static-method-param-dflt-yield.js b/test/language/expressions/class/static-method-param-dflt-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..a6b6d16acd9e2dabaad039107b6a66bf5f253d4f --- /dev/null +++ b/test/language/expressions/class/static-method-param-dflt-yield.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-method-definitions +es6id: 14.3 +description: > + YieldExpression cannot be used within the FormalParameters of a class method +info: | + MethodDefinition[Yield] : + + PropertyName[?Yield] ( StrictFormalParameters ) { FunctionBody } +features: [generators, default-parameters] +negative: SyntaxError +---*/ + +0, class { + static m(x = yield) {} +}; diff --git a/test/language/expressions/function/param-dflt-yield-non-strict.js b/test/language/expressions/function/param-dflt-yield-non-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..9149401c40151139843adb5029a626f3db8bde0c --- /dev/null +++ b/test/language/expressions/function/param-dflt-yield-non-strict.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions +es6id: 14.1 +description: > + The `yield` token is interpreted as an IdentifierReference within a generator + and outside of strict mode +info: | + FunctionExpression : + function BindingIdentifieropt ( FormalParameters ) { FunctionBody } +features: [generators, default-parameters] +flags: [noStrict] +---*/ + +var yield = 23; +var paramValue; + +function *g() { + (function(x = yield) { + paramValue = x; + }()); +} + +g().next(); + +assert.sameValue(paramValue, 23); diff --git a/test/language/expressions/function/param-dflt-yield-strict.js b/test/language/expressions/function/param-dflt-yield-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..875973f963ed89ed155e70d5a93a778237d5f2bc --- /dev/null +++ b/test/language/expressions/function/param-dflt-yield-strict.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions +es6id: 14.1 +description: > + The `yield` token is interpreted as an IdentifierReference within a generator + and outside of strict mode +info: | + FunctionExpression : + function BindingIdentifieropt ( FormalParameters ) { FunctionBody } +features: [generators, default-parameters] +flags: [onlyStrict] +negative: SyntaxError +---*/ + +function *g() { + 0, function(x = yield) { + paramValue = x; + }; +} diff --git a/test/language/expressions/generators/param-dflt-yield.js b/test/language/expressions/generators/param-dflt-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..98952a297412e4e5388caf2017a321f434e57c16 --- /dev/null +++ b/test/language/expressions/generators/param-dflt-yield.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression cannot be used within the FormalParameters of a generator + function +info: | + GeneratorExpression : + + function * BindingIdentifier[Yield]opt ( FormalParameters[Yield] ) { GeneratorBody } + + YieldExpression cannot be used within the FormalParameters of a generator + function because any expressions that are part of FormalParameters are + evaluated before the resulting generator object is in a resumable state. +features: [default-parameters] +negative: SyntaxError +---*/ + +0, function*(x = yield) {}; diff --git a/test/language/statements/class/gen-method-param-dflt-yield.js b/test/language/statements/class/gen-method-param-dflt-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..708120b2b5160f9f31bbe9f20cdb959e14751866 --- /dev/null +++ b/test/language/statements/class/gen-method-param-dflt-yield.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression cannot be used within the FormalParameters of a generator + function +info: | + GeneratorMethod[Yield]: + + * PropertyName[?Yield] ( StrictFormalParameters[Yield] ) { GeneratorBody } + + YieldExpression cannot be used within the FormalParameters of a generator + function because any expressions that are part of FormalParameters are + evaluated before the resulting generator object is in a resumable state. +features: [generators, default-parameters] +negative: SyntaxError +---*/ + +class C { + *g(x = yield) {} +} diff --git a/test/language/statements/class/method-param-yield.js b/test/language/statements/class/method-param-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..244c1e8945e0f7c251f7e821c0be36041400d55c --- /dev/null +++ b/test/language/statements/class/method-param-yield.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-method-definitions +es6id: 14.3 +description: > + YieldExpression cannot be used within the FormalParameters of a class method +info: | + MethodDefinition[Yield] : + + PropertyName[?Yield] ( StrictFormalParameters ) { FunctionBody } +features: [generators, default-parameters] +negative: SyntaxError +---*/ + +class C { + m(x = yield) {} +} diff --git a/test/language/statements/class/static-gen-method-param-dflt-yield.js b/test/language/statements/class/static-gen-method-param-dflt-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..903c8eeba314c60f40306d46fc177fccf8f73590 --- /dev/null +++ b/test/language/statements/class/static-gen-method-param-dflt-yield.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression cannot be used within the FormalParameters of a generator + function +info: | + GeneratorMethod[Yield]: + + * PropertyName[?Yield] ( StrictFormalParameters[Yield] ) { GeneratorBody } + + YieldExpression cannot be used within the FormalParameters of a generator + function because any expressions that are part of FormalParameters are + evaluated before the resulting generator object is in a resumable state. +features: [generators, default-parameters] +negative: SyntaxError +---*/ + +class C { + static *g(x = yield) {} +} diff --git a/test/language/statements/class/static-method-param-yield.js b/test/language/statements/class/static-method-param-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..be2fc130021108b77a5013afca6389c7b39958ac --- /dev/null +++ b/test/language/statements/class/static-method-param-yield.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-method-definitions +es6id: 14.3 +description: > + YieldExpression cannot be used within the FormalParameters of a class method +info: | + MethodDefinition[Yield] : + + PropertyName[?Yield] ( StrictFormalParameters ) { FunctionBody } +features: [generators, default-parameters] +negative: SyntaxError +---*/ + +class C { + static m(x = yield) {} +} diff --git a/test/language/statements/function/param-dflt-yield-non-strict.js b/test/language/statements/function/param-dflt-yield-non-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..d04d8d5dd9122dba3bac8e455f9cbe463d3e4cde --- /dev/null +++ b/test/language/statements/function/param-dflt-yield-non-strict.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions +es6id: 14.1 +description: > + The `yield` token is interpreted as an IdentifierReference within a generator + and outside of strict mode +info: | + FunctionDeclaration[Yield, Default] : + function BindingIdentifier[?Yield] ( FormalParameters ) { FunctionBody } +features: [generators, default-parameters] +flags: [noStrict] +---*/ + +var yield = 23; +var paramValue; + +function *g() { + function f(x = yield) { + paramValue = x; + } + + f(); +} + +g().next(); + +assert.sameValue(paramValue, 23); diff --git a/test/language/statements/function/param-dflt-yield-strict.js b/test/language/statements/function/param-dflt-yield-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..39a14ad1d4579697dac341ea54830e0c859861b3 --- /dev/null +++ b/test/language/statements/function/param-dflt-yield-strict.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions +es6id: 14.1 +description: > + The `yield` token is interpreted as an IdentifierReference within a generator + and outside of strict mode +info: | + FunctionDeclaration[Yield, Default] : + function BindingIdentifier[?Yield] ( FormalParameters ) { FunctionBody } +features: [generators, default-parameters] +flags: [onlyStrict] +negative: SyntaxError +---*/ + +function *g() { + function f(x = yield) { + paramValue = x; + } +} diff --git a/test/language/statements/generators/param-dflt-yield.js b/test/language/statements/generators/param-dflt-yield.js new file mode 100644 index 0000000000000000000000000000000000000000..6df68b3bebd51d2c89aa4593df048ca6d699efa2 --- /dev/null +++ b/test/language/statements/generators/param-dflt-yield.js @@ -0,0 +1,20 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression cannot be used within the FormalParameters of a generator + function +info: | + GeneratorDeclaration[Yield, Default] : + function * BindingIdentifier[?Yield] ( FormalParameters[Yield] ) { GeneratorBody } + + YieldExpression cannot be used within the FormalParameters of a generator + function because any expressions that are part of FormalParameters are + evaluated before the resulting generator object is in a resumable state. +features: [default-parameters] +negative: SyntaxError +---*/ + +function* g(x = yield) {}