Merge pull request #1203 from esdrubal/protect
[mono.git] / mcs / class / Mono.CompilerServices.SymbolWriter / MonoSymbolWriter.cs
index 4d6d1f3d2db5a276423c659a5b5d4f3aac544860..b2c2afdba619bdf08b9f47c310f3cab2f15c99a6 100644 (file)
@@ -47,11 +47,7 @@ namespace Mono.CompilerServices.SymbolWriter
                string filename;
                
                private SourceMethodBuilder current_method;
-#if NET_2_1
-               System.Collections.Stack current_method_stack = new System.Collections.Stack ();
-#else
                Stack<SourceMethodBuilder> current_method_stack = new Stack<SourceMethodBuilder> ();
-#endif
 
                public MonoSymbolWriter (string filename)
                {
@@ -239,165 +235,4 @@ namespace Mono.CompilerServices.SymbolWriter
                        }
                }
        }
-
-       public class SourceMethodBuilder
-       {
-               List<LocalVariableEntry> _locals;
-               List<CodeBlockEntry> _blocks;
-               List<ScopeVariable> _scope_vars;
-#if NET_2_1
-               System.Collections.Stack _block_stack;
-#else          
-               Stack<CodeBlockEntry> _block_stack;
-#endif
-               string _real_name;
-               IMethodDef _method;
-               ICompileUnit _comp_unit;
-//             MethodEntry.Flags _method_flags;
-               int _ns_id;
-
-               public SourceMethodBuilder (ICompileUnit comp_unit, int ns_id, IMethodDef method)
-               {
-                       this._comp_unit = comp_unit;
-                       this._method = method;
-                       this._ns_id = ns_id;
-
-                       method_lines = new LineNumberEntry [32];
-               }
-
-               private LineNumberEntry [] method_lines;
-               private int method_lines_pos = 0;
-
-               public void MarkSequencePoint (int offset, SourceFileEntry file, int line, int column,
-                                              bool is_hidden)
-               {
-                       if (method_lines_pos == method_lines.Length) {
-                               LineNumberEntry [] tmp = method_lines;
-                               method_lines = new LineNumberEntry [method_lines.Length * 2];
-                               Array.Copy (tmp, method_lines, method_lines_pos);
-                       }
-
-                       int file_idx = file != null ? file.Index : 0;
-                       method_lines [method_lines_pos++] = new LineNumberEntry (
-                               file_idx, line, offset, is_hidden);
-               }
-
-               public void StartBlock (CodeBlockEntry.Type type, int start_offset)
-               {
-                       if (_block_stack == null) {
-#if NET_2_1
-                               _block_stack = new System.Collections.Stack ();
-#else                          
-                               _block_stack = new Stack<CodeBlockEntry> ();
-#endif
-                       }
-                       
-                       if (_blocks == null)
-                               _blocks = new List<CodeBlockEntry> ();
-
-                       int parent = CurrentBlock != null ? CurrentBlock.Index : -1;
-
-                       CodeBlockEntry block = new CodeBlockEntry (
-                               _blocks.Count + 1, parent, type, start_offset);
-
-                       _block_stack.Push (block);
-                       _blocks.Add (block);
-               }
-
-               public void EndBlock (int end_offset)
-               {
-                       CodeBlockEntry block = (CodeBlockEntry) _block_stack.Pop ();
-                       block.Close (end_offset);
-               }
-
-               public CodeBlockEntry[] Blocks {
-                       get {
-                               if (_blocks == null)
-                                       return new CodeBlockEntry [0];
-
-                               CodeBlockEntry[] retval = new CodeBlockEntry [_blocks.Count];
-                               _blocks.CopyTo (retval, 0);
-                               return retval;
-                       }
-               }
-
-               public CodeBlockEntry CurrentBlock {
-                       get {
-                               if ((_block_stack != null) && (_block_stack.Count > 0))
-                                       return (CodeBlockEntry) _block_stack.Peek ();
-                               else
-                                       return null;
-                       }
-               }
-
-               public LocalVariableEntry[] Locals {
-                       get {
-                               if (_locals == null)
-                                       return new LocalVariableEntry [0];
-                               else {
-                                       LocalVariableEntry[] retval =
-                                               new LocalVariableEntry [_locals.Count];
-                                       _locals.CopyTo (retval, 0);
-                                       return retval;
-                               }
-                       }
-               }
-
-               public void AddLocal (int index, string name)
-               {
-                       if (_locals == null)
-                               _locals = new List<LocalVariableEntry> ();
-                       int block_idx = CurrentBlock != null ? CurrentBlock.Index : 0;
-                       _locals.Add (new LocalVariableEntry (index, name, block_idx));
-               }
-
-               public ScopeVariable[] ScopeVariables {
-                       get {
-                               if (_scope_vars == null)
-                                       return new ScopeVariable [0];
-
-                               ScopeVariable[] retval = new ScopeVariable [_scope_vars.Count];
-                               _scope_vars.CopyTo (retval);
-                               return retval;
-                       }
-               }
-
-               public void AddScopeVariable (int scope, int index)
-               {
-                       if (_scope_vars == null)
-                               _scope_vars = new List<ScopeVariable> ();
-                       _scope_vars.Add (
-                               new ScopeVariable (scope, index));
-               }
-
-               public string RealMethodName {
-                       get { return _real_name; }
-               }
-
-               public void SetRealMethodName (string name)
-               {
-                       _real_name = name;
-               }
-
-               public ICompileUnit SourceFile {
-                       get { return _comp_unit; }
-               }
-
-               public IMethodDef Method {
-                       get { return _method; }
-               }
-
-               public void DefineMethod (MonoSymbolFile file)
-               {
-                       LineNumberEntry[] lines = new LineNumberEntry [method_lines_pos];
-                       Array.Copy (method_lines, lines, method_lines_pos);
-
-                       MethodEntry entry = new MethodEntry (
-                               file, _comp_unit.Entry, _method.Token, ScopeVariables,
-                               Locals, lines, Blocks, RealMethodName, 0, //_method_flags,
-                               _ns_id);
-
-                       file.AddMethod (entry);
-               }
-       }
 }