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

Side by Side 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: Refactor. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library('dart:_interceptors'); 5 #library('dart:_interceptors');
6 6
7 #import('coreimpl.dart'); 7 #import('coreimpl.dart');
8 #import('js_helper.dart'); 8 #import('js_helper.dart');
9 9
10 add$1(var receiver, var value) { 10 add$1(var receiver, var value) {
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 if (receiver is !int) return UNINTERCEPTED(receiver.isEven()); 636 if (receiver is !int) return UNINTERCEPTED(receiver.isEven());
637 return (receiver & 1) === 0; 637 return (receiver & 1) === 0;
638 } 638 }
639 639
640 isOdd(receiver) { 640 isOdd(receiver) {
641 if (receiver is !int) return UNINTERCEPTED(receiver.isOdd()); 641 if (receiver is !int) return UNINTERCEPTED(receiver.isOdd());
642 return (receiver & 1) === 1; 642 return (receiver & 1) === 1;
643 } 643 }
644 644
645 get$toString(receiver) => () => toString(receiver); 645 get$toString(receiver) => () => toString(receiver);
646
647 runtimeType(receiver) {
648 if (receiver is int) {
649 return getOrCreateCachedRuntimeType('int');
650 } else if (receiver is String) {
651 return getOrCreateCachedRuntimeType('String');
652 } else if (receiver is double) {
653 return getOrCreateCachedRuntimeType('double');
654 } else if (receiver is List) {
655 return getOrCreateCachedRuntimeType('List');
656 } else {
657 return UNINTERCEPTED(receiver.runtimeType());
658 }
659 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698