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

Side by Side Diff: pkg/analyzer/lib/src/task/dart_work_manager.dart

Issue 2231473002: Revert 6ad38498c8673f1fbe3e12c49b1cf590305676dd (PARSED_UNIT). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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/task/dart.dart ('k') | pkg/analyzer/lib/task/dart.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 // 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.task.dart_work_manager; 5 library analyzer.src.task.dart_work_manager;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/generated/engine.dart' 10 import 'package:analyzer/src/generated/engine.dart'
(...skipping 11 matching lines...) Expand all
22 */ 22 */
23 class DartWorkManager implements WorkManager { 23 class DartWorkManager implements WorkManager {
24 /** 24 /**
25 * The list of errors that are reported for raw Dart [Source]s. 25 * The list of errors that are reported for raw Dart [Source]s.
26 */ 26 */
27 static final List<ResultDescriptor<List<AnalysisError>>> _SOURCE_ERRORS = 27 static final List<ResultDescriptor<List<AnalysisError>>> _SOURCE_ERRORS =
28 <ResultDescriptor<List<AnalysisError>>>[ 28 <ResultDescriptor<List<AnalysisError>>>[
29 BUILD_DIRECTIVES_ERRORS, 29 BUILD_DIRECTIVES_ERRORS,
30 BUILD_LIBRARY_ERRORS, 30 BUILD_LIBRARY_ERRORS,
31 PARSE_ERRORS, 31 PARSE_ERRORS,
32 RESOLVE_DIRECTIVES_ERRORS,
33 SCAN_ERRORS 32 SCAN_ERRORS
34 ]; 33 ];
35 34
36 /** 35 /**
37 * The list of errors that are reported for raw Dart [LibrarySpecificUnit]s. 36 * The list of errors that are reported for raw Dart [LibrarySpecificUnit]s.
38 */ 37 */
39 static final List<ResultDescriptor<List<AnalysisError>>> _UNIT_ERRORS = 38 static final List<ResultDescriptor<List<AnalysisError>>> _UNIT_ERRORS =
40 <ResultDescriptor<List<AnalysisError>>>[ 39 <ResultDescriptor<List<AnalysisError>>>[
41 HINTS, 40 HINTS,
42 LINTS, 41 LINTS,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } else { 296 } else {
298 bool needErrors = _shouldErrorsBeComputed(source); 297 bool needErrors = _shouldErrorsBeComputed(source);
299 if (needErrors) { 298 if (needErrors) {
300 librarySourceQueue.add(target); 299 librarySourceQueue.add(target);
301 } 300 }
302 } 301 }
303 } 302 }
304 } 303 }
305 } 304 }
306 // Update parts in libraries. 305 // Update parts in libraries.
307 { 306 if (isDartLibrarySource) {
307 Source library = target;
308 List<Source> includedParts = outputs[INCLUDED_PARTS] as List<Source>; 308 List<Source> includedParts = outputs[INCLUDED_PARTS] as List<Source>;
309 if (includedParts != null && !includedParts.isEmpty) { 309 if (includedParts != null) {
310 Source library = target;
311 libraryPartsMap[library] = includedParts; 310 libraryPartsMap[library] = includedParts;
312 for (Source part in includedParts) { 311 for (Source part in includedParts) {
313 List<Source> libraries = 312 List<Source> libraries =
314 partLibrariesMap.putIfAbsent(part, () => <Source>[]); 313 partLibrariesMap.putIfAbsent(part, () => <Source>[]);
315 if (!libraries.contains(library)) { 314 if (!libraries.contains(library)) {
316 libraries.add(library); 315 libraries.add(library);
317 _invalidateContainingLibraries(part); 316 _invalidateContainingLibraries(part);
318 } 317 }
319 } 318 }
320 } 319 }
321 } 320 }
322 // Update notice. 321 // Update notice.
323 if (isDartSource) { 322 if (isDartSource) {
324 bool shouldSetErrors = false; 323 bool shouldSetErrors = false;
325 outputs.forEach((ResultDescriptor descriptor, value) { 324 outputs.forEach((ResultDescriptor descriptor, value) {
326 if (descriptor == PARSED_UNIT1 && value != null) { 325 if (descriptor == PARSED_UNIT && value != null) {
327 context.getNotice(target).parsedDartUnit = value; 326 context.getNotice(target).parsedDartUnit = value;
328 shouldSetErrors = true; 327 shouldSetErrors = true;
329 } 328 }
330 if (descriptor == DART_ERRORS) { 329 if (descriptor == DART_ERRORS) {
331 shouldSetErrors = true; 330 shouldSetErrors = true;
332 } 331 }
333 }); 332 });
334 if (shouldSetErrors) { 333 if (shouldSetErrors) {
335 AnalysisErrorInfo info = context.getErrors(target); 334 AnalysisErrorInfo info = context.getErrors(target);
336 context.getNotice(target).setErrors(info.errors, info.lineInfo); 335 context.getNotice(target).setErrors(info.errors, info.lineInfo);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 418 }
420 } 419 }
421 } 420 }
422 // Invalidate targets and values. 421 // Invalidate targets and values.
423 unitTargets.forEach(partition.remove); 422 unitTargets.forEach(partition.remove);
424 for (Source dartSource in dartSources) { 423 for (Source dartSource in dartSources) {
425 CacheEntry entry = partition.get(dartSource); 424 CacheEntry entry = partition.get(dartSource);
426 if (entry != null) { 425 if (entry != null) {
427 // TODO(scheglov) we invalidate too much. 426 // TODO(scheglov) we invalidate too much.
428 // Would be nice to invalidate just URLs resolution. 427 // Would be nice to invalidate just URLs resolution.
429 entry.setState(PARSED_UNIT1, CacheState.INVALID);
430 entry.setState(PARSED_UNIT, CacheState.INVALID); 428 entry.setState(PARSED_UNIT, CacheState.INVALID);
431 entry.setState(IMPORTED_LIBRARIES, CacheState.INVALID); 429 entry.setState(IMPORTED_LIBRARIES, CacheState.INVALID);
432 entry.setState(EXPLICITLY_IMPORTED_LIBRARIES, CacheState.INVALID); 430 entry.setState(EXPLICITLY_IMPORTED_LIBRARIES, CacheState.INVALID);
433 entry.setState(EXPORTED_LIBRARIES, CacheState.INVALID); 431 entry.setState(EXPORTED_LIBRARIES, CacheState.INVALID);
434 entry.setState(INCLUDED_PARTS, CacheState.INVALID); 432 entry.setState(INCLUDED_PARTS, CacheState.INVALID);
435 entry.setState(LIBRARY_SPECIFIC_UNITS, CacheState.INVALID); 433 entry.setState(LIBRARY_SPECIFIC_UNITS, CacheState.INVALID);
436 entry.setState(UNITS, CacheState.INVALID); 434 entry.setState(UNITS, CacheState.INVALID);
437 } 435 }
438 } 436 }
439 } 437 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 } 491 }
494 } 492 }
495 493
496 bool _shouldErrorsBeComputed(Source source) => 494 bool _shouldErrorsBeComputed(Source source) =>
497 context.shouldErrorsBeAnalyzed(source); 495 context.shouldErrorsBeAnalyzed(source);
498 496
499 static bool _isDartSource(AnalysisTarget target) { 497 static bool _isDartSource(AnalysisTarget target) {
500 return target is Source && AnalysisEngine.isDartFileName(target.fullName); 498 return target is Source && AnalysisEngine.isDartFileName(target.fullName);
501 } 499 }
502 } 500 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/lib/task/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698