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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/lib/mirrors_patch.dart

Issue 14251021: Move invokeOn to InstanceMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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: dart/sdk/lib/_internal/compiler/implementation/lib/mirrors_patch.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/lib/mirrors_patch.dart b/dart/sdk/lib/_internal/compiler/implementation/lib/mirrors_patch.dart
index e9864d5f862b6b4bf59504dad87400cc2299399b..cd2608ab347ac0ca15bfbe1f5f2a467e80b83f97 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/lib/mirrors_patch.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/lib/mirrors_patch.dart
@@ -49,7 +49,6 @@ patch InstanceMirror reflect(Object reflectee) {
_mirrorsEnabled = true;
print(reflectee);
}
- _ensureEnabled();
return new _InstanceMirror(reflectee);
}
@@ -63,13 +62,12 @@ class _InstanceMirror extends InstanceMirror {
final reflectee;
- _InstanceMirror(this.reflectee) {
- _ensureEnabled();
- }
+ _InstanceMirror(this.reflectee);
bool get hasReflectee => true;
ClassMirror get type {
+ _ensureEnabled();
String className = Primitives.objectTypeName(reflectee);
var constructor = Primitives.getConstructor(className);
var mirror = classMirrors[constructor];
@@ -83,6 +81,7 @@ class _InstanceMirror extends InstanceMirror {
Future<InstanceMirror> invokeAsync(String memberName,
List<Object> positionalArguments,
[Map<String,Object> namedArguments]) {
+ _ensureEnabled();
if (namedArguments != null && !namedArguments.isEmpty) {
throw new UnsupportedError('Named arguments are not implemented');
}
@@ -106,6 +105,10 @@ class _InstanceMirror extends InstanceMirror {
return completer.future;
}
+ delegate(Invocation invocation) {
+ return JSInvocationMirror.invokeFromMirror(invocation, reflectee);
+ }
+
String toString() => 'InstanceMirror($reflectee)';
}

Powered by Google App Engine
This is Rietveld 408576698