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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/lib/interceptors.dart

Issue 11360228: Simplify runtime type support. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 _interceptors; 5 library _interceptors;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 part 'js_array.dart'; 9 part 'js_array.dart';
10 part 'js_number.dart'; 10 part 'js_number.dart';
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 /** 48 /**
49 * The interceptor class for [bool]. 49 * The interceptor class for [bool].
50 */ 50 */
51 class JSBool implements bool { 51 class JSBool implements bool {
52 const JSBool(); 52 const JSBool();
53 String toString() => JS('String', r'String(#)', this); 53 String toString() => JS('String', r'String(#)', this);
54 int get hashCode => this ? 0x40377024 : 0xc18c0076; 54 int get hashCode => this ? 0x40377024 : 0xc18c0076;
55 Type get runtimeType => createRuntimeType('bool'); 55 Type get runtimeType => createRuntimeType('bool');
56 } 56 }
57 57
58 get$runtimeType(receiver) {
ngeoffray 2012/11/22 17:09:39 This is dead code now.
karlklose 2012/11/23 08:47:46 Done.
59 if (receiver is int) {
60 return int;
61 } else if (receiver is String) {
62 return String;
63 } else if (receiver is double) {
64 return double;
65 } else if (receiver is bool) {
66 return bool;
67 } else if (receiver == null) {
68 return createRuntimeType('Null');
69 } else if (isJsArray(receiver)) {
70 // Call getRuntimeTypeString to get the name including type arguments.
71 return createRuntimeType(getRuntimeTypeString(receiver));
72 } else {
73 return UNINTERCEPTED(receiver.runtimeType);
74 }
75 }
76
58 /** 77 /**
59 * The interceptor class for [Null]. 78 * The interceptor class for [Null].
60 */ 79 */
61 class JSNull implements Null { 80 class JSNull implements Null {
62 const JSNull(); 81 const JSNull();
63 String toString() => 'null'; 82 String toString() => 'null';
64 int get hashCode => 0; 83 int get hashCode => 0;
65 Type get runtimeType => createRuntimeType('Null'); 84 Type get runtimeType => createRuntimeType('Null');
66 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698