| Index: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
|
| ===================================================================
|
| --- dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java (revision 29808)
|
| +++ dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java (working copy)
|
| @@ -1934,14 +1934,21 @@
|
| * @return {@code true} if the given token appears to be the beginning of an operator declaration
|
| */
|
| private boolean isOperator(Token startToken) {
|
| - if (startToken.isOperator()) {
|
| - Token token = startToken.getNext();
|
| - while (token.isOperator()) {
|
| - token = token.getNext();
|
| - }
|
| - return matches(token, TokenType.OPEN_PAREN);
|
| + // Accept any operator here, even if it is not user definable.
|
| + if (!startToken.isOperator()) {
|
| + return false;
|
| }
|
| - return false;
|
| + // Token "=" means that it is actually field initializer.
|
| + if (startToken.getType() == TokenType.EQ) {
|
| + return false;
|
| + }
|
| + // Consume all operator tokens.
|
| + Token token = startToken.getNext();
|
| + while (token.isOperator()) {
|
| + token = token.getNext();
|
| + }
|
| + // Formal parameter list is expect now.
|
| + return matches(token, TokenType.OPEN_PAREN);
|
| }
|
|
|
| /**
|
| @@ -5692,9 +5699,15 @@
|
| private Token skipFinalConstVarOrType(Token startToken) {
|
| if (matches(startToken, Keyword.FINAL) || matches(startToken, Keyword.CONST)) {
|
| Token next = startToken.getNext();
|
| - if (matchesIdentifier(next.getNext()) || matches(next.getNext(), TokenType.LT)
|
| - || matches(next.getNext(), Keyword.THIS)) {
|
| - return skipTypeName(next);
|
| + if (matchesIdentifier(next)) {
|
| + Token next2 = next.getNext();
|
| + // "Type parameter" or "Type<" or "prefix.Type"
|
| + if (matchesIdentifier(next2) || matches(next2, TokenType.LT)
|
| + || matches(next2, TokenType.PERIOD)) {
|
| + return skipTypeName(next);
|
| + }
|
| + // "parameter"
|
| + return next;
|
| }
|
| } else if (matches(startToken, Keyword.VAR)) {
|
| return startToken.getNext();
|
|
|