chore: fmt
This commit is contained in:
@@ -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(())
|
||||
|
||||
@@ -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 }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user