| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 assertEquals(correct_answers[correct_answer_index], answer); | 297 assertEquals(correct_answers[correct_answer_index], answer); |
| 298 } catch (e) { | 298 } catch (e) { |
| 299 assertTrue(/prototype/.test(e)); | 299 assertTrue(/prototype/.test(e)); |
| 300 assertEquals(correct_answers[correct_answer_index], except); | 300 assertEquals(correct_answers[correct_answer_index], except); |
| 301 } | 301 } |
| 302 correct_answer_index++; | 302 correct_answer_index++; |
| 303 } | 303 } |
| 304 | 304 |
| 305 | 305 |
| 306 function Test(a, b, c, d, e, f, g, h) { | 306 function Test(a, b, c, d, e, f, g, h) { |
| 307 var Foo = function() { } | 307 var Foo = function() { }; |
| 308 var Bar = function() { } | 308 var Bar = function() { }; |
| 309 | 309 |
| 310 if (c) Foo.prototype = 12; | 310 if (c) Foo.prototype = 12; |
| 311 if (d) Bar.prototype = 13; | 311 if (d) Bar.prototype = 13; |
| 312 var x = a ? new Foo() : new Bar(); | 312 var x = a ? new Foo() : new Bar(); |
| 313 var y = b ? new Foo() : new Bar(); | 313 var y = b ? new Foo() : new Bar(); |
| 314 InstanceTest(x, Foo); | 314 InstanceTest(x, Foo); |
| 315 InstanceTest(y, Foo); | 315 InstanceTest(y, Foo); |
| 316 InstanceTest(x, Bar); | 316 InstanceTest(x, Bar); |
| 317 InstanceTest(y, Bar); | 317 InstanceTest(y, Bar); |
| 318 if (e) x.__proto__ = Bar.prototype; | 318 if (e) x.__proto__ = Bar.prototype; |
| 319 if (f) y.__proto__ = Foo.prototype; | 319 if (f) y.__proto__ = Foo.prototype; |
| 320 if (g) { | 320 if (g) { |
| 321 x.__proto__ = y; | 321 x.__proto__ = y; |
| 322 } else { | 322 } else { |
| 323 if (h) y.__proto__ = x | 323 if (h) y.__proto__ = x; |
| 324 } | 324 } |
| 325 InstanceTest(x, Foo); | 325 InstanceTest(x, Foo); |
| 326 InstanceTest(y, Foo); | 326 InstanceTest(y, Foo); |
| 327 InstanceTest(x, Bar); | 327 InstanceTest(x, Bar); |
| 328 InstanceTest(y, Bar); | 328 InstanceTest(y, Bar); |
| 329 } | 329 } |
| OLD | NEW |