Skip to content

Commit 886efdd

Browse files
scheglovCommit Queue
authored and
Commit Queue
committed
Elements. Migrate test/src/dart/analysis/result_printer.dart
Change-Id: If2faad6d907d806506aaceecca6fdf748c7a1ac7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415242 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 1e1dcf8 commit 886efdd

File tree

2 files changed

+11
-28
lines changed

2 files changed

+11
-28
lines changed

pkg/analyzer/test/src/dart/analysis/driver_test.dart

+10-10
Original file line numberDiff line numberDiff line change
@@ -1219,8 +1219,8 @@ final B1 = A1;
12191219
driver.addFile2(a);
12201220
driver.addFile2(b);
12211221

1222-
configuration.libraryConfiguration.unitConfiguration
1223-
.variableTypesSelector2 = (result) {
1222+
configuration.libraryConfiguration.unitConfiguration.variableTypesSelector =
1223+
(result) {
12241224
return switch (result.uriStr) {
12251225
'package:test/a.dart' => [
12261226
result.findElement2.topVar('A1'),
@@ -1306,8 +1306,8 @@ final A2 = B1;
13061306
driver.addFile2(a);
13071307
driver.priorityFiles2 = [a];
13081308

1309-
configuration.libraryConfiguration.unitConfiguration
1310-
.variableTypesSelector2 = (result) {
1309+
configuration.libraryConfiguration.unitConfiguration.variableTypesSelector =
1310+
(result) {
13111311
switch (result.uriStr) {
13121312
case 'package:test/a.dart':
13131313
return [
@@ -2606,8 +2606,8 @@ final foo = 0;
26062606
var driver = driverFor(testFile);
26072607
var collector = DriverEventCollector(driver);
26082608

2609-
configuration.libraryConfiguration.unitConfiguration
2610-
.variableTypesSelector2 = (result) {
2609+
configuration.libraryConfiguration.unitConfiguration.variableTypesSelector =
2610+
(result) {
26112611
return [
26122612
result.findElement2.topVar('foo'),
26132613
];
@@ -3025,8 +3025,8 @@ final B = A;
30253025
var driver = driverFor(testFile);
30263026
var collector = DriverEventCollector(driver);
30273027

3028-
configuration.libraryConfiguration.unitConfiguration
3029-
.variableTypesSelector2 = (result) {
3028+
configuration.libraryConfiguration.unitConfiguration.variableTypesSelector =
3029+
(result) {
30303030
switch (result.uriStr) {
30313031
case 'package:test/b.dart':
30323032
return [
@@ -4535,8 +4535,8 @@ final B = 0;
45354535
driver.addFile2(a);
45364536
driver.addFile2(b);
45374537

4538-
configuration.libraryConfiguration.unitConfiguration
4539-
.variableTypesSelector2 = (result) {
4538+
configuration.libraryConfiguration.unitConfiguration.variableTypesSelector =
4539+
(result) {
45404540
switch (result.uriStr) {
45414541
case 'package:test/a.dart':
45424542
return [

pkg/analyzer/test/src/dart/analysis/result_printer.dart

+1-18
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// ignore_for_file: analyzer_use_new_elements
6-
75
import 'package:analyzer/dart/analysis/results.dart';
86
import 'package:analyzer/dart/ast/ast.dart';
9-
import 'package:analyzer/dart/element/element.dart';
107
import 'package:analyzer/dart/element/element2.dart';
118
import 'package:analyzer/dart/element/nullability_suffix.dart';
129
import 'package:analyzer/dart/element/type.dart';
@@ -993,17 +990,6 @@ class ResolvedUnitResultPrinter {
993990
sink.writeElements(
994991
'selectedVariableTypes',
995992
variableTypesToWrite,
996-
(variable) {
997-
sink.writeIndent();
998-
sink.write('${variable.name}: ');
999-
elementPrinter.writeType(variable.type);
1000-
},
1001-
);
1002-
1003-
var variableTypesToWrite2 = configuration.variableTypesSelector2(result);
1004-
sink.writeElements(
1005-
'selectedVariableTypes',
1006-
variableTypesToWrite2,
1007993
(variable) {
1008994
sink.writeIndent();
1009995
sink.write('${variable.name3}: ');
@@ -1022,10 +1008,7 @@ class ResolvedUnitResultPrinterConfiguration {
10221008
var nodeConfiguration = ResolvedNodeTextConfiguration();
10231009
AstNode? Function(ResolvedUnitResult) nodeSelector = (_) => null;
10241010
Map<String, DartType> Function(ResolvedUnitResult) typesSelector = (_) => {};
1025-
List<VariableElement> Function(ResolvedUnitResult) variableTypesSelector =
1026-
(_) => [];
1027-
List<Element2> Function(ResolvedUnitResult) variableTypesSelector2 =
1028-
(_) => [];
1011+
List<Element2> Function(ResolvedUnitResult) variableTypesSelector = (_) => [];
10291012
bool Function(FileResult) withContentPredicate = (_) => false;
10301013
}
10311014

0 commit comments

Comments
 (0)