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

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

Issue 1808123005: First batch of changes to make analyzer package strong mode error free (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 Source unitSource, Source librarySource) { 1012 Source unitSource, Source librarySource) {
1013 if (!AnalysisEngine.isDartFileName(unitSource.shortName) || 1013 if (!AnalysisEngine.isDartFileName(unitSource.shortName) ||
1014 !AnalysisEngine.isDartFileName(librarySource.shortName)) { 1014 !AnalysisEngine.isDartFileName(librarySource.shortName)) {
1015 return null; 1015 return null;
1016 } 1016 }
1017 return getResult( 1017 return getResult(
1018 new LibrarySpecificUnit(librarySource, unitSource), RESOLVED_UNIT); 1018 new LibrarySpecificUnit(librarySource, unitSource), RESOLVED_UNIT);
1019 } 1019 }
1020 1020
1021 @override 1021 @override
1022 Object getResult(AnalysisTarget target, ResultDescriptor result) { 1022 Object/*=V*/ getResult/*<V>*/(
1023 return _cache.getValue(target, result); 1023 AnalysisTarget target, ResultDescriptor/*<V>*/ result) {
1024 return _cache.getValue(target, result) as Object/*=V*/;
1024 } 1025 }
1025 1026
1026 @override 1027 @override
1027 List<Source> getSourcesWithFullName(String path) { 1028 List<Source> getSourcesWithFullName(String path) {
1028 return analysisCache.getSourcesWithFullName(path); 1029 return analysisCache.getSourcesWithFullName(path);
1029 } 1030 }
1030 1031
1031 @override 1032 @override
1032 bool handleContentsChanged( 1033 bool handleContentsChanged(
1033 Source source, String originalContents, String newContents, bool notify) { 1034 Source source, String originalContents, String newContents, bool notify) {
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 * If the result cannot be generated, then the future will be completed with 2003 * If the result cannot be generated, then the future will be completed with
2003 * the error AnalysisNotScheduledError. 2004 * the error AnalysisNotScheduledError.
2004 */ 2005 */
2005 CancelableFuture<T> computeAsync() { 2006 CancelableFuture<T> computeAsync() {
2006 if (_context.isDisposed) { 2007 if (_context.isDisposed) {
2007 // No further analysis is expected, so return a future that completes 2008 // No further analysis is expected, so return a future that completes
2008 // immediately with AnalysisNotScheduledError. 2009 // immediately with AnalysisNotScheduledError.
2009 return new CancelableFuture.error(new AnalysisNotScheduledError()); 2010 return new CancelableFuture.error(new AnalysisNotScheduledError());
2010 } 2011 }
2011 CacheEntry entry = _context.getCacheEntry(_target); 2012 CacheEntry entry = _context.getCacheEntry(_target);
2012 PendingFuture pendingFuture = 2013 PendingFuture<T> pendingFuture =
2013 new PendingFuture<T>(_context, _target, (CacheEntry entry) { 2014 new PendingFuture<T>(_context, _target, (CacheEntry entry) {
2014 CacheState state = entry.getState(_descriptor); 2015 CacheState state = entry.getState(_descriptor);
2015 if (state == CacheState.ERROR) { 2016 if (state == CacheState.ERROR) {
2016 throw entry.exception; 2017 throw entry.exception;
2017 } else if (state == CacheState.INVALID) { 2018 } else if (state == CacheState.INVALID) {
2018 return null; 2019 return null;
2019 } 2020 }
2020 return entry.getValue(_descriptor); 2021 return entry.getValue(_descriptor);
2021 }); 2022 });
2022 if (!pendingFuture.evaluate(entry)) { 2023 if (!pendingFuture.evaluate(entry)) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2178 } 2179 }
2179 DartSdk sdk = factory.dartSdk; 2180 DartSdk sdk = factory.dartSdk;
2180 if (sdk == null) { 2181 if (sdk == null) {
2181 throw new IllegalArgumentException( 2182 throw new IllegalArgumentException(
2182 "The source factory for an SDK analysis context must have a DartUriRes olver"); 2183 "The source factory for an SDK analysis context must have a DartUriRes olver");
2183 } 2184 }
2184 return new AnalysisCache( 2185 return new AnalysisCache(
2185 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); 2186 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]);
2186 } 2187 }
2187 } 2188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698