Implementing case 3.b in PutValue operation.
This commit is contained in:
@@ -18,8 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecma-exceptions.h"
|
#include "ecma-exceptions.h"
|
||||||
|
#include "ecma-gc.h"
|
||||||
|
#include "ecma-global-object.h"
|
||||||
#include "ecma-helpers.h"
|
#include "ecma-helpers.h"
|
||||||
#include "ecma-lex-env.h"
|
#include "ecma-lex-env.h"
|
||||||
|
#include "ecma-objects-properties.h"
|
||||||
#include "ecma-operations.h"
|
#include "ecma-operations.h"
|
||||||
|
|
||||||
/** \addtogroup ecma ---TODO---
|
/** \addtogroup ecma ---TODO---
|
||||||
@@ -135,13 +138,19 @@ ecma_op_put_value(ecma_reference_t ref, /**< ECMA-reference */
|
|||||||
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_REFERENCE));
|
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_REFERENCE));
|
||||||
} else // PutValue_3.b
|
} else // PutValue_3.b
|
||||||
{
|
{
|
||||||
/*
|
ecma_object_t *global_object_p = ecma_get_global_object();
|
||||||
ecma_object_t *global_object_p = ecma_GetGlobalObject();
|
|
||||||
|
|
||||||
return global_object_p->[[Put]]( ref.referenced_name_p, value, false);
|
ecma_completion_value_t completion = ecma_op_object_put( global_object_p,
|
||||||
*/
|
ref.referenced_name_p,
|
||||||
|
value,
|
||||||
|
false);
|
||||||
|
|
||||||
JERRY_UNIMPLEMENTED();
|
ecma_deref_object( global_object_p);
|
||||||
|
|
||||||
|
JERRY_ASSERT( ecma_is_completion_value_normal_true( completion)
|
||||||
|
|| ecma_is_completion_value_normal_false( completion) );
|
||||||
|
|
||||||
|
return ecma_make_empty_completion_value();
|
||||||
}
|
}
|
||||||
} else if ( is_property_reference ) // PutValue_4
|
} else if ( is_property_reference ) // PutValue_4
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "ecma-gc.h"
|
||||||
#include "ecma-globals.h"
|
#include "ecma-globals.h"
|
||||||
#include "ecma-global-object.h"
|
#include "ecma-global-object.h"
|
||||||
#include "ecma-helpers.h"
|
#include "ecma-helpers.h"
|
||||||
@@ -26,6 +27,27 @@
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global object
|
||||||
|
*/
|
||||||
|
static ecma_object_t* ecma_global_object_p = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Global object
|
||||||
|
*
|
||||||
|
* @return pointer to the Global object
|
||||||
|
* caller should free the reference by calling ecma_deref_object
|
||||||
|
*/
|
||||||
|
ecma_object_t*
|
||||||
|
ecma_get_global_object( void)
|
||||||
|
{
|
||||||
|
JERRY_ASSERT( ecma_global_object_p != NULL );
|
||||||
|
|
||||||
|
ecma_ref_object( ecma_global_object_p);
|
||||||
|
|
||||||
|
return ecma_global_object_p;
|
||||||
|
} /* ecma_get_global_object */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Global Object construction routine.
|
* The Global Object construction routine.
|
||||||
*
|
*
|
||||||
@@ -36,6 +58,8 @@
|
|||||||
ecma_object_t*
|
ecma_object_t*
|
||||||
ecma_op_create_global_object( void)
|
ecma_op_create_global_object( void)
|
||||||
{
|
{
|
||||||
|
JERRY_ASSERT( ecma_global_object_p == NULL );
|
||||||
|
|
||||||
ecma_object_t *glob_obj_p = ecma_create_object( NULL, true, ECMA_OBJECT_TYPE_GENERAL);
|
ecma_object_t *glob_obj_p = ecma_create_object( NULL, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||||
|
|
||||||
ecma_property_t *undefined_prop_p = ecma_create_named_data_property( glob_obj_p,
|
ecma_property_t *undefined_prop_p = ecma_create_named_data_property( glob_obj_p,
|
||||||
@@ -47,6 +71,9 @@ ecma_op_create_global_object( void)
|
|||||||
|
|
||||||
TODO( /* Define NaN, Infinity, eval, parseInt, parseFloat, isNaN, isFinite properties */ );
|
TODO( /* Define NaN, Infinity, eval, parseInt, parseFloat, isNaN, isFinite properties */ );
|
||||||
|
|
||||||
|
ecma_ref_object( glob_obj_p);
|
||||||
|
ecma_global_object_p = glob_obj_p;
|
||||||
|
|
||||||
return glob_obj_p;
|
return glob_obj_p;
|
||||||
} /* ecma_op_create_global_object */
|
} /* ecma_op_create_global_object */
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
extern ecma_object_t* ecma_get_global_object(void);
|
||||||
extern ecma_object_t* ecma_op_create_global_object( void);
|
extern ecma_object_t* ecma_op_create_global_object( void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -212,7 +212,8 @@ ecma_op_object_put( ecma_object_t *obj_p, /**< the object */
|
|||||||
ecma_property_t *own_desc_p = ecma_op_object_get_own_property( obj_p, property_name_p);
|
ecma_property_t *own_desc_p = ecma_op_object_get_own_property( obj_p, property_name_p);
|
||||||
|
|
||||||
// 3.
|
// 3.
|
||||||
if ( own_desc_p->type == ECMA_PROPERTY_NAMEDDATA )
|
if ( own_desc_p != NULL
|
||||||
|
&& own_desc_p->type == ECMA_PROPERTY_NAMEDDATA )
|
||||||
{
|
{
|
||||||
// a.
|
// a.
|
||||||
ecma_property_descriptor_t value_desc = ecma_make_empty_property_descriptor();
|
ecma_property_descriptor_t value_desc = ecma_make_empty_property_descriptor();
|
||||||
@@ -232,7 +233,8 @@ ecma_op_object_put( ecma_object_t *obj_p, /**< the object */
|
|||||||
ecma_property_t *desc_p = ecma_op_object_get_property( obj_p, property_name_p);
|
ecma_property_t *desc_p = ecma_op_object_get_property( obj_p, property_name_p);
|
||||||
|
|
||||||
// 5.
|
// 5.
|
||||||
if ( desc_p->type == ECMA_PROPERTY_NAMEDACCESSOR )
|
if ( desc_p != NULL
|
||||||
|
&& desc_p->type == ECMA_PROPERTY_NAMEDACCESSOR )
|
||||||
{
|
{
|
||||||
// a.
|
// a.
|
||||||
ecma_object_t *setter_p = ecma_get_pointer( desc_p->u.named_accessor_property.set_p);
|
ecma_object_t *setter_p = ecma_get_pointer( desc_p->u.named_accessor_property.set_p);
|
||||||
|
|||||||
Reference in New Issue
Block a user