Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/scope-gen-meth-param-rest-elem-var-close.js

raw
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 the BindingRestElement formal parameter
7 info: |
8 [...]
9 2. Let currentContext be the running execution context.
10 3. Let originalEnv be the VariableEnvironment of currentContext.
11 4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
12 are the same.
13 5. Assert: environment and originalEnv are the same.
14 6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
15 7. Set the VariableEnvironment of currentContext to paramVarEnv.
16 8. Set the LexicalEnvironment of currentContext to paramVarEnv.
17 9. Let result be the result of performing IteratorBindingInitialization for
18 BindingRestElement using iteratorRecord and environment as the
19 arguments.
20 10. Set the VariableEnvironment of currentContext to originalEnv.
21 11. Set the LexicalEnvironment of currentContext to originalEnv.
22 [...]
23 flags: [noStrict]
24 features: [generators]
25 ---*/
26
27 var x = 'outside';
28 var probeParam, probeBody;
29
30 ({
31 *m(
32 ...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })]
33 ) {
34 probeBody = function() { return x; }
35 }
36 }.m().next());
37
38 assert.sameValue(probeParam(), 'inside');
39 assert.sameValue(probeBody(), 'outside');