Browse Source

Fix #1146: C#3+ property accessor generates bad "[field: " tag on the accessor

pull/1600/head
Siegfried Pammer 7 years ago
parent
commit
e012fe04be
  1. 13
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.cs
  2. 33
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.il
  3. 27
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.il
  4. 27
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.roslyn.il
  5. 27
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.roslyn.il
  6. 23
      ICSharpCode.Decompiler/CSharp/Transforms/PatternStatementTransform.cs

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

@ -32,11 +32,24 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -32,11 +32,24 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
[NonSerialized]
private int someField;
public int Value {
get;
private set;
}
#if ROSLYN
public int NotAnAutoProperty => someField;
#else
public int NotAnAutoProperty {
get {
return someField;
}
}
#endif
public event EventHandler AutomaticEvent;
[field: NonSerialized]

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

@ -56,13 +56,13 @@ @@ -56,13 +56,13 @@
.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)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event(class [mscorlib]System.Action)
} // end of event IBase::Event
.property instance int32 Test()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test(int32)
} // end of property IBase::Test
} // end of class IBase
@ -128,11 +128,12 @@ @@ -128,11 +128,12 @@
} // end of event Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Event
.property instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test()
} // end of property Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test
} // end of class Impl
.field private notserialized int32 someField
.field private class [mscorlib]System.EventHandler AutomaticEvent
.field private notserialized class [mscorlib]System.EventHandler AutomaticEventWithInitializer
.field private int32 '<Value>k__BackingField'
@ -167,6 +168,22 @@ @@ -167,6 +168,22 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed
{
// Code size 12 (0xc)
.maxstack 1
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::someField
IL_0007: stloc.0
IL_0008: br.s IL_000a
IL_000a: ldloc.0
IL_000b: ret
} // end of method PropertiesAndEvents::get_NotAnAutoProperty
.method public hidebysig specialname instance void
add_AutomaticEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
@ -390,13 +407,13 @@ @@ -390,13 +407,13 @@
.event [mscorlib]System.EventHandler AutomaticEvent
{
.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)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEvent(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEvent
.event [mscorlib]System.EventHandler AutomaticEventWithInitializer
{
.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)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEventWithInitializer
.event [mscorlib]System.EventHandler CustomEvent
{
@ -405,9 +422,13 @@ @@ -405,9 +422,13 @@
} // end of event PropertiesAndEvents::CustomEvent
.property instance int32 Value()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
} // end of property PropertiesAndEvents::Value
.property instance int32 NotAnAutoProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()
} // end of property PropertiesAndEvents::NotAnAutoProperty
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents

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

@ -56,13 +56,13 @@ @@ -56,13 +56,13 @@
.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)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event(class [mscorlib]System.Action)
} // end of event IBase::Event
.property instance int32 Test()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test(int32)
} // end of property IBase::Test
} // end of class IBase
@ -124,11 +124,12 @@ @@ -124,11 +124,12 @@
} // end of event Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Event
.property instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test()
} // end of property Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test
} // end of class Impl
.field private notserialized int32 someField
.field private class [mscorlib]System.EventHandler AutomaticEvent
.field private notserialized class [mscorlib]System.EventHandler AutomaticEventWithInitializer
.field private int32 '<Value>k__BackingField'
@ -158,6 +159,16 @@ @@ -158,6 +159,16 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::someField
IL_0006: ret
} // end of method PropertiesAndEvents::get_NotAnAutoProperty
.method public hidebysig specialname instance void
add_AutomaticEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
@ -349,13 +360,13 @@ @@ -349,13 +360,13 @@
.event [mscorlib]System.EventHandler AutomaticEvent
{
.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)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEvent(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEvent
.event [mscorlib]System.EventHandler AutomaticEventWithInitializer
{
.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)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEventWithInitializer
.event [mscorlib]System.EventHandler CustomEvent
{
@ -364,9 +375,13 @@ @@ -364,9 +375,13 @@
} // end of event PropertiesAndEvents::CustomEvent
.property instance int32 Value()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
} // end of property PropertiesAndEvents::Value
.property instance int32 NotAnAutoProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()
} // end of property PropertiesAndEvents::NotAnAutoProperty
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents

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

