Chromium Code Reviews| 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 { |
|
Ivan Posva
2012/07/23 23:57:20
Should implement ClosureMirror here.
|
| + _LocalClosureMirrorImpl(ref, |
| + klass, |
| + reflectee) : super(ref, klass, reflectee) {} |
| + |
| + MethodMirror _function; |
| + MethodMirror function() => _function; |
| + |
| + String source() { |
| + throw "asYetUnimplemented"; |
|
Ivan Posva
2012/07/23 23:57:20
See other uses of "throw new NotImplementedExcepti
|
| + } |
| + |
| + 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) |
|
Ivan Posva
2012/07/23 23:57:20
Why is this native method marked as a static metho
rmacnak
2012/07/24 01:14:00
Consistency with ObjectMirror's _invoke.
On 2012/
|
| + native 'LocalClosureMirrorImpl_apply'; |
| +} |
| + |
| class _LazyInterfaceMirror { |
| _LazyInterfaceMirror(this.libraryName, this.interfaceName) {} |