| 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 library _js_helper; | 5 library _js_helper; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:_foreign_helper' show DART_CLOSURE_TO_JS, | 8 import 'dart:_foreign_helper' show DART_CLOSURE_TO_JS, |
| 9 JS, | 9 JS, |
| 10 JS_CALL_IN_ISOLATE, | 10 JS_CALL_IN_ISOLATE, |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 554 |
| 555 /** | 555 /** |
| 556 * Called by generated code to throw an index-out-of-range exception, | 556 * Called by generated code to throw an index-out-of-range exception, |
| 557 * for example, if a bounds check fails in an optimized indexed | 557 * for example, if a bounds check fails in an optimized indexed |
| 558 * access. | 558 * access. |
| 559 */ | 559 */ |
| 560 ioore(index) { | 560 ioore(index) { |
| 561 throw new RangeError.value(index); | 561 throw new RangeError.value(index); |
| 562 } | 562 } |
| 563 | 563 |
| 564 listInsertRange(receiver, start, length, initialValue) { | |
| 565 if (length == 0) { | |
| 566 return; | |
| 567 } | |
| 568 if (length is !int) throw new ArgumentError(length); | |
| 569 if (length < 0) throw new ArgumentError(length); | |
| 570 if (start is !int) throw new ArgumentError(start); | |
| 571 | |
| 572 var receiverLength = JS('num', r'#.length', receiver); | |
| 573 if (start < 0 || start > receiverLength) { | |
| 574 throw new RangeError.value(start); | |
| 575 } | |
| 576 receiver.length = receiverLength + length; | |
| 577 Arrays.copy(receiver, | |
| 578 start, | |
| 579 receiver, | |
| 580 start + length, | |
| 581 receiverLength - start); | |
| 582 if (initialValue != null) { | |
| 583 for (int i = start; i < start + length; i++) { | |
| 584 receiver[i] = initialValue; | |
| 585 } | |
| 586 } | |
| 587 receiver.length = receiverLength + length; | |
| 588 } | |
| 589 | |
| 590 stringLastIndexOfUnchecked(receiver, element, start) | 564 stringLastIndexOfUnchecked(receiver, element, start) |
| 591 => JS('int', r'#.lastIndexOf(#, #)', receiver, element, start); | 565 => JS('int', r'#.lastIndexOf(#, #)', receiver, element, start); |
| 592 | 566 |
| 593 | 567 |
| 594 checkNull(object) { | 568 checkNull(object) { |
| 595 if (object == null) throw new ArgumentError(null); | 569 if (object == null) throw new ArgumentError(null); |
| 596 return object; | 570 return object; |
| 597 } | 571 } |
| 598 | 572 |
| 599 checkNum(value) { | 573 checkNum(value) { |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 // of [t]. | 1590 // of [t]. |
| 1617 if ((!isJsArray(s) && JS('bool', '# == null', substitution)) || | 1591 if ((!isJsArray(s) && JS('bool', '# == null', substitution)) || |
| 1618 !isJsArray(t)) { | 1592 !isJsArray(t)) { |
| 1619 return true; | 1593 return true; |
| 1620 } | 1594 } |
| 1621 // Recursively check the type arguments. | 1595 // Recursively check the type arguments. |
| 1622 return checkArguments(substitution, getArguments(s), getArguments(t)); | 1596 return checkArguments(substitution, getArguments(s), getArguments(t)); |
| 1623 } | 1597 } |
| 1624 | 1598 |
| 1625 createRuntimeType(String name) => new TypeImpl(name); | 1599 createRuntimeType(String name) => new TypeImpl(name); |
| OLD | NEW |