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

Unified Diff: lib/compiler/implementation/universe.dart

Issue 10908068: Better tracking of provided types at call sites (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 8 years, 3 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: lib/compiler/implementation/universe.dart
diff --git a/lib/compiler/implementation/universe.dart b/lib/compiler/implementation/universe.dart
index a03a61c7295d92f44e19ced9a4a85f67449360d7..9dbcb8edc89cdeaa69ca1fa9fd4c24f3b7cc30db 100644
--- a/lib/compiler/implementation/universe.dart
+++ b/lib/compiler/implementation/universe.dart
@@ -322,7 +322,26 @@ class Selector implements Hashable {
return orderedNamedArguments;
}
- toString() => 'Selector($kind, $name, $argumentCount)';
+ String namedArgumentsToString() {
+ StringBuffer result = new StringBuffer();
kasperl 2012/09/05 07:06:29 Don't do the allocation of this if namedArgumentCo
Søren Gjesse 2012/09/05 08:02:59 Done.
+ if (namedArgumentCount > 0) {
+ result.add('[');
kasperl 2012/09/05 07:06:29 How about not adding [ and ] and just returning "[
Søren Gjesse 2012/09/05 08:02:59 Done.
+ for (int i = 0; i < namedArgumentCount; i++) {
+ if (i != 0) result.add(', ');
+ result.add(namedArguments[i].slowToString());
+ }
+ result.add(']');
+ return result.toString();
+ }
+ return '';
+ }
+
+ String toString() {
+ String named = '';
+ if (namedArgumentCount > 0) named = ', named=${namedArgumentsToString()}';
+ return 'Selector($kind, ${name.slowToString()}, '
+ 'arity=$argumentCount$named)';
+ }
}
class TypedSelector extends Selector {
@@ -388,8 +407,10 @@ class TypedSelector extends Selector {
return false;
}
- toString() {
- return 'Selector($kind, "${name.slowToString()}", '
- '$argumentCount, type=$receiverType)';
+ String toString() {
kasperl 2012/09/05 07:06:29 How about getting rid of this and just use the one
Søren Gjesse 2012/09/05 08:02:59 Good point, done.
+ String named = '';
+ if (namedArgumentCount > 0) named = ', named=${namedArgumentsToString()}';
+ return 'Selector($kind, ${name.slowToString()}, '
+ 'arity=$argumentCount$named, type=$receiverType)';
}
}

Powered by Google App Engine
This is Rietveld 408576698