diff options
Diffstat (limited to 'js/src/tests/test262/language/expressions/function/scope-name-var-close.js')
-rw-r--r-- | js/src/tests/test262/language/expressions/function/scope-name-var-close.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/function/scope-name-var-close.js b/js/src/tests/test262/language/expressions/function/scope-name-var-close.js new file mode 100644 index 0000000000..2114f5ad5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/scope-name-var-close.js @@ -0,0 +1,30 @@ +// 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-evaluation +description: Removal of variable environment for the BindingIdentifier +info: | + [...] + 2. Let scope be the running execution context's LexicalEnvironment. + 3. Let funcEnv be NewDeclarativeEnvironment(scope). + 4. Let envRec be funcEnv's EnvironmentRecord. + 5. Let name be StringValue of BindingIdentifier. + 6. Perform envRec.CreateImmutableBinding(name, false). + 7. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + funcEnv, strict). + [...] +---*/ + +var probe; + +var func = function f() { + probe = function() { return f; }; +}; +var f = 'outside'; + +func(); + +assert.sameValue(f, 'outside'); +assert.sameValue(probe(), func); + +reportCompare(0, 0); |