| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 function native_ArrayFactory__new(typeToken, length) { | |
| 6 return RTT.setTypeInfo( | |
| 7 new Array(length), | |
| 8 Array.$lookupRTT(RTT.getTypeInfo(typeToken).typeArgs)); | |
| 9 } | |
| 10 | |
| 11 function native_ListFactory__new(typeToken, length) { | 5 function native_ListFactory__new(typeToken, length) { |
| 12 return RTT.setTypeInfo( | 6 return RTT.setTypeInfo( |
| 13 new Array(length), | 7 new Array(length), |
| 14 Array.$lookupRTT(RTT.getTypeInfo(typeToken).typeArgs)); | 8 Array.$lookupRTT(RTT.getTypeInfo(typeToken).typeArgs)); |
| 15 } | 9 } |
| 16 | 10 |
| 17 function native_ObjectArray__indexOperator(index) { | 11 function native_ListImplementation__indexOperator(index) { |
| 18 return this[index]; | 12 return this[index]; |
| 19 } | 13 } |
| 20 | 14 |
| 21 function native_ObjectArray__indexAssignOperator(index, value) { | 15 function native_ListImplementation__indexAssignOperator(index, value) { |
| 22 this[index] = value; | 16 this[index] = value; |
| 23 } | 17 } |
| 24 | 18 |
| 25 function native_ObjectArray_get$length() { | 19 function native_ListImplementation_get$length() { |
| 26 return this.length; | 20 return this.length; |
| 27 } | 21 } |
| 28 | 22 |
| 29 function native_ObjectArray__setLength(length) { | 23 function native_ListImplementation__setLength(length) { |
| 30 this.length = length; | 24 this.length = length; |
| 31 } | 25 } |
| 32 | 26 |
| 33 function native_ObjectArray__add(element) { | 27 function native_ListImplementation__add(element) { |
| 34 this.push(element); | 28 this.push(element); |
| 35 } | 29 } |
| 36 | 30 |
| 37 function $inlineArrayIndexCheck(array, index) { | 31 function $inlineArrayIndexCheck(array, index) { |
| 38 if (index >= 0 && index < array.length) { | 32 if (index >= 0 && index < array.length) { |
| 39 return index; | 33 return index; |
| 40 } | 34 } |
| 41 native__ArrayJsUtil__throwIndexOutOfRangeException(index); | 35 native__ArrayJsUtil__throwIndexOutOfRangeException(index); |
| 42 } | 36 } |
| 43 | 37 |
| 44 function native_ObjectArray__removeRange(start, length) { | 38 function native_ListImplementation__removeRange(start, length) { |
| 45 this.splice(start, length); | 39 this.splice(start, length); |
| 46 } | 40 } |
| 47 | 41 |
| 48 function native_ObjectArray__insertRange(start, length, initialValue) { | 42 function native_ListImplementation__insertRange(start, length, initialValue) { |
| 49 var array = [start, 0]; | 43 var array = [start, 0]; |
| 50 for (var i = 0; i < length; i++){ | 44 for (var i = 0; i < length; i++){ |
| 51 array.push(initialValue); | 45 array.push(initialValue); |
| 52 } | 46 } |
| 53 this.splice.apply(this, array); | 47 this.splice.apply(this, array); |
| 54 } | 48 } |
| OLD | NEW |