diff options
author | Marek Safar <marek.safar@gmail.com> | 2015-06-22 18:56:16 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2015-06-22 18:57:26 +0300 |
commit | e040f8f8d17a330f1a577c67aea3bb7b8d8f9292 (patch) | |
tree | eab3c7393d1409e86c11ee8674b361238630d185 /mcs/class/PEAPI | |
parent | b92d706d0c848b9d99330787e857152c9cdc0193 (diff) |
[ilasm] Add another undocumented custom attributes initializer syntax
Diffstat (limited to 'mcs/class/PEAPI')
-rw-r--r-- | mcs/class/PEAPI/Metadata.cs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/mcs/class/PEAPI/Metadata.cs b/mcs/class/PEAPI/Metadata.cs index c40f4a9ee95..5e33ca09a9b 100644 --- a/mcs/class/PEAPI/Metadata.cs +++ b/mcs/class/PEAPI/Metadata.cs @@ -453,17 +453,17 @@ namespace PEAPI { if (bac != null) return bac.val; + var ms = new MemoryStream (); + // Version info + ms.WriteByte (1); + ms.WriteByte (0); + var sc = c as StringConst; if (sc != null) { string value = sc.val; if (value == null) throw new NotImplementedException (); - var ms = new MemoryStream (); - // Version info - ms.WriteByte (1); - ms.WriteByte (0); - var buf = Encoding.UTF8.GetBytes (value); MetaData.CompressNum ((uint) buf.Length, ms); var byteVal = ms.ToArray (); @@ -472,6 +472,15 @@ namespace PEAPI { return byteVal; } + var ac = c as ArrayConstant; + if (ac != null) { + var bw = new BinaryWriter (ms); + bw.Write (ac.ExplicitSize.Value); + ac.Write (bw); + bw.Write ((short)0); + return ms.ToArray (); + } + throw new NotImplementedException (c.GetType ().ToString ()); } @@ -2942,7 +2951,7 @@ namespace PEAPI { /// <summary> /// Boolean constant /// </summary> - public class BoolConst : Constant { + public class BoolConst : DataConstant { bool val; /// <summary> @@ -3296,6 +3305,8 @@ namespace PEAPI { } } + public int? ExplicitSize { get; set; } + internal sealed override void Write(BinaryWriter bw) { for (int i=0; i < dataVals.Length; i++) { |