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) |
| @@ -356,12 +356,23 @@ |
| class TypedefElement extends Element { |
| final Token token; |
| Type cachedType; |
| + Node cachedNode; |
|
ahe
2012/05/29 12:32:08
The type should be Typedef.
ngeoffray
2012/05/29 13:06:28
Done.
|
| TypedefElement(SourceString name, Element enclosing, this.token) |
| : super(name, ElementKind.TYPEDEF, enclosing) { |
| cachedType = new InterfaceType(this); |
| } |
| + Node parseNode(Compiler compiler) { |
|
ahe
2012/05/29 12:32:08
I would prefer if this followed the "PartialFuncti
ngeoffray
2012/05/29 13:06:28
Done.
|
| + if (cachedNode !== null) return cachedNode; |
| + NodeListener listener = new NodeListener(compiler, enclosingElement); |
| + Parser parser = new Parser(listener); |
| + Token token = parser.parseTopLevelDeclaration(token); |
| + cachedNode = listener.popNode(); |
| + assert(listener.nodes.isEmpty()); |
|
kasperl
2012/05/29 12:16:24
Maybe cancel with an internal error instead?
ahe
2012/05/29 12:32:08
This is consistent with other code.
|
| + return cachedNode; |
| + } |
| + |
| position() => findMyName(token); |
| Type computeType(Compiler compiler) => cachedType; |