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

Unified Diff: pkg/analyzer/lib/src/dart/analysis/analysis_impl.dart

Issue 2685043002: Compute pending errors for @Required named parameters. (Closed)
Patch Set: Created 3 years, 10 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/dart/analysis/analysis_impl.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/analysis_impl.dart b/pkg/analyzer/lib/src/dart/analysis/analysis_impl.dart
index 777142878956cdbc5fec418d87ad027b42862e1e..6682d5bc492e159565f403174127639e824c3b4e 100644
--- a/pkg/analyzer/lib/src/dart/analysis/analysis_impl.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/analysis_impl.dart
@@ -49,6 +49,7 @@ class AnalyzerImpl {
final Map<FileState, ErrorReporter> _errorReporters = {};
final List<UsedImportedElements> _usedImportedElementsList = [];
final List<UsedLocalElements> _usedLocalElementsList = [];
+ final Map<FileState, List<PendingError>> _fileToPendingErrors = {};
final List<ConstantEvaluationTarget> _constants = [];
AnalyzerImpl(this._analysisOptions, this._declaredVariables,
@@ -85,6 +86,7 @@ class AnalyzerImpl {
units.forEach((file, unit) {
_resolveFile(file, unit);
+ _computePendingMissingRequiredParameters(file, unit);
});
_computeConstants();
@@ -142,21 +144,24 @@ class AnalyzerImpl {
}
}
+ void _computePendingMissingRequiredParameters(
+ FileState file, CompilationUnit unit) {
+ // TODO(scheglov) This can be done without "pending" if we resynthesize.
+ var computer = new RequiredConstantsComputer(file.source);
+ unit.accept(computer);
+ _constants.addAll(computer.requiredConstants);
+ _fileToPendingErrors[file] = computer.pendingErrors;
+ }
+
void _computeVerifyErrorsAndHints(FileState file, CompilationUnit unit) {
RecordingErrorListener errorListener = _getErrorListener(file);
CompilationUnitElement unitElement = unit.element;
//
- // Use the ErrorVerifier to compute errors.
+ // Convert the pending errors into actual errors.
//
- List<PendingError> pendingErrors;
- {
- RequiredConstantsComputer computer =
- new RequiredConstantsComputer(file.source);
- unit.accept(computer);
- pendingErrors = computer.pendingErrors;
- List<ConstantEvaluationTarget> requiredConstants =
- computer.requiredConstants;
+ for (PendingError pendingError in _fileToPendingErrors[file]) {
+ errorListener.onError(pendingError.toAnalysisError());
}
if (_analysisOptions.strongMode) {
@@ -197,13 +202,6 @@ class AnalyzerImpl {
unit.accept(errorVerifier);
//
- // Convert the pending errors into actual errors.
- //
- for (PendingError pendingError in pendingErrors) {
- errorListener.onError(pendingError.toAnalysisError());
- }
-
- //
// Find dead code.
//
unit.accept(
« 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