Debian Codegraph @

js/src/tests/test262/language/statements/generators/param-dflt-yield.js

raw
1 // |reftest| error:SyntaxError
2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-generator-function-definitions
6 es6id: 14.4
7 description: >
8 YieldExpression cannot be used within the FormalParameters of a generator
9 function
10 info: |
11 GeneratorDeclaration[Yield, Default] :
12 function * BindingIdentifier[?Yield] ( FormalParameters[Yield] ) { GeneratorBody }
13
14 YieldExpression cannot be used within the FormalParameters of a generator
15 function because any expressions that are part of FormalParameters are
16 evaluated before the resulting generator object is in a resumable state.
17 features: [generators, default-parameters]
18 negative:
19 phase: parse
20 type: SyntaxError
21 ---*/
22
23 $DONOTEVALUATE();
24
25 function* g(x = yield) {}