Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions jerry-core/api/jerry.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,9 +861,10 @@ jerry_module_get_namespace (const jerry_value_t module_val) /**< module */

if (module_p->namespace_object_p == NULL)
{
if (module_p->header.u.cls.u1.module_state != JERRY_MODULE_STATE_EVALUATED)
if (module_p->header.u.cls.u1.module_state < JERRY_MODULE_STATE_LINKED
|| module_p->header.u.cls.u1.module_state > JERRY_MODULE_STATE_EVALUATED)
{
return jerry_throw (ecma_raise_range_error (ECMA_ERR_MSG ("Namespace object has not been created yet")));
return jerry_throw (ecma_raise_range_error (ECMA_ERR_MSG ("Namespace object cannot be created")));
}

ecma_module_create_namespace_object (module_p);
Expand Down Expand Up @@ -1264,6 +1265,9 @@ static const uint8_t jerry_class_object_type[] =
#if JERRY_BUILTIN_TYPEDARRAY
JERRY_OBJECT_TYPE_TYPEDARRAY, /**< type of ECMA_OBJECT_CLASS_TYPEDARRAY */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_MODULE_SYSTEM
JERRY_OBJECT_TYPE_GENERIC, /**< type of ECMA_OBJECT_CLASS_MODULE_NAMESPACE */
#endif

/* These objects are marked by Garbage Collector. */
#if JERRY_ESNEXT
Expand Down Expand Up @@ -5130,9 +5134,7 @@ jerry_realm_set_this (jerry_value_t realm_value, /**< realm value */
ecma_global_object_t *global_object_p = (ecma_global_object_t *) object_p;
global_object_p->this_binding = this_value;

ecma_object_t *global_lex_env_p = ecma_create_object_lex_env (NULL,
ecma_get_object_from_value (this_value),
ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);
ecma_object_t *global_lex_env_p = ecma_create_object_lex_env (NULL, ecma_get_object_from_value (this_value));

ECMA_SET_NON_NULL_POINTER (global_object_p->global_env_cp, global_lex_env_p);
#if JERRY_ESNEXT
Expand Down
12 changes: 11 additions & 1 deletion jerry-core/ecma/base/ecma-errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,22 @@ const char * const ecma_error_local_variable_is_redeclared = "Local variable is
*/
const char * const ecma_error_expected_a_function = "Expected a function";

#if JERRY_ESNEXT

/**
* Error message, class constructor invoked without new keyword
*/
const char * const ecma_error_class_constructor_new = "Class constructor cannot be invoked without 'new'";

#endif /* JERRY_ERROR_MESSAGES */
/**
* Error message, variables declared by let/const must be initialized before reading their value
*/
const char * const ecma_error_let_const_not_initialized = ("Variables declared by let/const must be"
" initialized before reading their value");

#endif /* JERRY_ESNEXT */

#endif /* JERRY_ERROR_MESSAGES */

#if JERRY_SNAPSHOT_SAVE || JERRY_SNAPSHOT_EXEC

Expand Down
8 changes: 8 additions & 0 deletions jerry-core/ecma/base/ecma-errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#ifndef ECMA_ERRORS_H
#define ECMA_ERRORS_H

#if JERRY_ERROR_MESSAGES

extern const char * const ecma_error_value_msg_p;
extern const char * const ecma_error_wrong_args_msg_p;

Expand Down Expand Up @@ -65,7 +67,13 @@ extern const char * const ecma_error_argument_is_not_an_regexp;
extern const char * const ecma_error_invalid_array_length;
extern const char * const ecma_error_local_variable_is_redeclared;
extern const char * const ecma_error_expected_a_function;

#if JERRY_ESNEXT
extern const char * const ecma_error_class_constructor_new;
extern const char * const ecma_error_let_const_not_initialized;
#endif /* JERRY_ESNEXT */

#endif /* JERRY_ERROR_MESSAGES */

/* snapshot errors */
extern const char * const ecma_error_maximum_snapshot_size;
Expand Down
Loading