| 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; | 5 library analyzer.src.task.dart; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:analyzer/src/context/cache.dart'; | 10 import 'package:analyzer/src/context/cache.dart'; |
| (...skipping 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2376 'GenerateHintsTask', createTask, buildInputs, <ResultDescriptor>[HINTS]); | 2376 'GenerateHintsTask', createTask, buildInputs, <ResultDescriptor>[HINTS]); |
| 2377 | 2377 |
| 2378 GenerateHintsTask(InternalAnalysisContext context, AnalysisTarget target) | 2378 GenerateHintsTask(InternalAnalysisContext context, AnalysisTarget target) |
| 2379 : super(context, target); | 2379 : super(context, target); |
| 2380 | 2380 |
| 2381 @override | 2381 @override |
| 2382 TaskDescriptor get descriptor => DESCRIPTOR; | 2382 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2383 | 2383 |
| 2384 @override | 2384 @override |
| 2385 void internalPerform() { | 2385 void internalPerform() { |
| 2386 AnalysisOptions analysisOptions = context.analysisOptions; |
| 2387 if (!analysisOptions.hint) { |
| 2388 outputs[HINTS] = AnalysisError.NO_ERRORS; |
| 2389 return; |
| 2390 } |
| 2391 // |
| 2392 // Prepare collectors. |
| 2393 // |
| 2386 RecordingErrorListener errorListener = new RecordingErrorListener(); | 2394 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 2387 Source source = getRequiredSource(); | 2395 Source source = getRequiredSource(); |
| 2388 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 2396 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
| 2389 // | 2397 // |
| 2390 // Prepare inputs. | 2398 // Prepare inputs. |
| 2391 // | 2399 // |
| 2392 CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT); | 2400 CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT); |
| 2393 List<UsedImportedElements> usedImportedElementsList = | 2401 List<UsedImportedElements> usedImportedElementsList = |
| 2394 getRequiredInput(USED_IMPORTED_ELEMENTS_INPUT); | 2402 getRequiredInput(USED_IMPORTED_ELEMENTS_INPUT); |
| 2395 List<UsedLocalElements> usedLocalElementsList = | 2403 List<UsedLocalElements> usedLocalElementsList = |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2410 } | 2418 } |
| 2411 // Unused local elements. | 2419 // Unused local elements. |
| 2412 { | 2420 { |
| 2413 UsedLocalElements usedElements = | 2421 UsedLocalElements usedElements = |
| 2414 new UsedLocalElements.merge(usedLocalElementsList); | 2422 new UsedLocalElements.merge(usedLocalElementsList); |
| 2415 UnusedLocalElementsVerifier visitor = | 2423 UnusedLocalElementsVerifier visitor = |
| 2416 new UnusedLocalElementsVerifier(errorListener, usedElements); | 2424 new UnusedLocalElementsVerifier(errorListener, usedElements); |
| 2417 unitElement.accept(visitor); | 2425 unitElement.accept(visitor); |
| 2418 } | 2426 } |
| 2419 // Dart2js analysis. | 2427 // Dart2js analysis. |
| 2420 if (context.analysisOptions.dart2jsHint) { | 2428 if (analysisOptions.dart2jsHint) { |
| 2421 unit.accept(new Dart2JSVerifier(errorReporter)); | 2429 unit.accept(new Dart2JSVerifier(errorReporter)); |
| 2422 } | 2430 } |
| 2423 // Dart best practices. | 2431 // Dart best practices. |
| 2424 InheritanceManager inheritanceManager = | 2432 InheritanceManager inheritanceManager = |
| 2425 new InheritanceManager(libraryElement); | 2433 new InheritanceManager(libraryElement); |
| 2426 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); | 2434 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 2427 unit.accept(new BestPracticesVerifier(errorReporter, typeProvider)); | 2435 unit.accept(new BestPracticesVerifier(errorReporter, typeProvider)); |
| 2428 unit.accept(new OverrideVerifier(errorReporter, inheritanceManager)); | 2436 unit.accept(new OverrideVerifier(errorReporter, inheritanceManager)); |
| 2429 // Find to-do comments. | 2437 // Find to-do comments. |
| 2430 new ToDoFinder(errorReporter).findIn(unit); | 2438 new ToDoFinder(errorReporter).findIn(unit); |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3409 @override | 3417 @override |
| 3410 bool moveNext() { | 3418 bool moveNext() { |
| 3411 if (_newSources.isEmpty) { | 3419 if (_newSources.isEmpty) { |
| 3412 return false; | 3420 return false; |
| 3413 } | 3421 } |
| 3414 currentTarget = _newSources.first; | 3422 currentTarget = _newSources.first; |
| 3415 _newSources.remove(currentTarget); | 3423 _newSources.remove(currentTarget); |
| 3416 return true; | 3424 return true; |
| 3417 } | 3425 } |
| 3418 } | 3426 } |
| OLD | NEW |