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

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

Issue 10270010: Remove getType; use the resolver instead. (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/typechecker.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 9b1710bc848ba4825c611a6df615afaebded36af..67f338b387a5da84c0cb49992898cd2c3f47e8eb 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -211,6 +211,17 @@ class ResolverTask extends CompilerTask {
return visitor.mapping;
}
+ Type resolveTypeAnnotation(Element element, TypeAnnotation annotation) {
+ if (annotation === null) return compiler.types.dynamicType;
+ ResolverVisitor visitor = new ResolverVisitor(compiler, element);
+ Type result = visitor.resolveTypeAnnotation(annotation);
+ if (result === null) {
+ // TODO(karklose): warning.
+ return compiler.types.dynamicType;
+ }
+ return result;
+ }
+
void resolveClass(ClassElement element) {
if (element.isResolved) return;
measure(() {
@@ -1107,11 +1118,18 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
}
if (cls.typeParameters.length == 0) {
// Return the canonical type if it has no type parameters.
- type = element.computeType(compiler);
+ type = cls.computeType(compiler);
} else {
type = new InterfaceType(cls, arguments.toLink());
}
- } else if (element.isTypedef() || element.isTypeVariable()) {
+ } else if (element.isTypedef()) {
+ // TODO(ngeoffray): This is a hack to help us get support for the
+ // DOM library.
+ // TODO(ngeoffray): The list of types for the argument is wrong.
+ type = new FunctionType(compiler.types.dynamicType,
+ const EmptyLink<Type>(),
+ element);
+ } else if (element.isTypeVariable()) {
type = element.computeType(compiler);
} else {
compiler.cancel("unexpected element kind ${element.kind}",
« no previous file with comments | « lib/compiler/implementation/elements/elements.dart ('k') | lib/compiler/implementation/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698