Error builtin

This commit is contained in:
Andrew Morris
2023-03-21 16:06:53 +11:00
parent e94876fc68
commit e657604cbe
9 changed files with 190 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ use valuescript_common::InstructionByte;
use crate::bytecode_decoder::BytecodeDecoder;
use crate::bytecode_decoder::BytecodeType;
use crate::format_val;
use crate::operations;
use crate::stack_frame::FrameStepOk;
use crate::stack_frame::FrameStepResult;
@@ -348,7 +349,7 @@ impl StackFrameTrait for BytecodeStackFrame {
.decoder
.decode_val(&self.registers)
.as_class_data()
.expect("Not implemented: throw exception (not constructible)");
.ok_or(format_val!("TypeError: value is not a constructor"))?;
let mut instance = Val::Object(Rc::new(VsObject {
string_map: Default::default(),