diff --git a/crates/codegen/src/compile.rs b/crates/codegen/src/compile.rs index 040571ca31..67f5ddd4df 100644 --- a/crates/codegen/src/compile.rs +++ b/crates/codegen/src/compile.rs @@ -1057,7 +1057,14 @@ impl Compiler { for statement in body { if let Stmt::Expr(StmtExpr { value, .. }) = &statement { self.compile_expression(value)?; - emit!(self, Instruction::PrintExpr); + emit!( + self, + Instruction::CallIntrinsic1 { + func: bytecode::IntrinsicFunction1::Print + } + ); + + emit!(self, Instruction::Pop); } else { self.compile_statement(statement)?; } @@ -1066,7 +1073,14 @@ impl Compiler { if let Stmt::Expr(StmtExpr { value, .. }) = &last { self.compile_expression(value)?; emit!(self, Instruction::CopyItem { index: 1_u32 }); - emit!(self, Instruction::PrintExpr); + emit!( + self, + Instruction::CallIntrinsic1 { + func: bytecode::IntrinsicFunction1::Print + } + ); + + emit!(self, Instruction::Pop); } else { self.compile_statement(last)?; self.emit_load_const(ConstantData::None); diff --git a/crates/compiler-core/src/bytecode.rs b/crates/compiler-core/src/bytecode.rs index 18a3572d19..11d2a7b5f1 100644 --- a/crates/compiler-core/src/bytecode.rs +++ b/crates/compiler-core/src/bytecode.rs @@ -551,7 +551,7 @@ op_arg_enum!( #[repr(u8)] pub enum IntrinsicFunction1 { // Invalid = 0, - // Print = 1, + Print = 1, /// Import * operation ImportStar = 2, // StopIterationError = 3, @@ -793,7 +793,6 @@ pub enum Instruction { PopJumpIfTrue { target: Arg