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/ast.dart' show CompilationUnit; |
10 import 'package:analyzer/src/generated/engine.dart' | 11 import 'package:analyzer/src/generated/engine.dart' |
11 show AnalysisEngine, CacheState, InternalAnalysisContext; | 12 show AnalysisEngine, CacheState, InternalAnalysisContext; |
12 import 'package:analyzer/src/generated/source.dart'; | 13 import 'package:analyzer/src/generated/source.dart'; |
13 import 'package:analyzer/src/generated/utilities_collection.dart'; | 14 import 'package:analyzer/src/generated/utilities_collection.dart'; |
14 import 'package:analyzer/src/task/dart.dart'; | 15 import 'package:analyzer/src/task/dart.dart'; |
15 import 'package:analyzer/src/task/driver.dart'; | 16 import 'package:analyzer/src/task/driver.dart'; |
16 import 'package:analyzer/task/dart.dart'; | 17 import 'package:analyzer/task/dart.dart'; |
17 import 'package:analyzer/task/model.dart'; | 18 import 'package:analyzer/task/model.dart'; |
18 | 19 |
19 /** | 20 /** |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // Organize sources. | 171 // Organize sources. |
171 if (_isDartSource(target)) { | 172 if (_isDartSource(target)) { |
172 SourceKind kind = outputs[SOURCE_KIND]; | 173 SourceKind kind = outputs[SOURCE_KIND]; |
173 if (kind != null) { | 174 if (kind != null) { |
174 unknownSourceQueue.remove(target); | 175 unknownSourceQueue.remove(target); |
175 if (kind == SourceKind.LIBRARY) { | 176 if (kind == SourceKind.LIBRARY) { |
176 librarySourceQueue.add(target); | 177 librarySourceQueue.add(target); |
177 } | 178 } |
178 } | 179 } |
179 } | 180 } |
| 181 // Update notice. |
| 182 if (_isDartSource(target)) { |
| 183 CompilationUnit unit = outputs[PARSED_UNIT]; |
| 184 if (unit != null) { |
| 185 context.getNotice(target).parsedDartUnit = unit; |
| 186 } |
| 187 } |
| 188 if (target is LibrarySpecificUnit) { |
| 189 CompilationUnit unit = outputs[RESOLVED_UNIT]; |
| 190 if (unit != null) { |
| 191 context.getNotice(target.source).resolvedDartUnit = unit; |
| 192 } |
| 193 } |
| 194 // TODO(scheglov) Move getError() implementation into DWM. |
| 195 // Set errors into notice on any error result change. |
180 } | 196 } |
181 | 197 |
182 bool _isDartSource(AnalysisTarget target) { | 198 bool _isDartSource(AnalysisTarget target) { |
183 return target is Source && AnalysisEngine.isDartFileName(target.fullName); | 199 return target is Source && AnalysisEngine.isDartFileName(target.fullName); |
184 } | 200 } |
185 | 201 |
186 /** | 202 /** |
187 * Returns `true` if the given [result] of the given [target] needs | 203 * Returns `true` if the given [result] of the given [target] needs |
188 * computing, i.e. it is not in the valid and not in the error state. | 204 * computing, i.e. it is not in the valid and not in the error state. |
189 */ | 205 */ |
190 bool _needsComputing(AnalysisTarget target, ResultDescriptor result) { | 206 bool _needsComputing(AnalysisTarget target, ResultDescriptor result) { |
191 CacheState state = analysisCache.getState(target, result); | 207 CacheState state = analysisCache.getState(target, result); |
192 return state != CacheState.VALID && state != CacheState.ERROR; | 208 return state != CacheState.VALID && state != CacheState.ERROR; |
193 } | 209 } |
194 } | 210 } |
OLD | NEW |