diff options
author | Dániel Bátyai <dbatyai@inf.u-szeged.hu> | 2021-12-06 10:20:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-06 10:20:09 +0100 |
commit | 9860d66a56ed44f62e1dafb9900e6f2c886a56d3 (patch) | |
tree | fd96679ecb136c3fe03711811d2b655e92cbca43 /jerry-core/parser/js/js-parser.c | |
parent | 81d2319144377f87e716c73a9b8b46f2bf5d09e5 (diff) |
Rework the public API (#4829)
Related to #4186.
Some notable changes:
- The term 'Error' now strictly refers to native Error objects defined in
the ECMA standard, which are ordinary objects. All other uses of
'error' or 'error reference' where the term refers to a thrown value is
now called 'exception'.
- Simplified the naming scheme of many String API functions. These functions
will now also take an 'encoding' argument to specify the desired
encoding in which to operate.
- Removed the substring-copy-to-buffer functions. These functions
behaved awkwardly, as they use character index to specify the
start/end positions, and were mostly used incorrectly with byte
offsets instead. The functionality can still be replicated with
other functions if necessary.
- String-to-buffer functions will no longer fail if the buffer is not
sufficiently large, the string will instead be cropped.
- Fixed the usage of the '_sz' prefix in many API functions. The term
'sz' means zero-terminated string in hungarian notation, this was
used incorrectly in many cases.
- Renamed most of the public API functions to have shorter, more on-point
names, rather than the often too long descriptive names. Functions are now
also grouped by the type of value they operate on, where this makes
sense.
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
Diffstat (limited to 'jerry-core/parser/js/js-parser.c')
-rw-r--r-- | jerry-core/parser/js/js-parser.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/jerry-core/parser/js/js-parser.c b/jerry-core/parser/js/js-parser.c index b55baed5..0640a9f6 100644 --- a/jerry-core/parser/js/js-parser.c +++ b/jerry-core/parser/js/js-parser.c @@ -2109,18 +2109,18 @@ parser_parse_source (void *source_p, /**< source code */ } #if JERRY_RESOURCE_NAME - ecma_value_t resource_name = ecma_make_magic_string_value (LIT_MAGIC_STRING_RESOURCE_ANON); + ecma_value_t source_name = ecma_make_magic_string_value (LIT_MAGIC_STRING_RESOURCE_ANON); - if (context.options_p != NULL && (context.options_p->options & JERRY_PARSE_HAS_RESOURCE)) + if (context.options_p != NULL && (context.options_p->options & JERRY_PARSE_HAS_SOURCE_NAME)) { - JERRY_ASSERT (ecma_is_value_string (context.options_p->resource_name)); + JERRY_ASSERT (ecma_is_value_string (context.options_p->source_name)); - ecma_ref_ecma_string (ecma_get_string_from_value (context.options_p->resource_name)); - resource_name = context.options_p->resource_name; + ecma_ref_ecma_string (ecma_get_string_from_value (context.options_p->source_name)); + source_name = context.options_p->source_name; } else if (context.global_status_flags & ECMA_PARSE_EVAL) { - resource_name = ecma_make_magic_string_value (LIT_MAGIC_STRING_RESOURCE_EVAL); + source_name = ecma_make_magic_string_value (LIT_MAGIC_STRING_RESOURCE_EVAL); } #endif /* JERRY_RESOURCE_NAME */ @@ -2263,7 +2263,7 @@ parser_parse_source (void *source_p, /**< source code */ #endif /* JERRY_BUILTIN_REALMS */ #if JERRY_RESOURCE_NAME - context.script_p->resource_name = resource_name; + context.script_p->source_name = source_name; #endif /* JERRY_RESOURCE_NAME */ ECMA_SET_INTERNAL_VALUE_POINTER (context.script_value, context.script_p); @@ -2431,7 +2431,7 @@ parser_parse_source (void *source_p, /**< source code */ parser_cbc_stream_free (&context.byte_code); #if JERRY_RESOURCE_NAME - ecma_deref_ecma_string (ecma_get_string_from_value (context.script_p->resource_name)); + ecma_deref_ecma_string (ecma_get_string_from_value (context.script_p->source_name)); #endif /* JERRY_RESOURCE_NAME */ if (context.script_p != NULL) @@ -2515,7 +2515,7 @@ parser_parse_source (void *source_p, /**< source code */ ecma_raise_standard_error_with_format (JERRY_ERROR_SYNTAX, "% [%:%:%]", err_str_val, - resource_name, + source_name, line_str_val, col_str_val); @@ -3361,7 +3361,7 @@ parser_parse_script (void *source_p, /**< source code */ JERRY_UNUSED (source_p); JERRY_UNUSED (source_size); JERRY_UNUSED (parse_opts); - JERRY_UNUSED (resource_name); + JERRY_UNUSED (source_name); ecma_raise_syntax_error (ECMA_ERR_PARSER_NOT_SUPPORTED); return NULL; |