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 context.directory.manager; | 5 library context.directory.manager; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'dart:core'; | 10 import 'dart:core'; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 List<String> get includedPaths; | 272 List<String> get includedPaths; |
273 | 273 |
274 /** | 274 /** |
275 * Return a list of all of the contexts reachable from the given | 275 * Return a list of all of the contexts reachable from the given |
276 * [analysisRoot] (the context associated with [analysisRoot] and all of its | 276 * [analysisRoot] (the context associated with [analysisRoot] and all of its |
277 * descendants). | 277 * descendants). |
278 */ | 278 */ |
279 List<AnalysisContext> contextsInAnalysisRoot(Folder analysisRoot); | 279 List<AnalysisContext> contextsInAnalysisRoot(Folder analysisRoot); |
280 | 280 |
281 /** | 281 /** |
| 282 * Return the [AnalysisDriver] for the "innermost" context whose associated |
| 283 * folder is or contains the given path. ("innermost" refers to the nesting |
| 284 * of contexts, so if there is a context for path /foo and a context for |
| 285 * path /foo/bar, then the innermost context containing /foo/bar/baz.dart is |
| 286 * the context for /foo/bar.) |
| 287 * |
| 288 * If no driver contains the given path, `null` is returned. |
| 289 */ |
| 290 AnalysisDriver getDriverFor(String path); |
| 291 |
| 292 /** |
282 * Return the [AnalysisContext] for the "innermost" context whose associated | 293 * Return the [AnalysisContext] for the "innermost" context whose associated |
283 * folder is or contains the given path. ("innermost" refers to the nesting | 294 * folder is or contains the given path. ("innermost" refers to the nesting |
284 * of contexts, so if there is a context for path /foo and a context for | 295 * of contexts, so if there is a context for path /foo and a context for |
285 * path /foo/bar, then the innermost context containing /foo/bar/baz.dart is | 296 * path /foo/bar, then the innermost context containing /foo/bar/baz.dart is |
286 * the context for /foo/bar.) | 297 * the context for /foo/bar.) |
287 * | 298 * |
288 * If no context contains the given path, `null` is returned. | 299 * If no context contains the given path, `null` is returned. |
289 */ | 300 */ |
290 AnalysisContext getContextFor(String path); | 301 AnalysisContext getContextFor(String path); |
291 | 302 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 } | 587 } |
577 return contexts; | 588 return contexts; |
578 } | 589 } |
579 | 590 |
580 /** | 591 /** |
581 * Check if this map defines embedded libraries. | 592 * Check if this map defines embedded libraries. |
582 */ | 593 */ |
583 bool definesEmbeddedLibs(Map map) => map[_EMBEDDED_LIB_MAP_KEY] != null; | 594 bool definesEmbeddedLibs(Map map) => map[_EMBEDDED_LIB_MAP_KEY] != null; |
584 | 595 |
585 @override | 596 @override |
| 597 AnalysisDriver getDriverFor(String path) { |
| 598 return _getInnermostContextInfoFor(path)?.analysisDriver; |
| 599 } |
| 600 |
| 601 @override |
586 AnalysisContext getContextFor(String path) { | 602 AnalysisContext getContextFor(String path) { |
587 return _getInnermostContextInfoFor(path)?.context; | 603 return _getInnermostContextInfoFor(path)?.context; |
588 } | 604 } |
589 | 605 |
590 /** | 606 /** |
591 * For testing: get the [ContextInfo] object for the given [folder], if any. | 607 * For testing: get the [ContextInfo] object for the given [folder], if any. |
592 */ | 608 */ |
593 ContextInfo getContextInfoFor(Folder folder) { | 609 ContextInfo getContextInfoFor(Folder folder) { |
594 ContextInfo info = _getInnermostContextInfoFor(folder.path); | 610 ContextInfo info = _getInnermostContextInfoFor(folder.path); |
595 if (info != null && folder == info.folder) { | 611 if (info != null && folder == info.folder) { |
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1946 } | 1962 } |
1947 return _embedderLocator; | 1963 return _embedderLocator; |
1948 } | 1964 } |
1949 | 1965 |
1950 @override | 1966 @override |
1951 SdkExtensionFinder getSdkExtensionFinder(ResourceProvider resourceProvider) { | 1967 SdkExtensionFinder getSdkExtensionFinder(ResourceProvider resourceProvider) { |
1952 return _sdkExtensionFinder ??= | 1968 return _sdkExtensionFinder ??= |
1953 new SdkExtensionFinder(buildPackageMap(resourceProvider)); | 1969 new SdkExtensionFinder(buildPackageMap(resourceProvider)); |
1954 } | 1970 } |
1955 } | 1971 } |
OLD | NEW |