X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fsymbolwriter.cs;h=5159f73d0bfa97257b8ddbb4a305a6a7123db94b;hb=2d23bfcbce7a3f7e54dcd5911adb88b244baca35;hp=a930b7040c8054db335b94d2f61f27ceee871e34;hpb=855c168103764fc419255392be76c5c0bec1ebba;p=mono.git diff --git a/mcs/mcs/symbolwriter.cs b/mcs/mcs/symbolwriter.cs index a930b7040c8..5159f73d0bf 100644 --- a/mcs/mcs/symbolwriter.cs +++ b/mcs/mcs/symbolwriter.cs @@ -9,7 +9,6 @@ // using System; -using System.Collections; using System.Reflection; using System.Reflection.Emit; @@ -25,10 +24,12 @@ namespace Mono.CSharp { private static SymbolWriterImpl symwriter; class SymbolWriterImpl : MonoSymbolWriter { +#if !NET_4_0 delegate int GetILOffsetFunc (ILGenerator ig); + GetILOffsetFunc get_il_offset_func; +#endif delegate Guid GetGuidFunc (ModuleBuilder mb); - GetILOffsetFunc get_il_offset_func; GetGuidFunc get_guid_func; ModuleBuilder module_builder; @@ -41,7 +42,11 @@ namespace Mono.CSharp { public int GetILOffset (ILGenerator ig) { +#if NET_4_0 + return ig.ILOffset; +#else return get_il_offset_func (ig); +#endif } public void WriteSymbolFile () @@ -52,7 +57,9 @@ namespace Mono.CSharp { public bool Initialize () { - MethodInfo mi = typeof (ILGenerator).GetMethod ( + MethodInfo mi; +#if !NET_4_0 + mi = typeof (ILGenerator).GetMethod ( "Mono_GetCurrentOffset", BindingFlags.Static | BindingFlags.NonPublic); if (mi == null) @@ -60,6 +67,7 @@ namespace Mono.CSharp { get_il_offset_func = (GetILOffsetFunc) System.Delegate.CreateDelegate ( typeof (GetILOffsetFunc), mi); +#endif mi = typeof (ModuleBuilder).GetMethod ( "Mono_GetGuid", @@ -84,10 +92,13 @@ namespace Mono.CSharp { } } - public static void OpenMethod (ICompileUnit file, ISourceMethod method) + public static SourceMethodBuilder OpenMethod (ICompileUnit file, int ns_id, + IMethodDef method) { if (symwriter != null) - symwriter.OpenMethod (file, method); + return symwriter.OpenMethod (file, ns_id, method); + else + return null; } public static void CloseMethod () @@ -170,62 +181,50 @@ namespace Mono.CSharp { symwriter.DefineCapturedScope (scope_id, id, captured_name); } - public static void SetRealMethodName (string name) - { - if (symwriter != null) - symwriter.SetRealMethodName (name); - } - - public static void SetCompilerGenerated () - { - if (symwriter != null) - symwriter.SetCompilerGenerated (); - } - - public static void OpenCompilerGeneratedBlock (ILGenerator ig) + public static void OpenCompilerGeneratedBlock (EmitContext ec) { if (symwriter != null) { - int offset = symwriter.GetILOffset (ig); + int offset = symwriter.GetILOffset (ec.ig); symwriter.OpenCompilerGeneratedBlock (offset); } } - public static void CloseCompilerGeneratedBlock (ILGenerator ig) + public static void CloseCompilerGeneratedBlock (EmitContext ec) { if (symwriter != null) { - int offset = symwriter.GetILOffset (ig); + int offset = symwriter.GetILOffset (ec.ig); symwriter.CloseCompilerGeneratedBlock (offset); } } - public static void StartIteratorBody (ILGenerator ig) + public static void StartIteratorBody (EmitContext ec) { if (symwriter != null) { - int offset = symwriter.GetILOffset (ig); + int offset = symwriter.GetILOffset (ec.ig); symwriter.StartIteratorBody (offset); } } - public static void EndIteratorBody (ILGenerator ig) + public static void EndIteratorBody (EmitContext ec) { if (symwriter != null) { - int offset = symwriter.GetILOffset (ig); + int offset = symwriter.GetILOffset (ec.ig); symwriter.EndIteratorBody (offset); } } - public static void StartIteratorDispatcher (ILGenerator ig) + public static void StartIteratorDispatcher (EmitContext ec) { if (symwriter != null) { - int offset = symwriter.GetILOffset (ig); + int offset = symwriter.GetILOffset (ec.ig); symwriter.StartIteratorDispatcher (offset); } } - public static void EndIteratorDispatcher (ILGenerator ig) + public static void EndIteratorDispatcher (EmitContext ec) { if (symwriter != null) { - int offset = symwriter.GetILOffset (ig); + int offset = symwriter.GetILOffset (ec.ig); symwriter.EndIteratorDispatcher (offset); } } @@ -234,9 +233,10 @@ namespace Mono.CSharp { public static void MarkSequencePoint (ILGenerator ig, Location loc) { if (symwriter != null) { + SourceFileEntry file = loc.SourceFile.SourceFileEntry; int offset = symwriter.GetILOffset (ig); symwriter.MarkSequencePoint ( - offset, loc.File, loc.Row, loc.Column, loc.Hidden); + offset, file, loc.Row, loc.Column, loc.Hidden); } } @@ -256,5 +256,10 @@ namespace Mono.CSharp { return true; } + + public static void Reset () + { + symwriter = null; + } } }