@@ -736,8 +736,13 @@ abstract class FlowAnalysis<Node extends Object, Statement extends Node,
736
736
/// expression to the left hand side of the `.` , and [propertyName] should be
737
737
/// the identifier to the right hand side of the `.` . [staticType] should be
738
738
/// the static type of the value returned by the property get.
739
+ ///
740
+ /// [propertyMember] should be whatever data structure the client uses to keep
741
+ /// track of the field or property being accessed. In the event of
742
+ /// non-promotion of a property get, this value can be retrieved from
743
+ /// [PropertyNotPromoted.propertyMember] .
739
744
void propertyGet (Expression wholeExpression, Expression target,
740
- String propertyName, Type staticType);
745
+ String propertyName, Object ? propertyMember, Type staticType);
741
746
742
747
/// Retrieves the SSA node associated with [variable] , or `null` if [variable]
743
748
/// is not associated with an SSA node because it is write captured. For
@@ -788,8 +793,13 @@ abstract class FlowAnalysis<Node extends Object, Statement extends Node,
788
793
/// the whole property get, and [propertyName] should be the name of the
789
794
/// property being read. [staticType] should be the static type of the value
790
795
/// returned by the property get.
791
- void thisOrSuperPropertyGet (
792
- Expression expression, String propertyName, Type staticType);
796
+ ///
797
+ /// [propertyMember] should be whatever data structure the client uses to keep
798
+ /// track of the field or property being accessed. In the event of
799
+ /// non-promotion of a property get, this value can be retrieved from
800
+ /// [PropertyNotPromoted.propertyMember] .
801
+ void thisOrSuperPropertyGet (Expression expression, String propertyName,
802
+ Object ? propertyMember, Type staticType);
793
803
794
804
/// Call this method just before visiting the body of a "try/catch" statement.
795
805
///
@@ -1339,11 +1349,12 @@ class FlowAnalysisDebug<Node extends Object, Statement extends Node,
1339
1349
1340
1350
@override
1341
1351
void propertyGet (Expression wholeExpression, Expression target,
1342
- String propertyName, Type staticType) {
1352
+ String propertyName, Object ? propertyMember, Type staticType) {
1343
1353
_wrap (
1344
- 'propertyGet($wholeExpression , $target , $propertyName , $staticType )' ,
1354
+ 'propertyGet($wholeExpression , $target , $propertyName , '
1355
+ '$propertyMember , $staticType )' ,
1345
1356
() => _wrapped.propertyGet (
1346
- wholeExpression, target, propertyName, staticType));
1357
+ wholeExpression, target, propertyName, propertyMember, staticType));
1347
1358
}
1348
1359
1349
1360
@override
@@ -1378,12 +1389,13 @@ class FlowAnalysisDebug<Node extends Object, Statement extends Node,
1378
1389
}
1379
1390
1380
1391
@override
1381
- void thisOrSuperPropertyGet (
1382
- Expression expression, String propertyName , Type staticType) {
1392
+ void thisOrSuperPropertyGet (Expression expression, String propertyName,
1393
+ Object ? propertyMember , Type staticType) {
1383
1394
_wrap (
1384
- 'thisOrSuperPropertyGet($expression , $propertyName , $staticType )' ,
1395
+ 'thisOrSuperPropertyGet($expression , $propertyName , $propertyMember , '
1396
+ '$staticType )' ,
1385
1397
() => _wrapped.thisOrSuperPropertyGet (
1386
- expression, propertyName, staticType));
1398
+ expression, propertyName, propertyMember, staticType));
1387
1399
}
1388
1400
1389
1401
@override
@@ -2334,12 +2346,17 @@ class PropertyNotPromoted<Type extends Object> extends NonPromotionReason {
2334
2346
/// The name of the property.
2335
2347
final String propertyName;
2336
2348
2349
+ /// The field or property being accessed. This matches a `propertyMember`
2350
+ /// value that was passed to either [FlowAnalysis.propertyGet] or
2351
+ /// [FlowAnalysis.thisOrSuperPropertyGet] .
2352
+ final Object ? propertyMember;
2353
+
2337
2354
/// The static type of the property at the time of the access. This is the
2338
2355
/// type that was passed to [FlowAnalysis.whyNotPromoted] ; it is provided to
2339
2356
/// the client as a convenience for ID testing.
2340
2357
final Type staticType;
2341
2358
2342
- PropertyNotPromoted (this .propertyName, this .staticType);
2359
+ PropertyNotPromoted (this .propertyName, this .propertyMember, this . staticType);
2343
2360
2344
2361
@override
2345
2362
String get documentationLink => 'http://dart.dev/go/non-promo-property' ;
@@ -2517,8 +2534,10 @@ abstract class Reference<Variable extends Object, Type extends Object> {
2517
2534
2518
2535
/// Creates a reference representing a get of a property called [propertyName]
2519
2536
/// on the reference represented by `this` .
2520
- Reference <Variable , Type > propertyGet (String propertyName) =>
2521
- new _PropertyGetReference <Variable , Type >(this , propertyName);
2537
+ Reference <Variable , Type > propertyGet (
2538
+ String propertyName, Object ? propertyMember) =>
2539
+ new _PropertyGetReference <Variable , Type >(
2540
+ this , propertyName, propertyMember);
2522
2541
2523
2542
/// Stores info for this reference in [variableInfo] .
2524
2543
void storeInfo (Map <Variable ?, VariableModel <Variable , Type >> variableInfo,
@@ -3952,14 +3971,14 @@ class _FlowAnalysisImpl<Node extends Object, Statement extends Node,
3952
3971
3953
3972
@override
3954
3973
void propertyGet (Expression wholeExpression, Expression target,
3955
- String propertyName, Type staticType) {
3974
+ String propertyName, Object ? propertyMember, Type staticType) {
3956
3975
Reference <Variable , Type >? reference =
3957
3976
_getExpressionReference (target)? .reference;
3958
3977
if (reference != null ) {
3959
3978
_storeExpressionReference (
3960
3979
wholeExpression,
3961
3980
new ReferenceWithType <Variable , Type >(
3962
- reference.propertyGet (propertyName), staticType));
3981
+ reference.propertyGet (propertyName, propertyMember ), staticType));
3963
3982
}
3964
3983
}
3965
3984
@@ -4016,12 +4035,13 @@ class _FlowAnalysisImpl<Node extends Object, Statement extends Node,
4016
4035
}
4017
4036
4018
4037
@override
4019
- void thisOrSuperPropertyGet (
4020
- Expression expression, String propertyName , Type staticType) {
4038
+ void thisOrSuperPropertyGet (Expression expression, String propertyName,
4039
+ Object ? propertyMember , Type staticType) {
4021
4040
_storeExpressionReference (
4022
4041
expression,
4023
4042
new ReferenceWithType <Variable , Type >(
4024
- new _ThisReference <Variable , Type >().propertyGet (propertyName),
4043
+ new _ThisReference <Variable , Type >()
4044
+ .propertyGet (propertyName, propertyMember),
4025
4045
staticType));
4026
4046
}
4027
4047
@@ -4686,7 +4706,7 @@ class _LegacyTypePromotion<Node extends Object, Statement extends Node,
4686
4706
4687
4707
@override
4688
4708
void propertyGet (Expression wholeExpression, Expression target,
4689
- String propertyName, Type staticType) {}
4709
+ String propertyName, Object ? propertyMember, Type staticType) {}
4690
4710
4691
4711
@override
4692
4712
SsaNode <Variable , Type >? ssaNodeForTesting (Variable variable) {
@@ -4706,8 +4726,8 @@ class _LegacyTypePromotion<Node extends Object, Statement extends Node,
4706
4726
void thisOrSuper (Expression expression, Type staticType) {}
4707
4727
4708
4728
@override
4709
- void thisOrSuperPropertyGet (
4710
- Expression expression, String propertyName , Type staticType) {}
4729
+ void thisOrSuperPropertyGet (Expression expression, String propertyName,
4730
+ Object ? propertyMember , Type staticType) {}
4711
4731
4712
4732
@override
4713
4733
void tryCatchStatement_bodyBegin () {}
@@ -4908,7 +4928,12 @@ class _PropertyGetReference<Variable extends Object, Type extends Object>
4908
4928
/// The name of the property.
4909
4929
final String propertyName;
4910
4930
4911
- _PropertyGetReference (this .target, this .propertyName);
4931
+ /// The field or property being accessed. This matches a `propertyMember`
4932
+ /// value that was passed to either [FlowAnalysis.propertyGet] or
4933
+ /// [FlowAnalysis.thisOrSuperPropertyGet] .
4934
+ final Object ? propertyMember;
4935
+
4936
+ _PropertyGetReference (this .target, this .propertyName, this .propertyMember);
4912
4937
4913
4938
@override
4914
4939
Map <Type , NonPromotionReason > Function () getNonPromotionReasons (
@@ -4920,7 +4945,8 @@ class _PropertyGetReference<Variable extends Object, Type extends Object>
4920
4945
return () {
4921
4946
Map <Type , NonPromotionReason > result = < Type , NonPromotionReason > {};
4922
4947
for (Type type in promotedTypes) {
4923
- result[type] = new PropertyNotPromoted (propertyName, staticType);
4948
+ result[type] =
4949
+ new PropertyNotPromoted (propertyName, propertyMember, staticType);
4924
4950
}
4925
4951
return result;
4926
4952
};
0 commit comments