Index: lib/compiler/implementation/scanner/parser.dart |
diff --git a/lib/compiler/implementation/scanner/parser.dart b/lib/compiler/implementation/scanner/parser.dart |
index a05394afc82917494cd902b29b25cc4df3dcb7eb..548e8d295f29d76260ceabd115b1d131317db508 100644 |
--- a/lib/compiler/implementation/scanner/parser.dart |
+++ b/lib/compiler/implementation/scanner/parser.dart |
@@ -931,6 +931,8 @@ class Parser { |
} |
} else if (info === IS_INFO) { |
token = parseIsOperatorRest(token); |
+ } else if (info === AS_INFO) { |
+ token = parseAsOperatorRest(token); |
} else if (info === QUESTION_INFO) { |
token = parseConditionalExpressionRest(token); |
} else { |
@@ -1357,14 +1359,26 @@ class Parser { |
} |
token = parseType(token.next); |
listener.handleIsOperator(operator, not, token); |
- if (optional('is', token)) { |
- // The is-operator cannot be chained, but it can take part of |
+ if (optional('is', token) || optional('as', token)) { |
ahe
2012/06/25 10:36:56
Please put stringValue in a local variable instead
Lasse Reichstein Nielsen
2012/06/25 11:20:06
Done.
|
+ // The is- and as-operators cannot be chained, but they can take part of |
// expressions like: foo is Foo || foo is Bar. |
listener.unexpected(token); |
} |
return token; |
} |
+ Token parseAsOperatorRest(Token token) { |
+ assert(optional('as', token)); |
+ Token operator = token; |
+ token = parseType(token.next); |
+ listener.handleAsOperator(operator, token); |
+ if (optional('is', token) || optional('as', token)) { |
ahe
2012/06/25 10:36:56
Ditto.
Lasse Reichstein Nielsen
2012/06/25 11:20:06
Done.
|
+ // The is- and as-operators cannot be chained. |
+ listener.unexpected(token); |
+ } |
+ return token; |
+ } |
+ |
Token parseVariablesDeclaration(Token token) { |
token = parseVariablesDeclarationNoSemicolon(token); |
return expectSemicolon(token); |