| 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 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // Tests to verify proper arguments handling if the arguments | 28 // Tests to verify proper arguments handling if the arguments |
| 29 // variable is declared as a parameter or local variable. | 29 // variable is declared as a parameter or local variable. |
| 30 | 30 |
| 31 function e(a) { | 31 function e(a) { |
| 32 assertEquals(9, a.length); | 32 assertEquals(9, a.length); |
| 33 assertEquals("arguments", a); | 33 assertEquals("arguments", a); |
| 34 }; | 34 } |
| 35 | 35 |
| 36 e("arguments"); | 36 e("arguments"); |
| 37 | 37 |
| 38 | 38 |
| 39 function f(arguments) { | 39 function f(arguments) { |
| 40 assertEquals(9, arguments.length); | 40 assertEquals(9, arguments.length); |
| 41 assertEquals("arguments", arguments); | 41 assertEquals("arguments", arguments); |
| 42 }; | 42 } |
| 43 | 43 |
| 44 f("arguments"); | 44 f("arguments"); |
| 45 | 45 |
| 46 | 46 |
| 47 function g(x) { | 47 function g(x) { |
| 48 var arguments; | 48 var arguments; |
| 49 assertEquals("arguments", x); | 49 assertEquals("arguments", x); |
| 50 assertEquals(1, arguments.length); | 50 assertEquals(1, arguments.length); |
| 51 assertEquals("[object Arguments]", '' + arguments); | 51 assertEquals("[object Arguments]", '' + arguments); |
| 52 }; | 52 } |
| 53 | 53 |
| 54 g("arguments"); | 54 g("arguments"); |
| 55 | 55 |
| 56 | 56 |
| 57 function h(x) { | 57 function h(x) { |
| 58 assertEquals("arguments", x); | 58 assertEquals("arguments", x); |
| 59 assertEquals(1, arguments.length); | 59 assertEquals(1, arguments.length); |
| 60 assertEquals("[object Arguments]", '' + arguments); | 60 assertEquals("[object Arguments]", '' + arguments); |
| 61 var arguments = "foobar"; | 61 var arguments = "foobar"; |
| 62 assertEquals("arguments", x); | 62 assertEquals("arguments", x); |
| 63 assertEquals(6, arguments.length); | 63 assertEquals(6, arguments.length); |
| 64 assertEquals("foobar", '' + arguments); | 64 assertEquals("foobar", '' + arguments); |
| 65 }; | 65 } |
| 66 | 66 |
| 67 h("arguments"); | 67 h("arguments"); |
| OLD | NEW |