@@ -4,7 +4,7 @@ pub trait Decode {
4
4
fn decode ( file : & ' static File , code : u32 ) -> Self ;
5
5
}
6
6
7
- #[ derive( Copy , Clone , Debug , PartialEq , PartialOrd , Eq , Ord ) ]
7
+ #[ derive( Clone , Debug ) ]
8
8
pub enum TypeDefOrRef {
9
9
TypeDef ( tables:: TypeDef ) ,
10
10
TypeRef ( tables:: TypeRef ) ,
@@ -15,7 +15,7 @@ impl Decode for TypeDefOrRef {
15
15
fn decode ( file : & ' static File , code : u32 ) -> Self {
16
16
let code = ( code & ( ( 1 << 2 ) - 1 ) , ( code >> 2 ) - 1 ) ;
17
17
match code. 0 {
18
- 0 => Self :: TypeDef ( tables :: TypeDef ( Row :: new ( code. 1 , TableIndex :: TypeDef , file) ) ) ,
18
+ 0 => Self :: TypeDef ( Row :: new ( code. 1 , TableIndex :: TypeDef , file) . into ( ) ) ,
19
19
1 => Self :: TypeRef ( tables:: TypeRef ( Row :: new ( code. 1 , TableIndex :: TypeRef , file) ) ) ,
20
20
2 => Self :: TypeSpec ( tables:: TypeSpec ( Row :: new (
21
21
code. 1 ,
@@ -30,14 +30,14 @@ impl Decode for TypeDefOrRef {
30
30
impl TypeDefOrRef {
31
31
pub fn encode ( & self ) -> u32 {
32
32
match self {
33
- Self :: TypeDef ( value) => ( ( value. 0 . row + 1 ) << 2 ) ,
33
+ Self :: TypeDef ( value) => ( ( value. row . row + 1 ) << 2 ) ,
34
34
Self :: TypeRef ( value) => ( ( value. 0 . row + 1 ) << 2 ) | 1 ,
35
35
Self :: TypeSpec ( value) => ( ( value. 0 . row + 1 ) << 2 ) | 2 ,
36
36
}
37
37
}
38
38
}
39
39
40
- #[ derive( Copy , Clone , Debug , PartialEq , PartialOrd , Eq , Ord ) ]
40
+ #[ derive( Clone , Debug ) ]
41
41
pub enum TypeOrMethodDef {
42
42
TypeDef ( tables:: TypeDef ) ,
43
43
MethodDef ( tables:: MethodDef ) ,
@@ -47,7 +47,7 @@ impl Decode for TypeOrMethodDef {
47
47
fn decode ( file : & ' static File , code : u32 ) -> Self {
48
48
let code = ( code & ( ( 1 << 1 ) - 1 ) , ( code >> 1 ) - 1 ) ;
49
49
match code. 0 {
50
- 0 => Self :: TypeDef ( tables :: TypeDef ( Row :: new ( code. 1 , TableIndex :: TypeDef , file) ) ) ,
50
+ 0 => Self :: TypeDef ( Row :: new ( code. 1 , TableIndex :: TypeDef , file) . into ( ) ) ,
51
51
1 => Self :: MethodDef ( tables:: MethodDef ( Row :: new (
52
52
code. 1 ,
53
53
TableIndex :: MethodDef ,
@@ -61,13 +61,13 @@ impl Decode for TypeOrMethodDef {
61
61
impl TypeOrMethodDef {
62
62
pub fn encode ( & self ) -> u32 {
63
63
match self {
64
- Self :: TypeDef ( value) => ( ( value. 0 . row + 1 ) << 1 ) ,
64
+ Self :: TypeDef ( value) => ( ( value. row . row + 1 ) << 1 ) ,
65
65
Self :: MethodDef ( value) => ( ( value. 0 . row + 1 ) << 1 ) | 1 ,
66
66
}
67
67
}
68
68
}
69
69
70
- #[ derive( Copy , Clone , Debug , PartialEq , PartialOrd , Eq , Ord ) ]
70
+ #[ derive( Clone , Debug ) ]
71
71
pub enum HasAttribute {
72
72
MethodDef ( tables:: MethodDef ) ,
73
73
Field ( tables:: Field ) ,
@@ -91,7 +91,7 @@ impl Decode for HasAttribute {
91
91
) ) ) ,
92
92
1 => Self :: Field ( tables:: Field ( Row :: new ( code. 1 , TableIndex :: Field , file) ) ) ,
93
93
2 => Self :: TypeRef ( tables:: TypeRef ( Row :: new ( code. 1 , TableIndex :: TypeRef , file) ) ) ,
94
- 3 => Self :: TypeDef ( tables :: TypeDef ( Row :: new ( code. 1 , TableIndex :: TypeDef , file) ) ) ,
94
+ 3 => Self :: TypeDef ( Row :: new ( code. 1 , TableIndex :: TypeDef , file) . into ( ) ) ,
95
95
4 => Self :: Param ( tables:: Param ( Row :: new ( code. 1 , TableIndex :: Param , file) ) ) ,
96
96
5 => Self :: InterfaceImpl ( tables:: InterfaceImpl ( Row :: new (
97
97
code. 1 ,
@@ -124,7 +124,7 @@ impl HasAttribute {
124
124
Self :: MethodDef ( value) => ( ( value. 0 . row + 1 ) << 5 ) ,
125
125
Self :: Field ( value) => ( ( value. 0 . row + 1 ) << 5 ) | 1 ,
126
126
Self :: TypeRef ( value) => ( ( value. 0 . row + 1 ) << 5 ) | 2 ,
127
- Self :: TypeDef ( value) => ( ( value. 0 . row + 1 ) << 5 ) | 3 ,
127
+ Self :: TypeDef ( value) => ( ( value. row . row + 1 ) << 5 ) | 3 ,
128
128
Self :: Param ( value) => ( ( value. 0 . row + 1 ) << 5 ) | 4 ,
129
129
Self :: InterfaceImpl ( value) => ( ( value. 0 . row + 1 ) << 5 ) | 5 ,
130
130
Self :: MemberRef ( value) => ( ( value. 0 . row + 1 ) << 5 ) | 6 ,
@@ -134,7 +134,7 @@ impl HasAttribute {
134
134
}
135
135
}
136
136
137
- #[ derive( Copy , Clone , Debug , PartialEq , PartialOrd , Eq , Ord ) ]
137
+ #[ derive( Clone , Debug ) ]
138
138
pub enum MemberRefParent {
139
139
TypeDef ( tables:: TypeDef ) ,
140
140
TypeRef ( tables:: TypeRef ) ,
@@ -146,7 +146,7 @@ impl Decode for MemberRefParent {
146
146
fn decode ( file : & ' static File , code : u32 ) -> Self {
147
147
let code = ( code & ( ( 1 << 3 ) - 1 ) , ( code >> 3 ) - 1 ) ;
148
148
match code. 0 {
149
- 0 => Self :: TypeDef ( tables :: TypeDef ( Row :: new ( code. 1 , TableIndex :: TypeDef , file) ) ) ,
149
+ 0 => Self :: TypeDef ( Row :: new ( code. 1 , TableIndex :: TypeDef , file) . into ( ) ) ,
150
150
1 => Self :: TypeRef ( tables:: TypeRef ( Row :: new ( code. 1 , TableIndex :: TypeRef , file) ) ) ,
151
151
3 => Self :: MethodDef ( tables:: MethodDef ( Row :: new (
152
152
code. 1 ,
@@ -166,15 +166,15 @@ impl Decode for MemberRefParent {
166
166
impl MemberRefParent {
167
167
pub fn encode ( & self ) -> u32 {
168
168
match self {
169
- Self :: TypeDef ( value) => ( ( value. 0 . row + 1 ) << 3 ) ,
169
+ Self :: TypeDef ( value) => ( ( value. row . row + 1 ) << 3 ) ,
170
170
Self :: TypeRef ( value) => ( ( value. 0 . row + 1 ) << 3 ) | 1 ,
171
171
Self :: MethodDef ( value) => ( ( value. 0 . row + 1 ) << 3 ) | 3 ,
172
172
Self :: TypeSpec ( value) => ( ( value. 0 . row + 1 ) << 3 ) | 4 ,
173
173
}
174
174
}
175
175
}
176
176
177
- #[ derive( Copy , Clone , Debug , PartialEq , PartialOrd , Eq , Ord ) ]
177
+ #[ derive( Clone , Debug ) ]
178
178
pub enum HasConstant {
179
179
Field ( tables:: Field ) ,
180
180
Param ( tables:: Param ) ,
@@ -200,7 +200,7 @@ impl HasConstant {
200
200
}
201
201
}
202
202
203
- #[ derive( Copy , Clone , Debug , PartialEq , PartialOrd , Eq , Ord ) ]
203
+ #[ derive( Clone , Debug ) ]
204
204
pub enum AttributeType {
205
205
MethodDef ( tables:: MethodDef ) ,
206
206
MemberRef ( tables:: MemberRef ) ,
@@ -234,7 +234,7 @@ impl AttributeType {
234
234
}
235
235
}
236
236
237
- #[ derive( Copy , Clone , Debug , PartialEq , PartialOrd , Eq , Ord ) ]
237
+ #[ derive( Clone , Debug ) ]
238
238
pub enum MemberForwarded {
239
239
Field ( tables:: Field ) ,
240
240
MethodDef ( tables:: MethodDef ) ,
@@ -264,7 +264,7 @@ impl MemberForwarded {
264
264
}
265
265
}
266
266
267
- #[ derive( Copy , Clone , Debug , PartialEq , PartialOrd , Eq , Ord ) ]
267
+ #[ derive( Clone , Debug ) ]
268
268
pub enum ResolutionScope {
269
269
Module ( tables:: Module ) ,
270
270
ModuleRef ( tables:: ModuleRef ) ,
@@ -331,7 +331,7 @@ impl TypeDefOrRef {
331
331
332
332
pub fn resolve ( & self ) -> tables:: TypeDef {
333
333
match self {
334
- Self :: TypeDef ( value) => * value,
334
+ Self :: TypeDef ( value) => value. clone ( ) ,
335
335
Self :: TypeRef ( value) => value. resolve ( ) ,
336
336
_ => unexpected ! ( ) ,
337
337
}
0 commit comments