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' | 8 import 'dart:_js_helper' |
9 show | 9 show |
10 patch, | 10 patch, |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 list = JS('', '[]'); | 325 list = JS('', '[]'); |
326 } else { | 326 } else { |
327 // Explicit type test is necessary to guard against JavaScript conversions | 327 // Explicit type test is necessary to guard against JavaScript conversions |
328 // in unchecked mode. | 328 // in unchecked mode. |
329 if ((length is! int) || (length < 0)) { | 329 if ((length is! int) || (length < 0)) { |
330 throw new ArgumentError( | 330 throw new ArgumentError( |
331 "Length must be a non-negative integer: $length"); | 331 "Length must be a non-negative integer: $length"); |
332 } | 332 } |
333 list = JSArray.markFixedList(JS('', 'new Array(#)', length)); | 333 list = JSArray.markFixedList(JS('', 'new Array(#)', length)); |
334 } | 334 } |
335 return new JSArray<E>.typed(list); | 335 return new JSArray<E>.of(list); |
336 } | 336 } |
337 | 337 |
338 @patch | 338 @patch |
339 factory List.filled(int length, E fill, {bool growable: true}) { | 339 factory List.filled(int length, E fill, {bool growable: true}) { |
340 List<E> result = new List<E>(length); | 340 List<E> result = new List<E>(length); |
341 if (length != 0 && fill != null) { | 341 if (length != 0 && fill != null) { |
342 for (int i = 0; i < result.length; i++) { | 342 for (int i = 0; i < result.length; i++) { |
343 result[i] = fill; | 343 result[i] = fill; |
344 } | 344 } |
345 } | 345 } |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 static StackTrace get current { | 656 static StackTrace get current { |
657 return getTraceFromException(JS('', 'new Error()')); | 657 return getTraceFromException(JS('', 'new Error()')); |
658 } | 658 } |
659 } | 659 } |
660 | 660 |
661 @patch | 661 @patch |
662 class _ConstantExpressionError { | 662 class _ConstantExpressionError { |
663 @patch | 663 @patch |
664 _throw(error) => throw error; | 664 _throw(error) => throw error; |
665 } | 665 } |
OLD | NEW |