Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java |
=================================================================== |
--- editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java (revision 22253) |
+++ editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java (working copy) |
@@ -4824,7 +4824,16 @@ |
* @return the type name that was parsed |
*/ |
private TypeName parseTypeName() { |
- Identifier typeName = parsePrefixedIdentifier(); |
+ Identifier typeName; |
+ if (matches(Keyword.VAR)) { |
+ reportError(ParserErrorCode.VAR_AS_TYPE_NAME); |
+ typeName = new SimpleIdentifier(getAndAdvance()); |
+ } else if (matchesIdentifier()) { |
+ typeName = parsePrefixedIdentifier(); |
+ } else { |
+ typeName = createSyntheticIdentifier(); |
+ reportError(ParserErrorCode.EXPECTED_TYPE_NAME); |
+ } |
TypeArgumentList typeArguments = null; |
if (matches(TokenType.LT)) { |
typeArguments = parseTypeArgumentList(); |