def assignable(node)
case node.type
when :cvar
node.updated(:cvasgn)
when :ivar
node.updated(:ivasgn)
when :gvar
node.updated(:gvasgn)
when :const
if @parser.in_def?
diagnostic :error, :dynamic_const, nil, node.loc.expression
end
node.updated(:casgn)
when :ident
name, = *node
@parser.static_env.declare(name)
node.updated(:lvasgn)
when :nil, :self, :true, :false,
:__FILE__, :__LINE__, :__ENCODING__
diagnostic :error, :invalid_assignment, nil, node.loc.expression
when :back_ref, :nth_ref
diagnostic :error, :backref_assignment, nil, node.loc.expression
end
end