Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/scanner/parser.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/scanner/parser.dart b/sdk/lib/_internal/compiler/implementation/scanner/parser.dart |
| index 05b1acfe4e85acc588c1dbb7655338612e280638..e07899f15740b3c4b248939fb97aab10d750a2e6 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/scanner/parser.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/scanner/parser.dart |
| @@ -59,9 +59,10 @@ class Parser { |
| Token parseTopLevelDeclaration(Token token) { |
| token = parseMetadataStar(token); |
| final String value = token.stringValue; |
| - if ((identical(value, 'abstract') && optional('class', token.next)) |
| - || identical(value, 'class')) { |
| + if (identical(value, 'abstract') && optional('class', token.next)) { |
| return parseClass(token); |
| + } else if (identical(value, 'class')) { |
| + return parseClassOrMixinApplication(token); |
| } else if (identical(value, 'typedef')) { |
| return parseTypedef(token); |
| } else if (identical(value, 'library')) { |
| @@ -246,6 +247,7 @@ class Parser { |
| Token parseTypedef(Token token) { |
| Token typedefKeyword = token; |
| if (optional('=', peekAfterType(token.next))) { |
| + // TODO(aprelev@gmail.com): Remove deprecated 'typedef' mixin application. |
| listener.beginNamedMixinApplication(token); |
| token = parseIdentifier(token.next); |
| token = parseTypeVariablesOpt(token); |
| @@ -270,6 +272,7 @@ class Parser { |
| return expect(';', token); |
| } |
| + |
|
Johnni Winther
2013/10/10 07:29:56
Extra line.
aam-me
2013/10/11 03:02:06
Done.
|
| Token parseMixinApplication(Token token) { |
| listener.beginMixinApplication(token); |
| token = parseType(token); |
| @@ -453,6 +456,28 @@ class Parser { |
| return beginGroupToken.endGroup; |
| } |
| + Token parseClassOrMixinApplication(Token token) { |
| + Token classKeyword = token; |
| + if (optional('=', peekAfterType(token.next))) { |
| + listener.beginNamedMixinApplication(token); |
| + token = parseIdentifier(token.next); |
| + token = parseTypeVariablesOpt(token); |
| + token = expect('=', token); |
| + token = parseModifiers(token); |
|
Johnni Winther
2013/10/10 07:29:56
Modifiers should preceed the 'class' keyword:
abs
aam-me
2013/10/11 03:02:06
Done.
|
| + token = parseMixinApplication(token); |
| + Token implementsKeyword = null; |
| + if (optional('implements', token)) { |
| + implementsKeyword = token; |
| + token = parseTypeList(token.next); |
| + } |
| + listener.endNamedMixinApplication( |
| + classKeyword, implementsKeyword, token); |
| + return expect(';', token); |
| + } else { |
| + return parseClass(token); |
| + } |
| + } |
| + |
| Token parseClass(Token token) { |
| Token begin = token; |
| listener.beginClassDeclaration(token); |