| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine; | 8 library engine; |
| 9 | 9 |
| 10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
| (...skipping 4540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4551 // TODO(brianwilkerson) This is hugely inefficient, but we need to re-anal
yze any libraries | 4551 // TODO(brianwilkerson) This is hugely inefficient, but we need to re-anal
yze any libraries |
| 4552 // that might have been referencing the not-yet-existing source that was j
ust added. Longer | 4552 // that might have been referencing the not-yet-existing source that was j
ust added. Longer |
| 4553 // term we need to keep track of which libraries are referencing non-exist
ing sources and | 4553 // term we need to keep track of which libraries are referencing non-exist
ing sources and |
| 4554 // only re-analyze those libraries. | 4554 // only re-analyze those libraries. |
| 4555 // logInformation("Added Dart sources, invalidating all resolution
information"); | 4555 // logInformation("Added Dart sources, invalidating all resolution
information"); |
| 4556 List<Source> sourcesToInvalidate = new List<Source>(); | 4556 List<Source> sourcesToInvalidate = new List<Source>(); |
| 4557 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); | 4557 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); |
| 4558 while (iterator.moveNext()) { | 4558 while (iterator.moveNext()) { |
| 4559 Source source = iterator.key; | 4559 Source source = iterator.key; |
| 4560 SourceEntry sourceEntry = iterator.value; | 4560 SourceEntry sourceEntry = iterator.value; |
| 4561 if (!source.isInSystemLibrary && sourceEntry is DartEntry) { | 4561 if (!source.isInSystemLibrary && (sourceEntry is DartEntry || sourceEntr
y is HtmlEntry)) { |
| 4562 sourcesToInvalidate.add(source); | 4562 sourcesToInvalidate.add(source); |
| 4563 } | 4563 } |
| 4564 } | 4564 } |
| 4565 int count = sourcesToInvalidate.length; | 4565 int count = sourcesToInvalidate.length; |
| 4566 for (int i = 0; i < count; i++) { | 4566 for (int i = 0; i < count; i++) { |
| 4567 Source source = sourcesToInvalidate[i]; | 4567 Source source = sourcesToInvalidate[i]; |
| 4568 DartEntry dartEntry = _getReadableDartEntry(source); | 4568 SourceEntry entry = _getReadableSourceEntry(source); |
| 4569 _removeFromParts(source, dartEntry); | 4569 if (entry is DartEntry) { |
| 4570 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4570 DartEntry dartEntry = entry; |
| 4571 dartCopy.invalidateAllResolutionInformation(); | 4571 _removeFromParts(source, dartEntry); |
| 4572 _cache.put(source, dartCopy); | 4572 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4573 SourcePriority priority = SourcePriority.UNKNOWN; | 4573 dartCopy.invalidateAllResolutionInformation(); |
| 4574 SourceKind kind = dartCopy.kind; | 4574 _cache.put(source, dartCopy); |
| 4575 if (kind == SourceKind.LIBRARY) { | 4575 SourcePriority priority = SourcePriority.UNKNOWN; |
| 4576 priority = SourcePriority.LIBRARY; | 4576 SourceKind kind = dartCopy.kind; |
| 4577 } else if (kind == SourceKind.PART) { | 4577 if (kind == SourceKind.LIBRARY) { |
| 4578 priority = SourcePriority.NORMAL_PART; | 4578 priority = SourcePriority.LIBRARY; |
| 4579 } else if (kind == SourceKind.PART) { |
| 4580 priority = SourcePriority.NORMAL_PART; |
| 4581 } |
| 4582 _workManager.add(source, priority); |
| 4579 } | 4583 } |
| 4580 _workManager.add(source, priority); | 4584 if (entry is HtmlEntry) { |
| 4585 HtmlEntry htmlEntry = entry; |
| 4586 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4587 htmlCopy.invalidateAllResolutionInformation(); |
| 4588 _cache.put(source, htmlCopy); |
| 4589 _workManager.add(source, SourcePriority.HTML); |
| 4590 } |
| 4581 } | 4591 } |
| 4582 } | 4592 } |
| 4583 } | 4593 } |
| 4584 | 4594 |
| 4585 @override | 4595 @override |
| 4586 String computeDocumentationComment(Element element) { | 4596 String computeDocumentationComment(Element element) { |
| 4587 if (element == null) { | 4597 if (element == null) { |
| 4588 return null; | 4598 return null; |
| 4589 } | 4599 } |
| 4590 Source source = element.source; | 4600 Source source = element.source; |
| (...skipping 8570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13161 if (prefix == null) { | 13171 if (prefix == null) { |
| 13162 prefix = new PrefixElementImpl(prefixNode); | 13172 prefix = new PrefixElementImpl(prefixNode); |
| 13163 nameToPrefixMap[prefixName] = prefix; | 13173 nameToPrefixMap[prefixName] = prefix; |
| 13164 } | 13174 } |
| 13165 importElement.prefix = prefix; | 13175 importElement.prefix = prefix; |
| 13166 prefixNode.staticElement = prefix; | 13176 prefixNode.staticElement = prefix; |
| 13167 } | 13177 } |
| 13168 directive.element = importElement; | 13178 directive.element = importElement; |
| 13169 imports.add(importElement); | 13179 imports.add(importElement); |
| 13170 if (analysisContext.computeKindOf(importedSource) != SourceKind.LI
BRARY) { | 13180 if (analysisContext.computeKindOf(importedSource) != SourceKind.LI
BRARY) { |
| 13171 _errorListener.onError(new AnalysisError.con2(library.librarySou
rce, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.IMPORT_OF_NON_LI
BRARY, [uriLiteral.toSource()])); | 13181 ErrorCode errorCode = (importElement.isDeferred ? StaticWarningC
ode.IMPORT_OF_NON_LIBRARY : CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY); |
| 13182 _errorListener.onError(new AnalysisError.con2(library.librarySou
rce, uriLiteral.offset, uriLiteral.length, errorCode, [uriLiteral.toSource()])); |
| 13172 } | 13183 } |
| 13173 } | 13184 } |
| 13174 } | 13185 } |
| 13175 } else if (directive is ExportDirective) { | 13186 } else if (directive is ExportDirective) { |
| 13176 ExportDirective exportDirective = directive; | 13187 ExportDirective exportDirective = directive; |
| 13177 Source exportedSource = exportDirective.source; | 13188 Source exportedSource = exportDirective.source; |
| 13178 if (exportedSource != null && analysisContext.exists(exportedSource))
{ | 13189 if (exportedSource != null && analysisContext.exists(exportedSource))
{ |
| 13179 // The exported source will be null if the URI in the export directi
ve was invalid. | 13190 // The exported source will be null if the URI in the export directi
ve was invalid. |
| 13180 ResolvableLibrary exportedLibrary = _libraryMap[exportedSource]; | 13191 ResolvableLibrary exportedLibrary = _libraryMap[exportedSource]; |
| 13181 if (exportedLibrary != null) { | 13192 if (exportedLibrary != null) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13293 return identifiers; | 13304 return identifiers; |
| 13294 } | 13305 } |
| 13295 } | 13306 } |
| 13296 | 13307 |
| 13297 /** | 13308 /** |
| 13298 * Instances of the class `GenerateDartErrorsTask` generate errors and warnings
for a single | 13309 * Instances of the class `GenerateDartErrorsTask` generate errors and warnings
for a single |
| 13299 * Dart source. | 13310 * Dart source. |
| 13300 */ | 13311 */ |
| 13301 class GenerateDartErrorsTask extends AnalysisTask { | 13312 class GenerateDartErrorsTask extends AnalysisTask { |
| 13302 /** | 13313 /** |
| 13314 * Check each directive in the given compilation unit to see if the referenced
source exists and |
| 13315 * report an error if it does not. |
| 13316 * |
| 13317 * @param context the context in which the library exists |
| 13318 * @param librarySource the source representing the library containing the dir
ectives |
| 13319 * @param unit the compilation unit containing the directives to be validated |
| 13320 * @param errorListener the error listener to which errors should be reported |
| 13321 */ |
| 13322 static void validateDirectives(AnalysisContext context, Source librarySource,
CompilationUnit unit, AnalysisErrorListener errorListener) { |
| 13323 for (Directive directive in unit.directives) { |
| 13324 if (directive is UriBasedDirective) { |
| 13325 validateReferencedSource(context, librarySource, directive, errorListene
r); |
| 13326 } |
| 13327 } |
| 13328 } |
| 13329 |
| 13330 /** |
| 13331 * Check the given directive to see if the referenced source exists and report
an error if it does |
| 13332 * not. |
| 13333 * |
| 13334 * @param context the context in which the library exists |
| 13335 * @param librarySource the source representing the library containing the dir
ective |
| 13336 * @param directive the directive to be verified |
| 13337 * @param errorListener the error listener to which errors should be reported |
| 13338 */ |
| 13339 static void validateReferencedSource(AnalysisContext context, Source librarySo
urce, UriBasedDirective directive, AnalysisErrorListener errorListener) { |
| 13340 Source source = directive.source; |
| 13341 if (source != null) { |
| 13342 if (context.exists(source)) { |
| 13343 return; |
| 13344 } |
| 13345 } else { |
| 13346 // Don't report errors already reported by ParseDartTask#resolveDirective |
| 13347 if (directive.validate() != null) { |
| 13348 return; |
| 13349 } |
| 13350 } |
| 13351 StringLiteral uriLiteral = directive.uri; |
| 13352 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.offse
t, uriLiteral.length, CompileTimeErrorCode.URI_DOES_NOT_EXIST, [directive.uriCon
tent])); |
| 13353 } |
| 13354 |
| 13355 /** |
| 13303 * The source for which errors and warnings are to be produced. | 13356 * The source for which errors and warnings are to be produced. |
| 13304 */ | 13357 */ |
| 13305 final Source source; | 13358 final Source source; |
| 13306 | 13359 |
| 13307 /** | 13360 /** |
| 13308 * The time at which the contents of the source were last modified. | 13361 * The time at which the contents of the source were last modified. |
| 13309 */ | 13362 */ |
| 13310 final int modificationTime; | 13363 final int modificationTime; |
| 13311 | 13364 |
| 13312 /** | 13365 /** |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13349 String get taskDescription => "generate errors and warnings for ${source.fullN
ame}"; | 13402 String get taskDescription => "generate errors and warnings for ${source.fullN
ame}"; |
| 13350 | 13403 |
| 13351 @override | 13404 @override |
| 13352 void internalPerform() { | 13405 void internalPerform() { |
| 13353 TimeCounter_TimeCounterHandle timeCounter = PerformanceStatistics.errors.sta
rt(); | 13406 TimeCounter_TimeCounterHandle timeCounter = PerformanceStatistics.errors.sta
rt(); |
| 13354 try { | 13407 try { |
| 13355 RecordingErrorListener errorListener = new RecordingErrorListener(); | 13408 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 13356 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 13409 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
| 13357 TypeProvider typeProvider = context.typeProvider; | 13410 TypeProvider typeProvider = context.typeProvider; |
| 13358 // | 13411 // |
| 13412 // Validate the directives |
| 13413 // |
| 13414 validateDirectives(context, source, _unit, errorListener); |
| 13415 // |
| 13359 // Use the ConstantVerifier to verify the use of constants. This needs to
happen before using | 13416 // Use the ConstantVerifier to verify the use of constants. This needs to
happen before using |
| 13360 // the ErrorVerifier because some error codes need the computed constant v
alues. | 13417 // the ErrorVerifier because some error codes need the computed constant v
alues. |
| 13361 // | 13418 // |
| 13362 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, ty
peProvider); | 13419 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, ty
peProvider); |
| 13363 _unit.accept(constantVerifier); | 13420 _unit.accept(constantVerifier); |
| 13364 // | 13421 // |
| 13365 // Use the ErrorVerifier to compute the rest of the errors. | 13422 // Use the ErrorVerifier to compute the rest of the errors. |
| 13366 // | 13423 // |
| 13367 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, libraryElem
ent, typeProvider, new InheritanceManager(libraryElement)); | 13424 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, libraryElem
ent, typeProvider, new InheritanceManager(libraryElement)); |
| 13368 _unit.accept(errorVerifier); | 13425 _unit.accept(errorVerifier); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13637 /** | 13694 /** |
| 13638 * Return the result of resolving the URI of the given URI-based directive aga
inst the URI of the | 13695 * Return the result of resolving the URI of the given URI-based directive aga
inst the URI of the |
| 13639 * given library, or `null` if the URI is not valid. | 13696 * given library, or `null` if the URI is not valid. |
| 13640 * | 13697 * |
| 13641 * @param context the context in which the resolution is to be performed | 13698 * @param context the context in which the resolution is to be performed |
| 13642 * @param librarySource the source representing the library containing the dir
ective | 13699 * @param librarySource the source representing the library containing the dir
ective |
| 13643 * @param directive the directive which URI should be resolved | 13700 * @param directive the directive which URI should be resolved |
| 13644 * @param errorListener the error listener to which errors should be reported | 13701 * @param errorListener the error listener to which errors should be reported |
| 13645 * @return the result of resolving the URI against the URI of the library | 13702 * @return the result of resolving the URI against the URI of the library |
| 13646 */ | 13703 */ |
| 13647 static Source resolveSource(AnalysisContext analysisContext, Source librarySou
rce, UriBasedDirective directive, AnalysisErrorListener errorListener) { | 13704 static Source resolveDirective(AnalysisContext context, Source librarySource,
UriBasedDirective directive, AnalysisErrorListener errorListener) { |
| 13648 StringLiteral uriLiteral = directive.uri; | 13705 StringLiteral uriLiteral = directive.uri; |
| 13649 if (uriLiteral is StringInterpolation) { | 13706 String uriContent = uriLiteral.stringValue; |
| 13707 if (uriContent != null) { |
| 13708 uriContent = uriContent.trim(); |
| 13709 directive.uriContent = uriContent; |
| 13710 } |
| 13711 UriValidationCode code = directive.validate(); |
| 13712 if (code == null) { |
| 13713 String encodedUriContent = Uri.encodeFull(uriContent); |
| 13714 Source source = context.sourceFactory.resolveUri(librarySource, encodedUri
Content); |
| 13715 directive.source = source; |
| 13716 return source; |
| 13717 } |
| 13718 if (code == UriValidationCode.URI_WITH_DART_EXT_SCHEME) { |
| 13719 return null; |
| 13720 } |
| 13721 if (code == UriValidationCode.URI_WITH_INTERPOLATION) { |
| 13650 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION, [])); | 13722 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION, [])); |
| 13651 return null; | 13723 return null; |
| 13652 } | 13724 } |
| 13653 String uriContent = uriLiteral.stringValue.trim(); | 13725 if (code == UriValidationCode.INVALID_URI) { |
| 13654 directive.uriContent = uriContent; | 13726 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); |
| 13655 if (directive is ImportDirective && uriContent.startsWith(_DART_EXT_SCHEME))
{ | |
| 13656 return null; | 13727 return null; |
| 13657 } | 13728 } |
| 13658 try { | 13729 throw new RuntimeException(message: "Failed to handle validation code: ${cod
e}"); |
| 13659 String encodedUriContent = Uri.encodeFull(uriContent); | |
| 13660 parseUriWithException(encodedUriContent); | |
| 13661 Source source = analysisContext.sourceFactory.resolveUri(librarySource, en
codedUriContent); | |
| 13662 if (!analysisContext.exists(source)) { | |
| 13663 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.o
ffset, uriLiteral.length, CompileTimeErrorCode.URI_DOES_NOT_EXIST, [uriContent])
); | |
| 13664 } | |
| 13665 directive.source = source; | |
| 13666 return source; | |
| 13667 } on URISyntaxException catch (exception) { | |
| 13668 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); | |
| 13669 } | |
| 13670 return null; | |
| 13671 } | 13730 } |
| 13672 | 13731 |
| 13673 /** | 13732 /** |
| 13674 * The source to be parsed. | 13733 * The source to be parsed. |
| 13675 */ | 13734 */ |
| 13676 final Source source; | 13735 final Source source; |
| 13677 | 13736 |
| 13678 /** | 13737 /** |
| 13679 * The time at which the contents of the source were last modified. | 13738 * The time at which the contents of the source were last modified. |
| 13680 */ | 13739 */ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13719 * A set containing the sources referenced by 'part' directives. | 13778 * A set containing the sources referenced by 'part' directives. |
| 13720 */ | 13779 */ |
| 13721 Set<Source> _includedSources = new Set<Source>(); | 13780 Set<Source> _includedSources = new Set<Source>(); |
| 13722 | 13781 |
| 13723 /** | 13782 /** |
| 13724 * The errors that were produced by scanning and parsing the source. | 13783 * The errors that were produced by scanning and parsing the source. |
| 13725 */ | 13784 */ |
| 13726 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; | 13785 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; |
| 13727 | 13786 |
| 13728 /** | 13787 /** |
| 13729 * The prefix of a URI using the `dart-ext` scheme to reference a native code
library. | |
| 13730 */ | |
| 13731 static String _DART_EXT_SCHEME = "dart-ext:"; | |
| 13732 | |
| 13733 /** | |
| 13734 * Initialize a newly created task to perform analysis within the given contex
t. | 13788 * Initialize a newly created task to perform analysis within the given contex
t. |
| 13735 * | 13789 * |
| 13736 * @param context the context in which the task is to be performed | 13790 * @param context the context in which the task is to be performed |
| 13737 * @param source the source to be parsed | 13791 * @param source the source to be parsed |
| 13738 * @param modificationTime the time at which the contents of the source were l
ast modified | 13792 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 13739 * @param tokenStream the head of the token stream used for parsing | 13793 * @param tokenStream the head of the token stream used for parsing |
| 13740 * @param lineInfo the line information associated with the source | 13794 * @param lineInfo the line information associated with the source |
| 13741 */ | 13795 */ |
| 13742 ParseDartTask(InternalAnalysisContext context, this.source, this.modificationT
ime, this._tokenStream, this.lineInfo) : super(context); | 13796 ParseDartTask(InternalAnalysisContext context, this.source, this.modificationT
ime, this._tokenStream, this.lineInfo) : super(context); |
| 13743 | 13797 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13819 Parser parser = new Parser(source, errorListener); | 13873 Parser parser = new Parser(source, errorListener); |
| 13820 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies
; | 13874 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies
; |
| 13821 _unit = parser.parseCompilationUnit(_tokenStream); | 13875 _unit = parser.parseCompilationUnit(_tokenStream); |
| 13822 _unit.lineInfo = lineInfo; | 13876 _unit.lineInfo = lineInfo; |
| 13823 AnalysisContext analysisContext = context; | 13877 AnalysisContext analysisContext = context; |
| 13824 for (Directive directive in _unit.directives) { | 13878 for (Directive directive in _unit.directives) { |
| 13825 if (directive is PartOfDirective) { | 13879 if (directive is PartOfDirective) { |
| 13826 _containsPartOfDirective = true; | 13880 _containsPartOfDirective = true; |
| 13827 } else { | 13881 } else { |
| 13828 _containsNonPartOfDirective = true; | 13882 _containsNonPartOfDirective = true; |
| 13829 if (directive is ExportDirective) { | 13883 if (directive is UriBasedDirective) { |
| 13830 Source exportSource = resolveSource(analysisContext, source, directi
ve, errorListener); | 13884 Source referencedSource = resolveDirective(analysisContext, source,
directive, errorListener); |
| 13831 if (exportSource != null) { | 13885 if (referencedSource != null) { |
| 13832 _exportedSources.add(exportSource); | 13886 if (directive is ExportDirective) { |
| 13833 } | 13887 _exportedSources.add(referencedSource); |
| 13834 } else if (directive is ImportDirective) { | 13888 } else if (directive is ImportDirective) { |
| 13835 Source importSource = resolveSource(analysisContext, source, directi
ve, errorListener); | 13889 _importedSources.add(referencedSource); |
| 13836 if (importSource != null) { | 13890 } else if (directive is PartDirective) { |
| 13837 _importedSources.add(importSource); | 13891 if (referencedSource != source) { |
| 13838 } | 13892 _includedSources.add(referencedSource); |
| 13839 } else if (directive is PartDirective) { | 13893 } |
| 13840 Source partSource = resolveSource(analysisContext, source, directive
, errorListener); | 13894 } else { |
| 13841 if (partSource != null && partSource != source) { | 13895 throw new AnalysisException.con1("${runtimeType.toString()} fail
ed to handle a ${directive.runtimeType.toString()}"); |
| 13842 _includedSources.add(partSource); | 13896 } |
| 13843 } | 13897 } |
| 13844 } | 13898 } |
| 13845 } | 13899 } |
| 13846 } | 13900 } |
| 13847 _errors = errorListener.getErrorsForSource(source); | 13901 _errors = errorListener.getErrorsForSource(source); |
| 13848 } finally { | 13902 } finally { |
| 13849 timeCounterParse.stop(); | 13903 timeCounterParse.stop(); |
| 13850 } | 13904 } |
| 13851 } | 13905 } |
| 13852 | 13906 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13998 | 14052 |
| 13999 /** | 14053 /** |
| 14000 * Resolves directives in the given [CompilationUnit]. | 14054 * Resolves directives in the given [CompilationUnit]. |
| 14001 */ | 14055 */ |
| 14002 void _resolveScriptDirectives(CompilationUnit script, AnalysisErrorListener er
rorListener) { | 14056 void _resolveScriptDirectives(CompilationUnit script, AnalysisErrorListener er
rorListener) { |
| 14003 if (script == null) { | 14057 if (script == null) { |
| 14004 return; | 14058 return; |
| 14005 } | 14059 } |
| 14006 AnalysisContext analysisContext = context; | 14060 AnalysisContext analysisContext = context; |
| 14007 for (Directive directive in script.directives) { | 14061 for (Directive directive in script.directives) { |
| 14008 if (directive is ExportDirective) { | 14062 if (directive is UriBasedDirective) { |
| 14009 ParseDartTask.resolveSource(analysisContext, source, directive, errorLis
tener); | 14063 ParseDartTask.resolveDirective(analysisContext, source, directive, error
Listener); |
| 14010 } else if (directive is ImportDirective) { | |
| 14011 ParseDartTask.resolveSource(analysisContext, source, directive, errorLis
tener); | |
| 14012 } else if (directive is PartDirective) { | |
| 14013 ParseDartTask.resolveSource(analysisContext, source, directive, errorLis
tener); | |
| 14014 } | 14064 } |
| 14015 } | 14065 } |
| 14016 } | 14066 } |
| 14017 } | 14067 } |
| 14018 | 14068 |
| 14019 class RecursiveXmlVisitor_ParseHtmlTask_internalPerform extends ht.RecursiveXmlV
isitor<Object> { | 14069 class RecursiveXmlVisitor_ParseHtmlTask_internalPerform extends ht.RecursiveXmlV
isitor<Object> { |
| 14020 final ParseHtmlTask ParseHtmlTask_this; | 14070 final ParseHtmlTask ParseHtmlTask_this; |
| 14021 | 14071 |
| 14022 RecordingErrorListener errorListener; | 14072 RecordingErrorListener errorListener; |
| 14023 | 14073 |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14691 | 14741 |
| 14692 @override | 14742 @override |
| 14693 void internalPerform() { | 14743 void internalPerform() { |
| 14694 // | 14744 // |
| 14695 // Build the standard HTML element. | 14745 // Build the standard HTML element. |
| 14696 // | 14746 // |
| 14697 HtmlUnitBuilder builder = new HtmlUnitBuilder(context); | 14747 HtmlUnitBuilder builder = new HtmlUnitBuilder(context); |
| 14698 _element = builder.buildHtmlElement(source, modificationTime, _unit); | 14748 _element = builder.buildHtmlElement(source, modificationTime, _unit); |
| 14699 RecordingErrorListener errorListener = builder.errorListener; | 14749 RecordingErrorListener errorListener = builder.errorListener; |
| 14700 // | 14750 // |
| 14751 // Validate the directives |
| 14752 // |
| 14753 _unit.accept(new RecursiveXmlVisitor_ResolveHtmlTask_internalPerform(this, e
rrorListener)); |
| 14754 // |
| 14701 // Record all resolution errors. | 14755 // Record all resolution errors. |
| 14702 // | 14756 // |
| 14703 _resolutionErrors = errorListener.getErrorsForSource(source); | 14757 _resolutionErrors = errorListener.getErrorsForSource(source); |
| 14704 // | 14758 // |
| 14705 // Remember the resolved unit. | 14759 // Remember the resolved unit. |
| 14706 // | 14760 // |
| 14707 _resolvedUnit = _unit; | 14761 _resolvedUnit = _unit; |
| 14708 } | 14762 } |
| 14709 } | 14763 } |
| 14710 | 14764 |
| 14765 class RecursiveXmlVisitor_ResolveHtmlTask_internalPerform extends ht.RecursiveXm
lVisitor<Object> { |
| 14766 final ResolveHtmlTask ResolveHtmlTask_this; |
| 14767 |
| 14768 RecordingErrorListener errorListener; |
| 14769 |
| 14770 RecursiveXmlVisitor_ResolveHtmlTask_internalPerform(this.ResolveHtmlTask_this,
this.errorListener) : super(); |
| 14771 |
| 14772 @override |
| 14773 Object visitHtmlScriptTagNode(ht.HtmlScriptTagNode node) { |
| 14774 CompilationUnit script = node.script; |
| 14775 if (script != null) { |
| 14776 GenerateDartErrorsTask.validateDirectives(ResolveHtmlTask_this.context, Re
solveHtmlTask_this.source, script, errorListener); |
| 14777 } |
| 14778 return null; |
| 14779 } |
| 14780 } |
| 14781 |
| 14711 /** | 14782 /** |
| 14712 * Instances of the class `ScanDartTask` scan a specific source as a Dart file. | 14783 * Instances of the class `ScanDartTask` scan a specific source as a Dart file. |
| 14713 */ | 14784 */ |
| 14714 class ScanDartTask extends AnalysisTask { | 14785 class ScanDartTask extends AnalysisTask { |
| 14715 /** | 14786 /** |
| 14716 * The source to be scanned. | 14787 * The source to be scanned. |
| 14717 */ | 14788 */ |
| 14718 final Source source; | 14789 final Source source; |
| 14719 | 14790 |
| 14720 /** | 14791 /** |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14893 } | 14964 } |
| 14894 | 14965 |
| 14895 @override | 14966 @override |
| 14896 void logInformation(String message) { | 14967 void logInformation(String message) { |
| 14897 } | 14968 } |
| 14898 | 14969 |
| 14899 @override | 14970 @override |
| 14900 void logInformation2(String message, Exception exception) { | 14971 void logInformation2(String message, Exception exception) { |
| 14901 } | 14972 } |
| 14902 } | 14973 } |
| OLD | NEW |