summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/GeneratorPrototype/next/context-method-invocation.js
blob: 78cdd3f9706b37e7aa1c68e07e22029fc83f22ab (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
// Copyright (C) 2013 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 25.2
description: >
    When a generator function is invoked as a method of an object, its context
    is that object.
features: [generators]
---*/

var context;

function* g() {
  context = this;
}
var obj = {
  g: g
};
var iter = obj.g();

iter.next();

assert.sameValue(context, obj);

reportCompare(0, 0);