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

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

Issue 10115026: Address the remaining review comments on http://chromiumcodereview.appspot.com/9431029. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 8 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 | « lib/compiler/implementation/elements/elements.dart ('k') | lib/compiler/implementation/ssa/codegen.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 5e949c3c19a02427004619e98c40b1ddcfd18e8d..9b1710bc848ba4825c611a6df615afaebded36af 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -1105,13 +1105,17 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
report(node.typeArguments, MessageKind.MISSING_TYPE_ARGUMENT);
}
}
- type = new InterfaceType(cls.name, cls, arguments.toLink());
- } else if (element.isTypedef()) {
- // TODO(karlklose): implement typedefs. We return a fake type that the
- // code generator can use to detect typedefs in is-checks.
- type = new InterfaceType(element.name, element);
- } else {
+ if (cls.typeParameters.length == 0) {
+ // Return the canonical type if it has no type parameters.
+ type = element.computeType(compiler);
+ } else {
+ type = new InterfaceType(cls, arguments.toLink());
+ }
+ } else if (element.isTypedef() || element.isTypeVariable()) {
type = element.computeType(compiler);
+ } else {
+ compiler.cancel("unexpected element kind ${element.kind}",
+ node: node);
}
}
return useType(node, type);
@@ -1404,7 +1408,7 @@ class ClassResolverVisitor extends CommonResolverVisitor<Type> {
} else if (objectElement === null){
error(node, MessageKind.CANNOT_RESOLVE_TYPE, [Types.OBJECT]);
}
- classElement.supertype = new InterfaceType(Types.OBJECT, objectElement);
+ classElement.supertype = new InterfaceType(objectElement);
}
if (node.defaultClause !== null) {
classElement.defaultClass = visit(node.defaultClause);
@@ -1739,17 +1743,7 @@ class SignatureResolver extends CommonResolverVisitor<Element> {
// TODO(ahe): This is temporary.
void resolveType(Node node) {
if (node == null) return;
- // Find the correct member context to perform the lookup in.
- Element outer = enclosingElement;
- Element context = outer;
- while (outer !== null) {
- if (outer.isMember()) {
- context = outer;
- break;
- }
- outer = outer.enclosingElement;
- }
- node.accept(new ResolverVisitor(compiler, context));
+ node.accept(new ResolverVisitor(compiler, enclosingElement));
}
// TODO(ahe): This is temporary.
« no previous file with comments | « lib/compiler/implementation/elements/elements.dart ('k') | lib/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698