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

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

Issue 2970953003: Use entities in ParameterTypeInformation (Closed)
Patch Set: Fix 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/node_tracer.dart ('k') | pkg/compiler/lib/src/inferrer/type_system.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_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 e26022ded79d0efd9b0cc630a3366a5e837b60b9..ff2d7041a4432e93075273afc5e41894ac2bf532 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -393,7 +393,7 @@ abstract class MemberTypeInformation extends ElementTypeInformation
MemberTypeInformation._internal(this._member) : super._internal(null);
- MemberElement get member => _member;
+ MemberEntity get member => _member;
String get debugName => '$member';
@@ -676,38 +676,48 @@ class GenerativeConstructorTypeInformation extends MemberTypeInformation {
* the [ElementTypeInformation] factory.
*/
class ParameterTypeInformation extends ElementTypeInformation {
- final ParameterElement _parameter;
- final MethodElement _method;
- bool _isInstanceMemberParameter;
- bool _isClosureParameter;
+ final Local _parameter;
+ final DartType _type;
+ final FunctionEntity _method;
+ final bool _isInstanceMemberParameter;
+ final bool _isClosureParameter;
+ final bool _isInitializingFormal;
bool _isTearOffClosureParameter = false;
ParameterTypeInformation.localFunction(
- MemberTypeInformation context, this._parameter, this._method)
+ MemberTypeInformation context, this._parameter, this._type, this._method)
: _isInstanceMemberParameter = false,
_isClosureParameter = true,
+ _isInitializingFormal = false,
super._internal(context);
ParameterTypeInformation.static(
- MemberTypeInformation context, this._parameter, this._method)
+ MemberTypeInformation context, this._parameter, this._type, this._method,
+ {bool isInitializingFormal: false})
: _isInstanceMemberParameter = false,
_isClosureParameter = false,
+ _isInitializingFormal = isInitializingFormal,
super._internal(context);
- ParameterTypeInformation.instanceMember(MemberTypeInformation context,
- this._parameter, this._method, ParameterAssignments assignments)
+ ParameterTypeInformation.instanceMember(
+ MemberTypeInformation context,
+ this._parameter,
+ this._type,
+ this._method,
+ ParameterAssignments assignments)
: _isInstanceMemberParameter = true,
_isClosureParameter = false,
+ _isInitializingFormal = false,
super._withAssignments(context, assignments);
- MethodElement get method => _method;
+ FunctionEntity get method => _method;
Local get parameter => _parameter;
String get debugName => '$parameter';
void tagAsTearOffClosureParameter(InferrerEngine inferrer) {
- assert(_parameter.isRegularParameter);
+ assert(!_isInitializingFormal);
_isTearOffClosureParameter = true;
// We have to add a flow-edge for the default value (if it exists), as we
// might not see all call-sites and thus miss the use of it.
@@ -729,7 +739,7 @@ class ParameterTypeInformation extends ElementTypeInformation {
// The below do not apply to parameters of constructors, so skip
// initializing formals.
- if (_parameter.isInitializingFormal) return null;
+ if (_isInitializingFormal) return null;
if ((_isTearOffClosureParameter || _isClosureParameter) &&
disableInferenceForClosures) {
@@ -776,7 +786,7 @@ class ParameterTypeInformation extends ElementTypeInformation {
// ignore type annotations to ensure that the checks are actually inserted
// into the function body and retained until runtime.
assert(!compiler.options.enableTypeAssertions);
- return _narrowType(inferrer.closedWorld, mask, _parameter.type);
+ return _narrowType(inferrer.closedWorld, mask, _type);
}
TypeMask computeType(InferrerEngine inferrer) {
« no previous file with comments | « pkg/compiler/lib/src/inferrer/node_tracer.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