Просмотр исходного кода

2004-10-03 Zoltan Varga <[email protected]>

	* LocalBuilder.cs: Make this inherit from LocalVariableInfo under
	net 2.0. Reorganize fields so the layout visible to the runtime is the
	same under 1.0 and 2.0. Add 2.0 properties.

svn path=/trunk/mcs/; revision=34628
Zoltan Varga 21 лет назад
Родитель
Сommit
9185df356b

+ 6 - 0
mcs/class/corlib/System.Reflection.Emit/ChangeLog

@@ -1,3 +1,9 @@
+2004-10-03  Zoltan Varga  <[email protected]>
+
+	* LocalBuilder.cs: Make this inherit from LocalVariableInfo under
+	net 2.0. Reorganize fields so the layout visible to the runtime is the
+	same under 1.0 and 2.0. Add 2.0 properties.
+
 2004-10-02  Gert Driesen  <[email protected]>
 
 	* TypeBuilder.cs: throw NotSupportedException when defining default

+ 33 - 9
mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs

@@ -41,20 +41,26 @@ using System.Runtime.CompilerServices;
 using System.Diagnostics.SymbolStore;
 
 namespace System.Reflection.Emit {
+#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 Type type;
 		private string name;
+		#endregion
+#else
+		#region Sync with reflection.h
+		private Type type;
 		internal bool is_pinned;
+		internal ushort position;
+		private string name;
 		#endregion
+#endif
 		
-		//
-		// Order does not matter after here
-		//
-		internal ushort position;
 		internal ILGenerator ilgen;
 
 		internal LocalBuilder (Type t, ILGenerator ilgen)
@@ -73,12 +79,30 @@ namespace System.Reflection.Emit {
 			SetLocalSymInfo (lname, 0, 0);
 		}
 
-
+#if NET_2_0
+		override
+#endif
 		public Type LocalType
 		{
 			get {
 				return type;
 			}
 		}
+
+#if NET_2_0
+		public override bool IsPinned
+		{
+			get {
+				return is_pinned;
+			}
+		}
+
+		public override int LocalIndex
+		{
+			get {
+				return position;
+			}
+		}
+#endif
 	}
 }