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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 16757007: Changes to mirrors in support of metadata access at runtime. Assumes VM changes in flight.… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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: runtime/lib/mirrors_impl.dart
===================================================================
--- runtime/lib/mirrors_impl.dart (revision 23823)
+++ runtime/lib/mirrors_impl.dart (working copy)
@@ -70,6 +70,10 @@
return result;
}
+List<InstanceMirror> _metadata(mirror) {
+ native 'LocalMirrorImpl_metadata';
ahe 2013/06/11 08:48:10 I don't think you can wrap the native declaration
hausner 2013/06/11 16:17:13 This isn't legal dart code.
ahe 2013/06/11 16:21:22 Neither is this: List<InstanceMirror> _metadata(m
gbracha 2013/06/12 21:21:18 Done.
+}
+
class _LocalMirrorSystemImpl extends MirrorSystem {
// Change parameter back to "this.libraries" when native code is changed.
_LocalMirrorSystemImpl(Map<String, LibraryMirror> libraries, this.isolate)
@@ -163,6 +167,13 @@
// language objects (except for objects of type VMReference, of
// course).
VMReference _reference;
+
+ int get hashCode => _reference.hashCode;
ahe 2013/06/11 08:48:10 This is a bad hashCode. It should be the hashCode
gbracha 2013/06/12 21:21:18 This really should be part of a different CL deali
+
+ bool operator == (m) {
+ return (runtimeType == m.runtimeType) && (_reference == m._reference);
ahe 2013/06/11 08:48:10 I don't understand the need to check for runtimeTy
gbracha 2013/06/12 21:21:18 Indeed, it probably is in the equality CL. This wa
+ }
+
}
abstract class _LocalObjectMirrorImpl extends _LocalVMObjectMirrorImpl
@@ -602,6 +613,10 @@
}
}
+ List<InstanceMirror> get metadata {
+ return _metadata(this).map((o) => reflect(o));
ahe 2013/06/11 08:48:10 This should be: List<InstanceMirror> get metadata
gbracha 2013/06/12 21:21:18 Done. In all 5 places.
+ }
+
static _invokeConstructor(ref, constructorName, positionalArguments, async)
native 'LocalClassMirrorImpl_invokeConstructor';
}
@@ -704,6 +719,10 @@
return _upperBound;
}
+ List<InstanceMirror> get metadata {
+ return _metadata(this).map((o) => reflect(o));
+ }
+
String toString() => "TypeVariableMirror on '$simpleName'";
}
@@ -843,6 +862,10 @@
return _variables;
}
+ List<InstanceMirror> get metadata {
+ return _metadata(this).map((o) => reflect(o));
+ }
+
String toString() => "LibraryMirror on '$simpleName'";
}
@@ -943,6 +966,10 @@
final bool isRedirectingConstructor;
final bool isFactoryConstructor;
+ List<InstanceMirror> get metadata {
+ return _metadata(this).map((o) => reflect(o));
+ }
+
String toString() => "MethodMirror on '$simpleName'";
}
@@ -997,6 +1024,10 @@
final bool isStatic;
final bool isFinal;
+ List<InstanceMirror> get metadata {
+ return _metadata(this).map((o) => reflect(o));
+ }
+
String toString() => "VariableMirror on '$simpleName'";
}

Powered by Google App Engine
This is Rietveld 408576698