| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 _functionTypes[sigString] = mirror; | 88 _functionTypes[sigString] = mirror; |
| 89 } | 89 } |
| 90 return mirror; | 90 return mirror; |
| 91 } | 91 } |
| 92 | 92 |
| 93 String toString() => "MirrorSystem for isolate '${isolate.debugName}'"; | 93 String toString() => "MirrorSystem for isolate '${isolate.debugName}'"; |
| 94 } | 94 } |
| 95 | 95 |
| 96 abstract class _LocalMirrorImpl implements Mirror { | 96 abstract class _LocalMirrorImpl implements Mirror { |
| 97 int get hashCode { | 97 int get hashCode { |
| 98 throw new NotImplementedException('Mirror.hashCode is not implemented'); | 98 throw new UnimplementedError('Mirror.hashCode is not implemented'); |
| 99 } | 99 } |
| 100 | 100 |
| 101 // Local mirrors always return the same MirrorSystem. This field | 101 // Local mirrors always return the same MirrorSystem. This field |
| 102 // is more interesting once we implement remote mirrors. | 102 // is more interesting once we implement remote mirrors. |
| 103 MirrorSystem get mirrors => _Mirrors.currentMirrorSystem(); | 103 MirrorSystem get mirrors => _Mirrors.currentMirrorSystem(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 class _LocalIsolateMirrorImpl extends _LocalMirrorImpl | 106 class _LocalIsolateMirrorImpl extends _LocalMirrorImpl |
| 107 implements IsolateMirror { | 107 implements IsolateMirror { |
| 108 _LocalIsolateMirrorImpl(this.debugName, this._rootLibrary) {} | 108 _LocalIsolateMirrorImpl(this.debugName, this._rootLibrary) {} |
| (...skipping 28 matching lines...) Expand all Loading... |
| 137 } | 137 } |
| 138 | 138 |
| 139 abstract class _LocalObjectMirrorImpl extends _LocalVMObjectMirrorImpl | 139 abstract class _LocalObjectMirrorImpl extends _LocalVMObjectMirrorImpl |
| 140 implements ObjectMirror { | 140 implements ObjectMirror { |
| 141 _LocalObjectMirrorImpl(ref) : super(ref) {} | 141 _LocalObjectMirrorImpl(ref) : super(ref) {} |
| 142 | 142 |
| 143 Future<InstanceMirror> invoke(String memberName, | 143 Future<InstanceMirror> invoke(String memberName, |
| 144 List positionalArguments, | 144 List positionalArguments, |
| 145 [Map<String,Dynamic> namedArguments]) { | 145 [Map<String,Dynamic> namedArguments]) { |
| 146 if (namedArguments != null) { | 146 if (namedArguments != null) { |
| 147 throw new NotImplementedException( | 147 throw new UnimplementedError( |
| 148 'named argument support is not implemented'); | 148 'named argument support is not implemented'); |
| 149 } | 149 } |
| 150 // Walk the arguments and make sure they are legal. | 150 // Walk the arguments and make sure they are legal. |
| 151 for (int i = 0; i < positionalArguments.length; i++) { | 151 for (int i = 0; i < positionalArguments.length; i++) { |
| 152 var arg = positionalArguments[i]; | 152 var arg = positionalArguments[i]; |
| 153 _validateArgument(i, arg); | 153 _validateArgument(i, arg); |
| 154 } | 154 } |
| 155 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); | 155 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); |
| 156 try { | 156 try { |
| 157 completer.complete( | 157 completer.complete( |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 class _LocalClosureMirrorImpl extends _LocalInstanceMirrorImpl | 293 class _LocalClosureMirrorImpl extends _LocalInstanceMirrorImpl |
| 294 implements ClosureMirror { | 294 implements ClosureMirror { |
| 295 _LocalClosureMirrorImpl(ref, | 295 _LocalClosureMirrorImpl(ref, |
| 296 type, | 296 type, |
| 297 reflectee, | 297 reflectee, |
| 298 this.function) : super(ref, type, reflectee) {} | 298 this.function) : super(ref, type, reflectee) {} |
| 299 | 299 |
| 300 final MethodMirror function; | 300 final MethodMirror function; |
| 301 | 301 |
| 302 String get source { | 302 String get source { |
| 303 throw new NotImplementedException( | 303 throw new UnimplementedError( |
| 304 'ClosureMirror.source is not implemented'); | 304 'ClosureMirror.source is not implemented'); |
| 305 } | 305 } |
| 306 | 306 |
| 307 Future<InstanceMirror> apply(List<Object> positionalArguments, | 307 Future<InstanceMirror> apply(List<Object> positionalArguments, |
| 308 [Map<String,Object> namedArguments]) { | 308 [Map<String,Object> namedArguments]) { |
| 309 if (namedArguments != null) { | 309 if (namedArguments != null) { |
| 310 throw new NotImplementedException( | 310 throw new UnimplementedError( |
| 311 'named argument support is not implemented'); | 311 'named argument support is not implemented'); |
| 312 } | 312 } |
| 313 // Walk the arguments and make sure they are legal. | 313 // Walk the arguments and make sure they are legal. |
| 314 for (int i = 0; i < positionalArguments.length; i++) { | 314 for (int i = 0; i < positionalArguments.length; i++) { |
| 315 var arg = positionalArguments[i]; | 315 var arg = positionalArguments[i]; |
| 316 _LocalObjectMirrorImpl._validateArgument(i, arg); | 316 _LocalObjectMirrorImpl._validateArgument(i, arg); |
| 317 } | 317 } |
| 318 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); | 318 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); |
| 319 try { | 319 try { |
| 320 completer.complete( | 320 completer.complete( |
| 321 _apply(this, positionalArguments)); | 321 _apply(this, positionalArguments)); |
| 322 } catch (exception) { | 322 } catch (exception) { |
| 323 completer.completeException(exception); | 323 completer.completeException(exception); |
| 324 } | 324 } |
| 325 return completer.future; | 325 return completer.future; |
| 326 } | 326 } |
| 327 | 327 |
| 328 Future<InstanceMirror> findInContext(String name) { | 328 Future<InstanceMirror> findInContext(String name) { |
| 329 throw new NotImplementedException( | 329 throw new UnimplementedError( |
| 330 'ClosureMirror.findInContext() is not implemented'); | 330 'ClosureMirror.findInContext() is not implemented'); |
| 331 } | 331 } |
| 332 | 332 |
| 333 static _apply(ref, positionalArguments) | 333 static _apply(ref, positionalArguments) |
| 334 native 'LocalClosureMirrorImpl_apply'; | 334 native 'LocalClosureMirrorImpl_apply'; |
| 335 } | 335 } |
| 336 | 336 |
| 337 class _LazyTypeMirror { | 337 class _LazyTypeMirror { |
| 338 _LazyTypeMirror(this.libraryName, this.typeName) {} | 338 _LazyTypeMirror(this.libraryName, this.typeName) {} |
| 339 | 339 |
| 340 TypeMirror resolve(MirrorSystem mirrors) { | 340 TypeMirror resolve(MirrorSystem mirrors) { |
| 341 if (libraryName == null) { | 341 if (libraryName == null) { |
| 342 // TODO(turnidge): Remove support for 'Dynamic'. | 342 // TODO(turnidge): Remove support for 'Dynamic'. |
| 343 if ((typeName == 'dynamic') || (typeName == 'Dynamic')) { | 343 if ((typeName == 'dynamic') || (typeName == 'Dynamic')) { |
| 344 return mirrors.dynamicType; | 344 return mirrors.dynamicType; |
| 345 } else if (typeName == 'void') { | 345 } else if (typeName == 'void') { |
| 346 return mirrors.voidType; | 346 return mirrors.voidType; |
| 347 } else { | 347 } else { |
| 348 throw new NotImplementedException( | 348 throw new UnimplementedError( |
| 349 "Mirror for type '$typeName' is not implemented"); | 349 "Mirror for type '$typeName' is not implemented"); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 var resolved = mirrors.libraries[libraryName].members[typeName]; | 352 var resolved = mirrors.libraries[libraryName].members[typeName]; |
| 353 if (resolved == null) { | 353 if (resolved == null) { |
| 354 throw new NotImplementedException( | 354 throw new UnimplementedError( |
| 355 "Mirror for type '$typeName' is not implemented"); | 355 "Mirror for type '$typeName' is not implemented"); |
| 356 } | 356 } |
| 357 return resolved; | 357 return resolved; |
| 358 } | 358 } |
| 359 | 359 |
| 360 final String libraryName; | 360 final String libraryName; |
| 361 final String typeName; | 361 final String typeName; |
| 362 } | 362 } |
| 363 | 363 |
| 364 class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl | 364 class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 _owner = _owner.resolve(mirrors); | 396 _owner = _owner.resolve(mirrors); |
| 397 } | 397 } |
| 398 return _owner; | 398 return _owner; |
| 399 } | 399 } |
| 400 | 400 |
| 401 bool get isPrivate => simpleName.startsWith('_'); | 401 bool get isPrivate => simpleName.startsWith('_'); |
| 402 | 402 |
| 403 final bool isTopLevel = true; | 403 final bool isTopLevel = true; |
| 404 | 404 |
| 405 SourceLocation get location { | 405 SourceLocation get location { |
| 406 throw new NotImplementedException( | 406 throw new UnimplementedError( |
| 407 'ClassMirror.location is not implemented'); | 407 'ClassMirror.location is not implemented'); |
| 408 } | 408 } |
| 409 | 409 |
| 410 final bool isClass; | 410 final bool isClass; |
| 411 | 411 |
| 412 var _superclass; | 412 var _superclass; |
| 413 ClassMirror get superclass { | 413 ClassMirror get superclass { |
| 414 if (_superclass is! Mirror) { | 414 if (_superclass is! Mirror) { |
| 415 _superclass = _superclass.resolve(mirrors); | 415 _superclass = _superclass.resolve(mirrors); |
| 416 } | 416 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 members, | 478 members, |
| 479 (key, value) => (value is VariableMirror)); | 479 (key, value) => (value is VariableMirror)); |
| 480 } | 480 } |
| 481 return _variables; | 481 return _variables; |
| 482 } | 482 } |
| 483 | 483 |
| 484 Map<String, MethodMirror> constructors; | 484 Map<String, MethodMirror> constructors; |
| 485 Map<String, TypeVariableMirror> typeVariables; | 485 Map<String, TypeVariableMirror> typeVariables; |
| 486 | 486 |
| 487 Map<String, TypeMirror> get typeArguments { | 487 Map<String, TypeMirror> get typeArguments { |
| 488 throw new NotImplementedException( | 488 throw new UnimplementedError( |
| 489 'ClassMirror.typeArguments is not implemented'); | 489 'ClassMirror.typeArguments is not implemented'); |
| 490 } | 490 } |
| 491 | 491 |
| 492 bool get isOriginalDeclaration { | 492 bool get isOriginalDeclaration { |
| 493 throw new NotImplementedException( | 493 throw new UnimplementedError( |
| 494 'ClassMirror.isOriginalDeclaration is not implemented'); | 494 'ClassMirror.isOriginalDeclaration is not implemented'); |
| 495 } | 495 } |
| 496 | 496 |
| 497 ClassMirror get genericDeclaration { | 497 ClassMirror get genericDeclaration { |
| 498 throw new NotImplementedException( | 498 throw new UnimplementedError( |
| 499 'ClassMirror.originalDeclaration is not implemented'); | 499 'ClassMirror.originalDeclaration is not implemented'); |
| 500 } | 500 } |
| 501 | 501 |
| 502 String toString() => "ClassMirror on '$simpleName'"; | 502 String toString() => "ClassMirror on '$simpleName'"; |
| 503 | 503 |
| 504 Future<InstanceMirror> newInstance(String constructorName, | 504 Future<InstanceMirror> newInstance(String constructorName, |
| 505 List positionalArguments, | 505 List positionalArguments, |
| 506 [Map<String,Dynamic> namedArguments]) { | 506 [Map<String,Dynamic> namedArguments]) { |
| 507 if (namedArguments != null) { | 507 if (namedArguments != null) { |
| 508 throw new NotImplementedException( | 508 throw new UnimplementedError( |
| 509 'named argument support is not implemented'); | 509 'named argument support is not implemented'); |
| 510 } | 510 } |
| 511 // Walk the arguments and make sure they are legal. | 511 // Walk the arguments and make sure they are legal. |
| 512 for (int i = 0; i < positionalArguments.length; i++) { | 512 for (int i = 0; i < positionalArguments.length; i++) { |
| 513 var arg = positionalArguments[i]; | 513 var arg = positionalArguments[i]; |
| 514 _LocalObjectMirrorImpl._validateArgument(i, arg); | 514 _LocalObjectMirrorImpl._validateArgument(i, arg); |
| 515 } | 515 } |
| 516 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); | 516 Completer<InstanceMirror> completer = new Completer<InstanceMirror>(); |
| 517 try { | 517 try { |
| 518 completer.complete( | 518 completer.complete( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 _owner = _owner.resolve(mirrors); | 603 _owner = _owner.resolve(mirrors); |
| 604 } | 604 } |
| 605 return _owner; | 605 return _owner; |
| 606 } | 606 } |
| 607 | 607 |
| 608 bool get isPrivate => false; | 608 bool get isPrivate => false; |
| 609 | 609 |
| 610 final bool isTopLevel = false; | 610 final bool isTopLevel = false; |
| 611 | 611 |
| 612 SourceLocation get location { | 612 SourceLocation get location { |
| 613 throw new NotImplementedException( | 613 throw new UnimplementedError( |
| 614 'TypeVariableMirror.location is not implemented'); | 614 'TypeVariableMirror.location is not implemented'); |
| 615 } | 615 } |
| 616 | 616 |
| 617 var _upperBound; | 617 var _upperBound; |
| 618 TypeMirror get upperBound { | 618 TypeMirror get upperBound { |
| 619 if (_upperBound is! Mirror) { | 619 if (_upperBound is! Mirror) { |
| 620 _upperBound = _upperBound.resolve(mirrors); | 620 _upperBound = _upperBound.resolve(mirrors); |
| 621 } | 621 } |
| 622 return _upperBound; | 622 return _upperBound; |
| 623 } | 623 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 647 _owner = _owner.resolve(mirrors); | 647 _owner = _owner.resolve(mirrors); |
| 648 } | 648 } |
| 649 return _owner; | 649 return _owner; |
| 650 } | 650 } |
| 651 | 651 |
| 652 bool get isPrivate => false; | 652 bool get isPrivate => false; |
| 653 | 653 |
| 654 final bool isTopLevel = true; | 654 final bool isTopLevel = true; |
| 655 | 655 |
| 656 SourceLocation get location { | 656 SourceLocation get location { |
| 657 throw new NotImplementedException( | 657 throw new UnimplementedError( |
| 658 'TypedefMirror.location is not implemented'); | 658 'TypedefMirror.location is not implemented'); |
| 659 } | 659 } |
| 660 | 660 |
| 661 var _referent; | 661 var _referent; |
| 662 TypeMirror get referent { | 662 TypeMirror get referent { |
| 663 if (_referent is! Mirror) { | 663 if (_referent is! Mirror) { |
| 664 _referent = _referent.resolve(mirrors); | 664 _referent = _referent.resolve(mirrors); |
| 665 } | 665 } |
| 666 return _referent; | 666 return _referent; |
| 667 } | 667 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 695 // Always null for libraries. | 695 // Always null for libraries. |
| 696 final DeclarationMirror owner = null; | 696 final DeclarationMirror owner = null; |
| 697 | 697 |
| 698 // Always false for libraries. | 698 // Always false for libraries. |
| 699 final bool isPrivate = false; | 699 final bool isPrivate = false; |
| 700 | 700 |
| 701 // Always false for libraries. | 701 // Always false for libraries. |
| 702 final bool isTopLevel = false; | 702 final bool isTopLevel = false; |
| 703 | 703 |
| 704 SourceLocation get location { | 704 SourceLocation get location { |
| 705 throw new NotImplementedException( | 705 throw new UnimplementedError( |
| 706 'LibraryMirror.location is not implemented'); | 706 'LibraryMirror.location is not implemented'); |
| 707 } | 707 } |
| 708 | 708 |
| 709 final String url; | 709 final String url; |
| 710 final Map<String, Mirror> members; | 710 final Map<String, Mirror> members; |
| 711 | 711 |
| 712 Map<String, ClassMirror> _classes = null; | 712 Map<String, ClassMirror> _classes = null; |
| 713 Map<String, MethodMirror> _functions = null; | 713 Map<String, MethodMirror> _functions = null; |
| 714 Map<String, MethodMirror> _getters = null; | 714 Map<String, MethodMirror> _getters = null; |
| 715 Map<String, MethodMirror> _setters = null; | 715 Map<String, MethodMirror> _setters = null; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 return _owner; | 792 return _owner; |
| 793 } | 793 } |
| 794 | 794 |
| 795 bool get isPrivate { | 795 bool get isPrivate { |
| 796 return simpleName.startsWith('_') || constructorName.startsWith('_'); | 796 return simpleName.startsWith('_') || constructorName.startsWith('_'); |
| 797 } | 797 } |
| 798 | 798 |
| 799 bool get isTopLevel => owner is LibraryMirror; | 799 bool get isTopLevel => owner is LibraryMirror; |
| 800 | 800 |
| 801 SourceLocation get location { | 801 SourceLocation get location { |
| 802 throw new NotImplementedException( | 802 throw new UnimplementedError( |
| 803 'MethodMirror.location is not implemented'); | 803 'MethodMirror.location is not implemented'); |
| 804 } | 804 } |
| 805 | 805 |
| 806 var _returnType; | 806 var _returnType; |
| 807 TypeMirror get returnType { | 807 TypeMirror get returnType { |
| 808 if (_returnType is! Mirror) { | 808 if (_returnType is! Mirror) { |
| 809 _returnType = _returnType.resolve(mirrors); | 809 _returnType = _returnType.resolve(mirrors); |
| 810 } | 810 } |
| 811 return _returnType; | 811 return _returnType; |
| 812 } | 812 } |
| 813 | 813 |
| 814 final List<ParameterMirror> parameters; | 814 final List<ParameterMirror> parameters; |
| 815 | 815 |
| 816 final bool isStatic; | 816 final bool isStatic; |
| 817 final bool isAbstract; | 817 final bool isAbstract; |
| 818 | 818 |
| 819 bool get isRegularMethod => !isGetter && !isSetter && !isConstructor; | 819 bool get isRegularMethod => !isGetter && !isSetter && !isConstructor; |
| 820 | 820 |
| 821 TypeMirror get isOperator { | 821 TypeMirror get isOperator { |
| 822 throw new NotImplementedException( | 822 throw new UnimplementedError( |
| 823 'MethodMirror.isOperator is not implemented'); | 823 'MethodMirror.isOperator is not implemented'); |
| 824 } | 824 } |
| 825 | 825 |
| 826 final bool isGetter; | 826 final bool isGetter; |
| 827 final bool isSetter; | 827 final bool isSetter; |
| 828 final bool isConstructor; | 828 final bool isConstructor; |
| 829 | 829 |
| 830 var _constructorName = null; | 830 var _constructorName = null; |
| 831 String get constructorName { | 831 String get constructorName { |
| 832 if (_constructorName == null) { | 832 if (_constructorName == null) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 | 884 |
| 885 bool get isPrivate { | 885 bool get isPrivate { |
| 886 return simpleName.startsWith('_'); | 886 return simpleName.startsWith('_'); |
| 887 } | 887 } |
| 888 | 888 |
| 889 bool get isTopLevel { | 889 bool get isTopLevel { |
| 890 return owner is LibraryMirror; | 890 return owner is LibraryMirror; |
| 891 } | 891 } |
| 892 | 892 |
| 893 SourceLocation get location { | 893 SourceLocation get location { |
| 894 throw new NotImplementedException( | 894 throw new UnimplementedError( |
| 895 'VariableMirror.location is not implemented'); | 895 'VariableMirror.location is not implemented'); |
| 896 } | 896 } |
| 897 | 897 |
| 898 var _type; | 898 var _type; |
| 899 TypeMirror get type { | 899 TypeMirror get type { |
| 900 if (_type is! Mirror) { | 900 if (_type is! Mirror) { |
| 901 _type = _type.resolve(mirrors); | 901 _type = _type.resolve(mirrors); |
| 902 } | 902 } |
| 903 return _type; | 903 return _type; |
| 904 } | 904 } |
| 905 | 905 |
| 906 final bool isStatic; | 906 final bool isStatic; |
| 907 final bool isFinal; | 907 final bool isFinal; |
| 908 | 908 |
| 909 String toString() => "VariableMirror on '$simpleName'"; | 909 String toString() => "VariableMirror on '$simpleName'"; |
| 910 } | 910 } |
| 911 | 911 |
| 912 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl | 912 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl |
| 913 implements ParameterMirror { | 913 implements ParameterMirror { |
| 914 _LocalParameterMirrorImpl(type, this.isOptional) | 914 _LocalParameterMirrorImpl(type, this.isOptional) |
| 915 : super('<TODO:unnamed>', null, type, false, false) {} | 915 : super('<TODO:unnamed>', null, type, false, false) {} |
| 916 | 916 |
| 917 final bool isOptional; | 917 final bool isOptional; |
| 918 | 918 |
| 919 String get defaultValue { | 919 String get defaultValue { |
| 920 throw new NotImplementedException( | 920 throw new UnimplementedError( |
| 921 'ParameterMirror.defaultValue is not implemented'); | 921 'ParameterMirror.defaultValue is not implemented'); |
| 922 } | 922 } |
| 923 | 923 |
| 924 bool get hasDefaultValue { | 924 bool get hasDefaultValue { |
| 925 throw new NotImplementedException( | 925 throw new UnimplementedError( |
| 926 'ParameterMirror.hasDefaultValue is not implemented'); | 926 'ParameterMirror.hasDefaultValue is not implemented'); |
| 927 } | 927 } |
| 928 } | 928 } |
| 929 | 929 |
| 930 class _Mirrors { | 930 class _Mirrors { |
| 931 // Does a port refer to our local isolate? | 931 // Does a port refer to our local isolate? |
| 932 static bool isLocalPort(SendPort port) native 'Mirrors_isLocalPort'; | 932 static bool isLocalPort(SendPort port) native 'Mirrors_isLocalPort'; |
| 933 | 933 |
| 934 static MirrorSystem _currentMirrorSystem = null; | 934 static MirrorSystem _currentMirrorSystem = null; |
| 935 | 935 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 949 Completer<MirrorSystem> completer = new Completer<MirrorSystem>(); | 949 Completer<MirrorSystem> completer = new Completer<MirrorSystem>(); |
| 950 if (isLocalPort(port)) { | 950 if (isLocalPort(port)) { |
| 951 // Make a local mirror system. | 951 // Make a local mirror system. |
| 952 try { | 952 try { |
| 953 completer.complete(currentMirrorSystem()); | 953 completer.complete(currentMirrorSystem()); |
| 954 } catch (exception) { | 954 } catch (exception) { |
| 955 completer.completeException(exception); | 955 completer.completeException(exception); |
| 956 } | 956 } |
| 957 } else { | 957 } else { |
| 958 // Make a remote mirror system | 958 // Make a remote mirror system |
| 959 throw new NotImplementedException( | 959 throw new UnimplementedError( |
| 960 'Remote mirror support is not implemented'); | 960 'Remote mirror support is not implemented'); |
| 961 } | 961 } |
| 962 return completer.future; | 962 return completer.future; |
| 963 } | 963 } |
| 964 | 964 |
| 965 // Creates a new local InstanceMirror | 965 // Creates a new local InstanceMirror |
| 966 static InstanceMirror makeLocalInstanceMirror(Object reflectee) | 966 static InstanceMirror makeLocalInstanceMirror(Object reflectee) |
| 967 native 'Mirrors_makeLocalInstanceMirror'; | 967 native 'Mirrors_makeLocalInstanceMirror'; |
| 968 | 968 |
| 969 // Creates a new local mirror for some Object. | 969 // Creates a new local mirror for some Object. |
| 970 static InstanceMirror reflect(Object reflectee) { | 970 static InstanceMirror reflect(Object reflectee) { |
| 971 return makeLocalInstanceMirror(reflectee); | 971 return makeLocalInstanceMirror(reflectee); |
| 972 } | 972 } |
| 973 } | 973 } |
| OLD | NEW |