| Index: runtime/vm/kernel_to_il.cc
|
| diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc
|
| index d12987fae7982f10fa0cbd485b18b8f52d3299b7..942a70f5e26ad0f46503d782cda6fcf3f37cdfd8 100644
|
| --- a/runtime/vm/kernel_to_il.cc
|
| +++ b/runtime/vm/kernel_to_il.cc
|
| @@ -6056,12 +6056,11 @@ void FlowGraphBuilder::VisitYieldStatement(YieldStatement* node) {
|
|
|
| Fragment continuation(instructions.entry, anchor);
|
|
|
| - // TODO(27590): we need a better way to detect if we need to check for an
|
| - // exception after yield or not.
|
| - if (parsed_function_->function().NumOptionalPositionalParameters() == 3) {
|
| - // If function takes three parameters then the second and the third
|
| - // are exception and stack_trace. Check if exception is non-null
|
| - // and rethrow it.
|
| + if (parsed_function_->function().IsAsyncClosure() ||
|
| + parsed_function_->function().IsAsyncGenClosure()) {
|
| + // If function is async closure or async gen closure it takes three
|
| + // parameters where the second and the third are exception and stack_trace.
|
| + // Check if exception is non-null and rethrow it.
|
| //
|
| // :async_op([:result, :exception, :stack_trace]) {
|
| // ...
|
| @@ -6132,7 +6131,26 @@ Fragment FlowGraphBuilder::TranslateFunctionNode(FunctionNode* node,
|
| // NOTE: This is not TokenPosition in the general sense!
|
| function = Function::NewClosureFunction(
|
| *name, parsed_function_->function(), position);
|
| - function.set_is_debuggable(node->debuggable());
|
| +
|
| + function.set_is_debuggable(node->dart_async_marker() ==
|
| + FunctionNode::kSync);
|
| + switch (node->dart_async_marker()) {
|
| + case FunctionNode::kSyncStar:
|
| + function.set_modifier(RawFunction::kSyncGen);
|
| + break;
|
| + case FunctionNode::kAsync:
|
| + function.set_modifier(RawFunction::kAsync);
|
| + break;
|
| + case FunctionNode::kAsyncStar:
|
| + function.set_modifier(RawFunction::kAsyncGen);
|
| + break;
|
| + default:
|
| + // no special modifier
|
| + break;
|
| + }
|
| + function.set_is_generated_body(node->async_marker() ==
|
| + FunctionNode::kSyncYielding);
|
| +
|
| function.set_end_token_pos(node->end_position());
|
| LocalScope* scope = scopes_->function_scopes[i].scope;
|
| const ContextScope& context_scope =
|
|
|