Chromium Code Reviews| Index: lib/compiler/implementation/scanner/parser.dart |
| diff --git a/lib/compiler/implementation/scanner/parser.dart b/lib/compiler/implementation/scanner/parser.dart |
| index 4f4f5ddba2aba43b2f61400ae36a5585d69f63d0..41dcc83035e84a3c49731b8fb6f5ea96d17f2a03 100644 |
| --- a/lib/compiler/implementation/scanner/parser.dart |
| +++ b/lib/compiler/implementation/scanner/parser.dart |
| @@ -916,7 +916,11 @@ class Parser { |
| token = parseIdentifier(token.next); |
| } |
| token = parseFormalParameters(token); |
| - token = parseFunctionBody(token, false); |
| + if (optional('=', token)) { |
| + token = parseRedirectingFactoryBody(token); |
| + } else { |
| + token = parseFunctionBody(token, false); |
| + } |
| listener.endFactoryMethod(start, period, token); |
| return token.next; |
| } |
| @@ -991,6 +995,21 @@ class Parser { |
| return isBlock ? token.next : token; |
| } |
| + Token parseRedirectingFactoryBody(Token token) { |
| + listener.beginRedirectingFactoryBody(token); |
| + assert('=' === token.stringValue); |
|
ahe
2012/10/05 08:23:20
assert(optional('=', token));
I should clean up t
Lasse Reichstein Nielsen
2012/10/09 09:46:54
Done.
|
| + Token equals = token; |
| + token = parseType(token.next); |
| + Token dot = null; |
| + if (optional('.', token)) { |
| + dot = token; |
| + token = parseIdentifier(token.next); |
| + } |
| + expectSemicolon(token); |
| + listener.endRedirectingFactoryBody(equals, dot, token); |
| + return token; |
|
ahe
2012/10/05 08:23:20
You should consume the semicolon token if you requ
Lasse Reichstein Nielsen
2012/10/09 09:46:54
I don't think that's compatible with parseFunction
|
| + } |
| + |
| Token parseFunctionBody(Token token, bool isExpression) { |
| if (optional(';', token)) { |
| listener.endFunctionBody(0, null, token); |