mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Add PrintExpr instruction to vm.
This commit is contained in:
@@ -63,6 +63,7 @@ pub enum Instruction {
|
||||
BuildList { size: usize },
|
||||
BuildMap { size: usize },
|
||||
BuildSlice { size: usize },
|
||||
PrintExpr,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
11
vm/src/vm.rs
11
vm/src/vm.rs
@@ -736,6 +736,17 @@ impl VirtualMachine {
|
||||
}
|
||||
None
|
||||
}
|
||||
bytecode::Instruction::PrintExpr => {
|
||||
let expr = self.pop_value();
|
||||
match expr.borrow().kind {
|
||||
PyObjectKind::None =>
|
||||
(),
|
||||
_ => {
|
||||
builtins::builtin_print(self, PyFuncArgs { args: vec![expr.clone()] });
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
_ => panic!("NOT IMPL {:?}", instruction),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user