@ -140,7 +140,7 @@ @@ -140,7 +140,7 @@
{
.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 class [mscorlib]System.EventHandler '<>9__15_0'
.field public static class [mscorlib]System.EventHandler '<>9__18_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -162,16 +162,17 @@ @@ -162,16 +162,17 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<.ctor>b__15_0'(object '<p0>',
'<.ctor>b__18_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method '<>c'::'<.ctor>b__15_0'
} // end of method '<>c'::'<.ctor>b__18_0'
} // end of class '<>c'
.field private notserialized int32 someField
.field private int32 '<Value>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private class [mscorlib]System.EventHandler AutomaticEvent
@ -201,6 +202,16 @@ @@ -201,6 +202,16 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::someField
IL_0006: ret
} // end of method PropertiesAndEvents::get_NotAnAutoProperty
.method public hidebysig specialname instance void
add_AutomaticEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
@ -369,18 +380,18 @@ @@ -369,18 +380,18 @@
// Code size 44 (0x2c)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__15_0'
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__18_0'
IL_0006: dup
IL_0007: brtrue.s IL_0020
IL_0009: pop
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__15_0'(object,
IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__18_0'(object,
class [mscorlib]System.EventArgs)
IL_0015: newobj instance void [mscorlib]System.EventHandler::.ctor(object,
native int)
IL_001a: dup
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__15_0'
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__18_0'
IL_0020: stfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::AutomaticEventWithInitializer
IL_0025: ldarg.0
IL_0026: call instance void [mscorlib]System.Object::.ctor()
@ -407,6 +418,10 @@ @@ -407,6 +418,10 @@
.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
.property instance int32 NotAnAutoProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()
} // end of property PropertiesAndEvents::NotAnAutoProperty
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents

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

@ -145,7 +145,7 @@ @@ -145,7 +145,7 @@
{
.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 class [mscorlib]System.EventHandler '<>9__15_0'
.field public static class [mscorlib]System.EventHandler '<>9__18_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -168,17 +168,18 @@ @@ -168,17 +168,18 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<.ctor>b__15_0'(object '<p0>',
'<.ctor>b__18_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method '<>c'::'<.ctor>b__15_0'
} // end of method '<>c'::'<.ctor>b__18_0'
} // end of class '<>c'
.field private notserialized int32 someField
.field private int32 '<Value>k__BackingField'
.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 )
@ -211,6 +212,16 @@ @@ -211,6 +212,16 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::someField
IL_0006: ret
} // end of method PropertiesAndEvents::get_NotAnAutoProperty
.method public hidebysig specialname instance void
add_AutomaticEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
@ -383,18 +394,18 @@ @@ -383,18 +394,18 @@
// Code size 45 (0x2d)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__15_0'
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__18_0'
IL_0006: dup
IL_0007: brtrue.s IL_0020
IL_0009: pop
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__15_0'(object,
IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__18_0'(object,
class [mscorlib]System.EventArgs)
IL_0015: newobj instance void [mscorlib]System.EventHandler::.ctor(object,
native int)
IL_001a: dup
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__15_0'
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__18_0'
IL_0020: stfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::AutomaticEventWithInitializer
IL_0025: ldarg.0
IL_0026: call instance void [mscorlib]System.Object::.ctor()
@ -422,6 +433,10 @@ @@ -422,6 +433,10 @@
.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
.property instance int32 NotAnAutoProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()
} // end of property PropertiesAndEvents::NotAnAutoProperty
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents

23
ICSharpCode.Decompiler/CSharp/Transforms/PatternStatementTransform.cs

@ -511,17 +511,18 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -511,17 +511,18 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
RemoveCompilerGeneratedAttribute(property.Setter.Attributes);
property.Getter.Body = null;
property.Setter.Body = null;
}
// Add C# 7.3 attributes on backing field:
var attributes = fieldInfo.Attributes
.Where(a => !attributeTypesToRemoveFromAutoProperties.Any(t => t == a.AttributeType.FullName))
.Select(context.TypeSystemAstBuilder.ConvertAttribute).ToArray();
if (attributes.Length > 0) {
var section = new AttributeSection {
AttributeTarget = "field"
};
section.Attributes.AddRange(attributes);
property.Attributes.Add(section);
// Add C# 7.3 attributes on backing field:
var attributes = fieldInfo.Attributes
.Where(a => !attributeTypesToRemoveFromAutoProperties.Any(t => t == a.AttributeType.FullName))
.Select(context.TypeSystemAstBuilder.ConvertAttribute).ToArray();
if (attributes.Length > 0) {
var section = new AttributeSection {
AttributeTarget = "field"
};
section.Attributes.AddRange(attributes);
property.Attributes.Add(section);
}
}
// Since the property instance is not changed, we can continue in the visitor as usual, so return null
return null;

Loading…
Cancel
Save