Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: src/full-codegen/full-codegen.cc

Issue 2488493003: [inspector] fix positions for single expression arrow function (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/ast/ast.h ('K') | « src/ast/ast.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« src/ast/ast.h ('K') | « src/ast/ast.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698