Revision: 11468 Author: [email protected] Date: Mon Apr 30 06:04:08 2012 Log: Fixed preparser for try statement. Tiny cleanup.
BUG=v8:2109 [email protected] Review URL: https://chromiumcodereview.appspot.com/10270007 http://code.google.com/p/v8/source/detail?r=11468 Modified: /branches/bleeding_edge/src/preparser.cc /branches/bleeding_edge/src/preparser.h ======================================= --- /branches/bleeding_edge/src/preparser.cc Mon Mar 12 05:35:28 2012 +++ /branches/bleeding_edge/src/preparser.cc Mon Apr 30 06:04:08 2012 @@ -581,9 +581,8 @@ ParseExpression(true, CHECK_OK); Expect(i::Token::RPAREN, CHECK_OK); - scope_->EnterWith(); + Scope::InsideWith iw(scope_); ParseStatement(CHECK_OK); - scope_->LeaveWith(); return Statement::Default(); } @@ -749,10 +748,9 @@ return Statement::Default(); } Expect(i::Token::RPAREN, CHECK_OK); - scope_->EnterWith(); - ParseBlock(ok); - scope_->LeaveWith(); - if (!*ok) Statement::Default(); + { Scope::InsideWith iw(scope_); + ParseBlock(CHECK_OK); + } catch_or_finally_seen = true; } if (peek() == i::Token::FINALLY) { ======================================= --- /branches/bleeding_edge/src/preparser.h Mon Mar 12 05:35:28 2012 +++ /branches/bleeding_edge/src/preparser.h Mon Apr 30 06:04:08 2012 @@ -470,8 +470,19 @@ void set_language_mode(i::LanguageMode language_mode) { language_mode_ = language_mode; } - void EnterWith() { with_nesting_count_++; } - void LeaveWith() { with_nesting_count_--; } + + class InsideWith { + public: + explicit InsideWith(Scope* scope) : scope_(scope) { + scope->with_nesting_count_++; + } + + ~InsideWith() { scope_->with_nesting_count_--; } + + private: + Scope* scope_; + DISALLOW_COPY_AND_ASSIGN(InsideWith); + }; private: Scope** const variable_; -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
