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

Unified Diff: pkg/analyzer/test/utils.dart

Issue 2965423002: Stop using ExecutableElement.functions in tests. (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
« no previous file with comments | « pkg/analyzer/test/src/task/strong/inferred_type_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/utils.dart
diff --git a/pkg/analyzer/test/utils.dart b/pkg/analyzer/test/utils.dart
index ed733b81e5c6fc9e707cdae9701ebf78c5bec4d0..72c71cd8db44a7885cacc7246b120333477e17fe 100644
--- a/pkg/analyzer/test/utils.dart
+++ b/pkg/analyzer/test/utils.dart
@@ -17,6 +17,18 @@ import 'package:test/test.dart';
* Search the [unit] for the [LocalVariableElement] with the given [name].
* Fail if there is not exactly one such variable.
*/
+FunctionElement findLocalFunction(CompilationUnit unit, String name) {
+ List<Element> elements = findElementsByName(unit, name);
+ List<Element> functions =
+ elements.where((e) => e is FunctionElement).toList();
+ expect(functions, hasLength(1));
+ return functions[0];
+}
+
+/**
+ * Search the [unit] for the [LocalVariableElement] with the given [name].
+ * Fail if there is not exactly one such variable.
+ */
LocalVariableElement findLocalVariable(CompilationUnit unit, String name) {
List<Element> elements = findElementsByName(unit, name);
List<Element> localVariables =
« no previous file with comments | « pkg/analyzer/test/src/task/strong/inferred_type_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698