Chromium Code Reviews| Index: runtime/lib/mirrors_impl.dart |
| =================================================================== |
| --- runtime/lib/mirrors_impl.dart (revision 21243) |
| +++ runtime/lib/mirrors_impl.dart (working copy) |
| @@ -139,6 +139,26 @@ |
| abstract class _LocalObjectMirrorImpl extends _LocalVMObjectMirrorImpl |
| implements ObjectMirror { |
| _LocalObjectMirrorImpl(ref) : super(ref) {} |
| + |
| +InstanceMirror invoke(String memberName, |
| + List positionalArguments, |
| + [Map<String,dynamic> namedArguments]) { |
| + if (namedArguments != null) { |
| + throw new UnimplementedError( |
| + 'named argument support is not implemented'); |
| + } |
| + return _invoke(this, memberName, positionalArguments); // needs to be distinct for sync calls |
|
Ivan Posva
2013/04/12 21:15:26
Long lines.
|
| + } |
| + |
| + InstanceMirror getField(String fieldName) { |
| + return _getField(this, fieldName); // needs to be distinct for sync calls |
| + } |
| + |
| + InstanceMirror setField(String fieldName, Object arg) { |
| + return _setField(this, fieldName, arg); // needs to be distinct for sync calls |
| + } |
| + |
| + |
| Future<InstanceMirror> invokeAsync(String memberName, |
|
Ivan Posva
2013/04/12 21:15:26
Please indent this appropriately.
|
| List positionalArguments, |
| @@ -155,7 +175,7 @@ |
| Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); |
| try { |
| completer.complete( |
| - _invoke(this, memberName, positionalArguments)); |
| + _invokeAsync(this, memberName, positionalArguments)); |
| } catch (exception, s) { |
| completer.completeError(exception, s); |
| } |
| @@ -177,7 +197,7 @@ |
| Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); |
| try { |
| - completer.complete(_setField(this, fieldName, arg)); |
| + completer.complete(_setFieldAsync(this, fieldName, arg)); |
| } catch (exception, s) { |
| completer.completeError(exception, s); |
| } |
| @@ -200,11 +220,17 @@ |
| static _invoke(ref, memberName, positionalArguments) |
| native 'LocalObjectMirrorImpl_invoke'; |
| - static _getField(ref, fieldName) |
| + static _getField(ref, fieldName) // same for sync and async versions |
| native 'LocalObjectMirrorImpl_getField'; |
| static _setField(ref, fieldName, value) |
| native 'LocalObjectMirrorImpl_setField'; |
| + |
| + static _invokeAsync(ref, memberName, positionalArguments) |
| + native 'LocalObjectMirrorImpl_invokeAsync'; |
| + |
| + static _setFieldAsync(ref, fieldName, value) |
| + native 'LocalObjectMirrorImpl_setFieldAsync'; |
| } |
| // Prints a string as it might appear in dart program text. |
| @@ -303,6 +329,15 @@ |
| 'ClosureMirror.source is not implemented'); |
| } |
| + InstanceMirror apply(List<Object> positionalArguments, |
| + [Map<String,Object> namedArguments]) { |
| + if (namedArguments != null) { |
| + throw new UnimplementedError( |
| + 'named argument support is not implemented'); |
| + } |
| + return _apply(this, positionalArguments); |
| + } |
| + |
| Future<InstanceMirror> applyAsync(List<Object> positionalArguments, |
| [Map<String,Object> namedArguments]) { |
| if (namedArguments != null) { |
| @@ -317,7 +352,7 @@ |
| Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); |
| try { |
| completer.complete( |
| - _apply(this, positionalArguments)); |
| + _applyAsync(this, positionalArguments)); |
| } catch (exception) { |
| completer.completeError(exception); |
| } |
| @@ -331,6 +366,9 @@ |
| static _apply(ref, positionalArguments) |
| native 'LocalClosureMirrorImpl_apply'; |
| + |
| + static _applyAsync(ref, positionalArguments) |
| + native 'LocalClosureMirrorImpl_applyAsync'; |
| } |
| class _LazyTypeMirror { |
| @@ -499,6 +537,25 @@ |
| String toString() => "ClassMirror on '$simpleName'"; |
| + InstanceMirror apply(List<Object> positionalArguments, |
| + [Map<String,Object> namedArguments]) { |
| + if (namedArguments != null) { |
| + throw new UnimplementedError( |
| + 'named argument support is not implemented'); |
| + } |
| + return _apply(this, positionalArguments); |
| + } |
| + |
| + InstanceMirror newInstance(String constructorName, |
| + List positionalArguments, |
| + [Map<String,dynamic> namedArguments]) { |
| + if (namedArguments != null) { |
| + throw new UnimplementedError( |
| + 'named argument support is not implemented'); |
| + } |
| + return _invokeConstructor(this, constructorName, positionalArguments); |
| + } |
| + |
| Future<InstanceMirror> newInstanceAsync(String constructorName, |
| List positionalArguments, |
| [Map<String,dynamic> namedArguments]) { |
| @@ -514,7 +571,7 @@ |
| Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); |
| try { |
| completer.complete( |
| - _invokeConstructor(this, constructorName, positionalArguments)); |
| + _invokeConstructorAsync(this, constructorName, positionalArguments)); |
| } catch (exception) { |
| completer.completeError(exception); |
| } |
| @@ -523,6 +580,9 @@ |
| static _invokeConstructor(ref, constructorName, positionalArguments) |
| native 'LocalClassMirrorImpl_invokeConstructor'; |
| + |
| + static _invokeConstructorAsync(ref, constructorName, positionalArguments) |
| + native 'LocalClassMirrorImpl_invokeConstructorAsync'; |
| } |
| class _LazyFunctionTypeMirror { |