codegen: lift unresolved symbols from function body

In this step of implementing closures, all unresolved symbols are lifted
out of the body, sorted, and set to 0-7 in sequence. Two tasks remain:
the caller should pass real env vars, and let forms need special
handling.