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

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

Issue 1011403003: cps-ir: Set runtime type information for new objects that require it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 34cd076d3c0941f0a6eec0baa1e8520d82735286..159f1502c793825c6e6a83b48ea6768624391a17 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
@@ -198,15 +198,28 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
}
String visitInvokeConstructor(InvokeConstructor node) {
+ String className;
+ // TODO(karlklose): for illegal nodes constructed for tests or unresolved
+ // cosntructor calls in the DartBackend, we get an element with no enclosing
+ // class. Clean this up by introducing a name field to the node and
+ // removing [ErroneousElement]s from the IR.
+ if (node.type != null) {
+ className = node.type.toString();
+ } else {
+ className = node.target.enclosingClass.name;
+ }
String callName;
if (node.target.name.isEmpty) {
- callName = '${node.type}';
+ callName = '${className}';
} else {
- callName = '${node.type}.${node.target.name}';
+ callName = '${className}.${node.target.name}';
}
String cont = access(node.continuation);
String args = formatArguments(node);
- return '$indentation(InvokeConstructor $callName $args $cont)';
+ String typeArguments = node.typeArguments.isEmpty ? ''
+ : ' <${node.typeArguments.map(access).join(', ')}>';
+ return '$indentation(InvokeConstructor $callName $args$typeArguments'
+ ' $cont)';
}
String visitConcatenateStrings(ConcatenateStrings node) {
@@ -338,6 +351,12 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
String visitReadTypeVariable(ReadTypeVariable node) {
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)';
asgerf 2015/03/18 10:18:06 Redundant toString call
+ }
}
class ConstantStringifier extends ConstantValueVisitor<String, Null> {

Powered by Google App Engine
This is Rietveld 408576698