Index: src/parsing/preparser.cc |
diff --git a/src/parsing/preparser.cc b/src/parsing/preparser.cc |
index 7f859d2bbe8cc741a734600041d11f8f47a3e0c1..1dae5e9b6658e85b1681f984c5fd4f0c6b7e02b1 100644 |
--- a/src/parsing/preparser.cc |
+++ b/src/parsing/preparser.cc |
@@ -144,6 +144,10 @@ PreParser::PreParseResult PreParser::PreParseFunction( |
LazyParsingResult result = ParseStatementListAndLogFunction( |
&formals, has_duplicate_parameters, may_abort, ok); |
+ if (is_sloppy(function_scope->language_mode())) { |
+ function_scope->HoistSloppyBlockFunctions(nullptr); |
+ } |
+ |
use_counts_ = nullptr; |
track_unresolved_variables_ = false; |
@@ -232,6 +236,10 @@ PreParser::Expression PreParser::ParseFunctionLiteral( |
// Parsing the body may change the language mode in our scope. |
language_mode = function_scope->language_mode(); |
+ if (is_sloppy(language_mode)) { |
+ function_scope->HoistSloppyBlockFunctions(nullptr); |
+ } |
+ |
// Validate name and parameter names. We can do this only after parsing the |
// function, since the function can declare itself strict. |
CheckFunctionName(language_mode, function_name, function_name_validity, |