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 dbe9c6ff7512186245112026fa292ef9334be101..ef4c5e341f9881c24046dbe74ebd421b5c6fa32c 100644 |
| --- a/lib/compiler/implementation/scanner/parser.dart |
| +++ b/lib/compiler/implementation/scanner/parser.dart |
| @@ -467,7 +467,8 @@ class Parser { |
| ('var' === token.stringValue) || |
| ('const' === token.stringValue) || |
| ('abstract' === token.stringValue) || |
| - ('static' === token.stringValue)); |
| + ('static' === token.stringValue) || |
| + ('external' === token.stringValue)); |
| listener.handleModifier(token); |
| return token.next; |
| } |
| @@ -480,7 +481,8 @@ class Parser { |
| ('var' !== value) && |
| ('const' !== value) && |
| ('abstract' !== value) && |
| - ('static' !== value)) |
| + ('static' !== value) && |
| + ('external' !== value)) |
| break; |
| token = parseModifier(token); |
| count++; |
| @@ -567,7 +569,9 @@ class Parser { |
| } |
| Token parseMember(Token token) { |
| - if (optional('factory', token)) { |
|
ahe
2012/08/02 20:14:36
This is kinda of a hack.
|
| + String value = token.stringValue; |
| + if (value === 'factory' || |
| + (value === 'external' && optional('factory', token.next))) { |
|
ahe
2012/08/02 20:14:36
And now the hack doesn't work anymore.
|
| return parseFactoryMethod(token); |
| } |
| Token start = token; |
| @@ -631,7 +635,10 @@ class Parser { |
| } |
| Token parseFactoryMethod(Token token) { |
| - assert(optional('factory', token)); |
| + assert((optional('external', token) && optional('factory', token.next)) || |
| + optional('factory', token)); |
| + Token start = token; |
| + if (start.stringValue === 'external') token = token.next; |
| Token factoryKeyword = token; |
| listener.beginFactoryMethod(factoryKeyword); |
| token = token.next; // Skip 'factory'. |
| @@ -645,7 +652,7 @@ class Parser { |
| } |
| token = parseFormalParameters(token); |
| token = parseFunctionBody(token, false); |
| - listener.endFactoryMethod(factoryKeyword, period, token); |
| + listener.endFactoryMethod(factoryKeyword, period, start); |
| return token.next; |
| } |