Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index 3bfc94fbd1ac9392d0e2f42726cc5cf4b13882ab..b7b5798acfb1ceccd4eb8755b98a98f51ae1e86f 100644 |
--- a/src/parser.cc |
+++ b/src/parser.cc |
@@ -3641,7 +3641,12 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name, |
} |
int num_parameters = 0; |
- Scope* scope = NewScope(top_scope_, Scope::FUNCTION_SCOPE, inside_with()); |
+ Scope* outer_scope = top_scope_; |
+ if (type == DECLARATION) { |
+ // Function declarations are hoisted. |
+ outer_scope = outer_scope->DeclarationScope(); |
rossberg
2011/08/02 14:54:05
Why not write it functionally?
Kevin Millikin (Chromium)
2011/08/02 14:56:33
No great reason. I wanted to write the comment ex
|
+ } |
+ Scope* scope = NewScope(outer_scope, Scope::FUNCTION_SCOPE, inside_with()); |
ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(8); |
int materialized_literal_count; |
int expected_property_count; |