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

Unified Diff: dart/pkg/compiler/lib/src/resolution/signatures.dart

Issue 845183004: Use synthetic elements to recover from errors in signatures.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r42768. Created 5 years, 11 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 | « dart/pkg/compiler/lib/src/resolution/resolution.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/compiler/lib/src/resolution/signatures.dart
diff --git a/dart/pkg/compiler/lib/src/resolution/signatures.dart b/dart/pkg/compiler/lib/src/resolution/signatures.dart
index 26d2326ed527b69e5530b529969a921799f81997..8260d8b9c456685219ca7fce825a354acc0692f5 100644
--- a/dart/pkg/compiler/lib/src/resolution/signatures.dart
+++ b/dart/pkg/compiler/lib/src/resolution/signatures.dart
@@ -172,15 +172,17 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
InitializingFormalElementX createFieldParameter(Send node,
Expression initializer) {
InitializingFormalElementX element;
- if (node.receiver.asIdentifier() == null ||
- !node.receiver.asIdentifier().isThis()) {
+ Identifier receiver = node.receiver.asIdentifier();
+ if (receiver == null || !receiver.isThis()) {
error(node, MessageKind.INVALID_PARAMETER);
- } else if (!identical(enclosingElement.kind,
- ElementKind.GENERATIVE_CONSTRUCTOR)) {
- error(node, MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED);
- // TODO(ahe): Don't throw, recover from error.
- throw new CompilerCancelledException(null);
+ return new ErroneousInitializingFormalElementX(
+ getParameterName(node), enclosingElement);
} else {
+ if (!enclosingElement.isGenerativeConstructor) {
+ error(node, MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED);
+ return new ErroneousInitializingFormalElementX(
+ getParameterName(node), enclosingElement);
+ }
Identifier name = getParameterName(node);
validateName(name);
Element fieldElement =
@@ -188,10 +190,12 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
if (fieldElement == null ||
!identical(fieldElement.kind, ElementKind.FIELD)) {
error(node, MessageKind.NOT_A_FIELD, {'fieldName': name});
- // TODO(ahe): Don't throw, recover from error.
- throw new CompilerCancelledException(null);
+ fieldElement = new ErroneousFieldElementX(
+ name, enclosingElement.enclosingClass);
} else if (!fieldElement.isInstanceMember) {
error(node, MessageKind.NOT_INSTANCE_FIELD, {'fieldName': name});
+ fieldElement = new ErroneousFieldElementX(
+ name, enclosingElement.enclosingClass);
}
element = new InitializingFormalElementX(enclosingElement,
currentDefinitions, name, initializer, fieldElement);
« no previous file with comments | « dart/pkg/compiler/lib/src/resolution/resolution.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698