| 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:collection'; | 10 import 'dart:collection'; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 * needed analysis and get notified of the consequent changes to the analysis re
sults. This | 244 * needed analysis and get notified of the consequent changes to the analysis re
sults. This |
| 245 * mechanism is realized by the method [performAnalysisTask]. | 245 * mechanism is realized by the method [performAnalysisTask]. |
| 246 * | 246 * |
| 247 * Analysis engine allows for having more than one context. This can be used, fo
r example, to | 247 * Analysis engine allows for having more than one context. This can be used, fo
r example, to |
| 248 * perform one analysis based on the state of files on disk and a separate analy
sis based on the | 248 * perform one analysis based on the state of files on disk and a separate analy
sis based on the |
| 249 * state of those files in open editors. It can also be used to perform an analy
sis based on a | 249 * state of those files in open editors. It can also be used to perform an analy
sis based on a |
| 250 * proposed future state, such as the state after a refactoring. | 250 * proposed future state, such as the state after a refactoring. |
| 251 */ | 251 */ |
| 252 abstract class AnalysisContext { | 252 abstract class AnalysisContext { |
| 253 /** | 253 /** |
| 254 * Add the given listener to the list of objects that are to be notified when
various analysis |
| 255 * results are produced in this context. |
| 256 * |
| 257 * @param listener the listener to be added |
| 258 */ |
| 259 void addListener(AnalysisListener listener); |
| 260 |
| 261 /** |
| 254 * Apply the given delta to change the level of analysis that will be performe
d for the sources | 262 * Apply the given delta to change the level of analysis that will be performe
d for the sources |
| 255 * known to this context. | 263 * known to this context. |
| 256 * | 264 * |
| 257 * @param delta a description of the level of analysis that should be performe
d for some sources | 265 * @param delta a description of the level of analysis that should be performe
d for some sources |
| 258 */ | 266 */ |
| 259 void applyAnalysisDelta(AnalysisDelta delta); | 267 void applyAnalysisDelta(AnalysisDelta delta); |
| 260 | 268 |
| 261 /** | 269 /** |
| 262 * Apply the changes specified by the given change set to this context. Any an
alysis results that | 270 * Apply the changes specified by the given change set to this context. Any an
alysis results that |
| 263 * have been invalidated by these changes will be removed. | 271 * have been invalidated by these changes will be removed. |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 /** | 727 /** |
| 720 * Perform the next unit of work required to keep the analysis results up-to-d
ate and return | 728 * Perform the next unit of work required to keep the analysis results up-to-d
ate and return |
| 721 * information about the consequent changes to the analysis results. This meth
od can be long | 729 * information about the consequent changes to the analysis results. This meth
od can be long |
| 722 * running. | 730 * running. |
| 723 * | 731 * |
| 724 * @return the results of performing the analysis | 732 * @return the results of performing the analysis |
| 725 */ | 733 */ |
| 726 AnalysisResult performAnalysisTask(); | 734 AnalysisResult performAnalysisTask(); |
| 727 | 735 |
| 728 /** | 736 /** |
| 737 * Remove the given listener from the list of objects that are to be notified
when various |
| 738 * analysis results are produced in this context. |
| 739 * |
| 740 * @param listener the listener to be removed |
| 741 */ |
| 742 void removeListener(AnalysisListener listener); |
| 743 |
| 744 /** |
| 729 * Parse and resolve a single source within the given context to produce a ful
ly resolved AST. | 745 * Parse and resolve a single source within the given context to produce a ful
ly resolved AST. |
| 730 * | 746 * |
| 731 * <b>Note:</b> This method cannot be used in an async environment. | 747 * <b>Note:</b> This method cannot be used in an async environment. |
| 732 * | 748 * |
| 733 * @param unitSource the source to be parsed and resolved | 749 * @param unitSource the source to be parsed and resolved |
| 734 * @param library the library containing the source to be resolved | 750 * @param library the library containing the source to be resolved |
| 735 * @return the result of resolving the AST structure representing the content
of the source in the | 751 * @return the result of resolving the AST structure representing the content
of the source in the |
| 736 * context of the given library | 752 * context of the given library |
| 737 * @throws AnalysisException if the analysis could not be performed | 753 * @throws AnalysisException if the analysis could not be performed |
| 738 * @see #getResolvedCompilationUnit(Source, LibraryElement) | 754 * @see #getResolvedCompilationUnit(Source, LibraryElement) |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 * The object used to manage the list of sources that need to be analyzed. | 950 * The object used to manage the list of sources that need to be analyzed. |
| 935 */ | 951 */ |
| 936 WorkManager _workManager = new WorkManager(); | 952 WorkManager _workManager = new WorkManager(); |
| 937 | 953 |
| 938 /** | 954 /** |
| 939 * The set of [AngularApplication] in this context. | 955 * The set of [AngularApplication] in this context. |
| 940 */ | 956 */ |
| 941 Set<AngularApplication> _angularApplications = new Set(); | 957 Set<AngularApplication> _angularApplications = new Set(); |
| 942 | 958 |
| 943 /** | 959 /** |
| 960 * The listeners that are to be notified when various analysis results are pro
duced in this |
| 961 * context. |
| 962 */ |
| 963 List<AnalysisListener> _listeners = new List<AnalysisListener>(); |
| 964 |
| 965 /** |
| 944 * Initialize a newly created analysis context. | 966 * Initialize a newly created analysis context. |
| 945 */ | 967 */ |
| 946 AnalysisContextImpl() : super() { | 968 AnalysisContextImpl() : super() { |
| 947 _resultRecorder = new AnalysisContextImpl_AnalysisTaskResultRecorder(this); | 969 _resultRecorder = new AnalysisContextImpl_AnalysisTaskResultRecorder(this); |
| 948 _privatePartition = new UniversalCachePartition(AnalysisOptionsImpl.DEFAULT_
CACHE_SIZE, new AnalysisContextImpl_ContextRetentionPolicy(this)); | 970 _privatePartition = new UniversalCachePartition(AnalysisOptionsImpl.DEFAULT_
CACHE_SIZE, new AnalysisContextImpl_ContextRetentionPolicy(this)); |
| 949 _cache = createCacheFromSourceFactory(null); | 971 _cache = createCacheFromSourceFactory(null); |
| 950 } | 972 } |
| 951 | 973 |
| 952 @override | 974 @override |
| 975 void addListener(AnalysisListener listener) { |
| 976 if (!_listeners.contains(listener)) { |
| 977 _listeners.add(listener); |
| 978 } |
| 979 } |
| 980 |
| 981 @override |
| 953 void addSourceInfo(Source source, SourceEntry info) { | 982 void addSourceInfo(Source source, SourceEntry info) { |
| 954 // This implementation assumes that the access to the cache does not need to
be synchronized | 983 // This implementation assumes that the access to the cache does not need to
be synchronized |
| 955 // because no other object can have access to this context while this method
is being invoked. | 984 // because no other object can have access to this context while this method
is being invoked. |
| 956 _cache.put(source, info); | 985 _cache.put(source, info); |
| 957 } | 986 } |
| 958 | 987 |
| 959 @override | 988 @override |
| 960 void applyAnalysisDelta(AnalysisDelta delta) { | 989 void applyAnalysisDelta(AnalysisDelta delta) { |
| 961 ChangeSet changeSet = new ChangeSet(); | 990 ChangeSet changeSet = new ChangeSet(); |
| 962 for (MapEntry<Source, AnalysisLevel> entry in getMapEntrySet(delta.analysisL
evels)) { | 991 for (MapEntry<Source, AnalysisLevel> entry in getMapEntrySet(delta.analysisL
evels)) { |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 } | 1723 } |
| 1695 int getStart = JavaSystem.currentTimeMillis(); | 1724 int getStart = JavaSystem.currentTimeMillis(); |
| 1696 AnalysisTask task = nextAnalysisTask; | 1725 AnalysisTask task = nextAnalysisTask; |
| 1697 int getEnd = JavaSystem.currentTimeMillis(); | 1726 int getEnd = JavaSystem.currentTimeMillis(); |
| 1698 if (task == null && _validateCacheConsistency()) { | 1727 if (task == null && _validateCacheConsistency()) { |
| 1699 task = nextAnalysisTask; | 1728 task = nextAnalysisTask; |
| 1700 } | 1729 } |
| 1701 if (task == null) { | 1730 if (task == null) { |
| 1702 return new AnalysisResult(_getChangeNotices(true), getEnd - getStart, null
, -1); | 1731 return new AnalysisResult(_getChangeNotices(true), getEnd - getStart, null
, -1); |
| 1703 } | 1732 } |
| 1704 String taskDescriptor = task.toString(); | 1733 String taskDescription = task.toString(); |
| 1705 // if (recentTasks.add(taskDescriptor)) { | 1734 // if (recentTasks.add(taskDescription)) { |
| 1706 // logInformation("Performing task: " + taskDescriptor); | 1735 // logInformation("Performing task: " + taskDescription); |
| 1707 // } else { | 1736 // } else { |
| 1708 // if (TRACE_PERFORM_TASK) { | 1737 // if (TRACE_PERFORM_TASK) { |
| 1709 // System.out.print("* "); | 1738 // System.out.print("* "); |
| 1710 // } | 1739 // } |
| 1711 // logInformation("*** Performing repeated task: " + taskDescriptor); | 1740 // logInformation("*** Performing repeated task: " + taskDescription); |
| 1712 // } | 1741 // } |
| 1742 _notifyAboutToPerformTask(taskDescription); |
| 1713 if (_TRACE_PERFORM_TASK) { | 1743 if (_TRACE_PERFORM_TASK) { |
| 1714 print(taskDescriptor); | 1744 print(taskDescription); |
| 1715 } | 1745 } |
| 1716 int performStart = JavaSystem.currentTimeMillis(); | 1746 int performStart = JavaSystem.currentTimeMillis(); |
| 1717 try { | 1747 try { |
| 1718 task.perform(_resultRecorder); | 1748 task.perform(_resultRecorder); |
| 1719 } on ObsoleteSourceAnalysisException catch (exception) { | 1749 } on ObsoleteSourceAnalysisException catch (exception) { |
| 1720 AnalysisEngine.instance.logger.logInformation2("Could not perform analysis
task: ${taskDescriptor}", exception); | 1750 AnalysisEngine.instance.logger.logInformation2("Could not perform analysis
task: ${taskDescription}", exception); |
| 1721 } on AnalysisException catch (exception) { | 1751 } on AnalysisException catch (exception) { |
| 1722 if (exception.cause is! JavaIOException) { | 1752 if (exception.cause is! JavaIOException) { |
| 1723 AnalysisEngine.instance.logger.logError2("Internal error while performin
g the task: ${task}", exception); | 1753 AnalysisEngine.instance.logger.logError2("Internal error while performin
g the task: ${task}", exception); |
| 1724 } | 1754 } |
| 1725 } | 1755 } |
| 1726 int performEnd = JavaSystem.currentTimeMillis(); | 1756 int performEnd = JavaSystem.currentTimeMillis(); |
| 1727 return new AnalysisResult(_getChangeNotices(false), getEnd - getStart, task.
runtimeType.toString(), performEnd - performStart); | 1757 List<ChangeNotice> notices = _getChangeNotices(false); |
| 1758 int noticeCount = notices.length; |
| 1759 for (int i = 0; i < noticeCount; i++) { |
| 1760 ChangeNotice notice = notices[i]; |
| 1761 Source source = notice.source; |
| 1762 // TODO(brianwilkerson) Figure out whether the compilation unit is always
resolved, or whether |
| 1763 // we need to decide whether to invoke the "parsed" or "resolved" method.
This might be better |
| 1764 // done when recording task results in order to reduce the chance of error
s. |
| 1765 // if (notice.getCompilationUnit() != null) { |
| 1766 // notifyResolvedDart(source, notice.getCompilationUnit()); |
| 1767 // } else if (notice.getHtmlUnit() != null) { |
| 1768 // notifyResolvedHtml(source, notice.getHtmlUnit()); |
| 1769 // } |
| 1770 _notifyErrors(source, notice.errors, notice.lineInfo); |
| 1771 } |
| 1772 return new AnalysisResult(notices, getEnd - getStart, task.runtimeType.toStr
ing(), performEnd - performStart); |
| 1728 } | 1773 } |
| 1729 | 1774 |
| 1730 @override | 1775 @override |
| 1731 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { | 1776 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { |
| 1732 Source htmlSource = _sourceFactory.forUri(DartSdk.DART_HTML); | 1777 Source htmlSource = _sourceFactory.forUri(DartSdk.DART_HTML); |
| 1733 for (MapEntry<Source, LibraryElement> entry in getMapEntrySet(elementMap)) { | 1778 for (MapEntry<Source, LibraryElement> entry in getMapEntrySet(elementMap)) { |
| 1734 Source librarySource = entry.getKey(); | 1779 Source librarySource = entry.getKey(); |
| 1735 LibraryElement library = entry.getValue(); | 1780 LibraryElement library = entry.getValue(); |
| 1736 // | 1781 // |
| 1737 // Cache the element in the library's info. | 1782 // Cache the element in the library's info. |
| 1738 // | 1783 // |
| 1739 DartEntry dartEntry = _getReadableDartEntry(librarySource); | 1784 DartEntry dartEntry = _getReadableDartEntry(librarySource); |
| 1740 if (dartEntry != null) { | 1785 if (dartEntry != null) { |
| 1741 DartEntryImpl dartCopy = dartEntry.writableCopy; | 1786 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 1742 _recordElementData(dartCopy, library, library.source, htmlSource); | 1787 _recordElementData(dartCopy, library, library.source, htmlSource); |
| 1743 dartCopy.setValue(DartEntry.SCAN_ERRORS, AnalysisError.NO_ERRORS); | 1788 dartCopy.setValue(DartEntry.SCAN_ERRORS, AnalysisError.NO_ERRORS); |
| 1744 dartCopy.setValue(DartEntry.PARSE_ERRORS, AnalysisError.NO_ERRORS); | 1789 dartCopy.setValue(DartEntry.PARSE_ERRORS, AnalysisError.NO_ERRORS); |
| 1745 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); | 1790 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); |
| 1746 dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySource, A
nalysisError.NO_ERRORS); | 1791 dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySource, A
nalysisError.NO_ERRORS); |
| 1747 dartCopy.setStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource, Cache
State.FLUSHED); | 1792 dartCopy.setStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource, Cache
State.FLUSHED); |
| 1748 dartCopy.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource,
AnalysisError.NO_ERRORS); | 1793 dartCopy.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource,
AnalysisError.NO_ERRORS); |
| 1749 dartCopy.setValue(DartEntry.ANGULAR_ERRORS, AnalysisError.NO_ERRORS); | 1794 dartCopy.setValue(DartEntry.ANGULAR_ERRORS, AnalysisError.NO_ERRORS); |
| 1750 dartCopy.setValueInLibrary(DartEntry.HINTS, librarySource, AnalysisError
.NO_ERRORS); | 1795 dartCopy.setValueInLibrary(DartEntry.HINTS, librarySource, AnalysisError
.NO_ERRORS); |
| 1751 _cache.put(librarySource, dartCopy); | 1796 _cache.put(librarySource, dartCopy); |
| 1752 } | 1797 } |
| 1753 } | 1798 } |
| 1754 } | 1799 } |
| 1755 | 1800 |
| 1756 @override | 1801 @override |
| 1802 void removeListener(AnalysisListener listener) { |
| 1803 _listeners.remove(listener); |
| 1804 } |
| 1805 |
| 1806 @override |
| 1757 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { | 1807 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { |
| 1758 if (library == null) { | 1808 if (library == null) { |
| 1759 return null; | 1809 return null; |
| 1760 } | 1810 } |
| 1761 return resolveCompilationUnit2(unitSource, library.source); | 1811 return resolveCompilationUnit2(unitSource, library.source); |
| 1762 } | 1812 } |
| 1763 | 1813 |
| 1764 @override | 1814 @override |
| 1765 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) => _getDartResolutionData2(unitSource, librarySource, DartEntry.RESOLVED_UNIT
, null); | 1815 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) => _getDartResolutionData2(unitSource, librarySource, DartEntry.RESOLVED_UNIT
, null); |
| 1766 | 1816 |
| (...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3825 */ | 3875 */ |
| 3826 void _logInformation2(String message, Exception exception) { | 3876 void _logInformation2(String message, Exception exception) { |
| 3827 if (exception == null) { | 3877 if (exception == null) { |
| 3828 AnalysisEngine.instance.logger.logInformation(message); | 3878 AnalysisEngine.instance.logger.logInformation(message); |
| 3829 } else { | 3879 } else { |
| 3830 AnalysisEngine.instance.logger.logInformation2(message, exception); | 3880 AnalysisEngine.instance.logger.logInformation2(message, exception); |
| 3831 } | 3881 } |
| 3832 } | 3882 } |
| 3833 | 3883 |
| 3834 /** | 3884 /** |
| 3885 * Notify all of the analysis listeners that a task is about to be performed. |
| 3886 * |
| 3887 * @param taskDescription a human readable description of the task that is abo
ut to be performed |
| 3888 */ |
| 3889 void _notifyAboutToPerformTask(String taskDescription) { |
| 3890 int count = _listeners.length; |
| 3891 for (int i = 0; i < count; i++) { |
| 3892 _listeners[i].aboutToPerformTask(this, taskDescription); |
| 3893 } |
| 3894 } |
| 3895 |
| 3896 /** |
| 3897 * Notify all of the analysis listeners that the errors associated with the gi
ven source has been |
| 3898 * updated to the given errors. |
| 3899 * |
| 3900 * @param source the source containing the errors that were computed |
| 3901 * @param errors the errors that were computed |
| 3902 * @param lineInfo the line information associated with the source |
| 3903 */ |
| 3904 void _notifyErrors(Source source, List<AnalysisError> errors, LineInfo lineInf
o) { |
| 3905 int count = _listeners.length; |
| 3906 for (int i = 0; i < count; i++) { |
| 3907 _listeners[i].computedErrors(this, source, errors, lineInfo); |
| 3908 } |
| 3909 } |
| 3910 |
| 3911 /** |
| 3912 * Notify all of the analysis listeners that the given source is no longer inc
luded in the set of |
| 3913 * sources that are being analyzed. |
| 3914 * |
| 3915 * @param source the source that is no longer being analyzed |
| 3916 */ |
| 3917 void _notifyExcludedSource(Source source) { |
| 3918 int count = _listeners.length; |
| 3919 for (int i = 0; i < count; i++) { |
| 3920 _listeners[i].excludedSource(this, source); |
| 3921 } |
| 3922 } |
| 3923 |
| 3924 /** |
| 3925 * Notify all of the analysis listeners that the given source is now included
in the set of |
| 3926 * sources that are being analyzed. |
| 3927 * |
| 3928 * @param source the source that is now being analyzed |
| 3929 */ |
| 3930 void _notifyIncludedSource(Source source) { |
| 3931 int count = _listeners.length; |
| 3932 for (int i = 0; i < count; i++) { |
| 3933 _listeners[i].includedSource(this, source); |
| 3934 } |
| 3935 } |
| 3936 |
| 3937 /** |
| 3938 * Notify all of the analysis listeners that the given Dart source was parsed. |
| 3939 * |
| 3940 * @param source the source that was parsed |
| 3941 * @param unit the result of parsing the source |
| 3942 */ |
| 3943 void _notifyParsedDart(Source source, CompilationUnit unit) { |
| 3944 int count = _listeners.length; |
| 3945 for (int i = 0; i < count; i++) { |
| 3946 _listeners[i].parsedDart(this, source, unit); |
| 3947 } |
| 3948 } |
| 3949 |
| 3950 /** |
| 3951 * Notify all of the analysis listeners that the given HTML source was parsed. |
| 3952 * |
| 3953 * @param source the source that was parsed |
| 3954 * @param unit the result of parsing the source |
| 3955 */ |
| 3956 void _notifyParsedHtml(Source source, ht.HtmlUnit unit) { |
| 3957 int count = _listeners.length; |
| 3958 for (int i = 0; i < count; i++) { |
| 3959 _listeners[i].parsedHtml(this, source, unit); |
| 3960 } |
| 3961 } |
| 3962 |
| 3963 /** |
| 3964 * Notify all of the analysis listeners that the given Dart source was resolve
d. |
| 3965 * |
| 3966 * @param source the source that was resolved |
| 3967 * @param unit the result of resolving the source |
| 3968 */ |
| 3969 void _notifyResolvedDart(Source source, CompilationUnit unit) { |
| 3970 int count = _listeners.length; |
| 3971 for (int i = 0; i < count; i++) { |
| 3972 _listeners[i].resolvedDart(this, source, unit); |
| 3973 } |
| 3974 } |
| 3975 |
| 3976 /** |
| 3977 * Notify all of the analysis listeners that the given HTML source was resolve
d. |
| 3978 * |
| 3979 * @param source the source that was resolved |
| 3980 * @param unit the result of resolving the source |
| 3981 */ |
| 3982 void _notifyResolvedHtml(Source source, ht.HtmlUnit unit) { |
| 3983 int count = _listeners.length; |
| 3984 for (int i = 0; i < count; i++) { |
| 3985 _listeners[i].resolvedHtml(this, source, unit); |
| 3986 } |
| 3987 } |
| 3988 |
| 3989 /** |
| 3835 * Updates [HtmlEntry]s that correspond to the previously known and new Angula
r application | 3990 * Updates [HtmlEntry]s that correspond to the previously known and new Angula
r application |
| 3836 * information. | 3991 * information. |
| 3837 */ | 3992 */ |
| 3838 void _recordAngularEntryPoint(HtmlEntryImpl entry, ResolveAngularEntryHtmlTask
task) { | 3993 void _recordAngularEntryPoint(HtmlEntryImpl entry, ResolveAngularEntryHtmlTask
task) { |
| 3839 AngularApplication application = task.application; | 3994 AngularApplication application = task.application; |
| 3840 if (application != null) { | 3995 if (application != null) { |
| 3841 _angularApplications.add(application); | 3996 _angularApplications.add(application); |
| 3842 // if this is an entry point, then we already resolved it | 3997 // if this is an entry point, then we already resolved it |
| 3843 entry.setValue(HtmlEntry.ANGULAR_ERRORS, task.entryErrors); | 3998 entry.setValue(HtmlEntry.ANGULAR_ERRORS, task.entryErrors); |
| 3844 // schedule HTML templates analysis | 3999 // schedule HTML templates analysis |
| (...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6164 * Indicates a source is not of interest to the client. | 6319 * Indicates a source is not of interest to the client. |
| 6165 */ | 6320 */ |
| 6166 static const AnalysisLevel NONE = const AnalysisLevel('NONE', 3); | 6321 static const AnalysisLevel NONE = const AnalysisLevel('NONE', 3); |
| 6167 | 6322 |
| 6168 static const List<AnalysisLevel> values = const [ALL, ERRORS, RESOLVED, NONE]; | 6323 static const List<AnalysisLevel> values = const [ALL, ERRORS, RESOLVED, NONE]; |
| 6169 | 6324 |
| 6170 const AnalysisLevel(String name, int ordinal) : super(name, ordinal); | 6325 const AnalysisLevel(String name, int ordinal) : super(name, ordinal); |
| 6171 } | 6326 } |
| 6172 | 6327 |
| 6173 /** | 6328 /** |
| 6329 * The interface `AnalysisListener` defines the behavior of objects that are lis
tening for |
| 6330 * results being produced by an analysis context. |
| 6331 */ |
| 6332 abstract class AnalysisListener { |
| 6333 /** |
| 6334 * Reports that a task is about to be performed by the given context. |
| 6335 * |
| 6336 * @param context the context in which the task is to be performed |
| 6337 * @param taskDescription a human readable description of the task that is abo
ut to be performed |
| 6338 */ |
| 6339 void aboutToPerformTask(AnalysisContext context, String taskDescription); |
| 6340 |
| 6341 /** |
| 6342 * Reports that the errors associated with the given source in the given conte
xt has been updated |
| 6343 * to the given errors. |
| 6344 * |
| 6345 * @param context the context in which the new list of errors was produced |
| 6346 * @param source the source containing the errors that were computed |
| 6347 * @param errors the errors that were computed |
| 6348 * @param lineInfo the line information associated with the source |
| 6349 */ |
| 6350 void computedErrors(AnalysisContext context, Source source, List<AnalysisError
> errors, LineInfo lineInfo); |
| 6351 |
| 6352 /** |
| 6353 * Reports that the given source is no longer included in the set of sources t
hat are being |
| 6354 * analyzed by the given analysis context. |
| 6355 * |
| 6356 * @param context the context in which the source is being analyzed |
| 6357 * @param source the source that is no longer being analyzed |
| 6358 */ |
| 6359 void excludedSource(AnalysisContext context, Source source); |
| 6360 |
| 6361 /** |
| 6362 * Reports that the given source is now included in the set of sources that ar
e being analyzed by |
| 6363 * the given analysis context. |
| 6364 * |
| 6365 * @param context the context in which the source is being analyzed |
| 6366 * @param source the source that is now being analyzed |
| 6367 */ |
| 6368 void includedSource(AnalysisContext context, Source source); |
| 6369 |
| 6370 /** |
| 6371 * Reports that the given Dart source was parsed in the given context. |
| 6372 * |
| 6373 * @param context the context in which the source was parsed |
| 6374 * @param source the source that was parsed |
| 6375 * @param unit the result of parsing the source in the given context |
| 6376 */ |
| 6377 void parsedDart(AnalysisContext context, Source source, CompilationUnit unit); |
| 6378 |
| 6379 /** |
| 6380 * Reports that the given HTML source was parsed in the given context. |
| 6381 * |
| 6382 * @param context the context in which the source was parsed |
| 6383 * @param source the source that was parsed |
| 6384 * @param unit the result of parsing the source in the given context |
| 6385 */ |
| 6386 void parsedHtml(AnalysisContext context, Source source, ht.HtmlUnit unit); |
| 6387 |
| 6388 /** |
| 6389 * Reports that the given Dart source was resolved in the given context. |
| 6390 * |
| 6391 * @param context the context in which the source was resolved |
| 6392 * @param source the source that was resolved |
| 6393 * @param unit the result of resolving the source in the given context |
| 6394 */ |
| 6395 void resolvedDart(AnalysisContext context, Source source, CompilationUnit unit
); |
| 6396 |
| 6397 /** |
| 6398 * Reports that the given HTML source was resolved in the given context. |
| 6399 * |
| 6400 * @param context the context in which the source was resolved |
| 6401 * @param source the source that was resolved |
| 6402 * @param unit the result of resolving the source in the given context |
| 6403 */ |
| 6404 void resolvedHtml(AnalysisContext context, Source source, ht.HtmlUnit unit); |
| 6405 } |
| 6406 |
| 6407 /** |
| 6174 * The interface `AnalysisOptions` defines the behavior of objects that provide
access to a | 6408 * The interface `AnalysisOptions` defines the behavior of objects that provide
access to a |
| 6175 * set of analysis options used to control the behavior of an analysis context. | 6409 * set of analysis options used to control the behavior of an analysis context. |
| 6176 */ | 6410 */ |
| 6177 abstract class AnalysisOptions { | 6411 abstract class AnalysisOptions { |
| 6178 /** | 6412 /** |
| 6179 * Return `true` if analysis is to analyze Angular. | 6413 * Return `true` if analysis is to analyze Angular. |
| 6180 * | 6414 * |
| 6181 * @return `true` if analysis is to analyze Angular | 6415 * @return `true` if analysis is to analyze Angular |
| 6182 */ | 6416 */ |
| 6183 bool get analyzeAngular; | 6417 bool get analyzeAngular; |
| (...skipping 5157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11341 * Create a new [InstrumentedAnalysisContextImpl] with a specified basis conte
xt, aka the | 11575 * Create a new [InstrumentedAnalysisContextImpl] with a specified basis conte
xt, aka the |
| 11342 * context to wrap and instrument. | 11576 * context to wrap and instrument. |
| 11343 * | 11577 * |
| 11344 * @param context some [InstrumentedAnalysisContext] to wrap and instrument | 11578 * @param context some [InstrumentedAnalysisContext] to wrap and instrument |
| 11345 */ | 11579 */ |
| 11346 InstrumentedAnalysisContextImpl.con1(InternalAnalysisContext context) { | 11580 InstrumentedAnalysisContextImpl.con1(InternalAnalysisContext context) { |
| 11347 _basis = context; | 11581 _basis = context; |
| 11348 } | 11582 } |
| 11349 | 11583 |
| 11350 @override | 11584 @override |
| 11585 void addListener(AnalysisListener listener) { |
| 11586 _basis.addListener(listener); |
| 11587 } |
| 11588 |
| 11589 @override |
| 11351 void addSourceInfo(Source source, SourceEntry info) { | 11590 void addSourceInfo(Source source, SourceEntry info) { |
| 11352 _basis.addSourceInfo(source, info); | 11591 _basis.addSourceInfo(source, info); |
| 11353 } | 11592 } |
| 11354 | 11593 |
| 11355 @override | 11594 @override |
| 11356 void applyAnalysisDelta(AnalysisDelta delta) { | 11595 void applyAnalysisDelta(AnalysisDelta delta) { |
| 11357 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
updateAnalysis"); | 11596 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
updateAnalysis"); |
| 11358 _checkThread(instrumentation); | 11597 _checkThread(instrumentation); |
| 11359 try { | 11598 try { |
| 11360 instrumentation.metric3("contextId", _contextId); | 11599 instrumentation.metric3("contextId", _contextId); |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11944 instrumentation.log2(2); | 12183 instrumentation.log2(2); |
| 11945 } | 12184 } |
| 11946 } | 12185 } |
| 11947 | 12186 |
| 11948 @override | 12187 @override |
| 11949 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { | 12188 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { |
| 11950 _basis.recordLibraryElements(elementMap); | 12189 _basis.recordLibraryElements(elementMap); |
| 11951 } | 12190 } |
| 11952 | 12191 |
| 11953 @override | 12192 @override |
| 12193 void removeListener(AnalysisListener listener) { |
| 12194 _basis.removeListener(listener); |
| 12195 } |
| 12196 |
| 12197 @override |
| 11954 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { | 12198 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { |
| 11955 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveCompilationUnit"); | 12199 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveCompilationUnit"); |
| 11956 _checkThread(instrumentation); | 12200 _checkThread(instrumentation); |
| 11957 try { | 12201 try { |
| 11958 instrumentation.metric3("contextId", _contextId); | 12202 instrumentation.metric3("contextId", _contextId); |
| 11959 return _basis.resolveCompilationUnit(unitSource, library); | 12203 return _basis.resolveCompilationUnit(unitSource, library); |
| 11960 } on AnalysisException catch (e, stackTrace) { | 12204 } on AnalysisException catch (e, stackTrace) { |
| 11961 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); | 12205 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); |
| 11962 throw e; | 12206 throw e; |
| 11963 } finally { | 12207 } finally { |
| (...skipping 3290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15254 _index++; | 15498 _index++; |
| 15255 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { | 15499 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { |
| 15256 _index = 0; | 15500 _index = 0; |
| 15257 _queueIndex++; | 15501 _queueIndex++; |
| 15258 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { | 15502 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { |
| 15259 _queueIndex++; | 15503 _queueIndex++; |
| 15260 } | 15504 } |
| 15261 } | 15505 } |
| 15262 } | 15506 } |
| 15263 } | 15507 } |
| OLD | NEW |