| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 CheckStrictMode("delete unqualified;", SyntaxError); | 284 CheckStrictMode("delete unqualified;", SyntaxError); |
| 285 CheckStrictMode("function strict() { delete unqualified; }", SyntaxError); | 285 CheckStrictMode("function strict() { delete unqualified; }", SyntaxError); |
| 286 CheckStrictMode("function function_name() { delete function_name; }", | 286 CheckStrictMode("function function_name() { delete function_name; }", |
| 287 SyntaxError); | 287 SyntaxError); |
| 288 CheckStrictMode("function strict(parameter) { delete parameter; }", | 288 CheckStrictMode("function strict(parameter) { delete parameter; }", |
| 289 SyntaxError); | 289 SyntaxError); |
| 290 CheckStrictMode("function strict() { var variable; delete variable; }", | 290 CheckStrictMode("function strict() { var variable; delete variable; }", |
| 291 SyntaxError); | 291 SyntaxError); |
| 292 CheckStrictMode("var variable; delete variable;", SyntaxError); | 292 CheckStrictMode("var variable; delete variable;", SyntaxError); |
| 293 | 293 |
| 294 (function TestStrictDelete() { |
| 295 "use strict"; |
| 296 // "delete this" is allowed in strict mode and should work. |
| 297 function strict_delete() { delete this; } |
| 298 strict_delete(); |
| 299 })(); |
| 300 |
| 294 // Prefix unary operators other than delete, ++, -- are valid in strict mode | 301 // Prefix unary operators other than delete, ++, -- are valid in strict mode |
| 295 (function StrictModeUnaryOperators() { | 302 (function StrictModeUnaryOperators() { |
| 296 "use strict"; | 303 "use strict"; |
| 297 var x = [void eval, typeof eval, +eval, -eval, ~eval, !eval]; | 304 var x = [void eval, typeof eval, +eval, -eval, ~eval, !eval]; |
| 298 var y = [void arguments, typeof arguments, | 305 var y = [void arguments, typeof arguments, |
| 299 +arguments, -arguments, ~arguments, !arguments]; | 306 +arguments, -arguments, ~arguments, !arguments]; |
| 300 })(); | 307 })(); |
| 301 | 308 |
| 302 // 7.6.1.2 Future Reserved Words | 309 // 7.6.1.2 Future Reserved Words |
| 303 var future_reserved_words = [ | 310 var future_reserved_words = [ |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 assertEquals(typeof strict.call("Hello"), "string"); | 478 assertEquals(typeof strict.call("Hello"), "string"); |
| 472 assertTrue(strict.call(object) === object); | 479 assertTrue(strict.call(object) === object); |
| 473 | 480 |
| 474 // Strict apply. | 481 // Strict apply. |
| 475 assertTrue(strict.apply(null) === null); | 482 assertTrue(strict.apply(null) === null); |
| 476 assertTrue(strict.apply(undefined) === undefined); | 483 assertTrue(strict.apply(undefined) === undefined); |
| 477 assertEquals(typeof strict.apply(7), "number"); | 484 assertEquals(typeof strict.apply(7), "number"); |
| 478 assertEquals(typeof strict.apply("Hello"), "string"); | 485 assertEquals(typeof strict.apply("Hello"), "string"); |
| 479 assertTrue(strict.apply(object) === object); | 486 assertTrue(strict.apply(object) === object); |
| 480 })(); | 487 })(); |
| OLD | NEW |