Skip to content

Commit 1747e2d

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Migrate tool/benchmark/heap/flutter_elements.dart
Change-Id: Ie60dbfbba92d9717fb4fb0e3709be2a24f1aa39a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395084 Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 6907727 commit 1747e2d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

pkg/analyzer/analyzer_use_new_elements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,3 @@ test/util/element_printer.dart
331331
test/util/element_type_matchers.dart
332332
test/util/id_testing_helper.dart
333333
test/utils.dart
334-
tool/benchmark/heap/flutter_elements.dart

pkg/analyzer/tool/benchmark/heap/flutter_elements.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import 'dart:io' as io;
77
import 'dart:typed_data';
88

99
import 'package:analyzer/dart/analysis/results.dart';
10-
import 'package:analyzer/dart/element/element.dart';
11-
import 'package:analyzer/dart/element/visitor.dart';
10+
import 'package:analyzer/dart/element/element2.dart';
11+
import 'package:analyzer/dart/element/visitor2.dart';
1212
import 'package:analyzer/error/error.dart';
1313
import 'package:analyzer/file_system/physical_file_system.dart';
1414
import 'package:analyzer/src/dart/analysis/analysis_context_collection.dart';
@@ -268,7 +268,7 @@ Future<void> _getAvailableLibraries(
268268
// }
269269
var result = await analysisDriver.getLibraryByUri(file.uriStr);
270270
if (result is LibraryElementResult) {
271-
result.element.accept(_AllElementVisitor());
271+
result.element2.accept2(_AllElementVisitor());
272272
}
273273
}
274274
}
@@ -331,11 +331,13 @@ void _writeResultFile(BenchmarkResultCompound result) {
331331
io.File(_resultFilePath).writeAsStringSync(result.asXmlText, flush: true);
332332
}
333333

334-
class _AllElementVisitor extends GeneralizingElementVisitor<void> {
334+
class _AllElementVisitor extends GeneralizingElementVisitor2<void> {
335335
@override
336-
void visitElement(Element element) {
336+
void visitElement(Element2 element) {
337337
// This triggers lazy reading.
338-
element.metadata;
338+
if (element case Annotatable element) {
339+
element.metadata2;
340+
}
339341
super.visitElement(element);
340342
}
341343
}

0 commit comments

Comments
 (0)