move apply_defs to just before the VM evaluates code

This commit is contained in:
りき萌 2024-08-24 18:04:18 +02:00
parent 4761fd40ba
commit 2d1f49f78d
2 changed files with 7 additions and 4 deletions

View file

@ -114,8 +114,6 @@ impl Haku {
let chunk_id = self.system.add_chunk(chunk).context("too many chunks")?;
self.brush = Some(chunk_id);
self.vm.apply_defs(&self.defs);
Ok(())
}
@ -124,6 +122,8 @@ impl Haku {
.brush
.ok_or_eyre("brush is not compiled and ready to be used")?;
self.vm.apply_defs(&self.defs);
let closure_id = self
.vm
.create_ref(Ref::Closure(Closure {