Przeglądaj źródła

Switch symbol writer to public api

Marek Safar 15 lat temu
rodzic
commit
5e61ba899a

+ 1 - 11
mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs

@@ -110,15 +110,14 @@ namespace Mono.CompilerServices.SymbolWriter
 	}
 
 #if !CECIL
+	// TODO: Obsolete under .net 4
 	internal class MonoDebuggerSupport
 	{
 		static GetMethodTokenFunc get_method_token;
 		static GetGuidFunc get_guid;
-		static GetLocalIndexFunc get_local_index;
 
 		delegate int GetMethodTokenFunc (MethodBase method);
 		delegate Guid GetGuidFunc (Module module);
-		delegate int GetLocalIndexFunc (SRE.LocalBuilder local);
 
 		static Delegate create_delegate (Type type, Type delegate_type, string name)
 		{
@@ -138,10 +137,6 @@ namespace Mono.CompilerServices.SymbolWriter
 
 			get_guid = (GetGuidFunc) create_delegate (
 				typeof (Module), typeof (GetGuidFunc), "Mono_GetGuid");
-
-			get_local_index = (GetLocalIndexFunc) create_delegate (
-				typeof (SRE.LocalBuilder), typeof (GetLocalIndexFunc),
-				"Mono_GetLocalIndex");
 		}
 
 		public static int GetMethodToken (MethodBase method)
@@ -153,11 +148,6 @@ namespace Mono.CompilerServices.SymbolWriter
 		{
 			return get_guid (module);
 		}
-
-		public static int GetLocalIndex (SRE.LocalBuilder local)
-		{
-			return get_local_index (local);
-		}
 	}
 #endif
 

+ 0 - 5
mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs

@@ -95,11 +95,6 @@ namespace System.Reflection.Emit {
 			}
 		}
 
-		internal static int Mono_GetLocalIndex (LocalBuilder builder)
-		{
-			return builder.position;
-		}
-
 		internal string Name {
 			get { return name; }
 		}

+ 9 - 11
mcs/mcs/symbolwriter.cs

@@ -1,11 +1,13 @@
 //
-// symbolwriter.cs: The symbol writer
+// symbolwriter.cs: The debug symbol writer
 //
-// Author:
-//   Martin Baulig (martin@ximian.com)
+// Authors: Martin Baulig ([email protected])
+//          Marek Safar (marek.safar@gmail.com)
 //
-// Copyright 2003 Ximian, Inc.
-// Copyright 2003-2008 Novell, Inc.
+// Dual licensed under the terms of the MIT X11 or GNU GPL
+//
+// Copyright 2003 Ximian, Inc (http://www.ximian.com)
+// Copyright 2004-2010 Novell, Inc
 //
 
 using System;
@@ -92,8 +94,7 @@ namespace Mono.CSharp {
 		public static void DefineLocalVariable (string name, LocalBuilder builder)
 		{
 			if (symwriter != null) {
-				int index = MonoDebuggerSupport.GetLocalIndex (builder);
-				symwriter.DefineLocalVariable (index, name);
+				symwriter.DefineLocalVariable (builder.LocalIndex, name);
 			}
 		}
 
@@ -139,7 +140,6 @@ namespace Mono.CSharp {
 				return -1;
 		}
 
-#region Terrania additions
 		public static void DefineAnonymousScope (int id)
 		{
 			if (symwriter != null)
@@ -149,8 +149,7 @@ namespace Mono.CSharp {
 		public static void DefineScopeVariable (int scope, LocalBuilder builder)
 		{
 			if (symwriter != null) {
-				int index = MonoDebuggerSupport.GetLocalIndex (builder);
-				symwriter.DefineScopeVariable (scope, index);
+				symwriter.DefineScopeVariable (scope, builder.LocalIndex);
 			}
 		}
 
@@ -233,7 +232,6 @@ namespace Mono.CSharp {
 				symwriter.EndIteratorDispatcher (offset);
 			}
 		}
-#endregion
 
 		public static void MarkSequencePoint (ILGenerator ig, Location loc)
 		{