Assign should be split into two distinct types
RReverser opened this issue · 0 comments
RReverser commented
Assign is currently too overloaded. One case is simple assignment:
x = 1
[a,b,c] = arr
where LHS is Patt
- identifier, property, object or array pattern are all allowed
and another case is binary-operation-based assignment:
x += 10
where only AssignTarget
- simple LHS (identifier or property) is allowed.
I think it makes sense to split Assign
into SimpleAssign(Patt<AssignTarget>, Box<Expr>)
and BinaryAssign(Binop, Box<Expr>)
(names are up to discussion).