Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/typechecker.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart |
| index 1af2669d9f4b8c6ef7e2448acec5ca809e0fd010..ec2fc91f7571d3ac2cf8a1baa2b6e8a414cd7830 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/typechecker.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart |
| @@ -155,10 +155,24 @@ class TypeCheckerVisitor extends Visitor<DartType> { |
| final ClassElement currentClass; |
| + InterfaceType thisTypeCache; |
| + InterfaceType superTypeCache; |
| + |
| /// The type of [:this:]. Can only be accessed if [currentClass] is not null. |
| - InterfaceType thisType; |
| + InterfaceType get thisType { |
| + assert(invariant(elements.currentElement, thisTypeCache != null, |
| + message: 'Trying to access the type of this in ' |
| + '${elements.currentElement}')); |
| + return thisTypeCache; |
|
ahe
2013/09/30 11:05:26
This isn't a cache, please find a different name.
Johnni Winther
2013/10/01 11:21:48
Removed the getters.
|
| + } |
| + |
| /// The type of [:super:]. Can only be accessed if [currentClass] is not null. |
| - InterfaceType superType; |
| + InterfaceType get superType { |
| + assert(invariant(elements.currentElement, superTypeCache != null, |
| + message: 'Trying to access the type of super in ' |
| + '${elements.currentElement}')); |
| + return superTypeCache; |
| + } |
| Link<DartType> cascadeTypes = const Link<DartType>(); |
| @@ -181,8 +195,8 @@ class TypeCheckerVisitor extends Visitor<DartType> { |
| listType = compiler.listClass.computeType(compiler); |
| if (currentClass != null) { |
| - thisType = currentClass.computeType(compiler); |
| - superType = currentClass.supertype; |
| + thisTypeCache = currentClass.computeType(compiler); |
|
karlklose
2013/10/01 08:58:58
Can you use currentClass.thisType here?
Johnni Winther
2013/10/01 11:21:48
Added a TODO.
|
| + superTypeCache = currentClass.supertype; |
| } |
| } |