OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 eval("var x = { get " + word + " () { 'use strict'; } };"); | 328 eval("var x = { get " + word + " () { 'use strict'; } };"); |
329 eval("var x = { set " + word + " (value) { 'use strict'; } };"); | 329 eval("var x = { set " + word + " (value) { 'use strict'; } };"); |
330 assertThrows("var x = { get foo(" + word + ") { 'use strict'; } };", SyntaxErr or); | 330 assertThrows("var x = { get foo(" + word + ") { 'use strict'; } };", SyntaxErr or); |
331 assertThrows("var x = { set foo(" + word + ") { 'use strict'; } };", SyntaxErr or); | 331 assertThrows("var x = { set foo(" + word + ") { 'use strict'; } };", SyntaxErr or); |
332 } | 332 } |
333 | 333 |
334 for (var i = 0; i < future_reserved_words.length; i++) { | 334 for (var i = 0; i < future_reserved_words.length; i++) { |
335 testFutureReservedWord(future_reserved_words[i]); | 335 testFutureReservedWord(future_reserved_words[i]); |
336 } | 336 } |
337 | 337 |
338 function testAssignToUndefined(should_throw) { | |
339 "use strict"; | |
340 try { | |
341 possibly_undefined_variable_for_strict_mode_test = "should throw?"; | |
342 } catch (e) { | |
343 assertTrue(should_throw, "strict mode"); | |
344 assertInstanceof(e, ReferenceError, "strict mode"); | |
345 return; | |
346 } | |
347 assertFalse(should_throw, "strict mode"); | |
348 } | |
338 | 349 |
350 testAssignToUndefined(true); | |
351 testAssignToUndefined(true); | |
352 testAssignToUndefined(true); | |
MarkM
2011/02/11 03:06:59
Why are you calling this three times for each case
Mads Ager (chromium)
2011/02/11 08:08:09
In order to make sure that ICs are initialized and
Martin Maly
2011/02/11 21:43:28
Done.
| |
353 | |
354 possibly_undefined_variable_for_strict_mode_test = "value"; | |
355 | |
356 testAssignToUndefined(false); | |
357 testAssignToUndefined(false); | |
358 testAssignToUndefined(false); | |
359 | |
360 delete possibly_undefined_variable_for_strict_mode_test; | |
361 | |
362 testAssignToUndefined(true); | |
363 testAssignToUndefined(true); | |
364 testAssignToUndefined(true); | |
OLD | NEW |