OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
463 bool IsInsideWith() { return with_nesting_count_ != 0; } | 463 bool IsInsideWith() { return with_nesting_count_ != 0; } |
464 bool is_classic_mode() { | 464 bool is_classic_mode() { |
465 return language_mode_ == i::CLASSIC_MODE; | 465 return language_mode_ == i::CLASSIC_MODE; |
466 } | 466 } |
467 i::LanguageMode language_mode() { | 467 i::LanguageMode language_mode() { |
468 return language_mode_; | 468 return language_mode_; |
469 } | 469 } |
470 void set_language_mode(i::LanguageMode language_mode) { | 470 void set_language_mode(i::LanguageMode language_mode) { |
471 language_mode_ = language_mode; | 471 language_mode_ = language_mode; |
472 } | 472 } |
473 void EnterWith() { with_nesting_count_++; } | 473 |
474 void LeaveWith() { with_nesting_count_--; } | 474 class WithinWith { |
Jakob Kummerow
2012/04/30 12:52:32
nit: not sure I like the name... how about InsideW
Sven Panne
2012/04/30 13:02:32
Done.
| |
475 public: | |
476 explicit WithinWith(Scope* scope): scope_(scope) { | |
Jakob Kummerow
2012/04/30 12:52:32
nit: space before ':'
Sven Panne
2012/04/30 13:02:32
Done.
| |
477 scope->with_nesting_count_++; | |
478 } | |
479 | |
480 ~WithinWith() { scope_->with_nesting_count_--; } | |
481 | |
482 private: | |
483 Scope* scope_; | |
484 DISALLOW_COPY_AND_ASSIGN(WithinWith); | |
485 }; | |
475 | 486 |
476 private: | 487 private: |
477 Scope** const variable_; | 488 Scope** const variable_; |
478 Scope* const prev_; | 489 Scope* const prev_; |
479 const ScopeType type_; | 490 const ScopeType type_; |
480 int materialized_literal_count_; | 491 int materialized_literal_count_; |
481 int expected_properties_; | 492 int expected_properties_; |
482 int with_nesting_count_; | 493 int with_nesting_count_; |
483 i::LanguageMode language_mode_; | 494 i::LanguageMode language_mode_; |
484 }; | 495 }; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
652 bool stack_overflow_; | 663 bool stack_overflow_; |
653 bool allow_lazy_; | 664 bool allow_lazy_; |
654 bool allow_modules_; | 665 bool allow_modules_; |
655 bool allow_natives_syntax_; | 666 bool allow_natives_syntax_; |
656 bool parenthesized_function_; | 667 bool parenthesized_function_; |
657 bool harmony_scoping_; | 668 bool harmony_scoping_; |
658 }; | 669 }; |
659 } } // v8::preparser | 670 } } // v8::preparser |
660 | 671 |
661 #endif // V8_PREPARSER_H | 672 #endif // V8_PREPARSER_H |
OLD | NEW |