aboutsummaryrefslogtreecommitdiffstats
path: root/src/generators/default/obj-method.template
blob: 7cf8b981234aecb5e1a000eedab4eff8bd98a1f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/object/method-definition/gen-
name: Generator method
esid: prod-GeneratorMethod
info: |
  14.4 Generator Function Definitions

  GeneratorMethod[Yield, Await]:
    * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
features: [generators]
---*/

var callCount = 0;

var gen = {
  *method() {
    callCount += 1;
    /*{ body }*/
  }
}.method;

var iter = gen();

/*{ assertions }*/

assert.sameValue(callCount, 1);