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

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

Issue 1420363005: Error Suppression FTW. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Typo. 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
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/instrumentation/instrumentation.dart'; 10 import 'package:analyzer/instrumentation/instrumentation.dart';
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 } 757 }
758 758
759 @override 759 @override
760 CompilationUnitElement getCompilationUnitElement( 760 CompilationUnitElement getCompilationUnitElement(
761 Source unitSource, Source librarySource) { 761 Source unitSource, Source librarySource) {
762 AnalysisTarget target = new LibrarySpecificUnit(librarySource, unitSource); 762 AnalysisTarget target = new LibrarySpecificUnit(librarySource, unitSource);
763 return getResult(target, COMPILATION_UNIT_ELEMENT); 763 return getResult(target, COMPILATION_UNIT_ELEMENT);
764 } 764 }
765 765
766 @override 766 @override
767 Object getConfigurationData(ResultDescriptor key) => _configurationData[key]; 767 Object getConfigurationData(ResultDescriptor key) =>
768 _configurationData[key] ?? key?.defaultValue;
768 769
769 @override 770 @override
770 TimestampedData<String> getContents(Source source) { 771 TimestampedData<String> getContents(Source source) {
771 String contents = _contentCache.getContents(source); 772 String contents = _contentCache.getContents(source);
772 if (contents != null) { 773 if (contents != null) {
773 return new TimestampedData<String>( 774 return new TimestampedData<String>(
774 _contentCache.getModificationStamp(source), contents); 775 _contentCache.getModificationStamp(source), contents);
775 } 776 }
776 return source.contents; 777 return source.contents;
777 } 778 }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 } 1017 }
1017 } 1018 }
1018 if (notify && changed) { 1019 if (notify && changed) {
1019 _onSourcesChangedController 1020 _onSourcesChangedController
1020 .add(new SourcesChangedEvent.changedContent(source, newContents)); 1021 .add(new SourcesChangedEvent.changedContent(source, newContents));
1021 } 1022 }
1022 return changed; 1023 return changed;
1023 } 1024 }
1024 1025
1025 /** 1026 /**
1026 * Invalidate analysis cache. 1027 * Invalidate analysis cache and notify work managers that they have work
1028 * to do.
1027 */ 1029 */
1028 void invalidateCachedResults() { 1030 void invalidateCachedResults() {
1029 _cache = createCacheFromSourceFactory(_sourceFactory); 1031 _cache = createCacheFromSourceFactory(_sourceFactory);
1032 for (WorkManager workManager in workManagers) {
1033 workManager.onAnalysisOptionsChanged();
scheglov 2015/10/27 23:41:44 Maybe we should rename this method to reflect the
Brian Wilkerson 2015/10/28 02:09:08 Is that the only time it's used? (I actually prefe
pquitslund 2015/10/28 15:56:44 Maybe `invalidateResults` or something? It's pret
1034 }
1030 } 1035 }
1031 1036
1032 @override 1037 @override
1033 void invalidateLibraryHints(Source librarySource) { 1038 void invalidateLibraryHints(Source librarySource) {
1034 List<Source> sources = getResult(librarySource, UNITS); 1039 List<Source> sources = getResult(librarySource, UNITS);
1035 if (sources != null) { 1040 if (sources != null) {
1036 for (Source source in sources) { 1041 for (Source source in sources) {
1037 getCacheEntry(source).setState(HINTS, CacheState.INVALID); 1042 getCacheEntry(source).setState(HINTS, CacheState.INVALID);
1038 } 1043 }
1039 } 1044 }
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 DartSdk sdk = factory.dartSdk; 2133 DartSdk sdk = factory.dartSdk;
2129 if (sdk == null) { 2134 if (sdk == null) {
2130 throw new IllegalArgumentException( 2135 throw new IllegalArgumentException(
2131 "The source factory for an SDK analysis context must have a DartUriRes olver"); 2136 "The source factory for an SDK analysis context must have a DartUriRes olver");
2132 } 2137 }
2133 return new AnalysisCache(<CachePartition>[ 2138 return new AnalysisCache(<CachePartition>[
2134 AnalysisEngine.instance.partitionManager_new.forSdk(sdk) 2139 AnalysisEngine.instance.partitionManager_new.forSdk(sdk)
2135 ]); 2140 ]);
2136 } 2141 }
2137 } 2142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698