| OLD | NEW |
| 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 part of html; | 5 part of html; |
| 6 | 6 |
| 7 class _Utils { | 7 class _Utils { |
| 8 static List convertToList(List list) { | 8 static List convertToList(List list) { |
| 9 // FIXME: [possible optimization]: do not copy the array if Dart_IsArray is
fine w/ it. | 9 // FIXME: [possible optimization]: do not copy the array if Dart_IsArray is
fine w/ it. |
| 10 final length = list.length; | 10 final length = list.length; |
| 11 List result = new List.fixedLength(length); | 11 List result = new List(length); |
| 12 result.setRange(0, length, list); | 12 result.setRange(0, length, list); |
| 13 return result; | 13 return result; |
| 14 } | 14 } |
| 15 | 15 |
| 16 static List convertMapToList(Map map) { | 16 static List convertMapToList(Map map) { |
| 17 List result = []; | 17 List result = []; |
| 18 map.forEach((k, v) => result.addAll([k, v])); | 18 map.forEach((k, v) => result.addAll([k, v])); |
| 19 return result; | 19 return result; |
| 20 } | 20 } |
| 21 | 21 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 bool get isEmpty => Maps.isEmpty(this); | 107 bool get isEmpty => Maps.isEmpty(this); |
| 108 } | 108 } |
| 109 | 109 |
| 110 get _printClosure => (s) { | 110 get _printClosure => (s) { |
| 111 try { | 111 try { |
| 112 window.console.log(s); | 112 window.console.log(s); |
| 113 } catch (_) { | 113 } catch (_) { |
| 114 _Utils.print(s); | 114 _Utils.print(s); |
| 115 } | 115 } |
| 116 }; | 116 }; |
| OLD | NEW |