Fix return copying

This commit is contained in:
Andrew Morris
2023-06-20 14:08:08 +10:00
parent a1d4b8149e
commit 13d782114f
2 changed files with 5 additions and 4 deletions

View File

@@ -1,5 +1,4 @@
//! test_output(1)
// Should be: 0
//! test_output(0)
/// <reference path="../../../concept-code/vs.d.ts" />

View File

@@ -1,3 +1,5 @@
use std::mem::take;
use valuescript_common::InstructionByte;
use crate::builtins::type_error_builtin::ToTypeError;
@@ -135,8 +137,8 @@ impl StackFrameTrait for BytecodeStackFrame {
match instruction_byte {
End => {
return Ok(FrameStepOk::Pop(CallResult {
return_: self.registers[0].clone(),
this: self.registers[1].clone(),
return_: take(&mut self.registers[0]),
this: take(&mut self.registers[1]),
}));
}