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

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

Issue 10536203: Issue 2373. 'v is Unknown' is compile-time warning, not error (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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: compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java b/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
index 02755b603ae2cc5f1b072e65ac8e7800f8cca51a..f9de9fd7c6f78c01e3f6a7a1bc0fe373d8d795b8 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
@@ -12,7 +12,6 @@ import com.google.dart.compiler.ast.DartFunctionTypeAlias;
import com.google.dart.compiler.ast.DartIdentifier;
import com.google.dart.compiler.ast.DartNode;
import com.google.dart.compiler.ast.DartParameter;
-import com.google.dart.compiler.ast.DartThisExpression;
import com.google.dart.compiler.ast.DartTypeNode;
import com.google.dart.compiler.ast.DartTypeParameter;
import com.google.dart.compiler.type.DynamicType;
@@ -46,7 +45,8 @@ abstract class ResolveVisitor extends ASTVisitor<Element> {
node.getReturnTypeNode(),
element.getModifiers().isStatic(),
element.getModifiers().isFactory(),
- TypeErrorCode.NO_SUCH_TYPE);
+ TypeErrorCode.NO_SUCH_TYPE,
+ TypeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS);
ClassElement functionElement = typeProvider.getFunctionType().getElement();
FunctionType type = Types.makeFunctionType(getContext(), functionElement,
element.getParameters(), returnType);
@@ -90,11 +90,17 @@ abstract class ResolveVisitor extends ASTVisitor<Element> {
@Override
public Element visitParameter(DartParameter node) {
- ErrorCode typeErrorCode =
- node.getParent() instanceof DartCatchBlock
- ? ResolverErrorCode.NO_SUCH_TYPE
- : TypeErrorCode.NO_SUCH_TYPE;
- Type type = resolveType(node.getTypeNode(), isStaticContext(), isFactoryContext(), typeErrorCode);
+ ErrorCode typeErrorCode;
+ ErrorCode wrongNumberErrorCode;
+ if (node.getParent() instanceof DartCatchBlock) {
+ typeErrorCode = ResolverErrorCode.NO_SUCH_TYPE;
+ wrongNumberErrorCode = ResolverErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS;
+ } else {
+ typeErrorCode = TypeErrorCode.NO_SUCH_TYPE;
+ wrongNumberErrorCode = TypeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS;
+ }
+ Type type = resolveType(node.getTypeNode(), isStaticContext(), isFactoryContext(),
+ typeErrorCode, wrongNumberErrorCode);
VariableElement element =
Elements.parameterElement(
getEnclosingElement(),
@@ -121,12 +127,12 @@ abstract class ResolveVisitor extends ASTVisitor<Element> {
}
final Type resolveType(DartTypeNode node, boolean isStatic, boolean isFactory,
- ErrorCode errorCode) {
+ ErrorCode errorCode, ErrorCode wrongNumberErrorCode) {
if (node == null) {
return getTypeProvider().getDynamicType();
}
assert node.getType() == null || node.getType() instanceof DynamicType;
- Type type = getContext().resolveType(node, isStatic, isFactory, errorCode);
+ Type type = getContext().resolveType(node, isStatic, isFactory, errorCode, wrongNumberErrorCode);
if (type == null) {
type = getTypeProvider().getDynamicType();
}

Powered by Google App Engine
This is Rietveld 408576698