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
}

View File

@ -36,7 +36,6 @@ impl Blueprint<Schema> {
let validators: Result<Vec<_>, Error> = modules
.validators()
.map(|(validator, def)| {
generator.reset();
Validator::from_checked_module(modules, generator, validator, def)
})
.collect();