lex-env-distinct-cls.js (842B)
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 Direct eval code creates a new declarative environment for lexically-scoped 7 declarations (class) 8 info: | 9 [...] 10 9. If direct is true, then 11 a. Let lexEnv be NewDeclarativeEnvironment(ctx's LexicalEnvironment). 12 [...] 13 features: [class] 14 ---*/ 15 16 class outside {} 17 18 eval('class outside {}'); 19 eval('"use strict"; class outside {}'); 20 21 eval('class xNonStrict {}'); 22 23 assert.sameValue(typeof xNonStrict, 'undefined'); 24 assert.throws(ReferenceError, function() { 25 xNonStrict; 26 }); 27 28 eval('"use strict"; class xStrict {}'); 29 30 assert.sameValue(typeof xStrict, 'undefined'); 31 assert.throws(ReferenceError, function() { 32 xStrict; 33 }); 34 35 reportCompare(0, 0);