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

Unified Diff: frog/leg/operations.dart

Issue 9668046: Integer operations might not succeed (division by zero). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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
« no previous file with comments | « no previous file | tests/co19/co19-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/operations.dart
diff --git a/frog/leg/operations.dart b/frog/leg/operations.dart
index f241d2565a63924f9756dc6ce8f364f8f8ee7a1e..0f5ea51f6da5595c823b0b0c52191e0a2d913875 100644
--- a/frog/leg/operations.dart
+++ b/frog/leg/operations.dart
@@ -117,7 +117,8 @@ class ArithmeticNumOperation implements BinaryOperation {
} else {
foldedValue = foldNums(leftNum.value, rightNum.value);
}
- assert(foldedValue != null);
+ // A division by 0 means that we might not have a folded value.
+ if (foldedValue === null) return null;
if (left.isInt() && right.isInt() && !isDivide()) {
assert(foldedValue is int);
return new IntConstant(foldedValue);
« no previous file with comments | « no previous file | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698