luaur_compiler/methods/
compiler_get_unary_op.rs1use luaur_ast::records::ast_expr_unary::AstExprUnaryOp;
2use luaur_common::enums::luau_opcode::LuauOpcode;
3use luaur_common::macros::luau_assert::LUAU_ASSERT;
4
5impl crate::records::compiler::Compiler {
6 pub fn get_unary_op(&mut self, op: AstExprUnaryOp) -> LuauOpcode {
7 match op {
8 AstExprUnaryOp::Not => LuauOpcode::LOP_NOT,
9 AstExprUnaryOp::Minus => LuauOpcode::LOP_MINUS,
10 AstExprUnaryOp::Len => LuauOpcode::LOP_LENGTH,
11 _ => {
12 LUAU_ASSERT!(false);
13 LuauOpcode::LOP_NOP
14 }
15 }
16 }
17}