Initializing [[FormalParameters]] internal property of Function object in ecma_op_create_function_object.

This commit is contained in:
Ruben Ayrapetyan
2014-08-13 21:47:56 +04:00
parent daf1cfc9e6
commit 63133c247f
3 changed files with 22 additions and 6 deletions
+9 -1
View File
@@ -395,7 +395,6 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */
{
case ECMA_INTERNAL_PROPERTY_NUMBER_INDEXED_ARRAY_VALUES: /* a collection */
case ECMA_INTERNAL_PROPERTY_STRING_INDEXED_ARRAY_VALUES: /* a collection */
case ECMA_INTERNAL_PROPERTY_FORMAL_PARAMETERS: /* a collection */
{
TODO (/* Free collection's elements */);
JERRY_UNIMPLEMENTED();
@@ -404,6 +403,15 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */
break;
}
case ECMA_INTERNAL_PROPERTY_FORMAL_PARAMETERS: /* a strings' collection */
{
if (property_value != ECMA_NULL_POINTER)
{
ecma_free_strings_collection (ECMA_GET_POINTER(property_value));
}
break;
}
case ECMA_INTERNAL_PROPERTY_SCOPE: /* a lexical environment */
case ECMA_INTERNAL_PROPERTY_BINDING_OBJECT: /* an object */
case ECMA_INTERNAL_PROPERTY_PROTOTYPE: /* the property's value is located in ecma_object_t */
+11 -3
View File
@@ -108,8 +108,8 @@ ecma_op_is_callable (ecma_value_t value) /**< ecma-value */
* @return pointer to newly created Function object
*/
ecma_object_t*
ecma_op_create_function_object (const ecma_char_t* formal_parameter_list_p[], /**< formal parameters list */
uint32_t formal_parameters_number, /**< formal parameters list's length */
ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< formal parameters list */
ecma_length_t formal_parameters_number, /**< formal parameters list's length */
ecma_object_t *scope_p, /**< function's scope */
bool is_strict, /**< 'strict' flag */
opcode_counter_t first_opcode_idx) /**< index of first opcode of function's body */
@@ -137,9 +137,17 @@ ecma_op_create_function_object (const ecma_char_t* formal_parameter_list_p[], /*
ecma_gc_update_may_ref_younger_object_flag_by_object (f, scope_p);
// 10., 11.
ecma_property_t *formal_parameters_prop_p = ecma_create_internal_property (f,
ECMA_INTERNAL_PROPERTY_FORMAL_PARAMETERS);
if (formal_parameters_number != 0)
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(formal_parameter_list_p);
ecma_collection_header_t *formal_parameters_collection_p = ecma_new_strings_collection (formal_parameter_list_p,
formal_parameters_number);
ECMA_SET_POINTER (formal_parameters_prop_p->u.internal_property.value, formal_parameters_collection_p);
}
else
{
JERRY_ASSERT (formal_parameters_prop_p->u.internal_property.value == ECMA_NULL_POINTER);
}
// 12.
+2 -2
View File
@@ -29,8 +29,8 @@
extern bool ecma_op_is_callable (ecma_value_t value);
extern ecma_object_t*
ecma_op_create_function_object (const ecma_char_t* formal_parameter_list_p[],
uint32_t formal_parameters_number,
ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[],
ecma_length_t formal_parameters_number,
ecma_object_t *scope_p,
bool is_strict,
opcode_counter_t first_opcode_idx);