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

Unified Diff: runtime/lib/mirrors_impl.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
Index: runtime/lib/mirrors_impl.dart
===================================================================
--- runtime/lib/mirrors_impl.dart (revision 9796)
+++ runtime/lib/mirrors_impl.dart (working copy)
@@ -212,6 +212,55 @@
}
}
+class _LocalClosureMirrorImpl extends _LocalInstanceMirrorImpl
+ implements InstanceMirror {
+ _LocalClosureMirrorImpl(ref,
+ klass,
+ reflectee) : super(ref, klass, reflectee) {}
+
+ MethodMirror _function;
+ MethodMirror function() => _function;
+
+ String source() {
+ throw "asYetUnimplemented";
+ }
+
+ Future<ObjectMirror> apply(List<Object> positionalArguments,
+ [Map<String,Object> namedArguments]) {
+ if (namedArguments !== null) {
+ throw new NotImplementedException('named arguments not implemented');
+ }
+ // Walk the arguments and make sure they are legal.
+ for (int i = 0; i < positionalArguments.length; i++) {
+ var arg = positionalArguments[i];
+ if (arg is Mirror) {
+ if (arg is! InstanceMirror) {
+ throw new MirrorException(
+ 'positional argument $i ($arg) was not an InstanceMirror');
+ }
+ } else if (!isSimpleValue(arg)) {
+ throw new MirrorException(
+ 'positional argument $i ($arg) was not a simple value');
+ }
+ }
+ Completer<InstanceMirror> completer = new Completer<InstanceMirror>();
+ try {
+ completer.complete(
+ _apply(this, positionalArguments));
+ } catch (var exception) {
+ completer.completeException(exception);
+ }
+ return completer.future;
+ }
+
+ Future<ObjectMirror> findInContext(String name) {
+ throw "asYetUnimplemented";
+ }
+
+ static _apply(ref, positionalArguments)
+ native 'LocalClosureMirrorImpl_apply';
+}
+
class _LazyInterfaceMirror {
_LazyInterfaceMirror(this.libraryName, this.interfaceName) {}

Powered by Google App Engine
This is Rietveld 408576698