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

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

Issue 10908142: Add runtimeType() to Object which returns canonicalized instances of Type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address more 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/lib/interceptors.dart
diff --git a/lib/compiler/implementation/lib/interceptors.dart b/lib/compiler/implementation/lib/interceptors.dart
index 8ca99f3a3151afe080eb7ec529b72c4cebdb34b0..54d086200c49dc8b9184020f3f2c9028049e02c1 100644
--- a/lib/compiler/implementation/lib/interceptors.dart
+++ b/lib/compiler/implementation/lib/interceptors.dart
@@ -643,3 +643,17 @@ isOdd(receiver) {
}
get$toString(receiver) => () => toString(receiver);
+
+runtimeType(receiver) {
+ if (receiver is int) {
+ return getOrCreateCachedRuntimeType('int');
+ } else if (receiver is String) {
+ return getOrCreateCachedRuntimeType('String');
+ } else if (receiver is double) {
+ return getOrCreateCachedRuntimeType('double');
+ } else if (receiver is List) {
+ return getOrCreateCachedRuntimeType('List');
+ } else {
+ return UNINTERCEPTED(receiver.runtimeType());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698