|
@@ -35,6 +35,18 @@ namespace JS {
|
|
|
|
|
|
ArrayPrototype::ArrayPrototype()
|
|
ArrayPrototype::ArrayPrototype()
|
|
{
|
|
{
|
|
|
|
+ put_native_function("shift", [](Object* this_object, const Vector<Value>&) -> Value {
|
|
|
|
+ ASSERT(this_object);
|
|
|
|
+ ASSERT(this_object->is_array());
|
|
|
|
+ return static_cast<Array*>(this_object)->shift();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ put_native_function("pop", [](Object* this_object, const Vector<Value>&) -> Value {
|
|
|
|
+ ASSERT(this_object);
|
|
|
|
+ ASSERT(this_object->is_array());
|
|
|
|
+ return static_cast<Array*>(this_object)->pop();
|
|
|
|
+ });
|
|
|
|
+
|
|
put_native_function("push", [](Object* this_object, const Vector<Value>& arguments) -> Value {
|
|
put_native_function("push", [](Object* this_object, const Vector<Value>& arguments) -> Value {
|
|
if (arguments.is_empty())
|
|
if (arguments.is_empty())
|
|
return js_undefined();
|
|
return js_undefined();
|