| 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 library engine; | 3 library engine; |
| 4 import 'java_core.dart'; | 4 import 'java_core.dart'; |
| 5 import 'java_engine.dart'; | 5 import 'java_engine.dart'; |
| 6 import 'utilities_collection.dart'; | 6 import 'utilities_collection.dart'; |
| 7 import 'utilities_general.dart'; | 7 import 'utilities_general.dart'; |
| 8 import 'instrumentation.dart'; | 8 import 'instrumentation.dart'; |
| 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, Scanner, CharSequenceReader; |
| 12 import 'ast.dart'; | 12 import 'ast.dart'; |
| 13 import 'parser.dart' show Parser; | 13 import 'parser.dart' show Parser; |
| 14 import 'sdk.dart' show DartSdk; | 14 import 'sdk.dart' show DartSdk; |
| 15 import 'element.dart'; | 15 import 'element.dart'; |
| 16 import 'resolver.dart'; | 16 import 'resolver.dart'; |
| 17 import 'html.dart' show XmlTagNode, XmlAttributeNode, RecursiveXmlVisitor, HtmlS
canner, HtmlScanResult, HtmlParser, HtmlParseResult, HtmlUnit; | 17 import 'html.dart' show XmlTagNode, XmlAttributeNode, RecursiveXmlVisitor, HtmlS
canner, HtmlScanResult, HtmlParser, HtmlParseResult, HtmlUnit; |
| 18 /** | 18 /** |
| 19 * The unique instance of the class `AnalysisEngine` serves as the entry point f
or the | 19 * The unique instance of the class `AnalysisEngine` serves as the entry point f
or the |
| 20 * functionality provided by the analysis engine. | 20 * functionality provided by the analysis engine. |
| 21 * | 21 * |
| (...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 */ | 1657 */ |
| 1658 void invalidateAllInformation() { | 1658 void invalidateAllInformation() { |
| 1659 setState(SourceEntry.LINE_INFO, CacheState.INVALID); | 1659 setState(SourceEntry.LINE_INFO, CacheState.INVALID); |
| 1660 _sourceKind = SourceKind.UNKNOWN; | 1660 _sourceKind = SourceKind.UNKNOWN; |
| 1661 _sourceKindState = CacheState.INVALID; | 1661 _sourceKindState = CacheState.INVALID; |
| 1662 _parseErrors = AnalysisError.NO_ERRORS; | 1662 _parseErrors = AnalysisError.NO_ERRORS; |
| 1663 _parseErrorsState = CacheState.INVALID; | 1663 _parseErrorsState = CacheState.INVALID; |
| 1664 _parsedUnit = null; | 1664 _parsedUnit = null; |
| 1665 _parsedUnitAccessed = false; | 1665 _parsedUnitAccessed = false; |
| 1666 _parsedUnitState = CacheState.INVALID; | 1666 _parsedUnitState = CacheState.INVALID; |
| 1667 invalidateAllResolutionInformation(); | 1667 discardCachedResolutionInformation(); |
| 1668 } | 1668 } |
| 1669 | 1669 |
| 1670 /** | 1670 /** |
| 1671 * Invalidate all of the resolution information associated with the compilatio
n unit. | 1671 * Invalidate all of the resolution information associated with the compilatio
n unit. |
| 1672 */ | 1672 */ |
| 1673 void invalidateAllResolutionInformation() { | 1673 void invalidateAllResolutionInformation() { |
| 1674 _element = null; | 1674 if (identical(_parsedUnitState, CacheState.FLUSHED)) { |
| 1675 _elementState = CacheState.INVALID; | 1675 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1676 _includedParts = Source.EMPTY_ARRAY; | 1676 while (state != null) { |
| 1677 _includedPartsState = CacheState.INVALID; | 1677 if (identical(state._resolvedUnitState, CacheState.VALID)) { |
| 1678 _exportedLibraries = Source.EMPTY_ARRAY; | 1678 _parsedUnit = state._resolvedUnit; |
| 1679 _exportedLibrariesState = CacheState.INVALID; | 1679 _parsedUnitAccessed = true; |
| 1680 _importedLibraries = Source.EMPTY_ARRAY; | 1680 _parsedUnitState = CacheState.VALID; |
| 1681 _importedLibrariesState = CacheState.INVALID; | 1681 break; |
| 1682 _bitmask = 0; | 1682 } |
| 1683 _clientServerState = CacheState.INVALID; | 1683 state = state._nextState; |
| 1684 _launchableState = CacheState.INVALID; | 1684 } |
| 1685 _publicNamespace = null; | 1685 } |
| 1686 _publicNamespaceState = CacheState.INVALID; | 1686 discardCachedResolutionInformation(); |
| 1687 _resolutionState.invalidateAllResolutionInformation(); | |
| 1688 } | 1687 } |
| 1689 bool get isRefactoringSafe { | 1688 bool get isRefactoringSafe { |
| 1690 DartEntryImpl_ResolutionState state = _resolutionState; | 1689 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1691 while (state != null) { | 1690 while (state != null) { |
| 1692 CacheState resolvedState = state._resolvedUnitState; | 1691 CacheState resolvedState = state._resolvedUnitState; |
| 1693 if (resolvedState != CacheState.VALID && resolvedState != CacheState.FLUSH
ED) { | 1692 if (resolvedState != CacheState.VALID && resolvedState != CacheState.FLUSH
ED) { |
| 1694 return false; | 1693 return false; |
| 1695 } | 1694 } |
| 1696 state = state._nextState; | 1695 state = state._nextState; |
| 1697 } | 1696 } |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2042 builder.append("; publicNamespace = "); | 2041 builder.append("; publicNamespace = "); |
| 2043 builder.append(_publicNamespaceState); | 2042 builder.append(_publicNamespaceState); |
| 2044 builder.append("; clientServer = "); | 2043 builder.append("; clientServer = "); |
| 2045 builder.append(_clientServerState); | 2044 builder.append(_clientServerState); |
| 2046 builder.append("; launchable = "); | 2045 builder.append("; launchable = "); |
| 2047 builder.append(_launchableState); | 2046 builder.append(_launchableState); |
| 2048 _resolutionState.writeOn(builder); | 2047 _resolutionState.writeOn(builder); |
| 2049 } | 2048 } |
| 2050 | 2049 |
| 2051 /** | 2050 /** |
| 2051 * Invalidate all of the resolution information associated with the compilatio
n unit. |
| 2052 */ |
| 2053 void discardCachedResolutionInformation() { |
| 2054 _element = null; |
| 2055 _elementState = CacheState.INVALID; |
| 2056 _includedParts = Source.EMPTY_ARRAY; |
| 2057 _includedPartsState = CacheState.INVALID; |
| 2058 _exportedLibraries = Source.EMPTY_ARRAY; |
| 2059 _exportedLibrariesState = CacheState.INVALID; |
| 2060 _importedLibraries = Source.EMPTY_ARRAY; |
| 2061 _importedLibrariesState = CacheState.INVALID; |
| 2062 _bitmask = 0; |
| 2063 _clientServerState = CacheState.INVALID; |
| 2064 _launchableState = CacheState.INVALID; |
| 2065 _publicNamespace = null; |
| 2066 _publicNamespaceState = CacheState.INVALID; |
| 2067 _resolutionState.invalidateAllResolutionInformation(); |
| 2068 } |
| 2069 |
| 2070 /** |
| 2052 * Return a resolution state for the specified library, creating one as necess
ary. | 2071 * Return a resolution state for the specified library, creating one as necess
ary. |
| 2053 * | 2072 * |
| 2054 * @param librarySource the library source (not `null`) | 2073 * @param librarySource the library source (not `null`) |
| 2055 * @return the resolution state (not `null`) | 2074 * @return the resolution state (not `null`) |
| 2056 */ | 2075 */ |
| 2057 DartEntryImpl_ResolutionState getOrCreateResolutionState(Source librarySource)
{ | 2076 DartEntryImpl_ResolutionState getOrCreateResolutionState(Source librarySource)
{ |
| 2058 DartEntryImpl_ResolutionState state = _resolutionState; | 2077 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2059 if (state._librarySource == null) { | 2078 if (state._librarySource == null) { |
| 2060 state._librarySource = librarySource; | 2079 state._librarySource = librarySource; |
| 2061 return state; | 2080 return state; |
| (...skipping 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4857 sourceChanged(source); | 4876 sourceChanged(source); |
| 4858 htmlEntry = getReadableHtmlEntry(source); | 4877 htmlEntry = getReadableHtmlEntry(source); |
| 4859 if (htmlEntry == null) { | 4878 if (htmlEntry == null) { |
| 4860 throw new AnalysisException.con1("An HTML file became a non-HTML fil
e: ${source.fullName}"); | 4879 throw new AnalysisException.con1("An HTML file became a non-HTML fil
e: ${source.fullName}"); |
| 4861 } | 4880 } |
| 4862 } | 4881 } |
| 4863 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4882 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4864 if (thrownException == null) { | 4883 if (thrownException == null) { |
| 4865 htmlCopy.setValue(HtmlEntry.ELEMENT, task.element); | 4884 htmlCopy.setValue(HtmlEntry.ELEMENT, task.element); |
| 4866 htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors); | 4885 htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors); |
| 4886 ChangeNoticeImpl notice = getNotice(source); |
| 4887 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LIN
E_INFO)); |
| 4867 } else { | 4888 } else { |
| 4868 htmlCopy.recordResolutionError(); | 4889 htmlCopy.recordResolutionError(); |
| 4869 } | 4890 } |
| 4870 htmlCopy.exception = thrownException; | 4891 htmlCopy.exception = thrownException; |
| 4871 _cache.put(source, htmlCopy); | 4892 _cache.put(source, htmlCopy); |
| 4872 htmlEntry = htmlCopy; | 4893 htmlEntry = htmlCopy; |
| 4873 } else { | 4894 } else { |
| 4874 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4895 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4875 if (thrownException == null || resultTime >= 0) { | 4896 if (thrownException == null || resultTime >= 0) { |
| 4876 if (identical(htmlCopy.getState(HtmlEntry.ELEMENT), CacheState.IN_PROC
ESS)) { | 4897 if (identical(htmlCopy.getState(HtmlEntry.ELEMENT), CacheState.IN_PROC
ESS)) { |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5232 /** | 5253 /** |
| 5233 * Set the errors that changed as a result of the analysis to the given errors
and set the line | 5254 * Set the errors that changed as a result of the analysis to the given errors
and set the line |
| 5234 * information to the given line information. | 5255 * information to the given line information. |
| 5235 * | 5256 * |
| 5236 * @param errors the errors that changed as a result of the analysis | 5257 * @param errors the errors that changed as a result of the analysis |
| 5237 * @param lineInfo the line information associated with the source | 5258 * @param lineInfo the line information associated with the source |
| 5238 */ | 5259 */ |
| 5239 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { | 5260 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { |
| 5240 this._errors = errors; | 5261 this._errors = errors; |
| 5241 this._lineInfo = lineInfo; | 5262 this._lineInfo = lineInfo; |
| 5263 if (lineInfo == null) { |
| 5264 AnalysisEngine.instance.logger.logError2("No line info: ${_source}", new J
avaException()); |
| 5265 } |
| 5242 } | 5266 } |
| 5243 String toString() => "Changes for ${_source.fullName}"; | 5267 String toString() => "Changes for ${_source.fullName}"; |
| 5244 } | 5268 } |
| 5245 /** | 5269 /** |
| 5246 * Instances of the class `DelegatingAnalysisContextImpl` extend [AnalysisContex
tImpl | 5270 * Instances of the class `DelegatingAnalysisContextImpl` extend [AnalysisContex
tImpl |
| 5247 ] to delegate sources to the appropriate analysis context. For instance, if the | 5271 ] to delegate sources to the appropriate analysis context. For instance, if the |
| 5248 * source is in a system library then the analysis context from the [DartSdk] is
used. | 5272 * source is in a system library then the analysis context from the [DartSdk] is
used. |
| 5249 * | 5273 * |
| 5250 * @coverage dart.engine | 5274 * @coverage dart.engine |
| 5251 */ | 5275 */ |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6149 * record the errors that are reported to it in a way that is appropriate for ca
ching those errors | 6173 * record the errors that are reported to it in a way that is appropriate for ca
ching those errors |
| 6150 * within an analysis context. | 6174 * within an analysis context. |
| 6151 * | 6175 * |
| 6152 * @coverage dart.engine | 6176 * @coverage dart.engine |
| 6153 */ | 6177 */ |
| 6154 class RecordingErrorListener implements AnalysisErrorListener { | 6178 class RecordingErrorListener implements AnalysisErrorListener { |
| 6155 | 6179 |
| 6156 /** | 6180 /** |
| 6157 * A HashMap of lists containing the errors that were collected, keyed by each
[Source]. | 6181 * A HashMap of lists containing the errors that were collected, keyed by each
[Source]. |
| 6158 */ | 6182 */ |
| 6159 Map<Source, List<AnalysisError>> _errors = new Map<Source, List<AnalysisError>
>(); | 6183 Map<Source, Set<AnalysisError>> _errors = new Map<Source, Set<AnalysisError>>(
); |
| 6160 | 6184 |
| 6161 /** | 6185 /** |
| 6162 * Add all of the errors recorded by the given listener to this listener. | 6186 * Add all of the errors recorded by the given listener to this listener. |
| 6163 * | 6187 * |
| 6164 * @param listener the listener that has recorded the errors to be added | 6188 * @param listener the listener that has recorded the errors to be added |
| 6165 */ | 6189 */ |
| 6166 void addAll(RecordingErrorListener listener) { | 6190 void addAll(RecordingErrorListener listener) { |
| 6167 for (AnalysisError error in listener.errors) { | 6191 for (AnalysisError error in listener.errors) { |
| 6168 onError(error); | 6192 onError(error); |
| 6169 } | 6193 } |
| 6170 } | 6194 } |
| 6171 | 6195 |
| 6172 /** | 6196 /** |
| 6173 * Answer the errors collected by the listener. | 6197 * Answer the errors collected by the listener. |
| 6174 * | 6198 * |
| 6175 * @return an array of errors (not `null`, contains no `null`s) | 6199 * @return an array of errors (not `null`, contains no `null`s) |
| 6176 */ | 6200 */ |
| 6177 List<AnalysisError> get errors { | 6201 List<AnalysisError> get errors { |
| 6178 Iterable<MapEntry<Source, List<AnalysisError>>> entrySet = getMapEntrySet(_e
rrors); | 6202 Iterable<MapEntry<Source, Set<AnalysisError>>> entrySet = getMapEntrySet(_er
rors); |
| 6179 int numEntries = entrySet.length; | 6203 int numEntries = entrySet.length; |
| 6180 if (numEntries == 0) { | 6204 if (numEntries == 0) { |
| 6181 return AnalysisError.NO_ERRORS; | 6205 return AnalysisError.NO_ERRORS; |
| 6182 } | 6206 } |
| 6183 List<AnalysisError> resultList = new List<AnalysisError>(); | 6207 List<AnalysisError> resultList = new List<AnalysisError>(); |
| 6184 for (MapEntry<Source, List<AnalysisError>> entry in entrySet) { | 6208 for (MapEntry<Source, Set<AnalysisError>> entry in entrySet) { |
| 6185 resultList.addAll(entry.getValue()); | 6209 resultList.addAll(entry.getValue()); |
| 6186 } | 6210 } |
| 6187 return new List.from(resultList); | 6211 return new List.from(resultList); |
| 6188 } | 6212 } |
| 6189 | 6213 |
| 6190 /** | 6214 /** |
| 6191 * Answer the errors collected by the listener for some passed [Source]. | 6215 * Answer the errors collected by the listener for some passed [Source]. |
| 6192 * | 6216 * |
| 6193 * @param source some [Source] for which the caller wants the set of [Analysis
Error]s | 6217 * @param source some [Source] for which the caller wants the set of [Analysis
Error]s |
| 6194 * collected by this listener | 6218 * collected by this listener |
| 6195 * @return the errors collected by the listener for the passed [Source] | 6219 * @return the errors collected by the listener for the passed [Source] |
| 6196 */ | 6220 */ |
| 6197 List<AnalysisError> getErrors2(Source source) { | 6221 List<AnalysisError> getErrors2(Source source) { |
| 6198 List<AnalysisError> errorsForSource = _errors[source]; | 6222 Set<AnalysisError> errorsForSource = _errors[source]; |
| 6199 if (errorsForSource == null) { | 6223 if (errorsForSource == null) { |
| 6200 return AnalysisError.NO_ERRORS; | 6224 return AnalysisError.NO_ERRORS; |
| 6201 } else { | 6225 } else { |
| 6202 return new List.from(errorsForSource); | 6226 return new List.from(errorsForSource); |
| 6203 } | 6227 } |
| 6204 } | 6228 } |
| 6205 void onError(AnalysisError event) { | 6229 void onError(AnalysisError error) { |
| 6206 Source source = event.source; | 6230 Source source = error.source; |
| 6207 List<AnalysisError> errorsForSource = _errors[source]; | 6231 Set<AnalysisError> errorsForSource = _errors[source]; |
| 6208 if (_errors[source] == null) { | 6232 if (_errors[source] == null) { |
| 6209 errorsForSource = new List<AnalysisError>(); | 6233 errorsForSource = new Set<AnalysisError>(); |
| 6210 _errors[source] = errorsForSource; | 6234 _errors[source] = errorsForSource; |
| 6211 } | 6235 } |
| 6212 errorsForSource.add(event); | 6236 javaSetAdd(errorsForSource, error); |
| 6213 } | 6237 } |
| 6214 } | 6238 } |
| 6215 /** | 6239 /** |
| 6216 * Instances of the class `ResolutionEraser` remove any resolution information f
rom an AST | 6240 * Instances of the class `ResolutionEraser` remove any resolution information f
rom an AST |
| 6217 * structure when used to visit that structure. | 6241 * structure when used to visit that structure. |
| 6218 */ | 6242 */ |
| 6219 class ResolutionEraser extends GeneralizingASTVisitor<Object> { | 6243 class ResolutionEraser extends GeneralizingASTVisitor<Object> { |
| 6220 Object visitAssignmentExpression(AssignmentExpression node) { | 6244 Object visitAssignmentExpression(AssignmentExpression node) { |
| 6221 node.staticElement = null; | 6245 node.staticElement = null; |
| 6222 node.propagatedElement = null; | 6246 node.propagatedElement = null; |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6761 if (source == null) { | 6785 if (source == null) { |
| 6762 return "parse as dart null source"; | 6786 return "parse as dart null source"; |
| 6763 } | 6787 } |
| 6764 return "parse as dart ${source.fullName}"; | 6788 return "parse as dart ${source.fullName}"; |
| 6765 } | 6789 } |
| 6766 void internalPerform() { | 6790 void internalPerform() { |
| 6767 RecordingErrorListener errorListener = new RecordingErrorListener(); | 6791 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 6768 List<Token> token = [null]; | 6792 List<Token> token = [null]; |
| 6769 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); | 6793 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); |
| 6770 try { | 6794 try { |
| 6771 Source_ContentReceiver receiver = new Source_ContentReceiver_9(this, error
Listener, token); | 6795 Source_ContentReceiver receiver = new Source_ContentReceiver_11(this, erro
rListener, token); |
| 6772 try { | 6796 try { |
| 6773 source.getContents(receiver); | 6797 source.getContents(receiver); |
| 6774 } on JavaException catch (exception) { | 6798 } on JavaException catch (exception) { |
| 6775 modificationTime = source.modificationStamp; | 6799 modificationTime = source.modificationStamp; |
| 6776 throw new AnalysisException.con3(exception); | 6800 throw new AnalysisException.con3(exception); |
| 6777 } | 6801 } |
| 6778 } finally { | 6802 } finally { |
| 6779 timeCounterScan.stop(); | 6803 timeCounterScan.stop(); |
| 6780 } | 6804 } |
| 6781 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); | 6805 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6844 * @return an array containing all of the sources in the given set | 6868 * @return an array containing all of the sources in the given set |
| 6845 */ | 6869 */ |
| 6846 List<Source> toArray(Set<Source> sources) { | 6870 List<Source> toArray(Set<Source> sources) { |
| 6847 int size = sources.length; | 6871 int size = sources.length; |
| 6848 if (size == 0) { | 6872 if (size == 0) { |
| 6849 return Source.EMPTY_ARRAY; | 6873 return Source.EMPTY_ARRAY; |
| 6850 } | 6874 } |
| 6851 return new List.from(sources); | 6875 return new List.from(sources); |
| 6852 } | 6876 } |
| 6853 } | 6877 } |
| 6854 class Source_ContentReceiver_9 implements Source_ContentReceiver { | 6878 class Source_ContentReceiver_11 implements Source_ContentReceiver { |
| 6855 final ParseDartTask ParseDartTask_this; | 6879 final ParseDartTask ParseDartTask_this; |
| 6856 RecordingErrorListener errorListener; | 6880 RecordingErrorListener errorListener; |
| 6857 List<Token> token; | 6881 List<Token> token; |
| 6858 Source_ContentReceiver_9(this.ParseDartTask_this, this.errorListener, this.tok
en); | 6882 Source_ContentReceiver_11(this.ParseDartTask_this, this.errorListener, this.to
ken); |
| 6859 void accept(CharBuffer contents, int modificationTime) { | 6883 void accept(CharBuffer contents, int modificationTime) { |
| 6860 ParseDartTask_this.modificationTime = modificationTime; | 6884 ParseDartTask_this.modificationTime = modificationTime; |
| 6861 CharBufferScanner scanner = new CharBufferScanner(ParseDartTask_this.source,
contents, errorListener); | 6885 Scanner scanner = new Scanner(ParseDartTask_this.source, new CharSequenceRea
der(contents), errorListener); |
| 6862 token[0] = scanner.tokenize(); | 6886 token[0] = scanner.tokenize(); |
| 6863 ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts); | 6887 ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts); |
| 6864 } | 6888 } |
| 6865 void accept2(String contents, int modificationTime) { | 6889 void accept2(String contents, int modificationTime) { |
| 6866 ParseDartTask_this.modificationTime = modificationTime; | 6890 ParseDartTask_this.modificationTime = modificationTime; |
| 6867 StringScanner scanner = new StringScanner(ParseDartTask_this.source, content
s, errorListener); | 6891 Scanner scanner = new Scanner(ParseDartTask_this.source, new CharSequenceRea
der(new CharSequence(contents)), errorListener); |
| 6868 token[0] = scanner.tokenize(); | 6892 token[0] = scanner.tokenize(); |
| 6869 ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts); | 6893 ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts); |
| 6870 } | 6894 } |
| 6871 } | 6895 } |
| 6872 /** | 6896 /** |
| 6873 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil
e. | 6897 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil
e. |
| 6874 */ | 6898 */ |
| 6875 class ParseHtmlTask extends AnalysisTask { | 6899 class ParseHtmlTask extends AnalysisTask { |
| 6876 | 6900 |
| 6877 /** | 6901 /** |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6951 referencedLibraries = librarySources; | 6975 referencedLibraries = librarySources; |
| 6952 } | 6976 } |
| 6953 | 6977 |
| 6954 /** | 6978 /** |
| 6955 * Return the sources of libraries that are referenced in the specified HTML f
ile. | 6979 * Return the sources of libraries that are referenced in the specified HTML f
ile. |
| 6956 * | 6980 * |
| 6957 * @return the sources of libraries that are referenced in the HTML file | 6981 * @return the sources of libraries that are referenced in the HTML file |
| 6958 */ | 6982 */ |
| 6959 List<Source> get librarySources { | 6983 List<Source> get librarySources { |
| 6960 List<Source> libraries = new List<Source>(); | 6984 List<Source> libraries = new List<Source>(); |
| 6961 htmlUnit.accept(new RecursiveXmlVisitor_10(this, libraries)); | 6985 htmlUnit.accept(new RecursiveXmlVisitor_12(this, libraries)); |
| 6962 if (libraries.isEmpty) { | 6986 if (libraries.isEmpty) { |
| 6963 return Source.EMPTY_ARRAY; | 6987 return Source.EMPTY_ARRAY; |
| 6964 } | 6988 } |
| 6965 return new List.from(libraries); | 6989 return new List.from(libraries); |
| 6966 } | 6990 } |
| 6967 } | 6991 } |
| 6968 class RecursiveXmlVisitor_10 extends RecursiveXmlVisitor<Object> { | 6992 class RecursiveXmlVisitor_12 extends RecursiveXmlVisitor<Object> { |
| 6969 final ParseHtmlTask ParseHtmlTask_this; | 6993 final ParseHtmlTask ParseHtmlTask_this; |
| 6970 List<Source> libraries; | 6994 List<Source> libraries; |
| 6971 RecursiveXmlVisitor_10(this.ParseHtmlTask_this, this.libraries) : super(); | 6995 RecursiveXmlVisitor_12(this.ParseHtmlTask_this, this.libraries) : super(); |
| 6972 Object visitXmlTagNode(XmlTagNode node) { | 6996 Object visitXmlTagNode(XmlTagNode node) { |
| 6973 if (javaStringEqualsIgnoreCase(node.tag.lexeme, ParseHtmlTask._TAG_SCRIPT))
{ | 6997 if (javaStringEqualsIgnoreCase(node.tag.lexeme, ParseHtmlTask._TAG_SCRIPT))
{ |
| 6974 bool isDartScript = false; | 6998 bool isDartScript = false; |
| 6975 XmlAttributeNode scriptAttribute = null; | 6999 XmlAttributeNode scriptAttribute = null; |
| 6976 for (XmlAttributeNode attribute in node.attributes) { | 7000 for (XmlAttributeNode attribute in node.attributes) { |
| 6977 if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTask._ATT
RIBUTE_SRC)) { | 7001 if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTask._ATT
RIBUTE_SRC)) { |
| 6978 scriptAttribute = attribute; | 7002 scriptAttribute = attribute; |
| 6979 } else if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTa
sk._ATTRIBUTE_TYPE)) { | 7003 } else if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTa
sk._ATTRIBUTE_TYPE)) { |
| 6980 if (javaStringEqualsIgnoreCase(attribute.text, ParseHtmlTask._TYPE_DAR
T)) { | 7004 if (javaStringEqualsIgnoreCase(attribute.text, ParseHtmlTask._TYPE_DAR
T)) { |
| 6981 isDartScript = true; | 7005 isDartScript = true; |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7259 } | 7283 } |
| 7260 void logError2(String message, Exception exception) { | 7284 void logError2(String message, Exception exception) { |
| 7261 } | 7285 } |
| 7262 void logError3(Exception exception) { | 7286 void logError3(Exception exception) { |
| 7263 } | 7287 } |
| 7264 void logInformation(String message) { | 7288 void logInformation(String message) { |
| 7265 } | 7289 } |
| 7266 void logInformation2(String message, Exception exception) { | 7290 void logInformation2(String message, Exception exception) { |
| 7267 } | 7291 } |
| 7268 } | 7292 } |
| OLD | NEW |