Skip to content

Unexpected token when parsing a member expression after a property initializer in an object pattern #10989

@JLHwung

Description

@JLHwung

Bug Report

  • I would like to work on a fix!

Current Behavior
A clear and concise description of the behavior.

The following snippet will throw SyntaxError: Unexpected token, expected ","
Input Code

  • REPL or Repo link if applicable: REPL
({ a = 42, b: {}.d } = {})

Expected behavior/code
It should parse successfully.

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc): No plugin.

Environment
REPL

Possible Solution
We may reset refExpressionErrors.shortAssign when parsing Assignment Expression after eating tt.colon in parseObjectProperty.

: this.parseMaybeAssign(false, refExpressionErrors);

Metadata

Metadata

Assignees

Labels

Has PRclaimedoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions