Support resource name and user value for implicit class constructors (#4771)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-09-17 16:28:10 +02:00
committed by GitHub
parent 430289b27d
commit 053bfa0f9f
13 changed files with 471 additions and 327 deletions
+21
View File
@@ -214,6 +214,27 @@ main (void)
jerry_release_value (parse_options.resource_name);
jerry_release_value (program);
const char *source_6 = "(class {})";
parse_options.options = JERRY_PARSE_HAS_RESOURCE;
parse_options.resource_name = jerry_create_string ((jerry_char_t *) "demo6.js");
program = jerry_parse ((const jerry_char_t *) source_6,
strlen (source_6),
&parse_options);
if (!jerry_value_is_error (program))
{
resource_value = jerry_get_resource_name (program);
compare_result = jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL, resource_value, parse_options.resource_name);
TEST_ASSERT (jerry_value_is_true (compare_result));
jerry_release_value (resource_value);
jerry_release_value (compare_result);
}
jerry_release_value (parse_options.resource_name);
jerry_release_value (program);
jerry_cleanup ();
return 0;
+8
View File
@@ -138,6 +138,14 @@ main (void)
parse_options.options = JERRY_PARSE_HAS_USER_VALUE;
test_parse_function (source_p, &parse_options, true);
/* There is no test for ESNEXT, using SYMBOL instead. */
if (jerry_is_feature_enabled (JERRY_FEATURE_SYMBOL))
{
source_p = TEST_STRING_LITERAL ("(class {})");
parse_options.options = JERRY_PARSE_HAS_USER_VALUE;
test_parse (source_p, &parse_options, true);
}
source_p = TEST_STRING_LITERAL ("eval('function f() {}')\n"
"f");
parse_options.options = JERRY_PARSE_HAS_USER_VALUE;