Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index 3bfc94fbd1ac9392d0e2f42726cc5cf4b13882ab..923faa0b82bee2dc0c894b124fc6894cc7a577e4 100644 |
--- a/src/parser.cc |
+++ b/src/parser.cc |
@@ -3641,7 +3641,10 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name, |
} |
int num_parameters = 0; |
- Scope* scope = NewScope(top_scope_, Scope::FUNCTION_SCOPE, inside_with()); |
+ // Function declarations are hoisted. |
+ Scope* scope = (type == DECLARATION) |
+ ? NewScope(top_scope_->DeclarationScope(), Scope::FUNCTION_SCOPE, false) |
+ : NewScope(top_scope_, Scope::FUNCTION_SCOPE, inside_with()); |
ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(8); |
int materialized_literal_count; |
int expected_property_count; |