Index: pkg/kernel/lib/transformations/continuation.dart |
diff --git a/pkg/kernel/lib/transformations/continuation.dart b/pkg/kernel/lib/transformations/continuation.dart |
index 632731756d68c6aaebf3d8dd38724047df8416e9..cce8f561545bc3868f5151863a16786620517ac9 100644 |
--- a/pkg/kernel/lib/transformations/continuation.dart |
+++ b/pkg/kernel/lib/transformations/continuation.dart |
@@ -215,6 +215,8 @@ class SyncStarFunctionRewriter extends ContinuationRewriterBase { |
abstract class AsyncRewriterBase extends ContinuationRewriterBase { |
final VariableDeclaration nestedClosureVariable = |
new VariableDeclaration(":async_op"); |
+ final VariableDeclaration stackTraceVariable = |
+ new VariableDeclaration(":async_stack_trace"); |
final VariableDeclaration thenContinuationVariable = |
new VariableDeclaration(":async_op_then"); |
final VariableDeclaration catchErrorContinuationVariable = |
@@ -230,6 +232,9 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase { |
void setupAsyncContinuations(List<Statement> statements) { |
expressionRewriter = new ExpressionLifter(this); |
+ // var :async_stack_trace; |
+ statements.add(stackTraceVariable); |
+ |
// var :async_op_then; |
statements.add(thenContinuationVariable); |
@@ -269,6 +274,13 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase { |
..fileOffset = enclosingFunction.parent.fileOffset; |
statements.add(closureFunction); |
+ // :async_stack_trace = _asyncStackTraceHelper(asyncBody); |
+ final stackTrace = new StaticInvocation(helper.asyncStackTraceHelper, |
+ new Arguments(<Expression>[new VariableGet(nestedClosureVariable)])); |
+ final stackTraceAssign = new ExpressionStatement( |
+ new VariableSet(stackTraceVariable, stackTrace)); |
+ statements.add(stackTraceAssign); |
+ |
// :async_op_then = _asyncThenWrapperHelper(asyncBody); |
final boundThenClosure = new StaticInvocation(helper.asyncThenWrapper, |
new Arguments(<Expression>[new VariableGet(nestedClosureVariable)])); |
@@ -905,6 +917,7 @@ class HelperNodes { |
final Constructor streamControllerConstructor; |
final Constructor syncIterableConstructor; |
final Constructor streamIteratorConstructor; |
+ final Procedure asyncStackTraceHelper; |
final Procedure asyncThenWrapper; |
final Procedure asyncErrorWrapper; |
final Procedure awaitHelper; |
@@ -923,6 +936,7 @@ class HelperNodes { |
this.streamIteratorConstructor, |
this.futureMicrotaskConstructor, |
this.streamControllerConstructor, |
+ this.asyncStackTraceHelper, |
this.asyncThenWrapper, |
this.asyncErrorWrapper, |
this.awaitHelper, |
@@ -942,6 +956,7 @@ class HelperNodes { |
coreTypes.streamIteratorDefaultConstructor, |
coreTypes.futureMicrotaskConstructor, |
coreTypes.asyncStarStreamControllerDefaultConstructor, |
+ coreTypes.asyncStackTraceHelperProcedure, |
coreTypes.asyncThenWrapperHelperProcedure, |
coreTypes.asyncErrorWrapperHelperProcedure, |
coreTypes.awaitHelperProcedure, |