| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 var completer = new Completer<AnalysisResult>(); | 370 var completer = new Completer<AnalysisResult>(); |
| 371 _requestedFiles | 371 _requestedFiles |
| 372 .putIfAbsent(path, () => <Completer<AnalysisResult>>[]) | 372 .putIfAbsent(path, () => <Completer<AnalysisResult>>[]) |
| 373 .add(completer); | 373 .add(completer); |
| 374 _transitionToAnalyzing(); | 374 _transitionToAnalyzing(); |
| 375 _hasWork.notify(); | 375 _hasWork.notify(); |
| 376 return completer.future; | 376 return completer.future; |
| 377 } | 377 } |
| 378 | 378 |
| 379 /** | 379 /** |
| 380 * Return `true` if the file with the given [path] was explicitly added |
| 381 * to analysis using [addFile]. |
| 382 */ |
| 383 bool isAddedFile(String path) { |
| 384 return _explicitFiles.contains(path); |
| 385 } |
| 386 |
| 387 /** |
| 380 * Returns a [Future] that completes after pumping the event queue [times] | 388 * Returns a [Future] that completes after pumping the event queue [times] |
| 381 * times. By default, this should pump the event queue enough times to allow | 389 * times. By default, this should pump the event queue enough times to allow |
| 382 * any code to run, as long as it's not waiting on some external event. | 390 * any code to run, as long as it's not waiting on some external event. |
| 383 */ | 391 */ |
| 384 Future pumpEventQueue([int times = 5000]) { | 392 Future pumpEventQueue([int times = 5000]) { |
| 385 if (times == 0) return new Future.value(); | 393 if (times == 0) return new Future.value(); |
| 386 // We use a delayed future to allow microtask events to finish. The | 394 // We use a delayed future to allow microtask events to finish. The |
| 387 // Future.value or Future() constructors use scheduleMicrotask themselves an
d | 395 // Future.value or Future() constructors use scheduleMicrotask themselves an
d |
| 388 // would therefore not wait for microtask callbacks that are scheduled after | 396 // would therefore not wait for microtask callbacks that are scheduled after |
| 389 // invoking this method. | 397 // invoking this method. |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 } | 1230 } |
| 1223 } | 1231 } |
| 1224 for (UnlinkedExportPublic export in unit.publicNamespace.exports) { | 1232 for (UnlinkedExportPublic export in unit.publicNamespace.exports) { |
| 1225 referenced.exported.add(export.uri); | 1233 referenced.exported.add(export.uri); |
| 1226 } | 1234 } |
| 1227 return referenced; | 1235 return referenced; |
| 1228 } | 1236 } |
| 1229 | 1237 |
| 1230 _ReferencedUris._(); | 1238 _ReferencedUris._(); |
| 1231 } | 1239 } |
| OLD | NEW |