Debian Codegraph @

js/src/tests/test262/language/eval-code/indirect/lex-env-distinct-cls.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-performeval
5 description: >
6 Indirect eval code creates a new declarative environment for
7 lexically-scoped declarations (class)
8 info: |
9 [...]
10 9. If direct is true, then
11 [...]
12 10. Else,
13 a. Let lexEnv be NewDeclarativeEnvironment(evalRealm.[[GlobalEnv]]).
14 [...]
15 features: [class]
16 ---*/
17
18 class outside {}
19
20 (0,eval)('class outside {}');
21 (0,eval)('"use strict"; class outside {}');
22
23 (0,eval)('class xNonStrict {}');
24
25 assert.sameValue(typeof xNonStrict, 'undefined');
26 assert.throws(ReferenceError, function() {
27 xNonStrict;
28 });
29
30 (0,eval)('"use strict"; class xStrict {}');
31
32 assert.sameValue(typeof xStrict, 'undefined');
33 assert.throws(ReferenceError, function() {
34 xStrict;
35 });
36
37 reportCompare(0, 0);