Walk the AST to generate globally unique names, resolving names within scopes and generating a log of assignments.