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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 CheckStrictMode("function strict() { var x = ++arguments; }", SyntaxError); | 257 CheckStrictMode("function strict() { var x = ++arguments; }", SyntaxError); |
258 | 258 |
259 // Prefix decrement with eval or arguments | 259 // Prefix decrement with eval or arguments |
260 CheckStrictMode("function strict() { --eval; }", SyntaxError); | 260 CheckStrictMode("function strict() { --eval; }", SyntaxError); |
261 CheckStrictMode("function strict() { --arguments; }", SyntaxError); | 261 CheckStrictMode("function strict() { --arguments; }", SyntaxError); |
262 CheckStrictMode("function strict() { print(--eval); }", SyntaxError); | 262 CheckStrictMode("function strict() { print(--eval); }", SyntaxError); |
263 CheckStrictMode("function strict() { print(--arguments); }", SyntaxError); | 263 CheckStrictMode("function strict() { print(--arguments); }", SyntaxError); |
264 CheckStrictMode("function strict() { var x = --eval; }", SyntaxError); | 264 CheckStrictMode("function strict() { var x = --eval; }", SyntaxError); |
265 CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError); | 265 CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError); |
266 | 266 |
267 // Delete of an unqialified identifier | |
268 CheckStrictMode("delete unqualified;", SyntaxError); | |
269 CheckStrictMode("function strict() { delete unqualified; }", SyntaxError); | |
270 CheckStrictMode("function function_name() { delete function_name; }", SyntaxErro r); | |
Mads Ager (chromium)
2011/02/14 09:00:12
Split these lines to keep within 80 char?
Martin Maly
2011/02/14 18:32:12
Done.
| |
271 CheckStrictMode("function strict(parameter) { delete parameter; }", SyntaxError) ; | |
272 CheckStrictMode("function strict() { var variable; delete variable; }", SyntaxEr ror); | |
273 CheckStrictMode("var variable; delete variable;", SyntaxError); | |
274 | |
267 // Prefix unary operators other than delete, ++, -- are valid in strict mode | 275 // Prefix unary operators other than delete, ++, -- are valid in strict mode |
268 (function StrictModeUnaryOperators() { | 276 (function StrictModeUnaryOperators() { |
269 "use strict"; | 277 "use strict"; |
270 var x = [void eval, typeof eval, +eval, -eval, ~eval, !eval]; | 278 var x = [void eval, typeof eval, +eval, -eval, ~eval, !eval]; |
271 var y = [void arguments, typeof arguments, | 279 var y = [void arguments, typeof arguments, |
272 +arguments, -arguments, ~arguments, !arguments]; | 280 +arguments, -arguments, ~arguments, !arguments]; |
273 })(); | 281 })(); |
274 | 282 |
275 // 7.6.1.2 Future Reserved Words | 283 // 7.6.1.2 Future Reserved Words |
276 var future_reserved_words = [ | 284 var future_reserved_words = [ |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 for (var i = 0; i < n; i ++) { f(); } | 375 for (var i = 0; i < n; i ++) { f(); } |
368 } | 376 } |
369 | 377 |
370 repeat(10, function() { testAssignToUndefined(true); }); | 378 repeat(10, function() { testAssignToUndefined(true); }); |
371 possibly_undefined_variable_for_strict_mode_test = "value"; | 379 possibly_undefined_variable_for_strict_mode_test = "value"; |
372 repeat(10, function() { testAssignToUndefined(false); }); | 380 repeat(10, function() { testAssignToUndefined(false); }); |
373 delete possibly_undefined_variable_for_strict_mode_test; | 381 delete possibly_undefined_variable_for_strict_mode_test; |
374 repeat(10, function() { testAssignToUndefined(true); }); | 382 repeat(10, function() { testAssignToUndefined(true); }); |
375 possibly_undefined_variable_for_strict_mode_test = undefined; | 383 possibly_undefined_variable_for_strict_mode_test = undefined; |
376 repeat(10, function() { testAssignToUndefined(false); }); | 384 repeat(10, function() { testAssignToUndefined(false); }); |
OLD | NEW |