feat: reset the generator when generate finishes

This commit is contained in:
rvcas
2023-02-05 20:26:52 -05:00
committed by Lucas
parent 501d667532
commit 3ff927d30a
2 changed files with 9 additions and 1 deletions

View File

@@ -123,6 +123,15 @@ impl<'a> CodeGenerator<'a> {
program = aiken_optimize_and_intern(program);
// This is very important to call here.
// If this isn't done, re-using the same instance
// of the generator will result in free unique errors
// among other unpredictable things. In fact,
// switching to a shared code generator caused some
// instability issues and we fixed it by placing this
// method here.
self.reset();
program
}