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

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: Address comments. 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
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3b71d9adc3e9594612cd22a96079363539b94d6a..f6d3e8840698056fead66175af79706fe407e4a0 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
@@ -207,11 +207,21 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
}
String visitInvokeConstructor(InvokeConstructor node) {
+ String className;
+ // TODO(karlklose): for illegal nodes constructed for tests or unresolved
+ // constructor 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);
@@ -323,7 +333,8 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
String visitCreateInstance(CreateInstance node) {
String className = node.classElement.name;
String arguments = node.arguments.map(access).join(' ');
- return '(CreateInstance $className ($arguments))';
+ String typeInformation = node.typeInformation.map(access).join(' ');
+ return '(CreateInstance $className ($arguments)$typeInformation)';
}
String visitIdentical(Identical node) {
@@ -343,6 +354,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)';
+ }
}
class ConstantStringifier extends ConstantValueVisitor<String, Null> {
@@ -427,7 +444,9 @@ class _Namer {
String nameParameter(Parameter parameter) {
assert(!_names.containsKey(parameter));
- return _names[parameter] = parameter.hint.name;
+ String name =
+ parameter.hint != null ? parameter.hint.name : nameValue(parameter);
+ return _names[parameter] = name;
}
String nameMutableVariable(MutableVariable variable) {
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698