aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/js_parser/js_parser.zig3
-rw-r--r--src/test/fixtures/module_exports_with_default_values.js1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/js_parser/js_parser.zig b/src/js_parser/js_parser.zig
index c341300c7..5087ec371 100644
--- a/src/js_parser/js_parser.zig
+++ b/src/js_parser/js_parser.zig
@@ -7767,7 +7767,8 @@ pub fn NewParser(
key = p.e(E.String{ .utf8 = name }, name_range.loc);
// Parse a shorthand property
- if (!opts.is_class and kind == .normal and p.lexer.token != .t_colon and p.lexer.token != .t_open_paren and p.lexer.token != .t_less_than and !opts.is_generator and !js_lexer.Keywords.has(name)) {
+ const isShorthandProperty = (!opts.is_class and kind == .normal and p.lexer.token != .t_colon and p.lexer.token != .t_open_paren and p.lexer.token != .t_less_than and !opts.is_generator and !opts.is_async and !js_lexer.Keywords.has(name));
+ if (isShorthandProperty) {
if ((p.fn_or_arrow_data_parse.allow_await != .allow_ident and strings.eqlComptime(name, "await")) or (p.fn_or_arrow_data_parse.allow_yield != .allow_ident and strings.eqlComptime(name, "yield"))) {
// TODO: add fmt to addRangeError
p.log.addRangeError(p.source, name_range, "Cannot use \"yield\" or \"await\" here.") catch unreachable;
diff --git a/src/test/fixtures/module_exports_with_default_values.js b/src/test/fixtures/module_exports_with_default_values.js
new file mode 100644
index 000000000..56669f109
--- /dev/null
+++ b/src/test/fixtures/module_exports_with_default_values.js
@@ -0,0 +1 @@
+module.exports = ({ level = "info", debug = false, console }) => {};