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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java

Issue 8395013: DartC User Warning Framework (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use new ErrorCode enums in single onError() method. Created 9 years, 2 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: compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java b/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
index 6035c2cfbee1f47cf026c5cd106176e7d8d03489..94f7751a9414bae2083a625fda688227f1e35a12 100644
--- a/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
+++ b/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
@@ -5,7 +5,6 @@
package com.google.dart.compiler.resolver;
import com.google.dart.compiler.DartCompilerContext;
-import com.google.dart.compiler.DartCompilerErrorCode;
import com.google.dart.compiler.ErrorCode;
import com.google.dart.compiler.ast.DartClass;
import com.google.dart.compiler.ast.DartExpression;
@@ -205,7 +204,7 @@ public class MemberBuilder {
switch (ElementKind.of(e)) {
default:
// Report an error and create a fake constructor element below.
- resolutionError(method.getName(), DartCompilerErrorCode.INVALID_TYPE_NAME_IN_CONSTRUCTOR);
+ resolutionError(method.getName(), ResolverErrorCode.INVALID_TYPE_NAME_IN_CONSTRUCTOR);
break;
case DYNAMIC:
@@ -319,7 +318,7 @@ public class MemberBuilder {
if (fieldElement.getGetter() != null) {
int conflictLine = fieldElement.getNode().getSourceLine();
int conflictColumn = fieldElement.getNode().getSourceColumn();
- resolutionError(fieldNode, DartCompilerErrorCode.FIELD_CONFLICTS, name, "getter",
+ resolutionError(fieldNode, ResolverErrorCode.FIELD_CONFLICTS, name, "getter",
conflictLine, conflictColumn);
} else {
fieldElement.setGetter(accessorElement);
@@ -329,14 +328,14 @@ public class MemberBuilder {
if (fieldElement.getSetter() != null) {
int conflictLine = fieldElement.getNode().getSourceLine();
int conflictColumn = fieldElement.getNode().getSourceColumn();
- resolutionError(fieldNode, DartCompilerErrorCode.FIELD_CONFLICTS, name, "setter",
+ resolutionError(fieldNode, ResolverErrorCode.FIELD_CONFLICTS, name, "setter",
conflictLine, conflictColumn);
} else {
fieldElement.setSetter(accessorElement);
List<VariableElement> parameters = accessorElement.getParameters();
Type type;
if (parameters.size() != 1) {
- resolutionError(fieldNode, DartCompilerErrorCode.EXPECTED_ONE_ARGUMENT);
+ resolutionError(fieldNode, ResolverErrorCode.EXPECTED_ONE_ARGUMENT);
type = getTypeProvider().getDynamicType();
} else {
type = parameters.get(0).getType();
@@ -387,7 +386,7 @@ public class MemberBuilder {
return ElementKind.CONSTRUCTOR;
} else {
resolutionError(method.getName(),
- DartCompilerErrorCode.CANNOT_DECLARE_NON_FACTORY_CONSTRUCTOR);
+ ResolverErrorCode.CANNOT_DECLARE_NON_FACTORY_CONSTRUCTOR);
}
}
@@ -400,30 +399,30 @@ public class MemberBuilder {
// TODO(ngeoffray): The errors should report the position of the modifier.
if (isNonFactoryConstructor) {
if (modifiers.isStatic()) {
- resolutionError(method.getName(), DartCompilerErrorCode.CONSTRUCTOR_CANNOT_BE_STATIC);
+ resolutionError(method.getName(), ResolverErrorCode.CONSTRUCTOR_CANNOT_BE_STATIC);
}
if (modifiers.isAbstract()) {
- resolutionError(method.getName(), DartCompilerErrorCode.CONSTRUCTOR_CANNOT_BE_ABSTRACT);
+ resolutionError(method.getName(), ResolverErrorCode.CONSTRUCTOR_CANNOT_BE_ABSTRACT);
}
// TODO(ngeoffray): This is already checked in the parser.
// Like operators/getters/setters. Should we all check them here?
if (modifiers.isConstant() && method.getFunction().getBody() != null) {
resolutionError(method.getName(),
- DartCompilerErrorCode.CONST_CONSTRUCTOR_CANNOT_HAVE_BODY);
+ ResolverErrorCode.CONST_CONSTRUCTOR_CANNOT_HAVE_BODY);
}
}
if (modifiers.isFactory()) {
if (modifiers.isStatic()) {
- resolutionError(method.getName(), DartCompilerErrorCode.FACTORY_CANNOT_BE_STATIC);
+ resolutionError(method.getName(), ResolverErrorCode.FACTORY_CANNOT_BE_STATIC);
}
if (modifiers.isAbstract()) {
- resolutionError(method.getName(), DartCompilerErrorCode.FACTORY_CANNOT_BE_ABSTRACT);
+ resolutionError(method.getName(), ResolverErrorCode.FACTORY_CANNOT_BE_ABSTRACT);
}
// TODO(ngeoffray): This is already checked in the parser.
// Like operators/getters/setters. Should we all check them here?
if (modifiers.isConstant()) {
- resolutionError(method.getName(), DartCompilerErrorCode.FACTORY_CANNOT_BE_CONST);
+ resolutionError(method.getName(), ResolverErrorCode.FACTORY_CANNOT_BE_CONST);
}
}
// TODO(ngeoffray): Add more checks on the modifiers. For
@@ -475,7 +474,7 @@ public class MemberBuilder {
source = otherNode.getSource().getUri().toString() + " ";
}
- resolutionError(e.getNode(), DartCompilerErrorCode.NAME_CLASHES_EXISTING_MEMBER,
+ resolutionError(e.getNode(), ResolverErrorCode.NAME_CLASHES_EXISTING_MEMBER,
source, other.getNode().getSourceLine(), other.getNode().getSourceColumn());
}
}
@@ -495,7 +494,7 @@ public class MemberBuilder {
}
void resolutionError(DartNode node, ErrorCode errorCode, Object... arguments) {
- topLevelContext.resolutionError(node, errorCode, arguments);
+ topLevelContext.onError(node, errorCode, arguments);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698