1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use crate::js::function::NativeFunctionData;
use crate::js::value::{to_value, ResultValue, Value, ValueData};
use gc::Gc;
pub fn make_array(this: Value, _: Value, _: Vec<Value>) -> ResultValue {
let this_ptr = this.clone();
this_ptr.set_field_slice("length", to_value(0i32));
Ok(Gc::new(ValueData::Undefined))
}
pub fn _create() -> Value {
let array = to_value(make_array as NativeFunctionData);
array
}
pub fn init(global: &Value) {
global.set_field_slice("Array", _create());
}