| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 test.services.refactoring; | 5 library test.services.refactoring; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart' | 9 import 'package:analysis_server/plugin/protocol/protocol.dart' |
| 10 show | 10 show |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 153 } |
| 154 | 154 |
| 155 /** | 155 /** |
| 156 * Completes with a fully resolved unit that contains the [element]. | 156 * Completes with a fully resolved unit that contains the [element]. |
| 157 */ | 157 */ |
| 158 Future<CompilationUnit> getResolvedUnitWithElement(Element element) async { | 158 Future<CompilationUnit> getResolvedUnitWithElement(Element element) async { |
| 159 return element.context | 159 return element.context |
| 160 .resolveCompilationUnit(element.source, element.library); | 160 .resolveCompilationUnit(element.source, element.library); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void indexTestUnit(String code) { | 163 Future<Null> indexTestUnit(String code) async { |
| 164 resolveTestUnit(code); | 164 await resolveTestUnit(code); |
| 165 index.indexUnit(testUnit); | 165 index.indexUnit(testUnit); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void indexUnit(String file, String code) { | 168 Future<Null> indexUnit(String file, String code) async { |
| 169 Source source = addSource(file, code); | 169 Source source = addSource(file, code); |
| 170 CompilationUnit unit = resolveLibraryUnit(source); | 170 CompilationUnit unit = await resolveLibraryUnit(source); |
| 171 index.indexUnit(unit); | 171 index.indexUnit(unit); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void setUp() { | 174 void setUp() { |
| 175 super.setUp(); | 175 super.setUp(); |
| 176 index = createMemoryIndex(); | 176 index = createMemoryIndex(); |
| 177 searchEngine = new SearchEngineImpl(index); | 177 searchEngine = new SearchEngineImpl(index); |
| 178 } | 178 } |
| 179 } | 179 } |
| OLD | NEW |