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

Unified Diff: src/parsing/parser-base.h

Issue 2917263002: Move generator-close on exception from the generator function to the GeneratorResume builtin. (Closed)
Patch Set: Add register allocation scope Created 3 years, 6 months 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
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 88c71a8b0450aad01a92d605feaffcab3c4beea7..dde9143df8b0b0feb2f59a700173b166e6ce3807 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -1388,10 +1388,6 @@ class ParserBase {
// Convenience method which determines the type of return statement to emit
// depending on the current function type.
inline StatementT BuildReturnStatement(ExpressionT expr, int pos) {
- if (is_generator() && !is_async_generator()) {
- expr = impl()->BuildIteratorResult(expr, true);
- }
-
if (is_async_function()) {
return factory()->NewAsyncReturnStatement(expr, pos);
}
@@ -2999,12 +2995,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseYieldExpression(
return impl()->RewriteYieldStar(expression, pos);
}
- if (!is_async_generator()) {
- // Async generator yield is rewritten in Ignition, and doesn't require
- // producing an Iterator Result.
- expression = impl()->BuildIteratorResult(expression, false);
- }
-
// Hackily disambiguate o from o.next and o [Symbol.iterator]().
// TODO(verwaest): Come up with a better solution.
ExpressionT yield = BuildSuspend(expression, pos, Suspend::kOnExceptionThrow,
@@ -4091,7 +4081,9 @@ void ParserBase<Impl>::ParseFunctionBody(
{
BlockState block_state(&scope_, inner_scope);
- if (IsGeneratorFunction(kind)) {
+ if (IsAsyncGeneratorFunction(kind)) {
+ impl()->ParseAndRewriteAsyncGeneratorFunctionBody(pos, kind, body, ok);
+ } else if (IsGeneratorFunction(kind)) {
impl()->ParseAndRewriteGeneratorFunctionBody(pos, kind, body, ok);
} else if (IsAsyncFunction(kind)) {
const bool accept_IN = true;
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698