Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1030)

Side by Side Diff: pkg/analysis_server/lib/src/context_manager.dart

Issue 1423333002: Option support for `enableSuperMixins` (and more). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge with master. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
11 11
12 import 'package:analysis_server/plugin/analysis/resolver_provider.dart'; 12 import 'package:analysis_server/plugin/analysis/resolver_provider.dart';
13 import 'package:analysis_server/src/analysis_server.dart'; 13 import 'package:analysis_server/src/analysis_server.dart';
14 import 'package:analyzer/file_system/file_system.dart'; 14 import 'package:analyzer/file_system/file_system.dart';
15 import 'package:analyzer/instrumentation/instrumentation.dart'; 15 import 'package:analyzer/instrumentation/instrumentation.dart';
16 import 'package:analyzer/plugin/options.dart'; 16 import 'package:analyzer/plugin/options.dart';
17 import 'package:analyzer/source/analysis_options_provider.dart'; 17 import 'package:analyzer/source/analysis_options_provider.dart';
18 import 'package:analyzer/source/package_map_provider.dart'; 18 import 'package:analyzer/source/package_map_provider.dart';
19 import 'package:analyzer/source/package_map_resolver.dart'; 19 import 'package:analyzer/source/package_map_resolver.dart';
20 import 'package:analyzer/source/path_filter.dart'; 20 import 'package:analyzer/source/path_filter.dart';
21 import 'package:analyzer/source/pub_package_map_provider.dart'; 21 import 'package:analyzer/source/pub_package_map_provider.dart';
22 import 'package:analyzer/source/sdk_ext.dart'; 22 import 'package:analyzer/source/sdk_ext.dart';
23 import 'package:analyzer/src/context/context.dart' as context; 23 import 'package:analyzer/src/context/context.dart' as context;
24 import 'package:analyzer/src/generated/engine.dart'; 24 import 'package:analyzer/src/generated/engine.dart';
25 import 'package:analyzer/src/generated/error.dart';
26 import 'package:analyzer/src/generated/java_engine.dart'; 25 import 'package:analyzer/src/generated/java_engine.dart';
27 import 'package:analyzer/src/generated/java_io.dart'; 26 import 'package:analyzer/src/generated/java_io.dart';
28 import 'package:analyzer/src/generated/source.dart'; 27 import 'package:analyzer/src/generated/source.dart';
29 import 'package:analyzer/src/generated/source_io.dart'; 28 import 'package:analyzer/src/generated/source_io.dart';
30 import 'package:analyzer/src/task/options.dart'; 29 import 'package:analyzer/src/task/options.dart';
31 import 'package:package_config/packages.dart'; 30 import 'package:package_config/packages.dart';
32 import 'package:package_config/packages_file.dart' as pkgfile show parse; 31 import 'package:package_config/packages_file.dart' as pkgfile show parse;
33 import 'package:package_config/src/packages_impl.dart' show MapPackages; 32 import 'package:package_config/src/packages_impl.dart' show MapPackages;
34 import 'package:path/path.dart' as pathos; 33 import 'package:path/path.dart' as pathos;
35 import 'package:watcher/watcher.dart'; 34 import 'package:watcher/watcher.dart';
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 return; 499 return;
501 } 500 }
502 501
503 // Analysis options are processed 'in-line'. 502 // Analysis options are processed 'in-line'.
504 YamlMap analyzer = options[AnalyzerOptions.analyzer]; 503 YamlMap analyzer = options[AnalyzerOptions.analyzer];
505 if (analyzer == null) { 504 if (analyzer == null) {
506 // No options for analyzer. 505 // No options for analyzer.
507 return; 506 return;
508 } 507 }
509 508
510 // Set strong mode (default is false). 509 configureContextOptions(info.context, options);
511 bool strongMode = analyzer[AnalyzerOptions.strong_mode] ?? false;
512 AnalysisContext context = info.context;
513 if (context.analysisOptions.strongMode != strongMode) {
514 AnalysisOptionsImpl options =
515 new AnalysisOptionsImpl.from(context.analysisOptions);
516 options.strongMode = strongMode;
517 context.analysisOptions = options;
518 }
519 510
520 // Set ignore patterns. 511 // Set ignore patterns.
521 YamlList exclude = analyzer[AnalyzerOptions.exclude]; 512 YamlList exclude = analyzer[AnalyzerOptions.exclude];
522 if (exclude != null) { 513 if (exclude != null) {
523 setIgnorePatternsForContext(info, exclude); 514 setIgnorePatternsForContext(info, exclude);
524 } 515 }
525
526 // Set filters.
527 YamlNode filters = analyzer[AnalyzerOptions.errors];
528 setFiltersForContext(info, filters);
529 } 516 }
530 517
531 @override 518 @override
532 void refresh(List<Resource> roots) { 519 void refresh(List<Resource> roots) {
533 // Destroy old contexts 520 // Destroy old contexts
534 List<ContextInfo> contextInfos = _rootInfo.descendants.toList(); 521 List<ContextInfo> contextInfos = _rootInfo.descendants.toList();
535 if (roots == null) { 522 if (roots == null) {
536 contextInfos.forEach(_destroyContext); 523 contextInfos.forEach(_destroyContext);
537 } else { 524 } else {
538 roots.forEach((Resource resource) { 525 roots.forEach((Resource resource) {
539 contextInfos.forEach((ContextInfo contextInfo) { 526 contextInfos.forEach((ContextInfo contextInfo) {
540 if (resource is Folder && 527 if (resource is Folder &&
541 resource.isOrContains(contextInfo.folder.path)) { 528 resource.isOrContains(contextInfo.folder.path)) {
542 _destroyContext(contextInfo); 529 _destroyContext(contextInfo);
543 } 530 }
544 }); 531 });
545 }); 532 });
546 } 533 }
547 534
548 // Rebuild contexts based on the data last sent to setRoots(). 535 // Rebuild contexts based on the data last sent to setRoots().
549 setRoots(includedPaths, excludedPaths, packageRoots); 536 setRoots(includedPaths, excludedPaths, packageRoots);
550 } 537 }
551 538
552 void setFiltersForContext(ContextInfo info, YamlNode codes) {
553 List<ErrorFilter> filters = <ErrorFilter>[];
554 // If codes are enumerated, collect them as filters; else leave filters
555 // empty to overwrite previous value.
556 if (codes is YamlMap) {
557 String value;
558 codes.nodes.forEach((k, v) {
559 if (k is YamlScalar && v is YamlScalar) {
560 value = v.value?.toString()?.toLowerCase();
561 if (AnalyzerOptions.ignoreSynonyms.contains(value)) {
562 // Case-insensitive.
563 String code = k.value?.toString()?.toUpperCase();
564 filters.add((AnalysisError error) => error.errorCode.name == code);
565 }
566 }
567 });
568 }
569 info.context.setConfigurationData(CONFIGURED_ERROR_FILTERS, filters);
570 }
571
572 /** 539 /**
573 * Sets the [ignorePatterns] for the context having info [info]. 540 * Sets the [ignorePatterns] for the context having info [info].
574 */ 541 */
575 void setIgnorePatternsForContext( 542 void setIgnorePatternsForContext(
576 ContextInfo info, List<String> ignorePatterns) { 543 ContextInfo info, List<String> ignorePatterns) {
577 info.pathFilter.setIgnorePatterns(ignorePatterns); 544 info.pathFilter.setIgnorePatterns(ignorePatterns);
578 } 545 }
579 546
580 @override 547 @override
581 void setRoots(List<String> includedPaths, List<String> excludedPaths, 548 void setRoots(List<String> includedPaths, List<String> excludedPaths,
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 var path = resourceProvider.pathContext.fromUri(uri); 1438 var path = resourceProvider.pathContext.fromUri(uri);
1472 packageMap[name] = <Folder>[resourceProvider.getFolder(path)]; 1439 packageMap[name] = <Folder>[resourceProvider.getFolder(path)];
1473 } 1440 }
1474 }); 1441 });
1475 return <UriResolver>[new SdkExtUriResolver(packageMap)]; 1442 return <UriResolver>[new SdkExtUriResolver(packageMap)];
1476 } else { 1443 } else {
1477 return const <UriResolver>[]; 1444 return const <UriResolver>[];
1478 } 1445 }
1479 } 1446 }
1480 } 1447 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698