Skip to content

Commit ad481ff

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Add Element2.fragments
Change-Id: I85fb19c87b833abca99cb86c4e285d9120f96ac2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403948 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 0836d36 commit ad481ff

File tree

6 files changed

+531
-99
lines changed

6 files changed

+531
-99
lines changed

pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import 'package:analysis_server/src/protocol_server.dart' as protocol;
66
import 'package:analysis_server/src/services/search/search_engine.dart';
77
import 'package:analyzer/dart/element/element2.dart';
8-
import 'package:analyzer/src/utilities/extensions/element.dart';
98

109
class ImplementedComputer {
1110
final SearchEngine searchEngine;

pkg/analysis_server/lib/src/lsp/handlers/handler_references.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import 'package:analyzer/dart/ast/ast.dart';
1515
import 'package:analyzer/dart/element/element2.dart';
1616
import 'package:analyzer/src/dart/ast/utilities.dart';
1717
import 'package:analyzer/src/util/performance/operation_performance.dart';
18-
import 'package:analyzer/src/utilities/extensions/element.dart';
1918

2019
typedef StaticOptions = Either2<bool, ReferenceOptions>;
2120

pkg/analyzer/lib/dart/element/element2.dart

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ abstract class Annotatable {
111111
abstract class BindPatternVariableElement2 implements PatternVariableElement2 {
112112
@override
113113
BindPatternVariableFragment get firstFragment;
114+
115+
@override
116+
List<BindPatternVariableFragment> get fragments;
114117
}
115118

116119
/// The portion of a [BindPatternVariableElement2] contributed by a single
@@ -138,6 +141,9 @@ abstract class ClassElement2 implements InterfaceElement2 {
138141
@override
139142
ClassFragment get firstFragment;
140143

144+
@override
145+
List<ClassFragment> get fragments;
146+
141147
/// Whether the class or its superclass declares a non-final instance field.
142148
bool get hasNonFinalField;
143149

@@ -267,6 +273,9 @@ abstract class ConstructorElement2
267273
@override
268274
ConstructorFragment get firstFragment;
269275

276+
@override
277+
List<ConstructorFragment> get fragments;
278+
270279
/// Whether the constructor is a const constructor.
271280
bool get isConst;
272281

@@ -406,6 +415,9 @@ abstract class Element2 {
406415
/// invocations of [Fragment.nextFragment].
407416
Fragment get firstFragment;
408417

418+
/// The fragments this element consists of.
419+
List<Fragment> get fragments;
420+
409421
/// The unique integer identifier of this element.
410422
int get id;
411423

@@ -608,6 +620,9 @@ abstract class EnumElement2 implements InterfaceElement2 {
608620

609621
@override
610622
EnumFragment get firstFragment;
623+
624+
@override
625+
List<EnumFragment> get fragments;
611626
}
612627

613628
/// The portion of an [EnumElement2] contributed by a single declaration.
@@ -638,6 +653,9 @@ abstract class ExecutableElement2 implements FunctionTypedElement2 {
638653
@override
639654
ExecutableFragment get firstFragment;
640655

656+
@override
657+
List<ExecutableFragment> get fragments;
658+
641659
/// Whether the executable element did not have an explicit return type
642660
/// specified for it in the original source.
643661
bool get hasImplicitReturnType;
@@ -712,6 +730,9 @@ abstract class ExtensionElement2 implements InstanceElement2 {
712730

713731
@override
714732
ExtensionFragment get firstFragment;
733+
734+
@override
735+
List<ExtensionFragment> get fragments;
715736
}
716737

717738
/// The portion of an [ExtensionElement2] contributed by a single
@@ -736,6 +757,9 @@ abstract class ExtensionTypeElement2 implements InterfaceElement2 {
736757
@override
737758
ExtensionTypeFragment get firstFragment;
738759

760+
@override
761+
List<ExtensionTypeFragment> get fragments;
762+
739763
/// The primary constructor of this extension.
740764
ConstructorElement2 get primaryConstructor2;
741765

@@ -781,6 +805,9 @@ abstract class FieldElement2 implements PropertyInducingElement2 {
781805
@override
782806
FieldFragment get firstFragment;
783807

808+
@override
809+
List<FieldFragment> get fragments;
810+
784811
/// Whether the field is abstract.
785812
///
786813
/// Executable fields are abstract if they are declared with the `abstract`
@@ -811,6 +838,9 @@ abstract class FieldFormalParameterElement2 implements FormalParameterElement {
811838

812839
@override
813840
FieldFormalParameterFragment get firstFragment;
841+
842+
@override
843+
List<FieldFormalParameterFragment> get fragments;
814844
}
815845

816846
/// The portion of a [FieldFormalParameterElement2] contributed by a single
@@ -868,6 +898,9 @@ abstract class FormalParameterElement
868898
/// formal parameter.
869899
List<FormalParameterElement> get formalParameters;
870900

901+
@override
902+
List<FormalParameterFragment> get fragments;
903+
871904
/// Whether the parameter has a default value.
872905
bool get hasDefaultValue;
873906

@@ -1051,6 +1084,9 @@ abstract class FunctionTypedElement2 implements TypeParameterizedElement2 {
10511084
/// The formal parameters defined by this element.
10521085
List<FormalParameterElement> get formalParameters;
10531086

1087+
@override
1088+
List<FunctionTypedFragment> get fragments;
1089+
10541090
/// The return type defined by this element.
10551091
DartType get returnType;
10561092

@@ -1081,6 +1117,9 @@ abstract class FunctionTypedFragment implements TypeParameterizedFragment {
10811117
abstract class GenericFunctionTypeElement2 implements FunctionTypedElement2 {
10821118
@override
10831119
GenericFunctionTypeFragment get firstFragment;
1120+
1121+
@override
1122+
List<GenericFunctionTypeFragment> get fragments;
10841123
}
10851124

10861125
/// The portion of a [GenericFunctionTypeElement2] coming from a single
@@ -1117,6 +1156,9 @@ abstract class GetterElement implements PropertyAccessorElement2 {
11171156

11181157
@override
11191158
GetterFragment get firstFragment;
1159+
1160+
@override
1161+
List<GetterFragment> get fragments;
11201162
}
11211163

11221164
/// The portion of a [GetterElement] contributed by a single declaration.
@@ -1183,6 +1225,9 @@ abstract class InstanceElement2
11831225
@override
11841226
InstanceFragment get firstFragment;
11851227

1228+
@override
1229+
List<InstanceFragment> get fragments;
1230+
11861231
/// The getters declared in this element.
11871232
List<GetterElement> get getters2;
11881233

@@ -1297,6 +1342,9 @@ abstract class InterfaceElement2 implements InstanceElement2 {
12971342
@override
12981343
InterfaceFragment get firstFragment;
12991344

1345+
@override
1346+
List<InterfaceFragment> get fragments;
1347+
13001348
/// The interfaces that are implemented by this class.
13011349
///
13021350
/// <b>Note:</b> Because the element model represents the state of the code,
@@ -1437,6 +1485,9 @@ abstract class JoinPatternVariableElement2 implements PatternVariableElement2 {
14371485
@override
14381486
JoinPatternVariableFragment get firstFragment;
14391487

1488+
@override
1489+
List<JoinPatternVariableFragment> get fragments;
1490+
14401491
/// Whether the [variables2] are consistent.
14411492
///
14421493
/// The variables are consistent if they are present in all branches, and have
@@ -1482,6 +1533,9 @@ abstract class LabelElement2 implements Element2 {
14821533
@override
14831534
LabelFragment get firstFragment;
14841535

1536+
@override
1537+
List<LabelFragment> get fragments;
1538+
14851539
@override
14861540
LibraryElement2 get library2;
14871541
}
@@ -1562,6 +1616,7 @@ abstract class LibraryElement2
15621616
///
15631617
/// This includes the defining fragment, and fragments included using the
15641618
/// `part` directive.
1619+
@override
15651620
List<LibraryFragment> get fragments;
15661621

15671622
/// The getters defined in this library.
@@ -1826,6 +1881,9 @@ abstract class LocalFunctionElement
18261881
implements ExecutableElement2, LocalElement2 {
18271882
@override
18281883
LocalFunctionFragment get firstFragment;
1884+
1885+
@override
1886+
List<LocalFunctionFragment> get fragments;
18291887
}
18301888

18311889
/// The portion of a [LocalFunctionElement] contributed by a single
@@ -1864,6 +1922,9 @@ abstract class LocalVariableElement2
18641922
@override
18651923
LocalVariableFragment get firstFragment;
18661924

1925+
@override
1926+
List<LocalVariableFragment> get fragments;
1927+
18671928
/// Whether the variable has an initializer at declaration.
18681929
bool get hasInitializer;
18691930
}
@@ -2012,6 +2073,9 @@ abstract class MethodElement2
20122073
@override
20132074
MethodFragment get firstFragment;
20142075

2076+
@override
2077+
List<MethodFragment> get fragments;
2078+
20152079
/// Whether the method defines an operator.
20162080
///
20172081
/// The test might be based on the name of the executable element, in which
@@ -2043,6 +2107,9 @@ abstract class MixinElement2 implements InterfaceElement2 {
20432107
@override
20442108
MixinFragment get firstFragment;
20452109

2110+
@override
2111+
List<MixinFragment> get fragments;
2112+
20462113
/// Whether the mixin is a base mixin.
20472114
///
20482115
/// A mixin is a base mixin if it has an explicit `base` modifier.
@@ -2105,6 +2172,9 @@ abstract class MultiplyDefinedElement2 implements Element2 {
21052172

21062173
@override
21072174
MultiplyDefinedFragment get firstFragment;
2175+
2176+
@override
2177+
List<MultiplyDefinedFragment> get fragments;
21082178
}
21092179

21102180
/// The fragment for a [MultiplyDefinedElement2].
@@ -2139,6 +2209,9 @@ abstract class PatternVariableElement2 implements LocalVariableElement2 {
21392209
@override
21402210
PatternVariableFragment get firstFragment;
21412211

2212+
@override
2213+
List<PatternVariableFragment> get fragments;
2214+
21422215
/// The variable in which this variable joins with other pattern variables
21432216
/// with the same name, in a logical-or pattern, or shared case scope.
21442217
JoinPatternVariableElement2? get join2;
@@ -2175,6 +2248,9 @@ abstract class PrefixElement2 implements Element2 {
21752248
@override
21762249
PrefixFragment get firstFragment;
21772250

2251+
@override
2252+
List<PrefixFragment> get fragments;
2253+
21782254
/// The imports that share this prefix.
21792255
List<LibraryImport> get imports;
21802256

@@ -2216,6 +2292,9 @@ abstract class PrefixFragment implements Fragment {
22162292
abstract class PromotableElement2 implements VariableElement2 {
22172293
@override
22182294
PromotableFragment get firstFragment;
2295+
2296+
@override
2297+
List<PromotableFragment> get fragments;
22192298
}
22202299

22212300
/// The portion of a [PromotableElement2] contributed by a single declaration.
@@ -2246,6 +2325,9 @@ abstract class PropertyAccessorElement2 implements ExecutableElement2 {
22462325
@override
22472326
PropertyAccessorFragment get firstFragment;
22482327

2328+
@override
2329+
List<PropertyAccessorFragment> get fragments;
2330+
22492331
/// The field or top-level variable associated with this getter.
22502332
///
22512333
/// If this getter was explicitly defined (is not synthetic) then the variable
@@ -2295,6 +2377,9 @@ abstract class PropertyInducingElement2
22952377
@override
22962378
PropertyInducingFragment get firstFragment;
22972379

2380+
@override
2381+
List<PropertyInducingFragment> get fragments;
2382+
22982383
/// The getter associated with this variable.
22992384
///
23002385
/// If this variable was explicitly defined (is not synthetic) then the
@@ -2389,6 +2474,9 @@ abstract class SetterElement implements PropertyAccessorElement2 {
23892474

23902475
@override
23912476
SetterFragment get firstFragment;
2477+
2478+
@override
2479+
List<SetterFragment> get fragments;
23922480
}
23932481

23942482
/// The portion of a [SetterElement] contributed by a single declaration.
@@ -2426,6 +2514,9 @@ abstract class SuperFormalParameterElement2 implements FormalParameterElement {
24262514
@override
24272515
SuperFormalParameterFragment get firstFragment;
24282516

2517+
@override
2518+
List<SuperFormalParameterFragment> get fragments;
2519+
24292520
/// The associated super-constructor parameter, from the super-constructor
24302521
/// that is referenced by the implicit or explicit super-constructor
24312522
/// invocation.
@@ -2461,6 +2552,9 @@ abstract class TopLevelFunctionElement
24612552
@override
24622553
TopLevelFunctionFragment get firstFragment;
24632554

2555+
@override
2556+
List<TopLevelFunctionFragment> get fragments;
2557+
24642558
/// Whether the function represents `identical` from the `dart:core` library.
24652559
bool get isDartCoreIdentical;
24662560

@@ -2504,6 +2598,9 @@ abstract class TopLevelVariableElement2 implements PropertyInducingElement2 {
25042598
@override
25052599
TopLevelVariableFragment get firstFragment;
25062600

2601+
@override
2602+
List<TopLevelVariableFragment> get fragments;
2603+
25072604
/// Whether the field was explicitly marked as being external.
25082605
bool get isExternal;
25092606
}
@@ -2550,6 +2647,9 @@ abstract class TypeAliasElement2
25502647
@override
25512648
TypeAliasFragment get firstFragment;
25522649

2650+
@override
2651+
List<TypeAliasFragment> get fragments;
2652+
25532653
/// Returns the type resulting from instantiating this typedef with the given
25542654
/// [typeArguments] and [nullabilitySuffix].
25552655
///
@@ -2593,6 +2693,9 @@ abstract class TypeDefiningElement2 implements Element2, Annotatable {
25932693

25942694
@override
25952695
TypeDefiningFragment get firstFragment;
2696+
2697+
@override
2698+
List<TypeDefiningFragment> get fragments;
25962699
}
25972700

25982701
/// The portion of a [TypeDefiningElement2] contributed by a single declaration.
@@ -2626,6 +2729,9 @@ abstract class TypeParameterElement2 implements TypeDefiningElement2 {
26262729
@override
26272730
TypeParameterFragment get firstFragment;
26282731

2732+
@override
2733+
List<TypeParameterFragment> get fragments;
2734+
26292735
/// Returns the [TypeParameterType] with the given [nullabilitySuffix] for
26302736
/// this type parameter.
26312737
TypeParameterType instantiate({
@@ -2655,6 +2761,9 @@ abstract class TypeParameterizedElement2 implements Element2, Annotatable {
26552761
@override
26562762
TypeParameterizedFragment get firstFragment;
26572763

2764+
@override
2765+
List<TypeParameterizedFragment> get fragments;
2766+
26582767
/// If the element defines a type, indicates whether the type may safely
26592768
/// appear without explicit type arguments as the bounds of a type parameter
26602769
/// declaration.
@@ -2702,6 +2811,9 @@ abstract class VariableElement2 implements Element2 {
27022811
@override
27032812
VariableFragment get firstFragment;
27042813

2814+
@override
2815+
List<VariableFragment> get fragments;
2816+
27052817
/// Whether the variable element did not have an explicit type specified
27062818
/// for it.
27072819
bool get hasImplicitType;

0 commit comments

Comments
 (0)