Skip to content

Commit 2cf84f8

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Rename most XyzElementImpl into XyzFragmentImpl.
Change-Id: I7902ccedd9d3e9ccde1091eb28aad98591791b6e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424922 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 7a83c82 commit 2cf84f8

File tree

83 files changed

+6770
-6733
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+6770
-6733
lines changed

pkg/analysis_server/lib/plugin/protocol/protocol_dart.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ ElementKind convertElementToElementKind(engine.Element element) {
133133
return convertElementKind(element.kind);
134134
}
135135

136-
Element convertLibraryFragment(CompilationUnitElementImpl fragment) {
136+
Element convertLibraryFragment(LibraryFragmentImpl fragment) {
137137
return Element(
138138
ElementKind.COMPILATION_UNIT,
139139
path.basename(fragment.source.fullName),

pkg/analysis_server/lib/src/computer/computer_call_hierarchy.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class CallHierarchyItem {
121121
// For synthetic items (like implicit constructors), use the nonSynthetic
122122
// element for the location.
123123
element = _nonSynthetic(element);
124-
var fragment = element.firstFragment as ElementImpl;
124+
var fragment = element.firstFragment as FragmentImpl;
125125

126126
// Non-synthetic elements should always have code locations.
127127
// TODO(brianwilkerson): Figure out why that's no longer true and possibly
@@ -134,7 +134,7 @@ class CallHierarchyItem {
134134
// For synthetic items (like implicit constructors), use the nonSynthetic
135135
// element for the location.
136136
element = _nonSynthetic(element);
137-
var fragment = element.firstFragment as ElementImpl;
137+
var fragment = element.firstFragment as FragmentImpl;
138138

139139
// Compilation units will return -1 for nameOffset which is not valid, so
140140
// use 0:0.

pkg/analysis_server/lib/src/computer/computer_lazy_type_hierarchy.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class TypeHierarchyItem {
217217
/// Returns the [SourceRange] of the code for [element].
218218
static SourceRange _codeRangeForElement(Element element) {
219219
// Non-synthetic elements should always have code locations.
220-
var firstFragment = element.nonSynthetic2.firstFragment as ElementImpl;
220+
var firstFragment = element.nonSynthetic2.firstFragment as FragmentImpl;
221221
return SourceRange(firstFragment.codeOffset!, firstFragment.codeLength!);
222222
}
223223

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class DefinitionHandler
234234
// Read the main codeOffset from the element. This may include doc comments
235235
// but will give the correct end position.
236236
int? codeOffset, codeLength;
237-
if (codeFragment case ElementImpl codeFragment) {
237+
if (codeFragment case FragmentImpl codeFragment) {
238238
codeOffset = codeFragment.codeOffset;
239239
codeLength = codeFragment.codeLength;
240240
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class TypeDefinitionHandler
177177
analyzer.LibraryFragment targetUnit,
178178
) {
179179
var (codeOffset, codeLength) = switch (targetFragment) {
180-
ElementImpl e => (e.codeOffset, e.codeLength),
180+
FragmentImpl e => (e.codeOffset, e.codeLength),
181181
_ => (null, null),
182182
};
183183

pkg/analysis_server/lib/src/lsp/mapping.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ lsp.Location? fragmentToLocation(
516516

517517
int? nameOffset;
518518
int? nameLength;
519-
if (fragment case PropertyAccessorElementImpl(
519+
if (fragment case PropertyAccessorFragmentImpl(
520520
:var isSynthetic,
521521
:var nonSynthetic,
522522
) when isSynthetic) {

pkg/analysis_server/lib/src/protocol_server.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ List<Element> _computePath(engine.Element element) {
348348
var path = <Element>[];
349349
for (var fragment in element.firstFragment.withAncestors) {
350350
if (fragment is engine.LibraryFragment) {
351-
path.add(convertLibraryFragment(fragment as CompilationUnitElementImpl));
351+
path.add(convertLibraryFragment(fragment as LibraryFragmentImpl));
352352
}
353353
path.add(convertElement(fragment.element));
354354
}

pkg/analysis_server/lib/src/services/refactoring/legacy/rename_local.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,16 @@ class RenameLocalRefactoringImpl extends RenameRefactoringImpl {
175175
var element = this.element;
176176
if (element is PatternVariableElement) {
177177
var rootVariable =
178-
(element.firstFragment as PatternVariableElementImpl).rootVariable;
178+
(element.firstFragment as PatternVariableFragmentImpl).rootVariable;
179179
var declaredFragments =
180-
rootVariable is JoinPatternVariableElementImpl
180+
rootVariable is JoinPatternVariableFragmentImpl
181181
? rootVariable.transitiveVariables
182-
.whereType<BindPatternVariableElementImpl>()
182+
.whereType<BindPatternVariableFragmentImpl>()
183183
.toList()
184184
: [element.firstFragment];
185185
for (var declaredFragment in declaredFragments) {
186186
processor.addDeclarationEdit(declaredFragment.element);
187-
if (declaredFragment is BindPatternVariableElementImpl) {
187+
if (declaredFragment is BindPatternVariableFragmentImpl) {
188188
// If a variable is used to resolve a named field with an implicit
189189
// name, we need to make the field name explicit.
190190
var fieldName = declaredFragment.node.fieldNameWithImplicitName;

pkg/analysis_server/lib/src/status/element_writer.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ class ElementWriter with TreeWriter {
5252
properties['isValidMixin'] = element.isValidMixin;
5353
}
5454
}
55-
if (firstFragment is ConstFieldElementImpl) {
55+
if (firstFragment is ConstFieldFragmentImpl) {
5656
properties['evaluationResult'] = firstFragment.evaluationResult;
5757
}
58-
if (firstFragment is ConstLocalVariableElementImpl) {
58+
if (firstFragment is ConstLocalVariableFragmentImpl) {
5959
properties['evaluationResult'] = firstFragment.evaluationResult;
6060
}
61-
if (firstFragment is ConstTopLevelVariableElementImpl) {
61+
if (firstFragment is ConstTopLevelVariableFragmentImpl) {
6262
properties['evaluationResult'] = firstFragment.evaluationResult;
6363
}
6464
if (element is ConstructorElement) {

pkg/analysis_server/test/services/refactoring/agnostic/change_method_signature_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class AbstractChangeMethodSignatureTest extends AbstractContextTest {
118118
var enclosingElement = element.enclosingElement2;
119119
var reference = switch (element) {
120120
ElementImpl2() =>
121-
element.reference ?? (element.firstFragment as ElementImpl).reference,
121+
element.reference ?? (element.firstFragment as FragmentImpl).reference,
122122
_ => null,
123123
};
124124
if (reference != null) {

0 commit comments

Comments
 (0)