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

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

Issue 2967003002: Split TypeSystem.typeInformations into member/parameter info (Closed)
Patch Set: 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
Index: pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index f03b24a9218e49c1745b36e770fbd5434c6040b9..08043e4cf2d207d6ee762efb248fdb7689ad426a 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -348,23 +348,10 @@ abstract class ElementTypeInformation extends TypeInformation {
/// Marker to disable inference for closures in [handleSpecialCases].
bool disableInferenceForClosures = true;
- factory ElementTypeInformation(Element element, TypeSystem types) {
- if (element.isParameter) {
- ParameterElement parameter = element;
- if (parameter.functionDeclaration.isLocal) {
- return new ParameterTypeInformation._localFunction(element, types);
- } else if (parameter.functionDeclaration.isInstanceMember) {
- return new ParameterTypeInformation._instanceMember(element, types);
- }
- return new ParameterTypeInformation._static(element, types);
- }
- return new MemberTypeInformation(element);
- }
-
ElementTypeInformation._internal(MemberTypeInformation context, this._element)
: super(context);
- ElementTypeInformation._withAssignments(
- MemberTypeInformation context, this._element, assignments)
+ ElementTypeInformation._withAssignments(MemberTypeInformation context,
+ this._element, ParameterAssignments assignments)
: super.withAssignments(context, assignments);
String getInferredSignature(TypeSystem types);
@@ -602,40 +589,22 @@ class ParameterTypeInformation extends ElementTypeInformation {
final FunctionElement _declaration;
final MethodElement _method;
- ParameterTypeInformation._internal(MemberTypeInformation context,
+ ParameterTypeInformation.localFunction(MemberTypeInformation context,
ParameterElement parameter, this._declaration, this._method)
: super._internal(context, parameter);
- factory ParameterTypeInformation._static(
- ParameterElement element, TypeSystem types) {
- MethodElement method = element.functionDeclaration;
- assert(!method.isInstanceMember);
- return new ParameterTypeInformation._internal(
- types.getInferredTypeOfMember(method), element, method, method);
- }
-
- factory ParameterTypeInformation._localFunction(
- ParameterElement element, TypeSystem types) {
- LocalFunctionElement localFunction = element.functionDeclaration;
- MethodElement callMethod = localFunction.callMethod;
- return new ParameterTypeInformation._internal(
- types.getInferredTypeOfMember(callMethod),
- element,
- localFunction,
- callMethod);
- }
-
- ParameterTypeInformation._instanceMember(
- ParameterElement element, TypeSystem types)
- : _declaration = element.functionDeclaration,
- _method = element.functionDeclaration,
- super._withAssignments(
- types.getInferredTypeOfMember(
- element.functionDeclaration as MethodElement),
- element,
- new ParameterAssignments()) {
- assert(element.functionDeclaration.isInstanceMember);
- }
+ ParameterTypeInformation.static(
+ MemberTypeInformation context, ParameterElement parameter, this._method)
+ : this._declaration = _method,
+ super._internal(context, parameter);
+
+ ParameterTypeInformation.instanceMember(
+ MemberTypeInformation context,
+ ParameterElement parameter,
+ this._method,
+ ParameterAssignments assignments)
+ : this._declaration = _method,
+ super._withAssignments(context, parameter, assignments);
MethodElement get method => _method;
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart ('k') | pkg/compiler/lib/src/inferrer/type_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698