Chromium Code Reviews| Index: lib/compiler/implementation/scanner/listener.dart |
| diff --git a/lib/compiler/implementation/scanner/listener.dart b/lib/compiler/implementation/scanner/listener.dart |
| index 3298428766a661c10ad6f2cbe62d4ec997f1dd80..8bb34c604a4e37a260194cc19cefa1f3587862e9 100644 |
| --- a/lib/compiler/implementation/scanner/listener.dart |
| +++ b/lib/compiler/implementation/scanner/listener.dart |
| @@ -250,6 +250,14 @@ class Listener { |
| Token beginToken, Token endToken) { |
| } |
| + void beginRedirectingFactoryBody(Token token) { |
| + } |
| + |
| + void endRedirectingFactoryBody(Token start, |
| + Token periodBeforeName, |
| + Token end) { |
| + } |
| + |
| void beginReturnStatement(Token token) { |
| } |
| @@ -1157,6 +1165,25 @@ class NodeListener extends ElementListener { |
| pushNode(null); |
| } |
| + void endRedirectingFactoryBody(Token start, |
| + Token periodBeforeName, |
| + Token end) { |
| + // This generates nodes for '= Type<T>.foo' that are similar to |
| + // 'return new Type<T>.foo()'. It is recognizable by having |
| + // the '=' token as starting token for both the Return and |
| + // the NewExpression objects. |
| + NodeList noArguments = new NodeList.empty(); |
| + Node target = popNode(); |
| + if (periodBeforeName != null) { |
| + Identifier name = target; |
| + TypeAnnotation type = popNode(); |
| + target = new Send(type, name); |
| + } |
| + NewExpression newExpression = |
| + new NewExpression(start, new Send(null, target, noArguments)); |
|
ahe
2012/10/05 08:23:20
We can't have the same token in two AST node.
I t
Lasse Reichstein Nielsen
2012/10/09 09:46:54
That's ... problematic. We might need a new AST no
|
| + pushNode(new Return(start, end, newExpression)); |
| + } |
| + |
| void endReturnStatement(bool hasExpression, |
| Token beginToken, Token endToken) { |
| Expression expression = hasExpression ? popNode() : null; |