File: scope-gen-meth-param-rest-elem-var-close.js

package info (click to toggle)
qtdeclarative-opensource-src-gles 5.15.17%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 258,992 kB
  • sloc: javascript: 512,415; cpp: 497,385; xml: 8,892; python: 3,304; ansic: 2,764; sh: 206; makefile: 46; php: 27
file content (39 lines) | stat: -rw-r--r-- 1,478 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-function-definitions-runtime-semantics-iteratorbindinginitialization
description: >
    Removal of variable environment for the BindingRestElement formal parameter
info: |
    [...]
    2. Let currentContext be the running execution context.
    3. Let originalEnv be the VariableEnvironment of currentContext.
    4. Assert: The VariableEnvironment and LexicalEnvironment of currentContext
       are the same.
    5. Assert: environment and originalEnv are the same.
    6. Let paramVarEnv be NewDeclarativeEnvironment(originalEnv).
    7. Set the VariableEnvironment of currentContext to paramVarEnv.
    8. Set the LexicalEnvironment of currentContext to paramVarEnv.
    9. Let result be the result of performing IteratorBindingInitialization for
       BindingRestElement using iteratorRecord and environment as the
       arguments.
    10. Set the VariableEnvironment of currentContext to originalEnv.
    11. Set the LexicalEnvironment of currentContext to originalEnv.
    [...]
flags: [noStrict]
features: [generators]
---*/

var x = 'outside';
var probeParam, probeBody;

({
  *m(
    ...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })]
  ) {
    probeBody = function() { return x; }
  }
}.m().next());

assert.sameValue(probeParam(), 'inside');
assert.sameValue(probeBody(), 'outside');