"localize '$x', $var" used to dereference $var and apply the localization
to $x directly. This did not set the IMPORTED flag on *x when necessary.
In order to fix this, we now follow the opposite logic : $var is now
referenced when the localization target is a scalar, and that reference is
assigned to *x so that localize now really behaves like "local *x = $var".
This fixes [RT #125931].