| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 @patch | 260 @patch |
| 261 factory List.from(Iterable elements, { bool growable: true }) { | 261 factory List.from(Iterable elements, { bool growable: true }) { |
| 262 List<E> list = new List<E>(); | 262 List<E> list = new List<E>(); |
| 263 for (var e in elements) { | 263 for (var e in elements) { |
| 264 list.add(e); | 264 list.add(e); |
| 265 } | 265 } |
| 266 if (growable) return list; | 266 if (growable) return list; |
| 267 return makeListFixedLength(list); | 267 return makeListFixedLength(list); |
| 268 } | 268 } |
| 269 |
| 270 @patch |
| 271 factory List.unmodifiable(Iterable elements) { |
| 272 List result = new List<E>.from(elements, growable: false); |
| 273 return makeFixedListUnmodifiable(result); |
| 274 } |
| 269 } | 275 } |
| 270 | 276 |
| 271 | 277 |
| 272 @patch | 278 @patch |
| 273 class String { | 279 class String { |
| 274 @patch | 280 @patch |
| 275 factory String.fromCharCodes(Iterable<int> charCodes, | 281 factory String.fromCharCodes(Iterable<int> charCodes, |
| 276 [int start = 0, int end]) { | 282 [int start = 0, int end]) { |
| 277 // If possible, recognize typed lists too. | 283 // If possible, recognize typed lists too. |
| 278 if (charCodes is! JSArray) { | 284 if (charCodes is! JSArray) { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 return getTraceFromException(error); | 471 return getTraceFromException(error); |
| 466 } | 472 } |
| 467 // Fallback if Error.captureStackTrace does not exist. | 473 // Fallback if Error.captureStackTrace does not exist. |
| 468 try { | 474 try { |
| 469 throw ''; | 475 throw ''; |
| 470 } catch (_, stackTrace) { | 476 } catch (_, stackTrace) { |
| 471 return stackTrace; | 477 return stackTrace; |
| 472 } | 478 } |
| 473 } | 479 } |
| 474 } | 480 } |
| OLD | NEW |