Chromium Code Reviews| 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 library analyzer.src.context.context_builder; | 5 library analyzer.src.context.context_builder; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:core'; | 8 import 'dart:core'; |
| 9 | 9 |
| 10 import 'package:analyzer/context/declared_variables.dart'; | 10 import 'package:analyzer/context/declared_variables.dart'; |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 /** | 329 /** |
| 330 * Return the analysis options that should be used when the given [context] is | 330 * Return the analysis options that should be used when the given [context] is |
| 331 * used to analyze code in the directory with the given [path]. | 331 * used to analyze code in the directory with the given [path]. |
| 332 */ | 332 */ |
| 333 AnalysisOptions getAnalysisOptions(AnalysisContext context, String path) { | 333 AnalysisOptions getAnalysisOptions(AnalysisContext context, String path) { |
| 334 AnalysisOptionsImpl options = createDefaultOptions(); | 334 AnalysisOptionsImpl options = createDefaultOptions(); |
| 335 File optionsFile = getOptionsFile(path); | 335 File optionsFile = getOptionsFile(path); |
| 336 if (optionsFile != null) { | 336 if (optionsFile != null) { |
| 337 List<OptionsProcessor> optionsProcessors = | 337 List<OptionsProcessor> optionsProcessors = |
| 338 AnalysisEngine.instance.optionsPlugin.optionsProcessors; | 338 AnalysisEngine.instance.optionsPlugin.optionsProcessors; |
| 339 Packages packages = createPackageMap(path); | |
| 340 Map<String, List<Folder>> packageMap = convertPackagesToMap(packages); | |
| 341 List<UriResolver> resolvers = <UriResolver>[ | |
|
Brian Wilkerson
2016/11/15 22:47:59
Perhaps add a TODO comment to restructure this so
danrubel
2016/11/16 13:17:29
Done.
| |
| 342 new ResourceUriResolver(resourceProvider), | |
| 343 new PackageMapUriResolver(resourceProvider, packageMap), | |
| 344 ]; | |
| 345 SourceFactory sourceFactory = | |
| 346 new SourceFactory(resolvers, packages, resourceProvider); | |
| 339 try { | 347 try { |
| 340 Map<String, YamlNode> optionMap = | 348 Map<String, YamlNode> optionMap = |
| 341 new AnalysisOptionsProvider().getOptionsFromFile(optionsFile); | 349 new AnalysisOptionsProvider(sourceFactory) |
| 350 .getOptionsFromFile(optionsFile); | |
| 342 optionsProcessors.forEach( | 351 optionsProcessors.forEach( |
| 343 (OptionsProcessor p) => p.optionsProcessed(context, optionMap)); | 352 (OptionsProcessor p) => p.optionsProcessed(context, optionMap)); |
| 344 applyToAnalysisOptions(options, optionMap); | 353 applyToAnalysisOptions(options, optionMap); |
| 345 } on Exception catch (exception) { | 354 } on Exception catch (exception) { |
| 346 optionsProcessors.forEach((OptionsProcessor p) => p.onError(exception)); | 355 optionsProcessors.forEach((OptionsProcessor p) => p.onError(exception)); |
| 347 } | 356 } |
| 348 } | 357 } |
| 349 return options; | 358 return options; |
| 350 } | 359 } |
| 351 | 360 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 String _readEmbedderYaml(Folder libDir) { | 624 String _readEmbedderYaml(Folder libDir) { |
| 616 File file = libDir.getChild(EMBEDDER_FILE_NAME); | 625 File file = libDir.getChild(EMBEDDER_FILE_NAME); |
| 617 try { | 626 try { |
| 618 return file.readAsStringSync(); | 627 return file.readAsStringSync(); |
| 619 } on FileSystemException { | 628 } on FileSystemException { |
| 620 // File can't be read. | 629 // File can't be read. |
| 621 return null; | 630 return null; |
| 622 } | 631 } |
| 623 } | 632 } |
| 624 } | 633 } |
| OLD | NEW |