I'm pretty sure that SimpleAssign is only created when the left-hand side is a StaticAssignable (e.g., Var, Const, or Underscore). If the target is a pattern, then it becomes a MatchAssign, and if it is some method chain (e.g. x.y = 2), then it is converted into a Call to the y= method with x as the receiver.
With that, I think that the target property of SimpleAssign nodes can be restricted from Node to StaticAssignable. That guarantee is helpful when doing semantic analysis (i.e., myst-typecheck :) and avoids the need to downcast it whenever it is referenced.
I'm pretty sure that
SimpleAssign
is only created when the left-hand side is aStaticAssignable
(e.g.,Var
,Const
, orUnderscore
). If the target is a pattern, then it becomes aMatchAssign
, and if it is some method chain (e.g.x.y = 2
), then it is converted into aCall
to they=
method withx
as the receiver.With that, I think that the
target
property ofSimpleAssign
nodes can be restricted fromNode
toStaticAssignable
. That guarantee is helpful when doing semantic analysis (i.e.,myst-typecheck
:) and avoids the need to downcast it whenever it is referenced.