Add reference resolution for let-in and val declarations