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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/// A `ResolutionScope` is an index into a certain table indicating the scope in which a TypeRef can be resolved.
#[derive(Default, Clone)]
pub enum ResolutionScope {
#[default]
None,
Module(u32),
ModuleRef(u32),
AssemblyRef(u32),
TypeRef(u32),
}
impl ResolutionScope {
pub fn encode(&self) -> u32 {
match self {
Self::Module(row) => (row + 1) << 2,
Self::ModuleRef(row) => ((row + 1) << 2) + 1,
Self::AssemblyRef(row) => ((row + 1) << 2) + 2,
Self::TypeRef(row) => ((row + 1) << 2) + 3,
_ => 0,
}
}
}
/// A `TypeDefOrRef` is an index into a certain table used to locate a type definition.
#[derive(Default, Clone)]
pub enum TypeDefOrRef {
#[default]
None,
TypeDef(u32),
TypeRef(u32),
TypeSpec(u32),
}
impl TypeDefOrRef {
pub fn encode(&self) -> u32 {
match self {
Self::TypeDef(row) => (row + 1) << 2,
Self::TypeRef(row) => ((row + 1) << 2) + 1,
Self::TypeSpec(row) => ((row + 1) << 2) + 2,
_ => 0,
}
}
}
/// A `HasConstant` is an index into a certain table used to identify the parent of a row in the `Constant` table.
#[derive(Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum HasConstant {
#[default]
None,
Field(u32),
Param(u32),
Property(u32),
}
impl HasConstant {
pub fn encode(&self) -> u32 {
match self {
Self::Field(row) => (row + 1) << 2,
Self::Param(row) => ((row + 1) << 2) + 1,
Self::Property(row) => ((row + 1) << 2) + 2,
_ => 0,
}
}
}
#[derive(Default, Clone)]
pub enum HasCustomAttribute {
#[default]
None,
}
#[derive(Default, Clone)]
pub enum CustomAttributeType {
#[default]
None,
}
#[derive(Default, Clone)]
pub enum TypeOrMethodDef {
#[default]
None,
}
#[derive(Default, Clone)]
pub enum MemberForwarded {
#[default]
None,
}
#[derive(Default, Clone)]
pub enum MemberRefParent {
#[default]
None,
}
|