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

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

Issue 9404015: Use Expect from core library. (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 | « dart/frog/leg/lib/core.dart ('k') | 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 d62261518f5d03884656fcbe9451f64e0b9ba09d..714204052bfa979c84ee40e1ba1e3f0224d96a69 100644
--- a/dart/frog/leg/lib/js_helper.dart
+++ b/dart/frog/leg/lib/js_helper.dart
@@ -339,3 +339,33 @@ class Primitives {
static num mathFloor(num value) => JS("num", @"Math.floor($0)", value);
}
+
+builtin$compareTo$1(a, b) {
+ if (checkNumbers(a, b, 'illegal argument')) {
+ if (a < b) {
+ return -1;
+ } else if (a > b) {
+ return 1;
+ } else if (a == b) {
+ if (a == 0) {
+ bool aIsNegative = a.isNegative();
+ bool bIsNegative = b.isNegative();
+ if (aIsNegative == bIsNegative) return 0;
+ if (aIsNegative) return -1;
+ return 1;
+ }
+ return 0;
+ } else if (a.isNaN()) {
+ if (b.isNaN()) {
+ return 0;
+ }
+ return 1;
+ } else {
+ return -1;
+ }
+ } else if (a is String) {
+ throw 'String.compareTo is not implemented';
+ } else {
+ return UNINTERCEPTED(a.compareTo(b));
+ }
+}
« no previous file with comments | « dart/frog/leg/lib/core.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698