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

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: 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
Index: lib/compiler/implementation/resolver.dart
diff --git a/lib/compiler/implementation/resolver.dart b/lib/compiler/implementation/resolver.dart
index 4535483d44db57aa7743abe3daddada1808f93bd..14d8b4b1f47fe518ec48880559175c445bc2cceb 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -1105,13 +1105,16 @@ 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) {
ahe 2012/05/01 17:26:24 && element.something == 0
karlklose 2012/05/02 08:26:50 Not necessary, as discussed.
+ // Return the canonical type if it has no type parameters.
+ type = element.computeType(compiler);
+ } else {
+ type = new InterfaceType(cls.name, cls, arguments.toLink());
+ }
+ } else if (element.isTypedef() || element.isTypeVariable()) {
type = element.computeType(compiler);
+ } else {
+ compiler.internalErrorOnElement(element, "unexpected element kind");
ahe 2012/05/01 17:26:24 I think you should use the node here.
karlklose 2012/05/02 08:26:50 Done.
}
}
return useType(node, type);
@@ -1739,17 +1742,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.

Powered by Google App Engine
This is Rietveld 408576698