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

Unified Diff: dart/frog/leg/lib/js_helper.dart

Issue 9422026: Pass all co19 int tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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 | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/lib/js_helper.dart
diff --git a/dart/frog/leg/lib/js_helper.dart b/dart/frog/leg/lib/js_helper.dart
index f8454bf59030c9cc15a453c38cb8af38add8e1f7..8223235978705412bc65bca432523af4e33db418 100644
--- a/dart/frog/leg/lib/js_helper.dart
+++ b/dart/frog/leg/lib/js_helper.dart
@@ -82,6 +82,7 @@ mod(var a, var b) {
tdiv(var a, var b) {
if (checkNumbers(a, b, "num~/ expects a number as second operand.")) {
+ if (b === 0) throw new IntegerDivisionByZeroException();
return (a / b).truncate();
}
return UNINTERCEPTED(a ~/ b);
@@ -677,6 +678,7 @@ builtin$isNaN$0(receiver) {
builtin$remainder$1(a, b) {
checkNull(a);
if (checkNumbers(a, b, "num.remainder expects a number as second operand.")) {
+ if (b === 0) throw new IntegerDivisionByZeroException();
return JS("num", @"$0 % $1", a, b);
} else {
return UNINTERCEPTED(a.remainder(b));
@@ -758,10 +760,41 @@ builtin$toStringAsFixed$1(receiver, fractionDigits) {
if (receiver is !num) {
return UNINTERCEPTED(receiver.toStringAsFixed(fractionDigits));
}
+ checkNum(fractionDigits);
return JS("String", @"$0.toFixed($1)", receiver, fractionDigits);
}
+builtin$toStringAsExponential$1(receiver, fractionDigits) {
+ checkNull(receiver);
ngeoffray 2012/02/21 12:20:30 No need for these check null.
+ if (receiver is !num) {
+ return UNINTERCEPTED(receiver.toStringAsExponential(fractionDigits));
+ }
+ checkNum(fractionDigits);
+
+ return JS("String", @"$0.toExponential($1)", receiver, fractionDigits);
+}
+
+builtin$toStringAsPrecision$1(receiver, fractionDigits) {
+ checkNull(receiver);
+ if (receiver is !num) {
+ return UNINTERCEPTED(receiver.toStringAsPrecision(fractionDigits));
+ }
+ checkNum(fractionDigits);
+
+ return JS("String", @"$0.toPrecision($1)", receiver, fractionDigits);
+}
+
+builtin$toRadixString$1(receiver, radix) {
+ checkNull(receiver);
+ if (receiver is !num) {
+ return UNINTERCEPTED(receiver.toRadixString(radix));
+ }
+ checkNum(radix);
+
+ return JS("String", @"$0.toString($1)", receiver, radix);
+}
+
builtin$allMatches$1(receiver, str) {
checkNull(receiver);
if (receiver is !String) return UNINTERCEPTED(receiver.allMatches(str));
@@ -913,3 +946,14 @@ class MathNatives {
static double random() => JS("double", "Math.random()");
}
+
+builtin$hashCode$0(receiver) {
+ if (receiver is num) return receiver & 0x1FFFFFFF;
+ if (receiver is String) {
+ throw new NotImplementedException();
+ }
+ if (isJSArray(receiver)) {
+ throw new NotImplementedException();
+ }
+ return UNINTERCEPTED(receiver.hashCode());
+}
« no previous file with comments | « no previous file | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698