diff options
author | Marek Safar <marek.safar@gmail.com> | 2015-06-23 19:12:53 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2015-06-23 20:35:58 +0300 |
commit | 47f5b69bfbeb82078054841f174a347fc3da786a (patch) | |
tree | 88ebc675be216a5b17048e6d95c7bf96e4307709 /mcs/class/PEAPI | |
parent | eaee29fbd7a6d0b470e7a33e80bbab11a3200ef8 (diff) |
[ilasm] Even more undocumented custom attributes syntax
Diffstat (limited to 'mcs/class/PEAPI')
-rw-r--r-- | mcs/class/PEAPI/Metadata.cs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/mcs/class/PEAPI/Metadata.cs b/mcs/class/PEAPI/Metadata.cs index 5e33ca09a9b..d983c8a2a2c 100644 --- a/mcs/class/PEAPI/Metadata.cs +++ b/mcs/class/PEAPI/Metadata.cs @@ -458,6 +458,12 @@ namespace PEAPI { ms.WriteByte (1); ms.WriteByte (0); + if (c == null) { + ms.WriteByte (0); + ms.WriteByte (0); + return ms.ToArray (); + } + var sc = c as StringConst; if (sc != null) { string value = sc.val; @@ -475,12 +481,21 @@ namespace PEAPI { var ac = c as ArrayConstant; if (ac != null) { var bw = new BinaryWriter (ms); - bw.Write (ac.ExplicitSize.Value); + if (ac.ExplicitSize != null) + bw.Write (ac.ExplicitSize.Value); ac.Write (bw); bw.Write ((short)0); return ms.ToArray (); } + var bc = c as DataConstant; + if (bc != null) { + var bw = new BinaryWriter (ms); + bc.Write (bw); + bw.Write ((short)0); + return ms.ToArray (); + } + throw new NotImplementedException (c.GetType ().ToString ()); } @@ -3149,7 +3164,7 @@ namespace PEAPI { } - public class UIntConst : Constant { + public class UIntConst : DataConstant { ulong val; public UIntConst(byte val) |