Skip to content

Commit 4ec9e76

Browse files
authored
Set input in with_document too when reuse engine (microsoft#474)
1 parent 1b0c2d4 commit 4ec9e76

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/interpreter.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,11 @@ impl Interpreter {
316316
}
317317

318318
pub fn set_input(&mut self, input: Value) {
319-
self.input = input;
319+
self.input = input.clone();
320+
// Update with_document["input"] too, in case if engine is being reused and was already prepared
321+
if let Ok(with_input) = Self::make_or_get_value_mut(&mut self.with_document, &["input"]) {
322+
*with_input = input;
323+
}
320324
}
321325

322326
pub fn init_with_document(&mut self) -> Result<()> {

0 commit comments

Comments
 (0)