Chromium Code Reviews| 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 "dart:math" as math; | 10 import "dart:math" as math; |
| (...skipping 2235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2246 _sourceChanged(source); | 2246 _sourceChanged(source); |
| 2247 } | 2247 } |
| 2248 } | 2248 } |
| 2249 if (notify && changed) { | 2249 if (notify && changed) { |
| 2250 _onSourcesChangedController.add( | 2250 _onSourcesChangedController.add( |
| 2251 new SourcesChangedEvent.changedContent(source, newContents)); | 2251 new SourcesChangedEvent.changedContent(source, newContents)); |
| 2252 } | 2252 } |
| 2253 return changed; | 2253 return changed; |
| 2254 } | 2254 } |
| 2255 | 2255 |
| 2256 /** | |
| 2257 * Invalidates hints in the given [librarySource]. | |
| 2258 */ | |
| 2259 void invalidateLibraryHints(Source librarySource) { | |
|
Brian Wilkerson
2015/02/05 21:55:59
This needs to iterate over all of the parts in the
scheglov
2015/02/05 22:06:27
Done.
| |
| 2260 SourceEntry sourceEntry = _cache.get(librarySource); | |
| 2261 if (sourceEntry is! DartEntry) { | |
| 2262 return; | |
| 2263 } | |
| 2264 DartEntry dartEntry = sourceEntry; | |
| 2265 if (dartEntry.getStateInLibrary(DartEntry.HINTS, librarySource) == | |
| 2266 CacheState.VALID) { | |
| 2267 dartEntry.setStateInLibrary( | |
| 2268 DartEntry.HINTS, | |
| 2269 librarySource, | |
| 2270 CacheState.INVALID); | |
| 2271 } | |
| 2272 } | |
| 2273 | |
| 2256 @override | 2274 @override |
| 2257 bool isClientLibrary(Source librarySource) { | 2275 bool isClientLibrary(Source librarySource) { |
| 2258 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); | 2276 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); |
| 2259 if (sourceEntry is DartEntry) { | 2277 if (sourceEntry is DartEntry) { |
| 2260 DartEntry dartEntry = sourceEntry; | 2278 DartEntry dartEntry = sourceEntry; |
| 2261 return dartEntry.getValue(DartEntry.IS_CLIENT) && | 2279 return dartEntry.getValue(DartEntry.IS_CLIENT) && |
| 2262 dartEntry.getValue(DartEntry.IS_LAUNCHABLE); | 2280 dartEntry.getValue(DartEntry.IS_LAUNCHABLE); |
| 2263 } | 2281 } |
| 2264 return false; | 2282 return false; |
| 2265 } | 2283 } |
| (...skipping 2797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5063 List<Source> librarySources = getLibrariesContaining(unitSource); | 5081 List<Source> librarySources = getLibrariesContaining(unitSource); |
| 5064 if (librarySources.length != 1) { | 5082 if (librarySources.length != 1) { |
| 5065 return false; | 5083 return false; |
| 5066 } | 5084 } |
| 5067 Source librarySource = librarySources[0]; | 5085 Source librarySource = librarySources[0]; |
| 5068 // prepare the library element | 5086 // prepare the library element |
| 5069 LibraryElement libraryElement = getLibraryElement(librarySource); | 5087 LibraryElement libraryElement = getLibraryElement(librarySource); |
| 5070 if (libraryElement == null) { | 5088 if (libraryElement == null) { |
| 5071 return false; | 5089 return false; |
| 5072 } | 5090 } |
| 5073 // prepare the existing library units | |
| 5074 Map<Source, CompilationUnit> units = <Source, CompilationUnit>{}; | |
| 5075 for (CompilationUnitElement unitElement in libraryElement.units) { | |
| 5076 Source unitSource = unitElement.source; | |
| 5077 CompilationUnit unit = | |
| 5078 getResolvedCompilationUnit2(unitSource, librarySource); | |
| 5079 if (unit == null) { | |
| 5080 return false; | |
| 5081 } | |
| 5082 units[unitSource] = unit; | |
| 5083 } | |
| 5084 // prepare the existing unit | 5091 // prepare the existing unit |
| 5085 CompilationUnit oldUnit = units[unitSource]; | 5092 CompilationUnit oldUnit = |
| 5093 getResolvedCompilationUnit2(unitSource, librarySource); | |
| 5086 if (oldUnit == null) { | 5094 if (oldUnit == null) { |
| 5087 return false; | 5095 return false; |
| 5088 } | 5096 } |
| 5089 // do resolution | 5097 // do resolution |
| 5090 Stopwatch perfCounter = new Stopwatch()..start(); | 5098 Stopwatch perfCounter = new Stopwatch()..start(); |
| 5091 PoorMansIncrementalResolver resolver = new PoorMansIncrementalResolver( | 5099 PoorMansIncrementalResolver resolver = new PoorMansIncrementalResolver( |
| 5092 typeProvider, | 5100 typeProvider, |
| 5093 units, | |
| 5094 unitSource, | 5101 unitSource, |
| 5095 dartEntry, | 5102 dartEntry, |
| 5103 oldUnit, | |
| 5096 analysisOptions.incrementalApi); | 5104 analysisOptions.incrementalApi); |
| 5097 bool success = resolver.resolve(newCode); | 5105 bool success = resolver.resolve(newCode); |
| 5098 AnalysisEngine.instance.instrumentationService.logPerformance( | 5106 AnalysisEngine.instance.instrumentationService.logPerformance( |
| 5099 AnalysisPerformanceKind.INCREMENTAL, | 5107 AnalysisPerformanceKind.INCREMENTAL, |
| 5100 perfCounter, | 5108 perfCounter, |
| 5101 'success=$success,context_id=$_id,code_length=${newCode.length}'); | 5109 'success=$success,context_id=$_id,code_length=${newCode.length}'); |
| 5102 if (!success) { | 5110 if (!success) { |
| 5103 return false; | 5111 return false; |
| 5104 } | 5112 } |
| 5105 // if validation, remember the result, but throw it away | 5113 // if validation, remember the result, but throw it away |
| 5106 if (analysisOptions.incrementalValidation) { | 5114 if (analysisOptions.incrementalValidation) { |
| 5107 incrementalResolutionValidation_lastUnitSource = oldUnit.element.source; | 5115 incrementalResolutionValidation_lastUnitSource = oldUnit.element.source; |
| 5108 incrementalResolutionValidation_lastLibrarySource = | 5116 incrementalResolutionValidation_lastLibrarySource = |
| 5109 oldUnit.element.library.source; | 5117 oldUnit.element.library.source; |
| 5110 incrementalResolutionValidation_lastUnit = oldUnit; | 5118 incrementalResolutionValidation_lastUnit = oldUnit; |
| 5111 return false; | 5119 return false; |
| 5112 } | 5120 } |
| 5113 // prepare notices | 5121 // prepare notice |
| 5114 units.forEach((Source source, CompilationUnit unit) { | 5122 { |
| 5115 DartEntry dartEntry = _cache.get(source); | 5123 LineInfo lineInfo = getLineInfo(unitSource); |
| 5116 LineInfo lineInfo = getLineInfo(source); | 5124 ChangeNoticeImpl notice = _getNotice(unitSource); |
| 5117 ChangeNoticeImpl notice = _getNotice(source); | 5125 notice.resolvedDartUnit = oldUnit; |
| 5118 notice.resolvedDartUnit = unit; | |
| 5119 notice.setErrors(dartEntry.allErrors, lineInfo); | 5126 notice.setErrors(dartEntry.allErrors, lineInfo); |
| 5120 }); | 5127 } |
| 5121 // OK | 5128 // OK |
| 5122 return true; | 5129 return true; |
| 5123 } | 5130 } |
| 5124 | 5131 |
| 5125 /** | 5132 /** |
| 5126 * Check the cache for any invalid entries (entries whose modification time do es not match the | 5133 * Check the cache for any invalid entries (entries whose modification time do es not match the |
| 5127 * modification time of the source associated with the entry). Invalid entries will be marked as | 5134 * modification time of the source associated with the entry). Invalid entries will be marked as |
| 5128 * invalid so that the source will be re-analyzed. | 5135 * invalid so that the source will be re-analyzed. |
| 5129 * | 5136 * |
| 5130 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. | 5137 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. |
| (...skipping 4502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9633 cache.offset, | 9640 cache.offset, |
| 9634 cache.offset + cache.oldLength); | 9641 cache.offset + cache.oldLength); |
| 9635 // Update the resolution | 9642 // Update the resolution |
| 9636 TypeProvider typeProvider = this.typeProvider; | 9643 TypeProvider typeProvider = this.typeProvider; |
| 9637 if (_updatedUnit != null && typeProvider != null) { | 9644 if (_updatedUnit != null && typeProvider != null) { |
| 9638 CompilationUnitElement element = _updatedUnit.element; | 9645 CompilationUnitElement element = _updatedUnit.element; |
| 9639 if (element != null) { | 9646 if (element != null) { |
| 9640 LibraryElement library = element.library; | 9647 LibraryElement library = element.library; |
| 9641 if (library != null) { | 9648 if (library != null) { |
| 9642 IncrementalResolver resolver = new IncrementalResolver( | 9649 IncrementalResolver resolver = new IncrementalResolver( |
| 9643 <Source, CompilationUnit>{}, | |
| 9644 element, | 9650 element, |
| 9645 cache.offset, | 9651 cache.offset, |
| 9646 cache.oldLength, | 9652 cache.oldLength, |
| 9647 cache.newLength); | 9653 cache.newLength); |
| 9648 resolver.resolve(parser.updatedNode); | 9654 resolver.resolve(parser.updatedNode); |
| 9649 } | 9655 } |
| 9650 } | 9656 } |
| 9651 } | 9657 } |
| 9652 } | 9658 } |
| 9653 } | 9659 } |
| (...skipping 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12355 if (element.id == _id) { | 12361 if (element.id == _id) { |
| 12356 result = element; | 12362 result = element; |
| 12357 throw new _ElementByIdFinderException(); | 12363 throw new _ElementByIdFinderException(); |
| 12358 } | 12364 } |
| 12359 super.visitElement(element); | 12365 super.visitElement(element); |
| 12360 } | 12366 } |
| 12361 } | 12367 } |
| 12362 | 12368 |
| 12363 class _ElementByIdFinderException { | 12369 class _ElementByIdFinderException { |
| 12364 } | 12370 } |
| OLD | NEW |