OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart2js.mirrors; | 5 part of dart2js.mirrors; |
6 | 6 |
7 abstract class ClassMirrorMixin implements ClassSourceMirror { | 7 abstract class ClassMirrorMixin implements ClassSourceMirror { |
8 bool get hasReflectedType => false; | 8 bool get hasReflectedType => false; |
9 Type get reflectedType { | 9 Type get reflectedType { |
10 throw new UnsupportedError("ClassMirror.reflectedType is not supported."); | 10 throw new UnsupportedError("ClassMirror.reflectedType is not supported."); |
11 } | 11 } |
12 InstanceMirror newInstance(Symbol constructorName, | 12 |
13 List positionalArguments, | 13 InstanceMirror newInstance(Symbol constructorName, List positionalArguments, |
14 [Map<Symbol, dynamic> namedArguments]) { | 14 [Map<Symbol, dynamic> namedArguments]) { |
15 throw new UnsupportedError("ClassMirror.newInstance is not supported."); | 15 throw new UnsupportedError("ClassMirror.newInstance is not supported."); |
16 } | 16 } |
17 } | 17 } |
18 | 18 |
19 abstract class Dart2JsTypeMirror | 19 abstract class Dart2JsTypeMirror |
20 implements Dart2JsDeclarationMirror, TypeSourceMirror { | 20 implements Dart2JsDeclarationMirror, TypeSourceMirror { |
21 DartType get _type; | 21 DartType get _type; |
22 | 22 |
23 String get _simpleNameString => _type.name; | 23 String get _simpleNameString => _type.name; |
24 | 24 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 bool isAssignableTo(TypeMirror other) { | 58 bool isAssignableTo(TypeMirror other) { |
59 if (other is Dart2JsTypeMirror) { | 59 if (other is Dart2JsTypeMirror) { |
60 return mirrorSystem.compiler.types.isAssignable(this._type, other._type); | 60 return mirrorSystem.compiler.types.isAssignable(this._type, other._type); |
61 } else { | 61 } else { |
62 throw new ArgumentError(other); | 62 throw new ArgumentError(other); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 String toString() => _type.toString(); | 66 String toString() => _type.toString(); |
67 | |
68 } | 67 } |
69 | 68 |
70 /// Base implementations for mirrors on element based types. | 69 /// Base implementations for mirrors on element based types. |
71 abstract class Dart2JsTypeElementMirror | 70 abstract class Dart2JsTypeElementMirror extends Dart2JsElementMirror |
72 extends Dart2JsElementMirror | |
73 with Dart2JsTypeMirror | 71 with Dart2JsTypeMirror |
74 implements TypeSourceMirror { | 72 implements TypeSourceMirror { |
75 final DartType _type; | 73 final DartType _type; |
76 | 74 |
77 Dart2JsTypeElementMirror(Dart2JsMirrorSystem system, DartType type) | 75 Dart2JsTypeElementMirror(Dart2JsMirrorSystem system, DartType type) |
78 : super(system, type.element), | 76 : super(system, type.element), |
79 this._type = type; | 77 this._type = type; |
80 | 78 |
81 Dart2JsLibraryMirror get library { | 79 Dart2JsLibraryMirror get library { |
82 return mirrorSystem._getLibrary(_type.element.library); | 80 return mirrorSystem._getLibrary(_type.element.library); |
83 } | 81 } |
84 } | 82 } |
85 | 83 |
86 abstract class DeclarationMixin implements TypeMirror { | 84 abstract class DeclarationMixin implements TypeMirror { |
87 | |
88 bool get isOriginalDeclaration => true; | 85 bool get isOriginalDeclaration => true; |
89 | 86 |
90 TypeMirror get originalDeclaration => this; | 87 TypeMirror get originalDeclaration => this; |
91 | 88 |
92 List<TypeMirror> get typeArguments => const <TypeMirror>[]; | 89 List<TypeMirror> get typeArguments => const <TypeMirror>[]; |
93 } | 90 } |
94 | 91 |
95 abstract class Dart2JsGenericTypeMirror extends Dart2JsTypeElementMirror { | 92 abstract class Dart2JsGenericTypeMirror extends Dart2JsTypeElementMirror { |
96 List<TypeMirror> _typeArguments; | 93 List<TypeMirror> _typeArguments; |
97 List<TypeVariableMirror> _typeVariables; | 94 List<TypeVariableMirror> _typeVariables; |
(...skipping 19 matching lines...) Expand all Loading... |
117 } | 114 } |
118 } | 115 } |
119 } | 116 } |
120 return _typeArguments; | 117 return _typeArguments; |
121 } | 118 } |
122 | 119 |
123 List<TypeVariableMirror> get typeVariables { | 120 List<TypeVariableMirror> get typeVariables { |
124 if (_typeVariables == null) { | 121 if (_typeVariables == null) { |
125 _typeVariables = <TypeVariableMirror>[]; | 122 _typeVariables = <TypeVariableMirror>[]; |
126 for (TypeVariableType typeVariable in _element.typeVariables) { | 123 for (TypeVariableType typeVariable in _element.typeVariables) { |
127 _typeVariables.add( | 124 _typeVariables |
128 new Dart2JsTypeVariableMirror(mirrorSystem, typeVariable)); | 125 .add(new Dart2JsTypeVariableMirror(mirrorSystem, typeVariable)); |
129 } | 126 } |
130 } | 127 } |
131 return _typeVariables; | 128 return _typeVariables; |
132 } | 129 } |
133 | 130 |
134 Iterable<Dart2JsMemberMirror> _getDeclarationMirrors(Element element) { | 131 Iterable<Dart2JsMemberMirror> _getDeclarationMirrors(Element element) { |
135 if (element.isTypeVariable) { | 132 if (element.isTypeVariable) { |
136 assert(invariant(_element, _element == element.enclosingElement, | 133 assert(invariant(_element, _element == element.enclosingElement, |
137 message: 'Foreigned type variable element $element.')); | 134 message: 'Foreigned type variable element $element.')); |
138 for (Dart2JsTypeVariableMirror mirror in typeVariables) { | 135 for (Dart2JsTypeVariableMirror mirror in typeVariables) { |
139 if (mirror._element == element) return [mirror]; | 136 if (mirror._element == element) return [mirror]; |
140 } | 137 } |
141 } | 138 } |
142 return super._getDeclarationMirrors(element); | 139 return super._getDeclarationMirrors(element); |
143 } | 140 } |
144 | 141 |
145 TypeMirror _getTypeMirror(DartType type) { | 142 TypeMirror _getTypeMirror(DartType type) { |
146 return super._getTypeMirror( | 143 return super._getTypeMirror( |
147 type.subst(_type.typeArguments, _type.element.typeVariables)); | 144 type.subst(_type.typeArguments, _type.element.typeVariables)); |
148 } | 145 } |
149 | 146 |
150 TypeSourceMirror createInstantiation( | 147 TypeSourceMirror createInstantiation( |
151 List<TypeSourceMirror> newTypeArguments) { | 148 List<TypeSourceMirror> newTypeArguments) { |
152 if (newTypeArguments.isEmpty) return owner._getTypeMirror(_type.asRaw()); | 149 if (newTypeArguments.isEmpty) return owner._getTypeMirror(_type.asRaw()); |
153 if (newTypeArguments.length != typeVariables.length) { | 150 if (newTypeArguments.length != typeVariables.length) { |
154 throw new ArgumentError('Cannot create generic instantiation of $_type ' | 151 throw new ArgumentError('Cannot create generic instantiation of $_type ' |
155 'with ${newTypeArguments.length} arguments, ' | 152 'with ${newTypeArguments.length} arguments, ' |
156 'expect ${typeVariables.length} arguments.'); | 153 'expect ${typeVariables.length} arguments.'); |
157 } | 154 } |
158 List<DartType> builder = <DartType>[]; | 155 List<DartType> builder = <DartType>[]; |
159 for (TypeSourceMirror newTypeArgument in newTypeArguments) { | 156 for (TypeSourceMirror newTypeArgument in newTypeArguments) { |
160 if (newTypeArgument.isVoid) { | 157 if (newTypeArgument.isVoid) { |
161 throw new ArgumentError('Cannot use void as type argument.'); | 158 throw new ArgumentError('Cannot use void as type argument.'); |
162 } | 159 } |
163 if (newTypeArgument is Dart2JsTypeMirror) { | 160 if (newTypeArgument is Dart2JsTypeMirror) { |
164 builder.add(newTypeArgument._type); | 161 builder.add(newTypeArgument._type); |
165 } else { | 162 } else { |
166 throw new UnsupportedError( | 163 throw new UnsupportedError('Cannot create instantiation using a type ' |
167 'Cannot create instantiation using a type ' | |
168 'mirror from a different mirrorSystem implementation.'); | 164 'mirror from a different mirrorSystem implementation.'); |
169 } | 165 } |
170 } | 166 } |
171 return owner._getTypeMirror(_type.createInstantiation(builder)); | 167 return owner._getTypeMirror(_type.createInstantiation(builder)); |
172 } | 168 } |
173 } | 169 } |
174 | 170 |
175 class Dart2JsInterfaceTypeMirror | 171 class Dart2JsInterfaceTypeMirror extends Dart2JsGenericTypeMirror |
176 extends Dart2JsGenericTypeMirror | |
177 with ObjectMirrorMixin, ClassMirrorMixin, ContainerMixin | 172 with ObjectMirrorMixin, ClassMirrorMixin, ContainerMixin |
178 implements ClassMirror { | 173 implements ClassMirror { |
179 Dart2JsInterfaceTypeMirror(Dart2JsMirrorSystem system, | 174 Dart2JsInterfaceTypeMirror( |
180 InterfaceType interfaceType) | 175 Dart2JsMirrorSystem system, InterfaceType interfaceType) |
181 : super(system, interfaceType); | 176 : super(system, interfaceType); |
182 | 177 |
183 ClassElement get _element => super._element; | 178 ClassElement get _element => super._element; |
184 | 179 |
185 InterfaceType get _type => super._type; | 180 InterfaceType get _type => super._type; |
186 | 181 |
187 bool get isNameSynthetic { | 182 bool get isNameSynthetic { |
188 if (_element.isMixinApplication) { | 183 if (_element.isMixinApplication) { |
189 MixinApplicationElement mixinApplication = _element; | 184 MixinApplicationElement mixinApplication = _element; |
190 return mixinApplication.isUnnamedMixinApplication; | 185 return mixinApplication.isUnnamedMixinApplication; |
191 } | 186 } |
192 return false; | 187 return false; |
193 } | 188 } |
194 | 189 |
195 void _forEachElement(f(Element element)) { | 190 void _forEachElement(f(Element element)) { |
196 _element.forEachMember((_, element) => f(element)); | 191 _element.forEachMember((_, element) => f(element)); |
197 } | 192 } |
198 | 193 |
199 ClassMirror get superclass { | 194 ClassMirror get superclass { |
200 if (_element.supertype != null) { | 195 if (_element.supertype != null) { |
201 return _getTypeMirror(_element.supertype); | 196 return _getTypeMirror(_element.supertype); |
202 } | 197 } |
203 return null; | 198 return null; |
204 } | 199 } |
205 | 200 |
206 bool isSubclassOf(Mirror other) { | 201 bool isSubclassOf(Mirror other) { |
207 if (other is Dart2JsTypeMirror) { | 202 if (other is Dart2JsTypeMirror) { |
208 return other._type.element != null && | 203 return other._type.element != null && |
209 _element.isSubclassOf(other._type.element); | 204 _element.isSubclassOf(other._type.element); |
210 } else { | 205 } else { |
211 throw new ArgumentError(other); | 206 throw new ArgumentError(other); |
212 } | 207 } |
213 } | 208 } |
214 | 209 |
215 ClassMirror get mixin { | 210 ClassMirror get mixin { |
216 if (_element.isMixinApplication) { | 211 if (_element.isMixinApplication) { |
217 MixinApplicationElement mixinApplication = _element; | 212 MixinApplicationElement mixinApplication = _element; |
218 return _getTypeMirror(mixinApplication.mixinType); | 213 return _getTypeMirror(mixinApplication.mixinType); |
219 } | 214 } |
(...skipping 24 matching lines...) Expand all Loading... |
244 } | 239 } |
245 if (other is! ClassMirror) { | 240 if (other is! ClassMirror) { |
246 return false; | 241 return false; |
247 } | 242 } |
248 return _type == other._type; | 243 return _type == other._type; |
249 } | 244 } |
250 | 245 |
251 String toString() => 'Mirror on interface type $_type'; | 246 String toString() => 'Mirror on interface type $_type'; |
252 } | 247 } |
253 | 248 |
254 class Dart2JsClassDeclarationMirror | 249 class Dart2JsClassDeclarationMirror extends Dart2JsInterfaceTypeMirror |
255 extends Dart2JsInterfaceTypeMirror | |
256 with DeclarationMixin { | 250 with DeclarationMixin { |
257 | 251 Dart2JsClassDeclarationMirror(Dart2JsMirrorSystem system, InterfaceType type) |
258 Dart2JsClassDeclarationMirror(Dart2JsMirrorSystem system, | |
259 InterfaceType type) | |
260 : super(system, type); | 252 : super(system, type); |
261 | 253 |
262 bool isSubclassOf(ClassMirror other) { | 254 bool isSubclassOf(ClassMirror other) { |
263 if (other is Dart2JsClassDeclarationMirror) { | 255 if (other is Dart2JsClassDeclarationMirror) { |
264 Dart2JsClassDeclarationMirror otherDeclaration = | 256 Dart2JsClassDeclarationMirror otherDeclaration = |
265 other.originalDeclaration; | 257 other.originalDeclaration; |
266 return _element.isSubclassOf(otherDeclaration._element); | 258 return _element.isSubclassOf(otherDeclaration._element); |
267 } else if (other is FunctionTypeMirror) { | 259 } else if (other is FunctionTypeMirror) { |
268 return false; | 260 return false; |
269 } | 261 } |
270 throw new ArgumentError(other); | 262 throw new ArgumentError(other); |
271 } | 263 } |
272 | 264 |
273 String toString() => 'Mirror on class ${_type.name}'; | 265 String toString() => 'Mirror on class ${_type.name}'; |
274 } | 266 } |
275 | 267 |
276 class Dart2JsTypedefMirror | 268 class Dart2JsTypedefMirror extends Dart2JsGenericTypeMirror |
277 extends Dart2JsGenericTypeMirror | |
278 implements TypedefMirror { | 269 implements TypedefMirror { |
279 final Dart2JsLibraryMirror _library; | 270 final Dart2JsLibraryMirror _library; |
280 List<TypeVariableMirror> _typeVariables; | 271 List<TypeVariableMirror> _typeVariables; |
281 var _definition; | 272 var _definition; |
282 | 273 |
283 Dart2JsTypedefMirror(Dart2JsMirrorSystem system, TypedefType _typedef) | 274 Dart2JsTypedefMirror(Dart2JsMirrorSystem system, TypedefType _typedef) |
284 : this._library = system._getLibrary(_typedef.element.library), | 275 : this._library = system._getLibrary(_typedef.element.library), |
285 super(system, _typedef); | 276 super(system, _typedef); |
286 | 277 |
287 Dart2JsTypedefMirror.fromLibrary(Dart2JsLibraryMirror library, | 278 Dart2JsTypedefMirror.fromLibrary( |
288 TypedefType _typedef) | 279 Dart2JsLibraryMirror library, TypedefType _typedef) |
289 : this._library = library, | 280 : this._library = library, |
290 super(library.mirrorSystem, _typedef); | 281 super(library.mirrorSystem, _typedef); |
291 | 282 |
292 TypedefType get _typedef => _type; | 283 TypedefType get _typedef => _type; |
293 | 284 |
294 LibraryMirror get library => _library; | 285 LibraryMirror get library => _library; |
295 | 286 |
296 bool get isTypedef => true; | 287 bool get isTypedef => true; |
297 | 288 |
298 FunctionTypeMirror get referent { | 289 FunctionTypeMirror get referent { |
299 if (_definition == null) { | 290 if (_definition == null) { |
300 _definition = _getTypeMirror(_typedef.element.alias); | 291 _definition = _getTypeMirror(_typedef.element.alias); |
301 } | 292 } |
302 return _definition; | 293 return _definition; |
303 } | 294 } |
304 | 295 |
305 bool get isClass => false; | 296 bool get isClass => false; |
306 | 297 |
307 bool get isAbstract => false; | 298 bool get isAbstract => false; |
308 | 299 |
309 bool get isEnum => throw new UnimplementedError(); | 300 bool get isEnum => throw new UnimplementedError(); |
310 | 301 |
311 String toString() => 'Mirror on typedef $_type'; | 302 String toString() => 'Mirror on typedef $_type'; |
312 } | 303 } |
313 | 304 |
314 class Dart2JsTypedefDeclarationMirror | 305 class Dart2JsTypedefDeclarationMirror extends Dart2JsTypedefMirror |
315 extends Dart2JsTypedefMirror | |
316 with DeclarationMixin { | 306 with DeclarationMixin { |
317 Dart2JsTypedefDeclarationMirror(Dart2JsMirrorSystem system, | 307 Dart2JsTypedefDeclarationMirror(Dart2JsMirrorSystem system, TypedefType type) |
318 TypedefType type) | |
319 : super(system, type); | 308 : super(system, type); |
320 | 309 |
321 String toString() => 'Mirror on typedef ${_type.name}'; | 310 String toString() => 'Mirror on typedef ${_type.name}'; |
322 } | 311 } |
323 | 312 |
324 class Dart2JsTypeVariableMirror extends Dart2JsTypeElementMirror | 313 class Dart2JsTypeVariableMirror extends Dart2JsTypeElementMirror |
325 implements TypeVariableMirror { | 314 implements TypeVariableMirror { |
326 Dart2JsDeclarationMirror _owner; | 315 Dart2JsDeclarationMirror _owner; |
327 | 316 |
328 Dart2JsTypeVariableMirror(Dart2JsMirrorSystem system, | 317 Dart2JsTypeVariableMirror( |
329 TypeVariableType typeVariableType) | 318 Dart2JsMirrorSystem system, TypeVariableType typeVariableType) |
330 : super(system, typeVariableType); | 319 : super(system, typeVariableType); |
331 | 320 |
332 TypeVariableType get _type => super._type; | 321 TypeVariableType get _type => super._type; |
333 | 322 |
334 Dart2JsDeclarationMirror get owner { | 323 Dart2JsDeclarationMirror get owner { |
335 if (_owner == null) { | 324 if (_owner == null) { |
336 _owner = mirrorSystem._getTypeDeclarationMirror( | 325 _owner = |
337 _type.element.typeDeclaration); | 326 mirrorSystem._getTypeDeclarationMirror(_type.element.typeDeclaration); |
338 } | 327 } |
339 return _owner; | 328 return _owner; |
340 } | 329 } |
341 | 330 |
342 bool get isStatic => false; | 331 bool get isStatic => false; |
343 | 332 |
344 TypeMirror get upperBound => owner._getTypeMirror(_type.element.bound); | 333 TypeMirror get upperBound => owner._getTypeMirror(_type.element.bound); |
345 | 334 |
346 bool operator ==(var other) { | 335 bool operator ==(var other) { |
347 if (identical(this, other)) { | 336 if (identical(this, other)) { |
348 return true; | 337 return true; |
349 } | 338 } |
350 if (other is! TypeVariableMirror) { | 339 if (other is! TypeVariableMirror) { |
351 return false; | 340 return false; |
352 } | 341 } |
353 if (owner != other.owner) { | 342 if (owner != other.owner) { |
354 return false; | 343 return false; |
355 } | 344 } |
356 return qualifiedName == other.qualifiedName; | 345 return qualifiedName == other.qualifiedName; |
357 } | 346 } |
358 | 347 |
359 String toString() => 'Mirror on type variable $_type'; | 348 String toString() => 'Mirror on type variable $_type'; |
360 } | 349 } |
361 | 350 |
362 class Dart2JsFunctionTypeMirror extends Dart2JsTypeElementMirror | 351 class Dart2JsFunctionTypeMirror extends Dart2JsTypeElementMirror |
363 with ObjectMirrorMixin, ClassMirrorMixin, DeclarationMixin | 352 with ObjectMirrorMixin, ClassMirrorMixin, DeclarationMixin |
364 implements FunctionTypeMirror { | 353 implements FunctionTypeMirror { |
365 List<ParameterMirror> _parameters; | 354 List<ParameterMirror> _parameters; |
366 | 355 |
367 Dart2JsFunctionTypeMirror(Dart2JsMirrorSystem system, | 356 Dart2JsFunctionTypeMirror( |
368 FunctionType functionType) | 357 Dart2JsMirrorSystem system, FunctionType functionType) |
369 : super(system, functionType) { | 358 : super(system, functionType) { |
370 assert (functionType.element != null); | 359 assert(functionType.element != null); |
371 } | 360 } |
372 | 361 |
373 FunctionType get _type => super._type; | 362 FunctionType get _type => super._type; |
374 | 363 |
375 // TODO(johnniwinther): Is this the qualified name of a function type? | 364 // TODO(johnniwinther): Is this the qualified name of a function type? |
376 Symbol get qualifiedName => originalDeclaration.qualifiedName; | 365 Symbol get qualifiedName => originalDeclaration.qualifiedName; |
377 | 366 |
378 // TODO(johnniwinther): Substitute type arguments for type variables. | 367 // TODO(johnniwinther): Substitute type arguments for type variables. |
379 Map<Symbol, DeclarationMirror> get declarations { | 368 Map<Symbol, DeclarationMirror> get declarations { |
380 var method = callMethod; | 369 var method = callMethod; |
381 if (method != null) { | 370 if (method != null) { |
382 var map = new Map<Symbol, DeclarationMirror>.from( | 371 var map = new Map<Symbol, DeclarationMirror>.from( |
383 originalDeclaration.declarations); | 372 originalDeclaration.declarations); |
384 var name = method.qualifiedName; | 373 var name = method.qualifiedName; |
385 assert(!map.containsKey(name)); | 374 assert(!map.containsKey(name)); |
386 map[name] = method; | 375 map[name] = method; |
387 return new UnmodifiableMapView<Symbol, DeclarationMirror>(map); | 376 return new UnmodifiableMapView<Symbol, DeclarationMirror>(map); |
388 } | 377 } |
389 return originalDeclaration.declarations; | 378 return originalDeclaration.declarations; |
390 } | 379 } |
391 | 380 |
392 bool get isFunction => true; | 381 bool get isFunction => true; |
393 | 382 |
394 MethodMirror get callMethod => _convertElementMethodToMethodMirror( | 383 MethodMirror get callMethod => _convertElementMethodToMethodMirror( |
395 mirrorSystem._getLibrary(_type.element.library), | 384 mirrorSystem._getLibrary(_type.element.library), _type.element); |
396 _type.element); | |
397 | 385 |
398 ClassMirror get originalDeclaration => | 386 ClassMirror get originalDeclaration => mirrorSystem._getTypeDeclarationMirror( |
399 mirrorSystem._getTypeDeclarationMirror( | 387 mirrorSystem.compiler.coreClasses.functionClass); |
400 mirrorSystem.compiler.coreClasses.functionClass); | |
401 | 388 |
402 // TODO(johnniwinther): Substitute type arguments for type variables. | 389 // TODO(johnniwinther): Substitute type arguments for type variables. |
403 ClassMirror get superclass => originalDeclaration.superclass; | 390 ClassMirror get superclass => originalDeclaration.superclass; |
404 | 391 |
405 // TODO(johnniwinther): Substitute type arguments for type variables. | 392 // TODO(johnniwinther): Substitute type arguments for type variables. |
406 List<ClassMirror> get superinterfaces => originalDeclaration.superinterfaces; | 393 List<ClassMirror> get superinterfaces => originalDeclaration.superinterfaces; |
407 | 394 |
408 Map<Symbol, MethodMirror> get instanceMembers => null; | 395 Map<Symbol, MethodMirror> get instanceMembers => null; |
409 Map<Symbol, MethodMirror> get staticMembers => null; | 396 Map<Symbol, MethodMirror> get staticMembers => null; |
410 | 397 |
(...skipping 23 matching lines...) Expand all Loading... |
434 bool isSubclassOf(ClassMirror other) => false; | 421 bool isSubclassOf(ClassMirror other) => false; |
435 } | 422 } |
436 | 423 |
437 /// Common superclass for mirrors on `dynamic` and `void`. | 424 /// Common superclass for mirrors on `dynamic` and `void`. |
438 abstract class Dart2JsBuiltinTypeMirror extends Dart2JsDeclarationMirror | 425 abstract class Dart2JsBuiltinTypeMirror extends Dart2JsDeclarationMirror |
439 with Dart2JsTypeMirror | 426 with Dart2JsTypeMirror |
440 implements TypeSourceMirror { | 427 implements TypeSourceMirror { |
441 final Dart2JsMirrorSystem mirrorSystem; | 428 final Dart2JsMirrorSystem mirrorSystem; |
442 final DartType _type; | 429 final DartType _type; |
443 | 430 |
444 Dart2JsBuiltinTypeMirror(Dart2JsMirrorSystem this.mirrorSystem, | 431 Dart2JsBuiltinTypeMirror( |
445 DartType this._type); | 432 Dart2JsMirrorSystem this.mirrorSystem, DartType this._type); |
446 | 433 |
447 Symbol get qualifiedName => simpleName; | 434 Symbol get qualifiedName => simpleName; |
448 | 435 |
449 /** | 436 /** |
450 * The builtin types have has no location. | 437 * The builtin types have has no location. |
451 */ | 438 */ |
452 SourceLocation get location => null; | 439 SourceLocation get location => null; |
453 | 440 |
454 /** | 441 /** |
455 * The builtin types have has no owner. | 442 * The builtin types have has no owner. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 if (other is! TypeMirror) { | 488 if (other is! TypeMirror) { |
502 return false; | 489 return false; |
503 } | 490 } |
504 return other.isDynamic; | 491 return other.isDynamic; |
505 } | 492 } |
506 | 493 |
507 int get hashCode => 13 * _type.hashCode; | 494 int get hashCode => 13 * _type.hashCode; |
508 | 495 |
509 String toString() => 'Mirror on dynamic'; | 496 String toString() => 'Mirror on dynamic'; |
510 } | 497 } |
OLD | NEW |