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

Unified Diff: dart/lib/compiler/implementation/scanner/parser.dart

Issue 10857013: Support for new catch syntax in dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 4 months 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/lib/compiler/implementation/scanner/parser.dart
diff --git a/dart/lib/compiler/implementation/scanner/parser.dart b/dart/lib/compiler/implementation/scanner/parser.dart
index c70a676dda66737a11b3fe8d7c6aeb765db73c1f..db3da46975f8984bce763df3da39552172d67443 100644
--- a/dart/lib/compiler/implementation/scanner/parser.dart
+++ b/dart/lib/compiler/implementation/scanner/parser.dart
@@ -1579,14 +1579,28 @@ class Parser {
listener.beginTryStatement(tryKeyword);
token = parseBlock(token.next);
int catchCount = 0;
- while (optional('catch', token)) {
- Token catchKeyword = token;
- // TODO(ahe): Validate the "parameters".
- token = parseFormalParameters(token.next);
+
+ String value = token.stringValue;
+ while (value === 'catch' || value === 'on') {
+ var onKeyword = null;
+ if (value === 'on') {
+ // on qualified catchPart?
+ onKeyword = token;
+ token = parseType(token.next);
+ value = token.stringValue;
+ }
+ Token catchKeyword = null;
+ if (value === 'catch') {
+ catchKeyword = token;
+ // TODO(ahe): Validate the "parameters".
+ token = parseFormalParameters(token.next);
+ }
token = parseBlock(token);
++catchCount;
- listener.handleCatchBlock(catchKeyword);
+ listener.handleCatchBlock(onKeyword, catchKeyword);
+ value = token.stringValue; // while condition
}
+
Token finallyKeyword = null;
if (optional('finally', token)) {
finallyKeyword = token;
« no previous file with comments | « dart/lib/compiler/implementation/scanner/listener.dart ('k') | dart/lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698