test262/test/language/eval-code/direct/var-env-var-init-global-exstng.js
Mike Pennisi 784824895d Extend coverage for eval code
Closes #572

Introduce tests for new semantics for ES2015 features such as
lexically-scoped bindings. Also add tests for semantics defined in prior
editions of the specification but not yet covered in this test suite.
2016-04-25 16:43:48 -04:00

34 lines
897 B
JavaScript

// 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-evaldeclarationinstantiation
description: Declaration does not modify existing global property
info: |
[...]
16. For each String vn in declaredVarNames, in list order do
a. If varEnvRec is a global Environment Record, then
i. Perform ? varEnvRec.CreateGlobalVarBinding(vn, true).
[...]
8.1.1.4.17 CreateGlobalVarBinding
[...]
5. Let extensible be ? IsExtensible(globalObject).
6. If hasProperty is false and extensible is true, then
[...]
[...]
flags: [noStrict]
includes: [propertyHelper.js]
---*/
var initial;
var x = 23;
eval('initial = x; var x = 45;');
verifyEnumerable(this, 'x');
verifyWritable(this, 'x');
verifyNotConfigurable(this, 'x');
assert.sameValue(initial, 23);