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

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

Issue 2610063004: Add ContentCache.getExists() and use it in AnalysisContextImpl.exists(). (Closed)
Patch Set: Created 3 years, 11 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 dartWorkManager.addPriorityResult(target, RESOLVED_UNIT); 803 dartWorkManager.addPriorityResult(target, RESOLVED_UNIT);
804 } 804 }
805 return null; 805 return null;
806 } 806 }
807 807
808 @override 808 @override
809 bool exists(Source source) { 809 bool exists(Source source) {
810 if (source == null) { 810 if (source == null) {
811 return false; 811 return false;
812 } 812 }
813 if (_contentCache.getContents(source) != null) { 813 bool overriddenExists = _contentCache.getExists(source);
814 return true; 814 if (overriddenExists != null) {
Paul Berry 2017/01/04 18:28:57 Assuming you accept my proposal below, I think lin
815 return overriddenExists;
815 } 816 }
816 return source.exists(); 817 return source.exists();
817 } 818 }
818 819
819 @override 820 @override
820 CacheEntry getCacheEntry(AnalysisTarget target) { 821 CacheEntry getCacheEntry(AnalysisTarget target) {
821 CacheEntry entry = _cache.get(target); 822 CacheEntry entry = _cache.get(target);
822 if (entry == null) { 823 if (entry == null) {
823 entry = new CacheEntry(target); 824 entry = new CacheEntry(target);
824 ImplicitAnalysisEvent event = null; 825 ImplicitAnalysisEvent event = null;
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 } 2263 }
2263 DartSdk sdk = factory.dartSdk; 2264 DartSdk sdk = factory.dartSdk;
2264 if (sdk == null) { 2265 if (sdk == null) {
2265 throw new ArgumentError( 2266 throw new ArgumentError(
2266 "The source factory for an SDK analysis context must have a DartUriRes olver"); 2267 "The source factory for an SDK analysis context must have a DartUriRes olver");
2267 } 2268 }
2268 return new AnalysisCache( 2269 return new AnalysisCache(
2269 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); 2270 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]);
2270 } 2271 }
2271 } 2272 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/source.dart » ('j') | pkg/analyzer/lib/src/generated/source.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698