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

Unified Diff: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart

Issue 562123002: Support parameter access in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart
diff --git a/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart b/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart
index 72ae2bae1d830dbd9f6676d475f808442c20cbec..e740ee1dc37d8298ebf466b0c5bc7f6575a7d5b8 100644
--- a/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart
+++ b/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart
@@ -481,6 +481,8 @@ class MemberTypeInformation extends ElementTypeInformation
* the [ElementTypeInformation] factory.
*/
class ParameterTypeInformation extends ElementTypeInformation {
+ ParameterElement get element => super.element;
+
ParameterTypeInformation._internal(ParameterElement element,
TypeInformationSystem types)
: super._internal(types.getInferredTypeOf(element.functionDeclaration),
@@ -517,8 +519,8 @@ class ParameterTypeInformation extends ElementTypeInformation {
// initializing formals.
if (element.isInitializingFormal) return null;
- Element enclosing = element.enclosingElement;
- if ((isTearOffClosureParameter || Elements.isLocal(enclosing)) &&
+ FunctionElement function = element.functionDeclaration;
+ if ((isTearOffClosureParameter || function.isLocal) &&
disableInferenceForClosures) {
// Do not infer types for parameters of closures. We do not
// clear the assignments in case the closure is successfully
@@ -526,16 +528,16 @@ class ParameterTypeInformation extends ElementTypeInformation {
giveUp(inferrer, clearAssignments: false);
return safeType(inferrer);
}
- if (enclosing.isInstanceMember &&
- (enclosing.name == Compiler.NO_SUCH_METHOD ||
- (enclosing.name == Compiler.CALL_OPERATOR_NAME &&
+ if (function.isInstanceMember &&
+ (function.name == Compiler.NO_SUCH_METHOD ||
+ (function.name == Compiler.CALL_OPERATOR_NAME &&
disableInferenceForClosures))) {
// Do not infer types for parameters of [noSuchMethod] and
// [call] instance methods.
giveUp(inferrer);
return safeType(inferrer);
}
- if (enclosing == inferrer.mainElement) {
+ if (function == inferrer.mainElement) {
// The implicit call to main is not seen by the inferrer,
// therefore we explicitly set the type of its parameters as
// dynamic.
@@ -557,7 +559,7 @@ class ParameterTypeInformation extends ElementTypeInformation {
bool hasStableType(TypeGraphInferrerEngine inferrer) {
// The number of assignments of parameters of instance methods is
// not stable. Therefore such a parameter cannot be stable.
- if (element.enclosingElement.isInstanceMember) {
+ if (element.functionDeclaration.isInstanceMember) {
return false;
}
return super.hasStableType(inferrer);

Powered by Google App Engine
This is Rietveld 408576698