| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.src.task.html_work_manager; | 5 library analyzer.src.task.html_work_manager; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/error/error.dart'; |
| 9 import 'package:analyzer/src/context/cache.dart'; | 10 import 'package:analyzer/src/context/cache.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart' | 11 import 'package:analyzer/src/generated/engine.dart' |
| 11 show | 12 show AnalysisEngine, AnalysisErrorInfo, CacheState, InternalAnalysisContext; |
| 12 AnalysisEngine, | |
| 13 AnalysisErrorInfo, | |
| 14 AnalysisErrorInfoImpl, | |
| 15 AnalysisOptions, | |
| 16 CacheState, | |
| 17 InternalAnalysisContext; | |
| 18 import 'package:analyzer/src/generated/error.dart'; | |
| 19 import 'package:analyzer/src/generated/source.dart'; | 13 import 'package:analyzer/src/generated/source.dart'; |
| 20 import 'package:analyzer/src/generated/utilities_collection.dart'; | 14 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| 21 import 'package:analyzer/src/task/html.dart'; | 15 import 'package:analyzer/src/task/html.dart'; |
| 22 import 'package:analyzer/task/html.dart'; | 16 import 'package:analyzer/task/html.dart'; |
| 23 import 'package:analyzer/task/model.dart'; | 17 import 'package:analyzer/task/model.dart'; |
| 24 | 18 |
| 25 /** | 19 /** |
| 26 * The manager for HTML specific analysis. | 20 * The manager for HTML specific analysis. |
| 27 */ | 21 */ |
| 28 class HtmlWorkManager implements WorkManager { | 22 class HtmlWorkManager implements WorkManager { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 htmlSources.add(target); | 218 htmlSources.add(target); |
| 225 } | 219 } |
| 226 if (target is DartScript) { | 220 if (target is DartScript) { |
| 227 scriptTargets.add(target); | 221 scriptTargets.add(target); |
| 228 } | 222 } |
| 229 } | 223 } |
| 230 // Invalidate targets and values. | 224 // Invalidate targets and values. |
| 231 scriptTargets.forEach(partition.remove); | 225 scriptTargets.forEach(partition.remove); |
| 232 for (Source htmlSource in htmlSources) { | 226 for (Source htmlSource in htmlSources) { |
| 233 CacheEntry entry = partition.get(htmlSource); | 227 CacheEntry entry = partition.get(htmlSource); |
| 234 if (htmlSource != null) { | 228 if (entry != null) { |
| 235 entry.setState(HTML_ERRORS, CacheState.INVALID); | 229 entry.setState(HTML_ERRORS, CacheState.INVALID); |
| 236 if (invalidateUris) { | 230 if (invalidateUris) { |
| 237 entry.setState(REFERENCED_LIBRARIES, CacheState.INVALID); | 231 entry.setState(REFERENCED_LIBRARIES, CacheState.INVALID); |
| 238 } | 232 } |
| 239 } | 233 } |
| 240 } | 234 } |
| 241 } | 235 } |
| 242 | 236 |
| 243 /** | 237 /** |
| 244 * Returns `true` if the given [result] of the given [target] needs | 238 * Returns `true` if the given [result] of the given [target] needs |
| 245 * computing, i.e. it is not in the valid and not in the error state. | 239 * computing, i.e. it is not in the valid and not in the error state. |
| 246 */ | 240 */ |
| 247 bool _needsComputing(AnalysisTarget target, ResultDescriptor result) { | 241 bool _needsComputing(AnalysisTarget target, ResultDescriptor result) { |
| 248 CacheState state = analysisCache.getState(target, result); | 242 CacheState state = analysisCache.getState(target, result); |
| 249 return state != CacheState.VALID && state != CacheState.ERROR; | 243 return state != CacheState.VALID && state != CacheState.ERROR; |
| 250 } | 244 } |
| 251 | 245 |
| 252 /** | 246 /** |
| 253 * Return `true` if the given target is an HTML source. | 247 * Return `true` if the given target is an HTML source. |
| 254 */ | 248 */ |
| 255 static bool _isHtmlSource(AnalysisTarget target) { | 249 static bool _isHtmlSource(AnalysisTarget target) { |
| 256 return target is Source && AnalysisEngine.isHtmlFileName(target.fullName); | 250 return target is Source && AnalysisEngine.isHtmlFileName(target.fullName); |
| 257 } | 251 } |
| 258 } | 252 } |
| OLD | NEW |