diff --git a/jerry-core/parser/js/js-parser-statm.c b/jerry-core/parser/js/js-parser-statm.c
index c29bc234bf..cbacf63dfd 100644
--- a/jerry-core/parser/js/js-parser-statm.c
+++ b/jerry-core/parser/js/js-parser-statm.c
@@ -2535,8 +2535,11 @@ parser_parse_import_statement (parser_context_t *context_p) /**< parser context
/**
* Parse export statement.
+ *
+ * @return true - if function of class statement was found
+ * false - otherwise
*/
-static void
+static bool
parser_parse_export_statement (parser_context_t *context_p) /**< context */
{
JERRY_ASSERT (context_p->token.type == LEXER_KEYW_EXPORT);
@@ -2545,6 +2548,8 @@ parser_parse_export_statement (parser_context_t *context_p) /**< context */
context_p->module_current_node_p = parser_module_create_module_node (context_p);
+ bool consume_last_statement = false;
+
lexer_next_token (context_p);
switch (context_p->token.type)
{
@@ -2556,15 +2561,26 @@ parser_parse_export_statement (parser_context_t *context_p) /**< context */
context_p->status_flags |= PARSER_MODULE_STORE_IDENT;
lexer_next_token (context_p);
+
+ if (context_p->token.type == LEXER_LITERAL
+ && lexer_token_is_async (context_p)
+ && context_p->next_scanner_info_p->source_p == context_p->source_p
+ && context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION)
+ {
+ lexer_next_token (context_p);
+ }
+
if (context_p->token.type == LEXER_KEYW_CLASS)
{
context_p->status_flags |= PARSER_MODULE_DEFAULT_CLASS_OR_FUNC;
parser_parse_class (context_p, true);
+ consume_last_statement = true;
}
else if (context_p->token.type == LEXER_KEYW_FUNCTION)
{
context_p->status_flags |= PARSER_MODULE_DEFAULT_CLASS_OR_FUNC;
parser_parse_function_statement (context_p);
+ consume_last_statement = true;
}
else
{
@@ -2627,12 +2643,14 @@ parser_parse_export_statement (parser_context_t *context_p) /**< context */
{
context_p->status_flags |= PARSER_MODULE_STORE_IDENT;
parser_parse_class (context_p, true);
+ consume_last_statement = true;
break;
}
case LEXER_KEYW_FUNCTION:
{
context_p->status_flags |= PARSER_MODULE_STORE_IDENT;
parser_parse_function_statement (context_p);
+ consume_last_statement = true;
break;
}
case LEXER_LEFT_BRACE:
@@ -2656,6 +2674,8 @@ parser_parse_export_statement (parser_context_t *context_p) /**< context */
context_p->status_flags &= (uint32_t) ~(PARSER_MODULE_DEFAULT_CLASS_OR_FUNC | PARSER_MODULE_STORE_IDENT);
parser_module_finalize_export_node (context_p);
context_p->module_current_node_p = NULL;
+
+ return consume_last_statement;
} /* parser_parse_export_statement */
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
@@ -2948,7 +2968,10 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
case LEXER_KEYW_EXPORT:
{
- parser_parse_export_statement (context_p);
+ if (parser_parse_export_statement (context_p))
+ {
+ goto consume_last_statement;
+ }
break;
}
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
diff --git a/jerry-core/parser/js/js-scanner-internal.h b/jerry-core/parser/js/js-scanner-internal.h
index d27d791a9c..4f075c88fe 100644
--- a/jerry-core/parser/js/js-scanner-internal.h
+++ b/jerry-core/parser/js/js-scanner-internal.h
@@ -119,6 +119,9 @@ typedef enum
SCAN_STACK_FOR_START_PATTERN, /**< possible assignment pattern for "for" iterator */
SCAN_STACK_USE_ASYNC, /**< an "async" identifier is used */
#endif /* ENABLED (JERRY_ESNEXT) */
+#if ENABLED (JERRY_MODULE_SYSTEM)
+ SCAN_STACK_EXPORT_DEFAULT, /**< scan primary expression after export default */
+#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
} scan_stack_modes_t;
/**
@@ -337,11 +340,6 @@ typedef enum
#define SCANNER_LITERAL_POOL_MAY_HAVE_ARGUMENTS(status_flags) \
(!((status_flags) & (SCANNER_LITERAL_POOL_CLASS_NAME | SCANNER_LITERAL_POOL_CLASS_FIELD)))
-/**
- * The class name is the *default* class name
- */
-#define SCANNER_LITERAL_POOL_DEFAULT_CLASS_NAME SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE
-
#else /* !ENABLED (JERRY_ESNEXT) */
/**
diff --git a/jerry-core/parser/js/js-scanner-util.c b/jerry-core/parser/js/js-scanner-util.c
index 6dc0f4285d..f250d49f24 100644
--- a/jerry-core/parser/js/js-scanner-util.c
+++ b/jerry-core/parser/js/js-scanner-util.c
@@ -640,19 +640,6 @@ scanner_pop_literal_pool (parser_context_t *context_p, /**< context */
parser_list_iterator_init (&literal_pool_p->literal_pool, &literal_iterator);
-#if ENABLED (JERRY_ESNEXT)
- if (JERRY_UNLIKELY (status_flags & SCANNER_LITERAL_POOL_CLASS_NAME))
- {
- literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator);
-
- if ((literal_p != NULL || (status_flags & SCANNER_LITERAL_POOL_DEFAULT_CLASS_NAME))
- && no_declarations < PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK)
- {
- no_declarations++;
- }
- }
-#endif /* ENABLED (JERRY_ESNEXT) */
-
uint8_t arguments_stream_type = SCANNER_STREAM_TYPE_ARGUMENTS;
const uint8_t *prev_source_p = literal_pool_p->source_p - 1;
lexer_lit_location_t *last_argument_p = NULL;
@@ -1702,15 +1689,40 @@ scanner_push_class_declaration (parser_context_t *context_p, /**< context */
const uint8_t *source_p = context_p->source_p;
lexer_lit_location_t *literal_p = NULL;
+#if ENABLED (JERRY_MODULE_SYSTEM)
+ bool is_export_default = context_p->stack_top_uint8 == SCAN_STACK_EXPORT_DEFAULT;
+ JERRY_ASSERT (!is_export_default || stack_mode == SCAN_STACK_CLASS_EXPRESSION);
+#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
+
parser_stack_push_uint8 (context_p, stack_mode);
lexer_next_token (context_p);
bool class_has_name = (context_p->token.type == LEXER_LITERAL
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
- if (stack_mode == SCAN_STACK_CLASS_STATEMENT && class_has_name)
+ if (class_has_name)
{
- literal_p = scanner_add_literal (context_p, scanner_context_p);
+ if (stack_mode == SCAN_STACK_CLASS_STATEMENT)
+ {
+ literal_p = scanner_add_literal (context_p, scanner_context_p);
+ scanner_context_p->active_literal_pool_p->no_declarations++;
+ }
+#if ENABLED (JERRY_MODULE_SYSTEM)
+ else if (is_export_default)
+ {
+ literal_p = scanner_add_literal (context_p, scanner_context_p);
+ scanner_context_p->active_literal_pool_p->no_declarations++;
+
+ scanner_detect_invalid_let (context_p, literal_p);
+
+ if (literal_p->type & SCANNER_LITERAL_IS_USED)
+ {
+ literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;
+ }
+
+ literal_p->type |= SCANNER_LITERAL_IS_LET | SCANNER_LITERAL_NO_REG;
+ }
+#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
}
scanner_literal_pool_t *literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, 0);
@@ -1718,7 +1730,20 @@ scanner_push_class_declaration (parser_context_t *context_p, /**< context */
if (class_has_name)
{
scanner_add_literal (context_p, scanner_context_p);
+ scanner_context_p->active_literal_pool_p->no_declarations++;
}
+#if ENABLED (JERRY_MODULE_SYSTEM)
+ else if (is_export_default)
+ {
+ lexer_lit_location_t *name_literal_p;
+ name_literal_p = scanner_add_custom_literal (context_p,
+ scanner_context_p->active_literal_pool_p->prev_p,
+ &lexer_default_literal);
+
+ name_literal_p->type |= SCANNER_LITERAL_IS_LET | SCANNER_LITERAL_NO_REG;
+ scanner_context_p->active_literal_pool_p->no_declarations++;
+ }
+#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
literal_pool_p->source_p = source_p;
literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_CLASS_NAME;
diff --git a/jerry-core/parser/js/js-scanner.c b/jerry-core/parser/js/js-scanner.c
index 2d253f506f..b70e5ce33d 100644
--- a/jerry-core/parser/js/js-scanner.c
+++ b/jerry-core/parser/js/js-scanner.c
@@ -101,6 +101,9 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
case LEXER_KEYW_FUNCTION:
{
uint16_t status_flags = SCANNER_LITERAL_POOL_FUNCTION;
+#if ENABLED (JERRY_MODULE_SYSTEM)
+ bool is_export_default = stack_top == SCAN_STACK_EXPORT_DEFAULT;
+#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#if ENABLED (JERRY_ESNEXT)
if (scanner_context_p->async_source_p != NULL)
@@ -121,8 +124,30 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
if (context_p->token.type == LEXER_LITERAL
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
+#if ENABLED (JERRY_MODULE_SYSTEM)
+ if (is_export_default)
+ {
+ lexer_lit_location_t *location_p;
+ location_p = scanner_add_custom_literal (context_p,
+ scanner_context_p->active_literal_pool_p->prev_p,
+ &context_p->token.lit_location);
+
+ scanner_detect_invalid_let (context_p, location_p);
+ location_p->type |= SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_LET;
+ }
+#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
lexer_next_token (context_p);
}
+#if ENABLED (JERRY_MODULE_SYSTEM)
+ else if (is_export_default)
+ {
+ lexer_lit_location_t *location_p;
+ location_p = scanner_add_custom_literal (context_p,
+ scanner_context_p->active_literal_pool_p->prev_p,
+ &lexer_default_literal);
+ location_p->type |= SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_LET;
+ }
+#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_EXPRESSION);
scanner_context_p->mode = SCAN_MODE_FUNCTION_ARGUMENTS;
@@ -179,7 +204,8 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
scanner_scan_simple_arrow (context_p, scanner_context_p, source_p);
return SCAN_KEEP_TOKEN;
}
- else if (JERRY_UNLIKELY (lexer_token_is_async (context_p)))
+
+ if (JERRY_UNLIKELY (lexer_token_is_async (context_p)))
{
scanner_context_p->async_source_p = source_p;
scanner_check_async_function (context_p, scanner_context_p);
@@ -189,6 +215,17 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
if (context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
+#if ENABLED (JERRY_MODULE_SYSTEM)
+ if (stack_top == SCAN_STACK_EXPORT_DEFAULT)
+ {
+ lexer_lit_location_t *location_p = scanner_add_literal (context_p, scanner_context_p);
+ location_p->type |= (SCANNER_LITERAL_IS_USED | SCANNER_LITERAL_IS_VAR);
+ scanner_detect_eval_call (context_p, scanner_context_p);
+ scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;
+ break;
+ }
+#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
+
scanner_add_reference (context_p, scanner_context_p);
}
/* FALLTHRU */
@@ -1804,84 +1841,9 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
if (context_p->token.type == LEXER_KEYW_DEFAULT)
{
lexer_next_token (context_p);
-
- if (context_p->token.type == LEXER_KEYW_FUNCTION)
- {
- lexer_next_token (context_p);
- if (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
- {
- lexer_lit_location_t *location_p = scanner_add_literal (context_p, scanner_context_p);
-
- if (location_p->type & SCANNER_LITERAL_IS_LOCAL
- && !(location_p->type & SCANNER_LITERAL_IS_FUNC))
- {
- scanner_raise_redeclaration_error (context_p);
- }
- location_p->type |= SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_LET;
-
- lexer_next_token (context_p);
- }
- else
- {
- lexer_lit_location_t *location_p;
- location_p = scanner_add_custom_literal (context_p,
- scanner_context_p->active_literal_pool_p,
- &lexer_default_literal);
- location_p->type |= SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_LET;
- }
-
- scanner_push_literal_pool (context_p, scanner_context_p, SCANNER_LITERAL_POOL_FUNCTION);
-
- parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_STATEMENT);
- scanner_context_p->mode = SCAN_MODE_FUNCTION_ARGUMENTS;
- return SCAN_KEEP_TOKEN;
- }
-
- if (context_p->token.type == LEXER_KEYW_CLASS)
- {
- lexer_lit_location_t *literal_p;
- literal_p = scanner_push_class_declaration (context_p, scanner_context_p, SCAN_STACK_CLASS_STATEMENT);
-
- if (literal_p != NULL)
- {
- scanner_detect_invalid_let (context_p, literal_p);
-
- if (literal_p->type & SCANNER_LITERAL_IS_USED)
- {
- literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;
- }
-
- literal_p->type |= SCANNER_LITERAL_IS_LET | SCANNER_LITERAL_NO_REG;
- return SCAN_NEXT_TOKEN;
- }
-
- literal_p = scanner_add_custom_literal (context_p,
- scanner_context_p->active_literal_pool_p,
- &lexer_default_literal);
-
- literal_p->type |= SCANNER_LITERAL_IS_LET | SCANNER_LITERAL_NO_REG;
- scanner_context_p->active_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_DEFAULT_CLASS_NAME;
- return SCAN_KEEP_TOKEN;
- }
-
- /* Assignment expression. */
- lexer_lit_location_t *location_p;
- location_p = scanner_add_custom_literal (context_p,
- scanner_context_p->active_literal_pool_p,
- &lexer_default_literal);
- location_p->type |= SCANNER_LITERAL_IS_VAR;
+ parser_stack_push_uint8 (context_p, SCAN_STACK_EXPORT_DEFAULT);
scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;
-
- if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
- {
- return SCAN_KEEP_TOKEN;
- }
-
- location_p = scanner_add_literal (context_p, scanner_context_p);
- location_p->type |= SCANNER_LITERAL_IS_VAR;
- scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;
- return SCAN_NEXT_TOKEN;
+ return SCAN_KEEP_TOKEN;
}
scanner_context_p->mode = SCAN_MODE_STATEMENT_END;
@@ -2152,6 +2114,16 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */
scanner_pop_literal_pool (context_p, scanner_context_p);
parser_stack_pop_uint8 (context_p);
+
+#if ENABLED (JERRY_MODULE_SYSTEM)
+ if (context_p->stack_top_uint8 == SCAN_STACK_EXPORT_DEFAULT)
+ {
+ terminator_found = true;
+ parser_stack_pop_uint8 (context_p);
+ lexer_next_token (context_p);
+ continue;
+ }
+#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
return SCAN_NEXT_TOKEN;
}
case SCAN_STACK_FUNCTION_PROPERTY:
@@ -2306,6 +2278,17 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */
continue;
}
#endif /* ENABLED (JERRY_ESNEXT) */
+#if ENABLED (JERRY_MODULE_SYSTEM)
+ case SCAN_STACK_EXPORT_DEFAULT:
+ {
+ parser_stack_pop_uint8 (context_p);
+ lexer_lit_location_t *location_p = scanner_add_custom_literal (context_p,
+ scanner_context_p->active_literal_pool_p,
+ &lexer_default_literal);
+ location_p->type |= SCANNER_LITERAL_IS_VAR;
+ continue;
+ }
+#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
default:
{
JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_TRY_STATEMENT
@@ -2617,6 +2600,16 @@ scanner_scan_all (parser_context_t *context_p, /**< context */
scanner_context.mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;
parser_stack_pop_uint8 (context_p);
+
+#if ENABLED (JERRY_MODULE_SYSTEM)
+ if (context_p->stack_top_uint8 == SCAN_STACK_EXPORT_DEFAULT)
+ {
+ /* The token is kept to disallow consuming a semicolon after it. */
+ parser_stack_change_last_uint8 (context_p, SCAN_STACK_CLASS_STATEMENT);
+ scanner_context.mode = SCAN_MODE_STATEMENT_END;
+ continue;
+ }
+#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
break;
}
diff --git a/tests/jerry/es.next/module-export-01.mjs b/tests/jerry/es.next/module-export-01.mjs
index 90bfff549a..400f174c6e 100644
--- a/tests/jerry/es.next/module-export-01.mjs
+++ b/tests/jerry/es.next/module-export-01.mjs
@@ -17,8 +17,8 @@ export {};
export {a as aa,};
export {b as bb, c as cc};
export {d};
-export var x = 42;
-export function f(a) {return a;};
+export var x = 40;
+export function f(a) {return a;} x++; /* test auto semicolon insertion */
export class Dog {
constructor (name) {
this.name = name;
@@ -27,7 +27,7 @@ export class Dog {
speak() {
return this.name + " barks."
}
-};
+} x++; /* test auto semicolon insertion */
export default "default";
var a = "a";
diff --git a/tests/jerry/es.next/module-export-default-1.mjs b/tests/jerry/es.next/module-export-default-1.mjs
new file mode 100644
index 0000000000..4b0062b076
--- /dev/null
+++ b/tests/jerry/es.next/module-export-default-1.mjs
@@ -0,0 +1,17 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// 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.
+
+let counter = 0.1;
+export default function* g() { return "foo1"; } counter++; /* test auto semicolon insertion */
+export {counter};
diff --git a/tests/jerry/es.next/module-export-default-2.mjs b/tests/jerry/es.next/module-export-default-2.mjs
new file mode 100644
index 0000000000..8514080c5b
--- /dev/null
+++ b/tests/jerry/es.next/module-export-default-2.mjs
@@ -0,0 +1,17 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// 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.
+
+let counter = 1.1;
+export default async function* g() { return "foo2"; } counter++; /* test auto semicolon insertion */
+export {counter};
diff --git a/tests/jerry/es.next/module-export-default-3.mjs b/tests/jerry/es.next/module-export-default-3.mjs
new file mode 100644
index 0000000000..50aa771172
--- /dev/null
+++ b/tests/jerry/es.next/module-export-default-3.mjs
@@ -0,0 +1,17 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// 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.
+
+let counter = 2.1;
+export default async function g() { return "foo3"; } counter++; /* test auto semicolon insertion */
+export {counter};
diff --git a/tests/jerry/es.next/module-export-default-4.mjs b/tests/jerry/es.next/module-export-default-4.mjs
new file mode 100644
index 0000000000..213bed03f3
--- /dev/null
+++ b/tests/jerry/es.next/module-export-default-4.mjs
@@ -0,0 +1,17 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// 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.
+
+var async = "foo4";
+
+export default async;
diff --git a/tests/jerry/es.next/module-export-default-5.mjs b/tests/jerry/es.next/module-export-default-5.mjs
new file mode 100644
index 0000000000..9abf8f7f4e
--- /dev/null
+++ b/tests/jerry/es.next/module-export-default-5.mjs
@@ -0,0 +1,15 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// 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.
+
+export default _ => "foo5";
diff --git a/tests/jerry/es.next/module-export-default-6.mjs b/tests/jerry/es.next/module-export-default-6.mjs
new file mode 100644
index 0000000000..b462fa55e5
--- /dev/null
+++ b/tests/jerry/es.next/module-export-default-6.mjs
@@ -0,0 +1,15 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// 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.
+
+export default async _ => "foo6";
diff --git a/tests/jerry/es.next/module-export-default-7.mjs b/tests/jerry/es.next/module-export-default-7.mjs
new file mode 100644
index 0000000000..53dbd458b9
--- /dev/null
+++ b/tests/jerry/es.next/module-export-default-7.mjs
@@ -0,0 +1,15 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// 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.
+
+export default async (a, b) => a + b;
diff --git a/tests/jerry/es.next/module-export-default-8.mjs b/tests/jerry/es.next/module-export-default-8.mjs
new file mode 100644
index 0000000000..e4cfce1eab
--- /dev/null
+++ b/tests/jerry/es.next/module-export-default-8.mjs
@@ -0,0 +1,17 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// 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.
+
+let counter = 7.1;
+export default class A { static x = "foo8" } counter++; /* test auto semicolon insertion */
+export {counter};
diff --git a/tests/jerry/es.next/module-export-default-9.mjs b/tests/jerry/es.next/module-export-default-9.mjs
new file mode 100644
index 0000000000..3e8b8c2a55
--- /dev/null
+++ b/tests/jerry/es.next/module-export-default-9.mjs
@@ -0,0 +1,17 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// 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.
+
+let counter = 8.1;
+export default class { static x = "foo9" } counter++; /* test auto semicolon insertion */
+export {counter};
diff --git a/tests/jerry/es.next/module-export-default-main.mjs b/tests/jerry/es.next/module-export-default-main.mjs
new file mode 100644
index 0000000000..999ef826e0
--- /dev/null
+++ b/tests/jerry/es.next/module-export-default-main.mjs
@@ -0,0 +1,83 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// 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.
+
+import foo1, { counter as bar1 } from "./module-export-default-1.mjs"
+import foo2, { counter as bar2 } from "./module-export-default-2.mjs"
+import foo3, { counter as bar3 } from "./module-export-default-3.mjs"
+import foo4 from "./module-export-default-4.mjs"
+import foo5 from "./module-export-default-5.mjs"
+import foo6 from "./module-export-default-6.mjs"
+import foo7 from "./module-export-default-7.mjs"
+import foo8, { counter as bar8 } from "./module-export-default-8.mjs"
+import foo9, { counter as bar9 } from "./module-export-default-9.mjs"
+
+let async_queue_expected = ["foo2", "foo3", "foo6", "foo7"];
+let async_queue = [];
+
+(function() {
+ assert(foo1().next().value === "foo1");
+ assert(bar1 === 1.1);
+})();
+
+(async function() {
+ async_queue.push((await foo2().next()).value);
+ assert(bar2 === 2.1);
+})();
+
+(async function() {
+ async_queue.push(await foo3());
+ assert(bar3 === 3.1);
+})();
+
+(function() {
+ assert(foo4 === "foo4");
+})();
+
+(function() {
+ assert(foo5() === "foo5");
+})();
+
+(async function() {
+ async_queue.push(await foo6());
+})();
+
+(async function() {
+ async_queue.push(await foo7("foo", "7"));
+})();
+
+(function() {
+ assert(foo8.x === "foo8");
+ assert(bar8 === 8.1);
+})();
+
+(function() {
+ assert(foo9.x === "foo9");
+ assert(bar9 === 9.1);
+})();
+
+Array.prototype.assertArrayEqual = function(expected) {
+ assert(this.length === expected.length);
+ print(this);
+ print(expected);
+
+ for (var i = 0; i < this.length; i++) {
+ assert(this[i] === expected[i]);
+ }
+}
+
+let global = new Function('return this;')();
+
+global.__checkAsync = function() {
+ async_queue.assertArrayEqual(async_queue_expected);
+}
diff --git a/tests/jerry/fail/module-export-default-arrow.mjs b/tests/jerry/fail/module-export-default-arrow.mjs
new file mode 100644
index 0000000000..c26f7d28d4
--- /dev/null
+++ b/tests/jerry/fail/module-export-default-arrow.mjs
@@ -0,0 +1,15 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// 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.
+
+export default () => 1, 5;
diff --git a/tests/test262-esnext-excludelist.xml b/tests/test262-esnext-excludelist.xml
index bc584442a5..454453a80e 100644
--- a/tests/test262-esnext-excludelist.xml
+++ b/tests/test262-esnext-excludelist.xml
@@ -390,11 +390,8 @@
-
-
-
@@ -405,12 +402,6 @@
-
-
-
-
-
-