44
55part of 'fragment.dart' ;
66
7- class GetterFragment implements Fragment {
7+ class GetterFragment implements Fragment , FunctionFragment {
88 final String name;
99 final Uri fileUri;
1010 final int startCharOffset;
1111 final int charOffset;
1212 final int charOpenParenOffset;
1313 final int charEndOffset;
14+ final bool isTopLevel;
1415 final List <MetadataBuilder >? metadata;
1516 final Modifiers modifiers;
1617 final TypeBuilder returnType;
@@ -28,6 +29,7 @@ class GetterFragment implements Fragment {
2829 required this .charOffset,
2930 required this .charOpenParenOffset,
3031 required this .charEndOffset,
32+ required this .isTopLevel,
3133 required this .metadata,
3234 required this .modifiers,
3335 required this .returnType,
@@ -47,6 +49,62 @@ class GetterFragment implements Fragment {
4749 _builder = value;
4850 }
4951
52+ @override
53+ FunctionBodyBuildingContext createFunctionBodyBuildingContext () {
54+ return new _GetterBodyBuildingContext (this );
55+ }
56+
5057 @override
5158 String toString () => '$runtimeType ($name ,$fileUri ,$charOffset )' ;
5259}
60+
61+ class _GetterBodyBuildingContext implements FunctionBodyBuildingContext {
62+ GetterFragment _fragment;
63+
64+ _GetterBodyBuildingContext (this ._fragment);
65+
66+ @override
67+ MemberKind get memberKind => _fragment.isTopLevel
68+ ? MemberKind .TopLevelMethod
69+ : (_fragment.modifiers.isStatic
70+ ? MemberKind .StaticMethod
71+ : MemberKind .NonStaticMethod );
72+
73+ @override
74+ bool get shouldBuild => true ;
75+
76+ @override
77+ LocalScope computeFormalParameterScope (LookupScope typeParameterScope) {
78+ return _fragment.builder.computeFormalParameterScope (typeParameterScope);
79+ }
80+
81+ @override
82+ LookupScope computeTypeParameterScope (LookupScope enclosingScope) {
83+ return _fragment.builder.computeTypeParameterScope (enclosingScope);
84+ }
85+
86+ @override
87+ BodyBuilderContext createBodyBuilderContext (
88+ {required bool inOutlineBuildingPhase,
89+ required bool inMetadata,
90+ required bool inConstFields}) {
91+ return _fragment.builder.createBodyBuilderContext (
92+ inOutlineBuildingPhase: inOutlineBuildingPhase,
93+ inMetadata: inMetadata,
94+ inConstFields: inConstFields);
95+ }
96+
97+ @override
98+ InferenceDataForTesting ? get inferenceDataForTesting => _fragment
99+ .builder
100+ .dataForTesting
101+ // Coverage-ignore(suite): Not run.
102+ ? .inferenceData;
103+
104+ @override
105+ List <TypeParameter >? get thisTypeParameters =>
106+ _fragment.builder.thisTypeParameters;
107+
108+ @override
109+ VariableDeclaration ? get thisVariable => _fragment.builder.thisVariable;
110+ }
0 commit comments