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

Unified Diff: runtime/vm/kernel_to_il.cc

Issue 2697193008: [Kernel] replace function debuggable field with originalAsyncMarker field (Closed)
Patch Set: ASSERT in kernel_reader Created 3 years, 10 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 | « runtime/vm/kernel_reader.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 =
« no previous file with comments | « runtime/vm/kernel_reader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698