Flow analysis: make propertyGet's wholeExpression argument nullable.

This is needed for CFE integration of field type promotion, since it
allows the CFE to call propertyGet in circumstances where there's no
expression corresponding to the property get, such as during an
invocation of a field that's been parsed as a method call.

Change-Id: I1856705c080315e87e283af217be331021ef8aee
Bug: https://github.com/dart-lang/language/issues/2020
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260452
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Paul Berry 2022-09-22 17:30:29 +00:00 committed by Commit Bot
parent 24b6b94637
commit b8eede8c9f
2 changed files with 12 additions and 4 deletions

View file

@ -513,6 +513,13 @@ abstract class FlowAnalysis<Node extends Object, Statement extends Node,
/// the identifier to the right hand side of the `.`. [staticType] should be
/// the static type of the value returned by the property get.
///
/// [wholeExpression] is used by flow analysis to detect the case where the
/// property get is used as a subexpression of a larger expression that
/// participates in promotion (e.g. promotion of a property of a property).
/// If there is no expression corresponding to the property get (e.g. because
/// the property is being invoked like a method, or the property get is part
/// of a compound assignment), [wholeExpression] may be `null`.
///
/// [propertyMember] should be whatever data structure the client uses to keep
/// track of the field or property being accessed. If not `null`,
/// [Operations.isPropertyPromotable] will be consulted to find out whether
@ -522,7 +529,7 @@ abstract class FlowAnalysis<Node extends Object, Statement extends Node,
///
/// If the property's type is currently promoted, the promoted type is
/// returned. Otherwise `null` is returned.
Type? propertyGet(Expression wholeExpression, Expression target,
Type? propertyGet(Expression? wholeExpression, Expression target,
String propertyName, Object? propertyMember, Type staticType);
/// Retrieves the SSA node associated with [variable], or `null` if [variable]
@ -1186,7 +1193,7 @@ class FlowAnalysisDebug<Node extends Object, Statement extends Node,
}
@override
Type? propertyGet(Expression wholeExpression, Expression target,
Type? propertyGet(Expression? wholeExpression, Expression target,
String propertyName, Object? propertyMember, Type staticType) {
return _wrap(
'propertyGet($wholeExpression, $target, $propertyName, '
@ -3733,7 +3740,7 @@ class _FlowAnalysisImpl<Node extends Object, Statement extends Node,
}
@override
Type? propertyGet(Expression wholeExpression, Expression target,
Type? propertyGet(Expression? wholeExpression, Expression target,
String propertyName, Object? propertyMember, Type staticType) {
return _handleProperty(
wholeExpression, target, propertyName, propertyMember, staticType);
@ -4600,7 +4607,7 @@ class _LegacyTypePromotion<Node extends Object, Statement extends Node,
}
@override
Type? propertyGet(Expression wholeExpression, Expression target,
Type? propertyGet(Expression? wholeExpression, Expression target,
String propertyName, Object? propertyMember, Type staticType) =>
null;

View file

@ -958,6 +958,7 @@ paren
parens
parenteses
parity
participates
particularly
partof
patchup