@@ -12,6 +12,32 @@ import 'package:analyzer/src/dart/element/type.dart';
1212import 'package:analyzer/src/generated/variable_type_provider.dart' ;
1313import 'package:front_end/src/fasta/flow_analysis/flow_analysis.dart' ;
1414
15+ class AnalyzerFunctionBodyAccess
16+ implements FunctionBodyAccess <VariableElement > {
17+ final FunctionBody node;
18+
19+ AnalyzerFunctionBodyAccess (this .node);
20+
21+ @override
22+ bool isPotentiallyMutatedInClosure (VariableElement variable) {
23+ return node.isPotentiallyMutatedInClosure (variable);
24+ }
25+
26+ @override
27+ bool isPotentiallyMutatedInScope (VariableElement variable) {
28+ return node.isPotentiallyMutatedInScope (variable);
29+ }
30+ }
31+
32+ class AnalyzerNodeOperations implements NodeOperations <Expression > {
33+ const AnalyzerNodeOperations ();
34+
35+ @override
36+ Expression unwrapParenthesized (Expression node) {
37+ return node.unParenthesized;
38+ }
39+ }
40+
1541/// The helper for performing flow analysis during resolution.
1642///
1743/// It contains related precomputed data, result, and non-trivial pieces of
@@ -43,7 +69,7 @@ class FlowAnalysisHelper {
4369 node.accept (_AssignedVariablesVisitor (assignedVariables));
4470
4571 return FlowAnalysisHelper ._(
46- _NodeOperations (),
72+ const AnalyzerNodeOperations (),
4773 _TypeSystemTypeOperations (typeSystem),
4874 assignedVariables,
4975 retainDataForTesting ? FlowAnalysisResult () : null );
@@ -135,7 +161,7 @@ class FlowAnalysisHelper {
135161 flow = FlowAnalysis <Statement , Expression , VariableElement , DartType >(
136162 _nodeOperations,
137163 _typeOperations,
138- _FunctionBodyAccess (node),
164+ AnalyzerFunctionBodyAccess (node),
139165 );
140166 }
141167
@@ -429,22 +455,6 @@ class _AssignedVariablesVisitor extends RecursiveAstVisitor<void> {
429455 }
430456}
431457
432- class _FunctionBodyAccess implements FunctionBodyAccess <VariableElement > {
433- final FunctionBody node;
434-
435- _FunctionBodyAccess (this .node);
436-
437- @override
438- bool isPotentiallyMutatedInClosure (VariableElement variable) {
439- return node.isPotentiallyMutatedInClosure (variable);
440- }
441-
442- @override
443- bool isPotentiallyMutatedInScope (VariableElement variable) {
444- return node.isPotentiallyMutatedInScope (variable);
445- }
446- }
447-
448458/// The flow analysis based implementation of [LocalVariableTypeProvider] .
449459class _LocalVariableTypeProvider implements LocalVariableTypeProvider {
450460 final FlowAnalysisHelper _manager;
@@ -459,13 +469,6 @@ class _LocalVariableTypeProvider implements LocalVariableTypeProvider {
459469 }
460470}
461471
462- class _NodeOperations implements NodeOperations <Expression > {
463- @override
464- Expression unwrapParenthesized (Expression node) {
465- return node.unParenthesized;
466- }
467- }
468-
469472class _TypeSystemTypeOperations
470473 implements TypeOperations <VariableElement , DartType > {
471474 final TypeSystem typeSystem;
0 commit comments