| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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("dart:core"); | 5 #library("dart:core"); |
| 6 #import("dart:coreimpl"); | 6 #import("dart:coreimpl"); |
| 7 | 7 |
| 8 // TODO(jimhug): Better way to map in standard corelib | 8 // TODO(jimhug): Better way to map in standard corelib |
| 9 #source("../../corelib/src/bool.dart"); | 9 #source("../../corelib/src/bool.dart"); |
| 10 #source("../../corelib/src/collection.dart"); | 10 #source("../../corelib/src/collection.dart"); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 /** | 44 /** |
| 45 * The class [Clock] provides access to a monotonically incrementing clock | 45 * The class [Clock] provides access to a monotonically incrementing clock |
| 46 * device. | 46 * device. |
| 47 */ | 47 */ |
| 48 class Clock { | 48 class Clock { |
| 49 /** Returns the current clock tick. */ | 49 /** Returns the current clock tick. */ |
| 50 static int now() native 'return new Date().getTime();'; | 50 static int now() native 'return new Date().getTime();'; |
| 51 | 51 |
| 52 /** Returns the frequency of clock ticks in Hz. */ | 52 /** Returns the frequency of clock ticks in Hz. */ |
| 53 // TODO(jimhug): Why isn't this a property? | 53 // TODO(jimhug): Why isn't this a property? |
| 54 static int frequency() native 'return 1000;'; | 54 static int frequency() => 1000; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void print(Object obj) native '''if (typeof console == 'object') { | 57 // TODO(jmesserly): this is working around a name conflict with "window.print". |
| 58 void print(Object obj) => _print(obj); |
| 59 void _print(Object obj) native '''if (typeof console == 'object') { |
| 58 if (obj) obj = obj.toString(); | 60 if (obj) obj = obj.toString(); |
| 59 console.log(obj); | 61 console.log(obj); |
| 60 } else { | 62 } else { |
| 61 write(obj); | 63 write(obj); |
| 62 write('\n'); | 64 write('\n'); |
| 63 }''' { | 65 }''' { |
| 64 // ensure toString is generated | 66 // ensure toString is generated |
| 65 obj.toString(); | 67 obj.toString(); |
| 66 } | 68 } |
| 67 | 69 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 String toString() native; | 119 String toString() native; |
| 118 | 120 |
| 119 // TODO(jmesserly): optimize this. No need to call it. | 121 // TODO(jmesserly): optimize this. No need to call it. |
| 120 get dynamic() => this; | 122 get dynamic() => this; |
| 121 | 123 |
| 122 // TODO(jmesserly): add named args. For now stay compatible with the VM. | 124 // TODO(jmesserly): add named args. For now stay compatible with the VM. |
| 123 noSuchMethod(String name, List args) { | 125 noSuchMethod(String name, List args) { |
| 124 throw new NoSuchMethodException(this, name, args); | 126 throw new NoSuchMethodException(this, name, args); |
| 125 } | 127 } |
| 126 } | 128 } |
| OLD | NEW |