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

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

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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: 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();

Powered by Google App Engine
This is Rietveld 408576698