Implementing EvalError, RangeError, SyntaxError, URIError built-ins and corresponding prototype built-in objects.
This commit is contained in:
@@ -104,7 +104,8 @@ get_variable_value (int_data_t *int_data, /**< interpreter context */
|
||||
if (unlikely (do_eval_or_arguments_check
|
||||
&& do_strict_eval_arguments_check (ref)))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_SYNTAX));
|
||||
/* SyntaxError should be treated as an early error */
|
||||
JERRY_UNREACHABLE ();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -156,7 +157,8 @@ set_variable_value (int_data_t *int_data, /**< interpreter context */
|
||||
|
||||
if (unlikely (do_strict_eval_arguments_check (ref)))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_SYNTAX));
|
||||
/* SyntaxError should be treated as an early error */
|
||||
JERRY_UNREACHABLE ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1452,7 +1452,8 @@ opfunc_delete_var (opcode_t opdata, /**< operation data */
|
||||
|
||||
if (ref.is_strict)
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_SYNTAX));
|
||||
/* SyntaxError should be treated as an early error */
|
||||
JERRY_UNREACHABLE ();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1518,7 +1519,8 @@ opfunc_delete_prop (opcode_t opdata, /**< operation data */
|
||||
{
|
||||
if (int_data->is_strict)
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_SYNTAX));
|
||||
/* SyntaxError should be treated as an early error */
|
||||
JERRY_UNREACHABLE ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/* 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-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "globals.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-evalerror-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID eval_error_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
@@ -0,0 +1,65 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* EvalError.prototype built-in description
|
||||
*/
|
||||
|
||||
#ifndef OBJECT_ID
|
||||
# define OBJECT_ID(builtin_object_id)
|
||||
#endif /* !OBJECT_ID */
|
||||
|
||||
#ifndef STRING_VALUE
|
||||
# define STRING_VALUE(name, magic_string_id, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !STRING_VALUE */
|
||||
|
||||
#ifndef OBJECT_VALUE
|
||||
# define OBJECT_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !OBJECT_VALUE */
|
||||
|
||||
/* Object identifier */
|
||||
OBJECT_ID (ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
// 15.11.7.8
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_EVAL_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// 15.11.7.9
|
||||
STRING_VALUE (ECMA_MAGIC_STRING_NAME,
|
||||
ECMA_MAGIC_STRING_EVAL_ERROR_UL,
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// 15.11.7.10
|
||||
STRING_VALUE (ECMA_MAGIC_STRING_MESSAGE,
|
||||
ECMA_MAGIC_STRING__EMPTY,
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
#undef OBJECT_ID
|
||||
#undef SIMPLE_VALUE
|
||||
#undef NUMBER_VALUE
|
||||
#undef STRING_VALUE
|
||||
#undef OBJECT_VALUE
|
||||
#undef CP_UNIMPLEMENTED_VALUE
|
||||
#undef ROUTINE
|
||||
@@ -0,0 +1,97 @@
|
||||
/* 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-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "globals.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-evalerror.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID eval_error
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
*
|
||||
* \addtogroup ecmabuiltins
|
||||
* @{
|
||||
*
|
||||
* \addtogroup evalerror ECMA EvalError object built-in
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handle calling [[Call]] of built-in EvalError object
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_eval_error_dispatch_call (ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p [0]))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (msg_to_str_completion,
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_EVAL,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_to_str_completion);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_EVAL);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
}
|
||||
} /* ecma_builtin_eval_error_dispatch_call */
|
||||
|
||||
/**
|
||||
* Handle calling [[Construct]] of built-in EvalError object
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_eval_error_dispatch_construct (ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
return ecma_builtin_eval_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_eval_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,65 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* EvalError built-in description
|
||||
*/
|
||||
|
||||
#ifndef OBJECT_ID
|
||||
# define OBJECT_ID(builtin_object_id)
|
||||
#endif /* !OBJECT_ID */
|
||||
|
||||
#ifndef NUMBER_VALUE
|
||||
# define NUMBER_VALUE(name, number_value, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !NUMBER_VALUE */
|
||||
|
||||
#ifndef STRING_VALUE
|
||||
# define STRING_VALUE(name, magic_string_id, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !STRING_VALUE */
|
||||
|
||||
#ifndef OBJECT_VALUE
|
||||
# define OBJECT_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !OBJECT_VALUE */
|
||||
|
||||
/* Object identifier */
|
||||
OBJECT_ID (ECMA_BUILTIN_ID_EVAL_ERROR)
|
||||
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
// 15.11.3
|
||||
NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
#undef OBJECT_ID
|
||||
#undef SIMPLE_VALUE
|
||||
#undef NUMBER_VALUE
|
||||
#undef STRING_VALUE
|
||||
#undef OBJECT_VALUE
|
||||
#undef CP_UNIMPLEMENTED_VALUE
|
||||
#undef ROUTINE
|
||||
@@ -138,18 +138,18 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_ERROR_UL,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.10
|
||||
CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_EVAL_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_EVAL_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_EVAL_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_EVAL_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.11
|
||||
CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_RANGE_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_RANGE_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_RANGE_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_RANGE_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.12
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_REFERENCE_ERROR_UL,
|
||||
@@ -159,11 +159,11 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_REFERENCE_ERROR_UL,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.13
|
||||
CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_SYNTAX_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_SYNTAX_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_SYNTAX_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_SYNTAX_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.14
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_TYPE_ERROR_UL,
|
||||
@@ -173,11 +173,11 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_TYPE_ERROR_UL,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.15
|
||||
CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_URI_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_URI_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_URI_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_URI_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.5.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_MATH_UL,
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/* 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-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "globals.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-rangeerror-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID range_error_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
@@ -0,0 +1,65 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* RangeError.prototype built-in description
|
||||
*/
|
||||
|
||||
#ifndef OBJECT_ID
|
||||
# define OBJECT_ID(builtin_object_id)
|
||||
#endif /* !OBJECT_ID */
|
||||
|
||||
#ifndef STRING_VALUE
|
||||
# define STRING_VALUE(name, magic_string_id, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !STRING_VALUE */
|
||||
|
||||
#ifndef OBJECT_VALUE
|
||||
# define OBJECT_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !OBJECT_VALUE */
|
||||
|
||||
/* Object identifier */
|
||||
OBJECT_ID (ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
// 15.11.7.8
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_RANGE_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// 15.11.7.9
|
||||
STRING_VALUE (ECMA_MAGIC_STRING_NAME,
|
||||
ECMA_MAGIC_STRING_RANGE_ERROR_UL,
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// 15.11.7.10
|
||||
STRING_VALUE (ECMA_MAGIC_STRING_MESSAGE,
|
||||
ECMA_MAGIC_STRING__EMPTY,
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
#undef OBJECT_ID
|
||||
#undef SIMPLE_VALUE
|
||||
#undef NUMBER_VALUE
|
||||
#undef STRING_VALUE
|
||||
#undef OBJECT_VALUE
|
||||
#undef CP_UNIMPLEMENTED_VALUE
|
||||
#undef ROUTINE
|
||||
@@ -0,0 +1,97 @@
|
||||
/* 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-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "globals.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-rangeerror.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID range_error
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
*
|
||||
* \addtogroup ecmabuiltins
|
||||
* @{
|
||||
*
|
||||
* \addtogroup rangeerror ECMA RangeError object built-in
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handle calling [[Call]] of built-in RangeError object
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_range_error_dispatch_call (ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p [0]))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (msg_to_str_completion,
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_RANGE,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_to_str_completion);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_RANGE);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
}
|
||||
} /* ecma_builtin_range_error_dispatch_call */
|
||||
|
||||
/**
|
||||
* Handle calling [[Construct]] of built-in RangeError object
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_range_error_dispatch_construct (ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
return ecma_builtin_range_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_range_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,65 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* RangeError built-in description
|
||||
*/
|
||||
|
||||
#ifndef OBJECT_ID
|
||||
# define OBJECT_ID(builtin_object_id)
|
||||
#endif /* !OBJECT_ID */
|
||||
|
||||
#ifndef NUMBER_VALUE
|
||||
# define NUMBER_VALUE(name, number_value, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !NUMBER_VALUE */
|
||||
|
||||
#ifndef STRING_VALUE
|
||||
# define STRING_VALUE(name, magic_string_id, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !STRING_VALUE */
|
||||
|
||||
#ifndef OBJECT_VALUE
|
||||
# define OBJECT_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !OBJECT_VALUE */
|
||||
|
||||
/* Object identifier */
|
||||
OBJECT_ID (ECMA_BUILTIN_ID_RANGE_ERROR)
|
||||
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
// 15.11.3
|
||||
NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
#undef OBJECT_ID
|
||||
#undef SIMPLE_VALUE
|
||||
#undef NUMBER_VALUE
|
||||
#undef STRING_VALUE
|
||||
#undef OBJECT_VALUE
|
||||
#undef CP_UNIMPLEMENTED_VALUE
|
||||
#undef ROUTINE
|
||||
@@ -49,7 +49,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
// 15.7.3.1
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/* 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-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "globals.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-syntaxerror-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID syntax_error_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
@@ -0,0 +1,65 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SyntaxError.prototype built-in description
|
||||
*/
|
||||
|
||||
#ifndef OBJECT_ID
|
||||
# define OBJECT_ID(builtin_object_id)
|
||||
#endif /* !OBJECT_ID */
|
||||
|
||||
#ifndef STRING_VALUE
|
||||
# define STRING_VALUE(name, magic_string_id, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !STRING_VALUE */
|
||||
|
||||
#ifndef OBJECT_VALUE
|
||||
# define OBJECT_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !OBJECT_VALUE */
|
||||
|
||||
/* Object identifier */
|
||||
OBJECT_ID (ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
// 15.11.7.8
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_SYNTAX_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// 15.11.7.9
|
||||
STRING_VALUE (ECMA_MAGIC_STRING_NAME,
|
||||
ECMA_MAGIC_STRING_SYNTAX_ERROR_UL,
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// 15.11.7.10
|
||||
STRING_VALUE (ECMA_MAGIC_STRING_MESSAGE,
|
||||
ECMA_MAGIC_STRING__EMPTY,
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
#undef OBJECT_ID
|
||||
#undef SIMPLE_VALUE
|
||||
#undef NUMBER_VALUE
|
||||
#undef STRING_VALUE
|
||||
#undef OBJECT_VALUE
|
||||
#undef CP_UNIMPLEMENTED_VALUE
|
||||
#undef ROUTINE
|
||||
@@ -0,0 +1,97 @@
|
||||
/* 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-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "globals.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-syntaxerror.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID syntax_error
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
*
|
||||
* \addtogroup ecmabuiltins
|
||||
* @{
|
||||
*
|
||||
* \addtogroup syntaxerror ECMA SyntaxError object built-in
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handle calling [[Call]] of built-in SyntaxError object
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_syntax_error_dispatch_call (ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p [0]))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (msg_to_str_completion,
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_SYNTAX,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_to_str_completion);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_SYNTAX);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
}
|
||||
} /* ecma_builtin_syntax_error_dispatch_call */
|
||||
|
||||
/**
|
||||
* Handle calling [[Construct]] of built-in SyntaxError object
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_syntax_error_dispatch_construct (ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
return ecma_builtin_syntax_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_syntax_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,65 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SyntaxError built-in description
|
||||
*/
|
||||
|
||||
#ifndef OBJECT_ID
|
||||
# define OBJECT_ID(builtin_object_id)
|
||||
#endif /* !OBJECT_ID */
|
||||
|
||||
#ifndef NUMBER_VALUE
|
||||
# define NUMBER_VALUE(name, number_value, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !NUMBER_VALUE */
|
||||
|
||||
#ifndef STRING_VALUE
|
||||
# define STRING_VALUE(name, magic_string_id, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !STRING_VALUE */
|
||||
|
||||
#ifndef OBJECT_VALUE
|
||||
# define OBJECT_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !OBJECT_VALUE */
|
||||
|
||||
/* Object identifier */
|
||||
OBJECT_ID (ECMA_BUILTIN_ID_SYNTAX_ERROR)
|
||||
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
// 15.11.3
|
||||
NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
#undef OBJECT_ID
|
||||
#undef SIMPLE_VALUE
|
||||
#undef NUMBER_VALUE
|
||||
#undef STRING_VALUE
|
||||
#undef OBJECT_VALUE
|
||||
#undef CP_UNIMPLEMENTED_VALUE
|
||||
#undef ROUTINE
|
||||
@@ -49,7 +49,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
// 15.7.3.1
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/* 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-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "globals.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-urierror-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID uri_error_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
@@ -0,0 +1,65 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* UriError.prototype built-in description
|
||||
*/
|
||||
|
||||
#ifndef OBJECT_ID
|
||||
# define OBJECT_ID(builtin_object_id)
|
||||
#endif /* !OBJECT_ID */
|
||||
|
||||
#ifndef STRING_VALUE
|
||||
# define STRING_VALUE(name, magic_string_id, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !STRING_VALUE */
|
||||
|
||||
#ifndef OBJECT_VALUE
|
||||
# define OBJECT_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !OBJECT_VALUE */
|
||||
|
||||
/* Object identifier */
|
||||
OBJECT_ID (ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
// 15.11.7.8
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_URI_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// 15.11.7.9
|
||||
STRING_VALUE (ECMA_MAGIC_STRING_NAME,
|
||||
ECMA_MAGIC_STRING_URI_ERROR_UL,
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// 15.11.7.10
|
||||
STRING_VALUE (ECMA_MAGIC_STRING_MESSAGE,
|
||||
ECMA_MAGIC_STRING__EMPTY,
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
#undef OBJECT_ID
|
||||
#undef SIMPLE_VALUE
|
||||
#undef NUMBER_VALUE
|
||||
#undef STRING_VALUE
|
||||
#undef OBJECT_VALUE
|
||||
#undef CP_UNIMPLEMENTED_VALUE
|
||||
#undef ROUTINE
|
||||
@@ -0,0 +1,97 @@
|
||||
/* 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-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "globals.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-urierror.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID uri_error
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
*
|
||||
* \addtogroup ecmabuiltins
|
||||
* @{
|
||||
*
|
||||
* \addtogroup urierror ECMA UriError object built-in
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handle calling [[Call]] of built-in UriError object
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_uri_error_dispatch_call (ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p [0]))
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
ECMA_TRY_CATCH (msg_to_str_completion,
|
||||
ecma_op_to_string (arguments_list_p[0]),
|
||||
ret_value);
|
||||
|
||||
ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value);
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_URI,
|
||||
message_string_p);
|
||||
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_to_str_completion);
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_URI);
|
||||
|
||||
return ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
|
||||
}
|
||||
} /* ecma_builtin_uri_error_dispatch_call */
|
||||
|
||||
/**
|
||||
* Handle calling [[Construct]] of built-in UriError object
|
||||
*
|
||||
* @return completion-value
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_uri_error_dispatch_construct (ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
return ecma_builtin_uri_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_uri_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,65 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* UriError built-in description
|
||||
*/
|
||||
|
||||
#ifndef OBJECT_ID
|
||||
# define OBJECT_ID(builtin_object_id)
|
||||
#endif /* !OBJECT_ID */
|
||||
|
||||
#ifndef NUMBER_VALUE
|
||||
# define NUMBER_VALUE(name, number_value, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !NUMBER_VALUE */
|
||||
|
||||
#ifndef STRING_VALUE
|
||||
# define STRING_VALUE(name, magic_string_id, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !STRING_VALUE */
|
||||
|
||||
#ifndef OBJECT_VALUE
|
||||
# define OBJECT_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable)
|
||||
#endif /* !OBJECT_VALUE */
|
||||
|
||||
/* Object identifier */
|
||||
OBJECT_ID (ECMA_BUILTIN_ID_URI_ERROR)
|
||||
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
// 15.11.3
|
||||
NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
#undef OBJECT_ID
|
||||
#undef SIMPLE_VALUE
|
||||
#undef NUMBER_VALUE
|
||||
#undef STRING_VALUE
|
||||
#undef OBJECT_VALUE
|
||||
#undef CP_UNIMPLEMENTED_VALUE
|
||||
#undef ROUTINE
|
||||
@@ -135,26 +135,66 @@ ecma_builtin_bin_search_for_magic_string_id_in_array (const ecma_magic_string_id
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_ERROR_PROTOTYPE, \
|
||||
error) \
|
||||
macro (TYPE_ERROR_PROTOTYPE, \
|
||||
macro (EVAL_ERROR_PROTOTYPE, \
|
||||
TYPE_GENERAL, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_ERROR_PROTOTYPE, \
|
||||
type_error_prototype) \
|
||||
macro (REFERENCE_ERROR, \
|
||||
eval_error_prototype) \
|
||||
macro (EVAL_ERROR, \
|
||||
TYPE_FUNCTION, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE, \
|
||||
reference_error) \
|
||||
ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE, \
|
||||
eval_error) \
|
||||
macro (RANGE_ERROR_PROTOTYPE, \
|
||||
TYPE_GENERAL, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_ERROR_PROTOTYPE, \
|
||||
range_error_prototype) \
|
||||
macro (RANGE_ERROR, \
|
||||
TYPE_FUNCTION, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE, \
|
||||
range_error) \
|
||||
macro (REFERENCE_ERROR_PROTOTYPE, \
|
||||
TYPE_GENERAL, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_ERROR_PROTOTYPE, \
|
||||
reference_error_prototype) \
|
||||
macro (REFERENCE_ERROR, \
|
||||
TYPE_FUNCTION, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE, \
|
||||
reference_error) \
|
||||
macro (SYNTAX_ERROR_PROTOTYPE, \
|
||||
TYPE_GENERAL, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_ERROR_PROTOTYPE, \
|
||||
syntax_error_prototype) \
|
||||
macro (SYNTAX_ERROR, \
|
||||
TYPE_FUNCTION, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE, \
|
||||
syntax_error) \
|
||||
macro (TYPE_ERROR_PROTOTYPE, \
|
||||
TYPE_GENERAL, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_ERROR_PROTOTYPE, \
|
||||
type_error_prototype) \
|
||||
macro (TYPE_ERROR, \
|
||||
TYPE_FUNCTION, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE, \
|
||||
type_error) \
|
||||
macro (URI_ERROR_PROTOTYPE, \
|
||||
TYPE_GENERAL, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_ERROR_PROTOTYPE, \
|
||||
uri_error_prototype) \
|
||||
macro (URI_ERROR, \
|
||||
TYPE_FUNCTION, \
|
||||
ERROR_UL, \
|
||||
ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE, \
|
||||
uri_error) \
|
||||
macro (COMPACT_PROFILE_ERROR, \
|
||||
TYPE_FUNCTION, \
|
||||
COMPACT_PROFILE_ERROR_UL, \
|
||||
|
||||
@@ -80,8 +80,8 @@ ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error typ
|
||||
|
||||
case ECMA_ERROR_SYNTAX:
|
||||
{
|
||||
/* SyntaxError should be treated as an early error */
|
||||
JERRY_UNREACHABLE ();
|
||||
prototype_id = ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,3 +110,91 @@ catch (e)
|
||||
|
||||
assert(!(e instanceof Function));
|
||||
}
|
||||
|
||||
/* EvalError */
|
||||
e = new EvalError ();
|
||||
assert (e.name === "EvalError");
|
||||
assert (e.message === "");
|
||||
assert (e.toString() === "EvalError");
|
||||
|
||||
e = new EvalError("some message");
|
||||
assert (e.name === "EvalError");
|
||||
assert (e.message === "some message");
|
||||
assert (e.toString() === "EvalError: some message");
|
||||
|
||||
e.name = "";
|
||||
assert (e.toString() === "some message");
|
||||
e.message = "";
|
||||
assert (e.toString() === "");
|
||||
|
||||
assert (EvalError.prototype.toString === Error.prototype.toString);
|
||||
assert (EvalError.prototype.constructor === EvalError);
|
||||
assert (EvalError.prototype.name === "EvalError");
|
||||
assert (EvalError.prototype.message === "");
|
||||
assert (EvalError.prototype.toString() === "EvalError");
|
||||
|
||||
/* RangeError */
|
||||
e = new RangeError ();
|
||||
assert (e.name === "RangeError");
|
||||
assert (e.message === "");
|
||||
assert (e.toString() === "RangeError");
|
||||
|
||||
e = new RangeError("some message");
|
||||
assert (e.name === "RangeError");
|
||||
assert (e.message === "some message");
|
||||
assert (e.toString() === "RangeError: some message");
|
||||
|
||||
e.name = "";
|
||||
assert (e.toString() === "some message");
|
||||
e.message = "";
|
||||
assert (e.toString() === "");
|
||||
|
||||
assert (RangeError.prototype.toString === Error.prototype.toString);
|
||||
assert (RangeError.prototype.constructor === RangeError);
|
||||
assert (RangeError.prototype.name === "RangeError");
|
||||
assert (RangeError.prototype.message === "");
|
||||
assert (RangeError.prototype.toString() === "RangeError");
|
||||
|
||||
/* SyntaxError */
|
||||
e = new SyntaxError ();
|
||||
assert (e.name === "SyntaxError");
|
||||
assert (e.message === "");
|
||||
assert (e.toString() === "SyntaxError");
|
||||
|
||||
e = new SyntaxError("some message");
|
||||
assert (e.name === "SyntaxError");
|
||||
assert (e.message === "some message");
|
||||
assert (e.toString() === "SyntaxError: some message");
|
||||
|
||||
e.name = "";
|
||||
assert (e.toString() === "some message");
|
||||
e.message = "";
|
||||
assert (e.toString() === "");
|
||||
|
||||
assert (SyntaxError.prototype.toString === Error.prototype.toString);
|
||||
assert (SyntaxError.prototype.constructor === SyntaxError);
|
||||
assert (SyntaxError.prototype.name === "SyntaxError");
|
||||
assert (SyntaxError.prototype.message === "");
|
||||
assert (SyntaxError.prototype.toString() === "SyntaxError");
|
||||
|
||||
/* URIError */
|
||||
e = new URIError ();
|
||||
assert (e.name === "URIError");
|
||||
assert (e.message === "");
|
||||
assert (e.toString() === "URIError");
|
||||
|
||||
e = new URIError("some message");
|
||||
assert (e.name === "URIError");
|
||||
assert (e.message === "some message");
|
||||
assert (e.toString() === "URIError: some message");
|
||||
|
||||
e.name = "";
|
||||
assert (e.toString() === "some message");
|
||||
e.message = "";
|
||||
assert (e.toString() === "");
|
||||
|
||||
assert (URIError.prototype.toString === Error.prototype.toString);
|
||||
assert (URIError.prototype.constructor === URIError);
|
||||
assert (URIError.prototype.name === "URIError");
|
||||
assert (URIError.prototype.message === "");
|
||||
assert (URIError.prototype.toString() === "URIError");
|
||||
|
||||
Reference in New Issue
Block a user