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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 1273983002: Hoist InstanceMirror.delegate to ObjectMirror. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index c64be5de39f23c626b4a5bbd806b34335d96d1ad..0c7b0bba81290769b4fa72c0bc7599125024a47b 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -371,6 +371,25 @@ abstract class _LocalObjectMirror extends _LocalMirror implements ObjectMirror {
this._invokeSetter(_reflectee, _n(memberName), value);
return reflect(value);
}
+
+ delegate(Invocation invocation) {
+ if (invocation.isMethod) {
+ return this.invoke(invocation.memberName,
+ invocation.positionalArguments,
+ invocation.namedArguments).reflectee;
+ }
+ if (invocation.isGetter) {
+ return this.getField(invocation.memberName).reflectee;
+ }
+ if (invocation.isSetter) {
+ var unwrapped = _n(invocation.memberName);
+ var withoutEqual = _s(unwrapped.substring(0, unwrapped.length - 1));
+ var arg = invocation.positionalArguments[0];
+ this.setField(withoutEqual, arg).reflectee;
+ return arg;
+ }
+ throw "UNREACHABLE";
+ }
}
class _LocalInstanceMirror extends _LocalObjectMirror
@@ -393,25 +412,6 @@ class _LocalInstanceMirror extends _LocalObjectMirror
get reflectee => _reflectee;
- delegate(Invocation invocation) {
- if (invocation.isMethod) {
- return this.invoke(invocation.memberName,
- invocation.positionalArguments,
- invocation.namedArguments).reflectee;
- }
- if (invocation.isGetter) {
- return this.getField(invocation.memberName).reflectee;
- }
- if (invocation.isSetter) {
- var unwrapped = _n(invocation.memberName);
- var withoutEqual = _s(unwrapped.substring(0, unwrapped.length - 1));
- var arg = invocation.positionalArguments[0];
- this.setField(withoutEqual, arg).reflectee;
- return arg;
- }
- throw "UNREACHABLE";
- }
-
String toString() => 'InstanceMirror on ${Error.safeToString(_reflectee)}';
bool operator ==(other) {

Powered by Google App Engine
This is Rietveld 408576698