Chromium Code Reviews| Index: src/parsing/parser.cc |
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
| index 8128670128b5512505c3a1c21d017b57f9c059b9..5445887e18eba89b19c4eaa936bd06ae24a64c3c 100644 |
| --- a/src/parsing/parser.cc |
| +++ b/src/parsing/parser.cc |
| @@ -1910,7 +1910,12 @@ Variable* Parser::Declare(Declaration* declaration, |
| var = declaration_scope->DeclareLocal( |
| name, mode, declaration->initialization(), kind, kNotAssigned); |
| } else if ((IsLexicalVariableMode(mode) || |
| - IsLexicalVariableMode(var->mode())) && |
| + IsLexicalVariableMode(var->mode()) || |
| + // At the top level of a Module, function declarations are |
| + // treated like lexical declarations rather than like var |
| + // declarations. |
| + (declaration_scope->is_module_scope() && |
|
adamk
2016/04/04 22:19:54
This code belongs not here, but in Parser::ParseFu
mike3
2016/04/13 21:18:44
Of course, that makes much more sense.
|
| + (is_function_declaration || var->is_function()))) && |
| // Lexical bindings may appear for some parameters in sloppy |
| // mode even with --harmony-sloppy off. |
| (is_strict(language_mode()) || allow_harmony_sloppy())) { |