@@ -771,26 +771,29 @@ class ResolverVisitor extends ScopedVisitor {
771
771
}
772
772
773
773
void startNullAwareIndexExpression (IndexExpression node) {
774
- if (_migratableAstInfoProvider.isIndexExpressionNullAware (node) &&
775
- _flowAnalysis != null ) {
776
- _flowAnalysis.flow.nullAwareAccess_rightBegin (
777
- node.target, node.realTarget.staticType ?? typeProvider.dynamicType);
778
- _unfinishedNullShorts.add (node.nullShortingTermination);
774
+ if (_migratableAstInfoProvider.isIndexExpressionNullAware (node)) {
775
+ var flow = _flowAnalysis? .flow;
776
+ if (flow != null ) {
777
+ flow.nullAwareAccess_rightBegin (node.target,
778
+ node.realTarget.staticType ?? typeProvider.dynamicType);
779
+ _unfinishedNullShorts.add (node.nullShortingTermination);
780
+ }
779
781
}
780
782
}
781
783
782
- void startNullAwarePropertyAccess (
783
- PropertyAccess node,
784
- ) {
785
- if (_migratableAstInfoProvider.isPropertyAccessNullAware (node) &&
786
- _flowAnalysis != null ) {
787
- var target = node.target;
788
- if (target is SimpleIdentifier && target.staticElement is ClassElement ) {
789
- // `?.` to access static methods is equivalent to `.`, so do nothing.
790
- } else {
791
- _flowAnalysis.flow.nullAwareAccess_rightBegin (
792
- target, node.realTarget.staticType ?? typeProvider.dynamicType);
793
- _unfinishedNullShorts.add (node.nullShortingTermination);
784
+ void startNullAwarePropertyAccess (PropertyAccess node) {
785
+ if (_migratableAstInfoProvider.isPropertyAccessNullAware (node)) {
786
+ var flow = _flowAnalysis? .flow;
787
+ if (flow != null ) {
788
+ var target = node.target;
789
+ if (target is SimpleIdentifier &&
790
+ target.staticElement is ClassElement ) {
791
+ // `?.` to access static methods is equivalent to `.`, so do nothing.
792
+ } else {
793
+ flow.nullAwareAccess_rightBegin (
794
+ target, node.realTarget.staticType ?? typeProvider.dynamicType);
795
+ _unfinishedNullShorts.add (node.nullShortingTermination);
796
+ }
794
797
}
795
798
}
796
799
}
@@ -1684,14 +1687,17 @@ class ResolverVisitor extends ScopedVisitor {
1684
1687
var target = node.target;
1685
1688
target? .accept (this );
1686
1689
1687
- if (_migratableAstInfoProvider.isMethodInvocationNullAware (node) &&
1688
- _flowAnalysis != null ) {
1689
- if (target is SimpleIdentifier && target.staticElement is ClassElement ) {
1690
- // `?.` to access static methods is equivalent to `.`, so do nothing.
1691
- } else {
1692
- _flowAnalysis.flow.nullAwareAccess_rightBegin (
1693
- target, node.realTarget.staticType ?? typeProvider.dynamicType);
1694
- _unfinishedNullShorts.add (node.nullShortingTermination);
1690
+ if (_migratableAstInfoProvider.isMethodInvocationNullAware (node)) {
1691
+ var flow = _flowAnalysis? .flow;
1692
+ if (flow != null ) {
1693
+ if (target is SimpleIdentifier &&
1694
+ target.staticElement is ClassElement ) {
1695
+ // `?.` to access static methods is equivalent to `.`, so do nothing.
1696
+ } else {
1697
+ flow.nullAwareAccess_rightBegin (
1698
+ target, node.realTarget.staticType ?? typeProvider.dynamicType);
1699
+ _unfinishedNullShorts.add (node.nullShortingTermination);
1700
+ }
1695
1701
}
1696
1702
}
1697
1703
0 commit comments