pure-c/purec

Only capture bindings in scope that are actually used

felixSchl opened this issue · 1 comments

Currently, during lambda erasure, continuations will capture everything that was introduced up to that point, regardless of whether the continuation will make use of it or not. We should instead analyze what bindings the continuation actually makes use of and only capture those.

https://github.com/pure-c/pure-c/blob/955df0c796d94dd4da91019db7ae4e7770c1fe5e/src/Language/PureScript/CodeGen/C.purs#L950-L958

Can probably use the new isReferenced function on each captured binding and the function ast.