Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2042)

Unified Diff: pkg/analysis_server/test/plugin/protocol_dart_test.dart

Issue 2965133003: Move findElementsByName() into shared analyzer/element_search.dart file. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/plugin/protocol_dart_test.dart
diff --git a/pkg/analysis_server/test/plugin/protocol_dart_test.dart b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
index 6f456409d2498eb1d2925080d44377cff0167669..4e1fff179946f237b14cfae9f0ff5e213a7d8130 100644
--- a/pkg/analysis_server/test/plugin/protocol_dart_test.dart
+++ b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
@@ -12,6 +12,7 @@ import 'package:analyzer/src/dart/ast/utilities.dart' as engine;
import 'package:analyzer/src/dart/element/element.dart' as engine;
import 'package:analyzer/src/error/codes.dart' as engine;
import 'package:analyzer/src/generated/source.dart' as engine;
+import 'package:analyzer/src/generated/testing/search.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -25,16 +26,6 @@ main() {
});
}
-/**
- * Search the [unit] for the [engine.Element]s with the given [name].
- */
-List<engine.Element> findElementsByName(
- engine.CompilationUnit unit, String name) {
- var finder = new _ElementsByNameFinder(name);
- unit.accept(finder);
- return finder.elements;
-}
-
@reflectiveTest
class ElementKindTest {
void test_fromEngine() {
@@ -488,17 +479,3 @@ class A {
expect(element.flags, 0);
}
}
-
-class _ElementsByNameFinder extends engine.RecursiveAstVisitor<Null> {
- final String name;
- final List<engine.Element> elements = [];
-
- _ElementsByNameFinder(this.name);
-
- @override
- visitSimpleIdentifier(engine.SimpleIdentifier node) {
- if (node.name == name && node.inDeclarationContext()) {
- elements.add(node.staticElement);
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698