Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index 30d6f222de3dfd8fc2c88755558ba880f7d59d3d..d685b8a34453d4e470f5df9737e0d456b5f19fe3 100644 |
--- a/src/parser.cc |
+++ b/src/parser.cc |
@@ -30,7 +30,6 @@ |
#include "api.h" |
#include "ast-inl.h" |
#include "bootstrapper.h" |
-#include "char-predicates-inl.h" |
#include "codegen.h" |
#include "compiler.h" |
#include "func-name-inferrer.h" |
@@ -1560,6 +1559,9 @@ Block* Parser::ParseScopedBlock(ZoneStringList* labels, bool* ok) { |
Scope* block_scope = NewScope(top_scope_, |
Scope::BLOCK_SCOPE, |
inside_with()); |
+ body->set_block_scope(block_scope); |
+ block_scope->DeclareLocal(isolate()->factory()->block_scope_symbol(), |
+ Variable::VAR); |
if (top_scope_->is_strict_mode()) { |
block_scope->EnableStrictMode(); |
} |
@@ -1582,28 +1584,21 @@ Block* Parser::ParseScopedBlock(ZoneStringList* labels, bool* ok) { |
} |
} |
Expect(Token::RBRACE, CHECK_OK); |
- top_scope_ = saved_scope; |
- block_scope = block_scope->FinalizeBlockScope(); |
- body->set_block_scope(block_scope); |
+ // Create exit block. |
+ Block* exit = new(zone()) Block(isolate(), NULL, 1, false); |
+ exit->AddStatement(new(zone()) ExitContextStatement()); |
- if (block_scope != NULL) { |
- // Create exit block. |
- Block* exit = new(zone()) Block(isolate(), NULL, 1, false); |
- exit->AddStatement(new(zone()) ExitContextStatement()); |
- |
- // Create a try-finally statement. |
- TryFinallyStatement* try_finally = |
- new(zone()) TryFinallyStatement(body, exit); |
- try_finally->set_escaping_targets(collector.targets()); |
+ // Create a try-finally statement. |
+ TryFinallyStatement* try_finally = |
+ new(zone()) TryFinallyStatement(body, exit); |
+ try_finally->set_escaping_targets(collector.targets()); |
+ top_scope_ = saved_scope; |
- // Create a result block. |
- Block* result = new(zone()) Block(isolate(), NULL, 1, false); |
- result->AddStatement(try_finally); |
- return result; |
- } else { |
- return body; |
- } |
+ // Create a result block. |
+ Block* result = new(zone()) Block(isolate(), NULL, 1, false); |
+ result->AddStatement(try_finally); |
+ return result; |
} |