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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 145 } |
146 f5(2, 3, 5); | 146 f5(2, 3, 5); |
147 | 147 |
148 | 148 |
149 function f6(x, y) { | 149 function f6(x, y) { |
150 x = "x"; | 150 x = "x"; |
151 arguments[1] = "y"; | 151 arguments[1] = "y"; |
152 return [arguments.length, arguments[0], y, arguments[2]]; | 152 return [arguments.length, arguments[0], y, arguments[2]]; |
153 } | 153 } |
154 | 154 |
155 assertArrayEquals([0, void 0, void 0, void 0], f6()); | 155 assertArrayEquals([0, "x", "y", void 0], f6()); |
156 assertArrayEquals([1, "x", void 0, void 0], f6(1)); | 156 assertArrayEquals([1, "x", "y", void 0], f6(1)); |
157 assertArrayEquals([2, "x", "y", void 0], f6(9, 17)); | 157 assertArrayEquals([2, "x", "y", void 0], f6(9, 17)); |
158 assertArrayEquals([3, "x", "y", 7], f6(3, 5, 7)); | 158 assertArrayEquals([3, "x", "y", 7], f6(3, 5, 7)); |
159 assertArrayEquals([4, "x", "y", "c"], f6("a", "b", "c", "d")); | 159 assertArrayEquals([4, "x", "y", "c"], f6("a", "b", "c", "d")); |
160 | 160 |
161 | 161 |
162 function list_args(a) { | 162 function list_args(a) { |
163 assertEquals("function", typeof a.callee); | 163 assertEquals("function", typeof a.callee); |
164 var result = []; | 164 var result = []; |
165 result.push(a.length); | 165 result.push(a.length); |
166 for (i = 0; i < a.length; i++) result.push(a[i]); | 166 for (i = 0; i < a.length; i++) result.push(a[i]); |
167 return result; | 167 return result; |
168 } | 168 } |
169 | 169 |
170 | 170 |
171 function f1(x, y) { | 171 function f1(x, y) { |
172 function g(p) { | 172 function g(p) { |
173 x = p; | 173 x = p; |
174 } | 174 } |
175 g(y); | 175 g(y); |
176 return list_args(arguments); | 176 return list_args(arguments); |
177 } | 177 } |
178 | 178 |
179 assertArrayEquals([0], f1()); | 179 assertArrayEquals([0], f1()); |
180 assertArrayEquals([1, void 0], f1(3)); | 180 assertArrayEquals([1, void 0], f1(3)); |
181 assertArrayEquals([2, 5, 5], f1(3, 5)); | 181 assertArrayEquals([2, 5, 5], f1(3, 5)); |
182 assertArrayEquals([3, 5, 5, 7], f1(3, 5, 7)); | 182 assertArrayEquals([3, 5, 5, 7], f1(3, 5, 7)); |
OLD | NEW |