Browse Source

Fix #1221: Private setter-only properties are not decompiled correctly

pull/1420/head
Siegfried Pammer 7 years ago
parent
commit
99f9ecadd3
  1. 8
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.cs
  2. 35
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.il
  3. 34
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.il
  4. 28
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.roslyn.il
  5. 29
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.roslyn.il
  6. 3
      ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataProperty.cs

8
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.cs

@ -74,11 +74,19 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
[NonSerialized] [NonSerialized]
private int someField; private int someField;
private object issue1221;
public int Value { public int Value {
get; get;
private set; private set;
} }
private object Issue1221 {
set {
issue1221 = value;
}
}
#if ROSLYN #if ROSLYN
public int NotAnAutoProperty => someField; public int NotAnAutoProperty => someField;
#else #else

35
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.il

@ -56,8 +56,8 @@
.event [mscorlib]System.Action Event .event [mscorlib]System.Action Event
{ {
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event(class [mscorlib]System.Action)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::remove_Event(class [mscorlib]System.Action) .removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::remove_Event(class [mscorlib]System.Action)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event(class [mscorlib]System.Action)
} // end of event IBase::Event } // end of event IBase::Event
.property instance int32 Test() .property instance int32 Test()
{ {
@ -91,8 +91,8 @@
.event [mscorlib]System.EventHandler ThisIsAnAbstractEvent .event [mscorlib]System.EventHandler ThisIsAnAbstractEvent
{ {
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::add_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler) .addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::add_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
} // end of event BaseClass::ThisIsAnAbstractEvent } // end of event BaseClass::ThisIsAnAbstractEvent
} // end of class BaseClass } // end of class BaseClass
@ -192,8 +192,8 @@
.event [mscorlib]System.EventHandler ThisIsAnAbstractEvent .event [mscorlib]System.EventHandler ThisIsAnAbstractEvent
{ {
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/OtherClass::add_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/OtherClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler) .removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/OtherClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/OtherClass::add_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
} // end of event OtherClass::ThisIsAnAbstractEvent } // end of event OtherClass::ThisIsAnAbstractEvent
} // end of class OtherClass } // end of class OtherClass
@ -288,13 +288,13 @@
.event [mscorlib]System.EventHandler Changed .event [mscorlib]System.EventHandler Changed
{ {
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::add_Changed(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::remove_Changed(class [mscorlib]System.EventHandler) .removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::remove_Changed(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::add_Changed(class [mscorlib]System.EventHandler)
} // end of event IChange::Changed } // end of event IChange::Changed
.property instance int32 Property() .property instance int32 Property()
{ {
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::set_Property(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::get_Property() .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::get_Property()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::set_Property(int32)
} // end of property IChange::Property } // end of property IChange::Property
} // end of class IChange } // end of class IChange
@ -394,6 +394,7 @@
} // end of class Change } // end of class Change
.field private notserialized int32 someField .field private notserialized int32 someField
.field private object issue1221
.field private class [mscorlib]System.EventHandler AutomaticEvent .field private class [mscorlib]System.EventHandler AutomaticEvent
.field private notserialized class [mscorlib]System.EventHandler AutomaticEventWithInitializer .field private notserialized class [mscorlib]System.EventHandler AutomaticEventWithInitializer
.field private int32 '<Value>k__BackingField' .field private int32 '<Value>k__BackingField'
@ -428,6 +429,18 @@
IL_0007: ret IL_0007: ret
} // end of method PropertiesAndEvents::set_Value } // end of method PropertiesAndEvents::set_Value
.method private hidebysig specialname instance void
set_Issue1221(object 'value') cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: stfld object ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::issue1221
IL_0008: ret
} // end of method PropertiesAndEvents::set_Issue1221
.method public hidebysig specialname instance int32 .method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed get_NotAnAutoProperty() cil managed
{ {
@ -667,24 +680,28 @@
.event [mscorlib]System.EventHandler AutomaticEvent .event [mscorlib]System.EventHandler AutomaticEvent
{ {
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEvent(class [mscorlib]System.EventHandler) .removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEvent(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEvent } // end of event PropertiesAndEvents::AutomaticEvent
.event [mscorlib]System.EventHandler AutomaticEventWithInitializer .event [mscorlib]System.EventHandler AutomaticEventWithInitializer
{ {
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler) .addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEventWithInitializer } // end of event PropertiesAndEvents::AutomaticEventWithInitializer
.event [mscorlib]System.EventHandler CustomEvent .event [mscorlib]System.EventHandler CustomEvent
{ {
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_CustomEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_CustomEvent(class [mscorlib]System.EventHandler) .removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_CustomEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_CustomEvent(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::CustomEvent } // end of event PropertiesAndEvents::CustomEvent
.property instance int32 Value() .property instance int32 Value()
{ {
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value() .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
} // end of property PropertiesAndEvents::Value } // end of property PropertiesAndEvents::Value
.property instance object Issue1221()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Issue1221(object)
} // end of property PropertiesAndEvents::Issue1221
.property instance int32 NotAnAutoProperty() .property instance int32 NotAnAutoProperty()
{ {
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty() .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()

34
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.il

@ -56,8 +56,8 @@
.event [mscorlib]System.Action Event .event [mscorlib]System.Action Event
{ {
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event(class [mscorlib]System.Action)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::remove_Event(class [mscorlib]System.Action) .removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::remove_Event(class [mscorlib]System.Action)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event(class [mscorlib]System.Action)
} // end of event IBase::Event } // end of event IBase::Event
.property instance int32 Test() .property instance int32 Test()
{ {
@ -91,8 +91,8 @@
.event [mscorlib]System.EventHandler ThisIsAnAbstractEvent .event [mscorlib]System.EventHandler ThisIsAnAbstractEvent
{ {
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::add_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler) .addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::add_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
} // end of event BaseClass::ThisIsAnAbstractEvent } // end of event BaseClass::ThisIsAnAbstractEvent
} // end of class BaseClass } // end of class BaseClass
@ -180,8 +180,8 @@
.event [mscorlib]System.EventHandler ThisIsAnAbstractEvent .event [mscorlib]System.EventHandler ThisIsAnAbstractEvent
{ {
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/OtherClass::add_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/OtherClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler) .removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/OtherClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/OtherClass::add_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
} // end of event OtherClass::ThisIsAnAbstractEvent } // end of event OtherClass::ThisIsAnAbstractEvent
} // end of class OtherClass } // end of class OtherClass
@ -272,13 +272,13 @@
.event [mscorlib]System.EventHandler Changed .event [mscorlib]System.EventHandler Changed
{ {
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::add_Changed(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::remove_Changed(class [mscorlib]System.EventHandler) .removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::remove_Changed(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::add_Changed(class [mscorlib]System.EventHandler)
} // end of event IChange::Changed } // end of event IChange::Changed
.property instance int32 Property() .property instance int32 Property()
{ {
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::set_Property(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::get_Property() .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::get_Property()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::set_Property(int32)
} // end of property IChange::Property } // end of property IChange::Property
} // end of class IChange } // end of class IChange
@ -371,6 +371,7 @@
} // end of class Change } // end of class Change
.field private notserialized int32 someField .field private notserialized int32 someField
.field private object issue1221
.field private class [mscorlib]System.EventHandler AutomaticEvent .field private class [mscorlib]System.EventHandler AutomaticEvent
.field private notserialized class [mscorlib]System.EventHandler AutomaticEventWithInitializer .field private notserialized class [mscorlib]System.EventHandler AutomaticEventWithInitializer
.field private int32 '<Value>k__BackingField' .field private int32 '<Value>k__BackingField'
@ -400,6 +401,17 @@
IL_0007: ret IL_0007: ret
} // end of method PropertiesAndEvents::set_Value } // end of method PropertiesAndEvents::set_Value
.method private hidebysig specialname instance void
set_Issue1221(object 'value') cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: stfld object ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::issue1221
IL_0007: ret
} // end of method PropertiesAndEvents::set_Issue1221
.method public hidebysig specialname instance int32 .method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed get_NotAnAutoProperty() cil managed
{ {
@ -601,24 +613,28 @@
.event [mscorlib]System.EventHandler AutomaticEvent .event [mscorlib]System.EventHandler AutomaticEvent
{ {
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEvent(class [mscorlib]System.EventHandler) .removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEvent(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEvent } // end of event PropertiesAndEvents::AutomaticEvent
.event [mscorlib]System.EventHandler AutomaticEventWithInitializer .event [mscorlib]System.EventHandler AutomaticEventWithInitializer
{ {
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler) .addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEventWithInitializer } // end of event PropertiesAndEvents::AutomaticEventWithInitializer
.event [mscorlib]System.EventHandler CustomEvent .event [mscorlib]System.EventHandler CustomEvent
{ {
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_CustomEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_CustomEvent(class [mscorlib]System.EventHandler) .removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_CustomEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_CustomEvent(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::CustomEvent } // end of event PropertiesAndEvents::CustomEvent
.property instance int32 Value() .property instance int32 Value()
{ {
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value() .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
} // end of property PropertiesAndEvents::Value } // end of property PropertiesAndEvents::Value
.property instance object Issue1221()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Issue1221(object)
} // end of property PropertiesAndEvents::Issue1221
.property instance int32 NotAnAutoProperty() .property instance int32 NotAnAutoProperty()
{ {
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty() .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()

28
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.roslyn.il

@ -388,7 +388,7 @@
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' '<>9' .field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__22_0' .field public static class [mscorlib]System.EventHandler '<>9__25_0'
.method private hidebysig specialname rtspecialname static .method private hidebysig specialname rtspecialname static
void .cctor() cil managed void .cctor() cil managed
{ {
@ -410,17 +410,18 @@
} // end of method '<>c'::.ctor } // end of method '<>c'::.ctor
.method assembly hidebysig instance void .method assembly hidebysig instance void
'<.ctor>b__22_0'(object '<p0>', '<.ctor>b__25_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed class [mscorlib]System.EventArgs '<p1>') cil managed
{ {
// Code size 1 (0x1) // Code size 1 (0x1)
.maxstack 8 .maxstack 8
IL_0000: ret IL_0000: ret
} // end of method '<>c'::'<.ctor>b__22_0' } // end of method '<>c'::'<.ctor>b__25_0'
} // end of class '<>c' } // end of class '<>c'
.field private notserialized int32 someField .field private notserialized int32 someField
.field private object issue1221
.field private int32 '<Value>k__BackingField' .field private int32 '<Value>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private class [mscorlib]System.EventHandler AutomaticEvent .field private class [mscorlib]System.EventHandler AutomaticEvent
@ -450,6 +451,17 @@
IL_0007: ret IL_0007: ret
} // end of method PropertiesAndEvents::set_Value } // end of method PropertiesAndEvents::set_Value
.method private hidebysig specialname instance void
set_Issue1221(object 'value') cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: stfld object ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::issue1221
IL_0007: ret
} // end of method PropertiesAndEvents::set_Issue1221
.method public hidebysig specialname instance int32 .method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed get_NotAnAutoProperty() cil managed
{ {
@ -628,18 +640,18 @@
// Code size 44 (0x2c) // Code size 44 (0x2c)
.maxstack 8 .maxstack 8
IL_0000: ldarg.0 IL_0000: ldarg.0
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__22_0' IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__25_0'
IL_0006: dup IL_0006: dup
IL_0007: brtrue.s IL_0020 IL_0007: brtrue.s IL_0020
IL_0009: pop IL_0009: pop
IL_000a: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9' IL_000a: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9'
IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__22_0'(object, IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__25_0'(object,
class [mscorlib]System.EventArgs) class [mscorlib]System.EventArgs)
IL_0015: newobj instance void [mscorlib]System.EventHandler::.ctor(object, IL_0015: newobj instance void [mscorlib]System.EventHandler::.ctor(object,
native int) native int)
IL_001a: dup IL_001a: dup
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__22_0' IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__25_0'
IL_0020: stfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::AutomaticEventWithInitializer IL_0020: stfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::AutomaticEventWithInitializer
IL_0025: ldarg.0 IL_0025: ldarg.0
IL_0026: call instance void [mscorlib]System.Object::.ctor() IL_0026: call instance void [mscorlib]System.Object::.ctor()
@ -666,6 +678,10 @@
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value() .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32) .set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
} // end of property PropertiesAndEvents::Value } // end of property PropertiesAndEvents::Value
.property instance object Issue1221()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Issue1221(object)
} // end of property PropertiesAndEvents::Issue1221
.property instance int32 NotAnAutoProperty() .property instance int32 NotAnAutoProperty()
{ {
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty() .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()

29
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.roslyn.il

@ -400,7 +400,7 @@
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' '<>9' .field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__22_0' .field public static class [mscorlib]System.EventHandler '<>9__25_0'
.method private hidebysig specialname rtspecialname static .method private hidebysig specialname rtspecialname static
void .cctor() cil managed void .cctor() cil managed
{ {
@ -423,18 +423,19 @@
} // end of method '<>c'::.ctor } // end of method '<>c'::.ctor
.method assembly hidebysig instance void .method assembly hidebysig instance void
'<.ctor>b__22_0'(object '<p0>', '<.ctor>b__25_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed class [mscorlib]System.EventArgs '<p1>') cil managed
{ {
// Code size 2 (0x2) // Code size 2 (0x2)
.maxstack 8 .maxstack 8
IL_0000: nop IL_0000: nop
IL_0001: ret IL_0001: ret
} // end of method '<>c'::'<.ctor>b__22_0' } // end of method '<>c'::'<.ctor>b__25_0'
} // end of class '<>c' } // end of class '<>c'
.field private notserialized int32 someField .field private notserialized int32 someField
.field private object issue1221
.field private int32 '<Value>k__BackingField' .field private int32 '<Value>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
@ -467,6 +468,18 @@
IL_0007: ret IL_0007: ret
} // end of method PropertiesAndEvents::set_Value } // end of method PropertiesAndEvents::set_Value
.method private hidebysig specialname instance void
set_Issue1221(object 'value') cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: stfld object ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::issue1221
IL_0008: ret
} // end of method PropertiesAndEvents::set_Issue1221
.method public hidebysig specialname instance int32 .method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed get_NotAnAutoProperty() cil managed
{ {
@ -649,18 +662,18 @@
// Code size 45 (0x2d) // Code size 45 (0x2d)
.maxstack 8 .maxstack 8
IL_0000: ldarg.0 IL_0000: ldarg.0
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__22_0' IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__25_0'
IL_0006: dup IL_0006: dup
IL_0007: brtrue.s IL_0020 IL_0007: brtrue.s IL_0020
IL_0009: pop IL_0009: pop
IL_000a: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9' IL_000a: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9'
IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__22_0'(object, IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__25_0'(object,
class [mscorlib]System.EventArgs) class [mscorlib]System.EventArgs)
IL_0015: newobj instance void [mscorlib]System.EventHandler::.ctor(object, IL_0015: newobj instance void [mscorlib]System.EventHandler::.ctor(object,
native int) native int)
IL_001a: dup IL_001a: dup
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__22_0' IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__25_0'
IL_0020: stfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::AutomaticEventWithInitializer IL_0020: stfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::AutomaticEventWithInitializer
IL_0025: ldarg.0 IL_0025: ldarg.0
IL_0026: call instance void [mscorlib]System.Object::.ctor() IL_0026: call instance void [mscorlib]System.Object::.ctor()
@ -688,6 +701,10 @@
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value() .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32) .set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
} // end of property PropertiesAndEvents::Value } // end of property PropertiesAndEvents::Value
.property instance object Issue1221()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Issue1221(object)
} // end of property PropertiesAndEvents::Issue1221
.property instance int32 NotAnAutoProperty() .property instance int32 NotAnAutoProperty()
{ {
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty() .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()

3
ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataProperty.cs

@ -197,6 +197,9 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
if (left == Accessibility.ProtectedAndInternal || right == Accessibility.ProtectedAndInternal) if (left == Accessibility.ProtectedAndInternal || right == Accessibility.ProtectedAndInternal)
return Accessibility.ProtectedAndInternal; return Accessibility.ProtectedAndInternal;
if (left == Accessibility.Private || right == Accessibility.Private)
return Accessibility.Private;
return left; return left;
} }
#endregion #endregion

Loading…
Cancel
Save