From cdde0900e3d95e0549450e0072507f3e3f249dd8 Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Tue, 15 Jul 2014 21:13:58 +0400 Subject: [PATCH] Introducing native ecma error types and ecma_NewStandardError interface. --- src/libecmaoperations/ecma-exceptions.c | 39 ++++++++++++++++++ src/libecmaoperations/ecma-exceptions.h | 53 +++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 src/libecmaoperations/ecma-exceptions.c create mode 100644 src/libecmaoperations/ecma-exceptions.h diff --git a/src/libecmaoperations/ecma-exceptions.c b/src/libecmaoperations/ecma-exceptions.c new file mode 100644 index 000000000..2f05938ea --- /dev/null +++ b/src/libecmaoperations/ecma-exceptions.c @@ -0,0 +1,39 @@ +/* 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-exceptions.h" +#include "ecma-globals.h" +#include "ecma-helpers.h" +#include "globals.h" + +/** \addtogroup ecma ---TODO--- + * @{ + */ + +/** + * \addtogroup exceptions Exceptions + * @{ + */ + +ecma_Object_t* +ecma_NewStandardError( ecma_StandardError_t error_type) +{ + JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( error_type); +} /* ecma_NewStandardError */ + +/** + * @} + * @} + */ diff --git a/src/libecmaoperations/ecma-exceptions.h b/src/libecmaoperations/ecma-exceptions.h new file mode 100644 index 000000000..5c3c2c9b6 --- /dev/null +++ b/src/libecmaoperations/ecma-exceptions.h @@ -0,0 +1,53 @@ +/* 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_EXCEPTIONS_H +#define ECMA_EXCEPTIONS_H + +#include "ecma-globals.h" +#include "globals.h" + +/** \addtogroup ecma ---TODO--- + * @{ + */ + +/** + * \addtogroup exceptions Exceptions + * @{ + */ + +/** + * Native errors. + * + * See also: 15.11.6 + */ +typedef enum +{ + ECMA_ERROR_EVAL, /**< EvalError */ + ECMA_ERROR_RANGE, /**< RangeError */ + ECMA_ERROR_REFERENCE, /**< ReferenceError */ + ECMA_ERROR_SYNTAX, /**< SyntaxError */ + ECMA_ERROR_TYPE, /**< TypeError */ + ECMA_ERROR_URI /**< URIError */ +} ecma_StandardError_t; + +extern ecma_Object_t *ecma_NewStandardError( ecma_StandardError_t error_type); + +/** + * @} + * @} + */ + +#endif /* !ECMA_EXCEPTIONS_H */