| 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 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 } else if (sourceEntry is DartEntry) { | 1205 } else if (sourceEntry is DartEntry) { |
| 1206 return _getDartScanData2(source, SourceEntry.LINE_INFO, null); | 1206 return _getDartScanData2(source, SourceEntry.LINE_INFO, null); |
| 1207 } | 1207 } |
| 1208 } on ObsoleteSourceAnalysisException catch (exception) { | 1208 } on ObsoleteSourceAnalysisException catch (exception) { |
| 1209 AnalysisEngine.instance.logger.logInformation2("Could not compute ${Source
Entry.LINE_INFO.toString()}", exception); | 1209 AnalysisEngine.instance.logger.logInformation2("Could not compute ${Source
Entry.LINE_INFO.toString()}", exception); |
| 1210 } | 1210 } |
| 1211 return null; | 1211 return null; |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 @override | 1214 @override |
| 1215 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) { | 1215 CompilationUnit computeResolvableCompilationUnit(Source source) { |
| 1216 DartEntry dartEntry = _getReadableDartEntry(source); | 1216 DartEntry dartEntry = _getReadableDartEntry(source); |
| 1217 if (dartEntry == null) { | 1217 if (dartEntry == null) { |
| 1218 throw new AnalysisException("computeResolvableCompilationUnit for non-Dart
: ${source.fullName}"); | 1218 throw new AnalysisException("computeResolvableCompilationUnit for non-Dart
: ${source.fullName}"); |
| 1219 } | 1219 } |
| 1220 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); | 1220 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); |
| 1221 CompilationUnit unit = dartEntry.resolvableCompilationUnit; | 1221 CompilationUnit unit = dartEntry.resolvableCompilationUnit; |
| 1222 if (unit == null) { | 1222 if (unit == null) { |
| 1223 throw new AnalysisException("Internal error: computeResolvableCompilationU
nit could not parse ${source.fullName}", new CaughtException(dartEntry.exception
, null)); | 1223 throw new AnalysisException("Internal error: computeResolvableCompilationU
nit could not parse ${source.fullName}", new CaughtException(dartEntry.exception
, null)); |
| 1224 } | 1224 } |
| 1225 return new ResolvableCompilationUnit.con1(dartEntry.modificationTime, unit); | 1225 return unit; |
| 1226 } | 1226 } |
| 1227 | 1227 |
| 1228 @override | 1228 @override |
| 1229 void dispose() { | 1229 void dispose() { |
| 1230 _disposed = true; | 1230 _disposed = true; |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 @override | 1233 @override |
| 1234 bool exists(Source source) { | 1234 bool exists(Source source) { |
| 1235 if (source == null) { | 1235 if (source == null) { |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); | 2128 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); |
| 2129 while (iterator.moveNext()) { | 2129 while (iterator.moveNext()) { |
| 2130 Source source = iterator.key; | 2130 Source source = iterator.key; |
| 2131 if (container.contains(source)) { | 2131 if (container.contains(source)) { |
| 2132 sources.add(source); | 2132 sources.add(source); |
| 2133 } | 2133 } |
| 2134 } | 2134 } |
| 2135 } | 2135 } |
| 2136 | 2136 |
| 2137 /** | 2137 /** |
| 2138 * Return `true` if the modification times of the sources used by the given li
brary resolver | |
| 2139 * to resolve one or more libraries are consistent with the modification times
in the cache. | |
| 2140 * | |
| 2141 * @param resolver the library resolver used to resolve one or more libraries | |
| 2142 * @return `true` if we should record the results of the resolution | |
| 2143 * @throws AnalysisException if any of the modification times could not be det
ermined (this should | |
| 2144 * not happen) | |
| 2145 */ | |
| 2146 bool _allModificationTimesMatch(List<ResolvableLibrary> resolvedLibraries) { | |
| 2147 bool allTimesMatch = true; | |
| 2148 for (ResolvableLibrary library in resolvedLibraries) { | |
| 2149 for (Source source in library.compilationUnitSources) { | |
| 2150 DartEntry dartEntry = _getReadableDartEntry(source); | |
| 2151 if (dartEntry == null) { | |
| 2152 // This shouldn't be possible because we should never have performed t
he task if the | |
| 2153 // source didn't represent a Dart file, but check to be safe. | |
| 2154 throw new AnalysisException("Internal error: attempting to resolve non
-Dart file as a Dart file: ${source.fullName}"); | |
| 2155 } | |
| 2156 int sourceTime = getModificationStamp(source); | |
| 2157 int resultTime = library.getModificationTime(source); | |
| 2158 if (sourceTime != resultTime) { | |
| 2159 // The source has changed without the context being notified. Simulate
notification. | |
| 2160 _sourceChanged(source); | |
| 2161 allTimesMatch = false; | |
| 2162 } | |
| 2163 } | |
| 2164 } | |
| 2165 return allTimesMatch; | |
| 2166 } | |
| 2167 | |
| 2168 /** | |
| 2169 * Return `true` if the modification times of the sources used by the given li
brary resolver | |
| 2170 * to resolve one or more libraries are consistent with the modification times
in the cache. | |
| 2171 * | |
| 2172 * @param resolver the library resolver used to resolve one or more libraries | |
| 2173 * @return `true` if we should record the results of the resolution | |
| 2174 * @throws AnalysisException if any of the modification times could not be det
ermined (this should | |
| 2175 * not happen) | |
| 2176 */ | |
| 2177 bool _allModificationTimesMatch2(Set<Library> resolvedLibraries) { | |
| 2178 bool allTimesMatch = true; | |
| 2179 for (Library library in resolvedLibraries) { | |
| 2180 for (Source source in library.compilationUnitSources) { | |
| 2181 DartEntry dartEntry = _getReadableDartEntry(source); | |
| 2182 if (dartEntry == null) { | |
| 2183 // This shouldn't be possible because we should never have performed t
he task if the | |
| 2184 // source didn't represent a Dart file, but check to be safe. | |
| 2185 throw new AnalysisException("Internal error: attempting to resolve non
-Dart file as a Dart file: ${source.fullName}"); | |
| 2186 } | |
| 2187 int sourceTime = getModificationStamp(source); | |
| 2188 int resultTime = library.getModificationTime(source); | |
| 2189 if (sourceTime != resultTime) { | |
| 2190 // The source has changed without the context being notified. Simulate
notification. | |
| 2191 _sourceChanged(source); | |
| 2192 allTimesMatch = false; | |
| 2193 } | |
| 2194 } | |
| 2195 } | |
| 2196 return allTimesMatch; | |
| 2197 } | |
| 2198 | |
| 2199 /** | |
| 2200 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which | 2138 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which |
| 2201 * the state of the data represented by the given descriptor is either [CacheS
tate.VALID] or | 2139 * the state of the data represented by the given descriptor is either [CacheS
tate.VALID] or |
| 2202 * [CacheState#ERROR]. This method assumes that the data can be produced by ge
nerating hints | 2140 * [CacheState#ERROR]. This method assumes that the data can be produced by ge
nerating hints |
| 2203 * for the library if the data is not already cached. | 2141 * for the library if the data is not already cached. |
| 2204 * | 2142 * |
| 2205 * <b>Note:</b> This method cannot be used in an async environment. | 2143 * <b>Note:</b> This method cannot be used in an async environment. |
| 2206 * | 2144 * |
| 2207 * @param unitSource the source representing the Dart file | 2145 * @param unitSource the source representing the Dart file |
| 2208 * @param librarySource the source representing the library containing the Dar
t file | 2146 * @param librarySource the source representing the library containing the Dar
t file |
| 2209 * @param dartEntry the cache entry associated with the Dart file | 2147 * @param dartEntry the cache entry associated with the Dart file |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2267 // | 2205 // |
| 2268 // Check to see whether we already have the information being requested. | 2206 // Check to see whether we already have the information being requested. |
| 2269 // | 2207 // |
| 2270 CacheState state = dartEntry.getState(descriptor); | 2208 CacheState state = dartEntry.getState(descriptor); |
| 2271 while (state != CacheState.ERROR && state != CacheState.VALID) { | 2209 while (state != CacheState.ERROR && state != CacheState.VALID) { |
| 2272 // | 2210 // |
| 2273 // If not, compute the information. Unless the modification date of the so
urce continues to | 2211 // If not, compute the information. Unless the modification date of the so
urce continues to |
| 2274 // change, this loop will eventually terminate. | 2212 // change, this loop will eventually terminate. |
| 2275 // | 2213 // |
| 2276 dartEntry = _cacheDartScanData(source, dartEntry, DartEntry.TOKEN_STREAM); | 2214 dartEntry = _cacheDartScanData(source, dartEntry, DartEntry.TOKEN_STREAM); |
| 2277 dartEntry = new ParseDartTask(this, source, dartEntry.modificationTime, da
rtEntry.getValue(DartEntry.TOKEN_STREAM), dartEntry.getValue(SourceEntry.LINE_IN
FO)).perform(_resultRecorder) as DartEntry; | 2215 dartEntry = new ParseDartTask(this, source, dartEntry.getValue(DartEntry.T
OKEN_STREAM), dartEntry.getValue(SourceEntry.LINE_INFO)).perform(_resultRecorder
) as DartEntry; |
| 2278 state = dartEntry.getState(descriptor); | 2216 state = dartEntry.getState(descriptor); |
| 2279 } | 2217 } |
| 2280 return dartEntry; | 2218 return dartEntry; |
| 2281 } | 2219 } |
| 2282 | 2220 |
| 2283 /** | 2221 /** |
| 2284 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which | 2222 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which |
| 2285 * the state of the data represented by the given descriptor is either [CacheS
tate.VALID] or | 2223 * the state of the data represented by the given descriptor is either [CacheS
tate.VALID] or |
| 2286 * [CacheState.ERROR]. This method assumes that the data can be produced by re
solving the | 2224 * [CacheState.ERROR]. This method assumes that the data can be produced by re
solving the |
| 2287 * source in the context of the library if it is not already cached. | 2225 * source in the context of the library if it is not already cached. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2334 CacheState state = dartEntry.getState(descriptor); | 2272 CacheState state = dartEntry.getState(descriptor); |
| 2335 while (state != CacheState.ERROR && state != CacheState.VALID) { | 2273 while (state != CacheState.ERROR && state != CacheState.VALID) { |
| 2336 // | 2274 // |
| 2337 // If not, compute the information. Unless the modification date of the so
urce continues to | 2275 // If not, compute the information. Unless the modification date of the so
urce continues to |
| 2338 // change, this loop will eventually terminate. | 2276 // change, this loop will eventually terminate. |
| 2339 // | 2277 // |
| 2340 try { | 2278 try { |
| 2341 if (dartEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { | 2279 if (dartEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { |
| 2342 dartEntry = new GetContentTask(this, source).perform(_resultRecorder)
as DartEntry; | 2280 dartEntry = new GetContentTask(this, source).perform(_resultRecorder)
as DartEntry; |
| 2343 } | 2281 } |
| 2344 dartEntry = new ScanDartTask(this, source, dartEntry.modificationTime, d
artEntry.getValue(SourceEntry.CONTENT)).perform(_resultRecorder) as DartEntry; | 2282 dartEntry = new ScanDartTask(this, source, dartEntry.getValue(SourceEntr
y.CONTENT)).perform(_resultRecorder) as DartEntry; |
| 2345 } on AnalysisException catch (exception) { | 2283 } on AnalysisException catch (exception) { |
| 2346 throw exception; | 2284 throw exception; |
| 2347 } catch (exception, stackTrace) { | 2285 } catch (exception, stackTrace) { |
| 2348 throw new AnalysisException("Exception", new CaughtException(exception,
stackTrace)); | 2286 throw new AnalysisException("Exception", new CaughtException(exception,
stackTrace)); |
| 2349 } | 2287 } |
| 2350 state = dartEntry.getState(descriptor); | 2288 state = dartEntry.getState(descriptor); |
| 2351 } | 2289 } |
| 2352 return dartEntry; | 2290 return dartEntry; |
| 2353 } | 2291 } |
| 2354 | 2292 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2375 while (state != CacheState.ERROR && state != CacheState.VALID) { | 2313 while (state != CacheState.ERROR && state != CacheState.VALID) { |
| 2376 // | 2314 // |
| 2377 // If not, compute the information. Unless the modification date of the so
urce continues to | 2315 // If not, compute the information. Unless the modification date of the so
urce continues to |
| 2378 // change, this loop will eventually terminate. | 2316 // change, this loop will eventually terminate. |
| 2379 // | 2317 // |
| 2380 LibraryElement library = computeLibraryElement(librarySource); | 2318 LibraryElement library = computeLibraryElement(librarySource); |
| 2381 CompilationUnit unit = resolveCompilationUnit(unitSource, library); | 2319 CompilationUnit unit = resolveCompilationUnit(unitSource, library); |
| 2382 if (unit == null) { | 2320 if (unit == null) { |
| 2383 throw new AnalysisException("Could not resolve compilation unit ${unitSo
urce.fullName} in ${librarySource.fullName}"); | 2321 throw new AnalysisException("Could not resolve compilation unit ${unitSo
urce.fullName} in ${librarySource.fullName}"); |
| 2384 } | 2322 } |
| 2385 dartEntry = new GenerateDartErrorsTask(this, unitSource, dartEntry.modific
ationTime, unit, library).perform(_resultRecorder) as DartEntry; | 2323 dartEntry = new GenerateDartErrorsTask(this, unitSource, unit, library).pe
rform(_resultRecorder) as DartEntry; |
| 2386 state = dartEntry.getStateInLibrary(descriptor, librarySource); | 2324 state = dartEntry.getStateInLibrary(descriptor, librarySource); |
| 2387 } | 2325 } |
| 2388 return dartEntry; | 2326 return dartEntry; |
| 2389 } | 2327 } |
| 2390 | 2328 |
| 2391 /** | 2329 /** |
| 2392 * Given a source for an HTML file, return a cache entry in which all of the d
ata represented by | 2330 * Given a source for an HTML file, return a cache entry in which all of the d
ata represented by |
| 2393 * the state of the given descriptors is either [CacheState.VALID] or | 2331 * the state of the given descriptors is either [CacheState.VALID] or |
| 2394 * [CacheState.ERROR]. This method assumes that the data can be produced by pa
rsing the | 2332 * [CacheState.ERROR]. This method assumes that the data can be produced by pa
rsing the |
| 2395 * source if it is not already cached. | 2333 * source if it is not already cached. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2416 CacheState state = htmlEntry.getState(descriptor); | 2354 CacheState state = htmlEntry.getState(descriptor); |
| 2417 while (state != CacheState.ERROR && state != CacheState.VALID) { | 2355 while (state != CacheState.ERROR && state != CacheState.VALID) { |
| 2418 // | 2356 // |
| 2419 // If not, compute the information. Unless the modification date of the so
urce continues to | 2357 // If not, compute the information. Unless the modification date of the so
urce continues to |
| 2420 // change, this loop will eventually terminate. | 2358 // change, this loop will eventually terminate. |
| 2421 // | 2359 // |
| 2422 try { | 2360 try { |
| 2423 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { | 2361 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { |
| 2424 htmlEntry = new GetContentTask(this, source).perform(_resultRecorder)
as HtmlEntry; | 2362 htmlEntry = new GetContentTask(this, source).perform(_resultRecorder)
as HtmlEntry; |
| 2425 } | 2363 } |
| 2426 htmlEntry = new ParseHtmlTask(this, source, htmlEntry.modificationTime,
htmlEntry.getValue(SourceEntry.CONTENT)).perform(_resultRecorder) as HtmlEntry; | 2364 htmlEntry = new ParseHtmlTask(this, source, htmlEntry.getValue(SourceEnt
ry.CONTENT)).perform(_resultRecorder) as HtmlEntry; |
| 2427 } on AnalysisException catch (exception) { | 2365 } on AnalysisException catch (exception) { |
| 2428 throw exception; | 2366 throw exception; |
| 2429 } catch (exception, stackTrace) { | 2367 } catch (exception, stackTrace) { |
| 2430 throw new AnalysisException("Exception", new CaughtException(exception,
stackTrace)); | 2368 throw new AnalysisException("Exception", new CaughtException(exception,
stackTrace)); |
| 2431 } | 2369 } |
| 2432 state = htmlEntry.getState(descriptor); | 2370 state = htmlEntry.getState(descriptor); |
| 2433 } | 2371 } |
| 2434 return htmlEntry; | 2372 return htmlEntry; |
| 2435 } | 2373 } |
| 2436 | 2374 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2555 } | 2493 } |
| 2556 CompilationUnit unit = unitEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT,
librarySource); | 2494 CompilationUnit unit = unitEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT,
librarySource); |
| 2557 if (unit == null) { | 2495 if (unit == null) { |
| 2558 CaughtException exception = new CaughtException(new AnalysisException("Ent
ry has VALID state for RESOLVED_UNIT but null value for ${unitSource.fullName} i
n ${librarySource.fullName}"), null); | 2496 CaughtException exception = new CaughtException(new AnalysisException("Ent
ry has VALID state for RESOLVED_UNIT but null value for ${unitSource.fullName} i
n ${librarySource.fullName}"), null); |
| 2559 AnalysisEngine.instance.logger.logInformation2(exception.toString(), excep
tion); | 2497 AnalysisEngine.instance.logger.logInformation2(exception.toString(), excep
tion); |
| 2560 unitEntry.recordResolutionError(exception); | 2498 unitEntry.recordResolutionError(exception); |
| 2561 return new AnalysisContextImpl_TaskData(null, false); | 2499 return new AnalysisContextImpl_TaskData(null, false); |
| 2562 } | 2500 } |
| 2563 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT); | 2501 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT); |
| 2564 unitEntry.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, Ca
cheState.IN_PROCESS); | 2502 unitEntry.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, Ca
cheState.IN_PROCESS); |
| 2565 return new AnalysisContextImpl_TaskData(new GenerateDartErrorsTask(this, uni
tSource, unitEntry.modificationTime, unit, libraryElement), false); | 2503 return new AnalysisContextImpl_TaskData(new GenerateDartErrorsTask(this, uni
tSource, unit, libraryElement), false); |
| 2566 } | 2504 } |
| 2567 | 2505 |
| 2568 /** | 2506 /** |
| 2569 * Create a [GenerateDartHintsTask] for the given source, marking the hints as
being | 2507 * Create a [GenerateDartHintsTask] for the given source, marking the hints as
being |
| 2570 * in-process. | 2508 * in-process. |
| 2571 * | 2509 * |
| 2572 * @param source the source whose content is to be verified | 2510 * @param source the source whose content is to be verified |
| 2573 * @param dartEntry the entry for the source | 2511 * @param dartEntry the entry for the source |
| 2574 * @param librarySource the source for the library containing the source | 2512 * @param librarySource the source for the library containing the source |
| 2575 * @param libraryEntry the entry for the library | 2513 * @param libraryEntry the entry for the library |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2621 * @param dartEntry the entry for the source | 2559 * @param dartEntry the entry for the source |
| 2622 * @return task data representing the created task | 2560 * @return task data representing the created task |
| 2623 */ | 2561 */ |
| 2624 AnalysisContextImpl_TaskData _createParseDartTask(Source source, DartEntry dar
tEntry) { | 2562 AnalysisContextImpl_TaskData _createParseDartTask(Source source, DartEntry dar
tEntry) { |
| 2625 if (dartEntry.getState(DartEntry.TOKEN_STREAM) != CacheState.VALID || dartEn
try.getState(SourceEntry.LINE_INFO) != CacheState.VALID) { | 2563 if (dartEntry.getState(DartEntry.TOKEN_STREAM) != CacheState.VALID || dartEn
try.getState(SourceEntry.LINE_INFO) != CacheState.VALID) { |
| 2626 return _createScanDartTask(source, dartEntry); | 2564 return _createScanDartTask(source, dartEntry); |
| 2627 } | 2565 } |
| 2628 Token tokenStream = dartEntry.getValue(DartEntry.TOKEN_STREAM); | 2566 Token tokenStream = dartEntry.getValue(DartEntry.TOKEN_STREAM); |
| 2629 dartEntry.setState(DartEntry.TOKEN_STREAM, CacheState.FLUSHED); | 2567 dartEntry.setState(DartEntry.TOKEN_STREAM, CacheState.FLUSHED); |
| 2630 dartEntry.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS); | 2568 dartEntry.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS); |
| 2631 return new AnalysisContextImpl_TaskData(new ParseDartTask(this, source, dart
Entry.modificationTime, tokenStream, dartEntry.getValue(SourceEntry.LINE_INFO)),
false); | 2569 return new AnalysisContextImpl_TaskData(new ParseDartTask(this, source, toke
nStream, dartEntry.getValue(SourceEntry.LINE_INFO)), false); |
| 2632 } | 2570 } |
| 2633 | 2571 |
| 2634 /** | 2572 /** |
| 2635 * Create a [ParseHtmlTask] for the given source, marking the parse errors as
being | 2573 * Create a [ParseHtmlTask] for the given source, marking the parse errors as
being |
| 2636 * in-process. | 2574 * in-process. |
| 2637 * | 2575 * |
| 2638 * @param source the source whose content is to be parsed | 2576 * @param source the source whose content is to be parsed |
| 2639 * @param htmlEntry the entry for the source | 2577 * @param htmlEntry the entry for the source |
| 2640 * @return task data representing the created task | 2578 * @return task data representing the created task |
| 2641 */ | 2579 */ |
| 2642 AnalysisContextImpl_TaskData _createParseHtmlTask(Source source, HtmlEntry htm
lEntry) { | 2580 AnalysisContextImpl_TaskData _createParseHtmlTask(Source source, HtmlEntry htm
lEntry) { |
| 2643 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { | 2581 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { |
| 2644 return _createGetContentTask(source, htmlEntry); | 2582 return _createGetContentTask(source, htmlEntry); |
| 2645 } | 2583 } |
| 2646 String content = htmlEntry.getValue(SourceEntry.CONTENT); | 2584 String content = htmlEntry.getValue(SourceEntry.CONTENT); |
| 2647 htmlEntry.setState(SourceEntry.CONTENT, CacheState.FLUSHED); | 2585 htmlEntry.setState(SourceEntry.CONTENT, CacheState.FLUSHED); |
| 2648 htmlEntry.setState(HtmlEntry.PARSE_ERRORS, CacheState.IN_PROCESS); | 2586 htmlEntry.setState(HtmlEntry.PARSE_ERRORS, CacheState.IN_PROCESS); |
| 2649 return new AnalysisContextImpl_TaskData(new ParseHtmlTask(this, source, html
Entry.modificationTime, content), false); | 2587 return new AnalysisContextImpl_TaskData(new ParseHtmlTask(this, source, cont
ent), false); |
| 2650 } | 2588 } |
| 2651 | 2589 |
| 2652 /** | 2590 /** |
| 2653 * Create a [PolymerBuildHtmlTask] for the given source, marking the Polymer e
lements as | 2591 * Create a [PolymerBuildHtmlTask] for the given source, marking the Polymer e
lements as |
| 2654 * being in-process. | 2592 * being in-process. |
| 2655 * | 2593 * |
| 2656 * @param source the source whose content is to be processed | 2594 * @param source the source whose content is to be processed |
| 2657 * @param htmlEntry the entry for the source | 2595 * @param htmlEntry the entry for the source |
| 2658 * @return task data representing the created task | 2596 * @return task data representing the created task |
| 2659 */ | 2597 */ |
| 2660 AnalysisContextImpl_TaskData _createPolymerBuildHtmlTask(Source source, HtmlEn
try htmlEntry) { | 2598 AnalysisContextImpl_TaskData _createPolymerBuildHtmlTask(Source source, HtmlEn
try htmlEntry) { |
| 2661 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { | 2599 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { |
| 2662 return _createResolveHtmlTask(source, htmlEntry); | 2600 return _createResolveHtmlTask(source, htmlEntry); |
| 2663 } | 2601 } |
| 2664 htmlEntry.setState(HtmlEntry.POLYMER_BUILD_ERRORS, CacheState.IN_PROCESS); | 2602 htmlEntry.setState(HtmlEntry.POLYMER_BUILD_ERRORS, CacheState.IN_PROCESS); |
| 2665 return new AnalysisContextImpl_TaskData(new PolymerBuildHtmlTask(this, sourc
e, htmlEntry.modificationTime, htmlEntry.getValue(SourceEntry.LINE_INFO), htmlEn
try.getValue(HtmlEntry.RESOLVED_UNIT)), false); | 2603 return new AnalysisContextImpl_TaskData(new PolymerBuildHtmlTask(this, sourc
e, htmlEntry.getValue(SourceEntry.LINE_INFO), htmlEntry.getValue(HtmlEntry.RESOL
VED_UNIT)), false); |
| 2666 } | 2604 } |
| 2667 | 2605 |
| 2668 /** | 2606 /** |
| 2669 * Create a [PolymerResolveHtmlTask] for the given source, marking the Polymer
errors as | 2607 * Create a [PolymerResolveHtmlTask] for the given source, marking the Polymer
errors as |
| 2670 * being in-process. | 2608 * being in-process. |
| 2671 * | 2609 * |
| 2672 * @param source the source whose content is to be resolved | 2610 * @param source the source whose content is to be resolved |
| 2673 * @param htmlEntry the entry for the source | 2611 * @param htmlEntry the entry for the source |
| 2674 * @return task data representing the created task | 2612 * @return task data representing the created task |
| 2675 */ | 2613 */ |
| 2676 AnalysisContextImpl_TaskData _createPolymerResolveHtmlTask(Source source, Html
Entry htmlEntry) { | 2614 AnalysisContextImpl_TaskData _createPolymerResolveHtmlTask(Source source, Html
Entry htmlEntry) { |
| 2677 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { | 2615 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { |
| 2678 return _createResolveHtmlTask(source, htmlEntry); | 2616 return _createResolveHtmlTask(source, htmlEntry); |
| 2679 } | 2617 } |
| 2680 htmlEntry.setState(HtmlEntry.POLYMER_RESOLUTION_ERRORS, CacheState.IN_PROCES
S); | 2618 htmlEntry.setState(HtmlEntry.POLYMER_RESOLUTION_ERRORS, CacheState.IN_PROCES
S); |
| 2681 return new AnalysisContextImpl_TaskData(new PolymerResolveHtmlTask(this, sou
rce, htmlEntry.modificationTime, htmlEntry.getValue(SourceEntry.LINE_INFO), html
Entry.getValue(HtmlEntry.RESOLVED_UNIT)), false); | 2619 return new AnalysisContextImpl_TaskData(new PolymerResolveHtmlTask(this, sou
rce, htmlEntry.getValue(SourceEntry.LINE_INFO), htmlEntry.getValue(HtmlEntry.RES
OLVED_UNIT)), false); |
| 2682 } | 2620 } |
| 2683 | 2621 |
| 2684 /** | 2622 /** |
| 2685 * Create a [ResolveAngularComponentTemplateTask] for the given source, markin
g the angular | 2623 * Create a [ResolveAngularComponentTemplateTask] for the given source, markin
g the angular |
| 2686 * errors as being in-process. | 2624 * errors as being in-process. |
| 2687 * | 2625 * |
| 2688 * @param source the source whose content is to be resolved | 2626 * @param source the source whose content is to be resolved |
| 2689 * @param htmlEntry the entry for the source | 2627 * @param htmlEntry the entry for the source |
| 2690 * @return task data representing the created task | 2628 * @return task data representing the created task |
| 2691 */ | 2629 */ |
| 2692 AnalysisContextImpl_TaskData _createResolveAngularComponentTemplateTask(Source
source, HtmlEntry htmlEntry) { | 2630 AnalysisContextImpl_TaskData _createResolveAngularComponentTemplateTask(Source
source, HtmlEntry htmlEntry) { |
| 2693 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { | 2631 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { |
| 2694 return _createResolveHtmlTask(source, htmlEntry); | 2632 return _createResolveHtmlTask(source, htmlEntry); |
| 2695 } | 2633 } |
| 2696 AngularApplication application = htmlEntry.getValue(HtmlEntry.ANGULAR_APPLIC
ATION); | 2634 AngularApplication application = htmlEntry.getValue(HtmlEntry.ANGULAR_APPLIC
ATION); |
| 2697 AngularComponentElement component = htmlEntry.getValue(HtmlEntry.ANGULAR_COM
PONENT); | 2635 AngularComponentElement component = htmlEntry.getValue(HtmlEntry.ANGULAR_COM
PONENT); |
| 2698 htmlEntry.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.IN_PROCESS); | 2636 htmlEntry.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.IN_PROCESS); |
| 2699 return new AnalysisContextImpl_TaskData(new ResolveAngularComponentTemplateT
ask(this, source, htmlEntry.modificationTime, htmlEntry.getValue(HtmlEntry.RESOL
VED_UNIT), component, application), false); | 2637 return new AnalysisContextImpl_TaskData(new ResolveAngularComponentTemplateT
ask(this, source, htmlEntry.getValue(HtmlEntry.RESOLVED_UNIT), component, applic
ation), false); |
| 2700 } | 2638 } |
| 2701 | 2639 |
| 2702 /** | 2640 /** |
| 2703 * Create a [ResolveAngularEntryHtmlTask] for the given source, marking the an
gular entry as | 2641 * Create a [ResolveAngularEntryHtmlTask] for the given source, marking the an
gular entry as |
| 2704 * being in-process. | 2642 * being in-process. |
| 2705 * | 2643 * |
| 2706 * @param source the source whose content is to be resolved | 2644 * @param source the source whose content is to be resolved |
| 2707 * @param htmlEntry the entry for the source | 2645 * @param htmlEntry the entry for the source |
| 2708 * @return task data representing the created task | 2646 * @return task data representing the created task |
| 2709 */ | 2647 */ |
| 2710 AnalysisContextImpl_TaskData _createResolveAngularEntryHtmlTask(Source source,
HtmlEntry htmlEntry) { | 2648 AnalysisContextImpl_TaskData _createResolveAngularEntryHtmlTask(Source source,
HtmlEntry htmlEntry) { |
| 2711 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { | 2649 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { |
| 2712 return _createResolveHtmlTask(source, htmlEntry); | 2650 return _createResolveHtmlTask(source, htmlEntry); |
| 2713 } | 2651 } |
| 2714 htmlEntry.setState(HtmlEntry.ANGULAR_ENTRY, CacheState.IN_PROCESS); | 2652 htmlEntry.setState(HtmlEntry.ANGULAR_ENTRY, CacheState.IN_PROCESS); |
| 2715 return new AnalysisContextImpl_TaskData(new ResolveAngularEntryHtmlTask(this
, source, htmlEntry.modificationTime, htmlEntry.getValue(HtmlEntry.RESOLVED_UNIT
)), false); | 2653 return new AnalysisContextImpl_TaskData(new ResolveAngularEntryHtmlTask(this
, source, htmlEntry.getValue(HtmlEntry.RESOLVED_UNIT)), false); |
| 2716 } | 2654 } |
| 2717 | 2655 |
| 2718 /** | 2656 /** |
| 2719 * Create a [ResolveDartLibraryTask] for the given source, marking ? as being
in-process. | 2657 * Create a [ResolveDartLibraryTask] for the given source, marking ? as being
in-process. |
| 2720 * | 2658 * |
| 2721 * @param source the source whose content is to be resolved | 2659 * @param source the source whose content is to be resolved |
| 2722 * @param dartEntry the entry for the source | 2660 * @param dartEntry the entry for the source |
| 2723 * @return task data representing the created task | 2661 * @return task data representing the created task |
| 2724 */ | 2662 */ |
| 2725 AnalysisContextImpl_TaskData _createResolveDartLibraryTask(Source source, Dart
Entry dartEntry) { | 2663 AnalysisContextImpl_TaskData _createResolveDartLibraryTask(Source source, Dart
Entry dartEntry) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2762 * @param dartEntry the entry for the source | 2700 * @param dartEntry the entry for the source |
| 2763 * @return task data representing the created task | 2701 * @return task data representing the created task |
| 2764 */ | 2702 */ |
| 2765 AnalysisContextImpl_TaskData _createScanDartTask(Source source, DartEntry dart
Entry) { | 2703 AnalysisContextImpl_TaskData _createScanDartTask(Source source, DartEntry dart
Entry) { |
| 2766 if (dartEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { | 2704 if (dartEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { |
| 2767 return _createGetContentTask(source, dartEntry); | 2705 return _createGetContentTask(source, dartEntry); |
| 2768 } | 2706 } |
| 2769 String content = dartEntry.getValue(SourceEntry.CONTENT); | 2707 String content = dartEntry.getValue(SourceEntry.CONTENT); |
| 2770 dartEntry.setState(SourceEntry.CONTENT, CacheState.FLUSHED); | 2708 dartEntry.setState(SourceEntry.CONTENT, CacheState.FLUSHED); |
| 2771 dartEntry.setState(DartEntry.SCAN_ERRORS, CacheState.IN_PROCESS); | 2709 dartEntry.setState(DartEntry.SCAN_ERRORS, CacheState.IN_PROCESS); |
| 2772 return new AnalysisContextImpl_TaskData(new ScanDartTask(this, source, dartE
ntry.modificationTime, content), false); | 2710 return new AnalysisContextImpl_TaskData(new ScanDartTask(this, source, conte
nt), false); |
| 2773 } | 2711 } |
| 2774 | 2712 |
| 2775 /** | 2713 /** |
| 2776 * Create a source information object suitable for the given source. Return th
e source information | 2714 * Create a source information object suitable for the given source. Return th
e source information |
| 2777 * object that was created, or `null` if the source should not be tracked by t
his context. | 2715 * object that was created, or `null` if the source should not be tracked by t
his context. |
| 2778 * | 2716 * |
| 2779 * @param source the source for which an information object is being created | 2717 * @param source the source for which an information object is being created |
| 2780 * @param explicitlyAdded `true` if the source was explicitly added to the con
text | 2718 * @param explicitlyAdded `true` if the source was explicitly added to the con
text |
| 2781 * @return the source information object that was created | 2719 * @return the source information object that was created |
| 2782 */ | 2720 */ |
| (...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3910 } | 3848 } |
| 3911 | 3849 |
| 3912 /** | 3850 /** |
| 3913 * Record the results produced by performing a [task] and return the cache | 3851 * Record the results produced by performing a [task] and return the cache |
| 3914 * entry associated with the results. | 3852 * entry associated with the results. |
| 3915 */ | 3853 */ |
| 3916 DartEntry _recordGenerateDartHintsTask(GenerateDartHintsTask task) { | 3854 DartEntry _recordGenerateDartHintsTask(GenerateDartHintsTask task) { |
| 3917 Source librarySource = task.libraryElement.source; | 3855 Source librarySource = task.libraryElement.source; |
| 3918 CaughtException thrownException = task.exception; | 3856 CaughtException thrownException = task.exception; |
| 3919 DartEntry libraryEntry = null; | 3857 DartEntry libraryEntry = null; |
| 3920 HashMap<Source, TimestampedData<List<AnalysisError>>> hintMap = task.hintMap
; | 3858 HashMap<Source, List<AnalysisError>> hintMap = task.hintMap; |
| 3921 if (hintMap == null) { | 3859 if (hintMap == null) { |
| 3922 // We don't have any information about which sources to mark as invalid | 3860 // We don't have any information about which sources to mark as invalid |
| 3923 // other than the library source. | 3861 // other than the library source. |
| 3924 DartEntry libraryEntry = _cache.get(librarySource); | 3862 DartEntry libraryEntry = _cache.get(librarySource); |
| 3925 if (thrownException == null) { | 3863 if (thrownException == null) { |
| 3926 String message = "GenerateDartHintsTask returned a null hint map " | 3864 String message = "GenerateDartHintsTask returned a null hint map " |
| 3927 "without throwing an exception: ${librarySource.fullName}"; | 3865 "without throwing an exception: ${librarySource.fullName}"; |
| 3928 thrownException = new CaughtException(new AnalysisException(message), nu
ll); | 3866 thrownException = new CaughtException(new AnalysisException(message), nu
ll); |
| 3929 } | 3867 } |
| 3930 libraryEntry.recordHintErrorInLibrary(librarySource, thrownException); | 3868 libraryEntry.recordHintErrorInLibrary(librarySource, thrownException); |
| 3931 throw new AnalysisException('<rethrow>', thrownException); | 3869 throw new AnalysisException('<rethrow>', thrownException); |
| 3932 } | 3870 } |
| 3933 hintMap.forEach((Source unitSource, TimestampedData<List<AnalysisError>> res
ults) { | 3871 hintMap.forEach((Source unitSource, List<AnalysisError> hints) { |
| 3934 DartEntry dartEntry = _cache.get(unitSource); | 3872 DartEntry dartEntry = _cache.get(unitSource); |
| 3935 if (unitSource == librarySource) { | 3873 if (unitSource == librarySource) { |
| 3936 libraryEntry = dartEntry; | 3874 libraryEntry = dartEntry; |
| 3937 } | 3875 } |
| 3938 if (thrownException == null) { | 3876 if (thrownException == null) { |
| 3939 dartEntry.setValueInLibrary(DartEntry.HINTS, librarySource, results.data
); | 3877 dartEntry.setValueInLibrary(DartEntry.HINTS, librarySource, hints); |
| 3940 ChangeNoticeImpl notice = _getNotice(unitSource); | 3878 ChangeNoticeImpl notice = _getNotice(unitSource); |
| 3941 LineInfo lineInfo = dartEntry.getValue(SourceEntry.LINE_INFO); | 3879 LineInfo lineInfo = dartEntry.getValue(SourceEntry.LINE_INFO); |
| 3942 notice.setErrors(dartEntry.allErrors, lineInfo); | 3880 notice.setErrors(dartEntry.allErrors, lineInfo); |
| 3943 } else { | 3881 } else { |
| 3944 dartEntry.recordHintErrorInLibrary(librarySource, thrownException); | 3882 dartEntry.recordHintErrorInLibrary(librarySource, thrownException); |
| 3945 } | 3883 } |
| 3946 }); | 3884 }); |
| 3947 if (thrownException != null) { | 3885 if (thrownException != null) { |
| 3948 throw new AnalysisException('<rethrow>', thrownException); | 3886 throw new AnalysisException('<rethrow>', thrownException); |
| 3949 } | 3887 } |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4800 */ | 4738 */ |
| 4801 void _computePartsInLibrary(CycleBuilder_LibraryPair libraryPair) { | 4739 void _computePartsInLibrary(CycleBuilder_LibraryPair libraryPair) { |
| 4802 ResolvableLibrary library = libraryPair.library; | 4740 ResolvableLibrary library = libraryPair.library; |
| 4803 List<CycleBuilder_SourceEntryPair> entryPairs = libraryPair.entryPairs; | 4741 List<CycleBuilder_SourceEntryPair> entryPairs = libraryPair.entryPairs; |
| 4804 int count = entryPairs.length; | 4742 int count = entryPairs.length; |
| 4805 List<ResolvableCompilationUnit> units = new List<ResolvableCompilationUnit>(
count); | 4743 List<ResolvableCompilationUnit> units = new List<ResolvableCompilationUnit>(
count); |
| 4806 for (int i = 0; i < count; i++) { | 4744 for (int i = 0; i < count; i++) { |
| 4807 CycleBuilder_SourceEntryPair entryPair = entryPairs[i]; | 4745 CycleBuilder_SourceEntryPair entryPair = entryPairs[i]; |
| 4808 Source source = entryPair.source; | 4746 Source source = entryPair.source; |
| 4809 DartEntry dartEntry = entryPair.entry; | 4747 DartEntry dartEntry = entryPair.entry; |
| 4810 units[i] = new ResolvableCompilationUnit.con2(dartEntry.modificationTime,
dartEntry.resolvableCompilationUnit, source); | 4748 units[i] = new ResolvableCompilationUnit(source, dartEntry.resolvableCompi
lationUnit); |
| 4811 } | 4749 } |
| 4812 library.resolvableCompilationUnits = units; | 4750 library.resolvableCompilationUnits = units; |
| 4813 } | 4751 } |
| 4814 | 4752 |
| 4815 /** | 4753 /** |
| 4816 * Create an object to represent the information about the library defined by
the compilation | 4754 * Create an object to represent the information about the library defined by
the compilation |
| 4817 * unit with the given source. | 4755 * unit with the given source. |
| 4818 * | 4756 * |
| 4819 * @param librarySource the source of the library's defining compilation unit | 4757 * @param librarySource the source of the library's defining compilation unit |
| 4820 * @return the library object that was created | 4758 * @return the library object that was created |
| (...skipping 4439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9260 StringLiteral uriLiteral = directive.uri; | 9198 StringLiteral uriLiteral = directive.uri; |
| 9261 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.offse
t, uriLiteral.length, CompileTimeErrorCode.URI_DOES_NOT_EXIST, [directive.uriCon
tent])); | 9199 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.offse
t, uriLiteral.length, CompileTimeErrorCode.URI_DOES_NOT_EXIST, [directive.uriCon
tent])); |
| 9262 } | 9200 } |
| 9263 | 9201 |
| 9264 /** | 9202 /** |
| 9265 * The source for which errors and warnings are to be produced. | 9203 * The source for which errors and warnings are to be produced. |
| 9266 */ | 9204 */ |
| 9267 final Source source; | 9205 final Source source; |
| 9268 | 9206 |
| 9269 /** | 9207 /** |
| 9270 * The time at which the contents of the source were last modified. | |
| 9271 */ | |
| 9272 final int modificationTime; | |
| 9273 | |
| 9274 /** | |
| 9275 * The compilation unit used to resolve the dependencies. | 9208 * The compilation unit used to resolve the dependencies. |
| 9276 */ | 9209 */ |
| 9277 final CompilationUnit _unit; | 9210 final CompilationUnit _unit; |
| 9278 | 9211 |
| 9279 /** | 9212 /** |
| 9280 * The element model for the library containing the source. | 9213 * The element model for the library containing the source. |
| 9281 */ | 9214 */ |
| 9282 final LibraryElement libraryElement; | 9215 final LibraryElement libraryElement; |
| 9283 | 9216 |
| 9284 /** | 9217 /** |
| 9285 * The errors that were generated for the source. | 9218 * The errors that were generated for the source. |
| 9286 */ | 9219 */ |
| 9287 List<AnalysisError> _errors; | 9220 List<AnalysisError> _errors; |
| 9288 | 9221 |
| 9289 /** | 9222 /** |
| 9290 * Initialize a newly created task to perform analysis within the given contex
t. | 9223 * Initialize a newly created task to perform analysis within the given contex
t. |
| 9291 * | 9224 * |
| 9292 * @param context the context in which the task is to be performed | 9225 * @param context the context in which the task is to be performed |
| 9293 * @param source the source for which errors and warnings are to be produced | 9226 * @param source the source for which errors and warnings are to be produced |
| 9294 * @param modificationTime the time at which the contents of the source were l
ast modified | |
| 9295 * @param unit the compilation unit used to resolve the dependencies | 9227 * @param unit the compilation unit used to resolve the dependencies |
| 9296 * @param libraryElement the element model for the library containing the sour
ce | 9228 * @param libraryElement the element model for the library containing the sour
ce |
| 9297 */ | 9229 */ |
| 9298 GenerateDartErrorsTask(InternalAnalysisContext context, this.source, this.modi
ficationTime, this._unit, this.libraryElement) : super(context); | 9230 GenerateDartErrorsTask(InternalAnalysisContext context, this.source, this._uni
t, this.libraryElement) : super(context); |
| 9299 | 9231 |
| 9300 @override | 9232 @override |
| 9301 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartErrorsTask(thi
s); | 9233 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartErrorsTask(thi
s); |
| 9302 | 9234 |
| 9303 /** | 9235 /** |
| 9304 * Return the errors that were generated for the source. | 9236 * Return the errors that were generated for the source. |
| 9305 * | 9237 * |
| 9306 * @return the errors that were generated for the source | 9238 * @return the errors that were generated for the source |
| 9307 */ | 9239 */ |
| 9308 List<AnalysisError> get errors => _errors; | 9240 List<AnalysisError> get errors => _errors; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9348 * first in the array. | 9280 * first in the array. |
| 9349 */ | 9281 */ |
| 9350 final List<TimestampedData<CompilationUnit>> _units; | 9282 final List<TimestampedData<CompilationUnit>> _units; |
| 9351 | 9283 |
| 9352 /** | 9284 /** |
| 9353 * The element model for the library being analyzed. | 9285 * The element model for the library being analyzed. |
| 9354 */ | 9286 */ |
| 9355 final LibraryElement libraryElement; | 9287 final LibraryElement libraryElement; |
| 9356 | 9288 |
| 9357 /** | 9289 /** |
| 9358 * A table mapping the sources that were analyzed to the hints that were gener
ated for the | 9290 * A table mapping the sources that were analyzed to the hints that were |
| 9359 * sources. | 9291 * generated for the sources. |
| 9360 */ | 9292 */ |
| 9361 HashMap<Source, TimestampedData<List<AnalysisError>>> _hintMap; | 9293 HashMap<Source, List<AnalysisError>> _hintMap; |
| 9362 | 9294 |
| 9363 /** | 9295 /** |
| 9364 * Initialize a newly created task to perform analysis within the given contex
t. | 9296 * Initialize a newly created task to perform analysis within the given contex
t. |
| 9365 * | 9297 * |
| 9366 * @param context the context in which the task is to be performed | 9298 * @param context the context in which the task is to be performed |
| 9367 * @param units the compilation units that comprise the library, with the defi
ning compilation | 9299 * @param units the compilation units that comprise the library, with the defi
ning compilation |
| 9368 * unit appearing first in the array | 9300 * unit appearing first in the array |
| 9369 * @param libraryElement the element model for the library being analyzed | 9301 * @param libraryElement the element model for the library being analyzed |
| 9370 */ | 9302 */ |
| 9371 GenerateDartHintsTask(InternalAnalysisContext context, this._units, this.libra
ryElement) : super(context); | 9303 GenerateDartHintsTask(InternalAnalysisContext context, this._units, this.libra
ryElement) : super(context); |
| 9372 | 9304 |
| 9373 @override | 9305 @override |
| 9374 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartHintsTask(this
); | 9306 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartHintsTask(this
); |
| 9375 | 9307 |
| 9376 /** | 9308 /** |
| 9377 * Return a table mapping the sources that were analyzed to the hints that wer
e generated for the | 9309 * Return a table mapping the sources that were analyzed to the hints that wer
e generated for the |
| 9378 * sources, or `null` if the task has not been performed or if the analysis di
d not complete | 9310 * sources, or `null` if the task has not been performed or if the analysis di
d not complete |
| 9379 * normally. | 9311 * normally. |
| 9380 * | 9312 * |
| 9381 * @return a table mapping the sources that were analyzed to the hints that we
re generated for the | 9313 * @return a table mapping the sources that were analyzed to the hints that we
re generated for the |
| 9382 * sources | 9314 * sources |
| 9383 */ | 9315 */ |
| 9384 HashMap<Source, TimestampedData<List<AnalysisError>>> get hintMap => _hintMap; | 9316 HashMap<Source, List<AnalysisError>> get hintMap => _hintMap; |
| 9385 | 9317 |
| 9386 @override | 9318 @override |
| 9387 String get taskDescription { | 9319 String get taskDescription { |
| 9388 Source librarySource = libraryElement.source; | 9320 Source librarySource = libraryElement.source; |
| 9389 if (librarySource == null) { | 9321 if (librarySource == null) { |
| 9390 return "generate Dart hints for library without source"; | 9322 return "generate Dart hints for library without source"; |
| 9391 } | 9323 } |
| 9392 return "generate Dart hints for ${librarySource.fullName}"; | 9324 return "generate Dart hints for ${librarySource.fullName}"; |
| 9393 } | 9325 } |
| 9394 | 9326 |
| 9395 @override | 9327 @override |
| 9396 void internalPerform() { | 9328 void internalPerform() { |
| 9397 // | 9329 // |
| 9398 // Gather the compilation units. | 9330 // Gather the compilation units. |
| 9399 // | 9331 // |
| 9400 int unitCount = _units.length; | 9332 int unitCount = _units.length; |
| 9401 List<CompilationUnit> compilationUnits = new List<CompilationUnit>(unitCount
); | 9333 List<CompilationUnit> compilationUnits = new List<CompilationUnit>(unitCount
); |
| 9402 for (int i = 0; i < unitCount; i++) { | 9334 for (int i = 0; i < unitCount; i++) { |
| 9403 compilationUnits[i] = _units[i].data; | 9335 compilationUnits[i] = _units[i].data; |
| 9404 } | 9336 } |
| 9405 // | 9337 // |
| 9406 // Analyze all of the units. | 9338 // Analyze all of the units. |
| 9407 // | 9339 // |
| 9408 RecordingErrorListener errorListener = new RecordingErrorListener(); | 9340 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 9409 HintGenerator hintGenerator = new HintGenerator(compilationUnits, context, e
rrorListener); | 9341 HintGenerator hintGenerator = new HintGenerator(compilationUnits, context, e
rrorListener); |
| 9410 hintGenerator.generateForLibrary(); | 9342 hintGenerator.generateForLibrary(); |
| 9411 // | 9343 // |
| 9412 // Store the results. | 9344 // Store the results. |
| 9413 // | 9345 // |
| 9414 _hintMap = new HashMap<Source, TimestampedData<List<AnalysisError>>>(); | 9346 _hintMap = new HashMap<Source, List<AnalysisError>>(); |
| 9415 for (int i = 0; i < unitCount; i++) { | 9347 for (int i = 0; i < unitCount; i++) { |
| 9416 int modificationTime = _units[i].modificationTime; | |
| 9417 Source source = _units[i].data.element.source; | 9348 Source source = _units[i].data.element.source; |
| 9418 List<AnalysisError> errors = errorListener.getErrorsForSource(source); | 9349 _hintMap[source] = errorListener.getErrorsForSource(source); |
| 9419 _hintMap[source] = new TimestampedData<List<AnalysisError>>(modificationTi
me, errors); | |
| 9420 } | 9350 } |
| 9421 } | 9351 } |
| 9422 } | 9352 } |
| 9423 | 9353 |
| 9424 /** | 9354 /** |
| 9425 * Instances of the class `GetContentTask` get the contents of a source. | 9355 * Instances of the class `GetContentTask` get the contents of a source. |
| 9426 */ | 9356 */ |
| 9427 class GetContentTask extends AnalysisTask { | 9357 class GetContentTask extends AnalysisTask { |
| 9428 /** | 9358 /** |
| 9429 * The source to be read. | 9359 * The source to be read. |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10549 return _basis.computeLineInfo(source); | 10479 return _basis.computeLineInfo(source); |
| 10550 } on AnalysisException catch (e, stackTrace) { | 10480 } on AnalysisException catch (e, stackTrace) { |
| 10551 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); | 10481 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); |
| 10552 throw e; | 10482 throw e; |
| 10553 } finally { | 10483 } finally { |
| 10554 instrumentation.log(); | 10484 instrumentation.log(); |
| 10555 } | 10485 } |
| 10556 } | 10486 } |
| 10557 | 10487 |
| 10558 @override | 10488 @override |
| 10559 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) => _
basis.computeResolvableCompilationUnit(source); | 10489 CompilationUnit computeResolvableCompilationUnit(Source source) |
| 10490 => _basis.computeResolvableCompilationUnit(source); |
| 10560 | 10491 |
| 10561 @override | 10492 @override |
| 10562 void dispose() { | 10493 void dispose() { |
| 10563 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
dispose"); | 10494 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
dispose"); |
| 10564 _checkThread(instrumentation); | 10495 _checkThread(instrumentation); |
| 10565 try { | 10496 try { |
| 10566 instrumentation.metric3("contextId", _contextId); | 10497 instrumentation.metric3("contextId", _contextId); |
| 10567 _basis.dispose(); | 10498 _basis.dispose(); |
| 10568 } finally { | 10499 } finally { |
| 10569 instrumentation.log(); | 10500 instrumentation.log(); |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11175 * Return an AST structure corresponding to the given source, but ensure that
the structure has | 11106 * Return an AST structure corresponding to the given source, but ensure that
the structure has |
| 11176 * not already been resolved and will not be resolved by any other threads or
in any other | 11107 * not already been resolved and will not be resolved by any other threads or
in any other |
| 11177 * library. | 11108 * library. |
| 11178 * | 11109 * |
| 11179 * <b>Note:</b> This method cannot be used in an async environment | 11110 * <b>Note:</b> This method cannot be used in an async environment |
| 11180 * | 11111 * |
| 11181 * @param source the compilation unit for which an AST structure should be ret
urned | 11112 * @param source the compilation unit for which an AST structure should be ret
urned |
| 11182 * @return the AST structure representing the content of the source | 11113 * @return the AST structure representing the content of the source |
| 11183 * @throws AnalysisException if the analysis could not be performed | 11114 * @throws AnalysisException if the analysis could not be performed |
| 11184 */ | 11115 */ |
| 11185 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source); | 11116 CompilationUnit computeResolvableCompilationUnit(Source source); |
| 11186 | 11117 |
| 11187 /** | 11118 /** |
| 11188 * Return context that owns the given source. | 11119 * Return context that owns the given source. |
| 11189 * | 11120 * |
| 11190 * @param source the source whose context is to be returned | 11121 * @param source the source whose context is to be returned |
| 11191 * @return the context that owns the partition that contains the source | 11122 * @return the context that owns the partition that contains the source |
| 11192 */ | 11123 */ |
| 11193 InternalAnalysisContext getContextFor(Source source); | 11124 InternalAnalysisContext getContextFor(Source source); |
| 11194 | 11125 |
| 11195 /** | 11126 /** |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11609 } | 11540 } |
| 11610 throw new RuntimeException(message: "Failed to handle validation code: ${cod
e}"); | 11541 throw new RuntimeException(message: "Failed to handle validation code: ${cod
e}"); |
| 11611 } | 11542 } |
| 11612 | 11543 |
| 11613 /** | 11544 /** |
| 11614 * The source to be parsed. | 11545 * The source to be parsed. |
| 11615 */ | 11546 */ |
| 11616 final Source source; | 11547 final Source source; |
| 11617 | 11548 |
| 11618 /** | 11549 /** |
| 11619 * The time at which the contents of the source were last modified. | |
| 11620 */ | |
| 11621 final int modificationTime; | |
| 11622 | |
| 11623 /** | |
| 11624 * The head of the token stream used for parsing. | 11550 * The head of the token stream used for parsing. |
| 11625 */ | 11551 */ |
| 11626 final Token _tokenStream; | 11552 final Token _tokenStream; |
| 11627 | 11553 |
| 11628 /** | 11554 /** |
| 11629 * The line information associated with the source. | 11555 * The line information associated with the source. |
| 11630 */ | 11556 */ |
| 11631 final LineInfo lineInfo; | 11557 final LineInfo lineInfo; |
| 11632 | 11558 |
| 11633 /** | 11559 /** |
| (...skipping 29 matching lines...) Expand all Loading... |
| 11663 /** | 11589 /** |
| 11664 * The errors that were produced by scanning and parsing the source. | 11590 * The errors that were produced by scanning and parsing the source. |
| 11665 */ | 11591 */ |
| 11666 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; | 11592 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; |
| 11667 | 11593 |
| 11668 /** | 11594 /** |
| 11669 * Initialize a newly created task to perform analysis within the given contex
t. | 11595 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11670 * | 11596 * |
| 11671 * @param context the context in which the task is to be performed | 11597 * @param context the context in which the task is to be performed |
| 11672 * @param source the source to be parsed | 11598 * @param source the source to be parsed |
| 11673 * @param modificationTime the time at which the contents of the source were l
ast modified | |
| 11674 * @param tokenStream the head of the token stream used for parsing | 11599 * @param tokenStream the head of the token stream used for parsing |
| 11675 * @param lineInfo the line information associated with the source | 11600 * @param lineInfo the line information associated with the source |
| 11676 */ | 11601 */ |
| 11677 ParseDartTask(InternalAnalysisContext context, this.source, this.modificationT
ime, this._tokenStream, this.lineInfo) : super(context); | 11602 ParseDartTask(InternalAnalysisContext context, this.source, this._tokenStream,
this.lineInfo) : super(context); |
| 11678 | 11603 |
| 11679 @override | 11604 @override |
| 11680 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this); | 11605 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this); |
| 11681 | 11606 |
| 11682 /** | 11607 /** |
| 11683 * Return the compilation unit that was produced by parsing the source, or `nu
ll` if the | 11608 * Return the compilation unit that was produced by parsing the source, or `nu
ll` if the |
| 11684 * task has not yet been performed or if an exception occurred. | 11609 * task has not yet been performed or if an exception occurred. |
| 11685 * | 11610 * |
| 11686 * @return the compilation unit that was produced by parsing the source | 11611 * @return the compilation unit that was produced by parsing the source |
| 11687 */ | 11612 */ |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11807 /** | 11732 /** |
| 11808 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil
e. | 11733 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil
e. |
| 11809 */ | 11734 */ |
| 11810 class ParseHtmlTask extends AnalysisTask { | 11735 class ParseHtmlTask extends AnalysisTask { |
| 11811 /** | 11736 /** |
| 11812 * The source to be parsed. | 11737 * The source to be parsed. |
| 11813 */ | 11738 */ |
| 11814 final Source source; | 11739 final Source source; |
| 11815 | 11740 |
| 11816 /** | 11741 /** |
| 11817 * The time at which the contents of the source were last modified. | |
| 11818 */ | |
| 11819 final int modificationTime; | |
| 11820 | |
| 11821 /** | |
| 11822 * The contents of the source. | 11742 * The contents of the source. |
| 11823 */ | 11743 */ |
| 11824 final String _content; | 11744 final String _content; |
| 11825 | 11745 |
| 11826 /** | 11746 /** |
| 11827 * The line information that was produced. | 11747 * The line information that was produced. |
| 11828 */ | 11748 */ |
| 11829 LineInfo _lineInfo; | 11749 LineInfo _lineInfo; |
| 11830 | 11750 |
| 11831 /** | 11751 /** |
| (...skipping 19 matching lines...) Expand all Loading... |
| 11851 /** | 11771 /** |
| 11852 * The name of the 'script' tag in an HTML file. | 11772 * The name of the 'script' tag in an HTML file. |
| 11853 */ | 11773 */ |
| 11854 static String _TAG_SCRIPT = "script"; | 11774 static String _TAG_SCRIPT = "script"; |
| 11855 | 11775 |
| 11856 /** | 11776 /** |
| 11857 * Initialize a newly created task to perform analysis within the given contex
t. | 11777 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11858 * | 11778 * |
| 11859 * @param context the context in which the task is to be performed | 11779 * @param context the context in which the task is to be performed |
| 11860 * @param source the source to be parsed | 11780 * @param source the source to be parsed |
| 11861 * @param modificationTime the time at which the contents of the source were l
ast modified | |
| 11862 * @param content the contents of the source | 11781 * @param content the contents of the source |
| 11863 */ | 11782 */ |
| 11864 ParseHtmlTask(InternalAnalysisContext context, this.source, this.modificationT
ime, this._content) : super(context); | 11783 ParseHtmlTask(InternalAnalysisContext context, this.source, this._content) : s
uper(context); |
| 11865 | 11784 |
| 11866 @override | 11785 @override |
| 11867 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this); | 11786 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this); |
| 11868 | 11787 |
| 11869 /** | 11788 /** |
| 11870 * Return the errors that were produced by scanning and parsing the source, or
`null` if the | 11789 * Return the errors that were produced by scanning and parsing the source, or
`null` if the |
| 11871 * task has not yet been performed or if an exception occurred. | 11790 * task has not yet been performed or if an exception occurred. |
| 11872 * | 11791 * |
| 11873 * @return the errors that were produced by scanning and parsing the source | 11792 * @return the errors that were produced by scanning and parsing the source |
| 11874 */ | 11793 */ |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12051 /** | 11970 /** |
| 12052 * Instances of the class `PolymerBuildHtmlTask` build Polymer specific elements
. | 11971 * Instances of the class `PolymerBuildHtmlTask` build Polymer specific elements
. |
| 12053 */ | 11972 */ |
| 12054 class PolymerBuildHtmlTask extends AnalysisTask { | 11973 class PolymerBuildHtmlTask extends AnalysisTask { |
| 12055 /** | 11974 /** |
| 12056 * The source to build which Polymer HTML elements for. | 11975 * The source to build which Polymer HTML elements for. |
| 12057 */ | 11976 */ |
| 12058 final Source source; | 11977 final Source source; |
| 12059 | 11978 |
| 12060 /** | 11979 /** |
| 12061 * The time at which the contents of the source were last modified. | |
| 12062 */ | |
| 12063 final int modificationTime; | |
| 12064 | |
| 12065 /** | |
| 12066 * The line information associated with the source. | 11980 * The line information associated with the source. |
| 12067 */ | 11981 */ |
| 12068 final LineInfo _lineInfo; | 11982 final LineInfo _lineInfo; |
| 12069 | 11983 |
| 12070 /** | 11984 /** |
| 12071 * The HTML unit to be resolved. | 11985 * The HTML unit to be resolved. |
| 12072 */ | 11986 */ |
| 12073 final ht.HtmlUnit _unit; | 11987 final ht.HtmlUnit _unit; |
| 12074 | 11988 |
| 12075 /** | 11989 /** |
| 12076 * The resolution errors that were discovered while building elements. | 11990 * The resolution errors that were discovered while building elements. |
| 12077 */ | 11991 */ |
| 12078 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; | 11992 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; |
| 12079 | 11993 |
| 12080 /** | 11994 /** |
| 12081 * Initialize a newly created task to perform analysis within the given contex
t. | 11995 * Initialize a newly created task to perform analysis within the given contex
t. |
| 12082 * | 11996 * |
| 12083 * @param context the context in which the task is to be performed | 11997 * @param context the context in which the task is to be performed |
| 12084 * @param source the source to be resolved | 11998 * @param source the source to be resolved |
| 12085 * @param modificationTime the time at which the contents of the source were l
ast modified | |
| 12086 * @param lineInfo the line information associated with the source | 11999 * @param lineInfo the line information associated with the source |
| 12087 * @param unit the HTML unit to build Polymer elements for | 12000 * @param unit the HTML unit to build Polymer elements for |
| 12088 */ | 12001 */ |
| 12089 PolymerBuildHtmlTask(InternalAnalysisContext context, this.source, this.modifi
cationTime, this._lineInfo, this._unit) : super(context); | 12002 PolymerBuildHtmlTask(InternalAnalysisContext context, this.source, this._lineI
nfo, this._unit) : super(context); |
| 12090 | 12003 |
| 12091 @override | 12004 @override |
| 12092 accept(AnalysisTaskVisitor visitor) => visitor.visitPolymerBuildHtmlTask(this)
; | 12005 accept(AnalysisTaskVisitor visitor) => visitor.visitPolymerBuildHtmlTask(this)
; |
| 12093 | 12006 |
| 12094 List<AnalysisError> get errors => _errors; | 12007 List<AnalysisError> get errors => _errors; |
| 12095 | 12008 |
| 12096 @override | 12009 @override |
| 12097 String get taskDescription => "build Polymer elements ${source.fullName}"; | 12010 String get taskDescription => "build Polymer elements ${source.fullName}"; |
| 12098 | 12011 |
| 12099 @override | 12012 @override |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12489 * | 12402 * |
| 12490 * TODO(scheglov) implement it | 12403 * TODO(scheglov) implement it |
| 12491 */ | 12404 */ |
| 12492 class PolymerResolveHtmlTask extends AnalysisTask { | 12405 class PolymerResolveHtmlTask extends AnalysisTask { |
| 12493 /** | 12406 /** |
| 12494 * The source to be resolved. | 12407 * The source to be resolved. |
| 12495 */ | 12408 */ |
| 12496 final Source source; | 12409 final Source source; |
| 12497 | 12410 |
| 12498 /** | 12411 /** |
| 12499 * The time at which the contents of the source were last modified. | |
| 12500 */ | |
| 12501 final int modificationTime; | |
| 12502 | |
| 12503 /** | |
| 12504 * The line information associated with the source. | 12412 * The line information associated with the source. |
| 12505 */ | 12413 */ |
| 12506 final LineInfo _lineInfo; | 12414 final LineInfo _lineInfo; |
| 12507 | 12415 |
| 12508 /** | 12416 /** |
| 12509 * The HTML unit to be resolved. | 12417 * The HTML unit to be resolved. |
| 12510 */ | 12418 */ |
| 12511 final ht.HtmlUnit _unit; | 12419 final ht.HtmlUnit _unit; |
| 12512 | 12420 |
| 12513 /** | 12421 /** |
| 12514 * The resolution errors that were discovered while resolving the source. | 12422 * The resolution errors that were discovered while resolving the source. |
| 12515 */ | 12423 */ |
| 12516 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; | 12424 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; |
| 12517 | 12425 |
| 12518 /** | 12426 /** |
| 12519 * Initialize a newly created task to perform analysis within the given contex
t. | 12427 * Initialize a newly created task to perform analysis within the given contex
t. |
| 12520 * | 12428 * |
| 12521 * @param context the context in which the task is to be performed | 12429 * @param context the context in which the task is to be performed |
| 12522 * @param source the source to be resolved | 12430 * @param source the source to be resolved |
| 12523 * @param modificationTime the time at which the contents of the source were l
ast modified | |
| 12524 * @param unit the HTML unit to be resolved | 12431 * @param unit the HTML unit to be resolved |
| 12525 */ | 12432 */ |
| 12526 PolymerResolveHtmlTask(InternalAnalysisContext context, this.source, this.modi
ficationTime, this._lineInfo, this._unit) : super(context); | 12433 PolymerResolveHtmlTask(InternalAnalysisContext context, this.source, this._lin
eInfo, this._unit) : super(context); |
| 12527 | 12434 |
| 12528 @override | 12435 @override |
| 12529 accept(AnalysisTaskVisitor visitor) => visitor.visitPolymerResolveHtmlTask(thi
s); | 12436 accept(AnalysisTaskVisitor visitor) => visitor.visitPolymerResolveHtmlTask(thi
s); |
| 12530 | 12437 |
| 12531 List<AnalysisError> get errors => _errors; | 12438 List<AnalysisError> get errors => _errors; |
| 12532 | 12439 |
| 12533 @override | 12440 @override |
| 12534 String get taskDescription => "resolve as Polymer ${source.fullName}"; | 12441 String get taskDescription => "resolve as Polymer ${source.fullName}"; |
| 12535 | 12442 |
| 12536 @override | 12443 @override |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13093 builder.append(oldState); | 13000 builder.append(oldState); |
| 13094 builder.append(" -> "); | 13001 builder.append(" -> "); |
| 13095 builder.append(newState); | 13002 builder.append(newState); |
| 13096 return true; | 13003 return true; |
| 13097 } | 13004 } |
| 13098 return needsSeparator; | 13005 return needsSeparator; |
| 13099 } | 13006 } |
| 13100 } | 13007 } |
| 13101 | 13008 |
| 13102 /** | 13009 /** |
| 13103 * Instances of the class `ResolvableCompilationUnit` represent a compilation un
it that is not | 13010 * A `ResolvableCompilationUnit` is a compilation unit that is not referenced by |
| 13104 * referenced by any other objects and for which we have modification stamp info
rmation. It is used | 13011 * any other objects. It is used by the [LibraryResolver] to resolve a library. |
| 13105 * by the [LibraryResolver] to resolve a library. | |
| 13106 */ | 13012 */ |
| 13107 class ResolvableCompilationUnit extends TimestampedData<CompilationUnit> { | 13013 class ResolvableCompilationUnit { |
| 13108 /** | 13014 /** |
| 13109 * The source of the compilation unit. | 13015 * The source of the compilation unit. |
| 13110 */ | 13016 */ |
| 13111 final Source source; | 13017 final Source source; |
| 13112 | 13018 |
| 13113 /** | 13019 /** |
| 13114 * Initialize a newly created holder to hold the given values. | 13020 * The compilation unit. |
| 13115 * | |
| 13116 * @param modificationTime the modification time of the source from which the
AST was created | |
| 13117 * @param unit the AST that was created from the source | |
| 13118 */ | 13021 */ |
| 13119 ResolvableCompilationUnit.con1(int modificationTime, CompilationUnit unit) : t
his.con2(modificationTime, unit, null); | 13022 final CompilationUnit compilationUnit; |
| 13120 | 13023 |
| 13121 /** | 13024 /** |
| 13122 * Initialize a newly created holder to hold the given values. | 13025 * Initialize a newly created holder to hold the given values. |
| 13123 * | 13026 * |
| 13124 * @param modificationTime the modification time of the source from which the
AST was created | 13027 * @param source the source of the compilation unit |
| 13125 * @param unit the AST that was created from the source | 13028 * @param unit the AST that was created from the source |
| 13126 * @param source the source of the compilation unit | |
| 13127 */ | 13029 */ |
| 13128 ResolvableCompilationUnit.con2(int modificationTime, CompilationUnit unit, thi
s.source) : super(modificationTime, unit); | 13030 ResolvableCompilationUnit(this.source, this.compilationUnit); |
| 13129 | |
| 13130 /** | |
| 13131 * Return the AST that was created from the source. | |
| 13132 * | |
| 13133 * @return the AST that was created from the source | |
| 13134 */ | |
| 13135 CompilationUnit get compilationUnit => data; | |
| 13136 } | 13031 } |
| 13137 | 13032 |
| 13138 /** | 13033 /** |
| 13139 * Instances of the class `ResolvableHtmlUnit` represent an HTML unit that is no
t referenced | |
| 13140 * by any other objects and for which we have modification stamp information. It
is used by the | |
| 13141 * [ResolveHtmlTask] to resolve an HTML source. | |
| 13142 */ | |
| 13143 class ResolvableHtmlUnit extends TimestampedData<ht.HtmlUnit> { | |
| 13144 /** | |
| 13145 * Initialize a newly created holder to hold the given values. | |
| 13146 * | |
| 13147 * @param modificationTime the modification time of the source from which the
AST was created | |
| 13148 * @param unit the AST that was created from the source | |
| 13149 */ | |
| 13150 ResolvableHtmlUnit(int modificationTime, ht.HtmlUnit unit) : super(modificatio
nTime, unit); | |
| 13151 | |
| 13152 /** | |
| 13153 * Return the AST that was created from the source. | |
| 13154 * | |
| 13155 * @return the AST that was created from the source | |
| 13156 */ | |
| 13157 ht.HtmlUnit get compilationUnit => data; | |
| 13158 } | |
| 13159 | |
| 13160 /** | |
| 13161 * Instances of the class `ResolveAngularComponentTemplateTask` resolve HTML tem
plate | 13034 * Instances of the class `ResolveAngularComponentTemplateTask` resolve HTML tem
plate |
| 13162 * referenced by [AngularComponentElement]. | 13035 * referenced by [AngularComponentElement]. |
| 13163 */ | 13036 */ |
| 13164 class ResolveAngularComponentTemplateTask extends AnalysisTask { | 13037 class ResolveAngularComponentTemplateTask extends AnalysisTask { |
| 13165 /** | 13038 /** |
| 13166 * The source to be resolved. | 13039 * The source to be resolved. |
| 13167 */ | 13040 */ |
| 13168 final Source source; | 13041 final Source source; |
| 13169 | 13042 |
| 13170 /** | 13043 /** |
| 13171 * The time at which the contents of the source were last modified. | |
| 13172 */ | |
| 13173 final int modificationTime; | |
| 13174 | |
| 13175 /** | |
| 13176 * The HTML unit to be resolved. | 13044 * The HTML unit to be resolved. |
| 13177 */ | 13045 */ |
| 13178 final ht.HtmlUnit _unit; | 13046 final ht.HtmlUnit _unit; |
| 13179 | 13047 |
| 13180 /** | 13048 /** |
| 13181 * The [AngularComponentElement] to resolve template for. | 13049 * The [AngularComponentElement] to resolve template for. |
| 13182 */ | 13050 */ |
| 13183 final AngularComponentElement _component; | 13051 final AngularComponentElement _component; |
| 13184 | 13052 |
| 13185 /** | 13053 /** |
| 13186 * The Angular application to resolve in context of. | 13054 * The Angular application to resolve in context of. |
| 13187 */ | 13055 */ |
| 13188 final AngularApplication _application; | 13056 final AngularApplication _application; |
| 13189 | 13057 |
| 13190 /** | 13058 /** |
| 13191 * The [HtmlUnit] that was resolved by this task. | 13059 * The [HtmlUnit] that was resolved by this task. |
| 13192 */ | 13060 */ |
| 13193 ht.HtmlUnit _resolvedUnit; | 13061 ht.HtmlUnit _resolvedUnit; |
| 13194 | 13062 |
| 13195 /** | 13063 /** |
| 13196 * The resolution errors that were discovered while resolving the source. | 13064 * The resolution errors that were discovered while resolving the source. |
| 13197 */ | 13065 */ |
| 13198 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; | 13066 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; |
| 13199 | 13067 |
| 13200 /** | 13068 /** |
| 13201 * Initialize a newly created task to perform analysis within the given contex
t. | 13069 * Initialize a newly created task to perform analysis within the given contex
t. |
| 13202 * | 13070 * |
| 13203 * @param context the context in which the task is to be performed | 13071 * @param context the context in which the task is to be performed |
| 13204 * @param source the source to be resolved | 13072 * @param source the source to be resolved |
| 13205 * @param modificationTime the time at which the contents of the source were l
ast modified | |
| 13206 * @param unit the HTML unit to be resolved | 13073 * @param unit the HTML unit to be resolved |
| 13207 * @param component the component that uses this HTML template, not `null` | 13074 * @param component the component that uses this HTML template, not `null` |
| 13208 * @param application the Angular application to resolve in context of | 13075 * @param application the Angular application to resolve in context of |
| 13209 */ | 13076 */ |
| 13210 ResolveAngularComponentTemplateTask(InternalAnalysisContext context, this.sour
ce, this.modificationTime, this._unit, this._component, this._application) : sup
er(context); | 13077 ResolveAngularComponentTemplateTask(InternalAnalysisContext context, this.sour
ce, this._unit, this._component, this._application) : super(context); |
| 13211 | 13078 |
| 13212 @override | 13079 @override |
| 13213 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularComponentTem
plateTask(this); | 13080 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularComponentTem
plateTask(this); |
| 13214 | 13081 |
| 13215 List<AnalysisError> get resolutionErrors => _resolutionErrors; | 13082 List<AnalysisError> get resolutionErrors => _resolutionErrors; |
| 13216 | 13083 |
| 13217 /** | 13084 /** |
| 13218 * Return the [HtmlUnit] that was resolved by this task. | 13085 * Return the [HtmlUnit] that was resolved by this task. |
| 13219 * | 13086 * |
| 13220 * @return the [HtmlUnit] that was resolved by this task | 13087 * @return the [HtmlUnit] that was resolved by this task |
| (...skipping 29 matching lines...) Expand all Loading... |
| 13250 * Instances of the class `ResolveAngularEntryHtmlTask` resolve a specific HTML
file as an | 13117 * Instances of the class `ResolveAngularEntryHtmlTask` resolve a specific HTML
file as an |
| 13251 * Angular entry point. | 13118 * Angular entry point. |
| 13252 */ | 13119 */ |
| 13253 class ResolveAngularEntryHtmlTask extends AnalysisTask { | 13120 class ResolveAngularEntryHtmlTask extends AnalysisTask { |
| 13254 /** | 13121 /** |
| 13255 * The source to be resolved. | 13122 * The source to be resolved. |
| 13256 */ | 13123 */ |
| 13257 final Source source; | 13124 final Source source; |
| 13258 | 13125 |
| 13259 /** | 13126 /** |
| 13260 * The time at which the contents of the source were last modified. | |
| 13261 */ | |
| 13262 final int modificationTime; | |
| 13263 | |
| 13264 /** | |
| 13265 * The HTML unit to be resolved. | 13127 * The HTML unit to be resolved. |
| 13266 */ | 13128 */ |
| 13267 final ht.HtmlUnit _unit; | 13129 final ht.HtmlUnit _unit; |
| 13268 | 13130 |
| 13269 /** | 13131 /** |
| 13270 * The listener to record errors. | 13132 * The listener to record errors. |
| 13271 */ | 13133 */ |
| 13272 RecordingErrorListener _errorListener = new RecordingErrorListener(); | 13134 RecordingErrorListener _errorListener = new RecordingErrorListener(); |
| 13273 | 13135 |
| 13274 /** | 13136 /** |
| 13275 * The [HtmlUnit] that was resolved by this task. | 13137 * The [HtmlUnit] that was resolved by this task. |
| 13276 */ | 13138 */ |
| 13277 ht.HtmlUnit _resolvedUnit; | 13139 ht.HtmlUnit _resolvedUnit; |
| 13278 | 13140 |
| 13279 /** | 13141 /** |
| 13280 * The element produced by resolving the source. | 13142 * The element produced by resolving the source. |
| 13281 */ | 13143 */ |
| 13282 HtmlElement _element = null; | 13144 HtmlElement _element = null; |
| 13283 | 13145 |
| 13284 /** | 13146 /** |
| 13285 * The Angular application to resolve in context of. | 13147 * The Angular application to resolve in context of. |
| 13286 */ | 13148 */ |
| 13287 AngularApplication _application; | 13149 AngularApplication _application; |
| 13288 | 13150 |
| 13289 /** | 13151 /** |
| 13290 * Initialize a newly created task to perform analysis within the given contex
t. | 13152 * Initialize a newly created task to perform analysis within the given contex
t. |
| 13291 * | 13153 * |
| 13292 * @param context the context in which the task is to be performed | 13154 * @param context the context in which the task is to be performed |
| 13293 * @param source the source to be resolved | 13155 * @param source the source to be resolved |
| 13294 * @param modificationTime the time at which the contents of the source were l
ast modified | |
| 13295 * @param unit the HTML unit to be resolved | 13156 * @param unit the HTML unit to be resolved |
| 13296 */ | 13157 */ |
| 13297 ResolveAngularEntryHtmlTask(InternalAnalysisContext context, this.source, this
.modificationTime, this._unit) : super(context); | 13158 ResolveAngularEntryHtmlTask(InternalAnalysisContext context, this.source, this
._unit) : super(context); |
| 13298 | 13159 |
| 13299 @override | 13160 @override |
| 13300 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularEntryHtmlTas
k(this); | 13161 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularEntryHtmlTas
k(this); |
| 13301 | 13162 |
| 13302 /** | 13163 /** |
| 13303 * Returns the [AngularApplication] for the Web application with this Angular
entry point, | 13164 * Returns the [AngularApplication] for the Web application with this Angular
entry point, |
| 13304 * maybe `null` if not an Angular entry point. | 13165 * maybe `null` if not an Angular entry point. |
| 13305 */ | 13166 */ |
| 13306 AngularApplication get application => _application; | 13167 AngularApplication get application => _application; |
| 13307 | 13168 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13478 * The source that is to be resolved. | 13339 * The source that is to be resolved. |
| 13479 */ | 13340 */ |
| 13480 final Source source; | 13341 final Source source; |
| 13481 | 13342 |
| 13482 /** | 13343 /** |
| 13483 * The element model for the library containing the source. | 13344 * The element model for the library containing the source. |
| 13484 */ | 13345 */ |
| 13485 final LibraryElement _libraryElement; | 13346 final LibraryElement _libraryElement; |
| 13486 | 13347 |
| 13487 /** | 13348 /** |
| 13488 * The time at which the contents of the source were last modified. | |
| 13489 */ | |
| 13490 int _modificationTime = -1; | |
| 13491 | |
| 13492 /** | |
| 13493 * The compilation unit that was resolved by this task. | 13349 * The compilation unit that was resolved by this task. |
| 13494 */ | 13350 */ |
| 13495 CompilationUnit _resolvedUnit; | 13351 CompilationUnit _resolvedUnit; |
| 13496 | 13352 |
| 13497 /** | 13353 /** |
| 13498 * Initialize a newly created task to perform analysis within the given contex
t. | 13354 * Initialize a newly created task to perform analysis within the given contex
t. |
| 13499 * | 13355 * |
| 13500 * @param context the context in which the task is to be performed | 13356 * @param context the context in which the task is to be performed |
| 13501 * @param source the source to be parsed | 13357 * @param source the source to be parsed |
| 13502 * @param libraryElement the element model for the library containing the sour
ce | 13358 * @param libraryElement the element model for the library containing the sour
ce |
| 13503 */ | 13359 */ |
| 13504 ResolveDartUnitTask(InternalAnalysisContext context, this.source, this._librar
yElement) : super(context); | 13360 ResolveDartUnitTask(InternalAnalysisContext context, this.source, this._librar
yElement) : super(context); |
| 13505 | 13361 |
| 13506 @override | 13362 @override |
| 13507 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this); | 13363 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this); |
| 13508 | 13364 |
| 13509 /** | 13365 /** |
| 13510 * Return the source for the library containing the source that is to be resol
ved. | 13366 * Return the source for the library containing the source that is to be resol
ved. |
| 13511 * | 13367 * |
| 13512 * @return the source for the library containing the source that is to be reso
lved | 13368 * @return the source for the library containing the source that is to be reso
lved |
| 13513 */ | 13369 */ |
| 13514 Source get librarySource => _libraryElement.source; | 13370 Source get librarySource => _libraryElement.source; |
| 13515 | 13371 |
| 13516 /** | 13372 /** |
| 13517 * Return the time at which the contents of the source that was parsed were la
st modified, or a | |
| 13518 * negative value if the task has not yet been performed or if an exception oc
curred. | |
| 13519 * | |
| 13520 * @return the time at which the contents of the source that was parsed were l
ast modified | |
| 13521 */ | |
| 13522 int get modificationTime => _modificationTime; | |
| 13523 | |
| 13524 /** | |
| 13525 * Return the compilation unit that was resolved by this task. | 13373 * Return the compilation unit that was resolved by this task. |
| 13526 * | 13374 * |
| 13527 * @return the compilation unit that was resolved by this task | 13375 * @return the compilation unit that was resolved by this task |
| 13528 */ | 13376 */ |
| 13529 CompilationUnit get resolvedUnit => _resolvedUnit; | 13377 CompilationUnit get resolvedUnit => _resolvedUnit; |
| 13530 | 13378 |
| 13531 @override | 13379 @override |
| 13532 String get taskDescription { | 13380 String get taskDescription { |
| 13533 Source librarySource = _libraryElement.source; | 13381 Source librarySource = _libraryElement.source; |
| 13534 if (librarySource == null) { | 13382 if (librarySource == null) { |
| 13535 return "resolve unit null source"; | 13383 return "resolve unit null source"; |
| 13536 } | 13384 } |
| 13537 return "resolve unit ${librarySource.fullName}"; | 13385 return "resolve unit ${librarySource.fullName}"; |
| 13538 } | 13386 } |
| 13539 | 13387 |
| 13540 @override | 13388 @override |
| 13541 void internalPerform() { | 13389 void internalPerform() { |
| 13542 TypeProvider typeProvider = (_libraryElement.context as InternalAnalysisCont
ext).typeProvider; | 13390 TypeProvider typeProvider = (_libraryElement.context as InternalAnalysisCont
ext).typeProvider; |
| 13543 ResolvableCompilationUnit resolvableUnit = context.computeResolvableCompilat
ionUnit(source); | 13391 CompilationUnit unit = context.computeResolvableCompilationUnit(source); |
| 13544 _modificationTime = resolvableUnit.modificationTime; | |
| 13545 CompilationUnit unit = resolvableUnit.compilationUnit; | |
| 13546 if (unit == null) { | 13392 if (unit == null) { |
| 13547 throw new AnalysisException("Internal error: computeResolvableCompilationU
nit returned a value without a parsed Dart unit"); | 13393 throw new AnalysisException("Internal error: computeResolvableCompilationU
nit returned a value without a parsed Dart unit"); |
| 13548 } | 13394 } |
| 13549 // | 13395 // |
| 13550 // Resolve names in declarations. | 13396 // Resolve names in declarations. |
| 13551 // | 13397 // |
| 13552 new DeclarationResolver().resolve(unit, _find(_libraryElement, source)); | 13398 new DeclarationResolver().resolve(unit, _find(_libraryElement, source)); |
| 13553 // | 13399 // |
| 13554 // Resolve the type names. | 13400 // Resolve the type names. |
| 13555 // | 13401 // |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13725 /** | 13571 /** |
| 13726 * Instances of the class `ScanDartTask` scan a specific source as a Dart file. | 13572 * Instances of the class `ScanDartTask` scan a specific source as a Dart file. |
| 13727 */ | 13573 */ |
| 13728 class ScanDartTask extends AnalysisTask { | 13574 class ScanDartTask extends AnalysisTask { |
| 13729 /** | 13575 /** |
| 13730 * The source to be scanned. | 13576 * The source to be scanned. |
| 13731 */ | 13577 */ |
| 13732 final Source source; | 13578 final Source source; |
| 13733 | 13579 |
| 13734 /** | 13580 /** |
| 13735 * The time at which the contents of the source were last modified. | |
| 13736 */ | |
| 13737 final int modificationTime; | |
| 13738 | |
| 13739 /** | |
| 13740 * The contents of the source. | 13581 * The contents of the source. |
| 13741 */ | 13582 */ |
| 13742 final String _content; | 13583 final String _content; |
| 13743 | 13584 |
| 13744 /** | 13585 /** |
| 13745 * The token stream that was produced by scanning the source. | 13586 * The token stream that was produced by scanning the source. |
| 13746 */ | 13587 */ |
| 13747 Token _tokenStream; | 13588 Token _tokenStream; |
| 13748 | 13589 |
| 13749 /** | 13590 /** |
| 13750 * The line information that was produced. | 13591 * The line information that was produced. |
| 13751 */ | 13592 */ |
| 13752 LineInfo _lineInfo; | 13593 LineInfo _lineInfo; |
| 13753 | 13594 |
| 13754 /** | 13595 /** |
| 13755 * The errors that were produced by scanning the source. | 13596 * The errors that were produced by scanning the source. |
| 13756 */ | 13597 */ |
| 13757 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; | 13598 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; |
| 13758 | 13599 |
| 13759 /** | 13600 /** |
| 13760 * Initialize a newly created task to perform analysis within the given contex
t. | 13601 * Initialize a newly created task to perform analysis within the given contex
t. |
| 13761 * | 13602 * |
| 13762 * @param context the context in which the task is to be performed | 13603 * @param context the context in which the task is to be performed |
| 13763 * @param source the source to be parsed | 13604 * @param source the source to be parsed |
| 13764 * @param modificationTime the time at which the contents of the source were l
ast modified | |
| 13765 * @param content the contents of the source | 13605 * @param content the contents of the source |
| 13766 */ | 13606 */ |
| 13767 ScanDartTask(InternalAnalysisContext context, this.source, this.modificationTi
me, this._content) : super(context); | 13607 ScanDartTask(InternalAnalysisContext context, this.source, this._content) : su
per(context); |
| 13768 | 13608 |
| 13769 @override | 13609 @override |
| 13770 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this); | 13610 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this); |
| 13771 | 13611 |
| 13772 /** | 13612 /** |
| 13773 * Return the errors that were produced by scanning the source, or `null` if t
he task has | 13613 * Return the errors that were produced by scanning the source, or `null` if t
he task has |
| 13774 * not yet been performed or if an exception occurred. | 13614 * not yet been performed or if an exception occurred. |
| 13775 * | 13615 * |
| 13776 * @return the errors that were produced by scanning the source | 13616 * @return the errors that were produced by scanning the source |
| 13777 */ | 13617 */ |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14550 _index++; | 14390 _index++; |
| 14551 if (_index >= _manager._workQueues[_queueIndex].length) { | 14391 if (_index >= _manager._workQueues[_queueIndex].length) { |
| 14552 _index = 0; | 14392 _index = 0; |
| 14553 _queueIndex++; | 14393 _queueIndex++; |
| 14554 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_
queueIndex].isEmpty) { | 14394 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_
queueIndex].isEmpty) { |
| 14555 _queueIndex++; | 14395 _queueIndex++; |
| 14556 } | 14396 } |
| 14557 } | 14397 } |
| 14558 } | 14398 } |
| 14559 } | 14399 } |
| OLD | NEW |