| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'dart:core'; | 7 import 'dart:core'; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 import 'dart:math' show max; | 9 import 'dart:math' show max; |
| 10 | 10 |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 } | 679 } |
| 680 return null; | 680 return null; |
| 681 } | 681 } |
| 682 | 682 |
| 683 /** | 683 /** |
| 684 * Return an analysis driver to which the file with the given [path] is | 684 * Return an analysis driver to which the file with the given [path] is |
| 685 * added if one exists, otherwise a driver in which the file was analyzed if | 685 * added if one exists, otherwise a driver in which the file was analyzed if |
| 686 * one exists, otherwise the first driver, otherwise `null`. | 686 * one exists, otherwise the first driver, otherwise `null`. |
| 687 */ | 687 */ |
| 688 nd.AnalysisDriver getAnalysisDriver(String path) { | 688 nd.AnalysisDriver getAnalysisDriver(String path) { |
| 689 Iterable<nd.AnalysisDriver> drivers = driverMap.values; | 689 List<nd.AnalysisDriver> drivers = driverMap.values.toList(); |
| 690 if (drivers.isNotEmpty) { | 690 if (drivers.isNotEmpty) { |
| 691 // Sort the drivers so that more deeply nested contexts will be checked |
| 692 // before enclosing contexts. |
| 693 drivers.sort((first, second) => |
| 694 second.contextRoot.root.length - first.contextRoot.root.length); |
| 691 nd.AnalysisDriver driver = drivers.firstWhere( | 695 nd.AnalysisDriver driver = drivers.firstWhere( |
| 692 (driver) => driver.contextRoot.containsFile(path), | 696 (driver) => driver.contextRoot.containsFile(path), |
| 693 orElse: () => null); | 697 orElse: () => null); |
| 694 driver ??= drivers.firstWhere( | 698 driver ??= drivers.firstWhere( |
| 695 (driver) => driver.knownFiles.contains(path), | 699 (driver) => driver.knownFiles.contains(path), |
| 696 orElse: () => null); | 700 orElse: () => null); |
| 697 driver ??= drivers.first; | 701 driver ??= drivers.first; |
| 698 return driver; | 702 return driver; |
| 699 } | 703 } |
| 700 return null; | 704 return null; |
| (...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2364 /** | 2368 /** |
| 2365 * The [PerformanceTag] for time spent in server request handlers. | 2369 * The [PerformanceTag] for time spent in server request handlers. |
| 2366 */ | 2370 */ |
| 2367 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2371 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 2368 | 2372 |
| 2369 /** | 2373 /** |
| 2370 * The [PerformanceTag] for time spent in split store microtasks. | 2374 * The [PerformanceTag] for time spent in split store microtasks. |
| 2371 */ | 2375 */ |
| 2372 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2376 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 2373 } | 2377 } |
| OLD | NEW |