本文整理汇总了C++中ecma_is_value_object函数的典型用法代码示例。如果您正苦于以下问题:C++ ecma_is_value_object函数的具体用法?C++ ecma_is_value_object怎么用?C++ ecma_is_value_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ecma_is_value_object函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ecma_builtin_object_prototype_object_is_prototype_of
/**
* The Object.prototype object's 'isPrototypeOf' routine
*
* See also:
* ECMA-262 v5, 15.2.4.6
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_object_prototype_object_is_prototype_of (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg) /**< routine's first argument */
{
/* 1. Is the argument an object? */
if (!ecma_is_value_object (arg))
{
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE);
}
ecma_value_t return_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
/* 2. ToObject(this) */
ECMA_TRY_CATCH (obj_value,
ecma_op_to_object (this_arg),
return_value);
ecma_object_t *obj_p = ecma_get_object_from_value (obj_value);
/* 3. Compare prototype to object */
ECMA_TRY_CATCH (v_obj_value,
ecma_op_to_object (arg),
return_value);
ecma_object_t *v_obj_p = ecma_get_object_from_value (v_obj_value);
bool is_prototype_of = ecma_op_object_is_prototype_of (obj_p, v_obj_p);
return_value = ecma_make_simple_value (is_prototype_of ? ECMA_SIMPLE_VALUE_TRUE
: ECMA_SIMPLE_VALUE_FALSE);
ECMA_FINALIZE (v_obj_value);
ECMA_FINALIZE (obj_value);
return return_value;
} /* ecma_builtin_object_prototype_object_is_prototype_of */
开发者ID:Akromx16,项目名称:jerryscript,代码行数:44,代码来源:ecma-builtin-object-prototype.c
示例2: opfunc_in
/**
* 'in' opcode handler.
*
* See also: ECMA-262 v5, 11.8.7
*
* @return ecma value
* returned value must be freed with ecma_free_value.
*/
ecma_value_t
opfunc_in (ecma_value_t left_value, /**< left value */
ecma_value_t right_value) /**< right value */
{
if (!ecma_is_value_object (right_value))
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Expected an object in 'in' check."));
}
bool to_string = !ecma_is_value_string (left_value);
if (to_string)
{
left_value = ecma_op_to_string (left_value);
if (ECMA_IS_VALUE_ERROR (left_value))
{
return left_value;
}
}
ecma_string_t *left_value_prop_name_p = ecma_get_string_from_value (left_value);
ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);
ecma_value_t result = ecma_make_boolean_value (ecma_op_object_has_property (right_value_obj_p,
left_value_prop_name_p));
if (to_string)
{
ecma_free_value (left_value);
}
return result;
} /* opfunc_in */
开发者ID:Samsung,项目名称:jerryscript,代码行数:41,代码来源:opcodes-ecma-relational-equality.c
示例3: ecma_builtin_number_prototype_object_value_of
/**
* The Number.prototype object's 'valueOf' routine
*
* See also:
* ECMA-262 v5, 15.7.4.4
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_number_prototype_object_value_of (ecma_value_t this_arg) /**< this argument */
{
if (ecma_is_value_number (this_arg))
{
return ecma_copy_value (this_arg);
}
else if (ecma_is_value_object (this_arg))
{
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
if (ecma_object_get_class_name (obj_p) == LIT_MAGIC_STRING_NUMBER_UL)
{
ecma_property_t *prim_value_prop_p = ecma_get_internal_property (obj_p,
ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE);
ecma_number_t *prim_value_num_p;
prim_value_num_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t,
ecma_get_internal_property_value (prim_value_prop_p));
ecma_number_t *ret_num_p = ecma_alloc_number ();
*ret_num_p = *prim_value_num_p;
return ecma_make_number_value (ret_num_p);
}
}
return ecma_raise_type_error (ECMA_ERR_MSG (""));
} /* ecma_builtin_number_prototype_object_value_of */
开发者ID:Akromx16,项目名称:jerryscript,代码行数:38,代码来源:ecma-builtin-number-prototype.c
示例4: ecma_op_create_iterator_object
/**
* General iterator object creation operation.
*
* See also: ECMA-262 v6, 21.1.5.1, 22.1.5.1, 23.1.5.1
*
* Note:
* Returned value must be freed with ecma_free_value.
*
* @return iterator object
*/
ecma_value_t
ecma_op_create_iterator_object (ecma_value_t iterated_value, /**< value from create iterator */
ecma_object_t *prototype_obj_p, /**< prototype object */
uint8_t iterator_type, /**< itertator type, see ecma_pseudo_array_type_t */
uint8_t extra_info) /**< extra information */
{
/* 1. */
JERRY_ASSERT (ecma_is_value_object (iterated_value));
JERRY_ASSERT (iterator_type >= ECMA_PSEUDO_ARRAY_ITERATOR && iterator_type <= ECMA_PSEUDO_ARRAY__MAX);
ecma_object_t *iterated_obj_p = ecma_get_object_from_value (iterated_value);
/* 2. */
ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
sizeof (ecma_extended_object_t),
ECMA_OBJECT_TYPE_PSEUDO_ARRAY);
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
ext_obj_p->u.pseudo_array.type = iterator_type;
/* 3. */
ECMA_SET_NON_NULL_POINTER (ext_obj_p->u.pseudo_array.u2.iterated_value_cp, iterated_obj_p);
/* 4. */
ext_obj_p->u.pseudo_array.u1.iterator_index = 0;
/* 5. */
ext_obj_p->u.pseudo_array.extra_info = extra_info;
/* 6. */
return ecma_make_object_value (object_p);
} /* ecma_op_create_iterator_object */
开发者ID:Samsung,项目名称:jerryscript,代码行数:39,代码来源:ecma-iterator-object.c
示例5: opfunc_in
/**
* 'in' opcode handler.
*
* See also: ECMA-262 v5, 11.8.7
*
* @return ecma value
* returned value must be freed with ecma_free_value.
*/
ecma_value_t
opfunc_in (ecma_value_t left_value, /**< left value */
ecma_value_t right_value) /**< right value */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
if (!ecma_is_value_object (right_value))
{
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
ECMA_TRY_CATCH (str_left_value, ecma_op_to_string (left_value), ret_value);
ecma_string_t *left_value_prop_name_p = ecma_get_string_from_value (str_left_value);
ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);
if (ecma_op_object_get_property (right_value_obj_p, left_value_prop_name_p) != NULL)
{
ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE);
}
else
{
ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE);
}
ECMA_FINALIZE (str_left_value);
}
return ret_value;
} /* opfunc_in */
开发者ID:dmethvin,项目名称:jerryscript,代码行数:39,代码来源:opcodes-ecma-relational.c
示例6: ecma_builtin_date_prototype_set_time
/**
* The Date.prototype object's 'setTime' routine
*
* See also:
* ECMA-262 v5, 15.9.5.27
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_date_prototype_set_time (ecma_value_t this_arg, /**< this argument */
ecma_value_t time) /**< time */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
if (!ecma_is_value_object (this_arg)
|| ecma_object_get_class_name (ecma_get_object_from_value (this_arg)) != LIT_MAGIC_STRING_DATE_UL)
{
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incompatible type"));
}
else
{
/* 1. */
ECMA_OP_TO_NUMBER_TRY_CATCH (t, time, ret_value);
ecma_number_t *value_p = ecma_alloc_number ();
*value_p = ecma_date_time_clip (t);
/* 2. */
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
ecma_property_t *prim_prop_p = ecma_get_internal_property (obj_p,
ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE);
ecma_number_t *prim_value_num_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t,
ecma_get_internal_property_value (prim_prop_p));
*prim_value_num_p = *value_p;
/* 3. */
ret_value = ecma_make_number_value (value_p);
ECMA_OP_TO_NUMBER_FINALIZE (t);
}
return ret_value;
} /* ecma_builtin_date_prototype_set_time */
开发者ID:Akromx16,项目名称:jerryscript,代码行数:44,代码来源:ecma-builtin-date-prototype.c
示例7: opfunc_instanceof
/**
* 'instanceof' opcode handler.
*
* See also: ECMA-262 v5, 11.8.6
*
* @return ecma value
* returned value must be freed with ecma_free_value.
*/
ecma_value_t
opfunc_instanceof (ecma_value_t left_value, /**< left value */
ecma_value_t right_value) /**< right value */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
if (!ecma_is_value_object (right_value))
{
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected an object in 'instanceof' check."));
}
else
{
ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);
ECMA_TRY_CATCH (is_instance_of,
ecma_op_object_has_instance (right_value_obj_p, left_value),
ret_value);
ret_value = is_instance_of;
ECMA_FINALIZE (is_instance_of);
}
return ret_value;
} /* opfunc_instanceof */
开发者ID:drashti304,项目名称:TizenRT,代码行数:33,代码来源:opcodes-ecma-relational.c
示例8: ecma_op_to_object
/**
* ToObject operation.
*
* See also:
* ECMA-262 v5, 9.9
*
* @return ecma value
* Returned value must be freed with ecma_free_value
*/
ecma_value_t
ecma_op_to_object (ecma_value_t value) /**< ecma value */
{
ecma_check_value_type_is_spec_defined (value);
if (ecma_is_value_number (value))
{
return ecma_op_create_number_object (value);
}
else if (ecma_is_value_string (value))
{
return ecma_op_create_string_object (&value, 1);
}
else if (ecma_is_value_object (value))
{
return ecma_copy_value (value);
}
else
{
if (ecma_is_value_undefined (value)
|| ecma_is_value_null (value))
{
return ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (value));
return ecma_op_create_boolean_object (value);
}
}
} /* ecma_op_to_object */
开发者ID:vvreal,项目名称:jerryscript,代码行数:41,代码来源:ecma-conversion.c
示例9: ecma_builtin_string_prototype_object_to_string
/**
* The String.prototype object's 'toString' routine
*
* See also:
* ECMA-262 v5, 15.5.4.2
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_string_prototype_object_to_string (ecma_value_t this_arg) /**< this argument */
{
if (ecma_is_value_string (this_arg))
{
return ecma_make_normal_completion_value (ecma_copy_value (this_arg, true));
}
else if (ecma_is_value_object (this_arg))
{
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
if (ecma_object_get_class_name (obj_p) == LIT_MAGIC_STRING_STRING_UL)
{
ecma_property_t *prim_value_prop_p = ecma_get_internal_property (obj_p,
ECMA_INTERNAL_PROPERTY_PRIMITIVE_STRING_VALUE);
ecma_string_t *prim_value_str_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t,
prim_value_prop_p->u.internal_property.value);
prim_value_str_p = ecma_copy_or_ref_ecma_string (prim_value_str_p);
return ecma_make_normal_completion_value (ecma_make_string_value (prim_value_str_p));
}
}
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
} /* ecma_builtin_string_prototype_object_to_string */
开发者ID:szledan,项目名称:jerryscript,代码行数:36,代码来源:ecma-builtin-string-prototype.cpp
示例10: ecma_builtin_promise_remaining_inc_or_dec
/**
* Helper function for increase or decrease the remaining count.
*
* @return the current remaining count after increase or decrease.
*/
static ecma_length_t
ecma_builtin_promise_remaining_inc_or_dec (ecma_value_t remaining, /**< the remaining count */
bool is_inc) /**< whether to increase the count */
{
JERRY_ASSERT (ecma_is_value_object (remaining));
ecma_object_t *remaining_p = ecma_get_object_from_value (remaining);
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) remaining_p;
JERRY_ASSERT (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_NUMBER_UL);
JERRY_ASSERT (ecma_is_value_integer_number (ext_object_p->u.class_prop.u.value));
ecma_length_t current = (ecma_length_t) ecma_get_integer_from_value (ext_object_p->u.class_prop.u.value);
if (is_inc)
{
current++;
}
else
{
current--;
}
ext_object_p->u.class_prop.u.value = ecma_make_uint32_value (current);
return current;
} /* ecma_builtin_promise_remaining_inc_or_dec */
开发者ID:knightburton,项目名称:jerryscript,代码行数:33,代码来源:ecma-builtin-promise.c
示例11: ecma_op_to_object
/**
* ToObject operation.
*
* See also:
* ECMA-262 v5, 9.9
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_to_object (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
if (ecma_is_value_number (value))
{
return ecma_op_create_number_object (value);
}
else if (ecma_is_value_string (value))
{
return ecma_op_create_string_object (&value, 1);
}
else if (ecma_is_value_object (value))
{
return ecma_make_normal_completion_value (ecma_copy_value (value, true));
}
else
{
if (ecma_is_value_undefined (value)
|| ecma_is_value_null (value))
{
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (value));
return ecma_op_create_boolean_object (value);
}
}
} /* ecma_op_to_object */
开发者ID:kkristof,项目名称:jerryscript,代码行数:41,代码来源:ecma-conversion.cpp
示例12: ecma_is_arraybuffer
/**
* Helper function: check if the target is ArrayBuffer
*
*
* See also: ES2015 24.1.1.4
*
* @return true - if value is an ArrayBuffer object
* false - otherwise
*/
bool
ecma_is_arraybuffer (ecma_value_t target) /**< the target value */
{
return (ecma_is_value_object (target)
&& ecma_object_class_is (ecma_get_object_from_value (target),
LIT_MAGIC_STRING_ARRAY_BUFFER_UL));
} /* ecma_is_arraybuffer */
开发者ID:grgustaf,项目名称:jerryscript,代码行数:16,代码来源:ecma-arraybuffer-object.c
示例13: ecma_builtin_object_object_get_prototype_of
/**
* The Object object's 'getPrototypeOf' routine
*
* See also:
* ECMA-262 v5, 15.2.3.2
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_object_object_get_prototype_of (ecma_value_t this_arg __attr_unused___, /**< 'this' argument */
ecma_value_t arg) /**< routine's argument */
{
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
/* 1. */
if (!ecma_is_value_object (arg))
{
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
/* 2. */
ecma_object_t *obj_p = ecma_get_object_from_value (arg);
ecma_object_t *prototype_p = ecma_get_object_prototype (obj_p);
if (prototype_p)
{
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (prototype_p));
ecma_ref_object (prototype_p);
}
else
{
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_NULL);
}
}
return ret_value;
} /* ecma_builtin_object_object_get_prototype_of */
开发者ID:jiangrunwu,项目名称:iotjs-openwrt,代码行数:39,代码来源:ecma-builtin-object.cpp
示例14: ecma_builtin_object_object_is_sealed
/**
* The Object object's 'isSealed' routine
*
* See also:
* ECMA-262 v5, 15.2.3.11
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_object_object_is_sealed (ecma_value_t this_arg __attr_unused___, /**< 'this' argument */
ecma_value_t arg) /**< routine's argument */
{
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
// 1.
if (!ecma_is_value_object (arg))
{
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
ecma_object_t *obj_p = ecma_get_object_from_value (arg);
bool is_sealed;
// 3.
if (ecma_get_object_extensible (obj_p))
{
is_sealed = false;
}
else
{
/* the value can be updated in the loop below */
is_sealed = true;
// 2.
ecma_collection_header_t *props_p = ecma_op_object_get_property_names (obj_p, false, false, false);
ecma_collection_iterator_t iter;
ecma_collection_iterator_init (&iter, props_p);
while (ecma_collection_iterator_next (&iter))
{
ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p);
// 2.a
ecma_property_t *property_p = ecma_op_object_get_own_property (obj_p, property_name_p);
// 2.b
if (ecma_is_property_configurable (property_p))
{
is_sealed = false;
break;
}
}
ecma_free_values_collection (props_p, true);
}
// 4.
ret_value = ecma_make_simple_completion_value (is_sealed
? ECMA_SIMPLE_VALUE_TRUE
: ECMA_SIMPLE_VALUE_FALSE);
}
return ret_value;
} /* ecma_builtin_object_object_is_sealed */
开发者ID:jiangrunwu,项目名称:iotjs-openwrt,代码行数:68,代码来源:ecma-builtin-object.cpp
示例15: ecma_op_to_string
/**
* ToString operation.
*
* See also:
* ECMA-262 v5, 9.8
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_to_string (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
if (unlikely (ecma_is_value_object (value)))
{
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
ECMA_TRY_CATCH (prim_value,
ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_STRING),
ret_value);
ret_value = ecma_op_to_string (prim_value);
ECMA_FINALIZE (prim_value);
return ret_value;
}
else
{
ecma_string_t *res_p = NULL;
if (ecma_is_value_string (value))
{
res_p = ecma_get_string_from_value (value);
res_p = ecma_copy_or_ref_ecma_string (res_p);
}
else if (ecma_is_value_number (value))
{
ecma_number_t *num_p = ecma_get_number_from_value (value);
res_p = ecma_new_ecma_string_from_number (*num_p);
}
else if (ecma_is_value_undefined (value))
{
res_p = ecma_get_magic_string (LIT_MAGIC_STRING_UNDEFINED);
}
else if (ecma_is_value_null (value))
{
res_p = ecma_get_magic_string (LIT_MAGIC_STRING_NULL);
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (value));
if (ecma_is_value_true (value))
{
res_p = ecma_get_magic_string (LIT_MAGIC_STRING_TRUE);
}
else
{
res_p = ecma_get_magic_string (LIT_MAGIC_STRING_FALSE);
}
}
return ecma_make_normal_completion_value (ecma_make_string_value (res_p));
}
} /* ecma_op_to_string */
开发者ID:kkristof,项目名称:jerryscript,代码行数:67,代码来源:ecma-conversion.cpp
示例16: ecma_check_value_type_is_spec_defined
/**
* Debug assertion that specified value's type is one of ECMA-defined
* script-visible types, i.e.: undefined, null, boolean, number, string, object.
*/
void
ecma_check_value_type_is_spec_defined (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_is_value_undefined (value)
|| ecma_is_value_null (value)
|| ecma_is_value_boolean (value)
|| ecma_is_value_number (value)
|| ecma_is_value_string (value)
|| ecma_is_value_object (value));
} /* ecma_check_value_type_is_spec_defined */
开发者ID:SmartFire,项目名称:jerryscript,代码行数:14,代码来源:ecma-helpers-value.c
示例17: ecma_builtin_regexp_prototype_exec
/**
* The RegExp.prototype object's 'exec' routine
*
* See also:
* ECMA-262 v5, 15.10.6.2
*
* @return array object containing the results - if the matched
* null - otherwise
*
* May raise error, so returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_regexp_prototype_exec (ecma_value_t this_arg, /**< this argument */
ecma_value_t arg) /**< routine's argument */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
if (!ecma_is_value_object (this_arg)
|| ecma_object_get_class_name (ecma_get_object_from_value (this_arg)) != LIT_MAGIC_STRING_REGEXP_UL)
{
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incomplete RegExp type"));
}
else
{
ECMA_TRY_CATCH (obj_this, ecma_op_to_object (this_arg), ret_value);
ECMA_TRY_CATCH (input_str_value,
ecma_op_to_string (arg),
ret_value);
ecma_property_t *bytecode_prop_p;
ecma_object_t *obj_p = ecma_get_object_from_value (obj_this);
bytecode_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE);
void *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (void, ecma_get_internal_property_value (bytecode_prop_p));
if (bytecode_p == NULL)
{
/* Missing bytecode means empty RegExp: '/(?:)/', so always return empty string. */
ecma_string_t *capture_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
ecma_value_t arguments_list[1];
arguments_list[0] = ecma_make_string_value (capture_str_p);
ret_value = ecma_op_create_array_object (arguments_list, 1, false);
ecma_deref_ecma_string (capture_str_p);
re_set_result_array_properties (ecma_get_object_from_value (ret_value),
ecma_get_string_from_value (input_str_value),
1,
0);
}
else
{
ret_value = ecma_regexp_exec_helper (obj_this, input_str_value, false);
}
ECMA_FINALIZE (input_str_value);
ECMA_FINALIZE (obj_this);
}
return ret_value;
} /* ecma_builtin_regexp_prototype_exec */
开发者ID:jjykh,项目名称:jerryscript,代码行数:64,代码来源:ecma-builtin-regexp-prototype.c
示例18: opfunc_instanceof
/**
* 'instanceof' opcode handler.
*
* See also: ECMA-262 v5, 11.8.6
*
* @return ecma value
* returned value must be freed with ecma_free_value.
*/
ecma_value_t
opfunc_instanceof (ecma_value_t left_value, /**< left value */
ecma_value_t right_value) /**< right value */
{
if (!ecma_is_value_object (right_value))
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Expected an object in 'instanceof' check."));
}
ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);
return ecma_op_object_has_instance (right_value_obj_p, left_value);
} /* opfunc_instanceof */
开发者ID:Samsung,项目名称:jerryscript,代码行数:20,代码来源:opcodes-ecma-relational-equality.c
示例19: ecma_get_already_resolved_bool_value
/**
* Get the bool value of alreadyResolved.
*
* @return bool value of alreadyResolved.
*/
static bool
ecma_get_already_resolved_bool_value (ecma_value_t already_resolved) /**< the alreadyResolved */
{
JERRY_ASSERT (ecma_is_value_object (already_resolved));
ecma_object_t *already_resolved_p = ecma_get_object_from_value (already_resolved);
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) already_resolved_p;
JERRY_ASSERT (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_BOOLEAN_UL);
return ext_object_p->u.class_prop.u.value == ecma_make_boolean_value (true);
} /* ecma_get_already_resolved_bool_value */
开发者ID:jimmy-huang,项目名称:jerryscript,代码行数:17,代码来源:ecma-promise-object.c
示例20: ecma_op_to_boolean
/**
* ToBoolean operation.
*
* See also:
* ECMA-262 v5, 9.2
*
* @return completion value
* Returned value is simple and so need not be freed.
* However, ecma_free_completion_value may be called for it, but it is a no-op.
*/
ecma_completion_value_t
ecma_op_to_boolean (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
ecma_simple_value_t ret_value;
if (ecma_is_value_boolean (value))
{
ret_value = (ecma_is_value_true (value) ?
ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
}
else if (ecma_is_value_undefined (value)
|| ecma_is_value_null (value))
{
ret_value = ECMA_SIMPLE_VALUE_FALSE;
}
else if (ecma_is_value_number (value))
{
ecma_number_t *num_p = ecma_get_number_from_value (value);
if (ecma_number_is_nan (*num_p)
|| ecma_number_is_zero (*num_p))
{
ret_value = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
ret_value = ECMA_SIMPLE_VALUE_TRUE;
}
}
else if (ecma_is_value_string (value))
{
ecma_string_t *str_p = ecma_get_string_from_value (value);
if (ecma_string_get_length (str_p) == 0)
{
ret_value = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
ret_value = ECMA_SIMPLE_VALUE_TRUE;
}
}
else
{
JERRY_ASSERT (ecma_is_value_object (value));
ret_value = ECMA_SIMPLE_VALUE_TRUE;
}
return ecma_make_simple_completion_value (ret_value);
} /* ecma_op_to_boolean */
开发者ID:kkristof,项目名称:jerryscript,代码行数:63,代码来源:ecma-conversion.cpp
注:本文中的ecma_is_value_object函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论