Index: test/mjsunit/harmony/block-scoping-sloppy.js |
diff --git a/test/mjsunit/harmony/block-scoping-sloppy.js b/test/mjsunit/harmony/block-scoping-sloppy.js |
index d1975dfafcaffec18c5164e99cbd62bc387a83ec..a622b9e38a001b58a25bdbf218f0dc92849e7181 100644 |
--- a/test/mjsunit/harmony/block-scoping-sloppy.js |
+++ b/test/mjsunit/harmony/block-scoping-sloppy.js |
@@ -47,15 +47,19 @@ function f2(one) { |
var x = one + 1; |
let y = one + 2; |
const u = one + 4; |
+ class a { static foo() { return one + 6; } } |
{ |
let z = one + 3; |
const v = one + 5; |
+ class b { static foo() { return one + 7; } } |
assertEquals(1, eval('one')); |
assertEquals(2, eval('x')); |
assertEquals(3, eval('y')); |
assertEquals(4, eval('z')); |
assertEquals(5, eval('u')); |
assertEquals(6, eval('v')); |
+ assertEquals(7, eval('a.foo()')); |
+ assertEquals(8, eval('b.foo()')); |
} |
} |
@@ -66,15 +70,19 @@ function f3(one) { |
var x = one + 1; |
let y = one + 2; |
const u = one + 4; |
+ class a { static foo() { return one + 6; } } |
{ |
let z = one + 3; |
const v = one + 5; |
+ class b { static foo() { return one + 7; } } |
assertEquals(1, one); |
assertEquals(2, x); |
assertEquals(3, y); |
assertEquals(4, z); |
assertEquals(5, u); |
assertEquals(6, v); |
+ assertEquals(7, a.foo()); |
+ assertEquals(8, b.foo()); |
} |
} |
for (var j = 0; j < 5; ++j) f3(1); |
@@ -89,9 +97,11 @@ function f4(one) { |
var x = one + 1; |
let y = one + 2; |
const u = one + 4; |
+ class a { static foo() { return one + 6; } } |
{ |
let z = one + 3; |
const v = one + 5; |
+ class b { static foo() { return one + 7; } } |
function f() { |
assertEquals(1, eval('one')); |
assertEquals(2, eval('x')); |
@@ -99,6 +109,8 @@ function f4(one) { |
assertEquals(4, eval('z')); |
assertEquals(5, eval('u')); |
assertEquals(6, eval('v')); |
+ assertEquals(7, eval('a.foo()')); |
+ assertEquals(8, eval('b.foo()')); |
} |
f(); |
} |
@@ -111,9 +123,11 @@ function f5(one) { |
var x = one + 1; |
let y = one + 2; |
const u = one + 4; |
+ class a { static foo() { return one + 6; } } |
{ |
let z = one + 3; |
const v = one + 5; |
+ class b { static foo() { return one + 7; } } |
function f() { |
assertEquals(1, one); |
assertEquals(2, x); |
@@ -121,6 +135,8 @@ function f5(one) { |
assertEquals(4, z); |
assertEquals(5, u); |
assertEquals(6, v); |
+ assertEquals(7, a.foo()); |
+ assertEquals(8, b.foo()); |
} |
f(); |
} |
@@ -147,25 +163,43 @@ function f7(a) { |
var c = 1; |
var d = 1; |
const e = 1; |
- { // let variables shadowing argument, let, const and var variables |
+ class f { static foo() { return 1; } } |
+ { // let variables shadowing argument, let, const, class and var variables |
let a = 2; |
let b = 2; |
let c = 2; |
let e = 2; |
+ let f = 2; |
assertEquals(2,a); |
assertEquals(2,b); |
assertEquals(2,c); |
assertEquals(2,e); |
+ assertEquals(2,f); |
} |
{ // const variables shadowing argument, let, const and var variables |
const a = 2; |
const b = 2; |
const c = 2; |
const e = 2; |
+ const f = 2; |
assertEquals(2,a); |
assertEquals(2,b); |
assertEquals(2,c); |
assertEquals(2,e); |
+ assertEquals(2,f); |
+ } |
+ { // class variables shadowing argument, let, const and var variables |
+ class a { static foo() { return 2; } } |
+ class b { static foo() { return 2; } } |
+ class c { static foo() { return 2; } } |
+ class d { static foo() { return 2; } } |
+ class e { static foo() { return 2; } } |
+ class f { static foo() { return 2; } } |
+ assertEquals(2,a.foo()); |
+ assertEquals(2,b.foo()); |
+ assertEquals(2,c.foo()); |
+ assertEquals(2,e.foo()); |
+ assertEquals(2,f.foo()); |
} |
try { |
throw 'stuff1'; |
@@ -223,16 +257,18 @@ function f7(a) { |
c = 2; |
} |
assertEquals(1,c); |
- (function(a,b,c,e) { |
- // arguments shadowing argument, let, const and var variable |
+ (function(a,b,c,e,f) { |
+ // arguments shadowing argument, let, const, class and var variable |
a = 2; |
b = 2; |
c = 2; |
e = 2; |
+ f = 2; |
assertEquals(2,a); |
assertEquals(2,b); |
assertEquals(2,c); |
assertEquals(2,e); |
+ assertEquals(2,f); |
// var variable shadowing var variable |
var d = 2; |
})(1,1); |
@@ -241,6 +277,7 @@ function f7(a) { |
assertEquals(1,c); |
assertEquals(1,d); |
assertEquals(1,e); |
+ assertEquals(1,f.foo()); |
} |
f7(1); |
@@ -251,19 +288,23 @@ function f8() { |
var let_accessors = []; |
var var_accessors = []; |
var const_accessors = []; |
+ var class_accessors = []; |
for (var i = 0; i < 10; i++) { |
let x = i; |
var y = i; |
const z = i; |
+ class a { static foo() { return x; } } |
let_accessors[i] = function() { return x; } |
var_accessors[i] = function() { return y; } |
const_accessors[i] = function() { return z; } |
+ class_accessors[i] = function() { return a; } |
} |
for (var j = 0; j < 10; j++) { |
y = j + 10; |
assertEquals(j, let_accessors[j]()); |
assertEquals(y, var_accessors[j]()); |
assertEquals(j, const_accessors[j]()); |
+ assertEquals(j, class_accessors[j]().foo()); |
} |
} |
f8(); |