Chromium Code Reviews| Index: src/preparser.h |
| diff --git a/src/preparser.h b/src/preparser.h |
| index a5aa3709a6d509174fe9c02530b80cd940c907ab..2b07de94c47037d58c1f1a0652f96a75fe2d2677 100644 |
| --- a/src/preparser.h |
| +++ b/src/preparser.h |
| @@ -1083,6 +1083,7 @@ class PreParserExpression { |
| // More dummy implementations of things PreParser doesn't need to track: |
| void set_index(int index) {} // For YieldExpressions |
| void set_should_eager_compile() {} |
| + FunctionKind kind() const { return FunctionKind::kNormalFunction; } |
| int position() const { return RelocInfo::kNoPosition; } |
| void set_function_token_position(int position) {} |
| @@ -3279,8 +3280,12 @@ ParserBase<Traits>::ParseLeftHandSideExpression( |
| pos = peek_position(); |
| // Also the trailing parenthesis are a hint that the function will |
| // be called immediately. If we happen to have parsed a preceding |
| - // function literal eagerly, we can also compile it eagerly. |
| - if (result->IsFunctionLiteral() && mode() == PARSE_EAGERLY) { |
| + // function literal eagerly, we can also compile it eagerly (unless |
| + // that literal was an arrow function, in which case we always |
| + // compile lazily in order to get scoping right for its parameters, |
| + // see https://code.google.com/p/v8/issues/detail?id=4395). |
| + if (result->IsFunctionLiteral() && mode() == PARSE_EAGERLY && |
| + !IsArrowFunction(result->AsFunctionLiteral()->kind())) { |
|
caitp (gmail)
2015/09/19 21:34:36
The only time you _need_ to force re-parsing of ar
rossberg
2015/09/22 15:33:05
That's a good point. It might make sense to avoid
|
| result->AsFunctionLiteral()->set_should_eager_compile(); |
| } |
| } |