Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/scanner/parser.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/scanner/parser.dart b/sdk/lib/_internal/compiler/implementation/scanner/parser.dart |
| index 63e7da7a422e1244f7b3bbb062c99615361ba082..5cb6b1337ed20125d42725b7ce09f693874d549b 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/scanner/parser.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/scanner/parser.dart |
| @@ -1581,6 +1581,12 @@ class Parser { |
| } |
| info = token.info; |
| tokenLevel = info.precedence; |
| + if (level == EQUALITY_PRECEDENCE || level == RELATIONAL_PRECEDENCE) { |
| + // We don't allow (a == b == c) or (a < b < c). |
| + // Continue the outer loop if we have matched one equality or |
| + // relational operator. |
| + break; |
| + } |
| } |
| } |
| return token; |
| @@ -1622,25 +1628,7 @@ class Parser { |
| Token parseUnaryExpression(Token token, bool allowCascades) { |
| String value = token.stringValue; |
| // Prefix: |
| - if (identical(value, '+')) { |
| - // Dart only allows "prefix plus" as an initial part of a |
| - // decimal literal. We scan it as a separate token and let |
| - // the parser listener combine it with the digits. |
| - Token next = token.next; |
| - if (identical(next.charOffset, token.charOffset + 1)) { |
| - if (identical(next.kind, INT_TOKEN)) { |
| - listener.handleLiteralInt(token); |
| - return next.next; |
| - } |
| - if (identical(next.kind, DOUBLE_TOKEN)) { |
| - listener.handleLiteralDouble(token); |
| - return next.next; |
| - } |
| - } |
| - listener.recoverableError("Unexpected token '+'", token: token); |
| - return parsePrecedenceExpression(next, POSTFIX_PRECEDENCE, |
| - allowCascades); |
|
Lasse Reichstein Nielsen
2013/09/18 13:41:19
WOuld it be better to keep the 'if' and the last t
ahe
2013/09/18 13:42:59
Yes. And it would be even better if you replace li
|
| - } else if ((identical(value, '!')) || |
| + if ((identical(value, '!')) || |
| (identical(value, '-')) || |
| (identical(value, '~'))) { |
| Token operator = token; |