| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine; | 8 library engine; |
| 9 | 9 |
| 10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
| (...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 * The data descriptor representing the errors reported during Angular resolut
ion. | 1678 * The data descriptor representing the errors reported during Angular resolut
ion. |
| 1679 */ | 1679 */ |
| 1680 static final DataDescriptor<List<AnalysisError>> ANGULAR_ERRORS = new DataDesc
riptor<List<AnalysisError>>("DartEntry.ANGULAR_ERRORS"); | 1680 static final DataDescriptor<List<AnalysisError>> ANGULAR_ERRORS = new DataDesc
riptor<List<AnalysisError>>("DartEntry.ANGULAR_ERRORS"); |
| 1681 | 1681 |
| 1682 /** | 1682 /** |
| 1683 * The data descriptor representing the errors reported while building an elem
ent model. | 1683 * The data descriptor representing the errors reported while building an elem
ent model. |
| 1684 */ | 1684 */ |
| 1685 static final DataDescriptor<List<AnalysisError>> BUILD_ELEMENT_ERRORS = new Da
taDescriptor<List<AnalysisError>>("DartEntry.BUILD_ELEMENT_ERRORS"); | 1685 static final DataDescriptor<List<AnalysisError>> BUILD_ELEMENT_ERRORS = new Da
taDescriptor<List<AnalysisError>>("DartEntry.BUILD_ELEMENT_ERRORS"); |
| 1686 | 1686 |
| 1687 /** | 1687 /** |
| 1688 * The data descriptor representing the AST structure resulting from building
the element model. |
| 1689 */ |
| 1690 static final DataDescriptor<CompilationUnit> BUILT_UNIT = new DataDescriptor<C
ompilationUnit>("DartEntry.BUILT_UNIT"); |
| 1691 |
| 1692 /** |
| 1688 * The data descriptor representing the list of libraries that contain this co
mpilation unit. | 1693 * The data descriptor representing the list of libraries that contain this co
mpilation unit. |
| 1689 */ | 1694 */ |
| 1690 static final DataDescriptor<List<Source>> CONTAINING_LIBRARIES = new DataDescr
iptor<List<Source>>("DartEntry.CONTAINING_LIBRARIES"); | 1695 static final DataDescriptor<List<Source>> CONTAINING_LIBRARIES = new DataDescr
iptor<List<Source>>("DartEntry.CONTAINING_LIBRARIES"); |
| 1691 | 1696 |
| 1692 /** | 1697 /** |
| 1693 * The data descriptor representing the library element for the library. This
data is only | 1698 * The data descriptor representing the library element for the library. This
data is only |
| 1694 * available for Dart files that are the defining compilation unit of a librar
y. | 1699 * available for Dart files that are the defining compilation unit of a librar
y. |
| 1695 */ | 1700 */ |
| 1696 static final DataDescriptor<LibraryElement> ELEMENT = new DataDescriptor<Libra
ryElement>("DartEntry.ELEMENT"); | 1701 static final DataDescriptor<LibraryElement> ELEMENT = new DataDescriptor<Libra
ryElement>("DartEntry.ELEMENT"); |
| 1697 | 1702 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 } | 2057 } |
| 2053 return new List.from(errors); | 2058 return new List.from(errors); |
| 2054 } | 2059 } |
| 2055 | 2060 |
| 2056 @override | 2061 @override |
| 2057 CompilationUnit get anyParsedCompilationUnit { | 2062 CompilationUnit get anyParsedCompilationUnit { |
| 2058 if (_parsedUnitState == CacheState.VALID) { | 2063 if (_parsedUnitState == CacheState.VALID) { |
| 2059 _parsedUnitAccessed = true; | 2064 _parsedUnitAccessed = true; |
| 2060 return _parsedUnit; | 2065 return _parsedUnit; |
| 2061 } | 2066 } |
| 2067 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2068 while (state != null) { |
| 2069 if (state._builtUnitState == CacheState.VALID) { |
| 2070 return state._builtUnit; |
| 2071 } |
| 2072 state = state._nextState; |
| 2073 } |
| 2074 ; |
| 2062 return anyResolvedCompilationUnit; | 2075 return anyResolvedCompilationUnit; |
| 2063 } | 2076 } |
| 2064 | 2077 |
| 2065 @override | 2078 @override |
| 2066 CompilationUnit get anyResolvedCompilationUnit { | 2079 CompilationUnit get anyResolvedCompilationUnit { |
| 2067 DartEntryImpl_ResolutionState state = _resolutionState; | 2080 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2068 while (state != null) { | 2081 while (state != null) { |
| 2069 if (state._resolvedUnitState == CacheState.VALID) { | 2082 if (state._resolvedUnitState == CacheState.VALID) { |
| 2070 return state._resolvedUnit; | 2083 return state._resolvedUnit; |
| 2071 } | 2084 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2112 return _parsedUnit.accept(new AstCloner()) as CompilationUnit; | 2125 return _parsedUnit.accept(new AstCloner()) as CompilationUnit; |
| 2113 } | 2126 } |
| 2114 CompilationUnit unit = _parsedUnit; | 2127 CompilationUnit unit = _parsedUnit; |
| 2115 _parsedUnitState = CacheState.FLUSHED; | 2128 _parsedUnitState = CacheState.FLUSHED; |
| 2116 _parsedUnitAccessed = false; | 2129 _parsedUnitAccessed = false; |
| 2117 _parsedUnit = null; | 2130 _parsedUnit = null; |
| 2118 return unit; | 2131 return unit; |
| 2119 } | 2132 } |
| 2120 DartEntryImpl_ResolutionState state = _resolutionState; | 2133 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2121 while (state != null) { | 2134 while (state != null) { |
| 2135 if (state._builtUnitState == CacheState.VALID) { |
| 2136 // TODO(brianwilkerson) We're cloning the structure to remove any previo
us resolution data, |
| 2137 // but I'm not sure that's necessary. |
| 2138 return state._builtUnit.accept(new AstCloner()) as CompilationUnit; |
| 2139 } |
| 2122 if (state._resolvedUnitState == CacheState.VALID) { | 2140 if (state._resolvedUnitState == CacheState.VALID) { |
| 2123 return state._resolvedUnit.accept(new AstCloner()) as CompilationUnit; | 2141 return state._resolvedUnit.accept(new AstCloner()) as CompilationUnit; |
| 2124 } | 2142 } |
| 2125 state = state._nextState; | 2143 state = state._nextState; |
| 2126 } | 2144 } |
| 2127 ; | 2145 ; |
| 2128 return null; | 2146 return null; |
| 2129 } | 2147 } |
| 2130 | 2148 |
| 2131 @override | 2149 @override |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2159 } | 2177 } |
| 2160 } | 2178 } |
| 2161 | 2179 |
| 2162 @override | 2180 @override |
| 2163 CacheState getStateInLibrary(DataDescriptor descriptor, Source librarySource)
{ | 2181 CacheState getStateInLibrary(DataDescriptor descriptor, Source librarySource)
{ |
| 2164 DartEntryImpl_ResolutionState state = _resolutionState; | 2182 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2165 while (state != null) { | 2183 while (state != null) { |
| 2166 if (librarySource == state._librarySource) { | 2184 if (librarySource == state._librarySource) { |
| 2167 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS)) { | 2185 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS)) { |
| 2168 return state._buildElementErrorsState; | 2186 return state._buildElementErrorsState; |
| 2187 } else if (identical(descriptor, DartEntry.BUILT_UNIT)) { |
| 2188 return state._builtUnitState; |
| 2169 } else if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { | 2189 } else if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { |
| 2170 return state._resolutionErrorsState; | 2190 return state._resolutionErrorsState; |
| 2171 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 2191 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 2172 return state._resolvedUnitState; | 2192 return state._resolvedUnitState; |
| 2173 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { | 2193 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 2174 return state._verificationErrorsState; | 2194 return state._verificationErrorsState; |
| 2175 } else if (identical(descriptor, DartEntry.HINTS)) { | 2195 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 2176 return state._hintsState; | 2196 return state._hintsState; |
| 2177 } else { | 2197 } else { |
| 2178 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); | 2198 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 return super.getValue(descriptor); | 2243 return super.getValue(descriptor); |
| 2224 } | 2244 } |
| 2225 | 2245 |
| 2226 @override | 2246 @override |
| 2227 Object getValueInLibrary(DataDescriptor descriptor, Source librarySource) { | 2247 Object getValueInLibrary(DataDescriptor descriptor, Source librarySource) { |
| 2228 DartEntryImpl_ResolutionState state = _resolutionState; | 2248 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2229 while (state != null) { | 2249 while (state != null) { |
| 2230 if (librarySource == state._librarySource) { | 2250 if (librarySource == state._librarySource) { |
| 2231 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS)) { | 2251 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS)) { |
| 2232 return state._buildElementErrors; | 2252 return state._buildElementErrors; |
| 2253 } else if (identical(descriptor, DartEntry.BUILT_UNIT)) { |
| 2254 return state._builtUnit; |
| 2233 } else if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { | 2255 } else if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { |
| 2234 return state._resolutionErrors; | 2256 return state._resolutionErrors; |
| 2235 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 2257 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 2236 return state._resolvedUnit; | 2258 return state._resolvedUnit; |
| 2237 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { | 2259 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 2238 return state._verificationErrors; | 2260 return state._verificationErrors; |
| 2239 } else if (identical(descriptor, DartEntry.HINTS)) { | 2261 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 2240 return state._hints; | 2262 return state._hints; |
| 2241 } else { | 2263 } else { |
| 2242 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); | 2264 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2280 } else if (identical(descriptor, DartEntry.PARSED_UNIT)) { | 2302 } else if (identical(descriptor, DartEntry.PARSED_UNIT)) { |
| 2281 return _parsedUnitState == CacheState.INVALID; | 2303 return _parsedUnitState == CacheState.INVALID; |
| 2282 } else if (identical(descriptor, DartEntry.PUBLIC_NAMESPACE)) { | 2304 } else if (identical(descriptor, DartEntry.PUBLIC_NAMESPACE)) { |
| 2283 return _publicNamespaceState == CacheState.INVALID; | 2305 return _publicNamespaceState == CacheState.INVALID; |
| 2284 } else if (identical(descriptor, DartEntry.SCAN_ERRORS)) { | 2306 } else if (identical(descriptor, DartEntry.SCAN_ERRORS)) { |
| 2285 return _scanErrorsState == CacheState.INVALID; | 2307 return _scanErrorsState == CacheState.INVALID; |
| 2286 } else if (identical(descriptor, DartEntry.SOURCE_KIND)) { | 2308 } else if (identical(descriptor, DartEntry.SOURCE_KIND)) { |
| 2287 return _sourceKindState == CacheState.INVALID; | 2309 return _sourceKindState == CacheState.INVALID; |
| 2288 } else if (identical(descriptor, DartEntry.TOKEN_STREAM)) { | 2310 } else if (identical(descriptor, DartEntry.TOKEN_STREAM)) { |
| 2289 return _tokenStreamState == CacheState.INVALID; | 2311 return _tokenStreamState == CacheState.INVALID; |
| 2290 } else if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS) || identica
l(descriptor, DartEntry.RESOLUTION_ERRORS) || identical(descriptor, DartEntry.RE
SOLVED_UNIT) || identical(descriptor, DartEntry.VERIFICATION_ERRORS) || identica
l(descriptor, DartEntry.HINTS)) { | 2312 } else if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS) || identica
l(descriptor, DartEntry.BUILT_UNIT) || identical(descriptor, DartEntry.RESOLUTIO
N_ERRORS) || identical(descriptor, DartEntry.RESOLVED_UNIT) || identical(descrip
tor, DartEntry.VERIFICATION_ERRORS) || identical(descriptor, DartEntry.HINTS)) { |
| 2291 DartEntryImpl_ResolutionState state = _resolutionState; | 2313 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2292 while (state != null) { | 2314 while (state != null) { |
| 2293 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS)) { | 2315 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS)) { |
| 2294 return state._buildElementErrorsState == CacheState.INVALID; | 2316 return state._buildElementErrorsState == CacheState.INVALID; |
| 2317 } else if (identical(descriptor, DartEntry.BUILT_UNIT)) { |
| 2318 return state._builtUnitState == CacheState.INVALID; |
| 2295 } else if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { | 2319 } else if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { |
| 2296 return state._resolutionErrorsState == CacheState.INVALID; | 2320 return state._resolutionErrorsState == CacheState.INVALID; |
| 2297 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 2321 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 2298 return state._resolvedUnitState == CacheState.INVALID; | 2322 return state._resolvedUnitState == CacheState.INVALID; |
| 2299 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { | 2323 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 2300 return state._verificationErrorsState == CacheState.INVALID; | 2324 return state._verificationErrorsState == CacheState.INVALID; |
| 2301 } else if (identical(descriptor, DartEntry.HINTS)) { | 2325 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 2302 return state._hintsState == CacheState.INVALID; | 2326 return state._hintsState == CacheState.INVALID; |
| 2303 } | 2327 } |
| 2304 } | 2328 } |
| 2305 return false; | 2329 return false; |
| 2306 } else { | 2330 } else { |
| 2307 return super.getState(descriptor) == CacheState.INVALID; | 2331 return super.getState(descriptor) == CacheState.INVALID; |
| 2308 } | 2332 } |
| 2309 } | 2333 } |
| 2310 | 2334 |
| 2311 @override | 2335 @override |
| 2312 bool get hasResolvableCompilationUnit { | 2336 bool get hasResolvableCompilationUnit { |
| 2313 if (_parsedUnitState == CacheState.VALID) { | 2337 if (_parsedUnitState == CacheState.VALID) { |
| 2314 return true; | 2338 return true; |
| 2315 } | 2339 } |
| 2316 DartEntryImpl_ResolutionState state = _resolutionState; | 2340 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2317 while (state != null) { | 2341 while (state != null) { |
| 2318 if (state._resolvedUnitState == CacheState.VALID) { | 2342 if (state._builtUnitState == CacheState.VALID || state._resolvedUnitState
== CacheState.VALID) { |
| 2319 return true; | 2343 return true; |
| 2320 } | 2344 } |
| 2321 state = state._nextState; | 2345 state = state._nextState; |
| 2322 } | 2346 } |
| 2323 ; | 2347 ; |
| 2324 return false; | 2348 return false; |
| 2325 } | 2349 } |
| 2326 | 2350 |
| 2327 @override | 2351 @override |
| 2328 void invalidateAllInformation() { | 2352 void invalidateAllInformation() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2347 _discardCachedResolutionInformation(); | 2371 _discardCachedResolutionInformation(); |
| 2348 } | 2372 } |
| 2349 | 2373 |
| 2350 /** | 2374 /** |
| 2351 * Invalidate all of the resolution information associated with the compilatio
n unit. | 2375 * Invalidate all of the resolution information associated with the compilatio
n unit. |
| 2352 */ | 2376 */ |
| 2353 void invalidateAllResolutionInformation() { | 2377 void invalidateAllResolutionInformation() { |
| 2354 if (_parsedUnitState == CacheState.FLUSHED) { | 2378 if (_parsedUnitState == CacheState.FLUSHED) { |
| 2355 DartEntryImpl_ResolutionState state = _resolutionState; | 2379 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2356 while (state != null) { | 2380 while (state != null) { |
| 2357 if (state._resolvedUnitState == CacheState.VALID) { | 2381 if (state._builtUnitState == CacheState.VALID) { |
| 2382 _parsedUnit = state._builtUnit; |
| 2383 _parsedUnitAccessed = true; |
| 2384 _parsedUnitState = CacheState.VALID; |
| 2385 break; |
| 2386 } else if (state._resolvedUnitState == CacheState.VALID) { |
| 2358 _parsedUnit = state._resolvedUnit; | 2387 _parsedUnit = state._resolvedUnit; |
| 2359 _parsedUnitAccessed = true; | 2388 _parsedUnitAccessed = true; |
| 2360 _parsedUnitState = CacheState.VALID; | 2389 _parsedUnitState = CacheState.VALID; |
| 2361 break; | 2390 break; |
| 2362 } | 2391 } |
| 2363 state = state._nextState; | 2392 state = state._nextState; |
| 2364 } | 2393 } |
| 2365 } | 2394 } |
| 2366 _discardCachedResolutionInformation(); | 2395 _discardCachedResolutionInformation(); |
| 2367 } | 2396 } |
| 2368 | 2397 |
| 2369 @override | 2398 @override |
| 2370 bool get isRefactoringSafe { | 2399 bool get isRefactoringSafe { |
| 2371 DartEntryImpl_ResolutionState state = _resolutionState; | 2400 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2372 while (state != null) { | 2401 while (state != null) { |
| 2373 CacheState resolvedState = state._resolvedUnitState; | 2402 CacheState resolvedState = state._resolvedUnitState; |
| 2374 if (resolvedState != CacheState.VALID && resolvedState != CacheState.FLUSH
ED) { | 2403 if (resolvedState != CacheState.VALID && resolvedState != CacheState.FLUSH
ED) { |
| 2375 return false; | 2404 return false; |
| 2376 } | 2405 } |
| 2377 state = state._nextState; | 2406 state = state._nextState; |
| 2378 } | 2407 } |
| 2379 return true; | 2408 return true; |
| 2380 } | 2409 } |
| 2381 | 2410 |
| 2411 /** |
| 2412 * Record that an error occurred while attempting to build the element model f
or the source |
| 2413 * represented by this entry. This will set the state of all resolution-based
information as being |
| 2414 * in error, but will not change the state of any parse results. |
| 2415 */ |
| 2416 void recordBuildElementError() { |
| 2417 _element = null; |
| 2418 _elementState = CacheState.ERROR; |
| 2419 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); |
| 2420 _clientServerState = CacheState.ERROR; |
| 2421 _launchableState = CacheState.ERROR; |
| 2422 recordResolutionError(); |
| 2423 } |
| 2424 |
| 2425 /** |
| 2426 * Record that an in-process model build has stopped without recording results
because the results |
| 2427 * were invalidated before they could be recorded. |
| 2428 */ |
| 2429 void recordBuildElementNotInProcess() { |
| 2430 if (_elementState == CacheState.IN_PROCESS) { |
| 2431 _elementState = CacheState.INVALID; |
| 2432 } |
| 2433 if (_clientServerState == CacheState.IN_PROCESS) { |
| 2434 _clientServerState = CacheState.INVALID; |
| 2435 } |
| 2436 if (_launchableState == CacheState.IN_PROCESS) { |
| 2437 _launchableState = CacheState.INVALID; |
| 2438 } |
| 2439 } |
| 2440 |
| 2382 @override | 2441 @override |
| 2383 void recordContentError() { | 2442 void recordContentError() { |
| 2384 super.recordContentError(); | 2443 super.recordContentError(); |
| 2385 recordScanError(); | 2444 recordScanError(); |
| 2386 } | 2445 } |
| 2387 | 2446 |
| 2388 /** | 2447 /** |
| 2389 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 2448 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
| 2390 * entry. This will set the state of all information, including any resolution
-based information, | 2449 * entry. This will set the state of all information, including any resolution
-based information, |
| 2391 * as being in error. | 2450 * as being in error. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2454 } | 2513 } |
| 2455 if (_importedLibrariesState == CacheState.IN_PROCESS) { | 2514 if (_importedLibrariesState == CacheState.IN_PROCESS) { |
| 2456 _importedLibrariesState = CacheState.INVALID; | 2515 _importedLibrariesState = CacheState.INVALID; |
| 2457 } | 2516 } |
| 2458 if (_includedPartsState == CacheState.IN_PROCESS) { | 2517 if (_includedPartsState == CacheState.IN_PROCESS) { |
| 2459 _includedPartsState = CacheState.INVALID; | 2518 _includedPartsState = CacheState.INVALID; |
| 2460 } | 2519 } |
| 2461 } | 2520 } |
| 2462 | 2521 |
| 2463 /** | 2522 /** |
| 2464 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 2523 * Record that an error occurred while attempting to resolve the source repres
ented by this entry. |
| 2465 * entry. This will set the state of all resolution-based information as being
in error, but will | 2524 * This will set the state of all resolution-based information as being in err
or, but will not |
| 2466 * not change the state of any parse results. | 2525 * change the state of any parse results. |
| 2467 */ | 2526 */ |
| 2468 void recordResolutionError() { | 2527 void recordResolutionError() { |
| 2469 _element = null; | 2528 _element = null; |
| 2470 _elementState = CacheState.ERROR; | 2529 _elementState = CacheState.ERROR; |
| 2471 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); | 2530 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); |
| 2472 _clientServerState = CacheState.ERROR; | 2531 _clientServerState = CacheState.ERROR; |
| 2473 _launchableState = CacheState.ERROR; | 2532 _launchableState = CacheState.ERROR; |
| 2474 _publicNamespace = null; | 2533 _publicNamespace = null; |
| 2475 _publicNamespaceState = CacheState.ERROR; | 2534 _publicNamespaceState = CacheState.ERROR; |
| 2476 _resolutionState.recordResolutionError(); | 2535 _resolutionState.recordResolutionError(); |
| 2477 } | 2536 } |
| 2478 | 2537 |
| 2479 /** | 2538 /** |
| 2480 * Record that an in-process parse has stopped without recording results becau
se the results were | 2539 * Record that an in-process resolution has stopped without recording results
because the results |
| 2481 * invalidated before they could be recorded. | 2540 * were invalidated before they could be recorded. |
| 2482 */ | 2541 */ |
| 2483 void recordResolutionNotInProcess() { | 2542 void recordResolutionNotInProcess() { |
| 2484 if (_elementState == CacheState.IN_PROCESS) { | 2543 if (_elementState == CacheState.IN_PROCESS) { |
| 2485 _elementState = CacheState.INVALID; | 2544 _elementState = CacheState.INVALID; |
| 2486 } | 2545 } |
| 2487 if (_clientServerState == CacheState.IN_PROCESS) { | 2546 if (_clientServerState == CacheState.IN_PROCESS) { |
| 2488 _clientServerState = CacheState.INVALID; | 2547 _clientServerState = CacheState.INVALID; |
| 2489 } | 2548 } |
| 2490 if (_launchableState == CacheState.IN_PROCESS) { | 2549 if (_launchableState == CacheState.IN_PROCESS) { |
| 2491 _launchableState = CacheState.INVALID; | 2550 _launchableState = CacheState.INVALID; |
| 2492 } | 2551 } |
| 2552 // TODO(brianwilkerson) Remove the code above this line after resolution and
element building |
| 2553 // are separated. |
| 2493 if (_publicNamespaceState == CacheState.IN_PROCESS) { | 2554 if (_publicNamespaceState == CacheState.IN_PROCESS) { |
| 2494 _publicNamespaceState = CacheState.INVALID; | 2555 _publicNamespaceState = CacheState.INVALID; |
| 2495 } | 2556 } |
| 2496 _resolutionState.recordResolutionNotInProcess(); | 2557 _resolutionState.recordResolutionNotInProcess(); |
| 2497 } | 2558 } |
| 2498 | 2559 |
| 2499 /** | 2560 /** |
| 2500 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 2561 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
| 2501 * entry. This will set the state of all information, including any resolution
-based information, | 2562 * entry. This will set the state of all information, including any resolution
-based information, |
| 2502 * as being in error. | 2563 * as being in error. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2647 * @param descriptor the descriptor representing the data whose state is to be
set | 2708 * @param descriptor the descriptor representing the data whose state is to be
set |
| 2648 * @param librarySource the source of the defining compilation unit of the lib
rary that is the | 2709 * @param librarySource the source of the defining compilation unit of the lib
rary that is the |
| 2649 * context for the data | 2710 * context for the data |
| 2650 * @param cacheState the new state of the data represented by the given descri
ptor | 2711 * @param cacheState the new state of the data represented by the given descri
ptor |
| 2651 */ | 2712 */ |
| 2652 void setStateInLibrary(DataDescriptor descriptor, Source librarySource, CacheS
tate cacheState) { | 2713 void setStateInLibrary(DataDescriptor descriptor, Source librarySource, CacheS
tate cacheState) { |
| 2653 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); | 2714 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); |
| 2654 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS)) { | 2715 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS)) { |
| 2655 state._buildElementErrors = updatedValue(cacheState, state._buildElementEr
rors, AnalysisError.NO_ERRORS); | 2716 state._buildElementErrors = updatedValue(cacheState, state._buildElementEr
rors, AnalysisError.NO_ERRORS); |
| 2656 state._buildElementErrorsState = cacheState; | 2717 state._buildElementErrorsState = cacheState; |
| 2718 } else if (identical(descriptor, DartEntry.BUILT_UNIT)) { |
| 2719 state._builtUnit = updatedValue(cacheState, state._builtUnit, null); |
| 2720 state._builtUnitState = cacheState; |
| 2657 } else if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { | 2721 } else if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { |
| 2658 state._resolutionErrors = updatedValue(cacheState, state._resolutionErrors
, AnalysisError.NO_ERRORS); | 2722 state._resolutionErrors = updatedValue(cacheState, state._resolutionErrors
, AnalysisError.NO_ERRORS); |
| 2659 state._resolutionErrorsState = cacheState; | 2723 state._resolutionErrorsState = cacheState; |
| 2660 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 2724 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 2661 state._resolvedUnit = updatedValue(cacheState, state._resolvedUnit, null); | 2725 state._resolvedUnit = updatedValue(cacheState, state._resolvedUnit, null); |
| 2662 state._resolvedUnitState = cacheState; | 2726 state._resolvedUnitState = cacheState; |
| 2663 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { | 2727 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 2664 state._verificationErrors = updatedValue(cacheState, state._verificationEr
rors, AnalysisError.NO_ERRORS); | 2728 state._verificationErrors = updatedValue(cacheState, state._verificationEr
rors, AnalysisError.NO_ERRORS); |
| 2665 state._verificationErrorsState = cacheState; | 2729 state._verificationErrorsState = cacheState; |
| 2666 } else if (identical(descriptor, DartEntry.HINTS)) { | 2730 } else if (identical(descriptor, DartEntry.HINTS)) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2724 * @param descriptor the descriptor representing which data is to have its val
ue set | 2788 * @param descriptor the descriptor representing which data is to have its val
ue set |
| 2725 * @param librarySource the source of the defining compilation unit of the lib
rary that is the | 2789 * @param librarySource the source of the defining compilation unit of the lib
rary that is the |
| 2726 * context for the data | 2790 * context for the data |
| 2727 * @param value the new value of the data represented by the given descriptor
and library | 2791 * @param value the new value of the data represented by the given descriptor
and library |
| 2728 */ | 2792 */ |
| 2729 void setValueInLibrary(DataDescriptor descriptor, Source librarySource, Object
value) { | 2793 void setValueInLibrary(DataDescriptor descriptor, Source librarySource, Object
value) { |
| 2730 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); | 2794 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); |
| 2731 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS)) { | 2795 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS)) { |
| 2732 state._buildElementErrors = value == null ? AnalysisError.NO_ERRORS : (val
ue as List<AnalysisError>); | 2796 state._buildElementErrors = value == null ? AnalysisError.NO_ERRORS : (val
ue as List<AnalysisError>); |
| 2733 state._buildElementErrorsState = CacheState.VALID; | 2797 state._buildElementErrorsState = CacheState.VALID; |
| 2798 } else if (identical(descriptor, DartEntry.BUILT_UNIT)) { |
| 2799 state._builtUnit = value as CompilationUnit; |
| 2800 state._builtUnitState = CacheState.VALID; |
| 2734 } else if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { | 2801 } else if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { |
| 2735 state._resolutionErrors = value == null ? AnalysisError.NO_ERRORS : (value
as List<AnalysisError>); | 2802 state._resolutionErrors = value == null ? AnalysisError.NO_ERRORS : (value
as List<AnalysisError>); |
| 2736 state._resolutionErrorsState = CacheState.VALID; | 2803 state._resolutionErrorsState = CacheState.VALID; |
| 2737 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 2804 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 2738 state._resolvedUnit = value as CompilationUnit; | 2805 state._resolvedUnit = value as CompilationUnit; |
| 2739 state._resolvedUnitState = CacheState.VALID; | 2806 state._resolvedUnitState = CacheState.VALID; |
| 2740 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { | 2807 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 2741 state._verificationErrors = value == null ? AnalysisError.NO_ERRORS : (val
ue as List<AnalysisError>); | 2808 state._verificationErrors = value == null ? AnalysisError.NO_ERRORS : (val
ue as List<AnalysisError>); |
| 2742 state._verificationErrorsState = CacheState.VALID; | 2809 state._verificationErrorsState = CacheState.VALID; |
| 2743 } else if (identical(descriptor, DartEntry.HINTS)) { | 2810 } else if (identical(descriptor, DartEntry.HINTS)) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2884 DartEntryImpl_ResolutionState _nextState; | 2951 DartEntryImpl_ResolutionState _nextState; |
| 2885 | 2952 |
| 2886 /** | 2953 /** |
| 2887 * The source for the defining compilation unit of the library that contains t
his unit. If this | 2954 * The source for the defining compilation unit of the library that contains t
his unit. If this |
| 2888 * unit is the defining compilation unit for it's library, then this will be t
he source for this | 2955 * unit is the defining compilation unit for it's library, then this will be t
he source for this |
| 2889 * unit. | 2956 * unit. |
| 2890 */ | 2957 */ |
| 2891 Source _librarySource; | 2958 Source _librarySource; |
| 2892 | 2959 |
| 2893 /** | 2960 /** |
| 2961 * The state of the cached compilation unit that contains references to the bu
ilt element model. |
| 2962 */ |
| 2963 CacheState _builtUnitState = CacheState.INVALID; |
| 2964 |
| 2965 /** |
| 2966 * The compilation unit that contains references to the built element model, o
r `null` if |
| 2967 * that compilation unit is not currently cached. |
| 2968 */ |
| 2969 CompilationUnit _builtUnit; |
| 2970 |
| 2971 /** |
| 2894 * The state of the cached errors reported while building an element model. | 2972 * The state of the cached errors reported while building an element model. |
| 2895 */ | 2973 */ |
| 2896 CacheState _buildElementErrorsState = CacheState.INVALID; | 2974 CacheState _buildElementErrorsState = CacheState.INVALID; |
| 2897 | 2975 |
| 2898 /** | 2976 /** |
| 2899 * The errors produced while building an element model, or an empty array if t
he errors are not | 2977 * The errors produced while building an element model, or an empty array if t
he errors are not |
| 2900 * currently cached. | 2978 * currently cached. |
| 2901 */ | 2979 */ |
| 2902 List<AnalysisError> _buildElementErrors = AnalysisError.NO_ERRORS; | 2980 List<AnalysisError> _buildElementErrors = AnalysisError.NO_ERRORS; |
| 2903 | 2981 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2946 List<AnalysisError> _hints = AnalysisError.NO_ERRORS; | 3024 List<AnalysisError> _hints = AnalysisError.NO_ERRORS; |
| 2947 | 3025 |
| 2948 /** | 3026 /** |
| 2949 * Set this state to be exactly like the given state, recursively copying the
next state as | 3027 * Set this state to be exactly like the given state, recursively copying the
next state as |
| 2950 * necessary. | 3028 * necessary. |
| 2951 * | 3029 * |
| 2952 * @param other the state to be copied | 3030 * @param other the state to be copied |
| 2953 */ | 3031 */ |
| 2954 void copyFrom(DartEntryImpl_ResolutionState other) { | 3032 void copyFrom(DartEntryImpl_ResolutionState other) { |
| 2955 _librarySource = other._librarySource; | 3033 _librarySource = other._librarySource; |
| 3034 _builtUnitState = other._builtUnitState; |
| 3035 _builtUnit = other._builtUnit; |
| 2956 _buildElementErrorsState = other._buildElementErrorsState; | 3036 _buildElementErrorsState = other._buildElementErrorsState; |
| 2957 _buildElementErrors = other._buildElementErrors; | 3037 _buildElementErrors = other._buildElementErrors; |
| 2958 _resolvedUnitState = other._resolvedUnitState; | 3038 _resolvedUnitState = other._resolvedUnitState; |
| 2959 _resolvedUnit = other._resolvedUnit; | 3039 _resolvedUnit = other._resolvedUnit; |
| 2960 _resolutionErrorsState = other._resolutionErrorsState; | 3040 _resolutionErrorsState = other._resolutionErrorsState; |
| 2961 _resolutionErrors = other._resolutionErrors; | 3041 _resolutionErrors = other._resolutionErrors; |
| 2962 _verificationErrorsState = other._verificationErrorsState; | 3042 _verificationErrorsState = other._verificationErrorsState; |
| 2963 _verificationErrors = other._verificationErrors; | 3043 _verificationErrors = other._verificationErrors; |
| 2964 _hintsState = other._hintsState; | 3044 _hintsState = other._hintsState; |
| 2965 _hints = other._hints; | 3045 _hints = other._hints; |
| 2966 if (other._nextState != null) { | 3046 if (other._nextState != null) { |
| 2967 _nextState = new DartEntryImpl_ResolutionState(); | 3047 _nextState = new DartEntryImpl_ResolutionState(); |
| 2968 _nextState.copyFrom(other._nextState); | 3048 _nextState.copyFrom(other._nextState); |
| 2969 } | 3049 } |
| 2970 } | 3050 } |
| 2971 | 3051 |
| 2972 /** | 3052 /** |
| 2973 * Flush any AST structures being maintained by this state. | 3053 * Flush any AST structures being maintained by this state. |
| 2974 */ | 3054 */ |
| 2975 void flushAstStructures() { | 3055 void flushAstStructures() { |
| 3056 if (_builtUnitState == CacheState.VALID) { |
| 3057 _builtUnitState = CacheState.FLUSHED; |
| 3058 _builtUnit = null; |
| 3059 } |
| 2976 if (_resolvedUnitState == CacheState.VALID) { | 3060 if (_resolvedUnitState == CacheState.VALID) { |
| 2977 _resolvedUnitState = CacheState.FLUSHED; | 3061 _resolvedUnitState = CacheState.FLUSHED; |
| 2978 _resolvedUnit = null; | 3062 _resolvedUnit = null; |
| 2979 } | 3063 } |
| 2980 if (_nextState != null) { | 3064 if (_nextState != null) { |
| 2981 _nextState.flushAstStructures(); | 3065 _nextState.flushAstStructures(); |
| 2982 } | 3066 } |
| 2983 } | 3067 } |
| 2984 | 3068 |
| 2985 bool get hasErrorState => _buildElementErrorsState == CacheState.ERROR || _res
olvedUnitState == CacheState.ERROR || _resolutionErrorsState == CacheState.ERROR
|| _verificationErrorsState == CacheState.ERROR || _hintsState == CacheState.ER
ROR || (_nextState != null && _nextState.hasErrorState); | 3069 bool get hasErrorState => _builtUnitState == CacheState.ERROR || _buildElement
ErrorsState == CacheState.ERROR || _resolvedUnitState == CacheState.ERROR || _re
solutionErrorsState == CacheState.ERROR || _verificationErrorsState == CacheStat
e.ERROR || _hintsState == CacheState.ERROR || (_nextState != null && _nextState.
hasErrorState); |
| 2986 | 3070 |
| 2987 /** | 3071 /** |
| 2988 * Invalidate all of the resolution information associated with the compilatio
n unit. | 3072 * Invalidate all of the resolution information associated with the compilatio
n unit. |
| 2989 */ | 3073 */ |
| 2990 void invalidateAllResolutionInformation() { | 3074 void invalidateAllResolutionInformation() { |
| 2991 _nextState = null; | 3075 _nextState = null; |
| 2992 _librarySource = null; | 3076 _librarySource = null; |
| 3077 _builtUnitState = CacheState.INVALID; |
| 3078 _builtUnit = null; |
| 2993 _buildElementErrorsState = CacheState.INVALID; | 3079 _buildElementErrorsState = CacheState.INVALID; |
| 2994 _buildElementErrors = AnalysisError.NO_ERRORS; | 3080 _buildElementErrors = AnalysisError.NO_ERRORS; |
| 2995 _resolvedUnitState = CacheState.INVALID; | 3081 _resolvedUnitState = CacheState.INVALID; |
| 2996 _resolvedUnit = null; | 3082 _resolvedUnit = null; |
| 2997 _resolutionErrorsState = CacheState.INVALID; | 3083 _resolutionErrorsState = CacheState.INVALID; |
| 2998 _resolutionErrors = AnalysisError.NO_ERRORS; | 3084 _resolutionErrors = AnalysisError.NO_ERRORS; |
| 2999 _verificationErrorsState = CacheState.INVALID; | 3085 _verificationErrorsState = CacheState.INVALID; |
| 3000 _verificationErrors = AnalysisError.NO_ERRORS; | 3086 _verificationErrors = AnalysisError.NO_ERRORS; |
| 3001 _hintsState = CacheState.INVALID; | 3087 _hintsState = CacheState.INVALID; |
| 3002 _hints = AnalysisError.NO_ERRORS; | 3088 _hints = AnalysisError.NO_ERRORS; |
| 3003 } | 3089 } |
| 3004 | 3090 |
| 3005 /** | 3091 /** |
| 3006 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 3092 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
| 3007 * entry. This will set the state of all resolution-based information as being
in error, but | 3093 * entry. This will set the state of all resolution-based information as being
in error, but |
| 3008 * will not change the state of any parse results. | 3094 * will not change the state of any parse results. |
| 3009 */ | 3095 */ |
| 3010 void recordResolutionError() { | 3096 void recordResolutionError() { |
| 3097 _builtUnitState = CacheState.ERROR; |
| 3098 _builtUnit = null; |
| 3011 _buildElementErrorsState = CacheState.ERROR; | 3099 _buildElementErrorsState = CacheState.ERROR; |
| 3012 _buildElementErrors = AnalysisError.NO_ERRORS; | 3100 _buildElementErrors = AnalysisError.NO_ERRORS; |
| 3013 _resolvedUnitState = CacheState.ERROR; | 3101 _resolvedUnitState = CacheState.ERROR; |
| 3014 _resolvedUnit = null; | 3102 _resolvedUnit = null; |
| 3015 _resolutionErrorsState = CacheState.ERROR; | 3103 _resolutionErrorsState = CacheState.ERROR; |
| 3016 _resolutionErrors = AnalysisError.NO_ERRORS; | 3104 _resolutionErrors = AnalysisError.NO_ERRORS; |
| 3017 _verificationErrorsState = CacheState.ERROR; | 3105 _verificationErrorsState = CacheState.ERROR; |
| 3018 _verificationErrors = AnalysisError.NO_ERRORS; | 3106 _verificationErrors = AnalysisError.NO_ERRORS; |
| 3019 _hintsState = CacheState.ERROR; | 3107 _hintsState = CacheState.ERROR; |
| 3020 _hints = AnalysisError.NO_ERRORS; | 3108 _hints = AnalysisError.NO_ERRORS; |
| 3021 if (_nextState != null) { | 3109 if (_nextState != null) { |
| 3022 _nextState.recordResolutionError(); | 3110 _nextState.recordResolutionError(); |
| 3023 } | 3111 } |
| 3024 } | 3112 } |
| 3025 | 3113 |
| 3026 /** | 3114 /** |
| 3027 * Record that an in-process parse has stopped without recording results becau
se the results | 3115 * Record that an in-process parse has stopped without recording results becau
se the results |
| 3028 * were invalidated before they could be recorded. | 3116 * were invalidated before they could be recorded. |
| 3029 */ | 3117 */ |
| 3030 void recordResolutionNotInProcess() { | 3118 void recordResolutionNotInProcess() { |
| 3031 if (_buildElementErrorsState == CacheState.IN_PROCESS) { | |
| 3032 _buildElementErrorsState = CacheState.INVALID; | |
| 3033 } | |
| 3034 if (_resolvedUnitState == CacheState.IN_PROCESS) { | 3119 if (_resolvedUnitState == CacheState.IN_PROCESS) { |
| 3035 _resolvedUnitState = CacheState.INVALID; | 3120 _resolvedUnitState = CacheState.INVALID; |
| 3036 } | 3121 } |
| 3037 if (_resolutionErrorsState == CacheState.IN_PROCESS) { | 3122 if (_resolutionErrorsState == CacheState.IN_PROCESS) { |
| 3038 _resolutionErrorsState = CacheState.INVALID; | 3123 _resolutionErrorsState = CacheState.INVALID; |
| 3039 } | 3124 } |
| 3040 if (_verificationErrorsState == CacheState.IN_PROCESS) { | 3125 if (_verificationErrorsState == CacheState.IN_PROCESS) { |
| 3041 _verificationErrorsState = CacheState.INVALID; | 3126 _verificationErrorsState = CacheState.INVALID; |
| 3042 } | 3127 } |
| 3043 if (_hintsState == CacheState.IN_PROCESS) { | 3128 if (_hintsState == CacheState.IN_PROCESS) { |
| 3044 _hintsState = CacheState.INVALID; | 3129 _hintsState = CacheState.INVALID; |
| 3045 } | 3130 } |
| 3046 if (_nextState != null) { | 3131 if (_nextState != null) { |
| 3047 _nextState.recordResolutionNotInProcess(); | 3132 _nextState.recordResolutionNotInProcess(); |
| 3048 } | 3133 } |
| 3049 } | 3134 } |
| 3050 | 3135 |
| 3051 /** | 3136 /** |
| 3052 * Write a textual representation of this state to the given builder. The resu
lt will only be | 3137 * Write a textual representation of this state to the given builder. The resu
lt will only be |
| 3053 * used for debugging purposes. | 3138 * used for debugging purposes. |
| 3054 * | 3139 * |
| 3055 * @param builder the builder to which the text should be written | 3140 * @param builder the builder to which the text should be written |
| 3056 */ | 3141 */ |
| 3057 void writeOn(JavaStringBuilder builder) { | 3142 void writeOn(JavaStringBuilder builder) { |
| 3058 if (_librarySource != null) { | 3143 if (_librarySource != null) { |
| 3144 builder.append("; builtUnit = "); |
| 3145 builder.append(_builtUnitState); |
| 3059 builder.append("; buildElementErrors = "); | 3146 builder.append("; buildElementErrors = "); |
| 3060 builder.append(_buildElementErrorsState); | 3147 builder.append(_buildElementErrorsState); |
| 3061 builder.append("; resolvedUnit = "); | 3148 builder.append("; resolvedUnit = "); |
| 3062 builder.append(_resolvedUnitState); | 3149 builder.append(_resolvedUnitState); |
| 3063 builder.append("; resolutionErrors = "); | 3150 builder.append("; resolutionErrors = "); |
| 3064 builder.append(_resolutionErrorsState); | 3151 builder.append(_resolutionErrorsState); |
| 3065 builder.append("; verificationErrors = "); | 3152 builder.append("; verificationErrors = "); |
| 3066 builder.append(_verificationErrorsState); | 3153 builder.append(_verificationErrorsState); |
| 3067 builder.append("; hints = "); | 3154 builder.append("; hints = "); |
| 3068 builder.append(_hintsState); | 3155 builder.append(_hintsState); |
| (...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5053 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLUTION_ERRORS); | 5140 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLUTION_ERRORS); |
| 5054 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLVED_UNIT); | 5141 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLVED_UNIT); |
| 5055 } | 5142 } |
| 5056 } | 5143 } |
| 5057 return statistics; | 5144 return statistics; |
| 5058 } | 5145 } |
| 5059 | 5146 |
| 5060 @override | 5147 @override |
| 5061 TypeProvider get typeProvider { | 5148 TypeProvider get typeProvider { |
| 5062 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); | 5149 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); |
| 5063 return new TypeProviderImpl(computeLibraryElement(coreSource)); | 5150 if (coreSource == null) { |
| 5151 throw new AnalysisException.con1("Could not create a source for dart:core"
); |
| 5152 } |
| 5153 LibraryElement coreElement = computeLibraryElement(coreSource); |
| 5154 if (coreElement == null) { |
| 5155 throw new AnalysisException.con1("Could not create an element for dart:cor
e"); |
| 5156 } |
| 5157 return new TypeProviderImpl(coreElement); |
| 5064 } | 5158 } |
| 5065 | 5159 |
| 5066 @override | 5160 @override |
| 5067 bool isClientLibrary(Source librarySource) { | 5161 bool isClientLibrary(Source librarySource) { |
| 5068 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); | 5162 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); |
| 5069 if (sourceEntry is DartEntry) { | 5163 if (sourceEntry is DartEntry) { |
| 5070 DartEntry dartEntry = sourceEntry; | 5164 DartEntry dartEntry = sourceEntry; |
| 5071 return dartEntry.getValue(DartEntry.IS_CLIENT) && dartEntry.getValue(DartE
ntry.IS_LAUNCHABLE); | 5165 return dartEntry.getValue(DartEntry.IS_CLIENT) && dartEntry.getValue(DartE
ntry.IS_LAUNCHABLE); |
| 5072 } | 5166 } |
| 5073 return false; | 5167 return false; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5356 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); | 5450 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); |
| 5357 RecordingErrorListener errorListener = resolver.errorListener; | 5451 RecordingErrorListener errorListener = resolver.errorListener; |
| 5358 for (ResolvableLibrary library in resolvedLibraries) { | 5452 for (ResolvableLibrary library in resolvedLibraries) { |
| 5359 Source librarySource = library.librarySource; | 5453 Source librarySource = library.librarySource; |
| 5360 for (Source source in library.compilationUnitSources) { | 5454 for (Source source in library.compilationUnitSources) { |
| 5361 CompilationUnit unit = library.getAST(source); | 5455 CompilationUnit unit = library.getAST(source); |
| 5362 List<AnalysisError> errors = errorListener.getErrorsForSource(source
); | 5456 List<AnalysisError> errors = errorListener.getErrorsForSource(source
); |
| 5363 LineInfo lineInfo = getLineInfo(source); | 5457 LineInfo lineInfo = getLineInfo(source); |
| 5364 DartEntryImpl dartCopy = _cache.get(source).writableCopy as DartEntr
yImpl; | 5458 DartEntryImpl dartCopy = _cache.get(source).writableCopy as DartEntr
yImpl; |
| 5365 if (thrownException == null) { | 5459 if (thrownException == null) { |
| 5366 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo); | |
| 5367 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); | 5460 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); |
| 5368 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource,
unit); | 5461 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource,
unit); |
| 5369 dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySou
rce, errors); | 5462 dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySou
rce, errors); |
| 5370 if (source == librarySource) { | 5463 if (source == librarySource) { |
| 5371 _recordElementData(dartCopy, library.libraryElement, librarySour
ce, htmlSource); | 5464 _recordElementData(dartCopy, library.libraryElement, librarySour
ce, htmlSource); |
| 5372 } | 5465 } |
| 5373 _cache.storedAst(source); | 5466 _cache.storedAst(source); |
| 5374 } else { | 5467 } else { |
| 5375 dartCopy.recordResolutionError(); | 5468 dartCopy.recordResolutionError(); |
| 5376 _cache.remove(source); | 5469 _cache.remove(source); |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5917 // change, this loop will eventually terminate. | 6010 // change, this loop will eventually terminate. |
| 5918 // | 6011 // |
| 5919 htmlEntry = _cacheHtmlParseData(source, htmlEntry, HtmlEntry.PARSED_UNIT); | 6012 htmlEntry = _cacheHtmlParseData(source, htmlEntry, HtmlEntry.PARSED_UNIT); |
| 5920 htmlEntry = new ResolveHtmlTask(this, source, htmlEntry.modificationTime,
htmlEntry.getValue(HtmlEntry.PARSED_UNIT)).perform(_resultRecorder) as HtmlEntry
; | 6013 htmlEntry = new ResolveHtmlTask(this, source, htmlEntry.modificationTime,
htmlEntry.getValue(HtmlEntry.PARSED_UNIT)).perform(_resultRecorder) as HtmlEntry
; |
| 5921 state = htmlEntry.getState(descriptor); | 6014 state = htmlEntry.getState(descriptor); |
| 5922 } | 6015 } |
| 5923 return htmlEntry; | 6016 return htmlEntry; |
| 5924 } | 6017 } |
| 5925 | 6018 |
| 5926 /** | 6019 /** |
| 6020 * Compute the transitive closure of all libraries that depend on the given li
brary by adding such |
| 6021 * libraries to the given collection. |
| 6022 * |
| 6023 * @param library the library on which the other libraries depend |
| 6024 * @param librariesToInvalidate the libraries that depend on the given library |
| 6025 */ |
| 6026 void _computeAllLibrariesDependingOn(Source library, Set<Source> librariesToIn
validate) { |
| 6027 if (librariesToInvalidate.add(library)) { |
| 6028 for (Source dependentLibrary in getLibrariesDependingOn(library)) { |
| 6029 _computeAllLibrariesDependingOn(dependentLibrary, librariesToInvalidate)
; |
| 6030 } |
| 6031 } |
| 6032 } |
| 6033 |
| 6034 /** |
| 5927 * Given the encoded form of a source, use the source factory to reconstitute
the original source. | 6035 * Given the encoded form of a source, use the source factory to reconstitute
the original source. |
| 5928 * | 6036 * |
| 5929 * @param encoding the encoded form of a source | 6037 * @param encoding the encoded form of a source |
| 5930 * @return the source represented by the encoding | 6038 * @return the source represented by the encoding |
| 5931 */ | 6039 */ |
| 5932 Source _computeSourceFromEncoding(String encoding) => _sourceFactory.fromEncod
ing(encoding); | 6040 Source _computeSourceFromEncoding(String encoding) => _sourceFactory.fromEncod
ing(encoding); |
| 5933 | 6041 |
| 5934 /** | 6042 /** |
| 5935 * Return `true` if the given array of sources contains the given source. | 6043 * Return `true` if the given array of sources contains the given source. |
| 5936 * | 6044 * |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5957 bool _containsAny(List<Source> sources, List<Source> targetSources) { | 6065 bool _containsAny(List<Source> sources, List<Source> targetSources) { |
| 5958 for (Source targetSource in targetSources) { | 6066 for (Source targetSource in targetSources) { |
| 5959 if (_contains(sources, targetSource)) { | 6067 if (_contains(sources, targetSource)) { |
| 5960 return true; | 6068 return true; |
| 5961 } | 6069 } |
| 5962 } | 6070 } |
| 5963 return false; | 6071 return false; |
| 5964 } | 6072 } |
| 5965 | 6073 |
| 5966 /** | 6074 /** |
| 6075 * Create a [BuildDartElementModelTask] for the given source, marking the buil
t unit as |
| 6076 * being in-process. |
| 6077 * |
| 6078 * @param source the source for the library whose element model is to be built |
| 6079 * @param dartEntry the entry for the source |
| 6080 * @return task data representing the created task |
| 6081 */ |
| 6082 AnalysisContextImpl_TaskData _createBuildDartElementModelTask(Source source, D
artEntry dartEntry) { |
| 6083 try { |
| 6084 AnalysisContextImpl_CycleBuilder builder = new AnalysisContextImpl_CycleBu
ilder(this); |
| 6085 builder.computeCycleContaining(source); |
| 6086 AnalysisContextImpl_TaskData taskData = builder.taskData; |
| 6087 if (taskData != null) { |
| 6088 return taskData; |
| 6089 } |
| 6090 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 6091 dartCopy.setStateInLibrary(DartEntry.BUILT_UNIT, source, CacheState.IN_PRO
CESS); |
| 6092 _cache.put(source, dartCopy); |
| 6093 return new AnalysisContextImpl_TaskData(new BuildDartElementModelTask(this
, source, builder.librariesInCycle), false); |
| 6094 } on AnalysisException catch (exception) { |
| 6095 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 6096 dartCopy.recordBuildElementError(); |
| 6097 dartCopy.exception = exception; |
| 6098 _cache.put(source, dartCopy); |
| 6099 AnalysisEngine.instance.logger.logError2("Internal error trying to compute
the next analysis task", exception); |
| 6100 } |
| 6101 return new AnalysisContextImpl_TaskData(null, false); |
| 6102 } |
| 6103 |
| 6104 /** |
| 5967 * Create an analysis cache based on the given source factory. | 6105 * Create an analysis cache based on the given source factory. |
| 5968 * | 6106 * |
| 5969 * @param factory the source factory containing the information needed to crea
te the cache | 6107 * @param factory the source factory containing the information needed to crea
te the cache |
| 5970 * @return the cache that was created | 6108 * @return the cache that was created |
| 5971 */ | 6109 */ |
| 5972 AnalysisCache _createCacheFromSourceFactory(SourceFactory factory) { | 6110 AnalysisCache _createCacheFromSourceFactory(SourceFactory factory) { |
| 5973 if (factory == null) { | 6111 if (factory == null) { |
| 5974 return new AnalysisCache(<CachePartition> [_privatePartition]); | 6112 return new AnalysisCache(<CachePartition> [_privatePartition]); |
| 5975 } | 6113 } |
| 5976 DartSdk sdk = factory.dartSdk; | 6114 DartSdk sdk = factory.dartSdk; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6172 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { | 6310 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { |
| 6173 return _createResolveHtmlTask(source, htmlEntry); | 6311 return _createResolveHtmlTask(source, htmlEntry); |
| 6174 } | 6312 } |
| 6175 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 6313 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 6176 htmlCopy.setState(HtmlEntry.ANGULAR_ENTRY, CacheState.IN_PROCESS); | 6314 htmlCopy.setState(HtmlEntry.ANGULAR_ENTRY, CacheState.IN_PROCESS); |
| 6177 _cache.put(source, htmlCopy); | 6315 _cache.put(source, htmlCopy); |
| 6178 return new AnalysisContextImpl_TaskData(new ResolveAngularEntryHtmlTask(this
, source, htmlCopy.modificationTime, htmlCopy.getValue(HtmlEntry.RESOLVED_UNIT))
, false); | 6316 return new AnalysisContextImpl_TaskData(new ResolveAngularEntryHtmlTask(this
, source, htmlCopy.modificationTime, htmlCopy.getValue(HtmlEntry.RESOLVED_UNIT))
, false); |
| 6179 } | 6317 } |
| 6180 | 6318 |
| 6181 /** | 6319 /** |
| 6182 * Create a [ResolveDartLibraryTask] for the given source, marking the element
model as | 6320 * Create a [ResolveDartLibraryTask] for the given source, marking ? as being
in-process. |
| 6183 * being in-process. | |
| 6184 * | 6321 * |
| 6185 * @param source the source whose content is to be resolved | 6322 * @param source the source whose content is to be resolved |
| 6186 * @param dartEntry the entry for the source | 6323 * @param dartEntry the entry for the source |
| 6187 * @return task data representing the created task | 6324 * @return task data representing the created task |
| 6188 */ | 6325 */ |
| 6189 AnalysisContextImpl_TaskData _createResolveDartLibraryTask(Source source, Dart
Entry dartEntry) { | 6326 AnalysisContextImpl_TaskData _createResolveDartLibraryTask(Source source, Dart
Entry dartEntry) { |
| 6190 try { | 6327 try { |
| 6191 AnalysisContextImpl_CycleBuilder builder = new AnalysisContextImpl_CycleBu
ilder(this); | 6328 AnalysisContextImpl_CycleBuilder builder = new AnalysisContextImpl_CycleBu
ilder(this); |
| 6192 builder.computeCycleContaining(source); | 6329 builder.computeCycleContaining(source); |
| 6193 AnalysisContextImpl_TaskData taskData = builder.taskData; | 6330 AnalysisContextImpl_TaskData taskData = builder.taskData; |
| 6194 if (taskData != null) { | 6331 if (taskData != null) { |
| 6195 return taskData; | 6332 return taskData; |
| 6196 } | 6333 } |
| 6197 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryCycleTask(th
is, source, source, builder.librariesInCycle), false); | 6334 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryCycleTask(th
is, source, source, builder.librariesInCycle), false); |
| 6198 } on AnalysisException catch (exception) { | 6335 } on AnalysisException catch (exception) { |
| 6336 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 6337 dartCopy.recordResolutionError(); |
| 6338 dartCopy.exception = exception; |
| 6339 _cache.put(source, dartCopy); |
| 6199 AnalysisEngine.instance.logger.logError2("Internal error trying to compute
the next analysis task", exception); | 6340 AnalysisEngine.instance.logger.logError2("Internal error trying to compute
the next analysis task", exception); |
| 6200 } | 6341 } |
| 6201 return new AnalysisContextImpl_TaskData(null, false); | 6342 return new AnalysisContextImpl_TaskData(null, false); |
| 6202 } | 6343 } |
| 6203 | 6344 |
| 6204 /** | 6345 /** |
| 6205 * Create a [ResolveHtmlTask] for the given source, marking the resolved unit
as being | 6346 * Create a [ResolveHtmlTask] for the given source, marking the resolved unit
as being |
| 6206 * in-process. | 6347 * in-process. |
| 6207 * | 6348 * |
| 6208 * @param source the source whose content is to be resolved | 6349 * @param source the source whose content is to be resolved |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7270 RecordingErrorListener errorListener = task.errorListener; | 7411 RecordingErrorListener errorListener = task.errorListener; |
| 7271 for (ResolvableLibrary library in builtLibraries) { | 7412 for (ResolvableLibrary library in builtLibraries) { |
| 7272 Source librarySource = library.librarySource; | 7413 Source librarySource = library.librarySource; |
| 7273 for (Source source in library.compilationUnitSources) { | 7414 for (Source source in library.compilationUnitSources) { |
| 7274 CompilationUnit unit = library.getAST(source); | 7415 CompilationUnit unit = library.getAST(source); |
| 7275 List<AnalysisError> errors = errorListener.getErrorsForSource(source); | 7416 List<AnalysisError> errors = errorListener.getErrorsForSource(source); |
| 7276 LineInfo lineInfo = getLineInfo(source); | 7417 LineInfo lineInfo = getLineInfo(source); |
| 7277 DartEntryImpl dartCopy = _cache.get(source).writableCopy as DartEntryI
mpl; | 7418 DartEntryImpl dartCopy = _cache.get(source).writableCopy as DartEntryI
mpl; |
| 7278 if (thrownException == null) { | 7419 if (thrownException == null) { |
| 7279 dartCopy.setValueInLibrary(DartEntry.BUILD_ELEMENT_ERRORS, librarySo
urce, errors); | 7420 dartCopy.setValueInLibrary(DartEntry.BUILD_ELEMENT_ERRORS, librarySo
urce, errors); |
| 7421 dartCopy.setValueInLibrary(DartEntry.BUILT_UNIT, librarySource, unit
); |
| 7280 if (source == librarySource) { | 7422 if (source == librarySource) { |
| 7281 LibraryElementImpl libraryElement = library.libraryElement; | 7423 LibraryElementImpl libraryElement = library.libraryElement; |
| 7282 dartCopy.setValue(DartEntry.ELEMENT, libraryElement); | 7424 dartCopy.setValue(DartEntry.ELEMENT, libraryElement); |
| 7283 dartCopy.setValue(DartEntry.IS_LAUNCHABLE, libraryElement.entryPoi
nt != null); | 7425 dartCopy.setValue(DartEntry.IS_LAUNCHABLE, libraryElement.entryPoi
nt != null); |
| 7284 dartCopy.setValue(DartEntry.IS_CLIENT, _isClient(libraryElement, h
tmlSource, new Set<LibraryElement>())); | 7426 dartCopy.setValue(DartEntry.IS_CLIENT, _isClient(libraryElement, h
tmlSource, new Set<LibraryElement>())); |
| 7285 } | 7427 } |
| 7286 } else { | 7428 } else { |
| 7287 dartCopy.recordResolutionError(); | 7429 dartCopy.recordBuildElementError(); |
| 7288 _cache.remove(source); | 7430 _cache.remove(source); |
| 7289 } | 7431 } |
| 7290 dartCopy.exception = thrownException; | 7432 dartCopy.exception = thrownException; |
| 7291 _cache.put(source, dartCopy); | 7433 _cache.put(source, dartCopy); |
| 7292 if (source != librarySource) { | 7434 if (source != librarySource) { |
| 7293 _workManager.add(librarySource, SourcePriority.PRIORITY_PART); | 7435 _workManager.add(librarySource, SourcePriority.PRIORITY_PART); |
| 7294 } | 7436 } |
| 7295 if (source == targetLibrary) { | 7437 if (source == targetLibrary) { |
| 7296 targetEntry = dartCopy; | 7438 targetEntry = dartCopy; |
| 7297 } | 7439 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 7308 DartEntry dartEntry = _getReadableDartEntry(source); | 7450 DartEntry dartEntry = _getReadableDartEntry(source); |
| 7309 if (dartEntry != null) { | 7451 if (dartEntry != null) { |
| 7310 int resultTime = library.getModificationTime(source); | 7452 int resultTime = library.getModificationTime(source); |
| 7311 writer.println(" ${_debuggingString(source)}; sourceTime = ${getMod
ificationStamp(source)}, resultTime = ${resultTime}, cacheTime = ${dartEntry.mod
ificationTime}"); | 7453 writer.println(" ${_debuggingString(source)}; sourceTime = ${getMod
ificationStamp(source)}, resultTime = ${resultTime}, cacheTime = ${dartEntry.mod
ificationTime}"); |
| 7312 DartEntryImpl dartCopy = dartEntry.writableCopy; | 7454 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 7313 if (thrownException == null || resultTime >= 0) { | 7455 if (thrownException == null || resultTime >= 0) { |
| 7314 // | 7456 // |
| 7315 // The analysis was performed on out-of-date sources. Mark the cac
he so that the | 7457 // The analysis was performed on out-of-date sources. Mark the cac
he so that the |
| 7316 // sources will be re-analyzed using the up-to-date sources. | 7458 // sources will be re-analyzed using the up-to-date sources. |
| 7317 // | 7459 // |
| 7318 dartCopy.recordResolutionNotInProcess(); | 7460 dartCopy.recordBuildElementNotInProcess(); |
| 7319 } else { | 7461 } else { |
| 7320 // | 7462 // |
| 7321 // We could not determine whether the sources were up-to-date or o
ut-of-date. Mark | 7463 // We could not determine whether the sources were up-to-date or o
ut-of-date. Mark |
| 7322 // the cache so that we won't attempt to re-analyze the sources un
til there's a | 7464 // the cache so that we won't attempt to re-analyze the sources un
til there's a |
| 7323 // good chance that we'll be able to do so without error. | 7465 // good chance that we'll be able to do so without error. |
| 7324 // | 7466 // |
| 7325 dartCopy.recordResolutionError(); | 7467 dartCopy.recordBuildElementError(); |
| 7326 _cache.remove(source); | 7468 _cache.remove(source); |
| 7327 } | 7469 } |
| 7328 dartCopy.exception = thrownException; | 7470 dartCopy.exception = thrownException; |
| 7329 _cache.put(source, dartCopy); | 7471 _cache.put(source, dartCopy); |
| 7330 if (source == targetLibrary) { | 7472 if (source == targetLibrary) { |
| 7331 targetEntry = dartCopy; | 7473 targetEntry = dartCopy; |
| 7332 } | 7474 } |
| 7333 } else { | 7475 } else { |
| 7334 writer.println(" ${_debuggingString(source)}; sourceTime = ${getMod
ificationStamp(source)}, no entry"); | 7476 writer.println(" ${_debuggingString(source)}; sourceTime = ${getMod
ificationStamp(source)}, no entry"); |
| 7335 } | 7477 } |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8474 htmlCopy.modificationTime = getModificationStamp(source); | 8616 htmlCopy.modificationTime = getModificationStamp(source); |
| 8475 _invalidateAngularResolution(htmlCopy); | 8617 _invalidateAngularResolution(htmlCopy); |
| 8476 htmlCopy.invalidateAllInformation(); | 8618 htmlCopy.invalidateAllInformation(); |
| 8477 _cache.put(source, htmlCopy); | 8619 _cache.put(source, htmlCopy); |
| 8478 _cache.removedAst(source); | 8620 _cache.removedAst(source); |
| 8479 _workManager.add(source, SourcePriority.HTML); | 8621 _workManager.add(source, SourcePriority.HTML); |
| 8480 } else if (sourceEntry is DartEntry) { | 8622 } else if (sourceEntry is DartEntry) { |
| 8481 List<Source> containingLibraries = getLibrariesContaining(source); | 8623 List<Source> containingLibraries = getLibrariesContaining(source); |
| 8482 Set<Source> librariesToInvalidate = new Set<Source>(); | 8624 Set<Source> librariesToInvalidate = new Set<Source>(); |
| 8483 for (Source containingLibrary in containingLibraries) { | 8625 for (Source containingLibrary in containingLibraries) { |
| 8484 librariesToInvalidate.add(containingLibrary); | 8626 _computeAllLibrariesDependingOn(containingLibrary, librariesToInvalidate
); |
| 8485 for (Source dependentLibrary in getLibrariesDependingOn(containingLibrar
y)) { | |
| 8486 librariesToInvalidate.add(dependentLibrary); | |
| 8487 } | |
| 8488 } | 8627 } |
| 8489 for (Source library in librariesToInvalidate) { | 8628 for (Source library in librariesToInvalidate) { |
| 8490 // for (Source library : containingLibraries) { | 8629 // for (Source library : containingLibraries) { |
| 8491 _invalidateLibraryResolution(library); | 8630 _invalidateLibraryResolution(library); |
| 8492 } | 8631 } |
| 8493 _removeFromParts(source, _cache.get(source) as DartEntry); | 8632 _removeFromParts(source, _cache.get(source) as DartEntry); |
| 8494 DartEntryImpl dartCopy = (_cache.get(source) as DartEntry).writableCopy; | 8633 DartEntryImpl dartCopy = (_cache.get(source) as DartEntry).writableCopy; |
| 8495 dartCopy.modificationTime = getModificationStamp(source); | 8634 dartCopy.modificationTime = getModificationStamp(source); |
| 8496 dartCopy.invalidateAllInformation(); | 8635 dartCopy.invalidateAllInformation(); |
| 8497 _cache.put(source, dartCopy); | 8636 _cache.put(source, dartCopy); |
| (...skipping 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10971 _index = 0; | 11110 _index = 0; |
| 10972 _queueIndex++; | 11111 _queueIndex++; |
| 10973 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { | 11112 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { |
| 10974 _queueIndex++; | 11113 _queueIndex++; |
| 10975 } | 11114 } |
| 10976 } | 11115 } |
| 10977 } | 11116 } |
| 10978 } | 11117 } |
| 10979 | 11118 |
| 10980 /** | 11119 /** |
| 10981 * An [Expression] with optional [AngularFilterNode]s. | 11120 * An [Expression] with optional [AngularFormatterNode]s. |
| 10982 */ | 11121 */ |
| 10983 class AngularExpression { | 11122 class AngularExpression { |
| 10984 /** | 11123 /** |
| 10985 * The [Expression] to apply filters to. | 11124 * The [Expression] to apply formatters to. |
| 10986 */ | 11125 */ |
| 10987 final Expression expression; | 11126 final Expression expression; |
| 10988 | 11127 |
| 10989 /** | 11128 /** |
| 10990 * The filters to apply. | 11129 * The formatters to apply. |
| 10991 */ | 11130 */ |
| 10992 final List<AngularFilterNode> filters; | 11131 final List<AngularFormatterNode> formatters; |
| 10993 | 11132 |
| 10994 AngularExpression(this.expression, this.filters); | 11133 AngularExpression(this.expression, this.formatters); |
| 10995 | 11134 |
| 10996 /** | 11135 /** |
| 10997 * Return the offset of the character immediately following the last character
of this node's | 11136 * Return the offset of the character immediately following the last character
of this node's |
| 10998 * source range. This is equivalent to `node.getOffset() + node.getLength()`. | 11137 * source range. This is equivalent to `node.getOffset() + node.getLength()`. |
| 10999 * | 11138 * |
| 11000 * @return the offset of the character just past the node's source range | 11139 * @return the offset of the character just past the node's source range |
| 11001 */ | 11140 */ |
| 11002 int get end { | 11141 int get end { |
| 11003 if (filters.isEmpty) { | 11142 if (formatters.isEmpty) { |
| 11004 return expression.end; | 11143 return expression.end; |
| 11005 } | 11144 } |
| 11006 AngularFilterNode lastFilter = filters[filters.length - 1]; | 11145 AngularFormatterNode lastFormatter = formatters[formatters.length - 1]; |
| 11007 List<AngularFilterArgument> filterArguments = lastFilter.arguments; | 11146 List<AngularFormatterArgument> formatterArguments = lastFormatter.arguments; |
| 11008 if (filterArguments.isEmpty) { | 11147 if (formatterArguments.isEmpty) { |
| 11009 return lastFilter.name.end; | 11148 return lastFormatter.name.end; |
| 11010 } | 11149 } |
| 11011 return filterArguments[filterArguments.length - 1].expression.end; | 11150 return formatterArguments[formatterArguments.length - 1].expression.end; |
| 11012 } | 11151 } |
| 11013 | 11152 |
| 11014 /** | 11153 /** |
| 11015 * Return Dart [Expression]s this Angular expression consists of. | 11154 * Return Dart [Expression]s this Angular expression consists of. |
| 11016 */ | 11155 */ |
| 11017 List<Expression> get expressions { | 11156 List<Expression> get expressions { |
| 11018 List<Expression> expressions = []; | 11157 List<Expression> expressions = []; |
| 11019 expressions.add(expression); | 11158 expressions.add(expression); |
| 11020 for (AngularFilterNode filter in filters) { | 11159 for (AngularFormatterNode formatter in formatters) { |
| 11021 expressions.add(filter.name); | 11160 expressions.add(formatter.name); |
| 11022 for (AngularFilterArgument filterArgument in filter.arguments) { | 11161 for (AngularFormatterArgument formatterArgument in formatter.arguments) { |
| 11023 expressions.addAll(filterArgument.subExpressions); | 11162 expressions.addAll(formatterArgument.subExpressions); |
| 11024 expressions.add(filterArgument.expression); | 11163 expressions.add(formatterArgument.expression); |
| 11025 } | 11164 } |
| 11026 } | 11165 } |
| 11027 return expressions; | 11166 return expressions; |
| 11028 } | 11167 } |
| 11029 | 11168 |
| 11030 /** | 11169 /** |
| 11031 * Return the number of characters in the expression's source range. | 11170 * Return the number of characters in the expression's source range. |
| 11032 */ | 11171 */ |
| 11033 int get length => end - offset; | 11172 int get length => end - offset; |
| 11034 | 11173 |
| 11035 /** | 11174 /** |
| 11036 * Return the offset of the first character in the expression's source range. | 11175 * Return the offset of the first character in the expression's source range. |
| 11037 */ | 11176 */ |
| 11038 int get offset => expression.offset; | 11177 int get offset => expression.offset; |
| 11039 } | 11178 } |
| 11040 | 11179 |
| 11041 /** | 11180 /** |
| 11042 * Angular filter argument. | 11181 * Angular formatter argument. |
| 11043 */ | 11182 */ |
| 11044 class AngularFilterArgument { | 11183 class AngularFormatterArgument { |
| 11045 /** | 11184 /** |
| 11046 * The [TokenType#COLON] token. | 11185 * The [TokenType#COLON] token. |
| 11047 */ | 11186 */ |
| 11048 final Token token; | 11187 final Token token; |
| 11049 | 11188 |
| 11050 /** | 11189 /** |
| 11051 * The argument expression. | 11190 * The argument expression. |
| 11052 */ | 11191 */ |
| 11053 final Expression expression; | 11192 final Expression expression; |
| 11054 | 11193 |
| 11055 /** | 11194 /** |
| 11056 * The optional sub-[Expression]s. | 11195 * The optional sub-[Expression]s. |
| 11057 */ | 11196 */ |
| 11058 List<Expression> subExpressions = Expression.EMPTY_ARRAY; | 11197 List<Expression> subExpressions = Expression.EMPTY_ARRAY; |
| 11059 | 11198 |
| 11060 AngularFilterArgument(this.token, this.expression); | 11199 AngularFormatterArgument(this.token, this.expression); |
| 11061 } | 11200 } |
| 11062 | 11201 |
| 11063 /** | 11202 /** |
| 11064 * Angular filter node. | 11203 * Angular formatter node. |
| 11065 */ | 11204 */ |
| 11066 class AngularFilterNode { | 11205 class AngularFormatterNode { |
| 11067 /** | 11206 /** |
| 11068 * The [TokenType#BAR] token. | 11207 * The [TokenType#BAR] token. |
| 11069 */ | 11208 */ |
| 11070 final Token token; | 11209 final Token token; |
| 11071 | 11210 |
| 11072 /** | 11211 /** |
| 11073 * The name of the filter. | 11212 * The name of the formatter. |
| 11074 */ | 11213 */ |
| 11075 final SimpleIdentifier name; | 11214 final SimpleIdentifier name; |
| 11076 | 11215 |
| 11077 /** | 11216 /** |
| 11078 * The arguments for this filter. | 11217 * The arguments for this formatter. |
| 11079 */ | 11218 */ |
| 11080 final List<AngularFilterArgument> arguments; | 11219 final List<AngularFormatterArgument> arguments; |
| 11081 | 11220 |
| 11082 AngularFilterNode(this.token, this.name, this.arguments); | 11221 AngularFormatterNode(this.token, this.name, this.arguments); |
| 11083 } | 11222 } |
| 11084 | 11223 |
| 11085 /** | 11224 /** |
| 11086 * Instances of the class [AngularHtmlUnitResolver] resolve Angular specific exp
ressions. | 11225 * Instances of the class [AngularHtmlUnitResolver] resolve Angular specific exp
ressions. |
| 11087 */ | 11226 */ |
| 11088 class AngularHtmlUnitResolver extends ht.RecursiveXmlVisitor<Object> { | 11227 class AngularHtmlUnitResolver extends ht.RecursiveXmlVisitor<Object> { |
| 11089 static String _NG_APP = "ng-app"; | 11228 static String _NG_APP = "ng-app"; |
| 11090 | 11229 |
| 11091 /** | 11230 /** |
| 11092 * Checks if given [Element] is an artificial local variable and returns corre
sponding | 11231 * Checks if given [Element] is an artificial local variable and returns corre
sponding |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11426 * Parses given [String] as an [AngularExpression] at the given offset. | 11565 * Parses given [String] as an [AngularExpression] at the given offset. |
| 11427 */ | 11566 */ |
| 11428 AngularExpression _parseAngularExpression(String contents, int startIndex, int
endIndex, int offset) { | 11567 AngularExpression _parseAngularExpression(String contents, int startIndex, int
endIndex, int offset) { |
| 11429 Token token = _scanDart(contents, startIndex, endIndex, offset); | 11568 Token token = _scanDart(contents, startIndex, endIndex, offset); |
| 11430 return _parseAngularExpressionInToken(token); | 11569 return _parseAngularExpressionInToken(token); |
| 11431 } | 11570 } |
| 11432 | 11571 |
| 11433 AngularExpression _parseAngularExpressionInToken(Token token) { | 11572 AngularExpression _parseAngularExpressionInToken(Token token) { |
| 11434 List<Token> tokens = _splitAtBar(token); | 11573 List<Token> tokens = _splitAtBar(token); |
| 11435 Expression mainExpression = _parseDartExpressionInToken(tokens[0]); | 11574 Expression mainExpression = _parseDartExpressionInToken(tokens[0]); |
| 11436 // parse filters | 11575 // parse formatters |
| 11437 List<AngularFilterNode> filters = []; | 11576 List<AngularFormatterNode> formatters = []; |
| 11438 for (int i = 1; i < tokens.length; i++) { | 11577 for (int i = 1; i < tokens.length; i++) { |
| 11439 Token filterToken = tokens[i]; | 11578 Token formatterToken = tokens[i]; |
| 11440 Token barToken = filterToken; | 11579 Token barToken = formatterToken; |
| 11441 filterToken = filterToken.next; | 11580 formatterToken = formatterToken.next; |
| 11442 // parse name | 11581 // parse name |
| 11443 Expression nameExpression = _parseDartExpressionInToken(filterToken); | 11582 Expression nameExpression = _parseDartExpressionInToken(formatterToken); |
| 11444 if (nameExpression is! SimpleIdentifier) { | 11583 if (nameExpression is! SimpleIdentifier) { |
| 11445 _reportErrorForNode(AngularCode.INVALID_FILTER_NAME, nameExpression, [])
; | 11584 _reportErrorForNode(AngularCode.INVALID_FORMATTER_NAME, nameExpression,
[]); |
| 11446 continue; | 11585 continue; |
| 11447 } | 11586 } |
| 11448 SimpleIdentifier name = nameExpression as SimpleIdentifier; | 11587 SimpleIdentifier name = nameExpression as SimpleIdentifier; |
| 11449 filterToken = name.endToken.next; | 11588 formatterToken = name.endToken.next; |
| 11450 // parse arguments | 11589 // parse arguments |
| 11451 List<AngularFilterArgument> arguments = []; | 11590 List<AngularFormatterArgument> arguments = []; |
| 11452 while (filterToken.type != TokenType.EOF) { | 11591 while (formatterToken.type != TokenType.EOF) { |
| 11453 // skip ":" | 11592 // skip ":" |
| 11454 Token colonToken = filterToken; | 11593 Token colonToken = formatterToken; |
| 11455 if (colonToken.type == TokenType.COLON) { | 11594 if (colonToken.type == TokenType.COLON) { |
| 11456 filterToken = filterToken.next; | 11595 formatterToken = formatterToken.next; |
| 11457 } else { | 11596 } else { |
| 11458 _reportErrorForToken(AngularCode.MISSING_FILTER_COLON, colonToken, [])
; | 11597 _reportErrorForToken(AngularCode.MISSING_FORMATTER_COLON, colonToken,
[]); |
| 11459 } | 11598 } |
| 11460 // parse argument | 11599 // parse argument |
| 11461 Expression argument = _parseDartExpressionInToken(filterToken); | 11600 Expression argument = _parseDartExpressionInToken(formatterToken); |
| 11462 arguments.add(new AngularFilterArgument(colonToken, argument)); | 11601 arguments.add(new AngularFormatterArgument(colonToken, argument)); |
| 11463 // next token | 11602 // next token |
| 11464 filterToken = argument.endToken.next; | 11603 formatterToken = argument.endToken.next; |
| 11465 } | 11604 } |
| 11466 filters.add(new AngularFilterNode(barToken, name, arguments)); | 11605 formatters.add(new AngularFormatterNode(barToken, name, arguments)); |
| 11467 } | 11606 } |
| 11468 // done | 11607 // done |
| 11469 return new AngularExpression(mainExpression, filters); | 11608 return new AngularExpression(mainExpression, formatters); |
| 11470 } | 11609 } |
| 11471 | 11610 |
| 11472 /** | 11611 /** |
| 11473 * Parses given [String] as an [Expression] at the given offset. | 11612 * Parses given [String] as an [Expression] at the given offset. |
| 11474 */ | 11613 */ |
| 11475 Expression _parseDartExpression(String contents, int startIndex, int endIndex,
int offset) { | 11614 Expression _parseDartExpression(String contents, int startIndex, int endIndex,
int offset) { |
| 11476 Token token = _scanDart(contents, startIndex, endIndex, offset); | 11615 Token token = _scanDart(contents, startIndex, endIndex, offset); |
| 11477 return _parseDartExpressionInToken(token); | 11616 return _parseDartExpressionInToken(token); |
| 11478 } | 11617 } |
| 11479 | 11618 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11535 // create CompilationUnitElementImpl | 11674 // create CompilationUnitElementImpl |
| 11536 String unitName = _source.shortName; | 11675 String unitName = _source.shortName; |
| 11537 _unitElement = new CompilationUnitElementImpl(unitName); | 11676 _unitElement = new CompilationUnitElementImpl(unitName); |
| 11538 _unitElement.source = _source; | 11677 _unitElement.source = _source; |
| 11539 // create LibraryElementImpl | 11678 // create LibraryElementImpl |
| 11540 _libraryElement = new LibraryElementImpl(_context, null); | 11679 _libraryElement = new LibraryElementImpl(_context, null); |
| 11541 _libraryElement.definingCompilationUnit = _unitElement; | 11680 _libraryElement.definingCompilationUnit = _unitElement; |
| 11542 _libraryElement.angularHtml = true; | 11681 _libraryElement.angularHtml = true; |
| 11543 _injectedLibraries.add(_libraryElement); | 11682 _injectedLibraries.add(_libraryElement); |
| 11544 // create FunctionElementImpl | 11683 // create FunctionElementImpl |
| 11545 _functionElement = new FunctionElementImpl.con2(0); | 11684 _functionElement = new FunctionElementImpl.forOffset(0); |
| 11546 _unitElement.functions = <FunctionElement> [_functionElement]; | 11685 _unitElement.functions = <FunctionElement> [_functionElement]; |
| 11547 } | 11686 } |
| 11548 | 11687 |
| 11549 /** | 11688 /** |
| 11550 * Creates new [NgProcessor] for the given [AngularElement], maybe `null` if n
ot | 11689 * Creates new [NgProcessor] for the given [AngularElement], maybe `null` if n
ot |
| 11551 * supported. | 11690 * supported. |
| 11552 */ | 11691 */ |
| 11553 NgProcessor _createProcessor(AngularElement element) { | 11692 NgProcessor _createProcessor(AngularElement element) { |
| 11554 if (element is AngularComponentElement) { | 11693 if (element is AngularComponentElement) { |
| 11555 AngularComponentElement component = element; | 11694 AngularComponentElement component = element; |
| 11556 return new NgComponentElementProcessor(component); | 11695 return new NgComponentElementProcessor(component); |
| 11557 } | 11696 } |
| 11558 if (element is AngularControllerElement) { | 11697 if (element is AngularControllerElement) { |
| 11559 AngularControllerElement controller = element; | 11698 AngularControllerElement controller = element; |
| 11560 return new NgControllerElementProcessor(controller); | 11699 return new NgControllerElementProcessor(controller); |
| 11561 } | 11700 } |
| 11562 if (element is AngularDirectiveElement) { | 11701 if (element is AngularDecoratorElement) { |
| 11563 AngularDirectiveElement directive = element; | 11702 AngularDecoratorElement directive = element; |
| 11564 return new NgDirectiveElementProcessor(directive); | 11703 return new NgDecoratorElementProcessor(directive); |
| 11565 } | 11704 } |
| 11566 return null; | 11705 return null; |
| 11567 } | 11706 } |
| 11568 | 11707 |
| 11569 /** | 11708 /** |
| 11570 * Puts into [resolver] an [ResolverVisitor] to resolve [Expression]s in | 11709 * Puts into [resolver] an [ResolverVisitor] to resolve [Expression]s in |
| 11571 * [source]. | 11710 * [source]. |
| 11572 */ | 11711 */ |
| 11573 void _createResolver() { | 11712 void _createResolver() { |
| 11574 InheritanceManager inheritanceManager = new InheritanceManager(_libraryEleme
nt); | 11713 InheritanceManager inheritanceManager = new InheritanceManager(_libraryEleme
nt); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11715 _defineTopVariable_forScopeProperty(scopeProperty); | 11854 _defineTopVariable_forScopeProperty(scopeProperty); |
| 11716 } | 11855 } |
| 11717 } | 11856 } |
| 11718 // add processors | 11857 // add processors |
| 11719 for (AngularElement angularElement in angularElements) { | 11858 for (AngularElement angularElement in angularElements) { |
| 11720 NgProcessor processor = _createProcessor(angularElement); | 11859 NgProcessor processor = _createProcessor(angularElement); |
| 11721 if (processor != null) { | 11860 if (processor != null) { |
| 11722 _processors.add(processor); | 11861 _processors.add(processor); |
| 11723 } | 11862 } |
| 11724 } | 11863 } |
| 11725 // define filters | 11864 // define formatters |
| 11726 for (AngularElement angularElement in angularElements) { | 11865 for (AngularElement angularElement in angularElements) { |
| 11727 if (angularElement is AngularFilterElement) { | 11866 if (angularElement is AngularFormatterElement) { |
| 11728 _defineTopVariable_forClassElement(angularElement); | 11867 _defineTopVariable_forClassElement(angularElement); |
| 11729 } | 11868 } |
| 11730 } | 11869 } |
| 11731 // run this HTML visitor | 11870 // run this HTML visitor |
| 11732 _unit.accept(this); | 11871 _unit.accept(this); |
| 11733 // simulate imports for injects | 11872 // simulate imports for injects |
| 11734 { | 11873 { |
| 11735 List<ImportElement> imports = []; | 11874 List<ImportElement> imports = []; |
| 11736 for (LibraryElement injectedLibrary in _injectedLibraries) { | 11875 for (LibraryElement injectedLibrary in _injectedLibraries) { |
| 11737 ImportElementImpl importElement = new ImportElementImpl(-1); | 11876 ImportElementImpl importElement = new ImportElementImpl(-1); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11881 | 12020 |
| 11882 AngularXmlExpression(this.expression); | 12021 AngularXmlExpression(this.expression); |
| 11883 | 12022 |
| 11884 @override | 12023 @override |
| 11885 ht.XmlExpression_Reference getReference(int offset) { | 12024 ht.XmlExpression_Reference getReference(int offset) { |
| 11886 // main expression | 12025 // main expression |
| 11887 ht.XmlExpression_Reference reference = _getReferenceAtNode(expression.expres
sion, offset); | 12026 ht.XmlExpression_Reference reference = _getReferenceAtNode(expression.expres
sion, offset); |
| 11888 if (reference != null) { | 12027 if (reference != null) { |
| 11889 return reference; | 12028 return reference; |
| 11890 } | 12029 } |
| 11891 // filters | 12030 // formatters |
| 11892 for (AngularFilterNode filter in expression.filters) { | 12031 for (AngularFormatterNode formatter in expression.formatters) { |
| 11893 // filter name | 12032 // formatter name |
| 11894 reference = _getReferenceAtNode(filter.name, offset); | 12033 reference = _getReferenceAtNode(formatter.name, offset); |
| 11895 if (reference != null) { | 12034 if (reference != null) { |
| 11896 return reference; | 12035 return reference; |
| 11897 } | 12036 } |
| 11898 // filter arguments | 12037 // formatter arguments |
| 11899 for (AngularFilterArgument filterArgument in filter.arguments) { | 12038 for (AngularFormatterArgument formatterArgument in formatter.arguments) { |
| 11900 reference = _getReferenceAtNode(filterArgument.expression, offset); | 12039 reference = _getReferenceAtNode(formatterArgument.expression, offset); |
| 11901 if (reference != null) { | 12040 if (reference != null) { |
| 11902 return reference; | 12041 return reference; |
| 11903 } | 12042 } |
| 11904 } | 12043 } |
| 11905 } | 12044 } |
| 11906 return null; | 12045 return null; |
| 11907 } | 12046 } |
| 11908 | 12047 |
| 11909 /** | 12048 /** |
| 11910 * If the given [AstNode] has an [Element] at the given offset, then returns | 12049 * If the given [AstNode] has an [Element] at the given offset, then returns |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12009 LocalVariableElementImpl variable = resolver._createLocalVariableWithName(ty
pe, name); | 12148 LocalVariableElementImpl variable = resolver._createLocalVariableWithName(ty
pe, name); |
| 12010 resolver._defineVariable(variable); | 12149 resolver._defineVariable(variable); |
| 12011 variable.toolkitObjects = <AngularElement> [_element]; | 12150 variable.toolkitObjects = <AngularElement> [_element]; |
| 12012 } | 12151 } |
| 12013 | 12152 |
| 12014 @override | 12153 @override |
| 12015 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node); | 12154 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node); |
| 12016 } | 12155 } |
| 12017 | 12156 |
| 12018 /** | 12157 /** |
| 12019 * [NgDirectiveElementProcessor] applies [AngularDirectiveElement] by parsing ma
pped | 12158 * [NgDecoratorElementProcessor] applies [AngularDecoratorElement] by parsing ma
pped |
| 12020 * attributes as expressions. | 12159 * attributes as expressions. |
| 12021 */ | 12160 */ |
| 12022 class NgDirectiveElementProcessor extends NgDirectiveProcessor { | 12161 class NgDecoratorElementProcessor extends NgDirectiveProcessor { |
| 12023 final AngularDirectiveElement _element; | 12162 final AngularDecoratorElement _element; |
| 12024 | 12163 |
| 12025 NgDirectiveElementProcessor(this._element); | 12164 NgDecoratorElementProcessor(this._element); |
| 12026 | 12165 |
| 12027 @override | 12166 @override |
| 12028 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { | 12167 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { |
| 12029 String selectorAttributeName = null; | 12168 String selectorAttributeName = null; |
| 12030 { | 12169 { |
| 12031 AngularSelectorElement selector = _element.selector; | 12170 AngularSelectorElement selector = _element.selector; |
| 12032 if (selector is HasAttributeSelectorElementImpl) { | 12171 if (selector is HasAttributeSelectorElementImpl) { |
| 12033 selectorAttributeName = selector.name; | 12172 selectorAttributeName = selector.name; |
| 12034 // resolve attribute expression | 12173 // resolve attribute expression |
| 12035 ht.XmlAttributeNode attribute = node.getAttribute(selectorAttributeName)
; | 12174 ht.XmlAttributeNode attribute = node.getAttribute(selectorAttributeName)
; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12081 */ | 12220 */ |
| 12082 void _onNgEventDirective(AngularHtmlUnitResolver resolver) { | 12221 void _onNgEventDirective(AngularHtmlUnitResolver resolver) { |
| 12083 if (_element.isClass("NgEventDirective")) { | 12222 if (_element.isClass("NgEventDirective")) { |
| 12084 DartType dynamicType = resolver.typeProvider.dynamicType; | 12223 DartType dynamicType = resolver.typeProvider.dynamicType; |
| 12085 resolver._defineVariable(resolver._createLocalVariableWithName(dynamicType
, "\$event")); | 12224 resolver._defineVariable(resolver._createLocalVariableWithName(dynamicType
, "\$event")); |
| 12086 } | 12225 } |
| 12087 } | 12226 } |
| 12088 } | 12227 } |
| 12089 | 12228 |
| 12090 /** | 12229 /** |
| 12091 * [NgDirectiveProcessor] describes any <code>NgDirective</code> annotation inst
ance. | 12230 * [NgDirectiveProcessor] describes any <code>Directive</code> annotation instan
ce. |
| 12092 */ | 12231 */ |
| 12093 abstract class NgDirectiveProcessor extends NgProcessor { | 12232 abstract class NgDirectiveProcessor extends NgProcessor { |
| 12094 static bool hasValue(ht.XmlAttributeNode attribute) { | 12233 static bool hasValue(ht.XmlAttributeNode attribute) { |
| 12095 ht.Token valueToken = attribute.valueToken; | 12234 ht.Token valueToken = attribute.valueToken; |
| 12096 return valueToken != null && !valueToken.isSynthetic; | 12235 return valueToken != null && !valueToken.isSynthetic; |
| 12097 } | 12236 } |
| 12098 | 12237 |
| 12099 static AngularRawXmlExpression newAngularRawXmlExpression(AngularExpression e)
=> new AngularRawXmlExpression(e); | 12238 static AngularRawXmlExpression newAngularRawXmlExpression(AngularExpression e)
=> new AngularRawXmlExpression(e); |
| 12100 | 12239 |
| 12101 static ht.RawXmlExpression newRawXmlExpression(Expression e) => new ht.RawXmlE
xpression(e); | 12240 static ht.RawXmlExpression newRawXmlExpression(Expression e) => new ht.RawXmlE
xpression(e); |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12841 } | 12980 } |
| 12842 | 12981 |
| 12843 /** | 12982 /** |
| 12844 * Instances of the class `BuildDartElementModelTask` build the element models f
or all of the | 12983 * Instances of the class `BuildDartElementModelTask` build the element models f
or all of the |
| 12845 * libraries in a cycle. | 12984 * libraries in a cycle. |
| 12846 */ | 12985 */ |
| 12847 class BuildDartElementModelTask extends AnalysisTask { | 12986 class BuildDartElementModelTask extends AnalysisTask { |
| 12848 /** | 12987 /** |
| 12849 * The library for which an element model was originally requested. | 12988 * The library for which an element model was originally requested. |
| 12850 */ | 12989 */ |
| 12851 Source _targetLibrary; | 12990 final Source targetLibrary; |
| 12852 | 12991 |
| 12853 /** | 12992 /** |
| 12854 * The libraries that are part of the cycle to be resolved. | 12993 * The libraries that are part of the cycle to be resolved. |
| 12855 */ | 12994 */ |
| 12856 final List<ResolvableLibrary> librariesInCycle; | 12995 final List<ResolvableLibrary> librariesInCycle; |
| 12857 | 12996 |
| 12858 /** | 12997 /** |
| 12859 * The listener to which analysis errors will be reported. | 12998 * The listener to which analysis errors will be reported. |
| 12860 */ | 12999 */ |
| 12861 RecordingErrorListener _errorListener; | 13000 RecordingErrorListener _errorListener; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 12875 */ | 13014 */ |
| 12876 Map<Source, ResolvableLibrary> _libraryMap = new Map<Source, ResolvableLibrary
>(); | 13015 Map<Source, ResolvableLibrary> _libraryMap = new Map<Source, ResolvableLibrary
>(); |
| 12877 | 13016 |
| 12878 /** | 13017 /** |
| 12879 * Initialize a newly created task to perform analysis within the given contex
t. | 13018 * Initialize a newly created task to perform analysis within the given contex
t. |
| 12880 * | 13019 * |
| 12881 * @param context the context in which the task is to be performed | 13020 * @param context the context in which the task is to be performed |
| 12882 * @param targetLibrary the library for which an element model was originally
requested | 13021 * @param targetLibrary the library for which an element model was originally
requested |
| 12883 * @param librariesInCycle the libraries that are part of the cycle to be reso
lved | 13022 * @param librariesInCycle the libraries that are part of the cycle to be reso
lved |
| 12884 */ | 13023 */ |
| 12885 BuildDartElementModelTask(InternalAnalysisContext context, Source targetLibrar
y, this.librariesInCycle) : super(context) { | 13024 BuildDartElementModelTask(InternalAnalysisContext context, this.targetLibrary,
this.librariesInCycle) : super(context) { |
| 12886 this._errorListener = new RecordingErrorListener(); | 13025 this._errorListener = new RecordingErrorListener(); |
| 12887 _coreLibrarySource = context.sourceFactory.forUri(DartSdk.DART_CORE); | 13026 _coreLibrarySource = context.sourceFactory.forUri(DartSdk.DART_CORE); |
| 12888 } | 13027 } |
| 12889 | 13028 |
| 12890 @override | 13029 @override |
| 12891 accept(AnalysisTaskVisitor visitor) => visitor.visitBuildDartElementModelTask(
this); | 13030 accept(AnalysisTaskVisitor visitor) => visitor.visitBuildDartElementModelTask(
this); |
| 12892 | 13031 |
| 12893 /** | 13032 /** |
| 12894 * Return the listener to which analysis errors were (or will be) reported. | 13033 * Return the listener to which analysis errors were (or will be) reported. |
| 12895 * | 13034 * |
| 12896 * @return the listener to which analysis errors were reported | 13035 * @return the listener to which analysis errors were reported |
| 12897 */ | 13036 */ |
| 12898 RecordingErrorListener get errorListener => _errorListener; | 13037 RecordingErrorListener get errorListener => _errorListener; |
| 12899 | 13038 |
| 12900 /** | |
| 12901 * Return the library for which an element model was originally requested. | |
| 12902 * | |
| 12903 * @return the library for which an element model was originally requested | |
| 12904 */ | |
| 12905 Source get targetLibrary => _targetLibrary; | |
| 12906 | |
| 12907 @override | 13039 @override |
| 12908 String get taskDescription { | 13040 String get taskDescription { |
| 12909 Source librarySource = librariesInCycle[0].librarySource; | 13041 Source librarySource = librariesInCycle[0].librarySource; |
| 12910 if (librarySource == null) { | 13042 if (librarySource == null) { |
| 12911 return "build an element model for unknown library"; | 13043 return "build an element model for unknown library"; |
| 12912 } | 13044 } |
| 12913 return "build an element model for ${librarySource.fullName}"; | 13045 return "build an element model for ${librarySource.fullName}"; |
| 12914 } | 13046 } |
| 12915 | 13047 |
| 12916 @override | 13048 @override |
| 12917 void internalPerform() { | 13049 void internalPerform() { |
| 12918 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.LibraryResolver.resolveLibrary"); | 13050 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.BuildDartElementModel.internalPerform"); |
| 12919 try { | 13051 try { |
| 12920 // | 13052 // |
| 12921 // Build the map of libraries that are known. | 13053 // Build the map of libraries that are known. |
| 12922 // | 13054 // |
| 12923 _libraryMap = _buildLibraryMap(); | 13055 _libraryMap = _buildLibraryMap(); |
| 12924 _coreLibrary = _libraryMap[_coreLibrarySource]; | 13056 _coreLibrary = _libraryMap[_coreLibrarySource]; |
| 12925 LibraryElement coreElement = _coreLibrary.libraryElement; | 13057 LibraryElement coreElement = _coreLibrary.libraryElement; |
| 12926 if (coreElement == null) { | 13058 if (coreElement == null) { |
| 12927 throw new AnalysisException.con1("Could not resolve dart:core"); | 13059 throw new AnalysisException.con1("Could not resolve dart:core"); |
| 12928 } | 13060 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 12944 // | 13076 // |
| 12945 _buildDirectiveModels(); | 13077 _buildDirectiveModels(); |
| 12946 instrumentation.metric3("buildDirectiveModels", "complete"); | 13078 instrumentation.metric3("buildDirectiveModels", "complete"); |
| 12947 // | 13079 // |
| 12948 // 3. Build the rest of the type model by connecting superclasses, mixins,
and interfaces. This | 13080 // 3. Build the rest of the type model by connecting superclasses, mixins,
and interfaces. This |
| 12949 // requires that we be able to compute the names visible in the librari
es being resolved, | 13081 // requires that we be able to compute the names visible in the librari
es being resolved, |
| 12950 // which in turn requires that we have resolved the import directives. | 13082 // which in turn requires that we have resolved the import directives. |
| 12951 // | 13083 // |
| 12952 _buildTypeHierarchies(new TypeProviderImpl(coreElement)); | 13084 _buildTypeHierarchies(new TypeProviderImpl(coreElement)); |
| 12953 instrumentation.metric3("buildTypeHierarchies", "complete"); | 13085 instrumentation.metric3("buildTypeHierarchies", "complete"); |
| 13086 instrumentation.metric2("librariesInCycles", librariesInCycle.length); |
| 13087 for (ResolvableLibrary lib in librariesInCycle) { |
| 13088 instrumentation.metric2("librariesInCycles-CompilationUnitSources-Size",
lib.compilationUnitSources.length); |
| 13089 } |
| 12954 } finally { | 13090 } finally { |
| 12955 instrumentation.log(); | 13091 instrumentation.log(); |
| 12956 } | 13092 } |
| 12957 } | 13093 } |
| 12958 | 13094 |
| 12959 /** | 13095 /** |
| 12960 * Build the element model representing the combinators declared by the given
directive. | 13096 * Build the element model representing the combinators declared by the given
directive. |
| 12961 * | 13097 * |
| 12962 * @param directive the directive that declares the combinators | 13098 * @param directive the directive that declares the combinators |
| 12963 * @return an array containing the import combinators that were built | 13099 * @return an array containing the import combinators that were built |
| (...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14757 } | 14893 } |
| 14758 | 14894 |
| 14759 @override | 14895 @override |
| 14760 void logInformation(String message) { | 14896 void logInformation(String message) { |
| 14761 } | 14897 } |
| 14762 | 14898 |
| 14763 @override | 14899 @override |
| 14764 void logInformation2(String message, Exception exception) { | 14900 void logInformation2(String message, Exception exception) { |
| 14765 } | 14901 } |
| 14766 } | 14902 } |
| OLD | NEW |