as_array::as_array(player* player) : as_object(player) { // this->set_member("join", &array_not_impl); // this->set_member("concat", &array_not_impl); // this->set_member("slice", &array_not_impl); // this->set_member("unshift", &array_not_impl); // this->set_member("shift", &array_not_impl); // this->set_member("splice", &array_not_impl); // this->set_member("sort", &array_not_impl); // this->set_member("sortOn", &array_not_impl); // this->set_member("reverse", &array_not_impl); builtin_member("toString", as_array_tostring); builtin_member("push", as_array_push); builtin_member("pop", as_array_pop); builtin_member("length", as_value(as_array_length, NULL)); set_ctor(as_global_array_ctor); }
as_object* as_object::create_proto(const as_value& constructor) { m_proto = new as_object(get_player()); m_proto->m_this_ptr = m_this_ptr; if (constructor.to_object()) { // constructor is as_s_function as_value val; constructor.to_object()->get_member("prototype", &val); as_object* prototype = val.to_object(); assert(prototype); prototype->copy_to(this); as_value prototype_constructor; if (prototype->get_ctor(&prototype_constructor)) { m_proto->set_ctor(prototype_constructor); } } set_ctor(constructor); return m_proto.get_ptr(); }