From c7eec63e2809b04efecd47a8b6309ce9fbe4b0ac Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Wed, 15 Oct 2014 19:31:30 +0400 Subject: [PATCH] Fixing array instance construction routine: setting prototype to Array.prototype built-in object. --- src/libecmaoperations/ecma-array-object.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libecmaoperations/ecma-array-object.c b/src/libecmaoperations/ecma-array-object.c index c2f26c543..0cd17e0b9 100644 --- a/src/libecmaoperations/ecma-array-object.c +++ b/src/libecmaoperations/ecma-array-object.c @@ -15,7 +15,9 @@ #include "ecma-alloc.h" #include "ecma-array-object.h" +#include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-number-arithmetic.h" @@ -99,8 +101,9 @@ ecma_op_create_array_object (ecma_value_t *arguments_list_p, /**< list of argume array_items_count = arguments_list_len; } - FIXME (/* Set prototype to built-in Array prototype (15.4.3.1) */); - ecma_object_t *obj_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_ARRAY); + ecma_object_t *array_prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE); + ecma_object_t *obj_p = ecma_create_object (array_prototype_obj_p, true, ECMA_OBJECT_TYPE_ARRAY); + ecma_deref_object (array_prototype_obj_p); ecma_property_t *class_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS); class_prop_p->u.internal_property.value = ECMA_MAGIC_STRING_ARRAY_UL;