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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/resolution/signatures.dart

Issue 324293002: Improve parser error recovery. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Johnni's comments Created 6 years, 6 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
Index: dart/sdk/lib/_internal/compiler/implementation/resolution/signatures.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/resolution/signatures.dart b/dart/sdk/lib/_internal/compiler/implementation/resolution/signatures.dart
index 97326a3cf7ac11b28bad8196ba609e41d0565b86..2dd44a9dbe3e6537e299c0e22021bca4bd68064e 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/resolution/signatures.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/resolution/signatures.dart
@@ -252,7 +252,15 @@ class SignatureResolver extends MappingVisitor<ParameterElementX> {
int requiredParameterCount = 0;
if (formalParameters == null) {
if (!element.isGetter) {
- compiler.reportError(element, MessageKind.MISSING_FORMALS);
+ if (element.isErroneous) {
+ // If the element is erroneous, an error should already have been
+ // reported. In the case of parse errors, it is possible that there
+ // are formal parameters, but something else in the method failed to
+ // parse. So we suppress the message about missing formals.
+ assert(invariant(element, compiler.compilationFailed));
+ } else {
+ compiler.reportError(element, MessageKind.MISSING_FORMALS);
+ }
}
} else {
if (element.isGetter) {

Powered by Google App Engine
This is Rietveld 408576698