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

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

Issue 2614663007: Revert "Non-format-changing kernel offset changes" (Closed)
Patch Set: Created 3 years, 11 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 | « pkg/kernel/lib/text/ast_to_text.dart ('k') | pkg/kernel/lib/transformations/continuation.dart » ('j') | no next file with comments »
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.async; 5 library kernel.transformations.async;
6 6
7 import '../kernel.dart'; 7 import '../kernel.dart';
8 import 'continuation.dart'; 8 import 'continuation.dart';
9 9
10 /// A transformer that introduces temporary variables for all subexpressions 10 /// A transformer that introduces temporary variables for all subexpressions
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 ++nameIndex; 402 ++nameIndex;
403 seenAwait = seenAwait || thenAwait || otherwiseAwait; 403 seenAwait = seenAwait || thenAwait || otherwiseAwait;
404 return new VariableGet(result); 404 return new VariableGet(result);
405 } 405 }
406 406
407 // Others. 407 // Others.
408 TreeNode visitAwaitExpression(AwaitExpression expr) { 408 TreeNode visitAwaitExpression(AwaitExpression expr) {
409 final R = continuationRewriter; 409 final R = continuationRewriter;
410 var shouldName = seenAwait; 410 var shouldName = seenAwait;
411 var result = new VariableGet(asyncResult); 411 var result = new VariableGet(asyncResult);
412
413 // The statements are in reverse order, so name the result first if 412 // The statements are in reverse order, so name the result first if
414 // necessary and then add the two other statements in reverse. 413 // necessary and then add the two other statements in reverse.
415 if (shouldName) result = name(result); 414 if (shouldName) result = name(result);
416 statements.add(R.createContinuationPoint()..fileOffset = expr.fileOffset); 415 statements.add(R.createContinuationPoint());
417 Arguments arguments = new Arguments(<Expression>[ 416 Arguments arguments = new Arguments(<Expression>[
418 expr.operand, 417 expr.operand,
419 new VariableGet(R.thenContinuationVariable), 418 new VariableGet(R.thenContinuationVariable),
420 new VariableGet(R.catchErrorContinuationVariable) 419 new VariableGet(R.catchErrorContinuationVariable)
421 ]); 420 ]);
422 statements.add(new ExpressionStatement( 421 statements.add(new ExpressionStatement(
423 new StaticInvocation(R.helper.awaitHelper, arguments) 422 new StaticInvocation(R.helper.awaitHelper, arguments)));
424 ..fileOffset = expr.fileOffset));
425 423
426 seenAwait = false; 424 seenAwait = false;
427 var index = nameIndex; 425 var index = nameIndex;
428 arguments.positional[0] = expr.operand.accept(this)..parent = arguments; 426 arguments.positional[0] = expr.operand.accept(this)..parent = arguments;
429 427
430 if (shouldName) nameIndex = index + 1; 428 if (shouldName) nameIndex = index + 1;
431 seenAwait = true; 429 seenAwait = true;
432 return result; 430 return result;
433 } 431 }
434 432
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 }); 479 });
482 } 480 }
483 } 481 }
484 482
485 visitFunctionNode(FunctionNode node) { 483 visitFunctionNode(FunctionNode node) {
486 var nestedRewriter = 484 var nestedRewriter =
487 new RecursiveContinuationRewriter(continuationRewriter.helper); 485 new RecursiveContinuationRewriter(continuationRewriter.helper);
488 return node.accept(nestedRewriter); 486 return node.accept(nestedRewriter);
489 } 487 }
490 } 488 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/text/ast_to_text.dart ('k') | pkg/kernel/lib/transformations/continuation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698