Files
sdk/compiler/lib/implementation/array.js
T
mmendez@google.com 6dfce3cc04 Revert "Remove TypeToken as means for assigning type arguments to arrays."
This reverts commit r3356.  Apparently closure will optimize new Array(x) to Array(void 0).

Review URL: https://chromiumcodereview.appspot.com//9178020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3360 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-17 15:34:53 +00:00

49 lines
1.3 KiB
JavaScript

// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
function native_ListFactory__new(typeToken, length) {
return RTT.setTypeInfo(
new Array(length),
Array.$lookupRTT(RTT.getTypeInfo(typeToken).typeArgs));
}
function native_ListImplementation__indexOperator(index) {
return this[index];
}
function native_ListImplementation__indexAssignOperator(index, value) {
this[index] = value;
}
function native_ListImplementation_get$length() {
return this.length;
}
function native_ListImplementation__setLength(length) {
this.length = length;
}
function native_ListImplementation__add(element) {
this.push(element);
}
function $inlineArrayIndexCheck(array, index) {
if (index >= 0 && index < array.length) {
return index;
}
native__ListJsUtil__throwIndexOutOfRangeException(index);
}
function native_ListImplementation__removeRange(start, length) {
this.splice(start, length);
}
function native_ListImplementation__insertRange(start, length, initialValue) {
var array = [start, 0];
for (var i = 0; i < length; i++){
array.push(initialValue);
}
this.splice.apply(this, array);
}