| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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._js_helper; | 5 library dart._js_helper; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'dart:_foreign_helper' show | 9 import 'dart:_foreign_helper' show |
| 10 JS, | 10 JS, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 /// Returns the type of [object] as a string (including type arguments). | 169 /// Returns the type of [object] as a string (including type arguments). |
| 170 /// | 170 /// |
| 171 /// In minified mode, uses the unminified names if available. | 171 /// In minified mode, uses the unminified names if available. |
| 172 static String objectTypeName(Object object) { | 172 static String objectTypeName(Object object) { |
| 173 return getRuntimeType(object).toString(); | 173 return getRuntimeType(object).toString(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 /// In minified mode, uses the unminified names if available. | 176 /// In minified mode, uses the unminified names if available. |
| 177 static String objectToString(Object object) { | 177 static String objectToString(Object object) { |
| 178 // String name = objectTypeName(object); | 178 // String name = objectTypeName(object); |
| 179 String name = JS('String', 'dart.typeName(dart.realRuntimeType(#))', object)
; | 179 String name = JS('String', 'dart.typeName(dart.getReifiedType(#))', object); |
| 180 return "Instance of '$name'"; | 180 return "Instance of '$name'"; |
| 181 } | 181 } |
| 182 | 182 |
| 183 static int dateNow() => JS('int', r'Date.now()'); | 183 static int dateNow() => JS('int', r'Date.now()'); |
| 184 | 184 |
| 185 static void initTicker() { | 185 static void initTicker() { |
| 186 if (timerFrequency != null) return; | 186 if (timerFrequency != null) return; |
| 187 // Start with low-resolution. We overwrite the fields if we find better. | 187 // Start with low-resolution. We overwrite the fields if we find better. |
| 188 timerFrequency = 1000; | 188 timerFrequency = 1000; |
| 189 timerTicks = dateNow; | 189 timerTicks = dateNow; |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 | 788 |
| 789 SyncIterable(this._generator, this._args); | 789 SyncIterable(this._generator, this._args); |
| 790 | 790 |
| 791 // TODO(jmesserly): this should be [Symbol.iterator]() method. Unfortunately | 791 // TODO(jmesserly): this should be [Symbol.iterator]() method. Unfortunately |
| 792 // we have no way of telling the compiler yet, so it will generate an extra | 792 // we have no way of telling the compiler yet, so it will generate an extra |
| 793 // layer of indirection that wraps the SyncIterator. | 793 // layer of indirection that wraps the SyncIterator. |
| 794 _jsIterator() => JS('', '#(...#)', _generator, _args); | 794 _jsIterator() => JS('', '#(...#)', _generator, _args); |
| 795 | 795 |
| 796 Iterator<E> get iterator => new SyncIterator<E>(_jsIterator()); | 796 Iterator<E> get iterator => new SyncIterator<E>(_jsIterator()); |
| 797 } | 797 } |
| OLD | NEW |