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

Unified Diff: lib/compiler/implementation/resolver.dart

Issue 10834146: Revert resolver from https://chromiumcodereview.appspot.com/10824062 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/resolver.dart
diff --git a/lib/compiler/implementation/resolver.dart b/lib/compiler/implementation/resolver.dart
index fc52a7c9c71d18d8076bd420f84158b56fccd8d1..94808dc9e4b4d63e5c9a268f40e52da970dde9cf 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -699,9 +699,9 @@ class TypeResolver {
final Compiler compiler;
TypeResolver(this.compiler);
- Element resolveTypeName(Scope context, Node typeNode) {
- Identifier typeName = typeNode.asIdentifier();
- Send send = typeNode.asSend();
+ Element resolveTypeName(Scope context, TypeAnnotation node) {
+ Identifier typeName = node.typeName.asIdentifier();
+ Send send = node.typeName.asSend();
if (send !== null) {
typeName = send.selector;
}
@@ -744,26 +744,9 @@ class TypeResolver {
whenResolved);
}
- Type resolveTypeVariableInContext(Scope context, TypeVariable node,
- onFailure) {
- Element element = resolveTypeName(context, node.name);
- Type type;
- if (element === null) {
- onFailure(node, MessageKind.CANNOT_RESOLVE_TYPE, [node.name]);
- } else if (!element.impliesType()) {
- onFailure(node, MessageKind.NOT_A_TYPE, [node.name]);
- } else if (element.isTypeVariable()) {
- type = element.computeType(compiler);
- } else {
- compiler.cancel("unexpected element kind ${element.kind}",
- node: node);
- }
- return type;
- }
-
Type resolveTypeAnnotationInContext(Scope context, TypeAnnotation node,
onFailure, whenResolved) {
- Element element = resolveTypeName(context, node.typeName);
+ Element element = resolveTypeName(context, node);
Type type;
if (element === null) {
onFailure(node, MessageKind.CANNOT_RESOLVE_TYPE, [node.typeName]);
@@ -786,16 +769,10 @@ class TypeResolver {
onFailure(typeArguments.head,
MessageKind.ADDITIONAL_TYPE_ARGUMENT);
}
- // TypeVariable may happen in default clause of an interface.
- Type argType;
- if (typeArguments.head is TypeVariable) {
- argType = resolveTypeVariableInContext(
- new ClassScope(cls, cls.getLibrary()), typeArguments.head,
- onFailure);
- } else {
- argType = resolveTypeAnnotationInContext(context,
- typeArguments.head, onFailure, whenResolved);
- }
+ Type argType = resolveTypeAnnotationInContext(context,
+ typeArguments.head,
+ onFailure,
+ whenResolved);
arguments.addLast(argType);
}
if (index < cls.typeParameters.length) {
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698