| 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-function-definitions-runtime-semantics-iteratorbindinginitialization |
| 5 |
description: > |
| 6 |
Removal of variable environment for each BindingElement formal parameter |
| 7 |
info: | |
| 8 |
[...] |
| 9 |
6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv). |
| 10 |
7. Set the VariableEnvironment of currentContext to paramVarEnv. |
| 11 |
8. Set the LexicalEnvironment of currentContext to paramVarEnv. |
| 12 |
9. Let result be the result of performing IteratorBindingInitialization for |
| 13 |
BindingElement using iteratorRecord and environment as the arguments. |
| 14 |
10. Set the VariableEnvironment of currentContext to originalEnv. |
| 15 |
11. Set the LexicalEnvironment of currentContext to originalEnv. |
| 16 |
[...] |
| 17 |
flags: [noStrict] |
| 18 |
---*/ |
| 19 |
|
| 20 |
var x = 'outside'; |
| 21 |
var probe1, probe2, probeBody; |
| 22 |
|
| 23 |
(( |
| 24 |
_ = (eval('var x = "inside";'), probe1 = function() { return x; }), |
| 25 |
__ = probe2 = function() { return x; } |
| 26 |
) => { |
| 27 |
probeBody = function() { return x; }; |
| 28 |
})(); |
| 29 |
|
| 30 |
assert.sameValue(probe1(), 'inside'); |
| 31 |
assert.sameValue(probe2(), 'outside'); |
| 32 |
assert.sameValue(probeBody(), 'outside'); |