Index: dart/lib/compiler/implementation/elements/elements.dart |
diff --git a/dart/lib/compiler/implementation/elements/elements.dart b/dart/lib/compiler/implementation/elements/elements.dart |
index 2344018ca6a1811693d957a920efa8c961bbed8d..c356eb5757af170fb060df486e4619c3f4ac2672 100644 |
--- a/dart/lib/compiler/implementation/elements/elements.dart |
+++ b/dart/lib/compiler/implementation/elements/elements.dart |
@@ -448,8 +448,9 @@ class TypedefElement extends Element implements TypeDeclarationElement { |
Type computeType(Compiler compiler) { |
if (cachedType !== null) return cachedType; |
- cachedType = compiler.computeFunctionType( |
- this, compiler.resolveTypedef(this)); |
+ cachedType = new FunctionType(null, null, this); |
+ cachedType.initializeFrom( |
Lasse Reichstein Nielsen
2012/08/13 13:34:48
Make initialize a copy constructor instead.
ahe
2012/08/13 15:14:01
I don't think I can do that. I got to keep the sam
|
+ compiler.computeFunctionType(this, compiler.resolveTypedef(this))); |
return cachedType; |
} |
@@ -881,6 +882,10 @@ abstract class TypeDeclarationElement implements Element { |
class ClassElement extends ContainerElement |
implements TypeDeclarationElement { |
+ static final int STATE_NOT_STARTED = 0; |
+ static final int STATE_STARTED = 1; |
+ static final int STATE_DONE = 2; |
+ |
final int id; |
InterfaceType type; |
Type supertype; |
@@ -888,9 +893,22 @@ class ClassElement extends ContainerElement |
Link<Element> members = const EmptyLink<Element>(); |
Map<SourceString, Element> localMembers; |
Map<SourceString, Element> constructors; |
- Link<Type> interfaces = const EmptyLink<Type>(); |
- bool isResolved = false; |
- bool isBeingResolved = false; |
+ Link<Type> interfaces; |
+ |
+ int _supertypeLoadState = STATE_NOT_STARTED; |
+ int get supertypeLoadState() => _supertypeLoadState; |
+ void set supertypeLoadState(int state) { |
+ assert(state == _supertypeLoadState + 1); |
Lasse Reichstein Nielsen
2012/08/13 13:34:48
Also assert that it's not larger than STATE_DONE.
ahe
2012/08/13 15:14:01
Done.
|
+ _supertypeLoadState = state; |
+ } |
+ |
+ int _resolutionState = STATE_NOT_STARTED; |
+ int get resolutionState() => _resolutionState; |
+ void set resolutionState(int state) { |
+ assert(state == _resolutionState + 1); |
+ _resolutionState = state; |
+ } |
+ |
// backendMembers are members that have been added by the backend to simplify |
// compilation. They don't have any user-side counter-part. |
Link<Element> backendMembers = const EmptyLink<Element>(); |
@@ -929,7 +947,9 @@ class ClassElement extends ContainerElement |
Link<Type> get typeVariables() => type.arguments; |
ClassElement ensureResolved(Compiler compiler) { |
- compiler.resolveClass(this); |
+ if (resolutionState == STATE_NOT_STARTED) { |
+ compiler.resolver.resolveClass(this); |
+ } |
return this; |
} |
@@ -1016,7 +1036,7 @@ class ClassElement extends ContainerElement |
* The returned element may not be resolved yet. |
*/ |
ClassElement get superclass() { |
- assert(isResolved); |
+ assert(supertypeLoadState == STATE_DONE); |
return supertype === null ? null : supertype.element; |
} |