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

Unified Diff: frog/parser.dart

Issue 8463027: Optimize boolean asserts (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: co19 status Created 9 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: frog/parser.dart
diff --git a/frog/parser.dart b/frog/parser.dart
index b6dba8c0c018f6afed78448625348f499e550185..7c57cec3491e6019529871b7d4227c5073fbe209 100644
--- a/frog/parser.dart
+++ b/frog/parser.dart
@@ -848,7 +848,9 @@ class Parser {
var y = infixExpression(prec == 2 ? prec: prec+1);
if (op.kind == TokenKind.CONDITIONAL) {
_eat(TokenKind.COLON);
- var z = infixExpression(prec+1);
+ // Using prec for so "a ? b : c ? d : e" groups correctly as
+ // "a ? b : (c ? d : e)"
+ var z = infixExpression(prec);
x = new ConditionalExpression(x, y, z, _makeSpan(x.span.start));
} else {
x = new BinaryExpression(op, x, y, _makeSpan(x.span.start));
@@ -961,7 +963,7 @@ class Parser {
}
_boolTypeRef(SourceSpan span) {
- return new TypeReference(span, world.boolType);
+ return new TypeReference(span, world.nonNullBool);
}
_intTypeRef(SourceSpan span) {

Powered by Google App Engine
This is Rietveld 408576698