Index: src/full-codegen/full-codegen.cc |
diff --git a/src/full-codegen/full-codegen.cc b/src/full-codegen/full-codegen.cc |
index cd32c4db21df55080243eae3d419a9436fb8c5f6..86e10359c6c7d7ba050ca1bbb71c56d0db561f11 100644 |
--- a/src/full-codegen/full-codegen.cc |
+++ b/src/full-codegen/full-codegen.cc |
@@ -682,7 +682,11 @@ void FullCodeGenerator::SetFunctionPosition(FunctionLiteral* fun) { |
void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) { |
dgozman
2016/11/08 01:37:13
Do we have similar problem in other code generatio
Yang
2016/11/08 12:23:33
Yes, we need this logic in BytecodeArrayBuilder::B
kozy
2016/11/08 16:28:45
Done.
|
// For default constructors, start position equals end position, and there |
// is no source code besides the class literal. |
- int pos = std::max(fun->start_position(), fun->end_position() - 1); |
+ bool doesnt_contain_close_brace = |
+ IsArrowFunction(fun->kind()) && fun->HasSingleReturnBody(); |
+ int pos = |
+ std::max(fun->start_position(), |
+ fun->end_position() - (doesnt_contain_close_brace ? 0 : 1)); |
RecordStatementPosition(pos); |
if (info_->is_debug()) { |
// Always emit a debug break slot before a return. |