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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/frog/leg/lib/core.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library('js_helper'); 5 #library('js_helper');
6 6
7 $throw(String msg) { 7 $throw(String msg) {
8 var e = JS("Object", @"new Error($0)", msg); 8 var e = JS("Object", @"new Error($0)", msg);
9 var hasTrace = JS("bool", @"Error.captureStackTrace !== (void 0)"); 9 var hasTrace = JS("bool", @"Error.captureStackTrace !== (void 0)");
10 if (hasTrace) { 10 if (hasTrace) {
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if (length == null) return JS("Object", @"new Array()"); 332 if (length == null) return JS("Object", @"new Array()");
333 if (!(length is int)) throw "Invalid argument"; 333 if (!(length is int)) throw "Invalid argument";
334 if (length < 0) throw "Negative size"; 334 if (length < 0) throw "Negative size";
335 return JS("Object", @"new Array($0)", length); 335 return JS("Object", @"new Array($0)", length);
336 } 336 }
337 337
338 static num dateNow() => JS("num", @"Date.now()"); 338 static num dateNow() => JS("num", @"Date.now()");
339 339
340 static num mathFloor(num value) => JS("num", @"Math.floor($0)", value); 340 static num mathFloor(num value) => JS("num", @"Math.floor($0)", value);
341 } 341 }
342
343 builtin$compareTo$1(a, b) {
344 if (checkNumbers(a, b, 'illegal argument')) {
345 if (a < b) {
346 return -1;
347 } else if (a > b) {
348 return 1;
349 } else if (a == b) {
350 if (a == 0) {
351 bool aIsNegative = a.isNegative();
352 bool bIsNegative = b.isNegative();
353 if (aIsNegative == bIsNegative) return 0;
354 if (aIsNegative) return -1;
355 return 1;
356 }
357 return 0;
358 } else if (a.isNaN()) {
359 if (b.isNaN()) {
360 return 0;
361 }
362 return 1;
363 } else {
364 return -1;
365 }
366 } else if (a is String) {
367 throw 'String.compareTo is not implemented';
368 } else {
369 return UNINTERCEPTED(a.compareTo(b));
370 }
371 }
OLDNEW
« 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