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

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

Issue 11014010: Made assert a keyword. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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: lib/compiler/implementation/scanner/parser.dart
diff --git a/lib/compiler/implementation/scanner/parser.dart b/lib/compiler/implementation/scanner/parser.dart
index 4f4f5ddba2aba43b2f61400ae36a5585d69f63d0..9d3e6cdbf0dbfbbf9ec038d5b6934353a0f4ca3e 100644
--- a/lib/compiler/implementation/scanner/parser.dart
+++ b/lib/compiler/implementation/scanner/parser.dart
@@ -1053,6 +1053,8 @@ class Parser {
return parseBreakStatement(token);
} else if (value === 'continue') {
return parseContinueStatement(token);
+ } else if (value === 'assert') {
+ return parseAssertStatement(token);
} else if (value === ';') {
return parseEmptyStatement(token);
} else if (value === 'const') {
@@ -2047,6 +2049,14 @@ class Parser {
return expectSemicolon(token);
}
+ Token parseAssertStatement(Token token) {
+ Token assertKeyword = token;
+ token = expect('assert', token);
+ token = parseParenthesizedExpression(token);
ahe 2012/10/10 08:44:13 Rather than parsing a parenthesized expression her
aam-me 2012/10/11 05:35:25 Done.
+ listener.handleAssertStatement(assertKeyword, token);
+ return expectSemicolon(token);
+ }
+
Token parseEmptyStatement(Token token) {
listener.handleEmptyStatement(token);
return expectSemicolon(token);

Powered by Google App Engine
This is Rietveld 408576698