Implementing stubs for ecma objects' common internal properties and methods (ECMA-262 v5, Table 8).

This commit is contained in:
Ruben Ayrapetyan
2014-07-28 18:14:24 +04:00
parent d927d3e320
commit cae07c0832
5 changed files with 252 additions and 5 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ ecma_op_check_object_coercible( ecma_value_t value) /**< ecma-value */
*/
ecma_completion_value_t
ecma_op_to_primitive( ecma_value_t value, /**< ecma-value */
ecma_preferred_type_hint preferred_type) /**< preferred type hint */
ecma_preferred_type_hint_t preferred_type) /**< preferred type hint */
{
switch ( (ecma_type_t)value.value_type )
{
+2 -2
View File
@@ -38,10 +38,10 @@ typedef enum
ECMA_PREFERRED_TYPE_BOOLEAN, /**< Boolean */
ECMA_PREFERRED_TYPE_NUMBER, /**< Number */
ECMA_PREFERRED_TYPE_STRING /**< String */
} ecma_preferred_type_hint;
} ecma_preferred_type_hint_t;
extern ecma_completion_value_t ecma_op_check_object_coercible( ecma_value_t value);
extern ecma_completion_value_t ecma_op_to_primitive( ecma_value_t value, ecma_preferred_type_hint preferred_type);
extern ecma_completion_value_t ecma_op_to_primitive( ecma_value_t value, ecma_preferred_type_hint_t preferred_type);
extern ecma_completion_value_t ecma_op_to_boolean( ecma_value_t value);
extern ecma_completion_value_t ecma_op_to_number( ecma_value_t value);
extern ecma_completion_value_t ecma_op_to_object( ecma_value_t value);
@@ -0,0 +1,178 @@
/* Copyright 2014 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-globals.h"
#include "ecma-objects-properties.h"
/** \addtogroup ecma ---TODO---
* @{
*
* \addtogroup ecmaobjectsinternalops ECMA objects' operations
* @{
*/
/**
* [[Get]] ecma object's operation
*
* See also:
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_object_get( ecma_object_t *obj_p, /**< the object */
ecma_array_first_chunk_t *property_name_p) /**< property name */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( obj_p, property_name_p);
} /* ecma_op_object_get */
/**
* [[GetOwnProperty]] ecma object's operation
*
* See also:
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
*
* @return pointer to a property - if it exists,
* NULL - otherwise.
*/
ecma_property_t*
ecma_op_object_get_own_property( ecma_object_t *obj_p, /**< the object */
ecma_array_first_chunk_t *property_name_p) /**< property name */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( obj_p, property_name_p);
} /* ecma_op_object_get_own_property */
/**
* [[GetProperty]] ecma object's operation
*
* See also:
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
*
* @return pointer to a property - if it exists,
* NULL - otherwise.
*/
ecma_property_t*
ecma_op_object_get_property( ecma_object_t *obj_p, /**< the object */
ecma_array_first_chunk_t *property_name_p) /**< property name */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( obj_p, property_name_p);
} /* ecma_op_object_get_property */
/**
* [[Put]] ecma object's operation
*
* See also:
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_object_put( ecma_object_t *obj_p, /**< the object */
ecma_array_first_chunk_t *property_name_p, /**< property name */
ecma_value_t value, /**< ecma-value */
bool is_throw) /**< flag that controls failure handling */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( obj_p, property_name_p, value, is_throw);
} /* ecma_op_object_put */
/**
* [[CanPut]] ecma object's operation
*
* See also:
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
*
* @return true - if [[Put]] with the given property name can be performed;
* false - otherwise.
*/
bool
ecma_op_object_can_put( ecma_object_t *obj_p, /**< the object */
ecma_array_first_chunk_t *property_name_p) /**< property name */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( obj_p, property_name_p);
} /* ecma_op_object_can_put */
/**
* [[HasProperty]] ecma object's operation
*
* See also:
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
*
* @return true - if the object already has a property with the given property name;
* false - otherwise.
*/
bool
ecma_op_object_has_property( ecma_object_t *obj_p, /**< the object */
ecma_array_first_chunk_t *property_name_p) /**< property name */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( obj_p, property_name_p);
} /* ecma_op_object_has_property */
/**
* [[Delete]] ecma object's operation
*
* See also:
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_object_delete( ecma_object_t *obj_p, /**< the object */
ecma_array_first_chunk_t *property_name_p, /**< property name */
bool is_throw) /**< flag that controls failure handling */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( obj_p, property_name_p, is_throw);
} /* ecma_op_object_delete */
/**
* [[DefaultValue]] ecma object's operation
*
* See also:
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_object_default_value( ecma_object_t *obj_p, /**< the object */
ecma_preferred_type_hint_t hint) /**< hint on preferred result type */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( obj_p, hint);
} /* ecma_op_object_default_value */
/**
* [[DefineOwnProperty]] ecma object's operation
*
* See also:
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_object_define_own_property( ecma_object_t *obj_p, /**< the object */
ecma_array_first_chunk_t *property_name_p, /**< property name */
ecma_property_t property_desc, /**< property descriptor */
bool is_throw) /**< flag that controls failure handling */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( obj_p, property_name_p, property_desc, is_throw);
} /* ecma_op_object_define_own_property */
/**
* @}
* @}
*/
@@ -0,0 +1,52 @@
/* Copyright 2014 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ECMA_OBJECTS_PROPERTIES_H
#define ECMA_OBJECTS_PROPERTIES_H
#include "ecma-conversion.h"
#include "ecma-globals.h"
/** \addtogroup ecma ---TODO---
* @{
*
* \addtogroup ecmaobjectsinternalops ECMA objects' operations
* @{
*/
extern ecma_completion_value_t ecma_op_object_get( ecma_object_t *obj_p, ecma_array_first_chunk_t *property_name_p);
extern ecma_property_t *ecma_op_object_get_own_property( ecma_object_t *obj_p, ecma_array_first_chunk_t *property_name_p);
extern ecma_property_t *ecma_op_object_get_property( ecma_object_t *obj_p, ecma_array_first_chunk_t *property_name_p);
extern ecma_completion_value_t ecma_op_object_put( ecma_object_t *obj_p,
ecma_array_first_chunk_t *property_name_p,
ecma_value_t value,
bool is_throw);
extern bool ecma_op_object_can_put( ecma_object_t *obj_p, ecma_array_first_chunk_t *property_name_p);
extern bool ecma_op_object_has_property( ecma_object_t *obj_p, ecma_array_first_chunk_t *property_name_p);
extern ecma_completion_value_t ecma_op_object_delete( ecma_object_t *obj_p,
ecma_array_first_chunk_t *property_name_p,
bool is_throw);
extern ecma_completion_value_t ecma_op_object_default_value( ecma_object_t *obj_p, ecma_preferred_type_hint_t hint);
extern ecma_completion_value_t ecma_op_object_define_own_property( ecma_object_t *obj_p,
ecma_array_first_chunk_t *property_name_p,
ecma_property_t property_desc,
bool is_throw);
/**
* @}
* @}
*/
#endif /* !ECMA_OBJECTS_PROPERTIES_H */