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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 } | 494 } |
495 }); | 495 }); |
496 | 496 |
497 // In case options files are removed, revert to default options. | 497 // In case options files are removed, revert to default options. |
498 if (optionsRemoved) { | 498 if (optionsRemoved) { |
499 info.context.analysisOptions = new AnalysisOptionsImpl(); | 499 info.context.analysisOptions = new AnalysisOptionsImpl(); |
500 return; | 500 return; |
501 } | 501 } |
502 | 502 |
503 // Analysis options are processed 'in-line'. | 503 // Analysis options are processed 'in-line'. |
504 YamlMap analyzer = options['analyzer']; | 504 YamlMap analyzer = options[AnalyzerOptions.analyzer]; |
505 if (analyzer == null) { | 505 if (analyzer == null) { |
506 // No options for analyzer. | 506 // No options for analyzer. |
507 return; | 507 return; |
508 } | 508 } |
509 | 509 |
510 // Set strong mode (default is false). | 510 // Set strong mode (default is false). |
511 bool strongMode = analyzer['strong-mode'] ?? false; | 511 bool strongMode = analyzer[AnalyzerOptions.strong_mode] ?? false; |
512 AnalysisContext context = info.context; | 512 AnalysisContext context = info.context; |
513 if (context.analysisOptions.strongMode != strongMode) { | 513 if (context.analysisOptions.strongMode != strongMode) { |
514 AnalysisOptionsImpl options = | 514 AnalysisOptionsImpl options = |
515 new AnalysisOptionsImpl.from(context.analysisOptions); | 515 new AnalysisOptionsImpl.from(context.analysisOptions); |
516 options.strongMode = strongMode; | 516 options.strongMode = strongMode; |
517 context.analysisOptions = options; | 517 context.analysisOptions = options; |
518 } | 518 } |
519 | 519 |
520 // Set ignore patterns. | 520 // Set ignore patterns. |
521 YamlList exclude = analyzer['exclude']; | 521 YamlList exclude = analyzer[AnalyzerOptions.exclude]; |
522 if (exclude != null) { | 522 if (exclude != null) { |
523 setIgnorePatternsForContext(info, exclude); | 523 setIgnorePatternsForContext(info, exclude); |
524 } | 524 } |
525 | 525 |
526 // Set filters. | 526 // Set filters. |
527 YamlNode filters = analyzer['errors']; | 527 YamlNode filters = analyzer[AnalyzerOptions.errors]; |
528 setFiltersForContext(info, filters); | 528 setFiltersForContext(info, filters); |
529 } | 529 } |
530 | 530 |
531 @override | 531 @override |
532 void refresh(List<Resource> roots) { | 532 void refresh(List<Resource> roots) { |
533 // Destroy old contexts | 533 // Destroy old contexts |
534 List<ContextInfo> contextInfos = _rootInfo.descendants.toList(); | 534 List<ContextInfo> contextInfos = _rootInfo.descendants.toList(); |
535 if (roots == null) { | 535 if (roots == null) { |
536 contextInfos.forEach(_destroyContext); | 536 contextInfos.forEach(_destroyContext); |
537 } else { | 537 } else { |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 var path = resourceProvider.pathContext.fromUri(uri); | 1471 var path = resourceProvider.pathContext.fromUri(uri); |
1472 packageMap[name] = <Folder>[resourceProvider.getFolder(path)]; | 1472 packageMap[name] = <Folder>[resourceProvider.getFolder(path)]; |
1473 } | 1473 } |
1474 }); | 1474 }); |
1475 return <UriResolver>[new SdkExtUriResolver(packageMap)]; | 1475 return <UriResolver>[new SdkExtUriResolver(packageMap)]; |
1476 } else { | 1476 } else { |
1477 return const <UriResolver>[]; | 1477 return const <UriResolver>[]; |
1478 } | 1478 } |
1479 } | 1479 } |
1480 } | 1480 } |
OLD | NEW |