Remove ecma_parse_options_t in favor of jerry_parse_options_t (#4713)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg 2021-07-15 13:44:52 +02:00 committed by GitHub
parent 305741a608
commit 4be05a74eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 59 deletions

View File

@ -797,12 +797,8 @@ jerry_generate_snapshot_with_args (const jerry_char_t *source_p, /**< script sou
status_flags |= (options_p->options & ECMA_PARSE_STRICT_MODE);
}
ecma_compiled_code_t *bytecode_data_p = parser_parse_script (args_p,
args_size,
source_p,
source_size,
status_flags,
(const ecma_parse_options_t *) options_p);
ecma_compiled_code_t *bytecode_data_p;
bytecode_data_p = parser_parse_script (args_p, args_size, source_p, source_size, status_flags, options_p);
if (JERRY_UNLIKELY (bytecode_data_p == NULL))
{

View File

@ -54,15 +54,6 @@
JERRY_STATIC_ASSERT (sizeof (jerry_value_t) == sizeof (ecma_value_t),
size_of_jerry_value_t_must_be_equal_to_size_of_ecma_value_t);
JERRY_STATIC_ASSERT ((int) ECMA_PARSE_STRICT_MODE == (int) JERRY_PARSE_STRICT_MODE
&& (int) ECMA_PARSE_MODULE == (int) JERRY_PARSE_MODULE
&& (int) ECMA_PARSE_HAS_RESOURCE == (int) JERRY_PARSE_HAS_RESOURCE
&& (int) ECMA_PARSE_HAS_START == (int) JERRY_PARSE_HAS_START,
ecma_parse_config_options_t_must_be_equal_to_jerry_parse_config_options_t);
JERRY_STATIC_ASSERT (sizeof (jerry_parse_options_t) == sizeof (ecma_parse_options_t),
ecma_parse_options_t_and_jerry_parse_options_t_must_be_the_same);
#if JERRY_BUILTIN_REGEXP
JERRY_STATIC_ASSERT ((int) RE_FLAG_GLOBAL == (int) JERRY_REGEXP_FLAG_GLOBAL
&& (int) RE_FLAG_MULTILINE == (int) JERRY_REGEXP_FLAG_MULTILINE
@ -439,12 +430,8 @@ jerry_parse (const jerry_char_t *source_p, /**< script source */
#endif /* JERRY_MODULE_SYSTEM */
}
ecma_compiled_code_t *bytecode_data_p = parser_parse_script (NULL,
0,
source_p,
source_size,
parse_opts,
(const ecma_parse_options_t *) options_p);
ecma_compiled_code_t *bytecode_data_p;
bytecode_data_p = parser_parse_script (NULL, 0, source_p, source_size, parse_opts, options_p);
if (JERRY_UNLIKELY (bytecode_data_p == NULL))
{
@ -540,12 +527,8 @@ jerry_parse_function (const jerry_char_t *arg_list_p, /**< script source */
arg_list_p = (const jerry_char_t *) "";
}
ecma_compiled_code_t *bytecode_p = parser_parse_script (arg_list_p,
arg_list_size,
source_p,
source_size,
parse_opts,
(const ecma_parse_options_t *) options_p);
ecma_compiled_code_t *bytecode_p;
bytecode_p = parser_parse_script (arg_list_p, arg_list_size, source_p, source_size, parse_opts, options_p);
if (JERRY_UNLIKELY (bytecode_p == NULL))
{

View File

@ -316,32 +316,6 @@ typedef struct ecma_native_pointer_chain_t
struct ecma_native_pointer_chain_t *next_p; /**< next in the list */
} ecma_native_pointer_chain_t;
/**
* Option bits for ecma_parse_options_t.
*/
typedef enum
{
/* bit 0: ECMA_PARSE_STRICT_MODE */
/* bit 1: ECMA_PARSE_MODULE */
ECMA_PARSE_HAS_RESOURCE = (1 << 2), /**< resource_name_p and resource_name_length fields are valid */
ECMA_PARSE_HAS_START = (1 << 3), /**< start_line and start_column fields are valid */
} ecma_parse_option_feature_t;
/**
* Variable configuration options for parsing functions such as ecma_parse or ecma_parse_function.
*/
typedef struct
{
uint32_t options; /**< combination of ecma_parse_option_feature_t values
* which enables parsing features */
const lit_utf8_byte_t *resource_name_p; /**< resource name (usually a file name)
* if ECMA_PARSE_HAS_RESOURCE is set in options */
size_t resource_name_length; /**< length of resource name
* if ECMA_PARSE_HAS_RESOURCE is set in options */
uint32_t start_line; /**< start line of the source code if ECMA_PARSE_HAS_START is set in options */
uint32_t start_column; /**< start column of the source code if ECMA_PARSE_HAS_START is set in options */
} ecma_parse_options_t;
#if JERRY_ESNEXT
/**

View File

@ -3703,9 +3703,9 @@ lexer_init_line_info (parser_context_t *context_p) /**< context */
context_p->line = 1;
context_p->column = 1;
const ecma_parse_options_t *options_p = context_p->options_p;
const jerry_parse_options_t *options_p = context_p->options_p;
if (options_p != NULL && (options_p->options & ECMA_PARSE_HAS_START))
if (options_p != NULL && (options_p->options & JERRY_PARSE_HAS_START))
{
context_p->line = (options_p->start_line > 0) ? options_p->start_line : 1;
context_p->column = (options_p->start_column > 0) ? options_p->start_column : 1;

View File

@ -546,7 +546,7 @@ typedef struct
uint32_t global_status_flags; /**< global status flags */
uint16_t stack_depth; /**< current stack depth */
uint16_t stack_limit; /**< maximum stack depth */
const ecma_parse_options_t *options_p; /**< parse options */
const jerry_parse_options_t *options_p; /**< parse options */
parser_saved_context_t *last_context_p; /**< last saved context */
parser_stack_iterator_t last_statement; /**< last statement position */

View File

@ -1795,7 +1795,7 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
const uint8_t *source_p, /**< valid UTF-8 source code */
size_t source_size, /**< size of the source code */
uint32_t parse_opts, /**< ecma_parse_opts_t option bits */
const ecma_parse_options_t *options_p) /**< additional configuration options */
const jerry_parse_options_t *options_p) /**< additional configuration options */
{
parser_context_t context;
ecma_compiled_code_t *compiled_code_p;
@ -2858,7 +2858,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
const uint8_t *source_p, /**< source code */
size_t source_size, /**< size of the source code */
uint32_t parse_opts, /**< ecma_parse_opts_t option bits */
const ecma_parse_options_t *options_p) /**< additional configuration options */
const jerry_parse_options_t *options_p) /**< additional configuration options */
{
#if JERRY_PARSER

View File

@ -195,7 +195,7 @@ typedef uint32_t parser_line_counter_t;
ecma_compiled_code_t *
parser_parse_script (const uint8_t *arg_list_p, size_t arg_list_size,
const uint8_t *source_p, size_t source_size,
uint32_t parse_opts, const ecma_parse_options_t *options_p);
uint32_t parse_opts, const jerry_parse_options_t *options_p);
#if JERRY_ERROR_MESSAGES
const char *parser_error_to_string (parser_error_t);