mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
Add remaining operations as panic stubs
This commit is contained in:
@@ -127,14 +127,37 @@ pub fn op_nullish_coalesce(left: Val, right: Val) -> Val {
|
||||
};
|
||||
}
|
||||
|
||||
// OpOptionalChain = 0x16,
|
||||
// OpBitAnd = 0x17,
|
||||
// OpBitOr = 0x18,
|
||||
// OpBitNot = 0x19,
|
||||
// OpBitXor = 0x1a,
|
||||
// OpLeftShift = 0x1b,
|
||||
// OpRightShift = 0x1c,
|
||||
// OpRightShiftUnsigned = 0x1d,
|
||||
pub fn op_optional_chain(_left: Val, _right: Val) -> Val {
|
||||
std::panic!("Not implemented: op_optional_chain");
|
||||
}
|
||||
|
||||
pub fn op_bit_and(_left: Val, _right: Val) -> Val {
|
||||
std::panic!("Not implemented: op_bit_and");
|
||||
}
|
||||
|
||||
pub fn op_bit_or(_left: Val, _right: Val) -> Val {
|
||||
std::panic!("Not implemented: op_bit_or");
|
||||
}
|
||||
|
||||
pub fn op_bit_not(_left: Val, _right: Val) -> Val {
|
||||
std::panic!("Not implemented: op_bit_not");
|
||||
}
|
||||
|
||||
pub fn op_bit_xor(_left: Val, _right: Val) -> Val {
|
||||
std::panic!("Not implemented: op_bit_xor");
|
||||
}
|
||||
|
||||
pub fn op_left_shift(_left: Val, _right: Val) -> Val {
|
||||
std::panic!("Not implemented: op_left_shift");
|
||||
}
|
||||
|
||||
pub fn op_right_shift(_left: Val, _right: Val) -> Val {
|
||||
std::panic!("Not implemented: op_right_shift");
|
||||
}
|
||||
|
||||
pub fn op_right_shift_unsigned(_left: Val, _right: Val) -> Val {
|
||||
std::panic!("Not implemented: op_right_shift_unsigned");
|
||||
}
|
||||
|
||||
pub fn op_typeof(input: Val) -> Val {
|
||||
use VsType::*;
|
||||
@@ -151,6 +174,14 @@ pub fn op_typeof(input: Val) -> Val {
|
||||
}));
|
||||
}
|
||||
|
||||
// InstanceOf = 0x1f,
|
||||
// In = 0x20,
|
||||
// Sub = 0x24,
|
||||
pub fn op_instance_of(_left: Val, _right: Val) -> Val {
|
||||
std::panic!("Not implemented: op_instance_of");
|
||||
}
|
||||
|
||||
pub fn op_in(_left: Val, _right: Val) -> Val {
|
||||
std::panic!("Not implemented: op_in");
|
||||
}
|
||||
|
||||
pub fn op_sub(_left: Val, _right: Val) -> Val {
|
||||
std::panic!("Not implemented: op_sub");
|
||||
}
|
||||
|
||||
@@ -151,28 +151,19 @@ impl VirtualMachine {
|
||||
OpGreater => frame.apply_binary_op(operations::op_greater),
|
||||
OpGreaterEq => frame.apply_binary_op(operations::op_greater_eq),
|
||||
OpNullishCoalesce => frame.apply_binary_op(operations::op_nullish_coalesce),
|
||||
|
||||
OpOptionalChain => std::panic!("Instruction not implemented: OpOptionalChain"),
|
||||
|
||||
OpBitAnd => std::panic!("Instruction not implemented: OpBitAnd"),
|
||||
|
||||
OpBitOr => std::panic!("Instruction not implemented: OpBitOr"),
|
||||
|
||||
OpBitNot => std::panic!("Instruction not implemented: OpBitNot"),
|
||||
|
||||
OpBitXor => std::panic!("Instruction not implemented: OpBitXor"),
|
||||
|
||||
OpLeftShift => std::panic!("Instruction not implemented: OpLeftShift"),
|
||||
|
||||
OpRightShift => std::panic!("Instruction not implemented: OpRightShift"),
|
||||
|
||||
OpRightShiftUnsigned => std::panic!("Instruction not implemented: OpRightShiftUnsigned"),
|
||||
OpOptionalChain => frame.apply_binary_op(operations::op_optional_chain),
|
||||
OpBitAnd => frame.apply_binary_op(operations::op_bit_and),
|
||||
OpBitOr => frame.apply_binary_op(operations::op_bit_or),
|
||||
OpBitNot => frame.apply_binary_op(operations::op_bit_not),
|
||||
OpBitXor => frame.apply_binary_op(operations::op_bit_xor),
|
||||
OpLeftShift => frame.apply_binary_op(operations::op_left_shift),
|
||||
OpRightShift => frame.apply_binary_op(operations::op_right_shift),
|
||||
OpRightShiftUnsigned => frame.apply_binary_op(operations::op_right_shift_unsigned),
|
||||
|
||||
TypeOf => frame.apply_unary_op(operations::op_typeof),
|
||||
|
||||
InstanceOf => std::panic!("Instruction not implemented: InstanceOf"),
|
||||
|
||||
In => std::panic!("Instruction not implemented: In"),
|
||||
InstanceOf => frame.apply_binary_op(operations::op_instance_of),
|
||||
In => frame.apply_binary_op(operations::op_in),
|
||||
|
||||
Call => {
|
||||
let fn_ = frame.decoder.decode_val(&frame.registers);
|
||||
@@ -247,7 +238,7 @@ impl VirtualMachine {
|
||||
}
|
||||
},
|
||||
|
||||
Sub => std::panic!("Instruction not implemented: Sub"),
|
||||
Sub => frame.apply_binary_op(operations::op_sub),
|
||||
|
||||
SubMov => std::panic!("Instruction not implemented: SubMov"),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user