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' hide Resource; | 10 import 'dart:core' hide Resource; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 * folder is or contains the given path. ("innermost" refers to the nesting | 232 * folder is or contains the given path. ("innermost" refers to the nesting |
233 * of contexts, so if there is a context for path /foo and a context for | 233 * of contexts, so if there is a context for path /foo and a context for |
234 * path /foo/bar, then the innermost context containing /foo/bar/baz.dart is | 234 * path /foo/bar, then the innermost context containing /foo/bar/baz.dart is |
235 * the context for /foo/bar.) | 235 * the context for /foo/bar.) |
236 * | 236 * |
237 * If no context contains the given path, `null` is returned. | 237 * If no context contains the given path, `null` is returned. |
238 */ | 238 */ |
239 AnalysisContext getContextFor(String path); | 239 AnalysisContext getContextFor(String path); |
240 | 240 |
241 /** | 241 /** |
| 242 * Return `true` if the given [path] is ignored by a [ContextInfo] whose |
| 243 * folder contains it. |
| 244 */ |
| 245 bool isIgnored(String path); |
| 246 |
| 247 /** |
242 * Return `true` if the given absolute [path] is in one of the current | 248 * Return `true` if the given absolute [path] is in one of the current |
243 * root folders and is not excluded. | 249 * root folders and is not excluded. |
244 */ | 250 */ |
245 bool isInAnalysisRoot(String path); | 251 bool isInAnalysisRoot(String path); |
246 | 252 |
247 /** | 253 /** |
248 * Rebuild the set of contexts from scratch based on the data last sent to | 254 * Rebuild the set of contexts from scratch based on the data last sent to |
249 * [setRoots]. Only contexts contained in the given list of analysis [roots] | 255 * [setRoots]. Only contexts contained in the given list of analysis [roots] |
250 * will be rebuilt, unless the list is `null`, in which case every context | 256 * will be rebuilt, unless the list is `null`, in which case every context |
251 * will be rebuilt. | 257 * will be rebuilt. |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 */ | 471 */ |
466 ContextInfo getContextInfoFor(Folder folder) { | 472 ContextInfo getContextInfoFor(Folder folder) { |
467 ContextInfo info = _getInnermostContextInfoFor(folder.path); | 473 ContextInfo info = _getInnermostContextInfoFor(folder.path); |
468 if (info != null && folder == info.folder) { | 474 if (info != null && folder == info.folder) { |
469 return info; | 475 return info; |
470 } | 476 } |
471 return null; | 477 return null; |
472 } | 478 } |
473 | 479 |
474 @override | 480 @override |
| 481 bool isIgnored(String path) { |
| 482 ContextInfo info = _rootInfo; |
| 483 do { |
| 484 info = info.findChildInfoFor(path); |
| 485 if (info == null) { |
| 486 return false; |
| 487 } |
| 488 if (info.ignored(path)) { |
| 489 return true; |
| 490 } |
| 491 } while (true); |
| 492 } |
| 493 |
| 494 @override |
475 bool isInAnalysisRoot(String path) { | 495 bool isInAnalysisRoot(String path) { |
476 // check if excluded | 496 // check if excluded |
477 if (_isExcluded(path)) { | 497 if (_isExcluded(path)) { |
478 return false; | 498 return false; |
479 } | 499 } |
480 // check if in one of the roots | 500 // check if in one of the roots |
481 for (ContextInfo info in _rootInfo.children) { | 501 for (ContextInfo info in _rootInfo.children) { |
482 if (info.folder.contains(path)) { | 502 if (info.folder.contains(path)) { |
483 return true; | 503 return true; |
484 } | 504 } |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 ResourceProvider resourceProvider) { | 1513 ResourceProvider resourceProvider) { |
1494 if (packages != null) { | 1514 if (packages != null) { |
1495 // Construct package map for the SdkExtUriResolver. | 1515 // Construct package map for the SdkExtUriResolver. |
1496 Map<String, List<Folder>> packageMap = buildPackageMap(resourceProvider); | 1516 Map<String, List<Folder>> packageMap = buildPackageMap(resourceProvider); |
1497 return <UriResolver>[new SdkExtUriResolver(packageMap)]; | 1517 return <UriResolver>[new SdkExtUriResolver(packageMap)]; |
1498 } else { | 1518 } else { |
1499 return const <UriResolver>[]; | 1519 return const <UriResolver>[]; |
1500 } | 1520 } |
1501 } | 1521 } |
1502 } | 1522 } |
OLD | NEW |