Index: src/parsing/parser.cc |
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
index 8310ad948c543de2cfa10689062e10e1a1106496..fa4d7231d4e020b1d561475061f542e5ec2a5a6e 100644 |
--- a/src/parsing/parser.cc |
+++ b/src/parsing/parser.cc |
@@ -2092,7 +2092,9 @@ Statement* Parser::ParseFunctionDeclaration( |
// initial value upon entering the corresponding scope. |
// In ES6, a function behaves as a lexical binding, except in |
// a script scope, or the initial scope of eval or another function. |
- VariableMode mode = !scope_->is_declaration_scope() ? LET : VAR; |
+ VariableMode mode = |
+ (!scope_->is_declaration_scope() || scope_->is_module_scope()) ? LET |
+ : VAR; |
VariableProxy* proxy = NewUnresolved(name, mode); |
Declaration* declaration = |
factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos); |