MonoSymbolWriter.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. //using System;
  2. //using System.Collections.Generic;
  3. //using System.IO;
  4. //namespace Mono.CompilerServices.SymbolWriter
  5. //{
  6. // public class MonoSymbolWriter
  7. // {
  8. // private List<SourceMethodBuilder> methods;
  9. // private List<SourceFileEntry> sources;
  10. // private List<CompileUnitEntry> comp_units;
  11. // protected readonly MonoSymbolFile file;
  12. // private string filename;
  13. // private SourceMethodBuilder current_method;
  14. // private Stack<SourceMethodBuilder> current_method_stack = new Stack<SourceMethodBuilder>();
  15. // public MonoSymbolFile SymbolFile
  16. // {
  17. // get
  18. // {
  19. // return this.file;
  20. // }
  21. // }
  22. // public MonoSymbolWriter(string filename)
  23. // {
  24. // this.methods = new List<SourceMethodBuilder>();
  25. // this.sources = new List<SourceFileEntry>();
  26. // this.comp_units = new List<CompileUnitEntry>();
  27. // this.file = new MonoSymbolFile();
  28. // this.filename = filename + ".mdb";
  29. // }
  30. // public void CloseNamespace()
  31. // {
  32. // }
  33. // public void DefineLocalVariable(int index, string name)
  34. // {
  35. // if (this.current_method != null)
  36. // {
  37. // this.current_method.AddLocal(index, name);
  38. // }
  39. // }
  40. // public void DefineCapturedLocal(int scope_id, string name, string captured_name)
  41. // {
  42. // this.file.DefineCapturedVariable(scope_id, name, captured_name, CapturedVariable.CapturedKind.Local);
  43. // }
  44. // public void DefineCapturedParameter(int scope_id, string name, string captured_name)
  45. // {
  46. // this.file.DefineCapturedVariable(scope_id, name, captured_name, CapturedVariable.CapturedKind.Parameter);
  47. // }
  48. // public void DefineCapturedThis(int scope_id, string captured_name)
  49. // {
  50. // this.file.DefineCapturedVariable(scope_id, "this", captured_name, CapturedVariable.CapturedKind.This);
  51. // }
  52. // public void DefineCapturedScope(int scope_id, int id, string captured_name)
  53. // {
  54. // this.file.DefineCapturedScope(scope_id, id, captured_name);
  55. // }
  56. // public void DefineScopeVariable(int scope, int index)
  57. // {
  58. // if (this.current_method != null)
  59. // {
  60. // this.current_method.AddScopeVariable(scope, index);
  61. // }
  62. // }
  63. // public void MarkSequencePoint(int offset, SourceFileEntry file, int line, int column, bool is_hidden)
  64. // {
  65. // if (this.current_method != null)
  66. // {
  67. // this.current_method.MarkSequencePoint(offset, file, line, column, is_hidden);
  68. // }
  69. // }
  70. // public SourceMethodBuilder OpenMethod(ICompileUnit file, int ns_id, IMethodDef method)
  71. // {
  72. // SourceMethodBuilder builder = new SourceMethodBuilder(file, ns_id, method);
  73. // this.current_method_stack.Push(this.current_method);
  74. // this.current_method = builder;
  75. // this.methods.Add(this.current_method);
  76. // return builder;
  77. // }
  78. // public void CloseMethod()
  79. // {
  80. // this.current_method = this.current_method_stack.Pop();
  81. // }
  82. // public SourceFileEntry DefineDocument(string url)
  83. // {
  84. // SourceFileEntry entry = new SourceFileEntry(this.file, url);
  85. // this.sources.Add(entry);
  86. // return entry;
  87. // }
  88. // public SourceFileEntry DefineDocument(string url, byte[] guid, byte[] checksum)
  89. // {
  90. // SourceFileEntry entry = new SourceFileEntry(this.file, url, guid, checksum);
  91. // this.sources.Add(entry);
  92. // return entry;
  93. // }
  94. // public CompileUnitEntry DefineCompilationUnit(SourceFileEntry source)
  95. // {
  96. // CompileUnitEntry entry = new CompileUnitEntry(this.file, source);
  97. // this.comp_units.Add(entry);
  98. // return entry;
  99. // }
  100. // public int DefineNamespace(string name, CompileUnitEntry unit, string[] using_clauses, int parent)
  101. // {
  102. // if (unit == null || using_clauses == null)
  103. // {
  104. // throw new NullReferenceException();
  105. // }
  106. // return unit.DefineNamespace(name, using_clauses, parent);
  107. // }
  108. // public int OpenScope(int start_offset)
  109. // {
  110. // int result;
  111. // if (this.current_method == null)
  112. // {
  113. // result = 0;
  114. // }
  115. // else
  116. // {
  117. // this.current_method.StartBlock(CodeBlockEntry.Type.Lexical, start_offset);
  118. // result = 0;
  119. // }
  120. // return result;
  121. // }
  122. // public void CloseScope(int end_offset)
  123. // {
  124. // if (this.current_method != null)
  125. // {
  126. // this.current_method.EndBlock(end_offset);
  127. // }
  128. // }
  129. // public void OpenCompilerGeneratedBlock(int start_offset)
  130. // {
  131. // if (this.current_method != null)
  132. // {
  133. // this.current_method.StartBlock(CodeBlockEntry.Type.CompilerGenerated, start_offset);
  134. // }
  135. // }
  136. // public void CloseCompilerGeneratedBlock(int end_offset)
  137. // {
  138. // if (this.current_method != null)
  139. // {
  140. // this.current_method.EndBlock(end_offset);
  141. // }
  142. // }
  143. // public void StartIteratorBody(int start_offset)
  144. // {
  145. // this.current_method.StartBlock(CodeBlockEntry.Type.IteratorBody, start_offset);
  146. // }
  147. // public void EndIteratorBody(int end_offset)
  148. // {
  149. // this.current_method.EndBlock(end_offset);
  150. // }
  151. // public void StartIteratorDispatcher(int start_offset)
  152. // {
  153. // this.current_method.StartBlock(CodeBlockEntry.Type.IteratorDispatcher, start_offset);
  154. // }
  155. // public void EndIteratorDispatcher(int end_offset)
  156. // {
  157. // this.current_method.EndBlock(end_offset);
  158. // }
  159. // public void DefineAnonymousScope(int id)
  160. // {
  161. // this.file.DefineAnonymousScope(id);
  162. // }
  163. // public void WriteSymbolFile(Guid guid)
  164. // {
  165. // foreach (SourceMethodBuilder method in this.methods)
  166. // {
  167. // method.DefineMethod(this.file);
  168. // }
  169. // try
  170. // {
  171. // File.Delete(this.filename);
  172. // }
  173. // catch
  174. // {
  175. // }
  176. // using (FileStream fs = new FileStream(this.filename, FileMode.Create, FileAccess.Write))
  177. // {
  178. // this.file.CreateSymbolFile(guid, fs);
  179. // }
  180. // }
  181. // }
  182. //}