Debian Codegraph @

js/src/tests/test262/language/statements/with/unscopables-get-err.js

raw
1 // Copyright 2015 Mike Pennisi. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-getidentifierreference
6 es6id: 8.1.2.1
7 description: >
8 Behavior when accessing `Symbol.unscopables` property value throws an error
9 info: |
10 [...]
11 2. Let envRec be lex's EnvironmentRecord.
12 3. Let exists be ? envRec.HasBinding(name).
13
14 8.1.1.2.1 HasBinding
15
16 [...]
17 5. If the withEnvironment flag of envRec is false, return true.
18 6. Let unscopables be ? Get(bindings, @@unscopables).
19
20 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
21
22 [...]
23 5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
24 [...]
25 flags: [noStrict]
26 features: [Symbol.unscopables]
27 ---*/
28
29 var env = { x: 86 };
30 Object.defineProperty(env, Symbol.unscopables, {
31 get: function() {
32 throw new Test262Error();
33 }
34 });
35
36 with (env) {
37 assert.throws(Test262Error, function() {
38 x;
39 });
40 }
41
42 reportCompare(0, 0);