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

Side by Side Diff: pkg/analyzer/lib/src/context/context.dart

Issue 2314933003: Issue 27130. Fix applying changes to .analysis_options on save. (Closed)
Patch Set: Created 4 years, 3 months 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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; 5 library analyzer.src.context.context;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 if (level == AnalysisLevel.NONE) { 613 if (level == AnalysisLevel.NONE) {
614 changeSet.removedSource(source); 614 changeSet.removedSource(source);
615 } else { 615 } else {
616 changeSet.addedSource(source); 616 changeSet.addedSource(source);
617 } 617 }
618 }); 618 });
619 applyChanges(changeSet); 619 applyChanges(changeSet);
620 } 620 }
621 621
622 @override 622 @override
623 ApplyChangesStatus applyChanges(ChangeSet changeSet) { 623 void applyChanges(ChangeSet changeSet) {
624 if (changeSet.isEmpty) { 624 if (changeSet.isEmpty) {
625 return new ApplyChangesStatus(false); 625 return;
626 } 626 }
627 // 627 //
628 // First, compute the list of sources that have been removed. 628 // First, compute the list of sources that have been removed.
629 // 629 //
630 List<Source> removedSources = changeSet.removedSources.toList(); 630 List<Source> removedSources = changeSet.removedSources.toList();
631 for (SourceContainer container in changeSet.removedContainers) { 631 for (SourceContainer container in changeSet.removedContainers) {
632 _addSourcesInContainer(removedSources, container); 632 _addSourcesInContainer(removedSources, container);
633 } 633 }
634 // 634 //
635 // Then determine which cached results are no longer valid. 635 // Then determine which cached results are no longer valid.
(...skipping 22 matching lines...) Expand all
658 _sourceDeleted(source); 658 _sourceDeleted(source);
659 } 659 }
660 for (Source source in removedSources) { 660 for (Source source in removedSources) {
661 _sourceRemoved(source); 661 _sourceRemoved(source);
662 } 662 }
663 for (WorkManager workManager in workManagers) { 663 for (WorkManager workManager in workManagers) {
664 workManager.applyChange( 664 workManager.applyChange(
665 changeSet.addedSources, changedSources, removedSources); 665 changeSet.addedSources, changedSources, removedSources);
666 } 666 }
667 _onSourcesChangedController.add(new SourcesChangedEvent(changeSet)); 667 _onSourcesChangedController.add(new SourcesChangedEvent(changeSet));
668 return new ApplyChangesStatus(changeSet.addedSources.isNotEmpty ||
669 changeSet.changedContents.isNotEmpty ||
670 changeSet.deletedSources.isNotEmpty ||
671 changedSources.isNotEmpty ||
672 removedSources.isNotEmpty);
673 } 668 }
674 669
675 @override 670 @override
676 String computeDocumentationComment(Element element) => 671 String computeDocumentationComment(Element element) =>
677 element?.documentationComment; 672 element?.documentationComment;
678 673
679 @override 674 @override
680 List<AnalysisError> computeErrors(Source source) { 675 List<AnalysisError> computeErrors(Source source) {
681 String name = source.shortName; 676 String name = source.shortName;
682 if (AnalysisEngine.isHtmlFileName(name)) { 677 if (AnalysisEngine.isHtmlFileName(name)) {
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 } 2307 }
2313 DartSdk sdk = factory.dartSdk; 2308 DartSdk sdk = factory.dartSdk;
2314 if (sdk == null) { 2309 if (sdk == null) {
2315 throw new IllegalArgumentException( 2310 throw new IllegalArgumentException(
2316 "The source factory for an SDK analysis context must have a DartUriRes olver"); 2311 "The source factory for an SDK analysis context must have a DartUriRes olver");
2317 } 2312 }
2318 return new AnalysisCache( 2313 return new AnalysisCache(
2319 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); 2314 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]);
2320 } 2315 }
2321 } 2316 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698