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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart

Issue 923013002: dart2dart: Implementation of simple try/catch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 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 d5000f1920f4025829bb3a4f126b7c6585537281..5e8eff651c150c0f799fc1fb6ed6e29c40ee4035 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
@@ -98,7 +98,19 @@ class SExpressionStringifier extends Visitor<String> with Indentation {
}
}
String body = indentBlock(() => visit(node.body));
- return '$indentation($LetCont ($conts)\n$body)';
+ return '$indentation(LetCont ($conts)\n$body)';
+ }
+
+ String visitLetHandler(LetHandler node) {
+ // There are no explicit references to the handler, so we leave it
+ // anonymous in the printed representation.
+ String parameters = node.handler.parameters
+ .map((p) => '${decorator(p, newValueName(p))}')
+ .join(' ');
+ String handlerBody =
+ indentBlock(() => indentBlock(() => visit(node.handler.body)));
+ String body = indentBlock(() => visit(node.body));
+ return '$indentation(LetHandler (($parameters)\n$handlerBody)\n$body)';
}
String visitLetMutable(LetMutable node) {
@@ -315,19 +327,27 @@ class ConstantStringifier extends ConstantValueVisitor<String, Null> {
}
String visitList(ListConstantValue constant, _) {
- return _failWith(constant);
+ String entries =
+ constant.entries.map((entry) => entry.accept(this, _)).join(' ');
+ return '(List $entries)';
}
String visitMap(MapConstantValue constant, _) {
- return _failWith(constant);
+ List<String> elements = <String>[];
+ for (int i = 0; i < constant.keys.length; ++i) {
+ ConstantValue key = constant.keys[i];
+ ConstantValue value = constant.values[i];
+ elements.add('(${key.accept(this, _)} . ${value.accept(this, _)})');
+ }
+ return '(Map (${elements.join(' ')}))';
}
String visitConstructed(ConstructedConstantValue constant, _) {
- return _failWith(constant);
+ return '(Constructed "${constant.unparse()}")';
}
String visitType(TypeConstantValue constant, _) {
- return _failWith(constant);
+ return '(Type "${constant.representedType}")';
}
String visitInterceptor(InterceptorConstantValue constant, _) {

Powered by Google App Engine
This is Rietveld 408576698