Skip to content

Codegen does not wrap ChainExpression in parentheses when it's left side of AssignmentExpression #6385

@overlookmotel

Description

@overlookmotel

Source:

(foo?.bar).qux = 1;

Output from codegen:

foo?.bar.qux = 1;

Playground

This output is not legal. "SyntaxError: Invalid left-hand side in assignment"

Same problem with (foo?.()).bar = 1.

Metadata

Metadata

Assignees

Labels

A-codegenArea - Code GenerationC-bugCategory - Bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions