| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine; | 8 library engine; |
| 9 | 9 |
| 10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
| (...skipping 5108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5119 * <b>Note:</b> This method cannot be used in an async environment. | 5119 * <b>Note:</b> This method cannot be used in an async environment. |
| 5120 * | 5120 * |
| 5121 * @param source the source representing the Dart file | 5121 * @param source the source representing the Dart file |
| 5122 * @param dartEntry the cache entry associated with the Dart file | 5122 * @param dartEntry the cache entry associated with the Dart file |
| 5123 * @param descriptor the descriptor representing the data to be returned | 5123 * @param descriptor the descriptor representing the data to be returned |
| 5124 * @return a cache entry containing the required data | 5124 * @return a cache entry containing the required data |
| 5125 * @throws AnalysisException if data could not be returned because the source
could not be parsed | 5125 * @throws AnalysisException if data could not be returned because the source
could not be parsed |
| 5126 */ | 5126 */ |
| 5127 DartEntry _cacheDartParseData(Source source, DartEntry dartEntry, DataDescript
or descriptor) { | 5127 DartEntry _cacheDartParseData(Source source, DartEntry dartEntry, DataDescript
or descriptor) { |
| 5128 if (identical(descriptor, DartEntry.PARSED_UNIT)) { | 5128 if (identical(descriptor, DartEntry.PARSED_UNIT)) { |
| 5129 CompilationUnit unit = dartEntry.anyParsedCompilationUnit; | 5129 if (dartEntry.hasResolvableCompilationUnit) { |
| 5130 if (unit != null) { | |
| 5131 return dartEntry; | 5130 return dartEntry; |
| 5132 } | 5131 } |
| 5133 } | 5132 } |
| 5134 // | 5133 // |
| 5135 // Check to see whether we already have the information being requested. | 5134 // Check to see whether we already have the information being requested. |
| 5136 // | 5135 // |
| 5137 CacheState state = dartEntry.getState(descriptor); | 5136 CacheState state = dartEntry.getState(descriptor); |
| 5138 while (state != CacheState.ERROR && state != CacheState.VALID) { | 5137 while (state != CacheState.ERROR && state != CacheState.VALID) { |
| 5139 // | 5138 // |
| 5140 // If not, compute the information. Unless the modification date of the so
urce continues to | 5139 // If not, compute the information. Unless the modification date of the so
urce continues to |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6031 DartEntry dartEntry = sourceEntry; | 6030 DartEntry dartEntry = sourceEntry; |
| 6032 CacheState scanErrorsState = dartEntry.getState(DartEntry.SCAN_ERRORS); | 6031 CacheState scanErrorsState = dartEntry.getState(DartEntry.SCAN_ERRORS); |
| 6033 if (identical(scanErrorsState, CacheState.INVALID) || (isPriority && ident
ical(scanErrorsState, CacheState.FLUSHED))) { | 6032 if (identical(scanErrorsState, CacheState.INVALID) || (isPriority && ident
ical(scanErrorsState, CacheState.FLUSHED))) { |
| 6034 return _createScanDartTask(source, dartEntry); | 6033 return _createScanDartTask(source, dartEntry); |
| 6035 } | 6034 } |
| 6036 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS); | 6035 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS); |
| 6037 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { | 6036 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { |
| 6038 return _createParseDartTask(source, dartEntry); | 6037 return _createParseDartTask(source, dartEntry); |
| 6039 } | 6038 } |
| 6040 if (isPriority && parseErrorsState != CacheState.ERROR) { | 6039 if (isPriority && parseErrorsState != CacheState.ERROR) { |
| 6041 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit; | 6040 if (!dartEntry.hasResolvableCompilationUnit) { |
| 6042 if (parseUnit == null) { | |
| 6043 return _createParseDartTask(source, dartEntry); | 6041 return _createParseDartTask(source, dartEntry); |
| 6044 } | 6042 } |
| 6045 } | 6043 } |
| 6046 SourceKind kind = dartEntry.getValue(DartEntry.SOURCE_KIND); | 6044 SourceKind kind = dartEntry.getValue(DartEntry.SOURCE_KIND); |
| 6047 if (identical(kind, SourceKind.UNKNOWN)) { | 6045 if (identical(kind, SourceKind.UNKNOWN)) { |
| 6048 return _createParseDartTask(source, dartEntry); | 6046 return _createParseDartTask(source, dartEntry); |
| 6049 } else if (identical(kind, SourceKind.LIBRARY)) { | 6047 } else if (identical(kind, SourceKind.LIBRARY)) { |
| 6050 CacheState elementState = dartEntry.getState(DartEntry.ELEMENT); | 6048 CacheState elementState = dartEntry.getState(DartEntry.ELEMENT); |
| 6051 if (identical(elementState, CacheState.INVALID)) { | 6049 if (identical(elementState, CacheState.INVALID)) { |
| 6052 return _createResolveDartLibraryTask(source, dartEntry); | 6050 return _createResolveDartLibraryTask(source, dartEntry); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6261 if (identical(scanErrorsState, CacheState.INVALID) || (isPriority && ident
ical(scanErrorsState, CacheState.FLUSHED))) { | 6259 if (identical(scanErrorsState, CacheState.INVALID) || (isPriority && ident
ical(scanErrorsState, CacheState.FLUSHED))) { |
| 6262 sources.add(source); | 6260 sources.add(source); |
| 6263 return; | 6261 return; |
| 6264 } | 6262 } |
| 6265 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS); | 6263 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS); |
| 6266 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { | 6264 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { |
| 6267 sources.add(source); | 6265 sources.add(source); |
| 6268 return; | 6266 return; |
| 6269 } | 6267 } |
| 6270 if (isPriority) { | 6268 if (isPriority) { |
| 6271 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit; | 6269 if (!dartEntry.hasResolvableCompilationUnit) { |
| 6272 if (parseUnit == null) { | |
| 6273 sources.add(source); | 6270 sources.add(source); |
| 6274 return; | 6271 return; |
| 6275 } | 6272 } |
| 6276 } | 6273 } |
| 6277 for (Source librarySource in getLibrariesContaining(source)) { | 6274 for (Source librarySource in getLibrariesContaining(source)) { |
| 6278 SourceEntry libraryEntry = _cache.get(librarySource); | 6275 SourceEntry libraryEntry = _cache.get(librarySource); |
| 6279 if (libraryEntry is DartEntry) { | 6276 if (libraryEntry is DartEntry) { |
| 6280 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT); | 6277 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT); |
| 6281 if (identical(elementState, CacheState.INVALID) || (isPriority && iden
tical(elementState, CacheState.FLUSHED))) { | 6278 if (identical(elementState, CacheState.INVALID) || (isPriority && iden
tical(elementState, CacheState.FLUSHED))) { |
| 6282 sources.add(source); | 6279 sources.add(source); |
| (...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7597 * Check the cache for any invalid entries (entries whose modification time do
es not match the | 7594 * Check the cache for any invalid entries (entries whose modification time do
es not match the |
| 7598 * modification time of the source associated with the entry). Invalid entries
will be marked as | 7595 * modification time of the source associated with the entry). Invalid entries
will be marked as |
| 7599 * invalid so that the source will be re-analyzed. | 7596 * invalid so that the source will be re-analyzed. |
| 7600 * | 7597 * |
| 7601 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 7598 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 7602 * | 7599 * |
| 7603 * @return `true` if at least one entry was invalid | 7600 * @return `true` if at least one entry was invalid |
| 7604 */ | 7601 */ |
| 7605 bool _validateCacheConsistency() { | 7602 bool _validateCacheConsistency() { |
| 7606 int consistencyCheckStart = JavaSystem.nanoTime(); | 7603 int consistencyCheckStart = JavaSystem.nanoTime(); |
| 7604 List<Source> changedSources = new List<Source>(); |
| 7607 List<Source> missingSources = new List<Source>(); | 7605 List<Source> missingSources = new List<Source>(); |
| 7608 int inconsistentCount = 0; | |
| 7609 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 7606 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 7610 Source source = entry.getKey(); | 7607 Source source = entry.getKey(); |
| 7611 SourceEntry sourceEntry = entry.getValue(); | 7608 SourceEntry sourceEntry = entry.getValue(); |
| 7612 int sourceTime = getModificationStamp(source); | 7609 int sourceTime = getModificationStamp(source); |
| 7613 if (sourceTime != sourceEntry.modificationTime) { | 7610 if (sourceTime != sourceEntry.modificationTime) { |
| 7614 _sourceChanged(source); | 7611 changedSources.add(source); |
| 7615 inconsistentCount++; | |
| 7616 } | 7612 } |
| 7617 if (sourceEntry.exception != null) { | 7613 if (sourceEntry.exception != null) { |
| 7618 if (!exists(source)) { | 7614 if (!exists(source)) { |
| 7619 missingSources.add(source); | 7615 missingSources.add(source); |
| 7620 } | 7616 } |
| 7621 } | 7617 } |
| 7622 } | 7618 } |
| 7619 int count = changedSources.length; |
| 7620 for (int i = 0; i < count; i++) { |
| 7621 _sourceChanged(changedSources[i]); |
| 7622 } |
| 7623 int consistencyCheckEnd = JavaSystem.nanoTime(); | 7623 int consistencyCheckEnd = JavaSystem.nanoTime(); |
| 7624 if (inconsistentCount > 0 || missingSources.length > 0) { | 7624 if (changedSources.length > 0 || missingSources.length > 0) { |
| 7625 PrintStringWriter writer = new PrintStringWriter(); | 7625 PrintStringWriter writer = new PrintStringWriter(); |
| 7626 writer.print("Consistency check took "); | 7626 writer.print("Consistency check took "); |
| 7627 writer.print((consistencyCheckEnd - consistencyCheckStart) / 1000000.0); | 7627 writer.print((consistencyCheckEnd - consistencyCheckStart) / 1000000.0); |
| 7628 writer.println(" ms and found"); | 7628 writer.println(" ms and found"); |
| 7629 writer.print(" "); | 7629 writer.print(" "); |
| 7630 writer.print(inconsistentCount); | 7630 writer.print(changedSources.length); |
| 7631 writer.println(" inconsistent entries"); | 7631 writer.println(" inconsistent entries"); |
| 7632 writer.print(" "); | 7632 writer.print(" "); |
| 7633 writer.print(missingSources.length); | 7633 writer.print(missingSources.length); |
| 7634 writer.println(" missing sources"); | 7634 writer.println(" missing sources"); |
| 7635 for (Source source in missingSources) { | 7635 for (Source source in missingSources) { |
| 7636 writer.print(" "); | 7636 writer.print(" "); |
| 7637 writer.println(source.fullName); | 7637 writer.println(source.fullName); |
| 7638 } | 7638 } |
| 7639 _logInformation(writer.toString()); | 7639 _logInformation(writer.toString()); |
| 7640 } | 7640 } |
| 7641 return inconsistentCount > 0; | 7641 return changedSources.length > 0; |
| 7642 } | 7642 } |
| 7643 } | 7643 } |
| 7644 | 7644 |
| 7645 /** | 7645 /** |
| 7646 * Instances of the class `AnalysisTaskResultRecorder` are used by an analysis c
ontext to | 7646 * Instances of the class `AnalysisTaskResultRecorder` are used by an analysis c
ontext to |
| 7647 * record the results of a task. | 7647 * record the results of a task. |
| 7648 */ | 7648 */ |
| 7649 class AnalysisContextImpl_AnalysisTaskResultRecorder implements AnalysisTaskVisi
tor<SourceEntry> { | 7649 class AnalysisContextImpl_AnalysisTaskResultRecorder implements AnalysisTaskVisi
tor<SourceEntry> { |
| 7650 final AnalysisContextImpl AnalysisContextImpl_this; | 7650 final AnalysisContextImpl AnalysisContextImpl_this; |
| 7651 | 7651 |
| (...skipping 5634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13286 } | 13286 } |
| 13287 | 13287 |
| 13288 @override | 13288 @override |
| 13289 void logInformation(String message) { | 13289 void logInformation(String message) { |
| 13290 } | 13290 } |
| 13291 | 13291 |
| 13292 @override | 13292 @override |
| 13293 void logInformation2(String message, Exception exception) { | 13293 void logInformation2(String message, Exception exception) { |
| 13294 } | 13294 } |
| 13295 } | 13295 } |
| OLD | NEW |