luaur_analysis/enums/
control_flow.rs1#[allow(non_camel_case_types)]
2#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
3#[repr(u32)]
4pub enum ControlFlow {
5 Bits0 = 0b00000,
6 None = 0b00001,
7 Returns = 0b00010,
8 Bits3 = 0b00011,
9 Throws = 0b00100,
10 Bits5 = 0b00101,
11 Bits6 = 0b00110,
12 Bits7 = 0b00111,
13 Breaks = 0b01000,
14 Bits9 = 0b01001,
15 Bits10 = 0b01010,
16 Bits11 = 0b01011,
17 Bits12 = 0b01100,
18 Bits13 = 0b01101,
19 Bits14 = 0b01110,
20 Bits15 = 0b01111,
21 Continues = 0b10000,
22 Bits17 = 0b10001,
23 Bits18 = 0b10010,
24 Bits19 = 0b10011,
25 Bits20 = 0b10100,
26 Bits21 = 0b10101,
27 Bits22 = 0b10110,
28 Bits23 = 0b10111,
29 Bits24 = 0b11000,
30 Bits25 = 0b11001,
31 Bits26 = 0b11010,
32 Bits27 = 0b11011,
33 Bits28 = 0b11100,
34 Bits29 = 0b11101,
35 Bits30 = 0b11110,
36 Bits31 = 0b11111,
37}
38
39impl ControlFlow {
40 pub const Zero: Self = Self::Bits0;
41 pub const None: Self = Self::None;
42 pub const Returns: Self = Self::Returns;
43 pub const Throws: Self = Self::Throws;
44 pub const Breaks: Self = Self::Breaks;
45 pub const Continues: Self = Self::Continues;
46
47 pub fn from_bits(bits: u32) -> Self {
48 match bits {
49 0 => Self::Bits0,
50 1 => Self::None,
51 2 => Self::Returns,
52 3 => Self::Bits3,
53 4 => Self::Throws,
54 5 => Self::Bits5,
55 6 => Self::Bits6,
56 7 => Self::Bits7,
57 8 => Self::Breaks,
58 9 => Self::Bits9,
59 10 => Self::Bits10,
60 11 => Self::Bits11,
61 12 => Self::Bits12,
62 13 => Self::Bits13,
63 14 => Self::Bits14,
64 15 => Self::Bits15,
65 16 => Self::Continues,
66 17 => Self::Bits17,
67 18 => Self::Bits18,
68 19 => Self::Bits19,
69 20 => Self::Bits20,
70 21 => Self::Bits21,
71 22 => Self::Bits22,
72 23 => Self::Bits23,
73 24 => Self::Bits24,
74 25 => Self::Bits25,
75 26 => Self::Bits26,
76 27 => Self::Bits27,
77 28 => Self::Bits28,
78 29 => Self::Bits29,
79 30 => Self::Bits30,
80 31 => Self::Bits31,
81 _ => panic!("invalid ControlFlow bits {bits:#x}"),
82 }
83 }
84}