Skip to content

Commit

Permalink
fix lox-web
Browse files Browse the repository at this point in the history
  • Loading branch information
xffxff committed Nov 11, 2023
1 parent 95be2c9 commit 7e3938c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions components/lox-execute/src/kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ impl BufferKernel {
pub fn buffer(&self) -> &str {
&self.buffer
}

pub fn take_buffer(self) -> String {
self.buffer
}
}

impl Kernel for BufferKernel {
Expand Down
10 changes: 9 additions & 1 deletion components/lox-web/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use lox_execute::kernel::{self, BufferKernel};
use lox_ir::{diagnostic::Diagnostics, input_file::InputFile};
use salsa::DebugWithDb;
use wasm_bindgen::prelude::*;
Expand Down Expand Up @@ -37,7 +38,14 @@ impl Compiler {
if !diagnostics.is_empty() {
lox_error_format::format_diagnostics(&self.db, &diagnostics).unwrap()
} else {
lox_execute::execute_file(&self.db, self.input_file, None::<fn(_, &lox_execute::VM)>)
let mut kernel = BufferKernel::new();
lox_execute::execute_file(
&self.db,
self.input_file,
&mut kernel,
None::<fn(_, &lox_execute::VM)>,
);
kernel.take_buffer()
}
}

Expand Down

0 comments on commit 7e3938c

Please sign in to comment.