chore: fmt

This commit is contained in:
2025-05-10 20:13:00 +08:00
parent 046b03c60e
commit d04d46c905
7 changed files with 49 additions and 53 deletions

View File

@@ -32,9 +32,10 @@ impl<const CAP: usize> Stack<CAP> {
pub fn push(&mut self, item: Value) -> Result<()> {
self.items
.get_mut(self.top)
.map_or_else(|| Err(Error::EvalError("stack overflow".to_string())), |ok| {
Ok(ok)
})?
.map_or_else(
|| Err(Error::EvalError("stack overflow".to_string())),
|ok| Ok(ok),
)?
.write(item);
self.top += 1;
Ok(())

View File

@@ -1,7 +1,7 @@
use std::sync::Arc;
use crate::builtins::env;
use crate::bytecode::{self, BinOp, Funcs, OpCode, OpCodes, Program, Thunks, UnOp};
use crate::bytecode::{BinOp, OpCode, OpCodes, Program, UnOp};
use crate::error::*;
use crate::ty::common::Symbol;
use crate::ty::internal::*;
@@ -17,14 +17,14 @@ pub fn run(prog: Program) -> Result<p::Value> {
pub struct VM {
thunks: Box<[Thunk]>,
funcs: Funcs,
funcs: Box<[Func]>,
}
impl VM {
fn new(thunks: Thunks, funcs: Funcs) -> Self {
fn new(thunks: Box<[OpCodes]>, funcs: Box<[Func]>) -> Self {
let thunks = thunks
.into_iter()
.map(|bytecode::Thunk { opcodes }| Thunk::new(opcodes))
.map(|opcodes| Thunk::new(opcodes))
.collect();
VM { thunks, funcs }
}