| 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:typed_data'; | 7 import 'dart:typed_data'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 } | 335 } |
| 336 | 336 |
| 337 /** | 337 /** |
| 338 * Notify the driver that the client is going to stop using it. | 338 * Notify the driver that the client is going to stop using it. |
| 339 */ | 339 */ |
| 340 void dispose() { | 340 void dispose() { |
| 341 _scheduler._remove(this); | 341 _scheduler._remove(this); |
| 342 } | 342 } |
| 343 | 343 |
| 344 /** | 344 /** |
| 345 * Return the [Future] that completes with a [AnalysisResult] for the file | 345 * Return the [Future] that completes with a [AnalysisResult] for the Dart |
| 346 * with the given [path]. | 346 * file with the given [path]. If the file is not a Dart file, the [Future] |
| 347 * completes with `null`. |
| 347 * | 348 * |
| 348 * The [path] must be absolute and normalized. | 349 * The [path] must be absolute and normalized. |
| 349 * | 350 * |
| 350 * The [path] can be any file - explicitly or implicitly analyzed, or neither. | 351 * The [path] can be any file - explicitly or implicitly analyzed, or neither. |
| 351 * | 352 * |
| 352 * Causes the analysis state to transition to "analyzing" (if it is not in | 353 * Causes the analysis state to transition to "analyzing" (if it is not in |
| 353 * that state already), the driver will read the file and produce the analysis | 354 * that state already), the driver will read the file and produce the analysis |
| 354 * result for it, which is consistent with the current file state (including | 355 * result for it, which is consistent with the current file state (including |
| 355 * the new state of the file), prior to the next time the analysis state | 356 * the new state of the file), prior to the next time the analysis state |
| 356 * transitions to "idle". | 357 * transitions to "idle". |
| 357 */ | 358 */ |
| 358 Future<AnalysisResult> getResult(String path) { | 359 Future<AnalysisResult> getResult(String path) { |
| 359 var completer = new Completer<AnalysisResult>(); | 360 if (AnalysisEngine.isDartFileName(path)) { |
| 360 _requestedFiles | 361 var completer = new Completer<AnalysisResult>(); |
| 361 .putIfAbsent(path, () => <Completer<AnalysisResult>>[]) | 362 _requestedFiles |
| 362 .add(completer); | 363 .putIfAbsent(path, () => <Completer<AnalysisResult>>[]) |
| 363 _statusSupport.transitionToAnalyzing(); | 364 .add(completer); |
| 364 _scheduler._notify(this); | 365 _statusSupport.transitionToAnalyzing(); |
| 365 return completer.future; | 366 _scheduler._notify(this); |
| 367 return completer.future; |
| 368 } |
| 369 return new Future.value(); |
| 366 } | 370 } |
| 367 | 371 |
| 368 /** | 372 /** |
| 369 * Return the [Future] that completes with a [ParseResult] for the file | 373 * Return the [Future] that completes with a [ParseResult] for the file |
| 370 * with the given [path]. | 374 * with the given [path]. |
| 371 * | 375 * |
| 372 * The [path] must be absolute and normalized. | 376 * The [path] must be absolute and normalized. |
| 373 * | 377 * |
| 374 * The [path] can be any file - explicitly or implicitly analyzed, or neither. | 378 * The [path] can be any file - explicitly or implicitly analyzed, or neither. |
| 375 * | 379 * |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 } | 1180 } |
| 1177 } | 1181 } |
| 1178 | 1182 |
| 1179 appendDependencies(file); | 1183 appendDependencies(file); |
| 1180 } | 1184 } |
| 1181 } | 1185 } |
| 1182 | 1186 |
| 1183 @override | 1187 @override |
| 1184 String toString() => uri.toString(); | 1188 String toString() => uri.toString(); |
| 1185 } | 1189 } |
| OLD | NEW |