@@ -32,37 +32,25 @@ import 'package:meta/meta.dart';
3232import 'package:path/path.dart' ;
3333import 'package:yaml/yaml.dart' ;
3434
35- /**
36- * An implementation of a context locator.
37- */
35+ /// An implementation of a context locator.
3836class ContextLocatorImpl implements ContextLocator {
39- /**
40- * The name of the analysis options file.
41- */
37+ /// The name of the analysis options file.
4238 static const String ANALYSIS_OPTIONS_NAME = 'analysis_options.yaml' ;
4339
44- /**
45- * The name of the packages file.
46- */
40+ /// The name of the packages file.
4741 static const String PACKAGES_FILE_NAME = '.packages' ;
4842
49- /**
50- * The resource provider used to access the file system.
51- */
43+ /// The resource provider used to access the file system.
5244 final ResourceProvider resourceProvider;
5345
54- /**
55- * Initialize a newly created context locator. If a [resourceProvider] is
56- * supplied, it will be used to access the file system. Otherwise the default
57- * resource provider will be used.
58- */
46+ /// Initialize a newly created context locator. If a [resourceProvider] is
47+ /// supplied, it will be used to access the file system. Otherwise the default
48+ /// resource provider will be used.
5949 ContextLocatorImpl ({ResourceProvider resourceProvider})
6050 : this .resourceProvider =
6151 resourceProvider ?? PhysicalResourceProvider .INSTANCE ;
6252
63- /**
64- * Return the path to the default location of the SDK.
65- */
53+ /// Return the path to the default location of the SDK.
6654 String get _defaultSdkPath =>
6755 FolderBasedDartSdk .defaultSdkDirectory (resourceProvider).path;
6856
@@ -189,26 +177,23 @@ class ContextLocatorImpl implements ContextLocator {
189177 return roots;
190178 }
191179
192- /**
193- * Return `true` if the given [resource] is contained in one or more of the
194- * given [folders] .
195- */
180+ /// Return `true` if the given [resource] is contained in one or more of the
181+ /// given [folders] .
196182 bool _containedInAny (Iterable <Folder > folders, Resource resource) =>
197183 folders.any ((Folder folder) => folder.contains (resource.path));
198184
199- /**
200- * If the given [folder] should be the root of a new analysis context, then
201- * create a new context root for it and add it to the list of context [roots] .
202- * The [containingRoot] is the context root from an enclosing directory and is
203- * used to inherit configuration information that isn't overridden.
204- *
205- * If either the [optionsFile] or [packagesFile] is non-`null` then the given
206- * file will be used even if there is a local version of the file.
207- *
208- * For each directory within the given [folder] that is neither in the list of
209- * [excludedFolders] nor excluded by the [excludedFilePatterns] , recursively
210- * search for nested context roots.
211- */
185+ /// If the given [folder] should be the root of a new analysis context, then
186+ /// create a new context root for it and add it to the list of context
187+ /// [roots] . The [containingRoot] is the context root from an enclosing
188+ /// directory and is used to inherit configuration information that isn't
189+ /// overridden.
190+ ///
191+ /// If either the [optionsFile] or [packagesFile] is non-`null` then the given
192+ /// file will be used even if there is a local version of the file.
193+ ///
194+ /// For each directory within the given [folder] that is neither in the list
195+ /// of [excludedFolders] nor excluded by the [excludedFilePatterns] ,
196+ /// recursively search for nested context roots.
212197 void _createContextRoots (
213198 List <ContextRoot > roots,
214199 Folder folder,
@@ -253,14 +238,13 @@ class ContextLocatorImpl implements ContextLocator {
253238 excludedFilePatterns, optionsFile, packagesFile);
254239 }
255240
256- /**
257- * For each directory within the given [folder] that is neither in the list of
258- * [excludedFolders] nor excluded by the [excludedFilePatterns] , recursively
259- * search for nested context roots and add them to the list of [roots] .
260- *
261- * If either the [optionsFile] or [packagesFile] is non-`null` then the given
262- * file will be used even if there is a local version of the file.
263- */
241+ /// For each directory within the given [folder] that is neither in the list
242+ /// of [excludedFolders] nor excluded by the [excludedFilePatterns] ,
243+ /// recursively search for nested context roots and add them to the list of
244+ /// [roots] .
245+ ///
246+ /// If either the [optionsFile] or [packagesFile] is non-`null` then the given
247+ /// file will be used even if there is a local version of the file.
264248 void _createContextRootsIn (
265249 List <ContextRoot > roots,
266250 Folder folder,
@@ -303,11 +287,9 @@ class ContextLocatorImpl implements ContextLocator {
303287 }
304288 }
305289
306- /**
307- * Return the analysis options file to be used to analyze files in the given
308- * [folder] , or `null` if there is no analysis options file in the given
309- * folder or any parent folder.
310- */
290+ /// Return the analysis options file to be used to analyze files in the given
291+ /// [folder] , or `null` if there is no analysis options file in the given
292+ /// folder or any parent folder.
311293 File _findOptionsFile (Folder folder) {
312294 while (folder != null ) {
313295 File packagesFile = _getOptionsFile (folder);
@@ -319,11 +301,9 @@ class ContextLocatorImpl implements ContextLocator {
319301 return null ;
320302 }
321303
322- /**
323- * Return the packages file to be used to analyze files in the given [folder] ,
324- * or `null` if there is no packages file in the given folder or any parent
325- * folder.
326- */
304+ /// Return the packages file to be used to analyze files in the given
305+ /// [folder] , or `null` if there is no packages file in the given folder or
306+ /// any parent folder.
327307 File _findPackagesFile (Folder folder) {
328308 while (folder != null ) {
329309 File packagesFile = _getPackagesFile (folder);
@@ -375,10 +355,8 @@ class ContextLocatorImpl implements ContextLocator {
375355 return patterns;
376356 }
377357
378- /**
379- * If the given [directory] contains a file with the given [name] , then return
380- * the file. Otherwise, return `null` .
381- */
358+ /// If the given [directory] contains a file with the given [name] , then
359+ /// return the file. Otherwise, return `null` .
382360 File _getFile (Folder directory, String name) {
383361 Resource resource = directory.getChild (name);
384362 if (resource is File && resource.exists) {
@@ -387,24 +365,18 @@ class ContextLocatorImpl implements ContextLocator {
387365 return null ;
388366 }
389367
390- /**
391- * Return the analysis options file in the given [folder] , or `null` if the
392- * folder does not contain an analysis options file.
393- */
368+ /// Return the analysis options file in the given [folder] , or `null` if the
369+ /// folder does not contain an analysis options file.
394370 File _getOptionsFile (Folder folder) =>
395371 _getFile (folder, ANALYSIS_OPTIONS_NAME );
396372
397- /**
398- * Return the packages file in the given [folder] , or `null` if the folder
399- * does not contain a packages file.
400- */
373+ /// Return the packages file in the given [folder] , or `null` if the folder
374+ /// does not contain a packages file.
401375 File _getPackagesFile (Folder folder) => _getFile (folder, PACKAGES_FILE_NAME );
402376
403- /**
404- * Add to the given lists of [folders] and [files] all of the resources in the
405- * given list of [paths] that exist and are not contained within one of the
406- * folders.
407- */
377+ /// Add to the given lists of [folders] and [files] all of the resources in
378+ /// the given list of [paths] that exist and are not contained within one of
379+ /// the folders.
408380 void _resourcesFromPaths (
409381 List <String > paths, List <Folder > folders, List <File > files) {
410382 for (String path in _uniqueSortedPaths (paths)) {
@@ -421,10 +393,8 @@ class ContextLocatorImpl implements ContextLocator {
421393 }
422394 }
423395
424- /**
425- * Return a list of paths that contains all of the unique elements from the
426- * given list of [paths] , sorted such that shorter paths are first.
427- */
396+ /// Return a list of paths that contains all of the unique elements from the
397+ /// given list of [paths] , sorted such that shorter paths are first.
428398 List <String > _uniqueSortedPaths (List <String > paths) {
429399 Set <String > uniquePaths = HashSet <String >.from (paths);
430400 List <String > sortedPaths = uniquePaths.toList ();
0 commit comments