Skip to content

Commit

Permalink
Reuse interpreter in interactive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lgyanf committed Oct 3, 2023
1 parent 192f077 commit 03643ee
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ pub fn run_file(path: &str) -> Result<(), Box<dyn Error>> {
pub fn run_prompt() -> Result<(), Box<dyn Error>> {
let stdin = io::stdin();
let mut handle = stdin.lock();
let mut stdout = std::io::stdout();
let mut interpreter = Interpreter::new(&mut stdout);
loop {
print!("> ");
io::stdout().flush()?;
Expand All @@ -270,7 +272,7 @@ pub fn run_prompt() -> Result<(), Box<dyn Error>> {
if r == 0 {
return Ok(());
}
let result = run(&buffer);
let result = run_with_interpreter(&buffer, &mut interpreter);
match result {

Check failure on line 276 in src/interpreter.rs

View workflow job for this annotation

GitHub Actions / Clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
Err(errors) => {
for error in errors {
Expand Down

0 comments on commit 03643ee

Please sign in to comment.