Implement name lookups in var checking.