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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
index a645fb9a7a19fa5cb0166849f8a825c4149eec6e..8a99d4434bc7a5b26d8163c872ca3bb5263d7a1d 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
@@ -238,7 +238,16 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
String name = access(node.continuation);
if (node.isRecursive) name = 'rec $name';
String args = node.arguments.map(access).join(' ');
- return '$indentation($InvokeContinuation $name ($args))';
+ return '$indentation(InvokeContinuation $name ($args))';
+ }
+
+ String visitThrow(Throw node) {
+ String value = access(node.value);
+ return '$indentation(Throw $value)';
+ }
+
+ String visitRethrow(Rethrow node) {
+ return '$indentation(Rethrow)';
}
String visitBranch(Branch node) {
@@ -355,11 +364,15 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
return '(ReadTypeVariable ${access(node.target)}.${node.variable})';
}
- @override
String visitTypeExpression(TypeExpression node) {
String args = node.arguments.map(access).join(', ');
return '(TypeExpression ${node.dartType.toString()} $args)';
}
+
+ String visitNonTailThrow(NonTailThrow node) {
+ String value = access(node.value);
+ return '(NonTailThrow $value)';
+ }
}
class ConstantStringifier extends ConstantValueVisitor<String, Null> {
@@ -374,7 +387,7 @@ class ConstantStringifier extends ConstantValueVisitor<String, Null> {
}
String visitFunction(FunctionConstantValue constant, _) {
- return _failWith(constant);
+ return '(Function "${constant.unparse()}")';
}
String visitNull(NullConstantValue constant, _) {
@@ -470,7 +483,7 @@ class _Namer {
}
String getName(Node node) {
- assert(_names.containsKey(node));
+ if (!_names.containsKey(node)) return 'MISSING_NAME';
return _names[node];
}
}

Powered by Google App Engine
This is Rietveld 408576698