Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Unified Diff: pkg/compiler/lib/src/inferrer/type_system.dart

Issue 2971693002: Split MemberTypeInformation by member kind (Closed)
Patch Set: Updated cf. comments. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_nodes.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/inferrer/type_system.dart
diff --git a/pkg/compiler/lib/src/inferrer/type_system.dart b/pkg/compiler/lib/src/inferrer/type_system.dart
index 0dbe196a6f71b54c81b75e8481380261c507c4eb..03589b3bcfd093a069ac7b69596aa73f8eaa0ada 100644
--- a/pkg/compiler/lib/src/inferrer/type_system.dart
+++ b/pkg/compiler/lib/src/inferrer/type_system.dart
@@ -290,8 +290,7 @@ class TypeSystem {
* [isNullable] indicates whether the annotation implies a null
* type.
*/
- TypeInformation narrowType(
- TypeInformation type, DartType annotation,
+ TypeInformation narrowType(TypeInformation type, DartType annotation,
{bool isNullable: true}) {
if (annotation.treatAsDynamic) return type;
if (annotation.isVoid) return type;
@@ -346,9 +345,7 @@ class TypeSystem {
LocalFunctionElement localFunction = parameter.functionDeclaration;
MethodElement callMethod = localFunction.callMethod;
return new ParameterTypeInformation.localFunction(
- getInferredTypeOfMember(callMethod),
- parameter,
- callMethod);
+ getInferredTypeOfMember(callMethod), parameter, callMethod);
} else if (parameter.functionDeclaration.isInstanceMember) {
MethodElement method = parameter.functionDeclaration;
return new ParameterTypeInformation.instanceMember(
@@ -373,7 +370,23 @@ class TypeSystem {
MemberTypeInformation getInferredTypeOfMember(MemberElement member) {
member = member.implementation;
return memberTypeInformations.putIfAbsent(member, () {
- MemberTypeInformation typeInformation = new MemberTypeInformation(member);
+ MemberTypeInformation typeInformation;
+ if (member.isField) {
+ typeInformation = new FieldTypeInformation(member);
+ } else if (member.isGetter) {
+ typeInformation = new GetterTypeInformation(member);
+ } else if (member.isSetter) {
+ typeInformation = new SetterTypeInformation(member);
+ } else if (member.isFunction) {
+ typeInformation = new MethodTypeInformation(member);
+ } else {
+ ConstructorElement constructor = member;
+ if (constructor.isFactoryConstructor) {
+ typeInformation = new FactoryConstructorTypeInformation(member);
+ } else {
+ typeInformation = new GenerativeConstructorTypeInformation(member);
+ }
+ }
_orderedTypeInformations.add(typeInformation);
return typeInformation;
});
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698