Add reference resolution for do blocks