| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine; | 4 library engine; |
| 5 | 5 |
| 6 import 'java_core.dart'; | 6 import 'java_core.dart'; |
| 7 import 'java_engine.dart'; | 7 import 'java_engine.dart'; |
| 8 import 'dart:collection' show HasNextIterator; | 8 import 'dart:collection' show HasNextIterator; |
| 9 import 'error.dart'; | 9 import 'error.dart'; |
| 10 import 'source.dart'; | 10 import 'source.dart'; |
| 11 import 'scanner.dart' show Token, CharBufferScanner, StringScanner; | 11 import 'scanner.dart' show Token, CharBufferScanner, StringScanner; |
| 12 import 'ast.dart' show CompilationUnit, Directive, PartOfDirective; | 12 import 'ast.dart' show CompilationUnit, Directive, PartOfDirective; |
| 13 import 'parser.dart' show Parser; | 13 import 'parser.dart' show Parser; |
| 14 import 'element.dart'; | 14 import 'element.dart'; |
| 15 import 'resolver.dart' show Namespace, NamespaceBuilder, LibraryResolver; | 15 import 'resolver.dart' show Namespace, NamespaceBuilder, LibraryResolver; |
| 16 import 'html_scanner.dart' show HtmlScanner, HtmlScanResult, HtmlParser, HtmlPar
seResult; | 16 import 'html.dart' show HtmlScanner, HtmlScanResult, HtmlParser, HtmlParseResult
; |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * The unique instance of the class {@code AnalysisEngine} serves as the entry p
oint for the | 19 * The unique instance of the class {@code AnalysisEngine} serves as the entry p
oint for the |
| 20 * functionality provided by the analysis engine. | 20 * functionality provided by the analysis engine. |
| 21 * @coverage dart.engine |
| 21 */ | 22 */ |
| 22 class AnalysisEngine { | 23 class AnalysisEngine { |
| 23 /** | 24 /** |
| 24 * The suffix used for Dart source files. | 25 * The suffix used for Dart source files. |
| 25 */ | 26 */ |
| 26 static String SUFFIX_DART = "dart"; | 27 static String SUFFIX_DART = "dart"; |
| 27 /** | 28 /** |
| 28 * The short suffix used for HTML files. | 29 * The short suffix used for HTML files. |
| 29 */ | 30 */ |
| 30 static String SUFFIX_HTM = "htm"; | 31 static String SUFFIX_HTM = "htm"; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 /** | 276 /** |
| 276 * Given a collection of sources with content that has changed, return an {@li
nk Iterable}identifying the sources that need to be resolved. | 277 * Given a collection of sources with content that has changed, return an {@li
nk Iterable}identifying the sources that need to be resolved. |
| 277 * @param changedSources an array of sources (not {@code null}, contains no {@
code null}s) | 278 * @param changedSources an array of sources (not {@code null}, contains no {@
code null}s) |
| 278 * @return An iterable returning the sources to be resolved | 279 * @return An iterable returning the sources to be resolved |
| 279 */ | 280 */ |
| 280 Iterable<Source> sourcesToResolve(List<Source> changedSources); | 281 Iterable<Source> sourcesToResolve(List<Source> changedSources); |
| 281 } | 282 } |
| 282 /** | 283 /** |
| 283 * Instances of the class {@code AnalysisException} represent an exception that
occurred during the | 284 * Instances of the class {@code AnalysisException} represent an exception that
occurred during the |
| 284 * analysis of one or more sources. | 285 * analysis of one or more sources. |
| 286 * @coverage dart.engine |
| 285 */ | 287 */ |
| 286 class AnalysisException extends JavaException { | 288 class AnalysisException extends JavaException { |
| 287 /** | 289 /** |
| 288 * Initialize a newly created exception. | 290 * Initialize a newly created exception. |
| 289 */ | 291 */ |
| 290 AnalysisException() : super() { | 292 AnalysisException() : super() { |
| 291 _jtd_constructor_119_impl(); | 293 _jtd_constructor_121_impl(); |
| 292 } | 294 } |
| 293 _jtd_constructor_119_impl() { | 295 _jtd_constructor_121_impl() { |
| 294 } | 296 } |
| 295 /** | 297 /** |
| 296 * Initialize a newly created exception to have the given message. | 298 * Initialize a newly created exception to have the given message. |
| 297 * @param message the message associated with the exception | 299 * @param message the message associated with the exception |
| 298 */ | 300 */ |
| 299 AnalysisException.con1(String message) : super(message) { | 301 AnalysisException.con1(String message) : super(message) { |
| 300 _jtd_constructor_120_impl(message); | 302 _jtd_constructor_122_impl(message); |
| 301 } | 303 } |
| 302 _jtd_constructor_120_impl(String message) { | 304 _jtd_constructor_122_impl(String message) { |
| 303 } | 305 } |
| 304 /** | 306 /** |
| 305 * Initialize a newly created exception to have the given message and cause. | 307 * Initialize a newly created exception to have the given message and cause. |
| 306 * @param message the message associated with the exception | 308 * @param message the message associated with the exception |
| 307 * @param cause the underlying exception that caused this exception | 309 * @param cause the underlying exception that caused this exception |
| 308 */ | 310 */ |
| 309 AnalysisException.con2(String message, Exception cause) : super(message, cause
) { | 311 AnalysisException.con2(String message, Exception cause) : super(message, cause
) { |
| 310 _jtd_constructor_121_impl(message, cause); | 312 _jtd_constructor_123_impl(message, cause); |
| 311 } | 313 } |
| 312 _jtd_constructor_121_impl(String message, Exception cause) { | 314 _jtd_constructor_123_impl(String message, Exception cause) { |
| 313 } | 315 } |
| 314 /** | 316 /** |
| 315 * Initialize a newly created exception to have the given cause. | 317 * Initialize a newly created exception to have the given cause. |
| 316 * @param cause the underlying exception that caused this exception | 318 * @param cause the underlying exception that caused this exception |
| 317 */ | 319 */ |
| 318 AnalysisException.con3(Exception cause) : super.withCause(cause) { | 320 AnalysisException.con3(Exception cause) : super.withCause(cause) { |
| 319 _jtd_constructor_122_impl(cause); | 321 _jtd_constructor_124_impl(cause); |
| 320 } | 322 } |
| 321 _jtd_constructor_122_impl(Exception cause) { | 323 _jtd_constructor_124_impl(Exception cause) { |
| 322 } | 324 } |
| 323 } | 325 } |
| 324 /** | 326 /** |
| 325 * Instances of {@code ChangeResult} are returned by {@link AnalysisContext#chan
ged(ChangeSet)} to | 327 * Instances of {@code ChangeResult} are returned by {@link AnalysisContext#chan
ged(ChangeSet)} to |
| 326 * indicate what operations need to be performed as a result of the change. | 328 * indicate what operations need to be performed as a result of the change. |
| 329 * @coverage dart.engine |
| 327 */ | 330 */ |
| 328 class ChangeResult { | 331 class ChangeResult { |
| 329 } | 332 } |
| 330 /** | 333 /** |
| 331 * Instances of the class {@code ChangeSet} indicate what sources have been adde
d, changed, or | 334 * Instances of the class {@code ChangeSet} indicate what sources have been adde
d, changed, or |
| 332 * removed. | 335 * removed. |
| 336 * @coverage dart.engine |
| 333 */ | 337 */ |
| 334 class ChangeSet { | 338 class ChangeSet { |
| 335 /** | 339 /** |
| 336 * A table mapping the sources that have been added to their contents. | 340 * A table mapping the sources that have been added to their contents. |
| 337 */ | 341 */ |
| 338 Map<Source, String> _added3 = new Map<Source, String>(); | 342 Map<Source, String> _added3 = new Map<Source, String>(); |
| 339 /** | 343 /** |
| 340 * A table mapping the sources that have been changed to their contents. | 344 * A table mapping the sources that have been changed to their contents. |
| 341 */ | 345 */ |
| 342 Map<Source, String> _changed3 = new Map<Source, String>(); | 346 Map<Source, String> _changed3 = new Map<Source, String>(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 */ | 439 */ |
| 436 void removedContainer(SourceContainer container) { | 440 void removedContainer(SourceContainer container) { |
| 437 if (container != null) { | 441 if (container != null) { |
| 438 _removedContainers.add(container); | 442 _removedContainers.add(container); |
| 439 } | 443 } |
| 440 } | 444 } |
| 441 } | 445 } |
| 442 /** | 446 /** |
| 443 * Instances of the class {@code AnalysisContextImpl} implement an {@link Analys
isContext analysis | 447 * Instances of the class {@code AnalysisContextImpl} implement an {@link Analys
isContext analysis |
| 444 * context}. | 448 * context}. |
| 449 * @coverage dart.engine |
| 445 */ | 450 */ |
| 446 class AnalysisContextImpl implements AnalysisContext { | 451 class AnalysisContextImpl implements AnalysisContext { |
| 447 /** | 452 /** |
| 448 * The source factory used to create the sources that can be analyzed in this
context. | 453 * The source factory used to create the sources that can be analyzed in this
context. |
| 449 */ | 454 */ |
| 450 SourceFactory _sourceFactory; | 455 SourceFactory _sourceFactory; |
| 451 /** | 456 /** |
| 452 * A table mapping sources known to the context to the information known about
the source. | 457 * A table mapping sources known to the context to the information known about
the source. |
| 453 */ | 458 */ |
| 454 Map<Source, SourceInfo> _sourceMap = new Map<Source, SourceInfo>(); | 459 Map<Source, SourceInfo> _sourceMap = new Map<Source, SourceInfo>(); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 bool hasPartOfDirective(CompilationUnit unit) { | 772 bool hasPartOfDirective(CompilationUnit unit) { |
| 768 for (Directive directive in unit.directives) { | 773 for (Directive directive in unit.directives) { |
| 769 if (directive is PartOfDirective) { | 774 if (directive is PartOfDirective) { |
| 770 return true; | 775 return true; |
| 771 } | 776 } |
| 772 } | 777 } |
| 773 return false; | 778 return false; |
| 774 } | 779 } |
| 775 AnalysisContextImpl_ScanResult internalScan(Source source, AnalysisErrorListen
er errorListener) { | 780 AnalysisContextImpl_ScanResult internalScan(Source source, AnalysisErrorListen
er errorListener) { |
| 776 AnalysisContextImpl_ScanResult result = new AnalysisContextImpl_ScanResult()
; | 781 AnalysisContextImpl_ScanResult result = new AnalysisContextImpl_ScanResult()
; |
| 777 Source_ContentReceiver receiver = new Source_ContentReceiver_2(source, error
Listener, result); | 782 Source_ContentReceiver receiver = new Source_ContentReceiver_3(source, error
Listener, result); |
| 778 try { | 783 try { |
| 779 source.getContents(receiver); | 784 source.getContents(receiver); |
| 780 } on JavaException catch (exception) { | 785 } on JavaException catch (exception) { |
| 781 throw new AnalysisException.con3(exception); | 786 throw new AnalysisException.con3(exception); |
| 782 } | 787 } |
| 783 return result; | 788 return result; |
| 784 } | 789 } |
| 785 /** | 790 /** |
| 786 * Note: This method must only be invoked while we are synchronized on {@link
#cacheLock}. | 791 * Note: This method must only be invoked while we are synchronized on {@link
#cacheLock}. |
| 787 * @param source the source that has been added | 792 * @param source the source that has been added |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 /** | 847 /** |
| 843 * The line start information that was produced. | 848 * The line start information that was produced. |
| 844 */ | 849 */ |
| 845 List<int> _lineStarts; | 850 List<int> _lineStarts; |
| 846 /** | 851 /** |
| 847 * Initialize a newly created result object to be empty. | 852 * Initialize a newly created result object to be empty. |
| 848 */ | 853 */ |
| 849 AnalysisContextImpl_ScanResult() : super() { | 854 AnalysisContextImpl_ScanResult() : super() { |
| 850 } | 855 } |
| 851 } | 856 } |
| 852 class Source_ContentReceiver_2 implements Source_ContentReceiver { | 857 class Source_ContentReceiver_3 implements Source_ContentReceiver { |
| 853 Source source; | 858 Source source; |
| 854 AnalysisErrorListener errorListener; | 859 AnalysisErrorListener errorListener; |
| 855 AnalysisContextImpl_ScanResult result; | 860 AnalysisContextImpl_ScanResult result; |
| 856 Source_ContentReceiver_2(this.source, this.errorListener, this.result); | 861 Source_ContentReceiver_3(this.source, this.errorListener, this.result); |
| 857 accept(CharBuffer contents) { | 862 accept(CharBuffer contents) { |
| 858 CharBufferScanner scanner = new CharBufferScanner(source, contents, errorLis
tener); | 863 CharBufferScanner scanner = new CharBufferScanner(source, contents, errorLis
tener); |
| 859 result._token = scanner.tokenize(); | 864 result._token = scanner.tokenize(); |
| 860 result._lineStarts = scanner.lineStarts; | 865 result._lineStarts = scanner.lineStarts; |
| 861 } | 866 } |
| 862 void accept2(String contents) { | 867 void accept2(String contents) { |
| 863 StringScanner scanner = new StringScanner(source, contents, errorListener); | 868 StringScanner scanner = new StringScanner(source, contents, errorListener); |
| 864 result._token = scanner.tokenize(); | 869 result._token = scanner.tokenize(); |
| 865 result._lineStarts = scanner.lineStarts; | 870 result._lineStarts = scanner.lineStarts; |
| 866 } | 871 } |
| 867 } | 872 } |
| 868 /** | 873 /** |
| 869 * Instances of the class {@code RecordingErrorListener} implement an error list
ener that will | 874 * Instances of the class {@code RecordingErrorListener} implement an error list
ener that will |
| 870 * record the errors that are reported to it in a way that is appropriate for ca
ching those errors | 875 * record the errors that are reported to it in a way that is appropriate for ca
ching those errors |
| 871 * within an analysis context. | 876 * within an analysis context. |
| 877 * @coverage dart.engine |
| 872 */ | 878 */ |
| 873 class RecordingErrorListener implements AnalysisErrorListener { | 879 class RecordingErrorListener implements AnalysisErrorListener { |
| 874 /** | 880 /** |
| 875 * A HashMap of lists containing the errors that were collected, keyed by each
{@link Source}. | 881 * A HashMap of lists containing the errors that were collected, keyed by each
{@link Source}. |
| 876 */ | 882 */ |
| 877 Map<Source, List<AnalysisError>> _errors = new Map<Source, List<AnalysisError>
>(); | 883 Map<Source, List<AnalysisError>> _errors = new Map<Source, List<AnalysisError>
>(); |
| 878 /** | 884 /** |
| 879 * Answer the errors collected by the listener. | 885 * Answer the errors collected by the listener. |
| 880 * @return an array of errors (not {@code null}, contains no {@code null}s) | 886 * @return an array of errors (not {@code null}, contains no {@code null}s) |
| 881 */ | 887 */ |
| 882 List<AnalysisError> get errors { | 888 List<AnalysisError> get errors { |
| 883 Set<MapEntry<Source, List<AnalysisError>>> entrySet2 = getMapEntrySet(_error
s); | 889 Set<MapEntry<Source, List<AnalysisError>>> entrySet2 = getMapEntrySet(_error
s); |
| 884 if (entrySet2.length == 0) { | 890 if (entrySet2.length == 0) { |
| 885 return AnalysisError.NO_ERRORS; | 891 return AnalysisError.NO_ERRORS; |
| 886 } | 892 } |
| 887 List<AnalysisError> resultList = new List<AnalysisError>(entrySet2.length); | 893 List<AnalysisError> resultList = new List<AnalysisError>(); |
| 888 for (MapEntry<Source, List<AnalysisError>> entry in entrySet2) { | 894 for (MapEntry<Source, List<AnalysisError>> entry in entrySet2) { |
| 889 resultList.addAll(entry.getValue()); | 895 resultList.addAll(entry.getValue()); |
| 890 } | 896 } |
| 891 return new List.from(resultList); | 897 return new List.from(resultList); |
| 892 } | 898 } |
| 893 /** | 899 /** |
| 894 * Answer the errors collected by the listener for some passed {@link Source}. | 900 * Answer the errors collected by the listener for some passed {@link Source}. |
| 895 * @param source some {@link Source} for which the caller wants the set of {@l
ink AnalysisError}s | 901 * @param source some {@link Source} for which the caller wants the set of {@l
ink AnalysisError}s |
| 896 * collected by this listener | 902 * collected by this listener |
| 897 * @return the errors collected by the listener for the passed {@link Source} | 903 * @return the errors collected by the listener for the passed {@link Source} |
| (...skipping 12 matching lines...) Expand all Loading... |
| 910 if (_errors[source9] == null) { | 916 if (_errors[source9] == null) { |
| 911 errorsForSource = new List<AnalysisError>(); | 917 errorsForSource = new List<AnalysisError>(); |
| 912 _errors[source9] = errorsForSource; | 918 _errors[source9] = errorsForSource; |
| 913 } | 919 } |
| 914 errorsForSource.add(event); | 920 errorsForSource.add(event); |
| 915 } | 921 } |
| 916 } | 922 } |
| 917 /** | 923 /** |
| 918 * Instances of the class {@code SourceInfo} maintain the information known by a
n analysis context | 924 * Instances of the class {@code SourceInfo} maintain the information known by a
n analysis context |
| 919 * about an individual source. | 925 * about an individual source. |
| 926 * @coverage dart.engine |
| 920 */ | 927 */ |
| 921 class SourceInfo { | 928 class SourceInfo { |
| 922 /** | 929 /** |
| 923 * The kind of the source. | 930 * The kind of the source. |
| 924 */ | 931 */ |
| 925 SourceKind _kind; | 932 SourceKind _kind; |
| 926 /** | 933 /** |
| 927 * The sources for the defining compilation units for the libraries containing
the source, or{@code null} if the libraries containing the source are not yet k
nown. | 934 * The sources for the defining compilation units for the libraries containing
the source, or{@code null} if the libraries containing the source are not yet k
nown. |
| 928 */ | 935 */ |
| 929 List<Source> _librarySources = null; | 936 List<Source> _librarySources = null; |
| 930 SourceInfo.con1(Source source, SourceKind kind3) { | 937 SourceInfo.con1(Source source, SourceKind kind3) { |
| 931 _jtd_constructor_151_impl(source, kind3); | 938 _jtd_constructor_154_impl(source, kind3); |
| 932 } | 939 } |
| 933 _jtd_constructor_151_impl(Source source, SourceKind kind3) { | 940 _jtd_constructor_154_impl(Source source, SourceKind kind3) { |
| 934 this._kind = kind3; | 941 this._kind = kind3; |
| 935 } | 942 } |
| 936 /** | 943 /** |
| 937 * Initialize a newly created information holder to hold the same information
as the given holder. | 944 * Initialize a newly created information holder to hold the same information
as the given holder. |
| 938 * @param info the information holder used to initialize this holder | 945 * @param info the information holder used to initialize this holder |
| 939 */ | 946 */ |
| 940 SourceInfo.con2(SourceInfo info) { | 947 SourceInfo.con2(SourceInfo info) { |
| 941 _jtd_constructor_152_impl(info); | 948 _jtd_constructor_155_impl(info); |
| 942 } | 949 } |
| 943 _jtd_constructor_152_impl(SourceInfo info) { | 950 _jtd_constructor_155_impl(SourceInfo info) { |
| 944 _kind = info._kind; | 951 _kind = info._kind; |
| 945 _librarySources = new List<Source>.from(info._librarySources); | 952 _librarySources = new List<Source>.from(info._librarySources); |
| 946 } | 953 } |
| 947 /** | 954 /** |
| 948 * Add the given source to the list of sources for the defining compilation un
its for the | 955 * Add the given source to the list of sources for the defining compilation un
its for the |
| 949 * libraries containing this source. | 956 * libraries containing this source. |
| 950 * @param source the source to be added to the list | 957 * @param source the source to be added to the list |
| 951 */ | 958 */ |
| 952 void addLibrarySource(Source source) { | 959 void addLibrarySource(Source source) { |
| 953 if (_librarySources == null) { | 960 if (_librarySources == null) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 */ | 994 */ |
| 988 void set kind(SourceKind kind4) { | 995 void set kind(SourceKind kind4) { |
| 989 this._kind = kind4; | 996 this._kind = kind4; |
| 990 } | 997 } |
| 991 } | 998 } |
| 992 /** | 999 /** |
| 993 * The interface {@code Logger} defines the behavior of objects that can be used
to receive | 1000 * The interface {@code Logger} defines the behavior of objects that can be used
to receive |
| 994 * information about errors within the analysis engine. Implementations usually
write this | 1001 * information about errors within the analysis engine. Implementations usually
write this |
| 995 * information to a file, but can also record the information for later use (suc
h as during testing) | 1002 * information to a file, but can also record the information for later use (suc
h as during testing) |
| 996 * or even ignore the information. | 1003 * or even ignore the information. |
| 1004 * @coverage dart.engine.utilities |
| 997 */ | 1005 */ |
| 998 abstract class Logger { | 1006 abstract class Logger { |
| 999 static Logger NULL = new Logger_NullLogger(); | 1007 static Logger NULL = new Logger_NullLogger(); |
| 1000 /** | 1008 /** |
| 1001 * Log the given message as an error. | 1009 * Log the given message as an error. |
| 1002 * @param message an explanation of why the error occurred or what it means | 1010 * @param message an explanation of why the error occurred or what it means |
| 1003 */ | 1011 */ |
| 1004 void logError(String message); | 1012 void logError(String message); |
| 1005 /** | 1013 /** |
| 1006 * Log the given exception as one representing an error. | 1014 * Log the given exception as one representing an error. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1034 } | 1042 } |
| 1035 void logError2(String message, Exception exception) { | 1043 void logError2(String message, Exception exception) { |
| 1036 } | 1044 } |
| 1037 void logError3(Exception exception) { | 1045 void logError3(Exception exception) { |
| 1038 } | 1046 } |
| 1039 void logInformation(String message) { | 1047 void logInformation(String message) { |
| 1040 } | 1048 } |
| 1041 void logInformation2(String message, Exception exception) { | 1049 void logInformation2(String message, Exception exception) { |
| 1042 } | 1050 } |
| 1043 } | 1051 } |
| OLD | NEW |