1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use crate::imp::structs::rust_param::RustParam;
use crate::imp::structs::rust_list::{ConstListVal, MutListVal};
use crate::imp::structs::rust_value::{RustMemberType, RustValue};
use crate::imp::structs::var_type::VarType;
use crate::imp::structs::qv::QvType;
use crate::IdentityEqual;
#[derive(Debug, Clone, PartialEq)]
pub enum ListSabValue{
Param(RustParam),
Cil(ConstListVal),
Mil(Option<MutListVal>),
}
impl ListSabValue{
pub(crate) fn type_num(&self) -> RustMemberType {
use RustMemberType::*;
match self{
ListSabValue::Param(param) => param.type_num(),
ListSabValue::Cil(_) => Cil,
ListSabValue::Mil(_) => Mil,
}
}
pub(crate) fn into_rust_value_for_json(self) -> RustValue{
match self{
ListSabValue::Param(p) => RustValue::Param(p, VarType::Normal),
ListSabValue::Cil(l) => RustValue::Cil(l),
ListSabValue::Mil(m) => RustValue::Mil(m),
}
}
pub(crate) fn qv_type(&self) -> QvType{
match self{
ListSabValue::Param(p) => p.qv_type(),
ListSabValue::Mil(m) => if m.is_some(){ QvType::Val } else{ QvType::Undefined },
_ => QvType::Val,
}
}
}
impl IdentityEqual for ListSabValue{
fn identity_eq(&self, other: &Self) -> bool {
match self{
ListSabValue::Param(p) => if let ListSabValue::Param(p2) = other{ p.identity_eq(p2) } else{ false }
ListSabValue::Mil(m) => if let ListSabValue::Mil(m2) = other{
if let Some(m) = m{
if let Some(m2) = m2{
m.identity_eq(m2)
} else{ false }
}
else if m.is_none() && m2.is_none(){ true }
else{ false }
} else{ false },
_ => true,
}
}
}