Index: lib/compiler/implementation/elements/elements.dart |
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart |
index 8870678023f50765eec73cd5e53a196241a5571e..31536cde58e9e7e094262a869ad10fdd0e5cd2ea 100644 |
--- a/lib/compiler/implementation/elements/elements.dart |
+++ b/lib/compiler/implementation/elements/elements.dart |
@@ -491,21 +491,37 @@ class PrefixElement extends Element { |
} |
class TypedefElement extends Element implements TypeDeclarationElement { |
- Type cachedType; |
Typedef cachedNode; |
+ TypedefType cachedType; |
+ Type alias; |
+ |
+ bool isResolved = false; |
+ 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. |
+ */ |
+ 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); |
@@ -658,7 +674,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); |
} |
@@ -1489,7 +1505,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; |
} |
} |