Improve resolve reference.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -74,29 +74,19 @@ ecma_op_object_get (ecma_object_t *obj_p, /**< the object */
|
|||||||
|
|
||||||
const ecma_object_type_t type = ecma_get_object_type (obj_p);
|
const ecma_object_type_t type = ecma_get_object_type (obj_p);
|
||||||
|
|
||||||
switch (type)
|
if (unlikely (type == ECMA_OBJECT_TYPE_ARGUMENTS))
|
||||||
{
|
{
|
||||||
case ECMA_OBJECT_TYPE_GENERAL:
|
return ecma_op_arguments_object_get (obj_p, property_name_p);
|
||||||
case ECMA_OBJECT_TYPE_FUNCTION:
|
|
||||||
case ECMA_OBJECT_TYPE_EXTERNAL_FUNCTION:
|
|
||||||
case ECMA_OBJECT_TYPE_ARRAY:
|
|
||||||
case ECMA_OBJECT_TYPE_STRING:
|
|
||||||
case ECMA_OBJECT_TYPE_BOUND_FUNCTION:
|
|
||||||
{
|
|
||||||
return ecma_op_general_object_get (obj_p, property_name_p);
|
|
||||||
}
|
|
||||||
|
|
||||||
case ECMA_OBJECT_TYPE_ARGUMENTS:
|
|
||||||
{
|
|
||||||
return ecma_op_arguments_object_get (obj_p, property_name_p);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
JERRY_ASSERT (false);
|
|
||||||
|
|
||||||
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_GENERAL
|
||||||
|
|| type == ECMA_OBJECT_TYPE_FUNCTION
|
||||||
|
|| type == ECMA_OBJECT_TYPE_EXTERNAL_FUNCTION
|
||||||
|
|| type == ECMA_OBJECT_TYPE_ARRAY
|
||||||
|
|| type == ECMA_OBJECT_TYPE_STRING
|
||||||
|
|| type == ECMA_OBJECT_TYPE_BOUND_FUNCTION);
|
||||||
|
|
||||||
|
return ecma_op_general_object_get (obj_p, property_name_p);
|
||||||
} /* ecma_op_object_get */
|
} /* ecma_op_object_get */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecma-exceptions.h"
|
#include "ecma-exceptions.h"
|
||||||
|
#include "ecma-function-object.h"
|
||||||
#include "ecma-gc.h"
|
#include "ecma-gc.h"
|
||||||
#include "ecma-globals.h"
|
#include "ecma-globals.h"
|
||||||
#include "ecma-helpers.h"
|
#include "ecma-helpers.h"
|
||||||
@@ -106,9 +107,24 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
|
|||||||
|
|
||||||
ecma_property_t *property_p = ecma_op_object_get_property (binding_obj_p, name_p);
|
ecma_property_t *property_p = ecma_op_object_get_property (binding_obj_p, name_p);
|
||||||
|
|
||||||
if (property_p != NULL)
|
if (likely (property_p != NULL))
|
||||||
{
|
{
|
||||||
return ecma_op_object_get (binding_obj_p, name_p);
|
if (ECMA_PROPERTY_GET_TYPE (property_p) == ECMA_PROPERTY_TYPE_NAMEDDATA)
|
||||||
|
{
|
||||||
|
return ecma_fast_copy_value (ecma_get_named_data_property_value (property_p));
|
||||||
|
}
|
||||||
|
|
||||||
|
ecma_object_t *getter_p = ecma_get_named_accessor_property_getter (property_p);
|
||||||
|
|
||||||
|
if (getter_p == NULL)
|
||||||
|
{
|
||||||
|
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ecma_op_function_call (getter_p,
|
||||||
|
ecma_make_object_value (binding_obj_p),
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user