summaryrefslogtreecommitdiff
path: root/test/built-ins/GeneratorPrototype/next/context-method-invocation.js
blob: 5e6f3ed5a53adcf5a564d428f84693e2f5fc6d1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 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);