| 1 |
using System.Collections.ObjectModel; |
| 2 |
using System.Linq; |
| 3 |
|
| 4 |
using Mono.Cecil; |
| 5 |
|
| 6 |
using Mono.Documentation.Util; |
| 7 |
|
| 8 |
namespace Mono.Documentation.Updater |
| 9 |
{ |
| 10 |
public class DynamicParserContext |
| 11 |
{ |
| 12 |
public ReadOnlyCollection<bool> TransformFlags; |
| 13 |
public int TransformIndex; |
| 14 |
|
| 15 |
public DynamicParserContext (ICustomAttributeProvider provider) |
| 16 |
{ |
| 17 |
CustomAttribute da; |
| 18 |
if (provider.HasCustomAttributes && |
| 19 |
(da = (provider.CustomAttributes.SafeCast<CustomAttribute> () |
| 20 |
.SingleOrDefault (ca => ca.GetDeclaringType () == "System.Runtime.CompilerServices.DynamicAttribute"))) != null) |
| 21 |
{ |
| 22 |
CustomAttributeArgument[] values = da.ConstructorArguments.Count == 0 |
| 23 |
? new CustomAttributeArgument[0] |
| 24 |
: (CustomAttributeArgument[])da.ConstructorArguments[0].Value; |
| 25 |
|
| 26 |
TransformFlags = new ReadOnlyCollection<bool> (values.Select (t => (bool)t.Value).ToArray ()); |
| 27 |
} |
| 28 |
} |
| 29 |
} |
| 30 |
} |