kaleidawave / ezno

A JavaScript compiler and TypeScript checker written in Rust with a focus on static analysis and runtime performance
https://kaleidawave.github.io/posts/introducing-ezno/
MIT License
2.44k stars 45 forks source link

Implement closures #55

Closed kaleidawave closed 1 year ago

kaleidawave commented 1 year ago

This PR implements the basics of closures.

The additions are shown in these new specification tests https://github.com/kaleidawave/ezno/blob/4591ca369cc8b0e7715f560759a48bd34b2a725d/checker/specification/specification.md?plain=1#L223-L284

This PR does several things to support them:

I made this process up. I am not quite sure how engines actually implement it. With Ezno and things like events I am trying to abstract things and reduce overhead. Running the exact same things done in synthesis every function call is off the table... And these need a few fix see follow up issue #56

This PR also tidies some stuff up

kaleidawave commented 1 year ago

No idea what rustfmt is doing, seems to have broken recently (this PR doesn't change parser and it is reporting new formatting issues there). Will try and figure out later