Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2572)

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java

Issue 26466005: Support for parsing 'class name = mixinApplication', report error for 'typedef name = mixinApplicat… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changes for review comments. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
index 26216862b10369143fa06eb9d4a96582084e0f79..ed45060f6412241217a685be6c2cf9a084991f78 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
@@ -1397,7 +1397,8 @@ public class Parser {
*
* <pre>
* classDeclaration ::=
- * metadata 'abstract'? 'class' name typeParameterList? (extendsClause withClause?)? implementsClause? '{' classMembers '}'
+ * metadata 'abstract'? 'class' name typeParameterList? (extendsClause withClause?)? implementsClause? '{' classMembers '}' |
+ * metadata 'abstract'? 'class' mixinApplicationClass
* </pre>
*
* @param commentAndMetadata the metadata to be associated with the member
@@ -1405,11 +1406,25 @@ public class Parser {
* not given
* @return the class declaration that was parsed
*/
- private ClassDeclaration parseClassDeclaration(CommentAndMetadata commentAndMetadata,
+ private CompilationUnitMember parseClassDeclaration(CommentAndMetadata commentAndMetadata,
Token abstractKeyword) {
Token keyword = expect(Keyword.CLASS);
+
+ if (matchesIdentifier()) {
+ Token next = peek();
+ if (matches(next, TokenType.LT)) {
+ next = skipTypeParameterList(next);
+ if (next != null && matches(next, TokenType.EQ)) {
+ return parseClassTypeAlias(commentAndMetadata, keyword);
+ }
+ } else if (matches(next, TokenType.EQ)) {
+ return parseClassTypeAlias(commentAndMetadata, keyword);
+ }
+ }
+
SimpleIdentifier name = parseSimpleIdentifier();
String className = name.getName();
+
TypeParameterList typeParameters = null;
if (matches(TokenType.LT)) {
typeParameters = parseTypeParameterList();
@@ -5186,10 +5201,16 @@ public class Parser {
if (matches(next, TokenType.LT)) {
next = skipTypeParameterList(next);
if (next != null && matches(next, TokenType.EQ)) {
- return parseClassTypeAlias(commentAndMetadata, keyword);
+ TypeAlias typeAlias = parseClassTypeAlias(commentAndMetadata, keyword);
+ // TODO(scheglov) report error when VM and dart2js start to accept new syntax
+// reportError(ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS, keyword);
+ return typeAlias;
}
} else if (matches(next, TokenType.EQ)) {
- return parseClassTypeAlias(commentAndMetadata, keyword);
+ TypeAlias typeAlias = parseClassTypeAlias(commentAndMetadata, keyword);
+ // TODO(scheglov) report error when VM and dart2js start to accept new syntax
+// reportError(ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS, keyword);
+ return typeAlias;
}
}
return parseFunctionTypeAlias(commentAndMetadata, keyword);

Powered by Google App Engine
This is Rietveld 408576698