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

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

Issue 2955353002: Split inference type-info accessors into members, parameters and local functions (Closed)
Patch Set: Updated cf. comments Created 3 years, 6 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') | pkg/compiler/lib/src/serialization/modelz.dart » ('j') | 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 b6d34798cbd70ad26a595981c0280c304a0a7965..41979790116d57bdb1b9a5bd43bc6d5990c7f6b4 100644
--- a/pkg/compiler/lib/src/inferrer/type_system.dart
+++ b/pkg/compiler/lib/src/inferrer/type_system.dart
@@ -70,7 +70,7 @@ class TypeSystem {
void withMember(MemberElement element, action) {
assert(_currentMember == null,
failedAt(element, "Already constructing graph for $_currentMember."));
- _currentMember = getInferredTypeOf(element);
+ _currentMember = getInferredTypeOfMember(element);
action();
_currentMember = null;
}
@@ -322,7 +322,22 @@ class TypeSystem {
return newType;
}
- ElementTypeInformation getInferredTypeOf(Element element) {
+ ElementTypeInformation getInferredTypeOfParameter(ParameterElement element) {
+ return _getInferredTypeOf(element);
+ }
+
+ ElementTypeInformation getInferredTypeOfMember(MemberElement element) {
+ return _getInferredTypeOf(element);
+ }
+
+ @deprecated
+ ElementTypeInformation getInferredTypeOfLocalFunction(
+ LocalFunctionElement element) {
+ return _getInferredTypeOf(element);
+ }
+
+ @deprecated
+ ElementTypeInformation _getInferredTypeOf(Element element) {
element = element.implementation;
return typeInformations[element] ??=
new ElementTypeInformation(element, this);
@@ -339,12 +354,17 @@ class TypeSystem {
}
String getInferredSignatureOf(FunctionElement function) {
- ElementTypeInformation info = getInferredTypeOf(function);
+ ElementTypeInformation info;
+ if (function.isLocal) {
+ info = getInferredTypeOfLocalFunction(function);
+ } else {
+ info = getInferredTypeOfMember(function as MethodElement);
+ }
FunctionElement impl = function.implementation;
FunctionSignature signature = impl.functionSignature;
var res = "";
signature.forEachParameter((Element parameter) {
- TypeInformation type = getInferredTypeOf(parameter);
+ TypeInformation type = getInferredTypeOfParameter(parameter);
res += "${res.isEmpty ? '(' : ', '}${type.type} ${parameter.name}";
});
res += ") -> ${info.type}";
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_nodes.dart ('k') | pkg/compiler/lib/src/serialization/modelz.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698