Commit 25f85c9 1 parent 43336ee commit 25f85c9 Copy full SHA for 25f85c9
File tree 2 files changed +7
-43
lines changed
2 files changed +7
-43
lines changed Original file line number Diff line number Diff line change @@ -1435,7 +1435,8 @@ void AddType (TypeDefinition type)
1435
1435
if ( type . HasInterfaces )
1436
1436
AddInterfaces ( type ) ;
1437
1437
1438
- AddLayoutInfo ( type ) ;
1438
+ if ( type . HasLayoutInfo )
1439
+ AddLayoutInfo ( type ) ;
1439
1440
1440
1441
if ( type . HasFields )
1441
1442
AddFields ( type ) ;
@@ -1554,36 +1555,12 @@ void AddInterfaces (TypeDefinition type)
1554
1555
1555
1556
void AddLayoutInfo ( TypeDefinition type )
1556
1557
{
1557
- if ( type . HasLayoutInfo ) {
1558
- var table = GetTable < ClassLayoutTable > ( Table . ClassLayout ) ;
1558
+ var table = GetTable < ClassLayoutTable > ( Table . ClassLayout ) ;
1559
1559
1560
- table . AddRow ( new ClassLayoutRow (
1561
- ( ushort ) type . PackingSize ,
1562
- ( uint ) type . ClassSize ,
1563
- type . token . RID ) ) ;
1564
-
1565
- return ;
1566
- }
1567
-
1568
- if ( type . IsValueType && HasNoInstanceField ( type ) ) {
1569
- var table = GetTable < ClassLayoutTable > ( Table . ClassLayout ) ;
1570
-
1571
- table . AddRow ( new ClassLayoutRow ( 0 , 1 , type . token . RID ) ) ;
1572
- }
1573
- }
1574
-
1575
- static bool HasNoInstanceField ( TypeDefinition type )
1576
- {
1577
- if ( ! type . HasFields )
1578
- return true ;
1579
-
1580
- var fields = type . Fields ;
1581
-
1582
- for ( int i = 0 ; i < fields . Count ; i ++ )
1583
- if ( ! fields [ i ] . IsStatic )
1584
- return false ;
1585
-
1586
- return true ;
1560
+ table . AddRow ( new ClassLayoutRow (
1561
+ ( ushort ) type . PackingSize ,
1562
+ ( uint ) type . ClassSize ,
1563
+ type . token . RID ) ) ;
1587
1564
}
1588
1565
1589
1566
void AddNestedTypes ( TypeDefinition type )
Original file line number Diff line number Diff line change @@ -30,19 +30,6 @@ public void TypeLayout ()
30
30
} ) ;
31
31
}
32
32
33
- [ Test ]
34
- public void EmptyStructLayout ( )
35
- {
36
- TestModule ( "hello.exe" , module =>
37
- {
38
- var foo = new TypeDefinition ( "" , "Foo" ,
39
- TypeAttributes . Sealed | TypeAttributes . BeforeFieldInit | TypeAttributes . SequentialLayout ,
40
- module . ImportReference ( typeof ( ValueType ) ) ) ;
41
-
42
- module . Types . Add ( foo ) ;
43
- } ) ;
44
- }
45
-
46
33
[ Test ]
47
34
public void SimpleInterfaces ( )
48
35
{
You can’t perform that action at this time.
0 commit comments