init builtins
This commit is contained in:
+13
-5
@@ -16,6 +16,7 @@ use crate::store::{DaemonStore, StoreConfig};
|
||||
use crate::value::Symbol;
|
||||
|
||||
mod builtins;
|
||||
mod primops;
|
||||
mod stack;
|
||||
mod value;
|
||||
mod vm;
|
||||
@@ -43,6 +44,7 @@ impl Runtime {
|
||||
let store = DaemonStore::connect(&config.daemon_socket)?;
|
||||
|
||||
Ok(Self {
|
||||
arena: Arena::new(|mc| VM::new(mc, &mut strings)),
|
||||
global_env,
|
||||
store,
|
||||
strings,
|
||||
@@ -50,7 +52,6 @@ impl Runtime {
|
||||
bytecode: Vec::new(),
|
||||
sources: Vec::new(),
|
||||
spans: Vec::new(),
|
||||
arena: Arena::new(|mc| VM::new(mc)),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -108,8 +109,11 @@ impl Runtime {
|
||||
bump,
|
||||
token,
|
||||
strings,
|
||||
source: sources.last().unwrap().clone(),
|
||||
scopes: [Scope::Global(global_env)].into_iter().chain(extra_scope.into_iter()).collect(),
|
||||
source: sources.last().expect("no current source").clone(),
|
||||
scopes: [Scope::Global(global_env)]
|
||||
.into_iter()
|
||||
.chain(extra_scope)
|
||||
.collect(),
|
||||
with_scope_count: 0,
|
||||
arg_count: 0,
|
||||
thunk_count,
|
||||
@@ -117,7 +121,11 @@ impl Runtime {
|
||||
}
|
||||
}
|
||||
|
||||
fn downgrade<'a>(&'a mut self, source: Source, extra_scope: Option<Scope<'a>>) -> Result<OwnedIr> {
|
||||
fn downgrade<'a>(
|
||||
&'a mut self,
|
||||
source: Source,
|
||||
extra_scope: Option<Scope<'a>>,
|
||||
) -> Result<OwnedIr> {
|
||||
tracing::debug!("Parsing Nix expression");
|
||||
|
||||
self.sources.push(source.clone());
|
||||
@@ -496,7 +504,7 @@ impl OwnedIr {
|
||||
unsafe fn new(ir: RawIrRef<'_>, bump: Bump) -> Self {
|
||||
Self {
|
||||
_bump: bump,
|
||||
ir: unsafe { std::mem::transmute::<RawIrRef<'_>, RawIrRef<'static>>(ir) }
|
||||
ir: unsafe { std::mem::transmute::<RawIrRef<'_>, RawIrRef<'static>>(ir) },
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user