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

Side by Side Diff: pkg/analyzer/lib/src/summary/package_bundle_reader.dart

Issue 2093033003: Fix ResynthesizerResultProvider's handling of parts. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/source.dart ('k') | pkg/analyzer/lib/src/task/html.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import 'dart:io' as io; 1 import 'dart:io' as io;
2 2
3 import 'package:analyzer/dart/element/element.dart'; 3 import 'package:analyzer/dart/element/element.dart';
4 import 'package:analyzer/src/context/cache.dart'; 4 import 'package:analyzer/src/context/cache.dart';
5 import 'package:analyzer/src/context/context.dart'; 5 import 'package:analyzer/src/context/context.dart';
6 import 'package:analyzer/src/dart/element/element.dart'; 6 import 'package:analyzer/src/dart/element/element.dart';
7 import 'package:analyzer/src/generated/engine.dart'; 7 import 'package:analyzer/src/generated/engine.dart';
8 import 'package:analyzer/src/generated/java_io.dart'; 8 import 'package:analyzer/src/generated/java_io.dart';
9 import 'package:analyzer/src/generated/resolver.dart'; 9 import 'package:analyzer/src/generated/resolver.dart';
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 _dataStore.addBundle(path, bundle); 133 _dataStore.addBundle(path, bundle);
134 } 134 }
135 135
136 @override 136 @override
137 bool compute(CacheEntry entry, ResultDescriptor result) { 137 bool compute(CacheEntry entry, ResultDescriptor result) {
138 if (_sdkProvider != null && _sdkProvider.compute(entry, result)) { 138 if (_sdkProvider != null && _sdkProvider.compute(entry, result)) {
139 return true; 139 return true;
140 } 140 }
141 AnalysisTarget target = entry.target; 141 AnalysisTarget target = entry.target;
142 // Check whether there are results for the source. 142 // Check whether there are results for the source.
143 if (!hasResultsForSource(target.source)) { 143 if (!hasResultsForSource(target.librarySource ?? target.source)) {
144 return false; 144 return false;
145 } 145 }
146 // Constant expressions are always resolved in summaries. 146 // Constant expressions are always resolved in summaries.
147 if (result == CONSTANT_EXPRESSION_RESOLVED && 147 if (result == CONSTANT_EXPRESSION_RESOLVED &&
148 target is ConstantEvaluationTarget) { 148 target is ConstantEvaluationTarget) {
149 entry.setValue(result, true, TargetedResult.EMPTY_LIST); 149 entry.setValue(result, true, TargetedResult.EMPTY_LIST);
150 return true; 150 return true;
151 } 151 }
152 // Provide results for Source. 152 // Provide results for Source.
153 if (target is Source) { 153 if (target is Source) {
(...skipping 23 matching lines...) Expand all
177 entry.setValue(result, SourceKind.LIBRARY, TargetedResult.EMPTY_LIST); 177 entry.setValue(result, SourceKind.LIBRARY, TargetedResult.EMPTY_LIST);
178 return true; 178 return true;
179 } 179 }
180 if (_dataStore.unlinkedMap.containsKey(uriString)) { 180 if (_dataStore.unlinkedMap.containsKey(uriString)) {
181 entry.setValue(result, SourceKind.PART, TargetedResult.EMPTY_LIST); 181 entry.setValue(result, SourceKind.PART, TargetedResult.EMPTY_LIST);
182 return true; 182 return true;
183 } 183 }
184 return false; 184 return false;
185 } 185 }
186 } else if (target is LibrarySpecificUnit) { 186 } else if (target is LibrarySpecificUnit) {
187 if (!hasResultsForSource(target.library)) {
188 return false;
189 }
190 if (result == CREATED_RESOLVED_UNIT1 || 187 if (result == CREATED_RESOLVED_UNIT1 ||
191 result == CREATED_RESOLVED_UNIT2 || 188 result == CREATED_RESOLVED_UNIT2 ||
192 result == CREATED_RESOLVED_UNIT3 || 189 result == CREATED_RESOLVED_UNIT3 ||
193 result == CREATED_RESOLVED_UNIT4 || 190 result == CREATED_RESOLVED_UNIT4 ||
194 result == CREATED_RESOLVED_UNIT5 || 191 result == CREATED_RESOLVED_UNIT5 ||
195 result == CREATED_RESOLVED_UNIT6 || 192 result == CREATED_RESOLVED_UNIT6 ||
196 result == CREATED_RESOLVED_UNIT7 || 193 result == CREATED_RESOLVED_UNIT7 ||
197 result == CREATED_RESOLVED_UNIT8 || 194 result == CREATED_RESOLVED_UNIT8 ||
198 result == CREATED_RESOLVED_UNIT9 || 195 result == CREATED_RESOLVED_UNIT9 ||
199 result == CREATED_RESOLVED_UNIT10 || 196 result == CREATED_RESOLVED_UNIT10 ||
200 result == CREATED_RESOLVED_UNIT11 || 197 result == CREATED_RESOLVED_UNIT11 ||
201 result == CREATED_RESOLVED_UNIT12) { 198 result == CREATED_RESOLVED_UNIT12) {
202 entry.setValue(result, true, TargetedResult.EMPTY_LIST); 199 entry.setValue(result, true, TargetedResult.EMPTY_LIST);
203 return true; 200 return true;
204 } 201 }
205 if (result == COMPILATION_UNIT_ELEMENT) { 202 if (result == COMPILATION_UNIT_ELEMENT) {
206 String libraryUri = target.library.uri.toString(); 203 String libraryUri = target.library.uri.toString();
207 String unitUri = target.unit.uri.toString(); 204 String unitUri = target.unit.uri.toString();
208 CompilationUnitElement unit = resynthesizer.getElement( 205 CompilationUnitElement unit = resynthesizer.getElement(
209 new ElementLocationImpl.con3(<String>[libraryUri, unitUri])); 206 new ElementLocationImpl.con3(<String>[libraryUri, unitUri]));
210 if (unit != null) { 207 if (unit != null) {
211 entry.setValue(result, unit, TargetedResult.EMPTY_LIST); 208 entry.setValue(result, unit, TargetedResult.EMPTY_LIST);
212 return true; 209 return true;
213 } 210 }
214 } 211 }
215 } else if (target is VariableElement) { 212 } else if (target is VariableElement) {
216 if (!hasResultsForSource(target.library.source)) {
217 return false;
218 }
219 if (result == PROPAGATED_VARIABLE || result == INFERRED_STATIC_VARIABLE) { 213 if (result == PROPAGATED_VARIABLE || result == INFERRED_STATIC_VARIABLE) {
220 entry.setValue(result, target, TargetedResult.EMPTY_LIST); 214 entry.setValue(result, target, TargetedResult.EMPTY_LIST);
221 return true; 215 return true;
222 } 216 }
223 } 217 }
224 // Unknown target. 218 // Unknown target.
225 return false; 219 return false;
226 } 220 }
227 221
228 /** 222 /**
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 * also provides [summaryPath]. 340 * also provides [summaryPath].
347 */ 341 */
348 class _InSummaryFallbackSource extends FileBasedSource 342 class _InSummaryFallbackSource extends FileBasedSource
349 implements InSummarySource { 343 implements InSummarySource {
350 @override 344 @override
351 final String summaryPath; 345 final String summaryPath;
352 346
353 _InSummaryFallbackSource(JavaFile file, Uri uri, this.summaryPath) 347 _InSummaryFallbackSource(JavaFile file, Uri uri, this.summaryPath)
354 : super(file, uri); 348 : super(file, uri);
355 } 349 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/source.dart ('k') | pkg/analyzer/lib/src/task/html.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698