OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.test.src.context.abstract_context; | 5 library analyzer.test.src.context.abstract_context; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
9 import 'package:analyzer/dart/element/visitor.dart'; | 9 import 'package:analyzer/dart/element/visitor.dart'; |
10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
11 import 'package:analyzer/file_system/memory_file_system.dart'; | 11 import 'package:analyzer/file_system/memory_file_system.dart'; |
12 import 'package:analyzer/src/context/cache.dart'; | 12 import 'package:analyzer/src/context/cache.dart'; |
13 import 'package:analyzer/src/context/context.dart'; | 13 import 'package:analyzer/src/context/context.dart'; |
14 import 'package:analyzer/src/generated/engine.dart'; | 14 import 'package:analyzer/src/generated/engine.dart'; |
15 import 'package:analyzer/src/generated/sdk.dart'; | 15 import 'package:analyzer/src/generated/sdk.dart'; |
16 import 'package:analyzer/src/generated/source.dart'; | 16 import 'package:analyzer/src/generated/source.dart'; |
17 import 'package:analyzer/src/task/driver.dart'; | 17 import 'package:analyzer/src/task/driver.dart'; |
18 import 'package:analyzer/task/model.dart'; | 18 import 'package:analyzer/task/model.dart'; |
19 import 'package:plugin/manager.dart'; | 19 import 'package:plugin/manager.dart'; |
20 import 'package:plugin/plugin.dart'; | 20 import 'package:plugin/plugin.dart'; |
21 import 'package:unittest/unittest.dart'; | 21 import 'package:test/test.dart'; |
22 | 22 |
23 import 'mock_sdk.dart'; | 23 import 'mock_sdk.dart'; |
24 | 24 |
25 /** | 25 /** |
26 * Finds an [Element] with the given [name]. | 26 * Finds an [Element] with the given [name]. |
27 */ | 27 */ |
28 Element findChildElement(Element root, String name, [ElementKind kind]) { | 28 Element findChildElement(Element root, String name, [ElementKind kind]) { |
29 Element result = null; | 29 Element result = null; |
30 root.accept(new _ElementVisitorFunctionWrapper((Element element) { | 30 root.accept(new _ElementVisitorFunctionWrapper((Element element) { |
31 if (element.name != name) { | 31 if (element.name != name) { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { | 180 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { |
181 final _ElementVisitorFunction function; | 181 final _ElementVisitorFunction function; |
182 | 182 |
183 _ElementVisitorFunctionWrapper(this.function); | 183 _ElementVisitorFunctionWrapper(this.function); |
184 | 184 |
185 visitElement(Element element) { | 185 visitElement(Element element) { |
186 function(element); | 186 function(element); |
187 super.visitElement(element); | 187 super.visitElement(element); |
188 } | 188 } |
189 } | 189 } |
OLD | NEW |