diff --git a/vm/src/bytecode.rs b/vm/src/bytecode.rs index b404196b0..906e29e26 100644 --- a/vm/src/bytecode.rs +++ b/vm/src/bytecode.rs @@ -63,6 +63,7 @@ pub enum Instruction { BuildList { size: usize }, BuildMap { size: usize }, BuildSlice { size: usize }, + PrintExpr, } #[derive(Debug, Clone)] diff --git a/vm/src/vm.rs b/vm/src/vm.rs index b04842214..0d45e22eb 100644 --- a/vm/src/vm.rs +++ b/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), } }