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