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

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 156763002: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
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 3481 matching lines...) Expand 10 before | Expand all | Expand 10 after
3492 logInformation("Added Dart sources, invalidating all resolution informat ion"); 3492 logInformation("Added Dart sources, invalidating all resolution informat ion");
3493 for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) { 3493 for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) {
3494 Source source = mapEntry.getKey(); 3494 Source source = mapEntry.getKey();
3495 SourceEntry sourceEntry = mapEntry.getValue(); 3495 SourceEntry sourceEntry = mapEntry.getValue();
3496 if (!source.isInSystemLibrary && sourceEntry is DartEntry) { 3496 if (!source.isInSystemLibrary && sourceEntry is DartEntry) {
3497 DartEntry dartEntry = sourceEntry; 3497 DartEntry dartEntry = sourceEntry;
3498 DartEntryImpl dartCopy = dartEntry.writableCopy; 3498 DartEntryImpl dartCopy = dartEntry.writableCopy;
3499 removeFromParts(source, dartEntry); 3499 removeFromParts(source, dartEntry);
3500 dartCopy.invalidateAllResolutionInformation(); 3500 dartCopy.invalidateAllResolutionInformation();
3501 mapEntry.setValue(dartCopy); 3501 mapEntry.setValue(dartCopy);
3502 WorkManagerPriority priority = WorkManagerPriority.UNKNOWN; 3502 SourcePriority priority = SourcePriority.UNKNOWN;
3503 SourceKind kind = dartCopy.kind; 3503 SourceKind kind = dartCopy.kind;
3504 if (identical(kind, SourceKind.LIBRARY)) { 3504 if (identical(kind, SourceKind.LIBRARY)) {
3505 priority = WorkManagerPriority.LIBRARY; 3505 priority = SourcePriority.LIBRARY;
3506 } else if (identical(kind, SourceKind.PART)) { 3506 } else if (identical(kind, SourceKind.PART)) {
3507 priority = WorkManagerPriority.NORMAL_PART; 3507 priority = SourcePriority.NORMAL_PART;
3508 } 3508 }
3509 _workManager.add(source, priority); 3509 _workManager.add(source, priority);
3510 } 3510 }
3511 } 3511 }
3512 } 3512 }
3513 } 3513 }
3514 } 3514 }
3515 3515
3516 String computeDocumentationComment(Element element) { 3516 String computeDocumentationComment(Element element) {
3517 if (element == null) { 3517 if (element == null) {
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
4306 recordElementData(dartEntry, dartCopy, library.libraryElement, librarySource, htmlSource); 4306 recordElementData(dartEntry, dartCopy, library.libraryElement, librarySource, htmlSource);
4307 } 4307 }
4308 _cache.storedAst(source); 4308 _cache.storedAst(source);
4309 } else { 4309 } else {
4310 dartCopy.recordResolutionError(); 4310 dartCopy.recordResolutionError();
4311 _cache.remove(source); 4311 _cache.remove(source);
4312 } 4312 }
4313 dartCopy.exception = thrownException; 4313 dartCopy.exception = thrownException;
4314 _cache.put(source, dartCopy); 4314 _cache.put(source, dartCopy);
4315 if (source != librarySource) { 4315 if (source != librarySource) {
4316 _workManager.add(source, WorkManagerPriority.PRIORITY_PART); 4316 _workManager.add(source, SourcePriority.PRIORITY_PART);
4317 } 4317 }
4318 if (source == unitSource) { 4318 if (source == unitSource) {
4319 unitEntry = dartCopy; 4319 unitEntry = dartCopy;
4320 } 4320 }
4321 ChangeNoticeImpl notice = getNotice(source); 4321 ChangeNoticeImpl notice = getNotice(source);
4322 notice.compilationUnit = unit; 4322 notice.compilationUnit = unit;
4323 notice.setErrors(dartCopy.allErrors, lineInfo); 4323 notice.setErrors(dartCopy.allErrors, lineInfo);
4324 } 4324 }
4325 } 4325 }
4326 } else { 4326 } else {
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
5364 if (sourceEntry is HtmlEntry) { 5364 if (sourceEntry is HtmlEntry) {
5365 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy; 5365 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy;
5366 htmlCopy.invalidateAllResolutionInformation(); 5366 htmlCopy.invalidateAllResolutionInformation();
5367 mapEntry.setValue(htmlCopy); 5367 mapEntry.setValue(htmlCopy);
5368 } else if (sourceEntry is DartEntry) { 5368 } else if (sourceEntry is DartEntry) {
5369 DartEntry dartEntry = sourceEntry; 5369 DartEntry dartEntry = sourceEntry;
5370 removeFromParts(source, dartEntry); 5370 removeFromParts(source, dartEntry);
5371 DartEntryImpl dartCopy = dartEntry.writableCopy; 5371 DartEntryImpl dartCopy = dartEntry.writableCopy;
5372 dartCopy.invalidateAllResolutionInformation(); 5372 dartCopy.invalidateAllResolutionInformation();
5373 mapEntry.setValue(dartCopy); 5373 mapEntry.setValue(dartCopy);
5374 _workManager.add(source, WorkManagerPriority.UNKNOWN); 5374 _workManager.add(source, SourcePriority.UNKNOWN);
5375 } 5375 }
5376 } 5376 }
5377 } 5377 }
5378 5378
5379 /** 5379 /**
5380 * In response to a change to at least one of the compilation units in the giv en library, 5380 * In response to a change to at least one of the compilation units in the giv en library,
5381 * invalidate any results that are dependent on the result of resolving that l ibrary. 5381 * invalidate any results that are dependent on the result of resolving that l ibrary.
5382 * 5382 *
5383 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 5383 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
5384 * 5384 *
5385 * <b>Note:</b> Any cache entries that were accessed before this method was in voked must be 5385 * <b>Note:</b> Any cache entries that were accessed before this method was in voked must be
5386 * re-accessed after this method returns. 5386 * re-accessed after this method returns.
5387 * 5387 *
5388 * @param librarySource the source of the library being invalidated 5388 * @param librarySource the source of the library being invalidated
5389 * @param writer the writer to which debugging information should be written 5389 * @param writer the writer to which debugging information should be written
5390 */ 5390 */
5391 void invalidateLibraryResolution(Source librarySource, PrintStringWriter write r) { 5391 void invalidateLibraryResolution(Source librarySource, PrintStringWriter write r) {
5392 // TODO(brianwilkerson) This could be optimized. There's no need to flush al l of these caches if 5392 // TODO(brianwilkerson) This could be optimized. There's no need to flush al l of these caches if
5393 // the public namespace hasn't changed, which will be a fairly common case. The question is 5393 // the public namespace hasn't changed, which will be a fairly common case. The question is
5394 // whether we can afford the time to compute the namespace to look for diffe rences. 5394 // whether we can afford the time to compute the namespace to look for diffe rences.
5395 DartEntry libraryEntry = getReadableDartEntry(librarySource); 5395 DartEntry libraryEntry = getReadableDartEntry(librarySource);
5396 if (libraryEntry != null) { 5396 if (libraryEntry != null) {
5397 List<Source> includedParts = libraryEntry.getValue(DartEntry.INCLUDED_PART S); 5397 List<Source> includedParts = libraryEntry.getValue(DartEntry.INCLUDED_PART S);
5398 DartEntryImpl libraryCopy = libraryEntry.writableCopy; 5398 DartEntryImpl libraryCopy = libraryEntry.writableCopy;
5399 int oldTime = libraryCopy.modificationTime; 5399 int oldTime = libraryCopy.modificationTime;
5400 libraryCopy.invalidateAllResolutionInformation(); 5400 libraryCopy.invalidateAllResolutionInformation();
5401 _cache.put(librarySource, libraryCopy); 5401 _cache.put(librarySource, libraryCopy);
5402 _workManager.add(librarySource, WorkManagerPriority.LIBRARY); 5402 _workManager.add(librarySource, SourcePriority.LIBRARY);
5403 if (writer != null) { 5403 if (writer != null) {
5404 writer.println(" Invalidated library source: ${debuggingString(libraryS ource)} (previously modified at ${oldTime})"); 5404 writer.println(" Invalidated library source: ${debuggingString(libraryS ource)} (previously modified at ${oldTime})");
5405 } 5405 }
5406 for (Source partSource in includedParts) { 5406 for (Source partSource in includedParts) {
5407 SourceEntry partEntry = _cache.get(partSource); 5407 SourceEntry partEntry = _cache.get(partSource);
5408 if (partEntry is DartEntry) { 5408 if (partEntry is DartEntry) {
5409 DartEntryImpl partCopy = partEntry.writableCopy; 5409 DartEntryImpl partCopy = partEntry.writableCopy;
5410 oldTime = partCopy.modificationTime; 5410 oldTime = partCopy.modificationTime;
5411 if (partEntry != libraryCopy) { 5411 if (partEntry != libraryCopy) {
5412 partCopy.removeContainingLibrary(librarySource); 5412 partCopy.removeContainingLibrary(librarySource);
5413 _workManager.add(librarySource, WorkManagerPriority.NORMAL_PART); 5413 _workManager.add(librarySource, SourcePriority.NORMAL_PART);
5414 } 5414 }
5415 partCopy.invalidateAllResolutionInformation(); 5415 partCopy.invalidateAllResolutionInformation();
5416 _cache.put(partSource, partCopy); 5416 _cache.put(partSource, partCopy);
5417 if (writer != null) { 5417 if (writer != null) {
5418 writer.println(" Invalidated part source: ${debuggingString(partSou rce)} (previously modified at ${oldTime})"); 5418 writer.println(" Invalidated part source: ${debuggingString(partSou rce)} (previously modified at ${oldTime})");
5419 } 5419 }
5420 } 5420 }
5421 } 5421 }
5422 } 5422 }
5423 } 5423 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
5510 if (angularElement is AngularComponentElement) { 5510 if (angularElement is AngularComponentElement) {
5511 AngularComponentElement component = angularElement; 5511 AngularComponentElement component = angularElement;
5512 Source templateSource = component.templateSource; 5512 Source templateSource = component.templateSource;
5513 if (templateSource != null) { 5513 if (templateSource != null) {
5514 HtmlEntry htmlEntry = getReadableHtmlEntry(templateSource); 5514 HtmlEntry htmlEntry = getReadableHtmlEntry(templateSource);
5515 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 5515 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5516 htmlCopy.setValue(HtmlEntry.ANGULAR_APPLICATION, app); 5516 htmlCopy.setValue(HtmlEntry.ANGULAR_APPLICATION, app);
5517 htmlCopy.setValue(HtmlEntry.ANGULAR_COMPONENT, component); 5517 htmlCopy.setValue(HtmlEntry.ANGULAR_COMPONENT, component);
5518 htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.INVALID); 5518 htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.INVALID);
5519 _cache.put(templateSource, htmlCopy); 5519 _cache.put(templateSource, htmlCopy);
5520 _workManager.add(templateSource, WorkManagerPriority.HTML); 5520 _workManager.add(templateSource, SourcePriority.HTML);
5521 } 5521 }
5522 } 5522 }
5523 } 5523 }
5524 } 5524 }
5525 // remember Angular application 5525 // remember Angular application
5526 entry.setValue(HtmlEntry.ANGULAR_ENTRY, app); 5526 entry.setValue(HtmlEntry.ANGULAR_ENTRY, app);
5527 entry.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.INVALID); 5527 entry.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.INVALID);
5528 } 5528 }
5529 5529
5530 /** 5530 /**
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
5611 if (thrownException == null || resultTime >= 0) { 5611 if (thrownException == null || resultTime >= 0) {
5612 // 5612 //
5613 // The analysis was performed on out-of-date sources. Mark the cache s o that the source 5613 // The analysis was performed on out-of-date sources. Mark the cache s o that the source
5614 // will be re-verified using the up-to-date sources. 5614 // will be re-verified using the up-to-date sources.
5615 // 5615 //
5616 // dartCopy.setState(DartEntry.VERIFICATION_ERRORS, librarySo urce, CacheState.INVALID); 5616 // dartCopy.setState(DartEntry.VERIFICATION_ERRORS, librarySo urce, CacheState.INVALID);
5617 removeFromParts(source, dartEntry); 5617 removeFromParts(source, dartEntry);
5618 dartCopy.invalidateAllInformation(); 5618 dartCopy.invalidateAllInformation();
5619 dartCopy.modificationTime = sourceTime; 5619 dartCopy.modificationTime = sourceTime;
5620 _cache.removedAst(source); 5620 _cache.removedAst(source);
5621 _workManager.add(source, WorkManagerPriority.UNKNOWN); 5621 _workManager.add(source, SourcePriority.UNKNOWN);
5622 } else { 5622 } else {
5623 // 5623 //
5624 // We could not determine whether the sources were up-to-date or out-o f-date. Mark the 5624 // We could not determine whether the sources were up-to-date or out-o f-date. Mark the
5625 // cache so that we won't attempt to re-verify the source until there' s a good chance 5625 // cache so that we won't attempt to re-verify the source until there' s a good chance
5626 // that we'll be able to do so without error. 5626 // that we'll be able to do so without error.
5627 // 5627 //
5628 dartCopy.setState2(DartEntry.VERIFICATION_ERRORS, librarySource, Cache State.ERROR); 5628 dartCopy.setState2(DartEntry.VERIFICATION_ERRORS, librarySource, Cache State.ERROR);
5629 } 5629 }
5630 dartCopy.exception = thrownException; 5630 dartCopy.exception = thrownException;
5631 _cache.put(source, dartCopy); 5631 _cache.put(source, dartCopy);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
5714 if (thrownException == null || resultTime >= 0) { 5714 if (thrownException == null || resultTime >= 0) {
5715 // 5715 //
5716 // The analysis was performed on out-of-date sources. Mark the cac he so that the sources 5716 // The analysis was performed on out-of-date sources. Mark the cac he so that the sources
5717 // will be re-analyzed using the up-to-date sources. 5717 // will be re-analyzed using the up-to-date sources.
5718 // 5718 //
5719 // dartCopy.setState(DartEntry.HINTS, librarySource, CacheState.INVALID); 5719 // dartCopy.setState(DartEntry.HINTS, librarySource, CacheState.INVALID);
5720 removeFromParts(unitSource, dartEntry); 5720 removeFromParts(unitSource, dartEntry);
5721 dartCopy.invalidateAllInformation(); 5721 dartCopy.invalidateAllInformation();
5722 dartCopy.modificationTime = sourceTime; 5722 dartCopy.modificationTime = sourceTime;
5723 _cache.removedAst(unitSource); 5723 _cache.removedAst(unitSource);
5724 _workManager.add(unitSource, WorkManagerPriority.UNKNOWN); 5724 _workManager.add(unitSource, SourcePriority.UNKNOWN);
5725 } else { 5725 } else {
5726 // 5726 //
5727 // We could not determine whether the sources were up-to-date or o ut-of-date. Mark the 5727 // We could not determine whether the sources were up-to-date or o ut-of-date. Mark the
5728 // cache so that we won't attempt to re-analyze the sources until there's a good chance 5728 // cache so that we won't attempt to re-analyze the sources until there's a good chance
5729 // that we'll be able to do so without error. 5729 // that we'll be able to do so without error.
5730 // 5730 //
5731 dartCopy.setState2(DartEntry.HINTS, librarySource, CacheState.ERRO R); 5731 dartCopy.setState2(DartEntry.HINTS, librarySource, CacheState.ERRO R);
5732 } 5732 }
5733 dartCopy.exception = thrownException; 5733 dartCopy.exception = thrownException;
5734 _cache.put(unitSource, dartCopy); 5734 _cache.put(unitSource, dartCopy);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
5792 if (dartEntry == null) { 5792 if (dartEntry == null) {
5793 throw new AnalysisException.con1("A Dart file became a non-Dart file : ${source.fullName}"); 5793 throw new AnalysisException.con1("A Dart file became a non-Dart file : ${source.fullName}");
5794 } 5794 }
5795 } 5795 }
5796 DartEntryImpl dartCopy = dartEntry.writableCopy; 5796 DartEntryImpl dartCopy = dartEntry.writableCopy;
5797 if (thrownException == null) { 5797 if (thrownException == null) {
5798 LineInfo lineInfo = task.lineInfo; 5798 LineInfo lineInfo = task.lineInfo;
5799 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo); 5799 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
5800 if (task.hasPartOfDirective() && !task.hasLibraryDirective()) { 5800 if (task.hasPartOfDirective() && !task.hasLibraryDirective()) {
5801 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.PART); 5801 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.PART);
5802 _workManager.add(source, WorkManagerPriority.NORMAL_PART); 5802 _workManager.add(source, SourcePriority.NORMAL_PART);
5803 } else { 5803 } else {
5804 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); 5804 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY);
5805 dartCopy.containingLibrary = source; 5805 dartCopy.containingLibrary = source;
5806 _workManager.add(source, WorkManagerPriority.LIBRARY); 5806 _workManager.add(source, SourcePriority.LIBRARY);
5807 } 5807 }
5808 dartCopy.setValue(DartEntry.PARSED_UNIT, task.compilationUnit); 5808 dartCopy.setValue(DartEntry.PARSED_UNIT, task.compilationUnit);
5809 dartCopy.setValue(DartEntry.PARSE_ERRORS, task.errors); 5809 dartCopy.setValue(DartEntry.PARSE_ERRORS, task.errors);
5810 _cache.storedAst(source); 5810 _cache.storedAst(source);
5811 ChangeNoticeImpl notice = getNotice(source); 5811 ChangeNoticeImpl notice = getNotice(source);
5812 notice.setErrors(dartEntry.allErrors, lineInfo); 5812 notice.setErrors(dartEntry.allErrors, lineInfo);
5813 // Verify that the incrementally parsed and resolved unit in the incre mental cache 5813 // Verify that the incrementally parsed and resolved unit in the incre mental cache
5814 // is structurally equivalent to the fully parsed unit 5814 // is structurally equivalent to the fully parsed unit
5815 _incrementalAnalysisCache = IncrementalAnalysisCache.verifyStructure(_ incrementalAnalysisCache, source, task.compilationUnit); 5815 _incrementalAnalysisCache = IncrementalAnalysisCache.verifyStructure(_ incrementalAnalysisCache, source, task.compilationUnit);
5816 } else { 5816 } else {
(...skipping 10 matching lines...) Expand all
5827 if (thrownException == null || resultTime >= 0) { 5827 if (thrownException == null || resultTime >= 0) {
5828 // 5828 //
5829 // The analysis was performed on out-of-date sources. Mark the cache s o that the sources 5829 // The analysis was performed on out-of-date sources. Mark the cache s o that the sources
5830 // will be re-analyzed using the up-to-date sources. 5830 // will be re-analyzed using the up-to-date sources.
5831 // 5831 //
5832 // dartCopy.recordParseNotInProcess(); 5832 // dartCopy.recordParseNotInProcess();
5833 removeFromParts(source, dartEntry); 5833 removeFromParts(source, dartEntry);
5834 dartCopy.invalidateAllInformation(); 5834 dartCopy.invalidateAllInformation();
5835 dartCopy.modificationTime = sourceTime; 5835 dartCopy.modificationTime = sourceTime;
5836 _cache.removedAst(source); 5836 _cache.removedAst(source);
5837 _workManager.add(source, WorkManagerPriority.UNKNOWN); 5837 _workManager.add(source, SourcePriority.UNKNOWN);
5838 } else { 5838 } else {
5839 // 5839 //
5840 // We could not determine whether the sources were up-to-date or out-o f-date. Mark the 5840 // We could not determine whether the sources were up-to-date or out-o f-date. Mark the
5841 // cache so that we won't attempt to re-analyze the sources until ther e's a good chance 5841 // cache so that we won't attempt to re-analyze the sources until ther e's a good chance
5842 // that we'll be able to do so without error. 5842 // that we'll be able to do so without error.
5843 // 5843 //
5844 dartCopy.recordParseError(); 5844 dartCopy.recordParseError();
5845 } 5845 }
5846 dartCopy.exception = thrownException; 5846 dartCopy.exception = thrownException;
5847 _cache.put(source, dartCopy); 5847 _cache.put(source, dartCopy);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
6164 if (thrownException == null || resultTime >= 0) { 6164 if (thrownException == null || resultTime >= 0) {
6165 // 6165 //
6166 // The analysis was performed on out-of-date sources. Mark the cache s o that the sources 6166 // The analysis was performed on out-of-date sources. Mark the cache s o that the sources
6167 // will be re-analyzed using the up-to-date sources. 6167 // will be re-analyzed using the up-to-date sources.
6168 // 6168 //
6169 // dartCopy.recordDependencyNotInProcess(); 6169 // dartCopy.recordDependencyNotInProcess();
6170 removeFromParts(source, dartEntry); 6170 removeFromParts(source, dartEntry);
6171 dartCopy.invalidateAllInformation(); 6171 dartCopy.invalidateAllInformation();
6172 dartCopy.modificationTime = sourceTime; 6172 dartCopy.modificationTime = sourceTime;
6173 _cache.removedAst(source); 6173 _cache.removedAst(source);
6174 _workManager.add(source, WorkManagerPriority.UNKNOWN); 6174 _workManager.add(source, SourcePriority.UNKNOWN);
6175 } else { 6175 } else {
6176 // 6176 //
6177 // We could not determine whether the sources were up-to-date or out-o f-date. Mark the 6177 // We could not determine whether the sources were up-to-date or out-o f-date. Mark the
6178 // cache so that we won't attempt to re-analyze the sources until ther e's a good chance 6178 // cache so that we won't attempt to re-analyze the sources until ther e's a good chance
6179 // that we'll be able to do so without error. 6179 // that we'll be able to do so without error.
6180 // 6180 //
6181 dartCopy.setState(DartEntry.EXPORTED_LIBRARIES, CacheState.ERROR); 6181 dartCopy.setState(DartEntry.EXPORTED_LIBRARIES, CacheState.ERROR);
6182 dartCopy.setState(DartEntry.IMPORTED_LIBRARIES, CacheState.ERROR); 6182 dartCopy.setState(DartEntry.IMPORTED_LIBRARIES, CacheState.ERROR);
6183 dartCopy.setState(DartEntry.INCLUDED_PARTS, CacheState.ERROR); 6183 dartCopy.setState(DartEntry.INCLUDED_PARTS, CacheState.ERROR);
6184 } 6184 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6244 // The analysis was performed on out-of-date sources. Mark the cache s o that the sources 6244 // The analysis was performed on out-of-date sources. Mark the cache s o that the sources
6245 // will be re-analyzed using the up-to-date sources. 6245 // will be re-analyzed using the up-to-date sources.
6246 // 6246 //
6247 // if (dartCopy.getState(DartEntry.RESOLVED_UNIT) == CacheSta te.IN_PROCESS) { 6247 // if (dartCopy.getState(DartEntry.RESOLVED_UNIT) == CacheSta te.IN_PROCESS) {
6248 // dartCopy.setState(DartEntry.RESOLVED_UNIT, librarySource , CacheState.INVALID); 6248 // dartCopy.setState(DartEntry.RESOLVED_UNIT, librarySource , CacheState.INVALID);
6249 // } 6249 // }
6250 removeFromParts(unitSource, dartEntry); 6250 removeFromParts(unitSource, dartEntry);
6251 dartCopy.invalidateAllInformation(); 6251 dartCopy.invalidateAllInformation();
6252 dartCopy.modificationTime = sourceTime; 6252 dartCopy.modificationTime = sourceTime;
6253 _cache.removedAst(unitSource); 6253 _cache.removedAst(unitSource);
6254 _workManager.add(unitSource, WorkManagerPriority.UNKNOWN); 6254 _workManager.add(unitSource, SourcePriority.UNKNOWN);
6255 } else { 6255 } else {
6256 // 6256 //
6257 // We could not determine whether the sources were up-to-date or out-o f-date. Mark the 6257 // We could not determine whether the sources were up-to-date or out-o f-date. Mark the
6258 // cache so that we won't attempt to re-analyze the sources until ther e's a good chance 6258 // cache so that we won't attempt to re-analyze the sources until ther e's a good chance
6259 // that we'll be able to do so without error. 6259 // that we'll be able to do so without error.
6260 // 6260 //
6261 dartCopy.setState2(DartEntry.RESOLVED_UNIT, librarySource, CacheState. ERROR); 6261 dartCopy.setState2(DartEntry.RESOLVED_UNIT, librarySource, CacheState. ERROR);
6262 } 6262 }
6263 dartCopy.exception = thrownException; 6263 dartCopy.exception = thrownException;
6264 _cache.put(unitSource, dartCopy); 6264 _cache.put(unitSource, dartCopy);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
6412 logInformation("Added new source: ${debuggingString(source)}"); 6412 logInformation("Added new source: ${debuggingString(source)}");
6413 } else { 6413 } else {
6414 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; 6414 SourceEntryImpl sourceCopy = sourceEntry.writableCopy;
6415 int oldTime = sourceCopy.modificationTime; 6415 int oldTime = sourceCopy.modificationTime;
6416 sourceCopy.modificationTime = source.modificationStamp; 6416 sourceCopy.modificationTime = source.modificationStamp;
6417 // TODO(brianwilkerson) Understand why we're not invalidating the cache. 6417 // TODO(brianwilkerson) Understand why we're not invalidating the cache.
6418 _cache.put(source, sourceCopy); 6418 _cache.put(source, sourceCopy);
6419 logInformation("Added new source: ${debuggingString(source)} (previously m odified at ${oldTime})"); 6419 logInformation("Added new source: ${debuggingString(source)} (previously m odified at ${oldTime})");
6420 } 6420 }
6421 if (sourceEntry is HtmlEntry) { 6421 if (sourceEntry is HtmlEntry) {
6422 _workManager.add(source, WorkManagerPriority.HTML); 6422 _workManager.add(source, SourcePriority.HTML);
6423 } else { 6423 } else {
6424 _workManager.add(source, WorkManagerPriority.UNKNOWN); 6424 _workManager.add(source, SourcePriority.UNKNOWN);
6425 } 6425 }
6426 return sourceEntry is DartEntry; 6426 return sourceEntry is DartEntry;
6427 } 6427 }
6428 6428
6429 /** 6429 /**
6430 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 6430 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
6431 * 6431 *
6432 * @param source the source that has been changed 6432 * @param source the source that has been changed
6433 */ 6433 */
6434 void sourceChanged(Source source) { 6434 void sourceChanged(Source source) {
6435 SourceEntry sourceEntry = _cache.get(source); 6435 SourceEntry sourceEntry = _cache.get(source);
6436 if (sourceEntry == null || sourceEntry.modificationTime == source.modificati onStamp) { 6436 if (sourceEntry == null || sourceEntry.modificationTime == source.modificati onStamp) {
6437 // Either we have removed this source, in which case we don't care that it is changed, or we 6437 // Either we have removed this source, in which case we don't care that it is changed, or we
6438 // have already invalidated the cache and don't need to invalidate it agai n. 6438 // have already invalidated the cache and don't need to invalidate it agai n.
6439 if (sourceEntry == null) { 6439 if (sourceEntry == null) {
6440 logInformation("Modified source, but there is no entry: ${debuggingStrin g(source)}"); 6440 logInformation("Modified source, but there is no entry: ${debuggingStrin g(source)}");
6441 } else { 6441 } else {
6442 logInformation("Modified source, but modification time matches: ${debugg ingString(source)}"); 6442 logInformation("Modified source, but modification time matches: ${debugg ingString(source)}");
6443 } 6443 }
6444 return; 6444 return;
6445 } 6445 }
6446 if (sourceEntry is HtmlEntry) { 6446 if (sourceEntry is HtmlEntry) {
6447 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy; 6447 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy;
6448 int oldTime = htmlCopy.modificationTime; 6448 int oldTime = htmlCopy.modificationTime;
6449 htmlCopy.modificationTime = source.modificationStamp; 6449 htmlCopy.modificationTime = source.modificationStamp;
6450 htmlCopy.invalidateAllInformation(); 6450 htmlCopy.invalidateAllInformation();
6451 _cache.put(source, htmlCopy); 6451 _cache.put(source, htmlCopy);
6452 _cache.removedAst(source); 6452 _cache.removedAst(source);
6453 _workManager.add(source, WorkManagerPriority.HTML); 6453 _workManager.add(source, SourcePriority.HTML);
6454 logInformation("Modified HTML source: ${debuggingString(source)} (previous ly modified at ${oldTime})"); 6454 logInformation("Modified HTML source: ${debuggingString(source)} (previous ly modified at ${oldTime})");
6455 } else if (sourceEntry is DartEntry) { 6455 } else if (sourceEntry is DartEntry) {
6456 List<Source> containingLibraries = getLibrariesContaining(source); 6456 List<Source> containingLibraries = getLibrariesContaining(source);
6457 Set<Source> librariesToInvalidate = new Set<Source>(); 6457 Set<Source> librariesToInvalidate = new Set<Source>();
6458 for (Source containingLibrary in containingLibraries) { 6458 for (Source containingLibrary in containingLibraries) {
6459 librariesToInvalidate.add(containingLibrary); 6459 librariesToInvalidate.add(containingLibrary);
6460 for (Source dependentLibrary in getLibrariesDependingOn(containingLibrar y)) { 6460 for (Source dependentLibrary in getLibrariesDependingOn(containingLibrar y)) {
6461 librariesToInvalidate.add(dependentLibrary); 6461 librariesToInvalidate.add(dependentLibrary);
6462 } 6462 }
6463 } 6463 }
6464 PrintStringWriter writer = new PrintStringWriter(); 6464 PrintStringWriter writer = new PrintStringWriter();
6465 int oldTime = sourceEntry.modificationTime; 6465 int oldTime = sourceEntry.modificationTime;
6466 writer.println("Modified Dart source: ${debuggingString(source)} (previous ly modified at ${oldTime})"); 6466 writer.println("Modified Dart source: ${debuggingString(source)} (previous ly modified at ${oldTime})");
6467 for (Source library in librariesToInvalidate) { 6467 for (Source library in librariesToInvalidate) {
6468 // for (Source library : containingLibraries) { 6468 // for (Source library : containingLibraries) {
6469 invalidateLibraryResolution(library, writer); 6469 invalidateLibraryResolution(library, writer);
6470 } 6470 }
6471 removeFromParts(source, sourceEntry); 6471 removeFromParts(source, sourceEntry);
6472 DartEntryImpl dartCopy = sourceEntry.writableCopy; 6472 DartEntryImpl dartCopy = sourceEntry.writableCopy;
6473 dartCopy.modificationTime = source.modificationStamp; 6473 dartCopy.modificationTime = source.modificationStamp;
6474 dartCopy.invalidateAllInformation(); 6474 dartCopy.invalidateAllInformation();
6475 _cache.put(source, dartCopy); 6475 _cache.put(source, dartCopy);
6476 _cache.removedAst(source); 6476 _cache.removedAst(source);
6477 _workManager.add(source, WorkManagerPriority.UNKNOWN); 6477 _workManager.add(source, SourcePriority.UNKNOWN);
6478 logInformation(writer.toString()); 6478 logInformation(writer.toString());
6479 } 6479 }
6480 } 6480 }
6481 6481
6482 /** 6482 /**
6483 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 6483 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
6484 * 6484 *
6485 * @param source the source that has been deleted 6485 * @param source the source that has been deleted
6486 */ 6486 */
6487 void sourceRemoved(Source source) { 6487 void sourceRemoved(Source source) {
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after
8170 8170
8171 /** 8171 /**
8172 * Return the AST that was created from the source. 8172 * Return the AST that was created from the source.
8173 * 8173 *
8174 * @return the AST that was created from the source 8174 * @return the AST that was created from the source
8175 */ 8175 */
8176 ht.HtmlUnit get compilationUnit => data; 8176 ht.HtmlUnit get compilationUnit => data;
8177 } 8177 }
8178 8178
8179 /** 8179 /**
8180 * The enumerated type `Priority` defines the priority levels used to return sou rces in an
8181 * optimal order.
8182 */
8183 class SourcePriority extends Enum<SourcePriority> {
8184 /**
8185 * Used for a Dart source that is known to be a part contained in a library th at was recently
8186 * resolved. These parts are given a higher priority because there is a high p robability that
8187 * their AST structure is still in the cache and therefore would not need to b e re-created.
8188 */
8189 static final SourcePriority PRIORITY_PART = new SourcePriority('PRIORITY_PART' , 0);
8190
8191 /**
8192 * Used for a Dart source that is known to be a library.
8193 */
8194 static final SourcePriority LIBRARY = new SourcePriority('LIBRARY', 1);
8195
8196 /**
8197 * Used for a Dart source that is known to be a part but whose library has not yet been
8198 * resolved.
8199 */
8200 static final SourcePriority NORMAL_PART = new SourcePriority('NORMAL_PART', 2) ;
8201
8202 /**
8203 * Used for a Dart source whose kind is unknown.
8204 */
8205 static final SourcePriority UNKNOWN = new SourcePriority('UNKNOWN', 3);
8206
8207 /**
8208 * Used for an HTML source.
8209 */
8210 static final SourcePriority HTML = new SourcePriority('HTML', 4);
8211
8212 static final List<SourcePriority> values = [PRIORITY_PART, LIBRARY, NORMAL_PAR T, UNKNOWN, HTML];
8213
8214 SourcePriority(String name, int ordinal) : super(name, ordinal);
8215 }
8216
8217 /**
8180 * Instances of the class `TimestampedData` represent analysis data for which we have a 8218 * Instances of the class `TimestampedData` represent analysis data for which we have a
8181 * modification time. 8219 * modification time.
8182 */ 8220 */
8183 class TimestampedData<E> { 8221 class TimestampedData<E> {
8184 /** 8222 /**
8185 * The modification time of the source from which the data was created. 8223 * The modification time of the source from which the data was created.
8186 */ 8224 */
8187 final int modificationTime; 8225 final int modificationTime;
8188 8226
8189 /** 8227 /**
(...skipping 17 matching lines...) Expand all
8207 class WorkManager { 8245 class WorkManager {
8208 /** 8246 /**
8209 * An array containing the various queues is priority order. 8247 * An array containing the various queues is priority order.
8210 */ 8248 */
8211 List<List<Source>> _workQueues; 8249 List<List<Source>> _workQueues;
8212 8250
8213 /** 8251 /**
8214 * Initialize a newly created manager to have no work queued up. 8252 * Initialize a newly created manager to have no work queued up.
8215 */ 8253 */
8216 WorkManager() { 8254 WorkManager() {
8217 int queueCount = WorkManagerPriority.values.length; 8255 int queueCount = SourcePriority.values.length;
8218 _workQueues = new List<List>(queueCount); 8256 _workQueues = new List<List>(queueCount);
8219 for (int i = 0; i < queueCount; i++) { 8257 for (int i = 0; i < queueCount; i++) {
8220 _workQueues[i] = new List<Source>(); 8258 _workQueues[i] = new List<Source>();
8221 } 8259 }
8222 } 8260 }
8223 8261
8224 /** 8262 /**
8225 * Record that the given source needs to be analyzed. The priority level is us ed to control when 8263 * Record that the given source needs to be analyzed. The priority level is us ed to control when
8226 * the source will be analyzed with respect to other sources. 8264 * the source will be analyzed with respect to other sources.
8227 * 8265 *
8228 * @param source the source that needs to be analyzed 8266 * @param source the source that needs to be analyzed
8229 * @param priority the priority level of the source 8267 * @param priority the priority level of the source
8230 */ 8268 */
8231 void add(Source source, WorkManagerPriority priority) { 8269 void add(Source source, SourcePriority priority) {
8232 // TODO(brianwilkerson) Optimize the order of the libraries so that librarie s that depend on 8270 // TODO(brianwilkerson) Optimize the order of the libraries so that librarie s that depend on
8233 // other libraries get analyzed after the other libraries. 8271 // other libraries get analyzed after the other libraries.
8234 int queueCount = _workQueues.length; 8272 int queueCount = _workQueues.length;
8235 int ordinal = priority.ordinal; 8273 int ordinal = priority.ordinal;
8236 for (int i = 0; i < queueCount; i++) { 8274 for (int i = 0; i < queueCount; i++) {
8237 List<Source> queue = _workQueues[i]; 8275 List<Source> queue = _workQueues[i];
8238 if (i == ordinal) { 8276 if (i == ordinal) {
8239 if (!queue.contains(source)) { 8277 if (!queue.contains(source)) {
8240 queue.add(source); 8278 queue.add(source);
8241 } 8279 }
(...skipping 26 matching lines...) Expand all
8268 */ 8306 */
8269 void remove(Source source) { 8307 void remove(Source source) {
8270 int queueCount = _workQueues.length; 8308 int queueCount = _workQueues.length;
8271 for (int i = 0; i < queueCount; i++) { 8309 for (int i = 0; i < queueCount; i++) {
8272 _workQueues[i].remove(source); 8310 _workQueues[i].remove(source);
8273 } 8311 }
8274 } 8312 }
8275 } 8313 }
8276 8314
8277 /** 8315 /**
8278 * The enumerated type `Priority` defines the priority levels used to return sou rces in an
8279 * optimal order.
8280 */
8281 class WorkManagerPriority extends Enum<WorkManagerPriority> {
8282 /**
8283 * Used for a Dart source that is known to be a part contained in a library th at was recently
8284 * resolved. These parts are given a higher priority because there is a high p robability that
8285 * their AST structure is still in the cache and therefore would not need to b e re-created.
8286 */
8287 static final WorkManagerPriority PRIORITY_PART = new WorkManagerPriority('PRIO RITY_PART', 0);
8288
8289 /**
8290 * Used for a Dart source that is known to be a library.
8291 */
8292 static final WorkManagerPriority LIBRARY = new WorkManagerPriority('LIBRARY', 1);
8293
8294 /**
8295 * Used for a Dart source that is known to be a part but whose library has not yet been
8296 * resolved.
8297 */
8298 static final WorkManagerPriority NORMAL_PART = new WorkManagerPriority('NORMAL _PART', 2);
8299
8300 /**
8301 * Used for a Dart source whose kind is unknown.
8302 */
8303 static final WorkManagerPriority UNKNOWN = new WorkManagerPriority('UNKNOWN', 3);
8304
8305 /**
8306 * Used for an HTML source.
8307 */
8308 static final WorkManagerPriority HTML = new WorkManagerPriority('HTML', 4);
8309
8310 static final List<WorkManagerPriority> values = [PRIORITY_PART, LIBRARY, NORMA L_PART, UNKNOWN, HTML];
8311
8312 WorkManagerPriority(String name, int ordinal) : super(name, ordinal);
8313 }
8314
8315 /**
8316 * An [Expression] with optional [AngularFilterNode]s. 8316 * An [Expression] with optional [AngularFilterNode]s.
8317 * 8317 *
8318 * @coverage dart.engine.ast 8318 * @coverage dart.engine.ast
8319 */ 8319 */
8320 class AngularExpression { 8320 class AngularExpression {
8321 /** 8321 /**
8322 * The [Expression] to apply filters to. 8322 * The [Expression] to apply filters to.
8323 */ 8323 */
8324 final Expression expression; 8324 final Expression expression;
8325 8325
(...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after
9899 9899
9900 void internalPerform() { 9900 void internalPerform() {
9901 if (cache == null) { 9901 if (cache == null) {
9902 return; 9902 return;
9903 } 9903 }
9904 // Only handle small changes 9904 // Only handle small changes
9905 if (cache.oldLength > 0 || cache.newLength > 30) { 9905 if (cache.oldLength > 0 || cache.newLength > 30) {
9906 return; 9906 return;
9907 } 9907 }
9908 // Produce an updated token stream 9908 // Produce an updated token stream
9909 CharacterReader reader = new CharSequenceReader(new CharSequence(cache.newCo ntents)); 9909 CharacterReader reader = new CharSequenceReader(cache.newContents);
9910 BooleanErrorListener errorListener = new BooleanErrorListener(); 9910 BooleanErrorListener errorListener = new BooleanErrorListener();
9911 IncrementalScanner scanner = new IncrementalScanner(cache.source, reader, er rorListener); 9911 IncrementalScanner scanner = new IncrementalScanner(cache.source, reader, er rorListener);
9912 scanner.rescan(cache.resolvedUnit.beginToken, cache.offset, cache.oldLength, cache.newLength); 9912 scanner.rescan(cache.resolvedUnit.beginToken, cache.offset, cache.oldLength, cache.newLength);
9913 if (errorListener.errorReported) { 9913 if (errorListener.errorReported) {
9914 return; 9914 return;
9915 } 9915 }
9916 // Produce an updated AST 9916 // Produce an updated AST
9917 IncrementalParser parser = new IncrementalParser(cache.source, scanner.token Map, AnalysisErrorListener.NULL_LISTENER); 9917 IncrementalParser parser = new IncrementalParser(cache.source, scanner.token Map, AnalysisErrorListener.NULL_LISTENER);
9918 _updatedUnit = parser.reparse(cache.resolvedUnit, scanner.leftToken, scanner .rightToken, cache.offset, cache.offset + cache.oldLength); 9918 _updatedUnit = parser.reparse(cache.resolvedUnit, scanner.leftToken, scanner .rightToken, cache.offset, cache.offset + cache.oldLength);
9919 // Update the resolution 9919 // Update the resolution
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
10089 10089
10090 class Source_ContentReceiver_ParseDartTask_internalPerform implements Source_Con tentReceiver { 10090 class Source_ContentReceiver_ParseDartTask_internalPerform implements Source_Con tentReceiver {
10091 final ParseDartTask ParseDartTask_this; 10091 final ParseDartTask ParseDartTask_this;
10092 10092
10093 RecordingErrorListener errorListener; 10093 RecordingErrorListener errorListener;
10094 10094
10095 List<Token> token; 10095 List<Token> token;
10096 10096
10097 Source_ContentReceiver_ParseDartTask_internalPerform(this.ParseDartTask_this, this.errorListener, this.token); 10097 Source_ContentReceiver_ParseDartTask_internalPerform(this.ParseDartTask_this, this.errorListener, this.token);
10098 10098
10099 void accept(CharSequence contents, int modificationTime) { 10099 void accept(String contents, int modificationTime) {
10100 ParseDartTask_this._modificationTime = modificationTime; 10100 ParseDartTask_this._modificationTime = modificationTime;
10101 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s tart(); 10101 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s tart();
10102 try { 10102 try {
10103 Scanner scanner = new Scanner(ParseDartTask_this.source, new CharSequenceR eader(contents), errorListener); 10103 Scanner scanner = new Scanner(ParseDartTask_this.source, new CharSequenceR eader(contents), errorListener);
10104 scanner.preserveComments = ParseDartTask_this.context.analysisOptions.pres erveComments; 10104 scanner.preserveComments = ParseDartTask_this.context.analysisOptions.pres erveComments;
10105 token[0] = scanner.tokenize(); 10105 token[0] = scanner.tokenize();
10106 ParseDartTask_this._lineInfo = new LineInfo(scanner.lineStarts); 10106 ParseDartTask_this._lineInfo = new LineInfo(scanner.lineStarts);
10107 } finally { 10107 } finally {
10108 timeCounterScan.stop(); 10108 timeCounterScan.stop();
10109 } 10109 }
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
10964 10964
10965 void logError2(String message, Exception exception) { 10965 void logError2(String message, Exception exception) {
10966 } 10966 }
10967 10967
10968 void logInformation(String message) { 10968 void logInformation(String message) {
10969 } 10969 }
10970 10970
10971 void logInformation3(String message, Exception exception) { 10971 void logInformation3(String message, Exception exception) {
10972 } 10972 }
10973 } 10973 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698