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

Side by Side Diff: pkg/analyzer/lib/src/generated/testing/node_search.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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/dart/element/builder_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:analyzer/dart/ast/ast.dart';
6 import 'package:analyzer/dart/ast/visitor.dart';
7
8 /**
9 * Search the [unit] for declared [SimpleIdentifier]s with the given [name].
10 */
11 List<SimpleIdentifier> findDeclaredIdentifiersByName(
12 CompilationUnit unit, String name) {
13 var finder = new _DeclaredIdentifiersByNameFinder(name);
14 unit.accept(finder);
15 return finder.identifiers;
16 }
17
18 class _DeclaredIdentifiersByNameFinder extends RecursiveAstVisitor<Null> {
19 final String name;
20 final List<SimpleIdentifier> identifiers = [];
21
22 _DeclaredIdentifiersByNameFinder(this.name);
23
24 @override
25 visitSimpleIdentifier(SimpleIdentifier node) {
26 if (node.name == name && node.inDeclarationContext()) {
27 identifiers.add(node);
28 }
29 }
30 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/dart/element/builder_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698