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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart

Issue 1092023002: CPS implementation of throw and rethrow. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 tree_ir_builder; 5 library tree_ir_builder;
6 6
7 import '../dart2jslib.dart' as dart2js; 7 import '../dart2jslib.dart' as dart2js;
8 import '../dart_types.dart'; 8 import '../dart_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; 10 import '../cps_ir/cps_ir_nodes.dart' as cps_ir;
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 node.selector, arguments); 446 node.selector, arguments);
447 return continueWithExpression(node.continuation, invoke); 447 return continueWithExpression(node.continuation, invoke);
448 } 448 }
449 449
450 Statement visitConcatenateStrings(cps_ir.ConcatenateStrings node) { 450 Statement visitConcatenateStrings(cps_ir.ConcatenateStrings node) {
451 List<Expression> arguments = translateArguments(node.arguments); 451 List<Expression> arguments = translateArguments(node.arguments);
452 Expression concat = new ConcatenateStrings(arguments); 452 Expression concat = new ConcatenateStrings(arguments);
453 return continueWithExpression(node.continuation, concat); 453 return continueWithExpression(node.continuation, concat);
454 } 454 }
455 455
456 Statement visitThrow(cps_ir.Throw node) {
457 Expression value = getVariableUse(node.value);
458 return new Throw(value);
459 }
460
461 Statement visitRethrow(cps_ir.Rethrow node) {
462 return new Rethrow();
463 }
464
465 Expression visitNonTailThrow(cps_ir.NonTailThrow node) {
466 unexpectedNode(node);
467 }
468
456 Statement continueWithExpression(cps_ir.Reference continuation, 469 Statement continueWithExpression(cps_ir.Reference continuation,
457 Expression expression) { 470 Expression expression) {
458 cps_ir.Continuation cont = continuation.definition; 471 cps_ir.Continuation cont = continuation.definition;
459 if (cont == returnContinuation) { 472 if (cont == returnContinuation) {
460 return new Return(expression); 473 return new Return(expression);
461 } else { 474 } else {
462 assert(cont.parameters.length == 1); 475 assert(cont.parameters.length == 1);
463 Function nextBuilder = cont.hasExactlyOneUse ? 476 Function nextBuilder = cont.hasExactlyOneUse ?
464 () => visit(cont.body) : () => new Break(labels[cont]); 477 () => visit(cont.body) : () => new Break(labels[cont]);
465 return buildContinuationAssignment(cont.parameters.single, expression, 478 return buildContinuationAssignment(cont.parameters.single, expression,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 } 654 }
642 655
643 @override 656 @override
644 Node visitTypeExpression(cps_ir.TypeExpression node) { 657 Node visitTypeExpression(cps_ir.TypeExpression node) {
645 return new TypeExpression( 658 return new TypeExpression(
646 node.dartType, 659 node.dartType,
647 node.arguments.map(getVariableUse).toList()); 660 node.arguments.map(getVariableUse).toList());
648 } 661 }
649 } 662 }
650 663
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698