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..2f9b67a284bae52c00e8042f49be8f9430d1c0ea 100644 |
| --- a/lib/compiler/implementation/scanner/listener.dart |
| +++ b/lib/compiler/implementation/scanner/listener.dart |
| @@ -250,6 +250,12 @@ class Listener { |
| Token beginToken, Token endToken) { |
| } |
| + void beginRedirectingFactoryBody(Token token) { |
| + } |
| + |
| + void endRedirectingFactoryBody(Token start, Token dot, Token end) { |
|
ahe
2012/09/26 14:51:09
Not sure this is "dot". You're using a different n
Lasse Reichstein Nielsen
2012/09/27 11:50:59
Switched to periodBeforeName everywhere.
|
| + } |
| + |
| void beginReturnStatement(Token token) { |
| } |
| @@ -1157,6 +1163,23 @@ class NodeListener extends ElementListener { |
| pushNode(null); |
| } |
| + void endRedirectingFactoryBody(Token start, Token namePartStart, Token end) { |
|
ahe
2012/09/26 14:51:09
What is namePartStart? Should it be periodBeforeNa
Lasse Reichstein Nielsen
2012/09/27 11:50:59
Done.
|
| + // This generates code for '= Type<T>.foo' that is similar to |
|
ahe
2012/09/26 14:51:09
code -> nodes
Lasse Reichstein Nielsen
2012/09/27 11:50:59
Done.
|
| + // '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 (namePartStart != null) { |
| + Identifier name = target; |
| + TypeAnnotation type = popNode(); |
| + target = new Send(type, name); |
| + } |
| + NewExpression newExpression = |
| + new NewExpression(start, new Send(null, target, noArguments)); |
| + pushNode(new Return(start, end, newExpression)); |
| + } |
| + |
| void endReturnStatement(bool hasExpression, |
| Token beginToken, Token endToken) { |
| Expression expression = hasExpression ? popNode() : null; |