Index: src/parsing/parser.cc |
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
index e3ddc907e49f3385839484660a0332739f91d8f0..31313fd513a796d60bbc15fe39b1ba30831998d1 100644 |
--- a/src/parsing/parser.cc |
+++ b/src/parsing/parser.cc |
@@ -3657,17 +3657,22 @@ ZoneList<Statement*>* Parser::ParseEagerFunctionBody( |
} |
if (function_type == FunctionLiteral::kNamedExpression) { |
- // Now that we know the language mode, we can create the const assignment |
- // in the previously reserved spot. |
- DCHECK_EQ(function_scope, scope()); |
- Variable* fvar = function_scope->DeclareFunctionVar(function_name); |
- VariableProxy* fproxy = factory()->NewVariableProxy(fvar); |
- result->Set(kFunctionNameAssignmentIndex, |
- factory()->NewExpressionStatement( |
- factory()->NewAssignment(Token::INIT, fproxy, |
- factory()->NewThisFunction(pos), |
- kNoSourcePosition), |
- kNoSourcePosition)); |
+ Statement* statement; |
+ if (function_scope->Lookup(function_name) == nullptr) { |
adamk
2016/09/19 18:00:39
Do you mean LookupLocal? Please add a test that wo
|
+ // Now that we know the language mode, we can create the const assignment |
+ // in the previously reserved spot. |
+ DCHECK_EQ(function_scope, scope()); |
+ Variable* fvar = function_scope->DeclareFunctionVar(function_name); |
+ VariableProxy* fproxy = factory()->NewVariableProxy(fvar); |
+ statement = factory()->NewExpressionStatement( |
+ factory()->NewAssignment(Token::INIT, fproxy, |
+ factory()->NewThisFunction(pos), |
+ kNoSourcePosition), |
+ kNoSourcePosition); |
+ } else { |
+ statement = factory()->NewEmptyStatement(0); |
adamk
2016/09/19 18:00:39
Why 0 instead of kNoSourcePosition?
|
+ } |
+ result->Set(kFunctionNameAssignmentIndex, statement); |
} |
MarkCollectedTailCallExpressions(); |