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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 2971843002: Remove HintGenerator. (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index b850835427c98fcdc40407c71e69e4bde9b11328..c82c479bd1f7ded7ac0fa640a1e13f6db5058c2f 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -3747,97 +3747,6 @@ class GatherUsedLocalElementsVisitor extends RecursiveAstVisitor {
}
/**
- * Instances of the class `HintGenerator` traverse a library's worth of dart code at a time to
- * generate hints over the set of sources.
- *
- * See [HintCode].
- */
-class HintGenerator {
- final List<CompilationUnit> _compilationUnits;
-
- final InternalAnalysisContext _context;
-
- final AnalysisErrorListener _errorListener;
-
- LibraryElement _library;
-
- GatherUsedImportedElementsVisitor _usedImportedElementsVisitor;
-
- bool _enableDart2JSHints = false;
-
- /**
- * The inheritance manager used to find overridden methods.
- */
- InheritanceManager _manager;
-
- GatherUsedLocalElementsVisitor _usedLocalElementsVisitor;
-
- HintGenerator(this._compilationUnits, this._context, this._errorListener) {
- _library = resolutionMap
- .elementDeclaredByCompilationUnit(_compilationUnits[0])
- .library;
- _usedImportedElementsVisitor =
- new GatherUsedImportedElementsVisitor(_library);
- _enableDart2JSHints = _context.analysisOptions.dart2jsHint;
- _manager =
- new InheritanceManager(_library, includeAbstractFromSuperclasses: true);
- _usedLocalElementsVisitor = new GatherUsedLocalElementsVisitor(_library);
- }
-
- void generateForLibrary() {
- PerformanceStatistics.hints.makeCurrentWhile(() {
- int length = _compilationUnits.length;
- for (int i = 0; i < length; i++) {
- CompilationUnit unit = _compilationUnits[i];
- CompilationUnitElement element = unit.element;
- if (element != null) {
- _generateForCompilationUnit(unit, element.source);
- }
- }
- CompilationUnit definingUnit = _compilationUnits[0];
- ErrorReporter definingUnitErrorReporter = new ErrorReporter(
- _errorListener,
- resolutionMap.elementDeclaredByCompilationUnit(definingUnit).source);
- {
- ImportsVerifier importsVerifier = new ImportsVerifier();
- importsVerifier.addImports(definingUnit);
- importsVerifier
- .removeUsedElements(_usedImportedElementsVisitor.usedElements);
- importsVerifier.generateDuplicateImportHints(definingUnitErrorReporter);
- importsVerifier.generateUnusedImportHints(definingUnitErrorReporter);
- importsVerifier.generateUnusedShownNameHints(definingUnitErrorReporter);
- }
- _library.accept(new UnusedLocalElementsVerifier(
- _errorListener, _usedLocalElementsVisitor.usedElements));
- });
- }
-
- void _generateForCompilationUnit(CompilationUnit unit, Source source) {
- ErrorReporter errorReporter = new ErrorReporter(_errorListener, source);
- unit.accept(_usedImportedElementsVisitor);
- // dead code analysis
- unit.accept(
- new DeadCodeVerifier(errorReporter, typeSystem: _context.typeSystem));
- unit.accept(_usedLocalElementsVisitor);
- // dart2js analysis
- if (_enableDart2JSHints) {
- unit.accept(new Dart2JSVerifier(errorReporter));
- }
- // Dart best practices
- unit.accept(new BestPracticesVerifier(
- errorReporter, _context.typeProvider, _library, _manager,
- typeSystem: _context.typeSystem));
- unit.accept(new OverrideVerifier(errorReporter, _manager));
- // Find to-do comments
- new ToDoFinder(errorReporter).findIn(unit);
- // pub analysis
- // TODO(danrubel/jwren) Commented out until bugs in the pub verifier are
- // fixed
- // unit.accept(new PubVerifier(context, errorReporter));
- }
-}
-
-/**
* Instances of the class `ImportsVerifier` visit all of the referenced libraries in the source code
* verifying that all of the imports are used, otherwise a [HintCode.UNUSED_IMPORT] hint is
* generated with [generateUnusedImportHints].
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698