[fix] validate var name before defining or resolving in scope