projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't print null on exit
[mono.git]
/
mcs
/
mcs
/
symbolwriter.cs
diff --git
a/mcs/mcs/symbolwriter.cs
b/mcs/mcs/symbolwriter.cs
index fd97f5e13242e413543ceec62debae62c74786e2..5159f73d0bfa97257b8ddbb4a305a6a7123db94b 100644
(file)
--- a/
mcs/mcs/symbolwriter.cs
+++ b/
mcs/mcs/symbolwriter.cs
@@
-4,11
+4,11
@@
// Author:
// Martin Baulig (martin@ximian.com)
//
// Author:
// Martin Baulig (martin@ximian.com)
//
-// (C) 2003 Ximian, Inc.
+// Copyright 2003 Ximian, Inc.
+// Copyright 2003-2008 Novell, Inc.
//
using System;
//
using System;
-using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
using System.Reflection;
using System.Reflection.Emit;
@@
-24,10
+24,12
@@
namespace Mono.CSharp {
private static SymbolWriterImpl symwriter;
class SymbolWriterImpl : MonoSymbolWriter {
private static SymbolWriterImpl symwriter;
class SymbolWriterImpl : MonoSymbolWriter {
+#if !NET_4_0
delegate int GetILOffsetFunc (ILGenerator ig);
delegate int GetILOffsetFunc (ILGenerator ig);
+ GetILOffsetFunc get_il_offset_func;
+#endif
delegate Guid GetGuidFunc (ModuleBuilder mb);
delegate Guid GetGuidFunc (ModuleBuilder mb);
- GetILOffsetFunc get_il_offset_func;
GetGuidFunc get_guid_func;
ModuleBuilder module_builder;
GetGuidFunc get_guid_func;
ModuleBuilder module_builder;
@@
-40,7
+42,11
@@
namespace Mono.CSharp {
public int GetILOffset (ILGenerator ig)
{
public int GetILOffset (ILGenerator ig)
{
+#if NET_4_0
+ return ig.ILOffset;
+#else
return get_il_offset_func (ig);
return get_il_offset_func (ig);
+#endif
}
public void WriteSymbolFile ()
}
public void WriteSymbolFile ()
@@
-51,7
+57,9
@@
namespace Mono.CSharp {
public bool Initialize ()
{
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)
"Mono_GetCurrentOffset",
BindingFlags.Static | BindingFlags.NonPublic);
if (mi == null)
@@
-59,6
+67,7
@@
namespace Mono.CSharp {
get_il_offset_func = (GetILOffsetFunc) System.Delegate.CreateDelegate (
typeof (GetILOffsetFunc), mi);
get_il_offset_func = (GetILOffsetFunc) System.Delegate.CreateDelegate (
typeof (GetILOffsetFunc), mi);
+#endif
mi = typeof (ModuleBuilder).GetMethod (
"Mono_GetGuid",
mi = typeof (ModuleBuilder).GetMethod (
"Mono_GetGuid",
@@
-83,13
+92,13
@@
namespace Mono.CSharp {
}
}
}
}
- public static void OpenMethod (ISourceFile file, ISourceMethod method,
- int start_row, int start_column,
- int end_row, int end_column)
+ public static SourceMethodBuilder OpenMethod (ICompileUnit file, int ns_id,
+ IMethodDef method)
{
if (symwriter != null)
{
if (symwriter != null)
- symwriter.OpenMethod (file, method, start_row, start_column,
- end_row, end_column);
+ return symwriter.OpenMethod (file, ns_id, method);
+ else
+ return null;
}
public static void CloseMethod ()
}
public static void CloseMethod ()
@@
-116,7
+125,7
@@
namespace Mono.CSharp {
}
}
}
}
- public static int DefineNamespace (string name,
SourceFile
Entry source,
+ public static int DefineNamespace (string name,
CompileUnit
Entry source,
string[] using_clauses, int parent)
{
if (symwriter != null)
string[] using_clauses, int parent)
{
if (symwriter != null)
@@
-172,66
+181,62
@@
namespace Mono.CSharp {
symwriter.DefineCapturedScope (scope_id, id, captured_name);
}
symwriter.DefineCapturedScope (scope_id, id, captured_name);
}
- public static void SetRealMethodName (string name)
- {
- if (symwriter != null)
- symwriter.SetRealMethodName (name);
- }
-
- public static void OpenCompilerGeneratedBlock (ILGenerator ig)
+ public static void OpenCompilerGeneratedBlock (EmitContext ec)
{
if (symwriter != null) {
{
if (symwriter != null) {
- int offset = symwriter.GetILOffset (ig);
+ int offset = symwriter.GetILOffset (
ec.
ig);
symwriter.OpenCompilerGeneratedBlock (offset);
}
}
symwriter.OpenCompilerGeneratedBlock (offset);
}
}
- public static void CloseCompilerGeneratedBlock (
ILGenerator ig
)
+ public static void CloseCompilerGeneratedBlock (
EmitContext ec
)
{
if (symwriter != null) {
{
if (symwriter != null) {
- int offset = symwriter.GetILOffset (ig);
+ int offset = symwriter.GetILOffset (
ec.
ig);
symwriter.CloseCompilerGeneratedBlock (offset);
}
}
symwriter.CloseCompilerGeneratedBlock (offset);
}
}
- public static void StartIteratorBody (
ILGenerator ig
)
+ public static void StartIteratorBody (
EmitContext ec
)
{
if (symwriter != null) {
{
if (symwriter != null) {
- int offset = symwriter.GetILOffset (ig);
+ int offset = symwriter.GetILOffset (
ec.
ig);
symwriter.StartIteratorBody (offset);
}
}
symwriter.StartIteratorBody (offset);
}
}
- public static void EndIteratorBody (
ILGenerator ig
)
+ public static void EndIteratorBody (
EmitContext ec
)
{
if (symwriter != null) {
{
if (symwriter != null) {
- int offset = symwriter.GetILOffset (ig);
+ int offset = symwriter.GetILOffset (
ec.
ig);
symwriter.EndIteratorBody (offset);
}
}
symwriter.EndIteratorBody (offset);
}
}
- public static void StartIteratorDispatcher (
ILGenerator ig
)
+ public static void StartIteratorDispatcher (
EmitContext ec
)
{
if (symwriter != null) {
{
if (symwriter != null) {
- int offset = symwriter.GetILOffset (ig);
+ int offset = symwriter.GetILOffset (
ec.
ig);
symwriter.StartIteratorDispatcher (offset);
}
}
symwriter.StartIteratorDispatcher (offset);
}
}
- public static void EndIteratorDispatcher (
ILGenerator ig
)
+ public static void EndIteratorDispatcher (
EmitContext ec
)
{
if (symwriter != null) {
{
if (symwriter != null) {
- int offset = symwriter.GetILOffset (ig);
+ int offset = symwriter.GetILOffset (
ec.
ig);
symwriter.EndIteratorDispatcher (offset);
}
}
#endregion
symwriter.EndIteratorDispatcher (offset);
}
}
#endregion
- public static void MarkSequencePoint (ILGenerator ig,
int row, int column
)
+ public static void MarkSequencePoint (ILGenerator ig,
Location loc
)
{
if (symwriter != null) {
{
if (symwriter != null) {
+ SourceFileEntry file = loc.SourceFile.SourceFileEntry;
int offset = symwriter.GetILOffset (ig);
int offset = symwriter.GetILOffset (ig);
- symwriter.MarkSequencePoint (offset, row, column);
+ symwriter.MarkSequencePoint (
+ offset, file, loc.Row, loc.Column, loc.Hidden);
}
}
}
}
@@
-251,5
+256,10
@@
namespace Mono.CSharp {
return true;
}
return true;
}
+
+ public static void Reset ()
+ {
+ symwriter = null;
+ }
}
}
}
}