Index: lib/compiler/implementation/elements/elements.dart |
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart |
index ea7c5dde6e0b27d0dad267e3288cfe1791fa80f5..a72527a23b5df8b3b88f1f280ecbf2dbbe10a436 100644 |
--- a/lib/compiler/implementation/elements/elements.dart |
+++ b/lib/compiler/implementation/elements/elements.dart |
@@ -475,21 +475,37 @@ class PrefixElement extends Element { |
} |
class TypedefElement extends Element implements TypeDeclarationElement { |
- Type cachedType; |
Typedef cachedNode; |
+ TypedefType cachedType; |
+ Type alias; |
+ |
+ bool isResolved = false; |
ahe
2012/08/16 13:22:58
Can you use states instead as I do in ClassElement
Johnni Winther
2012/08/17 11:15:19
I will do that in a later CL.
|
+ bool isBeingResolved = false; |
TypedefElement(SourceString name, Element enclosing) |
: super(name, ElementKind.TYPEDEF, enclosing); |
- Type computeType(Compiler compiler) { |
+ /** |
+ * Function signature for a typedef of a function type. The signature is |
+ * kept to provide full information about parameter names through the mirror |
+ * system. |
+ * |
+ * The [functionSignature] is not available until the typedef element has been |
+ * resolved. |
ahe
2012/08/16 13:22:58
How do you resolve a typedef element?
Johnni Winther
2012/08/17 11:15:19
Currently `compiler.resolveTypedef(this)`. I will
ahe
2012/08/21 14:27:24
I hoped you would include this explanation in the
|
+ */ |
+ FunctionSignature functionSignature; |
+ |
+ TypedefType computeType(Compiler compiler) { |
if (cachedType !== null) return cachedType; |
- cachedType = new FunctionType(null, null, this); |
- cachedType.initializeFrom( |
- compiler.computeFunctionType(this, compiler.resolveTypedef(this))); |
+ Typedef node = parseNode(compiler); |
+ Link<Type> parameters = |
+ TypeDeclarationElement.createTypeVariables(this, node.typeParameters); |
+ cachedType = new TypedefType(this, parameters); |
+ compiler.resolveTypedef(this); |
return cachedType; |
} |
- Link<Type> get typeVariables() => const EmptyLink<Type>(); |
+ Link<Type> get typeVariables() => cachedType.typeArguments; |
Scope buildScope() => |
new TypeDeclarationScope(enclosingElement.buildScope(), this); |
@@ -642,7 +658,7 @@ class VariableListElement extends Element { |
VariableListElement cloneTo(Element enclosing, DiagnosticListener listener) { |
VariableListElement result; |
if (cachedNode !== null) { |
- result = new VariableListElement(cachedNode, kind, enclosing); |
+ result = new VariableListElement.node(cachedNode, kind, enclosing); |
} else { |
result = new VariableListElement(kind, modifiers, enclosing); |
} |
@@ -1415,7 +1431,7 @@ class TypeVariableElement extends Element { |
TypeVariableElement cloneTo(Element enclosing, DiagnosticListener listener) { |
TypeVariableElement result = |
- new TypeVariableElement(name, enclosing, node, type, bound); |
+ new TypeVariableElement(name, enclosing, cachedNode, type, bound); |
return result; |
} |
} |