OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // VM-specific implementation of the dart:mirrors library. | 5 // VM-specific implementation of the dart:mirrors library. |
6 | 6 |
7 // These values are allowed to be passed directly over the wire. | 7 // These values are allowed to be passed directly over the wire. |
8 bool _isSimpleValue(var value) { | 8 bool _isSimpleValue(var value) { |
9 return (value == null || value is num || value is String || value is bool); | 9 return (value == null || value is num || value is String || value is bool); |
10 } | 10 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 var result = new Map<Uri, LibraryMirror>(); | 66 var result = new Map<Uri, LibraryMirror>(); |
67 map.forEach((String url, LibraryMirror mirror) { | 67 map.forEach((String url, LibraryMirror mirror) { |
68 result[Uri.parse(url)] = mirror; | 68 result[Uri.parse(url)] = mirror; |
69 }); | 69 }); |
70 return result; | 70 return result; |
71 } | 71 } |
72 | 72 |
73 List<InstanceMirror> _metadata(mirror) | 73 List<InstanceMirror> _metadata(mirror) |
74 native 'Mirrors_metadata'; | 74 native 'Mirrors_metadata'; |
75 | 75 |
76 // This will verify the argument types, unwrap them, and ensure we have a fixed | |
77 // array. | |
78 List _unwarpAsyncPositionals(wrappedArgs){ | |
79 List unwrappedArgs = new List(wrappedArgs.length); | |
80 for(int i = 0; i < wrappedArgs.length; i++){ | |
81 var wrappedArg = wrappedArgs[i]; | |
82 if(_isSimpleValue(wrappedArg)) { | |
83 unwrappedArgs[i] = wrappedArg; | |
84 } else if(wrappedArg is InstanceMirror) { | |
85 unwrappedArgs[i] = wrappedArg._reflectee; | |
86 } else { | |
87 throw "positional argument $i ($arg) was not a simple value or InstanceMir ror"; | |
88 } | |
89 } | |
90 return unwrappedArgs; | |
91 } | |
76 | 92 |
77 class _LocalMirrorSystemImpl extends MirrorSystem { | 93 class _LocalMirrorSystemImpl extends MirrorSystem { |
78 // Change parameter back to "this.libraries" when native code is changed. | 94 // Change parameter back to "this.libraries" when native code is changed. |
79 _LocalMirrorSystemImpl(Map<String, LibraryMirror> libraries, this.isolate) | 95 _LocalMirrorSystemImpl(Map<String, LibraryMirror> libraries, this.isolate) |
80 : this.libraries = _createLibrariesMap(libraries), | 96 : this.libraries = _createLibrariesMap(libraries), |
81 _functionTypes = new Map<String, FunctionTypeMirror>(); | 97 _functionTypes = new Map<String, FunctionTypeMirror>(); |
82 | 98 |
83 final Map<Uri, LibraryMirror> libraries; | 99 final Map<Uri, LibraryMirror> libraries; |
84 final IsolateMirror isolate; | 100 final IsolateMirror isolate; |
85 | 101 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 | 184 |
169 // For now, all VMObjects hold a VMReference. We could consider | 185 // For now, all VMObjects hold a VMReference. We could consider |
170 // storing the Object reference itself here if the object is a Dart | 186 // storing the Object reference itself here if the object is a Dart |
171 // language objects (except for objects of type VMReference, of | 187 // language objects (except for objects of type VMReference, of |
172 // course). | 188 // course). |
173 VMReference _reference; | 189 VMReference _reference; |
174 } | 190 } |
175 | 191 |
176 abstract class _LocalObjectMirrorImpl extends _LocalVMObjectMirrorImpl | 192 abstract class _LocalObjectMirrorImpl extends _LocalVMObjectMirrorImpl |
177 implements ObjectMirror { | 193 implements ObjectMirror { |
178 _LocalObjectMirrorImpl(ref) : super(ref) {} | 194 _LocalObjectMirrorImpl(this._reflectee, ref) : super(ref) {} |
195 | |
196 final _reflectee; // May be a MirrorReference or an ordinary object | |
179 | 197 |
180 InstanceMirror invoke(Symbol memberName, | 198 InstanceMirror invoke(Symbol memberName, |
181 List positionalArguments, | 199 List positionalArguments, |
182 [Map<Symbol, dynamic> namedArguments]) { | 200 [Map<Symbol, dynamic> namedArguments]) { |
183 if (namedArguments != null) { | 201 if (namedArguments != null) { |
184 throw new UnimplementedError( | 202 throw new UnimplementedError( |
185 'named argument support is not implemented'); | 203 'named argument support is not implemented'); |
186 } | 204 } |
187 return _invoke(this, _n(memberName), positionalArguments, false); | 205 return reflect(this._invoke(_reflectee, |
206 _n(memberName), | |
207 positionalArguments.toList(growable:false))); | |
188 } | 208 } |
189 | 209 |
190 InstanceMirror getField(Symbol fieldName) { | 210 InstanceMirror getField(Symbol memberName) { |
191 return _getField(this, _n(fieldName)); | 211 return reflect(this._invokeGetter(_reflectee, |
212 _n(memberName))); | |
192 } | 213 } |
193 | 214 |
194 InstanceMirror setField(Symbol fieldName, Object arg) { | 215 InstanceMirror setField(Symbol memberName, Object value) { |
195 return _setField(this, _n(fieldName), arg, false); | 216 return reflect(this._invokeSetter(_reflectee, |
217 _n(memberName), | |
218 value)); | |
196 } | 219 } |
197 | 220 |
198 Future<InstanceMirror> invokeAsync(Symbol memberName, | 221 Future<InstanceMirror> invokeAsync(Symbol memberName, |
199 List positionalArguments, | 222 List positionalArguments, |
200 [Map<Symbol, dynamic> namedArguments]) { | 223 [Map<Symbol, dynamic> namedArguments]) { |
201 if (namedArguments != null) { | 224 if (namedArguments != null) { |
202 throw new UnimplementedError( | 225 throw new UnimplementedError( |
203 'named argument support is not implemented'); | 226 'named argument support is not implemented'); |
204 } | 227 } |
205 // Walk the arguments and make sure they are legal. | 228 |
206 for (int i = 0; i < positionalArguments.length; i++) { | |
207 var arg = positionalArguments[i]; | |
208 _validateArgument(i, arg); | |
209 } | |
210 try { | 229 try { |
211 return new Future<InstanceMirror>.value( | 230 var result = this._invoke(_reflectee, |
212 _invoke(this, _n(memberName), positionalArguments, true)); | 231 _n(memberName), |
213 } catch (exception, s) { | 232 _unwarpAsyncPositionals(positionalArguments)); |
214 return new Future<InstanceMirror>.error(exception, s); | 233 return new Future.value(reflect(result)); |
234 } on MirroredError catch(e) { | |
235 return new Future.error(e); | |
215 } | 236 } |
216 } | 237 } |
217 | 238 |
218 Future<InstanceMirror> getFieldAsync(Symbol fieldName) { | 239 Future<InstanceMirror> getFieldAsync(Symbol memberName) { |
219 try { | 240 try { |
220 return new Future<InstanceMirror>.value(_getField(this, _n(fieldName))); | 241 var result = this._invokeGetter(_reflectee, |
221 } catch (exception, s) { | 242 _n(memberName)); |
222 return new Future<InstanceMirror>.error(exception, s); | 243 return new Future.value(reflect(result)); |
244 } on MirroredError catch(e) { | |
245 return new Future.error(e); | |
223 } | 246 } |
224 } | 247 } |
225 | 248 |
226 Future<InstanceMirror> setFieldAsync(Symbol fieldName, Object arg) { | 249 Future<InstanceMirror> setFieldAsync(Symbol memberName, Object value) { |
227 _validateArgument(0, arg); | 250 try { |
251 var unwrappedValue; | |
252 if(_isSimpleValue(value)) { | |
253 unwrappedValue = value; | |
254 } else if(wrappedArg is InstanceMirror) { | |
255 unwrappedValue = value._reflectee; | |
256 } else { | |
257 throw "setter argument ($value) must be a simple value or InstanceMirror "; | |
258 } | |
228 | 259 |
229 try { | 260 var result = this._invokeSetter(_reflectee, |
230 return new Future<InstanceMirror>.value( | 261 _n(memberName), |
231 _setField(this, _n(fieldName), arg, true)); | 262 unwrappedValue); |
232 } catch (exception, s) { | 263 return new Future.value(reflect(result)); |
233 return new Future<InstanceMirror>.error(exception, s); | 264 } on MirroredError catch(e) { |
265 return new Future.error(e); | |
234 } | 266 } |
235 } | 267 } |
236 | 268 |
237 static _validateArgument(int i, Object arg) | 269 static _validateArgument(int i, Object arg) |
238 { | 270 { |
239 if (arg is Mirror) { | 271 if (arg is Mirror) { |
240 if (arg is! InstanceMirror) { | 272 if (arg is! InstanceMirror) { |
241 throw new MirrorException( | 273 throw new MirrorException( |
242 'positional argument $i ($arg) was not an InstanceMirror'); | 274 'positional argument $i ($arg) was not an InstanceMirror'); |
243 } | 275 } |
244 } else if (!_isSimpleValue(arg)) { | 276 } else if (!_isSimpleValue(arg)) { |
245 throw new MirrorException( | 277 throw new MirrorException( |
246 'positional argument $i ($arg) was not a simple value'); | 278 'positional argument $i ($arg) was not a simple value'); |
247 } | 279 } |
248 } | 280 } |
249 | |
250 static _invoke(ref, memberName, positionalArguments, async) | |
251 native 'LocalObjectMirrorImpl_invoke'; | |
252 | |
253 static _getField(ref, fieldName) // same for sync and async versions | |
254 native 'LocalObjectMirrorImpl_getField'; | |
255 | |
256 static _setField(ref, fieldName, value, async) | |
257 native 'LocalObjectMirrorImpl_setField'; | |
258 } | 281 } |
259 | 282 |
260 class _LocalInstanceMirrorImpl extends _LocalObjectMirrorImpl | 283 class _LocalInstanceMirrorImpl extends _LocalObjectMirrorImpl |
261 implements InstanceMirror { | 284 implements InstanceMirror { |
262 // TODO(ahe): This is a hack, see delegate below. | 285 // TODO(ahe): This is a hack, see delegate below. |
263 static Function _invokeOnClosure; | 286 static Function _invokeOnClosure; |
264 | 287 |
265 _LocalInstanceMirrorImpl(ref, | 288 _LocalInstanceMirrorImpl(ref, |
266 this._type, | 289 this._type, |
267 this._reflectee) : super(ref) {} | 290 reflectee) : super(reflectee, ref) {} |
268 | 291 |
269 var _type; | 292 var _type; |
270 ClassMirror get type { | 293 ClassMirror get type { |
271 if (_type is! Mirror) { | 294 if (_type is! Mirror) { |
272 _type = _type.resolve(mirrors); | 295 _type = _type.resolve(mirrors); |
273 } | 296 } |
274 return _type; | 297 return _type; |
275 } | 298 } |
276 | 299 |
277 // LocalInstanceMirrors always reflect local instances | 300 // LocalInstanceMirrors always reflect local instances |
278 bool hasReflectee = true; | 301 bool hasReflectee = true; |
279 | 302 |
280 var _reflectee; | |
281 get reflectee => _reflectee; | 303 get reflectee => _reflectee; |
282 | 304 |
283 delegate(Invocation invocation) { | 305 delegate(Invocation invocation) { |
284 if (_invokeOnClosure == null) { | 306 if (_invokeOnClosure == null) { |
285 // TODO(ahe): This is a total hack. We're using the mirror | 307 // TODO(ahe): This is a total hack. We're using the mirror |
286 // system to access a private field in a different library. For | 308 // system to access a private field in a different library. For |
287 // some reason, that works. On the other hand, calling a | 309 // some reason, that works. On the other hand, calling a |
288 // private method does not work. | 310 // private method does not work. |
311 | |
289 _LocalInstanceMirrorImpl mirror = | 312 _LocalInstanceMirrorImpl mirror = |
290 _Mirrors.makeLocalInstanceMirror(invocation); | 313 _Mirrors.makeLocalInstanceMirror(invocation); |
291 _invokeOnClosure = | 314 _invokeOnClosure = |
292 _LocalObjectMirrorImpl._getField(mirror.type, '_invokeOnClosure') | 315 reflectClass(invocation.runtimeType).getField(const Symbol('_invokeOnC losure')).reflectee; |
293 .reflectee; | |
294 } | 316 } |
295 return _invokeOnClosure(reflectee, invocation); | 317 return _invokeOnClosure(reflectee, invocation); |
296 } | 318 } |
297 | 319 |
298 String toString() => 'InstanceMirror on ${Error.safeToString(_reflectee)}'; | 320 String toString() => 'InstanceMirror on ${Error.safeToString(_reflectee)}'; |
321 | |
322 _invoke(reflectee, functionName, positionalArguments) | |
323 native 'InstanceMirror_invoke'; | |
324 | |
325 _invokeGetter(reflectee, getterName) | |
326 native 'InstanceMirror_invokeGetter'; | |
327 | |
328 _invokeSetter(reflectee, setterName, value) | |
329 native 'InstanceMirror_invokeSetter'; | |
299 } | 330 } |
300 | 331 |
301 class _LocalClosureMirrorImpl extends _LocalInstanceMirrorImpl | 332 class _LocalClosureMirrorImpl extends _LocalInstanceMirrorImpl |
302 implements ClosureMirror { | 333 implements ClosureMirror { |
303 _LocalClosureMirrorImpl(ref, | 334 _LocalClosureMirrorImpl(ref, |
304 type, | 335 type, |
305 reflectee, | 336 reflectee, |
306 this.function) : super(ref, type, reflectee) {} | 337 this.function) : super(ref, type, reflectee) {} |
307 | 338 |
308 final MethodMirror function; | 339 final MethodMirror function; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 } | 404 } |
374 return resolved; | 405 return resolved; |
375 } | 406 } |
376 | 407 |
377 final String libraryUrl; | 408 final String libraryUrl; |
378 final Symbol typeName; | 409 final Symbol typeName; |
379 } | 410 } |
380 | 411 |
381 class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl | 412 class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl |
382 implements ClassMirror { | 413 implements ClassMirror { |
383 _LocalClassMirrorImpl(this._reflectee, | 414 _LocalClassMirrorImpl(reflectee, |
384 ref, | 415 ref, |
385 String simpleName, | 416 String simpleName, |
386 this.isClass, | 417 this.isClass, |
387 this._owner, | 418 this._owner, |
388 this._superclass, | 419 this._superclass, |
389 this._superinterfaces, | 420 this._superinterfaces, |
390 this._defaultFactory, | 421 this._defaultFactory, |
391 Map<String, Mirror> members, | 422 Map<String, Mirror> members, |
392 Map<String, Mirror> constructors, | 423 Map<String, Mirror> constructors, |
393 Map<String, Mirror> typeVariables) | 424 Map<String, Mirror> typeVariables) |
394 : this._simpleName = _s(simpleName), | 425 : this._simpleName = _s(simpleName), |
395 this.members = _convertStringToSymbolMap(members), | 426 this.members = _convertStringToSymbolMap(members), |
396 this.constructors = _convertStringToSymbolMap(constructors), | 427 this.constructors = _convertStringToSymbolMap(constructors), |
397 this.typeVariables = _convertStringToSymbolMap(typeVariables), | 428 this.typeVariables = _convertStringToSymbolMap(typeVariables), |
398 super(ref); | 429 super(reflectee, ref); |
399 | |
400 final _MirrorReference _reflectee; | |
401 | 430 |
402 Symbol _simpleName; | 431 Symbol _simpleName; |
403 Symbol get simpleName { | 432 Symbol get simpleName { |
404 // dynamic, void and the function types have their names set eagerly in the | 433 // dynamic, void and the function types have their names set eagerly in the |
405 // constructor. | 434 // constructor. |
406 if(_simpleName == null) { | 435 if(_simpleName == null) { |
407 _simpleName = _s(_ClassMirror_name(_reflectee)); | 436 _simpleName = _s(_name(_reflectee)); |
408 } | 437 } |
409 return _simpleName; | 438 return _simpleName; |
410 } | 439 } |
411 | 440 |
412 Symbol _qualifiedName = null; | 441 Symbol _qualifiedName = null; |
413 Symbol get qualifiedName { | 442 Symbol get qualifiedName { |
414 if (_qualifiedName == null) { | 443 if (_qualifiedName == null) { |
415 _qualifiedName = _computeQualifiedName(owner, simpleName); | 444 _qualifiedName = _computeQualifiedName(owner, simpleName); |
416 } | 445 } |
417 return _qualifiedName; | 446 return _qualifiedName; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
531 return "$prettyName on '${_n(simpleName)}'"; | 560 return "$prettyName on '${_n(simpleName)}'"; |
532 } | 561 } |
533 | 562 |
534 InstanceMirror newInstance(Symbol constructorName, | 563 InstanceMirror newInstance(Symbol constructorName, |
535 List positionalArguments, | 564 List positionalArguments, |
536 [Map<Symbol, dynamic> namedArguments]) { | 565 [Map<Symbol, dynamic> namedArguments]) { |
537 if (namedArguments != null) { | 566 if (namedArguments != null) { |
538 throw new UnimplementedError( | 567 throw new UnimplementedError( |
539 'named argument support is not implemented'); | 568 'named argument support is not implemented'); |
540 } | 569 } |
541 return _invokeConstructor(this, | 570 return reflect(_invokeConstructor(_reflectee, |
542 _n(constructorName), | 571 _n(constructorName), |
543 positionalArguments, | 572 positionalArguments.toList(growable:false) )); |
544 false); | |
545 } | 573 } |
546 | 574 |
547 Future<InstanceMirror> newInstanceAsync(Symbol constructorName, | 575 Future<InstanceMirror> newInstanceAsync(Symbol constructorName, |
548 List positionalArguments, | 576 List positionalArguments, |
549 [Map<Symbol, dynamic> namedArguments]) { | 577 [Map<Symbol, dynamic> namedArguments]) { |
550 if (namedArguments != null) { | 578 if (namedArguments != null) { |
551 throw new UnimplementedError( | 579 throw new UnimplementedError( |
552 'named argument support is not implemented'); | 580 'named argument support is not implemented'); |
553 } | 581 } |
554 // Walk the arguments and make sure they are legal. | 582 |
555 for (int i = 0; i < positionalArguments.length; i++) { | |
556 var arg = positionalArguments[i]; | |
557 _LocalObjectMirrorImpl._validateArgument(i, arg); | |
558 } | |
559 try { | 583 try { |
560 return new Future<InstanceMirror>.value( | 584 var result = _invokeConstructor(_reflectee, |
561 _invokeConstructor(this, | 585 _n(constructorName), |
562 _n(constructorName), | 586 _unwarpAsyncPositionals(positionalArgument s)); |
563 positionalArguments, | 587 return new Future.value(reflect(result)); |
564 true)); | 588 } on MirroredError catch(e) { |
565 } catch (exception) { | 589 return new Future.error(e); |
566 return new Future<InstanceMirror>.error(exception); | |
567 } | 590 } |
568 } | 591 } |
569 | 592 |
570 // get the metadata objects, convert them into InstanceMirrors using | 593 // get the metadata objects, convert them into InstanceMirrors using |
571 // reflect() and then make them into a Dart list | 594 // reflect() and then make them into a Dart list |
572 List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList(); | 595 List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList(); |
573 | 596 |
574 static _invokeConstructor(ref, constructorName, positionalArguments, async) | |
575 native 'LocalClassMirrorImpl_invokeConstructor'; | |
576 | 597 |
577 static String _ClassMirror_name(reflectee) | 598 static _name(reflectee) |
578 native "ClassMirror_name"; | 599 native "ClassMirror_name"; |
600 | |
601 _invoke(reflectee, memberName, positionalArguments) | |
602 native 'ClassMirror_invoke'; | |
603 | |
604 _invokeGetter(reflectee, getterName) | |
605 native 'ClassMirror_invokeGetter'; | |
606 | |
607 _invokeSetter(reflectee, setterName, value) | |
608 native 'ClassMirror_invokeSetter'; | |
siva
2013/07/11 23:50:59
The implementation of these native methods does no
| |
609 | |
610 static _invokeConstructor(reflectee, constructorName, positionalArguments) | |
611 native 'ClassMirror_invokeConstructor'; | |
579 } | 612 } |
580 | 613 |
581 class _LazyFunctionTypeMirror { | 614 class _LazyFunctionTypeMirror { |
582 _LazyFunctionTypeMirror(this.returnType, this.parameters) {} | 615 _LazyFunctionTypeMirror(this.returnType, this.parameters) {} |
583 | 616 |
584 ClassMirror resolve(MirrorSystem mirrors) { | 617 ClassMirror resolve(MirrorSystem mirrors) { |
585 return mirrors._lookupFunctionTypeMirror(returnType.resolve(mirrors), | 618 return mirrors._lookupFunctionTypeMirror(returnType.resolve(mirrors), |
586 parameters); | 619 parameters); |
587 } | 620 } |
588 | 621 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
736 | 769 |
737 LibraryMirror resolve(MirrorSystem mirrors) { | 770 LibraryMirror resolve(MirrorSystem mirrors) { |
738 return mirrors.libraries[Uri.parse(libraryUrl)]; | 771 return mirrors.libraries[Uri.parse(libraryUrl)]; |
739 } | 772 } |
740 | 773 |
741 final String libraryUrl; | 774 final String libraryUrl; |
742 } | 775 } |
743 | 776 |
744 class _LocalLibraryMirrorImpl extends _LocalObjectMirrorImpl | 777 class _LocalLibraryMirrorImpl extends _LocalObjectMirrorImpl |
745 implements LibraryMirror { | 778 implements LibraryMirror { |
746 _LocalLibraryMirrorImpl(ref, | 779 _LocalLibraryMirrorImpl(reflectee, |
780 ref, | |
747 String simpleName, | 781 String simpleName, |
748 String url, | 782 String url, |
749 Map<String, Mirror> members) | 783 Map<String, Mirror> members) |
750 : this.simpleName = _s(simpleName), | 784 : this.simpleName = _s(simpleName), |
751 this.members = _convertStringToSymbolMap(members), | 785 this.members = _convertStringToSymbolMap(members), |
752 this.uri = Uri.parse(url), | 786 this.uri = Uri.parse(url), |
753 super(ref); | 787 super(reflectee, ref); |
754 | 788 |
755 final Symbol simpleName; | 789 final Symbol simpleName; |
756 | 790 |
757 // The simple name and the qualified name are the same for a library. | 791 // The simple name and the qualified name are the same for a library. |
758 Symbol get qualifiedName => simpleName; | 792 Symbol get qualifiedName => simpleName; |
759 | 793 |
760 // Always null for libraries. | 794 // Always null for libraries. |
761 final DeclarationMirror owner = null; | 795 final DeclarationMirror owner = null; |
762 | 796 |
763 // Always false for libraries. | 797 // Always false for libraries. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
818 (key, value) => (value is VariableMirror)); | 852 (key, value) => (value is VariableMirror)); |
819 } | 853 } |
820 return _variables; | 854 return _variables; |
821 } | 855 } |
822 | 856 |
823 // get the metadata objects, convert them into InstanceMirrors using | 857 // get the metadata objects, convert them into InstanceMirrors using |
824 // reflect() and then make them into a Dart list | 858 // reflect() and then make them into a Dart list |
825 List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList(); | 859 List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList(); |
826 | 860 |
827 String toString() => "LibraryMirror on '${_n(simpleName)}'"; | 861 String toString() => "LibraryMirror on '${_n(simpleName)}'"; |
862 | |
863 _invoke(reflectee, memberName, positionalArguments) | |
864 native 'LibraryMirror_invoke'; | |
865 _invokeGetter(reflectee, getterName) | |
866 native 'LibraryMirror_invokeGetter'; | |
867 _invokeSetter(reflectee, setterName, value) | |
868 native 'LibraryMirror_invokeSetter'; | |
siva
2013/07/11 23:50:59
Ditto question about static methods.
| |
828 } | 869 } |
829 | 870 |
830 class _LocalMethodMirrorImpl extends _LocalMirrorImpl | 871 class _LocalMethodMirrorImpl extends _LocalMirrorImpl |
831 implements MethodMirror { | 872 implements MethodMirror { |
832 _LocalMethodMirrorImpl(this._reflectee, | 873 _LocalMethodMirrorImpl(this._reflectee, |
833 this._owner, | 874 this._owner, |
834 this.parameters, | 875 this.parameters, |
835 this._returnType, | 876 this._returnType, |
836 this.isStatic, | 877 this.isStatic, |
837 this.isAbstract, | 878 this.isAbstract, |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1066 } | 1107 } |
1067 | 1108 |
1068 // Creates a new local ClassMirror. | 1109 // Creates a new local ClassMirror. |
1069 static ClassMirror makeLocalClassMirror(Type key) | 1110 static ClassMirror makeLocalClassMirror(Type key) |
1070 native "Mirrors_makeLocalClassMirror"; | 1111 native "Mirrors_makeLocalClassMirror"; |
1071 | 1112 |
1072 static ClassMirror reflectClass(Type key) { | 1113 static ClassMirror reflectClass(Type key) { |
1073 return makeLocalClassMirror(key); | 1114 return makeLocalClassMirror(key); |
1074 } | 1115 } |
1075 } | 1116 } |
OLD | NEW |