OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --strong-mode --harmony_rest_parameters --harmony_arrow_functions --ha rmony_classes --harmony-computed-property-names | 5 // Flags: --strong-mode --harmony_rest_parameters --harmony_arrow_functions --ha rmony_classes --harmony-computed-property-names |
6 | 6 |
7 // Note that it's essential for these tests that the reference is inside dead | 7 // Note that it's essential for these tests that the reference is inside dead |
8 // code (because we already produce ReferenceErrors for run-time unresolved | 8 // code (because we already produce ReferenceErrors for run-time unresolved |
9 // variables and don't want to confuse those with strong mode errors). But the | 9 // variables and don't want to confuse those with strong mode errors). But the |
10 // errors should *not* be inside lazy, unexecuted functions, since lazy parsing | 10 // errors should *not* be inside lazy, unexecuted functions, since lazy parsing |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 | 103 |
104 assertThrowsHelper( | 104 assertThrowsHelper( |
105 "'use strong'; if (false) { let C = class C2 { method() { C; } } }", | 105 "'use strong'; if (false) { let C = class C2 { method() { C; } } }", |
106 ReferenceError); | 106 ReferenceError); |
107 | 107 |
108 assertThrowsHelper( | 108 assertThrowsHelper( |
109 "'use strong'; if (false) { let C = class C2 { " + | 109 "'use strong'; if (false) { let C = class C2 { " + |
110 "static a() { return 'A'; } [C.a()]() { return 'B'; } }; }", | 110 "static a() { return 'A'; } [C.a()]() { return 'B'; } }; }", |
111 ReferenceError); | 111 ReferenceError); |
112 | 112 |
113 // TODO(marja, rossberg): More tests related to computed property names in | 113 assertThrowsHelper( |
114 // classes + recognize more errors. This one is not recognized as an error | 114 "'use strong'; if (false) { let C = class C2 { " + |
115 // yet: | 115 "static a() { return 'A'; } [C2.a()]() { return 'B'; } }; }", |
116 // let C = class C2 { | 116 ReferenceError); |
117 // static a() { return 'A'; } | |
118 // [C2.a()]() { return 'B'; } << C2 should not be allowed here | |
119 // }; | |
120 })(); | 117 })(); |
121 | 118 |
122 | 119 |
123 (function UsesWhichAreFine() { | 120 (function UsesWhichAreFine() { |
124 "use strong"; | 121 "use strong"; |
125 | 122 |
126 let var1 = 0; | 123 let var1 = 0; |
127 var1; | 124 var1; |
128 | 125 |
129 let var2a = 0, var2b = var2a + 1, var2c = 2 + var2b; | 126 let var2a = 0, var2b = var2a + 1, var2c = 2 + var2b; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 var1, var2a, var2b, var2c; | 170 var1, var2a, var2b, var2c; |
174 } | 171 } |
175 | 172 |
176 (function eval1() { | 173 (function eval1() { |
177 let var7 = 0; // Declaration position will be something large. | 174 let var7 = 0; // Declaration position will be something large. |
178 // But use position will be something small, however, this is not an error, | 175 // But use position will be something small, however, this is not an error, |
179 // since the use is inside an eval scope. | 176 // since the use is inside an eval scope. |
180 eval("var7;"); | 177 eval("var7;"); |
181 })(); | 178 })(); |
182 | 179 |
183 // https://code.google.com/p/v8/issues/detail?id=3927 | |
184 // class C1 { constructor() { C1; } }; new C1(); | |
185 // let C2 = class C3 { constructor() { C3; } }; new C2(); | |
186 | 180 |
187 // class C4 { method() { C4; method; } }; new C4(); | 181 class C1 { constructor() { C1; } }; new C1(); |
188 // let C5 = class C6 { method() { C6; method; } }; new C5(); | 182 let C2 = class C3 { constructor() { C3; } }; new C2(); |
183 | |
184 class C4 { method() { C4; } }; new C4(); | |
rossberg
2015/03/04 10:39:27
PErhaps add a third test using a static method.
marja
2015/03/04 11:14:38
Done.
| |
185 let C5 = class C6 { method() { C6; } }; new C5(); | |
189 })(); | 186 })(); |
OLD | NEW |