Skip to content

Commit 2862fdf

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Migrate test/services/correction/status_test.dart
Change-Id: Ie0afd64be7b90d68c81b05f2973557a5c562a431 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400165 Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 61ba8df commit 2862fdf

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

pkg/analysis_server/analyzer_use_new_elements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ lib/src/services/search/element_visitors.dart
2626
lib/src/services/search/search_engine.dart
2727
lib/src/services/search/search_engine_internal.dart
2828
test/abstract_single_unit.dart
29-
test/services/correction/status_test.dart
3029
test/services/refactoring/legacy/abstract_rename.dart
3130
test/services/refactoring/legacy/rename_import_test.dart
3231
test/services/search/element_visitors_test.dart

pkg/analysis_server/lib/src/services/search/search_engine_internal.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,10 @@ class SearchMatchImpl implements SearchMatch {
293293
final Source unitSource;
294294

295295
@override
296-
final LibraryElement libraryElement;
296+
final LibraryElement2 libraryElement2;
297297

298298
@override
299-
final Element element;
299+
final Element2 element2;
300300

301301
@override
302302
final bool isResolved;
@@ -314,19 +314,19 @@ class SearchMatchImpl implements SearchMatch {
314314
this.file,
315315
this.librarySource,
316316
this.unitSource,
317-
this.libraryElement,
318-
this.element,
317+
this.libraryElement2,
318+
this.element2,
319319
this.isResolved,
320320
this.isQualified,
321321
this.kind,
322322
this.sourceRange,
323323
);
324324

325325
@override
326-
Element2 get element2 => element.asElement2!;
326+
Element get element => element2.asElement!;
327327

328328
@override
329-
LibraryElement2 get libraryElement2 => libraryElement.asElement2;
329+
LibraryElement get libraryElement => libraryElement2.asElement;
330330

331331
@override
332332
String toString() {
@@ -352,8 +352,8 @@ class SearchMatchImpl implements SearchMatch {
352352
element.source!.fullName,
353353
element.librarySource!,
354354
element.source!,
355-
element.library!,
356-
element,
355+
element.library!.asElement2,
356+
element.asElement2!,
357357
true,
358358
true,
359359
MatchKind.DECLARATION,
@@ -367,8 +367,8 @@ class SearchMatchImpl implements SearchMatch {
367367
enclosingElement.source!.fullName,
368368
enclosingElement.librarySource!,
369369
enclosingElement.source!,
370-
enclosingElement.library!,
371-
enclosingElement,
370+
enclosingElement.library!.asElement2,
371+
enclosingElement.asElement2!,
372372
result.isResolved,
373373
result.isQualified,
374374
toMatchKind(result.kind),

pkg/analysis_server/test/services/correction/status_test.dart

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ void main() {
2424
class RefactoringLocationTest extends AbstractSingleUnitTest {
2525
Future<void> test_createLocation_forElement() async {
2626
await resolveTestCode('class MyClass {}');
27-
var element = findElement.class_('MyClass');
27+
var element = findElement2.class_('MyClass');
2828
// check
29-
var location = newLocation_fromElement(element)!;
29+
var location = newLocation_fromElement2(element)!;
3030
expect(location.file, testFile.path);
3131
expect(location.offset, 6);
3232
expect(location.length, 7);
@@ -36,13 +36,15 @@ class RefactoringLocationTest extends AbstractSingleUnitTest {
3636

3737
Future<void> test_createLocation_forMatch() async {
3838
await resolveTestCode('class MyClass {}');
39-
var element = findElement.class_('MyClass');
40-
var sourceRange = range.elementName(element);
39+
var element = findElement2.class_('MyClass');
40+
var firstFragment = element.firstFragment;
41+
var libraryFragment = firstFragment.libraryFragment;
42+
var sourceRange = range.fragmentName(firstFragment)!;
4143
SearchMatch match = SearchMatchImpl(
42-
element.source.fullName,
43-
element.library.source,
44-
element.source,
45-
element.library,
44+
libraryFragment.source.fullName,
45+
element.library2.firstFragment.source,
46+
libraryFragment.source,
47+
element.library2,
4648
element,
4749
true,
4850
false,

0 commit comments

Comments
 (0)