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

Side by Side Diff: dart/frog/leg/lib/js_helper.dart

Issue 9417031: Mock up all remaining core library implementation classes. (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
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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 static List newList(int length) { 331 static List newList(int length) {
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
342 static brokenDownDateToSecondsSinceEpoch(
343 int years, int month, int day, int hours, int minutes, int seconds,
344 bool isUtc) {
345 throw 'Primitives.brokenDownDateToSecondsSinceEpoch is not implemented';
346 }
347
348 static int getCurrentMs() {
349 throw 'Primitives.getCurrentMs is not implemented';
350 }
351
352 static int getYear(int secondsSinceEpoch, bool isUtc) {
353 throw 'Primitives.getYear is not implemented';
354 }
355
356 static int getMonth(int secondsSinceEpoch, bool isUtc) {
357 throw 'Primitives.getMonth is not implemented';
358 }
359
360 static int getDay_(int secondsSinceEpoch, bool isUtc);
361
362 static int getHours(int secondsSinceEpoch, bool isUtc) {
363 throw 'Primitives.getHours is not implemented';
364 }
365
366 static int getMinutes(int secondsSinceEpoch, bool isUtc) {
367 throw 'Primitives.getMinutes is not implemented';
368 }
369
370 static int getSeconds(int secondsSinceEpoch, bool isUtc) {
371 throw 'Primitives.getSeconds is not implemented';
372 }
341 } 373 }
342 374
343 builtin$compareTo$1(a, b) { 375 builtin$compareTo$1(a, b) {
344 if (checkNumbers(a, b, 'illegal argument')) { 376 if (checkNumbers(a, b, 'illegal argument')) {
345 if (a < b) { 377 if (a < b) {
346 return -1; 378 return -1;
347 } else if (a > b) { 379 } else if (a > b) {
348 return 1; 380 return 1;
349 } else if (a == b) { 381 } else if (a == b) {
350 if (a == 0) { 382 if (a == 0) {
(...skipping 11 matching lines...) Expand all
362 return 1; 394 return 1;
363 } else { 395 } else {
364 return -1; 396 return -1;
365 } 397 }
366 } else if (a is String) { 398 } else if (a is String) {
367 throw 'String.compareTo is not implemented'; 399 throw 'String.compareTo is not implemented';
368 } else { 400 } else {
369 return UNINTERCEPTED(a.compareTo(b)); 401 return UNINTERCEPTED(a.compareTo(b));
370 } 402 }
371 } 403 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698