Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: pkg/analyzer/lib/src/task/dart_work_manager.dart

Issue 1154033002: Schedule ChangeNotice results only after parse/resolve/errors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | pkg/analyzer/test/src/task/dart_work_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698