mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Fix incorrect error generated for shorthand properties with initializers
Former-commit-id: 3637987b9ba42805c60ed664769e8fc46fa524f1
This commit is contained in:
@@ -7780,9 +7780,13 @@ pub fn NewParser(
|
||||
// Destructuring patterns have an optional default value
|
||||
var initializer: ?Expr = null;
|
||||
if (errors != null and p.lexer.token == .t_equals) {
|
||||
(errors orelse unreachable).invalid_expr_default_value = p.lexer.range();
|
||||
const invalid_expr_default_value_range = p.lexer.range();
|
||||
try p.lexer.next();
|
||||
initializer = try p.parseExpr(.comma);
|
||||
// ({foo: 1 = })
|
||||
// ^ is invalid
|
||||
// but it's only invalid if we're missing an expression here.
|
||||
if (initializer == null) errors.?.invalid_expr_default_value = invalid_expr_default_value_range;
|
||||
}
|
||||
|
||||
return G.Property{
|
||||
|
||||
Reference in New Issue
Block a user