OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import '../common.dart'; | 5 import '../common.dart'; |
6 import '../elements/elements.dart'; | 6 import '../elements/elements.dart'; |
7 import '../elements/entities.dart'; | 7 import '../elements/entities.dart'; |
8 import '../elements/types.dart'; | 8 import '../elements/types.dart'; |
9 import '../tree/nodes.dart' as ast; | 9 import '../tree/nodes.dart' as ast; |
10 import '../types/masks.dart'; | 10 import '../types/masks.dart'; |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 _orderedTypeInformations.add(typeInformation); | 365 _orderedTypeInformations.add(typeInformation); |
366 return typeInformation; | 366 return typeInformation; |
367 }); | 367 }); |
368 } | 368 } |
369 | 369 |
370 MemberTypeInformation getInferredTypeOfMember(MemberElement member) { | 370 MemberTypeInformation getInferredTypeOfMember(MemberElement member) { |
371 member = member.implementation; | 371 member = member.implementation; |
372 return memberTypeInformations.putIfAbsent(member, () { | 372 return memberTypeInformations.putIfAbsent(member, () { |
373 MemberTypeInformation typeInformation; | 373 MemberTypeInformation typeInformation; |
374 if (member.isField) { | 374 if (member.isField) { |
375 typeInformation = new FieldTypeInformation(member); | 375 FieldElement field = member; |
| 376 typeInformation = new FieldTypeInformation(field, field.type); |
376 } else if (member.isGetter) { | 377 } else if (member.isGetter) { |
377 typeInformation = new GetterTypeInformation(member); | 378 GetterElement getter = member; |
| 379 typeInformation = new GetterTypeInformation(getter, getter.type); |
378 } else if (member.isSetter) { | 380 } else if (member.isSetter) { |
379 typeInformation = new SetterTypeInformation(member); | 381 SetterElement setter = member; |
| 382 typeInformation = new SetterTypeInformation(setter); |
380 } else if (member.isFunction) { | 383 } else if (member.isFunction) { |
381 typeInformation = new MethodTypeInformation(member); | 384 MethodElement method = member; |
| 385 typeInformation = new MethodTypeInformation(method, method.type); |
382 } else { | 386 } else { |
383 ConstructorElement constructor = member; | 387 ConstructorElement constructor = member; |
384 if (constructor.isFactoryConstructor) { | 388 if (constructor.isFactoryConstructor) { |
385 typeInformation = new FactoryConstructorTypeInformation(member); | 389 typeInformation = new FactoryConstructorTypeInformation( |
| 390 constructor, constructor.type); |
386 } else { | 391 } else { |
387 typeInformation = new GenerativeConstructorTypeInformation(member); | 392 typeInformation = |
| 393 new GenerativeConstructorTypeInformation(constructor); |
388 } | 394 } |
389 } | 395 } |
390 _orderedTypeInformations.add(typeInformation); | 396 _orderedTypeInformations.add(typeInformation); |
391 return typeInformation; | 397 return typeInformation; |
392 }); | 398 }); |
393 } | 399 } |
394 | 400 |
395 /** | 401 /** |
396 * Returns the internal inferrer representation for [mask]. | 402 * Returns the internal inferrer representation for [mask]. |
397 */ | 403 */ |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 TypeMask newType = null; | 624 TypeMask newType = null; |
619 for (TypeMask mask in list) { | 625 for (TypeMask mask in list) { |
620 newType = newType == null ? mask : newType.union(mask, closedWorld); | 626 newType = newType == null ? mask : newType.union(mask, closedWorld); |
621 // Likewise - stop early if we already reach dynamic. | 627 // Likewise - stop early if we already reach dynamic. |
622 if (newType.containsAll(closedWorld)) return dynamicType; | 628 if (newType.containsAll(closedWorld)) return dynamicType; |
623 } | 629 } |
624 | 630 |
625 return newType ?? const TypeMask.nonNullEmpty(); | 631 return newType ?? const TypeMask.nonNullEmpty(); |
626 } | 632 } |
627 } | 633 } |
OLD | NEW |