| 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 // Patch file for dart:core classes. | 5 // Patch file for dart:core classes. |
| 6 import "dart:_internal" as _symbol_dev; | 6 import "dart:_internal" as _symbol_dev; |
| 7 import 'dart:_interceptors'; | 7 import 'dart:_interceptors'; |
| 8 import 'dart:_js_helper' show patch, | 8 import 'dart:_js_helper' show patch, |
| 9 checkInt, | 9 checkInt, |
| 10 getRuntimeType, | 10 getRuntimeType, |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 JS('void', r'#.fixed$length = Array', list); | 261 JS('void', r'#.fixed$length = Array', list); |
| 262 } | 262 } |
| 263 // TODO(jmesserly): skip this when E is dynamic and Object. | 263 // TODO(jmesserly): skip this when E is dynamic and Object. |
| 264 JS('void', 'dart.setType(#, List\$(#))', list, E); | 264 JS('void', 'dart.setType(#, List\$(#))', list, E); |
| 265 // TODO(jmesserly): compiler creates a bogus type check here. | 265 // TODO(jmesserly): compiler creates a bogus type check here. |
| 266 return list; | 266 return list; |
| 267 } | 267 } |
| 268 | 268 |
| 269 @patch | 269 @patch |
| 270 factory List.filled(int length, E fill) { | 270 factory List.filled(int length, E fill) { |
| 271 List result = new List<E>(length); | 271 List<E> result = new List<E>(length); |
| 272 if (length != 0 && fill != null) { | 272 if (length != 0 && fill != null) { |
| 273 for (int i = 0; i < result.length; i++) { | 273 for (int i = 0; i < result.length; i++) { |
| 274 result[i] = fill; | 274 result[i] = fill; |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 return result; | 277 return result; |
| 278 } | 278 } |
| 279 | 279 |
| 280 @patch | 280 @patch |
| 281 factory List.from(Iterable elements, { bool growable: true }) { | 281 factory List.from(Iterable elements, { bool growable: true }) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 @patch | 466 @patch |
| 467 static bool get _isWindows => false; | 467 static bool get _isWindows => false; |
| 468 | 468 |
| 469 @patch | 469 @patch |
| 470 static Uri get base { | 470 static Uri get base { |
| 471 String uri = Primitives.currentUri(); | 471 String uri = Primitives.currentUri(); |
| 472 if (uri != null) return Uri.parse(uri); | 472 if (uri != null) return Uri.parse(uri); |
| 473 throw new UnsupportedError("'Uri.base' is not supported"); | 473 throw new UnsupportedError("'Uri.base' is not supported"); |
| 474 } | 474 } |
| 475 } | 475 } |
| OLD | NEW |