| 1 |
// Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
/*--- |
| 4 |
esid: sec-generator-function-definitions-runtime-semantics-evaluation |
| 5 |
description: Removal of variable environment for the BindingIdentifier |
| 6 |
info: | |
| 7 |
[...] |
| 8 |
2. Let scope be the running execution context's LexicalEnvironment. |
| 9 |
3. Let funcEnv be NewDeclarativeEnvironment(scope). |
| 10 |
4. Let envRec be funcEnv's EnvironmentRecord. |
| 11 |
5. Let name be StringValue of BindingIdentifier. |
| 12 |
6. Perform envRec.CreateImmutableBinding(name, false). |
| 13 |
7. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, |
| 14 |
GeneratorBody, funcEnv, strict). |
| 15 |
[...] |
| 16 |
features: [generators] |
| 17 |
---*/ |
| 18 |
|
| 19 |
var probe; |
| 20 |
|
| 21 |
var func = function* g() { |
| 22 |
probe = function() { return g; }; |
| 23 |
}; |
| 24 |
var g = 'outside'; |
| 25 |
|
| 26 |
func().next(); |
| 27 |
|
| 28 |
assert.sameValue(g, 'outside'); |
| 29 |
assert.sameValue(probe(), func); |