Chromium Code Reviews| Index: lib/compiler/implementation/resolution/members.dart |
| diff --git a/lib/compiler/implementation/resolution/members.dart b/lib/compiler/implementation/resolution/members.dart |
| index 866efe95366efc1b23c566e780e892682de2a165..19d6242d78015baa9a0cd497c56d7c4c5a1610cd 100644 |
| --- a/lib/compiler/implementation/resolution/members.dart |
| +++ b/lib/compiler/implementation/resolution/members.dart |
| @@ -1086,23 +1086,19 @@ class TypeResolver { |
| // flags instead of closures. |
| // TODO(johnniwinther): Should never return [null] but instead an erroneous |
| // type. |
| - DartType resolveTypeAnnotation(TypeAnnotation node, |
| - {Scope inScope, ClassElement inClass, |
| - onFailure(Node, MessageKind, [List arguments]), |
| - whenResolved(Node, Type)}) { |
| + DartType resolveTypeAnnotation(TypeAnnotation node, Scope scope, |
|
karlklose
2012/10/19 12:05:38
Maybe put the first two arguments on their on line
Johnni Winther
2012/10/22 09:03:32
Done.
|
| + {onFailure(Node node, MessageKind kind, [List arguments]), |
| + whenResolved(Node node, DartType type)}) { |
| if (onFailure == null) { |
| onFailure = (n, k, [arguments]) {}; |
| } |
| if (whenResolved == null) { |
| whenResolved = (n, t) {}; |
| } |
| - if (inClass != null) { |
| - inScope = inClass.buildScope(); |
| - } |
| - if (inScope == null) { |
| + if (scope == null) { |
| compiler.internalError('resolveTypeAnnotation: no scope specified'); |
| } |
| - return resolveTypeAnnotationInContext(inScope, node, onFailure, |
| + return resolveTypeAnnotationInContext(scope, node, onFailure, |
| whenResolved); |
| } |
| @@ -1342,6 +1338,10 @@ class ResolverVisitor extends CommonResolverVisitor<Element> { |
| if (type != null) { |
| mapping.setType(annotation, type); |
| useElement(annotation, type.element); |
| + if (type is TypeVariableType && enclosingElement.isInStaticMember()) { |
|
ahe
2012/10/19 11:58:04
I would prefer using .kind over is tests. I would
Johnni Winther
2012/10/22 09:03:32
TypeKind added.
|
| + error(annotation, MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, |
| + [type]); |
|
karlklose
2012/10/19 12:05:38
Indentation is wrong.
Johnni Winther
2012/10/22 09:03:32
Done.
|
| + } |
| } |
| return type; |
| } |
| @@ -1960,7 +1960,7 @@ class ResolverVisitor extends CommonResolverVisitor<Element> { |
| DartType resolveTypeAnnotation(TypeAnnotation node) { |
| Function report = typeRequired ? error : warning; |
| - DartType type = typeResolver.resolveTypeAnnotation(node, inScope: scope, |
| + DartType type = typeResolver.resolveTypeAnnotation(node, scope, |
| onFailure: report, |
| whenResolved: useType); |
| if (type == null) return null; |
| @@ -2312,7 +2312,7 @@ class TypeDefinitionVisitor extends CommonResolverVisitor<DartType> { |
| TypeVariableElement variableElement = typeVariable.element; |
| if (typeNode.bound != null) { |
| DartType boundType = typeResolver.resolveTypeAnnotation( |
| - typeNode.bound, inScope: scope, onFailure: warning); |
| + typeNode.bound, scope, onFailure: warning); |
| if (boundType != null && boundType.element == variableElement) { |
| // TODO(johnniwinther): Check for more general cycles, like |
| // [: <A extends B, B extends C, C extends B> :]. |