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

Side by Side Diff: pkg/serialization/lib/src/mirrors_helpers.dart

Issue 11567018: Get rid of the polyfill identity set implementation in favour of a (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: A bit more polyfill that can be removed with this change. Created 8 years 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 /** 5 /**
6 * Provides some additional convenience methods on top of the basic mirrors 6 * Provides some additional convenience methods on top of the basic mirrors
7 */ 7 */
8 library mirrors_helpers; 8 library mirrors_helpers;
9 9
10 // Import and re-export mirrors here to minimize both dependence on mirrors 10 // Import and re-export mirrors here to minimize both dependence on mirrors
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 var setters = mirror.setters; 50 var setters = mirror.setters;
51 return publicGetters(mirror).filter((each) => 51 return publicGetters(mirror).filter((each) =>
52 setters["${each.simpleName}="] != null); 52 setters["${each.simpleName}="] != null);
53 } 53 }
54 54
55 /** 55 /**
56 * A particularly bad case of polyfill, because we cannot yet use type names 56 * A particularly bad case of polyfill, because we cannot yet use type names
57 * as literals, so we have to be passed an instance and then extract a 57 * as literals, so we have to be passed an instance and then extract a
58 * ClassMirror from that. Given a horrible name as an extra reminder to fix it. 58 * ClassMirror from that. Given a horrible name as an extra reminder to fix it.
59 */ 59 */
60 ClassMirror turnInstanceIntoSomethingWeCanUse(x) => reflect(x).type; 60 ClassMirror turnInstanceIntoSomethingWeCanUse(x) => reflect(x).type;
61
62 /**
63 * This is polyfill because we can't hash ClassMirror right now. We
64 * don't bother implementing most of its methods because we don't need them.
65 */
66 // TODO(alanknight): Remove this when you can hash mirrors directly
67 class ClassMirrorWrapper implements ClassMirror {
68 ClassMirror mirror;
69 ClassMirrorWrapper(this.mirror);
70 get simpleName => mirror.simpleName;
71 get hashCode => simpleName.hashCode;
72 operator ==(x) => x is ClassMirror && simpleName == x.simpleName;
73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698