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

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

Issue 15861028: Implement MethodMirror.metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments and deal with private members of BoundClosure Created 7 years, 7 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/js_helper.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart b/dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
index 1cc1b926dacc354c10197f49e0251738faafa1a6..e570cbb68f6ebaf6bfbe5b9c172b6bd603126721 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
@@ -947,10 +947,19 @@ class Closure implements Function {
String toString() => "Closure";
}
+/// Represents a 'tear-off' closure, that is an instance method bound
+/// to a specific receiver (instance).
class BoundClosure extends Closure {
- var _self;
- var _target;
- var _receiver;
+ /// The receiver or interceptor.
+ // TODO(ahe): This could just be the interceptor, we always know if
+ // we need the interceptor when generating the call method.
+ final _self;
+
+ /// The method name.
+ final String _target;
+
+ /// The reciever.
kasperl 2013/06/03 10:23:21 i before e except after c :-)
ahe 2013/06/03 10:49:48 Done.
+ final _receiver;
bool operator==(other) {
if (identical(this, other)) return true;
@@ -967,6 +976,12 @@ class BoundClosure extends Closure {
_target.hashCode,
_receiver.hashCode);
}
+
+ static selfOf(BoundClosure closure) => closure._self;
+
+ static String targetOf(BoundClosure closure) => closure._target;
+
+ static revceiverOf(BoundClosure closure) => closure._receiver;
}
bool jsHasOwnProperty(var jsObject, String property) {

Powered by Google App Engine
This is Rietveld 408576698