Chromium Code Reviews| Index: test/mjsunit/strong/declaration-after-use.js |
| diff --git a/test/mjsunit/strong/declaration-after-use.js b/test/mjsunit/strong/declaration-after-use.js |
| index 0559cdeffbaad73b3846cb1da583f563bb496558..20fa4b355f83e22ec80fd792f525a4dc5a253fd6 100644 |
| --- a/test/mjsunit/strong/declaration-after-use.js |
| +++ b/test/mjsunit/strong/declaration-after-use.js |
| @@ -110,13 +110,40 @@ function assertThrowsHelper(code, error) { |
| "static a() { return 'A'; } [C.a()]() { return 'B'; } }; }", |
| ReferenceError); |
| - // TODO(marja, rossberg): More tests related to computed property names in |
| - // classes + recognize more errors. This one is not recognized as an error |
| - // yet: |
| - // let C = class C2 { |
| - // static a() { return 'A'; } |
| - // [C2.a()]() { return 'B'; } << C2 should not be allowed here |
| - // }; |
| + assertThrowsHelper( |
| + "'use strong'; if (false) { let C = class C2 { " + |
| + "static a() { return 'A'; } [C2.a()]() { return 'B'; } }; }", |
| + ReferenceError); |
| + |
| + assertThrowsHelper( |
| + "'use strong'; if (false) { let C = class C2 { " + |
| + "[(function() { C; return 'A';})()]() { return 'B'; } }; }", |
| + ReferenceError); |
| + |
| + // The reference to C or C2 is inside a function, but not a method. |
| + assertThrowsHelper( |
| + "'use strong'; if (false) { let C = class C2 { " + |
| + "[(function() { C2; return 'A';})()]() { return 'B'; } }; }", |
| + ReferenceError); |
| + |
| + assertThrowsHelper( |
| + "'use strong'; if (false) { let C = class C2 { " + |
| + "[(function() { C; return 'A';})()]() { return 'B'; } }; }", |
| + ReferenceError); |
| + |
| + // The reference to C or C2 is inside a method, but it's not a method of the |
| + // relevant class (C2). |
| + assertThrowsHelper( |
| + "'use strong'; if (false) { let C = class C2 { " + |
| + "[(new (class D { m() { C2; return 'A'; } })).m()]() " + |
| + "{ return 'B'; } } }", |
| + ReferenceError); |
| + |
| + assertThrowsHelper( |
| + "'use strong'; if (false) { let C = class C2 { " + |
| + "[(new (class D { m() { C; return 'A'; } })).m()]() " + |
| + "{ return 'B'; } } }", |
| + ReferenceError); |
|
Dmitry Lomov (no reviews)
2015/03/06 14:48:01
Add a test that tests the wrong behavior:
class C
marja
2015/03/06 16:14:23
Done.
|
| })(); |
| @@ -180,10 +207,13 @@ function assertThrowsHelper(code, error) { |
| eval("var7;"); |
| })(); |
| - // https://code.google.com/p/v8/issues/detail?id=3927 |
| - // class C1 { constructor() { C1; } }; new C1(); |
| - // let C2 = class C3 { constructor() { C3; } }; new C2(); |
| - // class C4 { method() { C4; method; } }; new C4(); |
| - // let C5 = class C6 { method() { C6; method; } }; new C5(); |
| + class C1 { constructor() { C1; } }; new C1(); |
| + let C2 = class C3 { constructor() { C3; } }; new C2(); |
| + |
| + class C4 { method() { C4; } }; new C4(); |
| + let C5 = class C6 { method() { C6; } }; new C5(); |
| + |
| + class C7 { static method() { C7; } }; new C7(); |
| + let C8 = class C9 { static method() { C9; } }; new C8(); |
|
Dmitry Lomov (no reviews)
2015/03/06 14:48:01
Add a test for inner class referencing outer class
marja
2015/03/06 16:14:23
Done (not sure what you meant w/ object literal me
Dmitry Lomov (no reviews)
2015/03/07 18:17:10
Yes, it does
|
| })(); |