johnynek / bosatsu

A python-ish pure and total functional programming language
Apache License 2.0
223 stars 11 forks source link

Explicitly build closure captures #1079

Closed johnynek closed 8 months ago

johnynek commented 8 months ago

In order to implement a backend on a platform without built-in closures (such as a C backend), it is better to explicitly build the context over which the lambdas close over, and also to insure that it only reaches into the current scope (not across several scopes).

This PR makes that change.

This doesn't really help python code generation or the interpreter (both of which use the Matchless IR). But it does open the door to easier implementation of a C or Java backend.

codecov-commenter commented 8 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (695d677) 92.26% compared to head (b09dbf2) 92.44%.

Files Patch % Lines
...la/org/bykn/bosatsu/codegen/python/PythonGen.scala 97.26% 2 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1079 +/- ## ========================================== + Coverage 92.26% 92.44% +0.17% ========================================== Files 93 93 Lines 10306 10348 +42 Branches 2388 2475 +87 ========================================== + Hits 9509 9566 +57 + Misses 797 782 -15 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.