OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 491 |
492 | 492 |
493 TEST(Reappearing) { | 493 TEST(Reappearing) { |
494 HandleScope scope; | 494 HandleScope scope; |
495 | 495 |
496 { ReappearingPropertyContext context; | 496 { ReappearingPropertyContext context; |
497 context.Check("const x; var x = 0", | 497 context.Check("const x; var x = 0", |
498 0, | 498 0, |
499 2, // var declaration + const initialization | 499 2, // var declaration + const initialization |
500 4, // 2 x declaration + 2 x initialization | 500 4, // 2 x declaration + 2 x initialization |
501 EXPECT_RESULT, Undefined()); // x = 0 fails for a const. | 501 EXPECT_EXCEPTION); // x has already been declared! |
502 } | 502 } |
503 } | 503 } |
504 | 504 |
505 | 505 |
506 | 506 |
507 class ExistsInPrototypeContext: public DeclarationContext { | 507 class ExistsInPrototypeContext: public DeclarationContext { |
508 protected: | 508 protected: |
509 virtual v8::Handle<Integer> Query(Local<String> key) { | 509 virtual v8::Handle<Integer> Query(Local<String> key) { |
510 // Let it seem that the property exists in the prototype object. | 510 // Let it seem that the property exists in the prototype object. |
511 return Integer::New(v8::None); | 511 return Integer::New(v8::None); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 HandleScope scope; | 584 HandleScope scope; |
585 | 585 |
586 { AbsentInPrototypeContext context; | 586 { AbsentInPrototypeContext context; |
587 context.Check("if (false) { var x = 0; }; x", | 587 context.Check("if (false) { var x = 0; }; x", |
588 0, | 588 0, |
589 0, | 589 0, |
590 1, // declaration | 590 1, // declaration |
591 EXPECT_RESULT, Undefined()); | 591 EXPECT_RESULT, Undefined()); |
592 } | 592 } |
593 } | 593 } |
OLD | NEW |