Bring jbevain/cecil's commit a2c944bd45b81443fd61cfd27d98ff551fa6938c, Add enum value...
[mono.git] / mcs / class / Mono.Cecil / Mono.Cecil / TypeDefinition.cs
index a1575e1b0ec70f3975ccca8a766cdf3e75dceeb3..4079406d4054087f9004bbecf9d143d5201db1dc 100644 (file)
@@ -27,7 +27,7 @@
 //
 
 using System;
-
+using Mono.Cecil.Metadata;
 using Mono.Collections.Generic;
 
 namespace Mono.Cecil {
@@ -388,6 +388,11 @@ namespace Mono.Cecil {
                        set { attributes = attributes.SetAttributes ((uint) TypeAttributes.Serializable, value); }
                }
 
+               public bool IsWindowsRuntime {
+                       get { return attributes.GetAttributes ((uint) TypeAttributes.WindowsRuntime); }
+                       set { attributes = attributes.SetAttributes ((uint) TypeAttributes.WindowsRuntime, value); }
+               }
+
                public bool IsAnsiClass {
                        get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AnsiClass); }
                        set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AnsiClass, value); }
@@ -433,6 +438,23 @@ namespace Mono.Cecil {
                        }
                }
 
+               public override bool IsPrimitive {
+                       get {
+                               ElementType primitive_etype;
+                               return MetadataSystem.TryGetPrimitiveElementType (this, out primitive_etype);
+                       }
+               }
+
+               public override MetadataType MetadataType {
+                       get {
+                               ElementType primitive_etype;
+                               if (MetadataSystem.TryGetPrimitiveElementType (this, out primitive_etype))
+                                       return (MetadataType) primitive_etype;
+
+                               return base.MetadataType;
+                       }
+               }
+
                public override bool IsDefinition {
                        get { return true; }
                }