didn't need that

This commit is contained in:
Shautvast 2025-11-03 19:11:37 +01:00
parent b397c4680e
commit ad9e9d8888
2 changed files with 4 additions and 6 deletions

View file

@ -19,8 +19,7 @@ mod value;
pub mod vm;
pub mod errors;
pub fn compile_sourcedir(source_dir:&str)-> Result<(Vec<String>, HashMap<String,Chunk>), Error>{
let mut paths = vec![];
pub fn compile_sourcedir(source_dir:&str)-> Result<HashMap<String,Chunk>, Error>{
let mut registry = HashMap::new();
for entry in WalkDir::new(source_dir).into_iter().filter_map(|e| e.ok()) {
@ -36,7 +35,6 @@ pub fn compile_sourcedir(source_dir:&str)-> Result<(Vec<String>, HashMap<String,
.unwrap()
.replace(".crud", "");
bytecode_compiler::compile(Some(&path), &statements, &mut registry)?;
paths.push(path);
}
Err(e) => {
println!("{}", e);
@ -46,7 +44,7 @@ pub fn compile_sourcedir(source_dir:&str)-> Result<(Vec<String>, HashMap<String,
println!();
}
}
Ok((paths,registry))
Ok(registry)
}
pub fn map_underlying() -> fn(std::io::Error) -> Error {

View file

@ -13,10 +13,10 @@ use std::sync::Arc;
async fn main() -> Result<(), crudlang::errors::Error> {
tracing_subscriber::fmt::init();
let (paths,registry) = compile_sourcedir("source")?;
let registry = compile_sourcedir("source")?;
let registry = Arc::new(registry);
if !paths.is_empty() {
if !registry.is_empty() {
let state = Arc::new(AppState {
registry: registry.clone(),
});