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

Unified Diff: lib/mirrors/mirrors.dart

Issue 10800065: Added ClosureMirror to dart:mirrors. Added Dart_ClosureFunction to the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « no previous file | runtime/include/dart_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/mirrors/mirrors.dart
===================================================================
--- lib/mirrors/mirrors.dart (revision 9835)
+++ lib/mirrors/mirrors.dart (working copy)
@@ -170,6 +170,38 @@
}
/**
+ * A [ClosureMirror] reflects a closure. Closures are special, because we do not
+ * wish to reflect the internals of a particular closure implementation. And
+ * yet, we need access to details of the closure internals - for example, its
+ * enclosing context and its source code.
+ */
+interface ClosureMirror extends InstanceMirror {
+
+ /**
+ * Return the source code for the closure, if available.
+ */
+ String source();
+
+ /**
+ * Call the closure. The arguments given in the descriptor need to be
+ * ObjectMirrors or values. Asynchronous.
+ */
+ Future<ObjectMirror> apply(List<Object> positionalArguments,
+ [Map<String,Object> namedArguments]);
+
+ /**
+ * Look up the value of name in the scope of the closure. The result is a
+ * mirror on that value. Asynchronous.
+ */
+ Future<ObjectMirror> findInContext(String name);
+
+ /**
+ * Return a mirror on the function of this closure.
+ */
+ MethodMirror function();
+}
+
+/**
* A [TypeMirror] reflects a Dart language class, interface, typedef
* or type variable.
*/
« no previous file with comments | « no previous file | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698