pure-c / purec

C backend for PureScript
234 stars 8 forks source link

Only capture bindings in scope that are actually used #42

Closed felixSchl closed 6 years ago

felixSchl commented 6 years ago

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

felixSchl commented 6 years ago

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