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

Unified Diff: pkg/compiler/lib/src/typechecker.dart

Issue 1172693003: Move computeType to TypedElement and TypeDeclarationElement. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | « pkg/compiler/lib/src/resolution/type_resolver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)) {
« no previous file with comments | « pkg/compiler/lib/src/resolution/type_resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698