| 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.dart_work_manager; | 5 library analyzer.src.task.dart_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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 // Update notice. | 277 // Update notice. |
| 278 if (_isDartSource(target)) { | 278 if (_isDartSource(target)) { |
| 279 bool shouldSetErrors = false; | 279 bool shouldSetErrors = false; |
| 280 outputs.forEach((ResultDescriptor descriptor, value) { | 280 outputs.forEach((ResultDescriptor descriptor, value) { |
| 281 if (descriptor == PARSED_UNIT && value != null) { | 281 if (descriptor == PARSED_UNIT && value != null) { |
| 282 context.getNotice(target).parsedDartUnit = value; | 282 context.getNotice(target).parsedDartUnit = value; |
| 283 shouldSetErrors = true; | 283 shouldSetErrors = true; |
| 284 } | 284 } |
| 285 if (_isErrorResult(descriptor)) { | 285 if (descriptor == DART_ERRORS) { |
| 286 shouldSetErrors = true; | 286 shouldSetErrors = true; |
| 287 } | 287 } |
| 288 }); | 288 }); |
| 289 if (shouldSetErrors) { | 289 if (shouldSetErrors) { |
| 290 AnalysisErrorInfo info = getErrors(target); | 290 AnalysisErrorInfo info = getErrors(target); |
| 291 context.getNotice(target).setErrors(info.errors, info.lineInfo); | 291 context.getNotice(target).setErrors(info.errors, info.lineInfo); |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 if (target is LibrarySpecificUnit) { | 294 if (target is LibrarySpecificUnit) { |
| 295 Source source = target.source; | 295 Source source = target.source; |
| 296 bool shouldSetErrors = false; | 296 bool shouldSetErrors = false; |
| 297 outputs.forEach((ResultDescriptor descriptor, value) { | 297 outputs.forEach((ResultDescriptor descriptor, value) { |
| 298 if (descriptor == RESOLVED_UNIT && value != null) { | 298 if (descriptor == RESOLVED_UNIT && value != null) { |
| 299 context.getNotice(source).resolvedDartUnit = value; | 299 context.getNotice(source).resolvedDartUnit = value; |
| 300 shouldSetErrors = true; | 300 shouldSetErrors = true; |
| 301 } | 301 } |
| 302 if (_isErrorResult(descriptor)) { | |
| 303 shouldSetErrors = true; | |
| 304 } | |
| 305 }); | 302 }); |
| 306 if (shouldSetErrors) { | 303 if (shouldSetErrors) { |
| 307 AnalysisErrorInfo info = getErrors(source); | 304 AnalysisErrorInfo info = getErrors(source); |
| 308 context.getNotice(source).setErrors(info.errors, info.lineInfo); | 305 context.getNotice(source).setErrors(info.errors, info.lineInfo); |
| 309 } | 306 } |
| 310 } | 307 } |
| 311 } | 308 } |
| 312 | 309 |
| 313 /** | 310 /** |
| 314 * Returns `true` if the given [result] of the given [target] needs | 311 * Returns `true` if the given [result] of the given [target] needs |
| (...skipping 16 matching lines...) Expand all Loading... |
| 331 if (libraries != null) { | 328 if (libraries != null) { |
| 332 libraries.remove(library); | 329 libraries.remove(library); |
| 333 } | 330 } |
| 334 } | 331 } |
| 335 } | 332 } |
| 336 } | 333 } |
| 337 | 334 |
| 338 static bool _isDartSource(AnalysisTarget target) { | 335 static bool _isDartSource(AnalysisTarget target) { |
| 339 return target is Source && AnalysisEngine.isDartFileName(target.fullName); | 336 return target is Source && AnalysisEngine.isDartFileName(target.fullName); |
| 340 } | 337 } |
| 341 | |
| 342 static bool _isErrorResult(ResultDescriptor descriptor) { | |
| 343 return _SOURCE_ERRORS.contains(descriptor) || | |
| 344 _UNIT_ERRORS.contains(descriptor); | |
| 345 } | |
| 346 } | 338 } |
| OLD | NEW |