| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this | 1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in | 2 // source code is governed by a BSD-style license that can be found in |
| 3 // the LICENSE file. | 3 // the LICENSE file. |
| 4 | 4 |
| 5 /// Implementation of the reflectable interface using dart mirrors. | 5 /// Implementation of the reflectable interface using dart mirrors. |
| 6 library reflectable.src.reflectable_implementation; | 6 library reflectable.src.reflectable_implementation; |
| 7 | 7 |
| 8 import 'dart:mirrors' as dm; | 8 import 'dart:mirrors' as dm; |
| 9 import 'reflectable_base.dart'; | 9 import 'reflectable_base.dart'; |
| 10 import '../capability.dart'; | 10 import '../capability.dart'; |
| 11 import '../mirrors.dart' as rm; | 11 import '../mirrors.dart' as rm; |
| 12 import '../reflectable.dart'; | 12 import '../reflectable.dart'; |
| 13 | 13 |
| 14 bool get isTransformed => false; | 14 bool get isTransformed => false; |
| 15 | 15 |
| 16 /// The name of the reflectable library. | 16 /// The name of the reflectable library. |
| 17 const Symbol reflectableLibrarySymbol = #reflectable.reflectable; | 17 const Symbol reflectableLibrarySymbol = #reflectable.reflectable; |
| 18 | 18 |
| 19 rm.ClassMirror wrapClassMirror( | 19 rm.ClassMirror wrapClassMirror( |
| 20 dm.ClassMirror classMirror, ReflectableImpl reflectable) { | 20 dm.ClassMirror classMirror, ReflectableImpl reflectable) { |
| 21 if (classMirror is dm.FunctionTypeMirror) { | 21 if (classMirror is dm.FunctionTypeMirror) { |
| 22 return new _FunctionTypeMirrorImpl(classMirror, reflectable); | 22 return new _FunctionTypeMirrorImpl(classMirror, reflectable); |
| 23 } else { | 23 } else { |
| 24 assert(classMirror is dm.ClassMirror); | 24 assert(classMirror is dm.ClassMirror); |
| 25 return new _ClassMirrorImpl(classMirror, reflectable); | 25 return new ClassMirrorImpl(classMirror, reflectable); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 | 28 |
| 29 rm.DeclarationMirror wrapDeclarationMirror( | 29 rm.DeclarationMirror wrapDeclarationMirror( |
| 30 dm.DeclarationMirror declarationMirror, ReflectableImpl reflectable) { | 30 dm.DeclarationMirror declarationMirror, ReflectableImpl reflectable) { |
| 31 if (declarationMirror is dm.MethodMirror) { | 31 if (declarationMirror is dm.MethodMirror) { |
| 32 return new _MethodMirrorImpl(declarationMirror, reflectable); | 32 return new MethodMirrorImpl(declarationMirror, reflectable); |
| 33 } else if (declarationMirror is dm.ParameterMirror) { | 33 } else if (declarationMirror is dm.ParameterMirror) { |
| 34 return new _ParameterMirrorImpl(declarationMirror, reflectable); | 34 return new _ParameterMirrorImpl(declarationMirror, reflectable); |
| 35 } else if (declarationMirror is dm.VariableMirror) { | 35 } else if (declarationMirror is dm.VariableMirror) { |
| 36 return new _VariableMirrorImpl(declarationMirror, reflectable); | 36 return new VariableMirrorImpl(declarationMirror, reflectable); |
| 37 } else if (declarationMirror is dm.TypeVariableMirror) { | 37 } else if (declarationMirror is dm.TypeVariableMirror) { |
| 38 return new _TypeVariableMirrorImpl(declarationMirror, reflectable); | 38 return new _TypeVariableMirrorImpl(declarationMirror, reflectable); |
| 39 } else if (declarationMirror is dm.TypedefMirror) { | 39 } else if (declarationMirror is dm.TypedefMirror) { |
| 40 return new _TypedefMirrorImpl(declarationMirror, reflectable); | 40 return new _TypedefMirrorImpl(declarationMirror, reflectable); |
| 41 } else if (declarationMirror is dm.ClassMirror) { | 41 } else if (declarationMirror is dm.ClassMirror) { |
| 42 // Covers FunctionTypeMirror and ClassMirror. | 42 // Covers FunctionTypeMirror and ClassMirror. |
| 43 return wrapClassMirror(declarationMirror, reflectable); | 43 return wrapClassMirror(declarationMirror, reflectable); |
| 44 } else { | 44 } else { |
| 45 assert(declarationMirror is dm.LibraryMirror); | 45 assert(declarationMirror is dm.LibraryMirror); |
| 46 return new _LibraryMirrorImpl(declarationMirror, reflectable); | 46 return new _LibraryMirrorImpl(declarationMirror, reflectable); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 68 return wrapClassMirror(m, reflectable); | 68 return wrapClassMirror(m, reflectable); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 rm.TypeMirror wrapTypeMirror( | 72 rm.TypeMirror wrapTypeMirror( |
| 73 dm.TypeMirror typeMirror, ReflectableImpl reflectable) { | 73 dm.TypeMirror typeMirror, ReflectableImpl reflectable) { |
| 74 if (typeMirror is dm.TypeVariableMirror) { | 74 if (typeMirror is dm.TypeVariableMirror) { |
| 75 return new _TypeVariableMirrorImpl(typeMirror, reflectable); | 75 return new _TypeVariableMirrorImpl(typeMirror, reflectable); |
| 76 } else if (typeMirror is dm.TypedefMirror) { | 76 } else if (typeMirror is dm.TypedefMirror) { |
| 77 return new _TypedefMirrorImpl(typeMirror, reflectable); | 77 return new _TypedefMirrorImpl(typeMirror, reflectable); |
| 78 } else if (typeMirror.reflectedType == dynamic) { |
| 79 return new _SpecialTypeMirrorImpl(typeMirror, reflectable); |
| 78 } else { | 80 } else { |
| 79 assert(typeMirror is dm.ClassMirror); | 81 assert(typeMirror is dm.ClassMirror); |
| 80 return wrapClassMirror(typeMirror, reflectable); | 82 return wrapClassMirror(typeMirror, reflectable); |
| 81 } | 83 } |
| 82 } | 84 } |
| 83 | 85 |
| 84 rm.CombinatorMirror wrapCombinatorMirror(dm.CombinatorMirror combinatorMirror) { | 86 rm.CombinatorMirror wrapCombinatorMirror(dm.CombinatorMirror combinatorMirror) { |
| 85 return new _CombinatorMirrorImpl(combinatorMirror); | 87 return new _CombinatorMirrorImpl(combinatorMirror); |
| 86 } | 88 } |
| 87 | 89 |
| 88 dm.ClassMirror unwrapClassMirror(rm.ClassMirror m) { | 90 dm.ClassMirror unwrapClassMirror(rm.ClassMirror m) { |
| 89 if (m is _ClassMirrorImpl) { | 91 if (m is ClassMirrorImpl) { |
| 90 // This also works for _FunctionTypeMirrorImpl | 92 // This also works for _FunctionTypeMirrorImpl |
| 91 return m._classMirror; | 93 return m._classMirror; |
| 92 } else { | 94 } else { |
| 93 throw new ArgumentError("Unexpected subtype of ClassMirror"); | 95 throw new ArgumentError("Unexpected subtype of ClassMirror"); |
| 94 } | 96 } |
| 95 } | 97 } |
| 96 | 98 |
| 97 dm.TypeMirror unwrapTypeMirror(rm.TypeMirror TypeMirror) { | 99 dm.TypeMirror unwrapTypeMirror(rm.TypeMirror TypeMirror) { |
| 98 if (TypeMirror is _TypeMirrorImpl) { | 100 if (TypeMirror is _TypeMirrorImpl) { |
| 99 return TypeMirror._typeMirror; | 101 return TypeMirror._typeMirror; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 declarationMirror.constructorName == nameSymbol; | 170 declarationMirror.constructorName == nameSymbol; |
| 169 }); | 171 }); |
| 170 if (constructorMirror == null || | 172 if (constructorMirror == null || |
| 171 !constructorMirror.isConstructor) return false; | 173 !constructorMirror.isConstructor) return false; |
| 172 return metadataSupported(constructorMirror.metadata, metadataCapability); | 174 return metadataSupported(constructorMirror.metadata, metadataCapability); |
| 173 } | 175 } |
| 174 return false; | 176 return false; |
| 175 }); | 177 }); |
| 176 } | 178 } |
| 177 | 179 |
| 180 bool reflectableSupportsDeclarations(Reflectable reflectable) { |
| 181 return reflectable.capabilities.any( |
| 182 (ReflectCapability capability) => capability == declarationsCapability); |
| 183 } |
| 184 |
| 178 /// Returns [setterName] with final "=" removed. | 185 /// Returns [setterName] with final "=" removed. |
| 179 /// If the it does not have a final "=" it is returned as is. | 186 /// If the it does not have a final "=" it is returned as is. |
| 180 String _setterToGetter(String setterName) { | 187 String _setterToGetter(String setterName) { |
| 181 if (!setterName.endsWith("=")) { | 188 if (!setterName.endsWith("=")) { |
| 182 return setterName; | 189 return setterName; |
| 183 } | 190 } |
| 184 return setterName.substring(0, setterName.length - 1); | 191 return setterName.substring(0, setterName.length - 1); |
| 185 } | 192 } |
| 186 | 193 |
| 187 /// Returns [getterName] with a final "=" added. | 194 /// Returns [getterName] with a final "=" added. |
| 188 /// If [getter] already ends with "=" an error is thrown. | 195 /// If [getter] already ends with "=" an error is thrown. |
| 189 String _getterToSetter(String getterName) { | 196 String _getterToSetter(String getterName) { |
| 190 if (getterName.endsWith("=")) { | 197 if (getterName.endsWith("=")) { |
| 191 throw new ArgumentError( | 198 throw new ArgumentError( |
| 192 "$getterName is a setter name (ends with `=`) already."); | 199 "$getterName is a setter name (ends with `=`) already."); |
| 193 } | 200 } |
| 194 return '$getterName='; | 201 return '$getterName='; |
| 195 } | 202 } |
| 196 | 203 |
| 204 bool _supportsType(List<ReflectCapability> capabilities) { |
| 205 return capabilities.any((ReflectCapability capability) => |
| 206 capability is TypeCapability || capabilities is TypingCapability); |
| 207 } |
| 208 |
| 197 abstract class _ObjectMirrorImplMixin implements rm.ObjectMirror { | 209 abstract class _ObjectMirrorImplMixin implements rm.ObjectMirror { |
| 198 ReflectableImpl get _reflectable; | 210 ReflectableImpl get _reflectable; |
| 199 } | 211 } |
| 200 | 212 |
| 201 class _LibraryMirrorImpl extends _DeclarationMirrorImpl | 213 class _LibraryMirrorImpl extends _DeclarationMirrorImpl |
| 202 with _ObjectMirrorImplMixin implements rm.LibraryMirror { | 214 with _ObjectMirrorImplMixin |
| 215 implements rm.LibraryMirror { |
| 203 dm.LibraryMirror get _libraryMirror => _declarationMirror; | 216 dm.LibraryMirror get _libraryMirror => _declarationMirror; |
| 204 | 217 |
| 205 _LibraryMirrorImpl(dm.LibraryMirror m, ReflectableImpl reflectable) | 218 _LibraryMirrorImpl(dm.LibraryMirror m, ReflectableImpl reflectable) |
| 206 : super(m, reflectable) {} | 219 : super(m, reflectable) {} |
| 207 | 220 |
| 208 @override | 221 @override |
| 209 Uri get uri => _libraryMirror.uri; | 222 Uri get uri => _libraryMirror.uri; |
| 210 | 223 |
| 211 @override | 224 @override |
| 212 Map<String, rm.DeclarationMirror> get declarations { | 225 Map<String, rm.DeclarationMirror> get declarations { |
| 226 if (!reflectableSupportsDeclarations(_reflectable)) { |
| 227 throw new NoSuchCapabilityError( |
| 228 "Attempt to get declarations without capability"); |
| 229 } |
| 213 Map<Symbol, dm.DeclarationMirror> decls = _libraryMirror.declarations; | 230 Map<Symbol, dm.DeclarationMirror> decls = _libraryMirror.declarations; |
| 214 Iterable<Symbol> relevantKeys = decls.keys.where((k) { | 231 Iterable<Symbol> relevantKeys = decls.keys.where((k) { |
| 215 List<dm.InstanceMirror> metadata = decls[k].metadata; | 232 List<dm.InstanceMirror> metadata = decls[k].metadata; |
| 216 for (var item in metadata) { | 233 for (var item in metadata) { |
| 217 if (item.hasReflectee && item.reflectee is ReflectableImpl) return true; | 234 if (item.hasReflectee && item.reflectee is ReflectableImpl) return true; |
| 218 } | 235 } |
| 219 return false; | 236 return false; |
| 220 }); | 237 }); |
| 221 return new Map<String, rm.DeclarationMirror>.fromIterable(relevantKeys, | 238 return new Map<String, rm.DeclarationMirror>.fromIterable(relevantKeys, |
| 222 key: (k) => dm.MirrorSystem.getName(k), | 239 key: (k) => dm.MirrorSystem.getName(k), |
| 223 value: (v) => wrapDeclarationMirror(decls[v], _reflectable)); | 240 value: (v) => wrapDeclarationMirror(decls[v], _reflectable)); |
| 224 } | 241 } |
| 225 | 242 |
| 226 @override | 243 @override |
| 227 Object invoke(String memberName, List positionalArguments, | 244 Object invoke(String memberName, List positionalArguments, |
| 228 [Map<Symbol, dynamic> namedArguments]) { | 245 [Map<Symbol, dynamic> namedArguments]) { |
| 229 if (!reflectableSupportsStaticInvoke(_reflectable, memberName, | 246 if (!reflectableSupportsStaticInvoke(_reflectable, memberName, |
| 230 _libraryMirror.declarations[new Symbol(memberName)].metadata)) { | 247 _libraryMirror.declarations[new Symbol(memberName)].metadata)) { |
| 231 throw new NoSuchInvokeCapabilityError( | 248 throw new NoSuchInvokeCapabilityError( |
| 232 _receiver, memberName, positionalArguments, namedArguments); | 249 _receiver, memberName, positionalArguments, namedArguments); |
| 233 } | 250 } |
| 234 | 251 |
| 235 return _libraryMirror.invoke( | 252 return _libraryMirror |
| 236 new Symbol(memberName), positionalArguments, namedArguments).reflectee; | 253 .invoke(new Symbol(memberName), positionalArguments, namedArguments) |
| 254 .reflectee; |
| 237 } | 255 } |
| 238 | 256 |
| 239 @override | 257 @override |
| 240 Object invokeGetter(String getterName) { | 258 Object invokeGetter(String getterName) { |
| 241 if (!reflectableSupportsStaticInvoke(_reflectable, getterName, | 259 if (!reflectableSupportsStaticInvoke(_reflectable, getterName, |
| 242 _libraryMirror.declarations[new Symbol(getterName)].metadata)) { | 260 _libraryMirror.declarations[new Symbol(getterName)].metadata)) { |
| 243 throw new NoSuchInvokeCapabilityError(_receiver, getterName, [], null); | 261 throw new NoSuchInvokeCapabilityError(_receiver, getterName, [], null); |
| 244 } | 262 } |
| 245 Symbol getterNameSymbol = new Symbol(getterName); | 263 Symbol getterNameSymbol = new Symbol(getterName); |
| 246 return _libraryMirror.getField(getterNameSymbol).reflectee; | 264 return _libraryMirror.getField(getterNameSymbol).reflectee; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 369 |
| 352 @override | 370 @override |
| 353 get reflectee => _instanceMirror.reflectee; | 371 get reflectee => _instanceMirror.reflectee; |
| 354 | 372 |
| 355 @override | 373 @override |
| 356 Object invoke(String memberName, List positionalArguments, | 374 Object invoke(String memberName, List positionalArguments, |
| 357 [Map<Symbol, dynamic> namedArguments]) { | 375 [Map<Symbol, dynamic> namedArguments]) { |
| 358 if (reflectableSupportsInstanceInvoke( | 376 if (reflectableSupportsInstanceInvoke( |
| 359 _reflectable, memberName, _instanceMirror.type)) { | 377 _reflectable, memberName, _instanceMirror.type)) { |
| 360 Symbol memberNameSymbol = new Symbol(memberName); | 378 Symbol memberNameSymbol = new Symbol(memberName); |
| 361 return _instanceMirror.invoke( | 379 return _instanceMirror |
| 362 memberNameSymbol, positionalArguments, namedArguments).reflectee; | 380 .invoke(memberNameSymbol, positionalArguments, namedArguments) |
| 381 .reflectee; |
| 363 } | 382 } |
| 364 throw new NoSuchInvokeCapabilityError( | 383 throw new NoSuchInvokeCapabilityError( |
| 365 _receiver, memberName, positionalArguments, namedArguments); | 384 _receiver, memberName, positionalArguments, namedArguments); |
| 366 } | 385 } |
| 367 | 386 |
| 368 @override | 387 @override |
| 369 Object invokeGetter(String fieldName) { | 388 Object invokeGetter(String fieldName) { |
| 370 if (reflectableSupportsInstanceInvoke( | 389 if (reflectableSupportsInstanceInvoke( |
| 371 _reflectable, fieldName, _instanceMirror.type)) { | 390 _reflectable, fieldName, _instanceMirror.type)) { |
| 372 Symbol fieldNameSymbol = new Symbol(fieldName); | 391 Symbol fieldNameSymbol = new Symbol(fieldName); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 396 | 415 |
| 397 @override | 416 @override |
| 398 delegate(Invocation invocation) => _instanceMirror.delegate(invocation); | 417 delegate(Invocation invocation) => _instanceMirror.delegate(invocation); |
| 399 | 418 |
| 400 get _receiver => _instanceMirror.reflectee; | 419 get _receiver => _instanceMirror.reflectee; |
| 401 | 420 |
| 402 @override | 421 @override |
| 403 String toString() => "_InstanceMirrorImpl('${_instanceMirror}')"; | 422 String toString() => "_InstanceMirrorImpl('${_instanceMirror}')"; |
| 404 } | 423 } |
| 405 | 424 |
| 406 class _ClassMirrorImpl extends _TypeMirrorImpl with _ObjectMirrorImplMixin | 425 class ClassMirrorImpl extends _TypeMirrorImpl |
| 426 with _ObjectMirrorImplMixin |
| 407 implements rm.ClassMirror { | 427 implements rm.ClassMirror { |
| 408 dm.ClassMirror get _classMirror => _declarationMirror; | 428 dm.ClassMirror get _classMirror => _declarationMirror; |
| 409 | 429 |
| 410 _ClassMirrorImpl(dm.ClassMirror cm, ReflectableImpl reflectable) | 430 ClassMirrorImpl(dm.ClassMirror cm, ReflectableImpl reflectable) |
| 411 : super(cm, reflectable) {} | 431 : super(cm, reflectable) {} |
| 412 | 432 |
| 413 @override | 433 @override |
| 414 List<rm.TypeVariableMirror> get typeVariables { | 434 List<rm.TypeVariableMirror> get typeVariables { |
| 415 return _classMirror.typeVariables.map((v) { | 435 return _classMirror.typeVariables.map((v) { |
| 416 return new _TypeVariableMirrorImpl(v, _reflectable); | 436 return new _TypeVariableMirrorImpl(v, _reflectable); |
| 417 }).toList(); | 437 }).toList(); |
| 418 } | 438 } |
| 419 | 439 |
| 420 @override | 440 @override |
| 421 List<rm.TypeMirror> get typeArguments => _classMirror.typeArguments.map((a) { | 441 List<rm.TypeMirror> get typeArguments => _classMirror.typeArguments.map((a) { |
| 422 return wrapTypeMirror(a, _reflectable); | 442 return wrapTypeMirror(a, _reflectable); |
| 423 }).toList(); | 443 }).toList(); |
| 424 | 444 |
| 425 @override | 445 @override |
| 426 rm.TypeMirror get superclass { | 446 rm.ClassMirror get superclass { |
| 427 dm.ClassMirror sup = _classMirror.superclass; | 447 dm.ClassMirror sup = _classMirror.superclass; |
| 428 if (sup == null) return null; // For `Object`, do as `dm`. | 448 if (sup == null) return null; // For `Object`, do as `dm`. |
| 429 return wrapClassMirror(sup, _reflectable); | 449 return wrapClassMirror(sup, _reflectable); |
| 430 } | 450 } |
| 431 | 451 |
| 432 @override | 452 @override |
| 433 List<rm.TypeMirror> get superinterfaces { | 453 List<rm.TypeMirror> get superinterfaces { |
| 434 List<dm.TypeMirror> superinterfaces = _classMirror.superinterfaces; | 454 List<dm.TypeMirror> superinterfaces = _classMirror.superinterfaces; |
| 435 return superinterfaces.map((dm.TypeMirror superInterface) { | 455 return superinterfaces.map((dm.TypeMirror superInterface) { |
| 436 return wrapTypeMirror(superInterface, _reflectable); | 456 return wrapTypeMirror(superInterface, _reflectable); |
| 437 }).toList(); | 457 }).toList(); |
| 438 } | 458 } |
| 439 | 459 |
| 440 @override | 460 @override |
| 441 bool get isAbstract => _classMirror.isAbstract; | 461 bool get isAbstract => _classMirror.isAbstract; |
| 442 | 462 |
| 443 @override | 463 @override |
| 444 Map<String, rm.DeclarationMirror> get declarations { | 464 Map<String, rm.DeclarationMirror> get declarations { |
| 465 if (!reflectableSupportsDeclarations(_reflectable)) { |
| 466 throw new NoSuchCapabilityError( |
| 467 "Attempt to get declarations without capability"); |
| 468 } |
| 445 // TODO(sigurdm) future: Possibly cache this. | 469 // TODO(sigurdm) future: Possibly cache this. |
| 446 Map<String, rm.DeclarationMirror> result = | 470 Map<String, rm.DeclarationMirror> result = |
| 447 new Map<String, rm.DeclarationMirror>(); | 471 new Map<String, rm.DeclarationMirror>(); |
| 448 _classMirror.declarations | 472 _classMirror.declarations |
| 449 .forEach((Symbol nameSymbol, dm.DeclarationMirror declarationMirror) { | 473 .forEach((Symbol nameSymbol, dm.DeclarationMirror declarationMirror) { |
| 450 String name = dm.MirrorSystem.getName(nameSymbol); | 474 String name = dm.MirrorSystem.getName(nameSymbol); |
| 451 if (declarationMirror is dm.MethodMirror) { | 475 if (declarationMirror is dm.MethodMirror) { |
| 452 bool included = false; | 476 bool included = false; |
| 453 if (declarationMirror.isConstructor) { | 477 if (declarationMirror.isConstructor) { |
| 454 // Factory constructors are static, others not, so this decision | 478 // Factory constructors are static, others not, so this decision |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 return result; | 530 return result; |
| 507 } | 531 } |
| 508 | 532 |
| 509 @override | 533 @override |
| 510 Map<String, rm.MethodMirror> get instanceMembers { | 534 Map<String, rm.MethodMirror> get instanceMembers { |
| 511 // TODO(sigurdm) implement: Only expose members that are allowed | 535 // TODO(sigurdm) implement: Only expose members that are allowed |
| 512 // by the capabilities of the reflectable. | 536 // by the capabilities of the reflectable. |
| 513 Map<Symbol, dm.MethodMirror> members = _classMirror.instanceMembers; | 537 Map<Symbol, dm.MethodMirror> members = _classMirror.instanceMembers; |
| 514 return new Map<String, rm.MethodMirror>.fromIterable(members.keys, | 538 return new Map<String, rm.MethodMirror>.fromIterable(members.keys, |
| 515 key: (k) => dm.MirrorSystem.getName(k), | 539 key: (k) => dm.MirrorSystem.getName(k), |
| 516 value: (v) => new _MethodMirrorImpl(members[v], _reflectable)); | 540 value: (v) => new MethodMirrorImpl(members[v], _reflectable)); |
| 517 } | 541 } |
| 518 | 542 |
| 519 @override | 543 @override |
| 520 Map<String, rm.MethodMirror> get staticMembers { | 544 Map<String, rm.MethodMirror> get staticMembers { |
| 521 // TODO(sigurdm) implement: Only expose members that are allowed by the | 545 // TODO(sigurdm) implement: Only expose members that are allowed by the |
| 522 // capabilities of the reflectable. | 546 // capabilities of the reflectable. |
| 523 Map<Symbol, dm.MethodMirror> members = _classMirror.staticMembers; | 547 Map<Symbol, dm.MethodMirror> members = _classMirror.staticMembers; |
| 524 return new Map<String, rm.MethodMirror>.fromIterable(members.keys, | 548 return new Map<String, rm.MethodMirror>.fromIterable(members.keys, |
| 525 key: (k) => dm.MirrorSystem.getName(k), | 549 key: (k) => dm.MirrorSystem.getName(k), |
| 526 value: (v) => new _MethodMirrorImpl(members[v], _reflectable)); | 550 value: (v) => new MethodMirrorImpl(members[v], _reflectable)); |
| 527 } | 551 } |
| 528 | 552 |
| 529 @override | 553 @override |
| 530 rm.TypeMirror get mixin => wrapTypeMirror(_classMirror.mixin, _reflectable); | 554 rm.TypeMirror get mixin => wrapTypeMirror(_classMirror.mixin, _reflectable); |
| 531 | 555 |
| 532 @override | 556 @override |
| 533 Object newInstance(String constructorName, List positionalArguments, | 557 Object newInstance(String constructorName, List positionalArguments, |
| 534 [Map<Symbol, dynamic> namedArguments]) { | 558 [Map<Symbol, dynamic> namedArguments]) { |
| 535 if (!reflectableSupportsConstructorInvoke( | 559 if (!reflectableSupportsConstructorInvoke( |
| 536 _reflectable, _classMirror, constructorName)) { | 560 _reflectable, _classMirror, constructorName)) { |
| 537 throw new NoSuchInvokeCapabilityError( | 561 throw new NoSuchInvokeCapabilityError( |
| 538 _classMirror, constructorName, positionalArguments, namedArguments); | 562 _classMirror, constructorName, positionalArguments, namedArguments); |
| 539 } | 563 } |
| 540 Symbol constructorNameSymbol = new Symbol(constructorName); | 564 Symbol constructorNameSymbol = new Symbol(constructorName); |
| 541 return _classMirror.newInstance( | 565 return _classMirror |
| 542 constructorNameSymbol, positionalArguments, namedArguments).reflectee; | 566 .newInstance(constructorNameSymbol, positionalArguments, namedArguments) |
| 567 .reflectee; |
| 543 } | 568 } |
| 544 | 569 |
| 545 @override | 570 @override |
| 546 Object invoke(String memberName, List positionalArguments, | 571 Object invoke(String memberName, List positionalArguments, |
| 547 [Map<Symbol, dynamic> namedArguments]) { | 572 [Map<Symbol, dynamic> namedArguments]) { |
| 548 dm.DeclarationMirror declaration = | 573 dm.DeclarationMirror declaration = |
| 549 _classMirror.declarations[new Symbol(memberName)]; | 574 _classMirror.declarations[new Symbol(memberName)]; |
| 550 List<Object> metadata = declaration == null ? null : declaration.metadata; | 575 List<Object> metadata = declaration == null ? null : declaration.metadata; |
| 551 if (reflectableSupportsStaticInvoke(_reflectable, memberName, metadata)) { | 576 if (reflectableSupportsStaticInvoke(_reflectable, memberName, metadata)) { |
| 552 Symbol memberNameSymbol = new Symbol(memberName); | 577 Symbol memberNameSymbol = new Symbol(memberName); |
| 553 return _classMirror.invoke( | 578 return _classMirror |
| 554 memberNameSymbol, positionalArguments, namedArguments).reflectee; | 579 .invoke(memberNameSymbol, positionalArguments, namedArguments) |
| 580 .reflectee; |
| 555 } | 581 } |
| 556 throw new NoSuchInvokeCapabilityError( | 582 throw new NoSuchInvokeCapabilityError( |
| 557 _receiver, memberName, positionalArguments, namedArguments); | 583 _receiver, memberName, positionalArguments, namedArguments); |
| 558 } | 584 } |
| 559 | 585 |
| 560 @override | 586 @override |
| 561 Object invokeGetter(String getterName) { | 587 Object invokeGetter(String getterName) { |
| 562 if (reflectableSupportsStaticInvoke(_reflectable, getterName, | 588 if (reflectableSupportsStaticInvoke(_reflectable, getterName, |
| 563 _classMirror.declarations[new Symbol(getterName)].metadata)) { | 589 _classMirror.declarations[new Symbol(getterName)].metadata)) { |
| 564 Symbol getterNameSymbol = new Symbol(getterName); | 590 Symbol getterNameSymbol = new Symbol(getterName); |
| 565 return _classMirror.getField(getterNameSymbol).reflectee; | 591 return _classMirror.getField(getterNameSymbol).reflectee; |
| 566 } | 592 } |
| 567 throw new NoSuchInvokeCapabilityError(_receiver, getterName, [], null); | 593 throw new NoSuchInvokeCapabilityError(_receiver, getterName, [], null); |
| 568 } | 594 } |
| 569 | 595 |
| 570 @override | 596 @override |
| 571 Object invokeSetter(String setterName, Object value) { | 597 Object invokeSetter(String setterName, Object value) { |
| 572 if (reflectableSupportsStaticInvoke(_reflectable, setterName, | 598 if (reflectableSupportsStaticInvoke(_reflectable, setterName, |
| 573 _classMirror.declarations[new Symbol(setterName)].metadata)) { | 599 _classMirror.declarations[new Symbol(setterName)].metadata)) { |
| 574 String getterName = _setterToGetter(setterName); | 600 String getterName = _setterToGetter(setterName); |
| 575 Symbol getterNameSymbol = new Symbol(getterName); | 601 Symbol getterNameSymbol = new Symbol(getterName); |
| 576 return _classMirror.setField(getterNameSymbol, value).reflectee; | 602 return _classMirror.setField(getterNameSymbol, value).reflectee; |
| 577 } | 603 } |
| 578 throw new NoSuchInvokeCapabilityError(_receiver, setterName, [value], null); | 604 throw new NoSuchInvokeCapabilityError(_receiver, setterName, [value], null); |
| 579 } | 605 } |
| 580 | 606 |
| 581 @override | 607 @override |
| 582 bool operator ==(other) { | 608 bool operator ==(other) { |
| 583 return other is _ClassMirrorImpl | 609 return other is ClassMirrorImpl |
| 584 ? _classMirror == other._classMirror | 610 ? _classMirror == other._classMirror |
| 585 : false; | 611 : false; |
| 586 } | 612 } |
| 587 | 613 |
| 588 @override | 614 @override |
| 589 int get hashCode => _classMirror.hashCode; | 615 int get hashCode => _classMirror.hashCode; |
| 590 | 616 |
| 591 @override | 617 @override |
| 592 bool isSubclassOf(rm.ClassMirror other) { | 618 bool isSubclassOf(rm.ClassMirror other) { |
| 593 return _classMirror.isSubclassOf(unwrapClassMirror(other)); | 619 return _classMirror.isSubclassOf(unwrapClassMirror(other)); |
| 594 } | 620 } |
| 595 | 621 |
| 596 get _receiver => _classMirror.reflectedType; | 622 get _receiver => _classMirror.reflectedType; |
| 597 | 623 |
| 598 @override | 624 @override |
| 599 String toString() => "_ClassMirrorImpl('${_classMirror}')"; | 625 String toString() => "ClassMirrorImpl('${_classMirror}')"; |
| 600 | 626 |
| 601 @override | 627 @override |
| 602 Function invoker(String memberName) { | 628 Function invoker(String memberName) { |
| 603 Symbol memberNameSymbol = new Symbol(memberName); | 629 Symbol memberNameSymbol = new Symbol(memberName); |
| 604 Function helper(Object o) { | 630 Function helper(Object o) { |
| 605 dm.InstanceMirror receiverMirror = dm.reflect(o); | 631 dm.InstanceMirror receiverMirror = dm.reflect(o); |
| 606 dm.InstanceMirror memberMirror = | 632 dm.InstanceMirror memberMirror = |
| 607 receiverMirror.getField(memberNameSymbol); | 633 receiverMirror.getField(memberNameSymbol); |
| 608 return memberMirror.reflectee; | 634 return memberMirror.reflectee; |
| 609 } | 635 } |
| 610 return helper; | 636 return helper; |
| 611 } | 637 } |
| 612 } | 638 } |
| 613 | 639 |
| 614 class _FunctionTypeMirrorImpl extends _ClassMirrorImpl | 640 class _FunctionTypeMirrorImpl extends ClassMirrorImpl |
| 615 implements rm.FunctionTypeMirror { | 641 implements rm.FunctionTypeMirror { |
| 616 dm.FunctionTypeMirror get _functionTypeMirror => _classMirror; | 642 dm.FunctionTypeMirror get _functionTypeMirror => _classMirror; |
| 617 | 643 |
| 618 _FunctionTypeMirrorImpl( | 644 _FunctionTypeMirrorImpl( |
| 619 dm.FunctionTypeMirror functionTypeMirror, ReflectableImpl reflectable) | 645 dm.FunctionTypeMirror functionTypeMirror, ReflectableImpl reflectable) |
| 620 : super(functionTypeMirror, reflectable); | 646 : super(functionTypeMirror, reflectable); |
| 621 | 647 |
| 622 @override | 648 @override |
| 623 rm.MethodMirror get callMethod { | 649 rm.MethodMirror get callMethod { |
| 624 return new _MethodMirrorImpl(_functionTypeMirror.callMethod, _reflectable); | 650 return new MethodMirrorImpl(_functionTypeMirror.callMethod, _reflectable); |
| 625 } | 651 } |
| 626 | 652 |
| 627 @override | 653 @override |
| 628 List<rm.ParameterMirror> get parameters { | 654 List<rm.ParameterMirror> get parameters { |
| 629 return _functionTypeMirror.parameters | 655 return _functionTypeMirror.parameters |
| 630 .map((dm.ParameterMirror parameterMirror) { | 656 .map((dm.ParameterMirror parameterMirror) { |
| 631 return new _ParameterMirrorImpl(parameterMirror, _reflectable); | 657 return new _ParameterMirrorImpl(parameterMirror, _reflectable); |
| 632 }); | 658 }); |
| 633 } | 659 } |
| 634 | 660 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 rm.SourceLocation get location { | 701 rm.SourceLocation get location { |
| 676 return new _SourceLocationImpl(_declarationMirror.location); | 702 return new _SourceLocationImpl(_declarationMirror.location); |
| 677 } | 703 } |
| 678 | 704 |
| 679 @override | 705 @override |
| 680 String toString() { | 706 String toString() { |
| 681 return "_DeclarationMirrorImpl('${_declarationMirror}')"; | 707 return "_DeclarationMirrorImpl('${_declarationMirror}')"; |
| 682 } | 708 } |
| 683 } | 709 } |
| 684 | 710 |
| 685 class _MethodMirrorImpl extends _DeclarationMirrorImpl | 711 class MethodMirrorImpl extends _DeclarationMirrorImpl |
| 686 implements rm.MethodMirror { | 712 implements rm.MethodMirror { |
| 687 dm.MethodMirror get _methodMirror => _declarationMirror; | 713 dm.MethodMirror get _methodMirror => _declarationMirror; |
| 688 | 714 |
| 689 _MethodMirrorImpl(dm.MethodMirror mm, ReflectableImpl reflectable) | 715 MethodMirrorImpl(dm.MethodMirror mm, ReflectableImpl reflectable) |
| 690 : super(mm, reflectable); | 716 : super(mm, reflectable); |
| 691 | 717 |
| 692 @override | 718 @override |
| 693 rm.TypeMirror get returnType => | 719 rm.TypeMirror get returnType => |
| 694 wrapTypeMirror(_methodMirror.returnType, _reflectable); | 720 wrapTypeMirror(_methodMirror.returnType, _reflectable); |
| 695 | 721 |
| 696 @override | 722 @override |
| 697 String get source => _methodMirror.source; | 723 String get source => _methodMirror.source; |
| 698 | 724 |
| 699 @override | 725 @override |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 bool get isGenerativeConstructor => _methodMirror.isGenerativeConstructor; | 764 bool get isGenerativeConstructor => _methodMirror.isGenerativeConstructor; |
| 739 | 765 |
| 740 @override | 766 @override |
| 741 bool get isRedirectingConstructor => _methodMirror.isRedirectingConstructor; | 767 bool get isRedirectingConstructor => _methodMirror.isRedirectingConstructor; |
| 742 | 768 |
| 743 @override | 769 @override |
| 744 bool get isFactoryConstructor => _methodMirror.isFactoryConstructor; | 770 bool get isFactoryConstructor => _methodMirror.isFactoryConstructor; |
| 745 | 771 |
| 746 @override | 772 @override |
| 747 bool operator ==(other) { | 773 bool operator ==(other) { |
| 748 return other is _MethodMirrorImpl | 774 return other is MethodMirrorImpl |
| 749 ? _methodMirror == other._methodMirror | 775 ? _methodMirror == other._methodMirror |
| 750 : false; | 776 : false; |
| 751 } | 777 } |
| 752 | 778 |
| 753 @override | 779 @override |
| 754 int get hashCode => _methodMirror.hashCode; | 780 int get hashCode => _methodMirror.hashCode; |
| 755 | 781 |
| 756 @override | 782 @override |
| 757 String toString() => "_MethodMirrorImpl('${_methodMirror}')"; | 783 String toString() => "_MethodMirrorImpl('${_methodMirror}')"; |
| 758 } | 784 } |
| 759 | 785 |
| 760 class _ClosureMirrorImpl extends _InstanceMirrorImpl | 786 class _ClosureMirrorImpl extends _InstanceMirrorImpl |
| 761 implements rm.ClosureMirror { | 787 implements rm.ClosureMirror { |
| 762 dm.ClosureMirror get _closureMirror => _instanceMirror; | 788 dm.ClosureMirror get _closureMirror => _instanceMirror; |
| 763 | 789 |
| 764 _ClosureMirrorImpl( | 790 _ClosureMirrorImpl( |
| 765 dm.ClosureMirror closureMirror, ReflectableImpl reflectable) | 791 dm.ClosureMirror closureMirror, ReflectableImpl reflectable) |
| 766 : super(closureMirror, reflectable); | 792 : super(closureMirror, reflectable); |
| 767 | 793 |
| 768 @override | 794 @override |
| 769 Object apply(List positionalArguments, | 795 Object apply(List positionalArguments, |
| 770 [Map<Symbol, dynamic> namedArguments]) { | 796 [Map<Symbol, dynamic> namedArguments]) { |
| 771 return _closureMirror.apply(positionalArguments, namedArguments).reflectee; | 797 return _closureMirror.apply(positionalArguments, namedArguments).reflectee; |
| 772 } | 798 } |
| 773 | 799 |
| 774 @override | 800 @override |
| 775 rm.MethodMirror get function { | 801 rm.MethodMirror get function { |
| 776 return new _MethodMirrorImpl(_closureMirror.function, _reflectable); | 802 return new MethodMirrorImpl(_closureMirror.function, _reflectable); |
| 777 } | 803 } |
| 778 | 804 |
| 779 @override | 805 @override |
| 780 String toString() => "_ClosureMirrorImpl('${_closureMirror}')"; | 806 String toString() => "_ClosureMirrorImpl('${_closureMirror}')"; |
| 781 } | 807 } |
| 782 | 808 |
| 783 class _VariableMirrorImpl extends _DeclarationMirrorImpl | 809 class VariableMirrorImpl extends _DeclarationMirrorImpl |
| 784 implements rm.VariableMirror { | 810 implements rm.VariableMirror { |
| 785 dm.VariableMirror get _variableMirror => _declarationMirror; | 811 dm.VariableMirror get _variableMirror => _declarationMirror; |
| 786 | 812 |
| 787 _VariableMirrorImpl(dm.VariableMirror vm, ReflectableImpl reflectable) | 813 VariableMirrorImpl(dm.VariableMirror vm, ReflectableImpl reflectable) |
| 788 : super(vm, reflectable); | 814 : super(vm, reflectable); |
| 789 | 815 |
| 790 @override | 816 @override |
| 791 rm.TypeMirror get type => wrapTypeMirror(_variableMirror.type, _reflectable); | 817 rm.TypeMirror get type { |
| 818 if (_supportsType(_reflectable.capabilities)) { |
| 819 return wrapTypeMirror(_variableMirror.type, _reflectable); |
| 820 } |
| 821 throw new NoSuchCapabilityError("Attempt to get a type without capability"); |
| 822 } |
| 792 | 823 |
| 793 @override | 824 @override |
| 794 bool get isStatic => _variableMirror.isStatic; | 825 bool get isStatic => _variableMirror.isStatic; |
| 795 | 826 |
| 796 @override | 827 @override |
| 797 bool get isFinal => _variableMirror.isFinal; | 828 bool get isFinal => _variableMirror.isFinal; |
| 798 | 829 |
| 799 @override | 830 @override |
| 800 bool get isConst => _variableMirror.isConst; | 831 bool get isConst => _variableMirror.isConst; |
| 801 | 832 |
| 802 @override | 833 @override |
| 803 bool operator ==(other) => other is _VariableMirrorImpl | 834 bool operator ==(other) => other is VariableMirrorImpl |
| 804 ? _variableMirror == other._variableMirror | 835 ? _variableMirror == other._variableMirror |
| 805 : false; | 836 : false; |
| 806 | 837 |
| 807 @override | 838 @override |
| 808 int get hashCode => _variableMirror.hashCode; | 839 int get hashCode => _variableMirror.hashCode; |
| 809 | 840 |
| 810 @override | 841 @override |
| 811 String toString() => "_VariableMirrorImpl('${_variableMirror}')"; | 842 String toString() => "VariableMirrorImpl('${_variableMirror}')"; |
| 812 } | 843 } |
| 813 | 844 |
| 814 class _ParameterMirrorImpl extends _VariableMirrorImpl | 845 class _ParameterMirrorImpl extends VariableMirrorImpl |
| 815 implements rm.ParameterMirror { | 846 implements rm.ParameterMirror { |
| 816 dm.ParameterMirror get _parameterMirror => _declarationMirror; | 847 dm.ParameterMirror get _parameterMirror => _declarationMirror; |
| 817 | 848 |
| 818 _ParameterMirrorImpl(dm.ParameterMirror pm, ReflectableImpl reflectable) | 849 _ParameterMirrorImpl(dm.ParameterMirror pm, ReflectableImpl reflectable) |
| 819 : super(pm, reflectable); | 850 : super(pm, reflectable); |
| 820 | 851 |
| 821 @override | 852 @override |
| 822 bool get isOptional => _parameterMirror.isOptional; | 853 bool get isOptional => _parameterMirror.isOptional; |
| 823 | 854 |
| 824 @override | 855 @override |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 | 975 |
| 945 @override | 976 @override |
| 946 int get hashCode => _typedefMirror.hashCode; | 977 int get hashCode => _typedefMirror.hashCode; |
| 947 | 978 |
| 948 @override | 979 @override |
| 949 String toString() { | 980 String toString() { |
| 950 return "_TypedefMirrorImpl('${_typedefMirror}')"; | 981 return "_TypedefMirrorImpl('${_typedefMirror}')"; |
| 951 } | 982 } |
| 952 } | 983 } |
| 953 | 984 |
| 985 class _SpecialTypeMirrorImpl extends _TypeMirrorImpl { |
| 986 _SpecialTypeMirrorImpl(dm.TypeMirror typeMirror, ReflectableImpl reflectable) |
| 987 : super(typeMirror, reflectable); |
| 988 |
| 989 @override operator ==(other) { |
| 990 return other is _SpecialTypeMirrorImpl && other._typeMirror == _typeMirror; |
| 991 } |
| 992 |
| 993 @override |
| 994 int get hashCode => _typeMirror.hashCode; |
| 995 |
| 996 @override |
| 997 String toString() { |
| 998 return "_SpecialTypeMirrorImpl('${_typeMirror}')"; |
| 999 } |
| 1000 } |
| 1001 |
| 954 class _CombinatorMirrorImpl implements rm.CombinatorMirror { | 1002 class _CombinatorMirrorImpl implements rm.CombinatorMirror { |
| 955 dm.CombinatorMirror _combinatorMirror; | 1003 dm.CombinatorMirror _combinatorMirror; |
| 956 | 1004 |
| 957 _CombinatorMirrorImpl(this._combinatorMirror); | 1005 _CombinatorMirrorImpl(this._combinatorMirror); |
| 958 | 1006 |
| 959 @override | 1007 @override |
| 960 List<String> get identifiers => | 1008 List<String> get identifiers => |
| 961 _combinatorMirror.identifiers.map(dm.MirrorSystem.getName); | 1009 _combinatorMirror.identifiers.map(dm.MirrorSystem.getName); |
| 962 | 1010 |
| 963 @override | 1011 @override |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 // Fields holding capabilities; we use discrete fields rather than a list | 1062 // Fields holding capabilities; we use discrete fields rather than a list |
| 1015 // of fields because this allows us to use a syntax similar to a varargs | 1063 // of fields because this allows us to use a syntax similar to a varargs |
| 1016 // invocation as the superinitializer (omitting `<ReflectCapability>[]` and | 1064 // invocation as the superinitializer (omitting `<ReflectCapability>[]` and |
| 1017 // directly giving the elements of that list as constructor arguments). | 1065 // directly giving the elements of that list as constructor arguments). |
| 1018 // This will only work up to a fixed number of arguments (we have chosen | 1066 // This will only work up to a fixed number of arguments (we have chosen |
| 1019 // to support at most 10 arguments), and with a larger number of arguments | 1067 // to support at most 10 arguments), and with a larger number of arguments |
| 1020 // the fromList constructor must be used. | 1068 // the fromList constructor must be used. |
| 1021 | 1069 |
| 1022 /// Const constructor, to enable usage as metadata, allowing for varargs | 1070 /// Const constructor, to enable usage as metadata, allowing for varargs |
| 1023 /// style invocation with up to ten arguments. | 1071 /// style invocation with up to ten arguments. |
| 1024 const ReflectableImpl([ReflectCapability cap0 = null, | 1072 const ReflectableImpl( |
| 1025 ReflectCapability cap1 = null, ReflectCapability cap2 = null, | 1073 [ReflectCapability cap0 = null, |
| 1026 ReflectCapability cap3 = null, ReflectCapability cap4 = null, | 1074 ReflectCapability cap1 = null, |
| 1027 ReflectCapability cap5 = null, ReflectCapability cap6 = null, | 1075 ReflectCapability cap2 = null, |
| 1028 ReflectCapability cap7 = null, ReflectCapability cap8 = null, | 1076 ReflectCapability cap3 = null, |
| 1077 ReflectCapability cap4 = null, |
| 1078 ReflectCapability cap5 = null, |
| 1079 ReflectCapability cap6 = null, |
| 1080 ReflectCapability cap7 = null, |
| 1081 ReflectCapability cap8 = null, |
| 1029 ReflectCapability cap9 = null]) | 1082 ReflectCapability cap9 = null]) |
| 1030 : super(cap0, cap1, cap2, cap3, cap4, cap5, cap6, cap7, cap8, cap9); | 1083 : super(cap0, cap1, cap2, cap3, cap4, cap5, cap6, cap7, cap8, cap9); |
| 1031 | 1084 |
| 1032 const ReflectableImpl.fromList(List<ReflectCapability> capabilities) | 1085 const ReflectableImpl.fromList(List<ReflectCapability> capabilities) |
| 1033 : super.fromList(capabilities); | 1086 : super.fromList(capabilities); |
| 1034 | 1087 |
| 1035 /// Returns a mirror of the given object [reflectee] | 1088 /// Returns a mirror of the given object [reflectee] |
| 1036 @override | 1089 @override |
| 1037 rm.InstanceMirror reflect(Object o) { | 1090 rm.InstanceMirror reflect(Object o) { |
| 1038 dm.InstanceMirror mirror = dm.reflect(o); | 1091 dm.InstanceMirror mirror = dm.reflect(o); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 } | 1196 } |
| 1144 } | 1197 } |
| 1145 } | 1198 } |
| 1146 return result; | 1199 return result; |
| 1147 }); | 1200 }); |
| 1148 } | 1201 } |
| 1149 | 1202 |
| 1150 static Map<ReflectableImpl, Set<dm.ClassMirror>> _supportedClassesCache = | 1203 static Map<ReflectableImpl, Set<dm.ClassMirror>> _supportedClassesCache = |
| 1151 new Map<ReflectableImpl, Set<dm.ClassMirror>>(); | 1204 new Map<ReflectableImpl, Set<dm.ClassMirror>>(); |
| 1152 } | 1205 } |
| OLD | NEW |