luaur_compiler/methods/constant_is_truthful.rs
1use crate::enums::type_constant_folding::Type;
2use luaur_common::macros::luau_assert::LUAU_ASSERT;
3
4impl crate::records::constant::Constant {
5 pub fn is_truthful(&self) -> bool {
6 LUAU_ASSERT!(self.r#type != Type::Type_Unknown);
7 self.r#type != Type::Type_Nil
8 && !(self.r#type == Type::Type_Boolean && unsafe { self.data.value_boolean } == false)
9 }
10}