| Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| index fd7ad6e3b7bf2b2150a60c9d9b37a6df8a6e2fbf..3704b4eeac483296640268df96771d3c9e501b58 100644
|
| --- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| +++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| @@ -55,6 +55,7 @@ import com.google.dart.engine.ast.ReturnStatement;
|
| import com.google.dart.engine.ast.SimpleFormalParameter;
|
| import com.google.dart.engine.ast.SimpleIdentifier;
|
| import com.google.dart.engine.ast.Statement;
|
| +import com.google.dart.engine.ast.SuperConstructorInvocation;
|
| import com.google.dart.engine.ast.SwitchCase;
|
| import com.google.dart.engine.ast.SwitchMember;
|
| import com.google.dart.engine.ast.SwitchStatement;
|
| @@ -298,6 +299,7 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| checkForConstConstructorWithNonFinalField(node);
|
| checkForConflictingConstructorNameAndMember(node);
|
| checkForAllFinalInitializedErrorCodes(node);
|
| + checkForMultipleSuperInitializers(node);
|
| return super.visitConstructorDeclaration(node);
|
| } finally {
|
| isEnclosingConstructorConst = false;
|
| @@ -1414,6 +1416,26 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| }
|
|
|
| /**
|
| + * This verifies that the passed constructor has at most one 'super' initializer.
|
| + *
|
| + * @param node the constructor declaration to evaluate
|
| + * @return {@code true} if and only if an error code is generated on the passed node
|
| + * @see CompileTimeErrorCode#MULTIPLE_SUPER_INITIALIZERS
|
| + */
|
| + private boolean checkForMultipleSuperInitializers(ConstructorDeclaration node) {
|
| + int numSuperInitializers = 0;
|
| + for (ConstructorInitializer initializer : node.getInitializers()) {
|
| + if (initializer instanceof SuperConstructorInvocation) {
|
| + numSuperInitializers++;
|
| + if (numSuperInitializers > 1) {
|
| + errorReporter.reportError(CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS, initializer);
|
| + }
|
| + }
|
| + }
|
| + return numSuperInitializers > 0;
|
| + }
|
| +
|
| + /**
|
| * Checks to ensure that native function bodies can only in SDK code.
|
| *
|
| * @param node the native function body to test
|
|
|