Index: sdk/lib/_internal/compiler/js_lib/js_number.dart |
diff --git a/sdk/lib/_internal/compiler/js_lib/js_number.dart b/sdk/lib/_internal/compiler/js_lib/js_number.dart |
index 8d7501e1e99a68e79cd5eaaad4c313a8cbeac4fd..fb13d38e5f7f2e9970a49e7cccf9afe84f7dedc3 100644 |
--- a/sdk/lib/_internal/compiler/js_lib/js_number.dart |
+++ b/sdk/lib/_internal/compiler/js_lib/js_number.dart |
@@ -504,14 +504,14 @@ class JSInt extends JSNumber implements int, double { |
if (m is! int) { |
throw new ArgumentError.value(m, "other", "not an integer"); |
} |
- if (this == 0) { |
- throw new ArgumentError.value(this, "first operand", "must not be zero"); |
- } |
- if (other == 0) { |
- throw new ArgumentError.value(this, "second operand", "must not be zero"); |
+ if (this == 0 && other == 0) { |
+ throw new ArgumentError.value(this, null, |
+ "at least one operand must not be zero"); |
} |
int x = this.abs(); |
int y = other.abs(); |
+ if (x == 0) return y; |
+ if (y == 0) return x; |
if ((x == 1) || (y == 1)) return 1; |
return _binaryGcd(x, y, false); |
} |