Switch to compiler-tester
[mono.git] / mcs / class / corlib / System.Reflection.Emit / LocalBuilder.cs
old mode 100755 (executable)
new mode 100644 (file)
index 64a134b..5ed11d4
@@ -38,42 +38,50 @@ using System.Reflection;
 using System.Reflection.Emit;
 using System.Globalization;
 using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
 using System.Diagnostics.SymbolStore;
 
 namespace System.Reflection.Emit {
+#if NET_2_0
+       [ComVisible (true)]
+       [ClassInterfaceAttribute (ClassInterfaceType.None)]
+       [ComDefaultInterfaceAttribute (typeof (_LocalBuilder))]
+#endif
+#if NET_2_0
+       public sealed class LocalBuilder : LocalVariableInfo {
+#else
        public sealed class LocalBuilder {
-               //
-               // These are kept in sync with reflection.h
-               //
+#endif
+
+#if NET_2_0
+               // Some fields are already defined in LocalVariableInfo
+               #region Sync with reflection.h
+               private string name;
+               #endregion
+#else
                #region Sync with reflection.h
                private Type type;
+               internal bool is_pinned;
+               internal ushort position;
                private string name;
-               private bool is_pinned;
                #endregion
+#endif
                
-               //
-               // Order does not matter after here
-               //
-               internal ushort position;
                internal ILGenerator ilgen;
+               int startOffset;
+               int endOffset;
 
                internal LocalBuilder (Type t, ILGenerator ilgen)
                {
                        this.type = t;
                        this.ilgen = ilgen;
                }
+
                public void SetLocalSymInfo (string lname, int startOffset, int endOffset)
                {
-                       this.name = lname;
-
-                       SignatureHelper sighelper = SignatureHelper.GetLocalVarSigHelper (ilgen.module);
-                       sighelper.AddArgument (type);
-                       byte[] signature = sighelper.GetSignature ();
-
-                       ilgen.sym_writer.DefineLocalVariable (lname, FieldAttributes.Private,
-                                                                 signature, SymAddressKind.ILOffset,
-                                                                 (int) position, 0, 0,
-                                                                 startOffset, endOffset);
+                       name = lname;
+                       this.startOffset = startOffset;
+                       this.endOffset = endOffset;
                }
 
                public void SetLocalSymInfo (string lname)
@@ -81,17 +89,42 @@ namespace System.Reflection.Emit {
                        SetLocalSymInfo (lname, 0, 0);
                }
 
-
+#if NET_2_0
+               override
+#endif
                public Type LocalType
                {
                        get {
                                return type;
                        }
                }
-               
-               internal void MakePinned ()
+
+#if NET_2_0
+               public override bool IsPinned
                {
-                       is_pinned = true;
+                       get {
+                               return is_pinned;
+                       }
+               }
+
+               public override int LocalIndex
+               {
+                       get {
+                               return position;
+                       }
+               }
+#endif
+
+               internal string Name {
+                       get { return name; }
+               }
+               
+               internal int StartOffset {
+                       get { return startOffset; }
+               }
+               
+               internal int EndOffset {
+                       get { return endOffset; }
                }
        }
 }