Move the funky name-based resolution code to VarDef for alias resolution,
where it's actually needed.