Index: pkg/compiler/lib/src/typechecker.dart |
diff --git a/pkg/compiler/lib/src/typechecker.dart b/pkg/compiler/lib/src/typechecker.dart |
index 85d82b3992980f12478d4e723b7a641b752b3bab..2d854a2e59e3aabcfca6a687929362a93ad6a576 100644 |
--- a/pkg/compiler/lib/src/typechecker.dart |
+++ b/pkg/compiler/lib/src/typechecker.dart |
@@ -126,18 +126,26 @@ class ResolvedAccess extends ElementAccess { |
DartType computeType(Compiler compiler) { |
if (element.isGetter) { |
- FunctionType functionType = element.computeType(compiler); |
+ GetterElement getter = element; |
+ FunctionType functionType = getter.computeType(compiler); |
return functionType.returnType; |
} else if (element.isSetter) { |
- FunctionType functionType = element.computeType(compiler); |
+ SetterElement setter = element; |
+ FunctionType functionType = setter.computeType(compiler); |
if (functionType.parameterTypes.length != 1) { |
// TODO(johnniwinther,karlklose): this happens for malformed static |
// setters. Treat them the same as instance members. |
return const DynamicType(); |
} |
return functionType.parameterTypes.first; |
+ } else if (element.isTypedef || element.isClass) { |
+ TypeDeclarationElement typeDeclaration = element; |
+ typeDeclaration.computeType(compiler); |
+ return typeDeclaration.thisType; |
} else { |
- return element.computeType(compiler); |
+ TypedElement typedElement = element; |
+ typedElement.computeType(compiler); |
+ return typedElement.type; |
} |
} |
@@ -637,7 +645,7 @@ class TypeCheckerVisitor extends Visitor<DartType> { |
} else if (node.isSuper()) { |
return superType; |
} else { |
- Element element = elements[node]; |
+ TypedElement element = elements[node]; |
assert(invariant(node, element != null, |
message: 'Missing element for identifier')); |
assert(invariant(node, element.isVariable || |
@@ -1524,7 +1532,8 @@ class TypeCheckerVisitor extends Visitor<DartType> { |
return compiler.symbolClass.rawType; |
} |
- DartType computeConstructorType(Element constructor, DartType type) { |
+ DartType computeConstructorType(ConstructorElement constructor, |
+ DartType type) { |
if (Elements.isUnresolved(constructor)) return const DynamicType(); |
DartType constructorType = constructor.computeType(compiler); |
if (identical(type.kind, TypeKind.INTERFACE)) { |