generator: Moved scan_vars() to separate pass