[ilasm] Clenup warnings
[mono.git] / mcs / ilasm / codegen / FieldDef.cs
index 130f739f8d4d90f37433fa34b5293485683c9904..456b9a5ee239bccfc8984545a759ca195eda8a26 100644 (file)
@@ -16,13 +16,14 @@ namespace Mono.ILASM {
         public class FieldDef : ICustomAttrTarget {
 
                 private string name;
-                private ITypeRef type;
+                private BaseTypeRef type;
                 private PEAPI.FieldAttr attr;
                 private PEAPI.FieldDef field_def;
                 private ArrayList customattr_list;
+                private PEAPI.NativeType native_type;
 
                 private bool offset_set;
-                private bool datavalue_set;
+//                private bool datavalue_set;
                 private bool value_set;
 
                 private bool is_resolved;
@@ -32,14 +33,14 @@ namespace Mono.ILASM {
                 private string at_data_id;
 
                 public FieldDef (PEAPI.FieldAttr attr, string name,
-                                ITypeRef type)
+                                BaseTypeRef type)
                 {
                         this.attr = attr;
                         this.name = name;
                         this.type = type;
 
                         offset_set = false;
-                        datavalue_set = false;
+//                        datavalue_set = false;
                         value_set = false;
 
                         at_data_id = null;
@@ -64,6 +65,10 @@ namespace Mono.ILASM {
                         set { attr = value; }
                 }
 
+                public BaseTypeRef Type {
+                        get { return type; }
+                }
+
                 public void SetOffset (uint val)
                 {
                         offset_set = true;
@@ -88,6 +93,11 @@ namespace Mono.ILASM {
 
                         customattr_list.Add (customattr);
                 }
+                
+                public void AddMarshalInfo (PEAPI.NativeType native_type)
+                {
+                        this.native_type = native_type;        
+                }
 
                 public PEAPI.FieldDef Resolve (CodeGen code_gen)
                 {
@@ -114,6 +124,9 @@ namespace Mono.ILASM {
                                 foreach (CustomAttr customattr in customattr_list)
                                         customattr.AddTo (code_gen, field_def);
 
+                        if (native_type != null)
+                                field_def.SetMarshalInfo (native_type);
+
                         is_resolved = true;
 
                         return field_def;