mirror of
https://github.com/tc39/test262.git
synced 2025-08-21 09:58:27 +02:00
29 lines
842 B
Plaintext
29 lines
842 B
Plaintext
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
/*---
|
|
desc: Variable binding is initialized to `undefined` in outer scope
|
|
template: func
|
|
info: |
|
|
B.3.3.1 Changes to FunctionDeclarationInstantiation
|
|
|
|
[...]
|
|
2. If instantiatedVarNames does not contain F, then
|
|
a. Perform ! varEnvRec.CreateMutableBinding(F, false).
|
|
b. Perform varEnvRec.InitializeBinding(F, undefined).
|
|
c. Append F to instantiatedVarNames.
|
|
[...]
|
|
---*/
|
|
|
|
//- setup
|
|
var init, changed;
|
|
//- before
|
|
init = f;
|
|
f = 123;
|
|
changed = f;
|
|
//- teardown
|
|
assert.sameValue(init, undefined, 'binding is initialized to `undefined`');
|
|
assert.sameValue(changed, 123, 'binding is mutable');
|
|
assert.throws(ReferenceError, function() {
|
|
f;
|
|
}, 'global binding is not created');
|