diff options
Diffstat (limited to 'deps/v8/src/ast/source-range-ast-visitor.cc')
-rw-r--r-- | deps/v8/src/ast/source-range-ast-visitor.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/deps/v8/src/ast/source-range-ast-visitor.cc b/deps/v8/src/ast/source-range-ast-visitor.cc index ee2c4f58743..52359d54525 100644 --- a/deps/v8/src/ast/source-range-ast-visitor.cc +++ b/deps/v8/src/ast/source-range-ast-visitor.cc @@ -99,13 +99,11 @@ void SourceRangeAstVisitor::MaybeRemoveLastContinuationRange( } namespace { -Statement* FindLastNonSyntheticStatement(ZonePtrList<Statement>* statements) { +Statement* FindLastNonSyntheticReturn(ZonePtrList<Statement>* statements) { for (int i = statements->length() - 1; i >= 0; --i) { Statement* stmt = statements->at(i); - if (stmt->IsReturnStatement() && - stmt->AsReturnStatement()->is_synthetic_async_return()) { - continue; - } + if (!stmt->IsReturnStatement()) break; + if (stmt->AsReturnStatement()->is_synthetic_async_return()) continue; return stmt; } return nullptr; @@ -116,11 +114,11 @@ void SourceRangeAstVisitor::MaybeRemoveContinuationRangeOfAsyncReturn( TryCatchStatement* try_catch_stmt) { // Detect try-catch inserted by NewTryCatchStatementForAsyncAwait in the // parser (issued for async functions, including async generators), and - // remove the continuation range of the last statement, such that the - // range of the enclosing function body is used. + // remove the continuation ranges of return statements corresponding to + // returns at function end in the untransformed source. if (try_catch_stmt->is_try_catch_for_async()) { Statement* last_non_synthetic = - FindLastNonSyntheticStatement(try_catch_stmt->try_block()->statements()); + FindLastNonSyntheticReturn(try_catch_stmt->try_block()->statements()); if (last_non_synthetic) { MaybeRemoveContinuationRange(last_non_synthetic); } |