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

Side by Side Diff: pkg/kernel/lib/transformations/continuation.dart

Issue 2690873005: Enable causal stacktrace in kernel (Closed)
Patch Set: Addressed comments 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/kernel_to_il.cc » ('j') | runtime/vm/kernel_to_il.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library kernel.transformations.continuation; 5 library kernel.transformations.continuation;
6 6
7 import 'dart:math' as math; 7 import 'dart:math' as math;
8 8
9 import '../ast.dart'; 9 import '../ast.dart';
10 import '../core_types.dart'; 10 import '../core_types.dart';
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 191 }
192 } 192 }
193 193
194 abstract class AsyncRewriterBase extends ContinuationRewriterBase { 194 abstract class AsyncRewriterBase extends ContinuationRewriterBase {
195 final VariableDeclaration nestedClosureVariable = 195 final VariableDeclaration nestedClosureVariable =
196 new VariableDeclaration(":async_op"); 196 new VariableDeclaration(":async_op");
197 final VariableDeclaration thenContinuationVariable = 197 final VariableDeclaration thenContinuationVariable =
198 new VariableDeclaration(":async_op_then"); 198 new VariableDeclaration(":async_op_then");
199 final VariableDeclaration catchErrorContinuationVariable = 199 final VariableDeclaration catchErrorContinuationVariable =
200 new VariableDeclaration(":async_op_error"); 200 new VariableDeclaration(":async_op_error");
201 final VariableDeclaration asyncStackTrace =
202 new VariableDeclaration(":async_stack_trace");
201 203
202 LabeledStatement labeledBody; 204 LabeledStatement labeledBody;
203 205
204 ExpressionLifter expressionRewriter; 206 ExpressionLifter expressionRewriter;
205 207
206 AsyncRewriterBase(helper, enclosingFunction) 208 AsyncRewriterBase(helper, enclosingFunction)
207 : super(helper, enclosingFunction) {} 209 : super(helper, enclosingFunction) {}
208 210
209 void setupAsyncContinuations(List<Statement> statements) { 211 void setupAsyncContinuations(List<Statement> statements) {
210 expressionRewriter = new ExpressionLifter(this); 212 expressionRewriter = new ExpressionLifter(this);
211 213
212 // var :async_op_then; 214 // var :async_op_then;
213 statements.add(thenContinuationVariable); 215 statements.add(thenContinuationVariable);
214 216
215 // var :async_op_error; 217 // var :async_op_error;
216 statements.add(catchErrorContinuationVariable); 218 statements.add(catchErrorContinuationVariable);
217 219
220 // var :async_stack_trace;
221 statements.add(asyncStackTrace);
222
218 // :async_op([:result, :exception, :stack_trace]) { 223 // :async_op([:result, :exception, :stack_trace]) {
219 // modified <node.body>; 224 // modified <node.body>;
220 // } 225 // }
221 final parameters = <VariableDeclaration>[ 226 final parameters = <VariableDeclaration>[
222 expressionRewriter.asyncResult, 227 expressionRewriter.asyncResult,
223 new VariableDeclaration(':exception'), 228 new VariableDeclaration(':exception'),
224 new VariableDeclaration(':stack_trace'), 229 new VariableDeclaration(':stack_trace'),
225 ]; 230 ];
226 final function = new FunctionNode(buildWrappedBody(), 231 final function = new FunctionNode(buildWrappedBody(),
227 positionalParameters: parameters, 232 positionalParameters: parameters,
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 findConstructor(syncIterableClass, ''), 974 findConstructor(syncIterableClass, ''),
970 findConstructor(streamIteratorClass, ''), 975 findConstructor(streamIteratorClass, ''),
971 findFactoryConstructor(futureClass, 'microtask'), 976 findFactoryConstructor(futureClass, 'microtask'),
972 findConstructor(streamControllerClass, ''), 977 findConstructor(streamControllerClass, ''),
973 findProcedure(asyncLibrary, '_asyncThenWrapperHelper'), 978 findProcedure(asyncLibrary, '_asyncThenWrapperHelper'),
974 findProcedure(asyncLibrary, '_asyncErrorWrapperHelper'), 979 findProcedure(asyncLibrary, '_asyncErrorWrapperHelper'),
975 findProcedure(asyncLibrary, '_awaitHelper'), 980 findProcedure(asyncLibrary, '_awaitHelper'),
976 new CoreTypes(program)); 981 new CoreTypes(program));
977 } 982 }
978 } 983 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/kernel_to_il.cc » ('j') | runtime/vm/kernel_to_il.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698