Reviewers: adamk,

Description:
Function declarations scope normally with --harmony_sloppy

In an initial attempt to implement sloppy mode lexical bindings,
functions were made lexically scoped in sloppy mode. However, the
ES2015 spec says that they need an additional hoisted var binding,
and further, it's not clear when we'll implement that behavior
or whether it's web-compatible. This patch removes the lexically
scoped function binding behavior from --harmony_sloppy and leaves
sloppy mode with the old var-scoped interpretation.

BUG=v8:4285
R=adamk
LOG=N

Please review this at https://codereview.chromium.org/1282093002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+2, -2 lines):
  M src/parser.cc


Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 45202cb3a82b922c7d487061cfff03578cc3a3c9..693149523ecf4234c24510754700228fcfbaecd7 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -2222,8 +2222,8 @@ Statement* Parser::ParseFunctionDeclaration(
   VariableMode mode =
       is_strong(language_mode())
           ? CONST
-          : (is_strict(language_mode()) || allow_harmony_sloppy()) &&
-              !scope_->is_declaration_scope() ? LET : VAR;
+ : is_strict(language_mode()) && !scope_->is_declaration_scope() ? LET + : VAR;
   VariableProxy* proxy = NewUnresolved(name, mode);
   Declaration* declaration =
       factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to