public class SymbolWriterImpl: ISymbolWriter
{
MonoSymbolWriter msw;
- ModuleBuilder mb;
- delegate Guid GetGuidFunc (ModuleBuilder mb);
- GetGuidFunc get_guid_func;
-
+ int nextLocalIndex;
int currentToken;
string methodName;
Stack namespaceStack = new Stack ();
bool methodOpened;
-
+
Hashtable documents = new Hashtable ();
+
+#if !CECIL && !MOBILE
+ ModuleBuilder mb;
+ delegate Guid GetGuidFunc (ModuleBuilder mb);
+ GetGuidFunc get_guid_func;
public SymbolWriterImpl (ModuleBuilder mb)
{
msw.WriteSymbolFile (get_guid_func (mb));
}
+#else
+ Guid guid;
+
+ public SymbolWriterImpl (Guid guid)
+ {
+ this.guid = guid;
+ }
+
+ public void Close ()
+ {
+ msw.WriteSymbolFile (guid);
+ }
+#endif
public void CloseMethod ()
{
if (methodOpened) {
methodOpened = false;
+ nextLocalIndex = 0;
msw.CloseMethod ();
}
}
{
SymbolDocumentWriterImpl doc = (SymbolDocumentWriterImpl) documents [url];
if (doc == null) {
- doc = new SymbolDocumentWriterImpl (msw.DefineDocument (url));
+ SourceFileEntry entry = msw.DefineDocument (url);
+ CompileUnitEntry comp_unit = msw.DefineCompilationUnit (entry);
+ doc = new SymbolDocumentWriterImpl (comp_unit);
documents [url] = doc;
}
return doc;
int startOffset,
int endOffset)
{
- msw.DefineLocalVariable (name, signature);
+ msw.DefineLocalVariable (nextLocalIndex++, name);
}
public void DefineParameter (
int[] endLines,
int[] endColumns)
{
+ SymbolDocumentWriterImpl doc = (SymbolDocumentWriterImpl) document;
+ SourceFileEntry file = doc != null ? doc.Entry.SourceFile : null;
+
for (int n=0; n<offsets.Length; n++) {
if (n > 0 && offsets[n] == offsets[n-1] && lines[n] == lines[n-1] && columns[n] == columns[n-1])
continue;
- msw.MarkSequencePoint (offsets[n], lines[n], columns[n]);
+ msw.MarkSequencePoint (offsets[n], file, lines[n], columns[n], false);
}
}
n.Name = name;
namespaceStack.Push (n);
}
-
+
public int OpenScope (int startOffset)
{
return msw.OpenScope (startOffset);
int endLine,
int endColumn)
{
- SourceMethodImpl sm = new SourceMethodImpl (methodName, currentToken, GetCurrentNamespace (startDoc));
- msw.OpenMethod (startDoc as ISourceFile, sm, startLine, startColumn, endLine, endColumn);
+ int nsId = GetCurrentNamespace (startDoc);
+ SourceMethodImpl sm = new SourceMethodImpl (methodName, currentToken, nsId);
+ msw.OpenMethod (((ICompileUnit)startDoc).Entry, nsId, sm);
methodOpened = true;
}
}
ni.UsingClauses.Add (fullName);
}
-
+
int GetCurrentNamespace (ISymbolDocumentWriter doc)
{
if (namespaceStack.Count == 0) {
namespaceStack.Push (ni);
}
- ni.NamespaceID = msw.DefineNamespace (ni.Name, ((ISourceFile)doc).Entry, usings, parentId);
+ ni.NamespaceID = msw.DefineNamespace (ni.Name, ((ICompileUnit)doc).Entry, usings, parentId);
}
return ni.NamespaceID;
}
+
}
- class SymbolDocumentWriterImpl: ISymbolDocumentWriter, ISourceFile
+ class SymbolDocumentWriterImpl: ISymbolDocumentWriter, ISourceFile, ICompileUnit
{
- SourceFileEntry entry;
+ CompileUnitEntry comp_unit;
- public SymbolDocumentWriterImpl (SourceFileEntry e)
+ public SymbolDocumentWriterImpl (CompileUnitEntry comp_unit)
{
- entry = e;
+ this.comp_unit = comp_unit;
}
public void SetCheckSum (Guid algorithmId, byte[] checkSum)
public void SetSource (byte[] source)
{
}
+
+ SourceFileEntry ISourceFile.Entry {
+ get { return comp_unit.SourceFile; }
+ }
- public SourceFileEntry Entry {
- get { return entry; }
+ public CompileUnitEntry Entry {
+ get { return comp_unit; }
}
}
- class SourceMethodImpl: ISourceMethod
+ class SourceMethodImpl: IMethodDef
{
string name;
int token;