| 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/src/context/cache.dart'; | 9 import 'package:analyzer/src/context/cache.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart' | 10 import 'package:analyzer/src/generated/engine.dart' |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 htmlSources.add(target); | 224 htmlSources.add(target); |
| 225 } | 225 } |
| 226 if (target is DartScript) { | 226 if (target is DartScript) { |
| 227 scriptTargets.add(target); | 227 scriptTargets.add(target); |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 // Invalidate targets and values. | 230 // Invalidate targets and values. |
| 231 scriptTargets.forEach(partition.remove); | 231 scriptTargets.forEach(partition.remove); |
| 232 for (Source htmlSource in htmlSources) { | 232 for (Source htmlSource in htmlSources) { |
| 233 CacheEntry entry = partition.get(htmlSource); | 233 CacheEntry entry = partition.get(htmlSource); |
| 234 if (htmlSource != null) { | 234 if (entry != null) { |
| 235 entry.setState(HTML_ERRORS, CacheState.INVALID); | 235 entry.setState(HTML_ERRORS, CacheState.INVALID); |
| 236 if (invalidateUris) { | 236 if (invalidateUris) { |
| 237 entry.setState(REFERENCED_LIBRARIES, CacheState.INVALID); | 237 entry.setState(REFERENCED_LIBRARIES, CacheState.INVALID); |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 /** | 243 /** |
| 244 * Returns `true` if the given [result] of the given [target] needs | 244 * 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. | 245 * computing, i.e. it is not in the valid and not in the error state. |
| 246 */ | 246 */ |
| 247 bool _needsComputing(AnalysisTarget target, ResultDescriptor result) { | 247 bool _needsComputing(AnalysisTarget target, ResultDescriptor result) { |
| 248 CacheState state = analysisCache.getState(target, result); | 248 CacheState state = analysisCache.getState(target, result); |
| 249 return state != CacheState.VALID && state != CacheState.ERROR; | 249 return state != CacheState.VALID && state != CacheState.ERROR; |
| 250 } | 250 } |
| 251 | 251 |
| 252 /** | 252 /** |
| 253 * Return `true` if the given target is an HTML source. | 253 * Return `true` if the given target is an HTML source. |
| 254 */ | 254 */ |
| 255 static bool _isHtmlSource(AnalysisTarget target) { | 255 static bool _isHtmlSource(AnalysisTarget target) { |
| 256 return target is Source && AnalysisEngine.isHtmlFileName(target.fullName); | 256 return target is Source && AnalysisEngine.isHtmlFileName(target.fullName); |
| 257 } | 257 } |
| 258 } | 258 } |
| OLD | NEW |