| Index: compiler/java/com/google/dart/compiler/parser/DartParser.java
|
| diff --git a/compiler/java/com/google/dart/compiler/parser/DartParser.java b/compiler/java/com/google/dart/compiler/parser/DartParser.java
|
| index 85e54bf233d968aeb3ba567714bd926568e0b44c..049ca82a78e819b0c42b4ccf18fe43927bab1ff6 100644
|
| --- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
|
| +++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
|
| @@ -125,7 +125,7 @@ public class DartParser extends CompletionHooksParserBase {
|
| private static final String ASSERT_KEYWORD = "assert";
|
| private static final String CLASS_KEYWORD = "class";
|
| private static final String EXTENDS_KEYWORD = "extends";
|
| - private static final String FACTORY_KEYWORD = "factory";
|
| + private static final String FACTORY_KEYWORD = "factory"; // TODO(zundel): remove
|
| private static final String GETTER_KEYWORD = "get";
|
| private static final String IMPLEMENTS_KEYWORD = "implements";
|
| private static final String INTERFACE_KEYWORD = "interface";
|
| @@ -579,9 +579,15 @@ public class DartParser extends CompletionHooksParserBase {
|
| }
|
|
|
| // Deal with factory clause for interfaces.
|
| - DartTypeNode factory = null;
|
| - if (isParsingInterface && optionalPseudoKeyword(FACTORY_KEYWORD)) {
|
| - factory = parseTypeAnnotation();
|
| + DartExpression factory = null;
|
| +
|
| + if (isParsingInterface &&
|
| + (optionalDeprecatedFactory() || optional(Token.DEFAULT))) {
|
| + factory = parseQualified();
|
| + List<DartTypeParameter> defaultTypeParameters = parseTypeParametersOpt();
|
| + if (!defaultTypeParameters.isEmpty()) {
|
| + factory = doneWithoutConsuming(new DartParameterizedNode(factory, defaultTypeParameters));
|
| + }
|
| }
|
|
|
| // Deal with native clause for classes.
|
| @@ -622,6 +628,15 @@ public class DartParser extends CompletionHooksParserBase {
|
| }
|
| }
|
|
|
| + private boolean optionalDeprecatedFactory() {
|
| + if (optionalPseudoKeyword(FACTORY_KEYWORD)) {
|
| + // Uncommenting this makes tests fail until corelib is cleaned up
|
| + // reportError(position(), ParserErrorCode.DEPRECATED_USE_OF_FACTORY_KEYWORD);
|
| + return true;
|
| + }
|
| + return false;
|
| + }
|
| +
|
| private List<DartTypeNode> parseTypeAnnotationList() {
|
| List<DartTypeNode> result = new ArrayList<DartTypeNode>();
|
| do {
|
| @@ -1019,10 +1034,6 @@ public class DartParser extends CompletionHooksParserBase {
|
| private DartMethodDefinition parseFactory(Modifiers modifiers) {
|
| beginMethodName();
|
| DartExpression name = parseQualified();
|
| - List<DartTypeParameter> typeParameters = parseTypeParametersOpt();
|
| - if (!typeParameters.isEmpty()) {
|
| - name = doneWithoutConsuming(new DartParameterizedNode(name, typeParameters));
|
| - }
|
| if (optional(Token.PERIOD)) {
|
| name = doneWithoutConsuming(new DartPropertyAccess(name, parseIdentifier()));
|
| }
|
| @@ -1036,7 +1047,7 @@ public class DartParser extends CompletionHooksParserBase {
|
| function = new DartFunction(formals, parseFunctionStatementBody(true), null);
|
| }
|
| doneWithoutConsuming(function);
|
| - return DartMethodDefinition.create(name, function, modifiers, null, typeParameters);
|
| + return DartMethodDefinition.create(name, function, modifiers, null);
|
| }
|
|
|
| private DartIdentifier parseVoidIdentifier() {
|
| @@ -1106,8 +1117,6 @@ public class DartParser extends CompletionHooksParserBase {
|
| } else {
|
| // Normal method or property.
|
| name = parseIdentifier();
|
| - // TODO(zundel): something constructive with the type arguments
|
| - parseTypeArgumentsOpt();
|
| }
|
|
|
| // Check for named constructor.
|
| @@ -1172,7 +1181,7 @@ public class DartParser extends CompletionHooksParserBase {
|
| }
|
|
|
| DartFunction function = doneWithoutConsuming(new DartFunction(parameters, body, returnType));
|
| - return DartMethodDefinition.create(name, function, modifiers, initializers, null);
|
| + return DartMethodDefinition.create(name, function, modifiers, initializers);
|
| }
|
|
|
| private DartBlock parseNativeBlock(Modifiers modifiers) {
|
|
|