Chromium Code Reviews| Index: dart/lib/compiler/implementation/elements/elements.dart |
| =================================================================== |
| --- dart/lib/compiler/implementation/elements/elements.dart (revision 8049) |
| +++ dart/lib/compiler/implementation/elements/elements.dart (working copy) |
| @@ -354,17 +354,18 @@ |
| } |
| class TypedefElement extends Element { |
| - final Token token; |
| Type cachedType; |
| + Typedef cachedNode; |
| - TypedefElement(SourceString name, Element enclosing, this.token) |
| - : super(name, ElementKind.TYPEDEF, enclosing) { |
| - cachedType = new InterfaceType(this); |
| - } |
| + TypedefElement(SourceString name, Element enclosing) |
| + : super(name, ElementKind.TYPEDEF, enclosing); |
| - position() => findMyName(token); |
|
ahe
2012/05/29 15:43:49
Did you mean to delete this?
ngeoffray
2012/05/29 15:51:42
Yes, it is now in PartialTypedefElement.
|
| - |
| - Type computeType(Compiler compiler) => cachedType; |
| + Type computeType(Compiler compiler) { |
| + if (cachedType !== null) return cachedType; |
| + cachedType = compiler.computeFunctionType( |
| + this, compiler.resolveTypedef(this)); |
| + return cachedType; |
| + } |
| } |
| class VariableElement extends Element { |
| @@ -611,19 +612,7 @@ |
| FunctionType computeType(Compiler compiler) { |
| if (type != null) return type; |
| - compiler.withCurrentElement(this, () { |
| - FunctionSignature signature = computeSignature(compiler); |
| - LinkBuilder<Type> parameterTypes = new LinkBuilder<Type>(); |
| - for (Link<Element> link = signature.requiredParameters; |
| - !link.isEmpty(); |
| - link = link.tail) { |
| - parameterTypes.addLast(link.head.computeType(compiler)); |
| - // TODO(karlklose): optional parameters. |
| - } |
| - type = new FunctionType(signature.returnType, |
| - parameterTypes.toLink(), |
| - this); |
| - }); |
| + type = compiler.computeFunctionType(this, computeSignature(compiler)); |
| return type; |
| } |