X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FMono.CompilerServices.SymbolWriter%2FMonoSymbolTable.cs;h=5f30818ff626bf3ec23d046c9ee4e7f09cb5dc3b;hb=eae45fd7044c04b0ebc1ad900e00ef0b79aa7ed8;hp=654a07d6e76962e99d5aa98cef171a8aa5f65a23;hpb=6b2b2a1f2ceb55082031e2d1a69f481c3202a5a3;p=mono.git diff --git a/mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs b/mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs index 654a07d6e76..5f30818ff62 100644 --- a/mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs +++ b/mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs @@ -30,7 +30,7 @@ using System; using System.Security.Cryptography; -using System.Collections; +using System.Collections.Generic; using System.Text; using System.IO; @@ -202,13 +202,10 @@ namespace Mono.CompilerServices.SymbolWriter public static LineNumberEntry Null = new LineNumberEntry (0, 0, 0); - private class OffsetComparerClass : IComparer + private class OffsetComparerClass : IComparer { - public int Compare (object a, object b) + public int Compare (LineNumberEntry l1, LineNumberEntry l2) { - LineNumberEntry l1 = (LineNumberEntry) a; - LineNumberEntry l2 = (LineNumberEntry) b; - if (l1.Offset < l2.Offset) return -1; else if (l1.Offset > l2.Offset) @@ -218,13 +215,10 @@ namespace Mono.CompilerServices.SymbolWriter } } - private class RowComparerClass : IComparer + private class RowComparerClass : IComparer { - public int Compare (object a, object b) + public int Compare (LineNumberEntry l1, LineNumberEntry l2) { - LineNumberEntry l1 = (LineNumberEntry) a; - LineNumberEntry l2 = (LineNumberEntry) b; - if (l1.Row < l2.Row) return -1; else if (l1.Row > l2.Row) @@ -234,8 +228,8 @@ namespace Mono.CompilerServices.SymbolWriter } } - public static readonly IComparer OffsetComparer = new OffsetComparerClass (); - public static readonly IComparer RowComparer = new RowComparerClass (); + public static readonly IComparer OffsetComparer = new OffsetComparerClass (); + public static readonly IComparer RowComparer = new RowComparerClass (); public override string ToString () { @@ -336,7 +330,7 @@ namespace Mono.CompilerServices.SymbolWriter public override string ToString () { return String.Format ("[LocalVariable {0}:{1}:{2}]", - Name, Index, BlockIndex); + Name, Index, BlockIndex - 1); } } @@ -453,8 +447,8 @@ namespace Mono.CompilerServices.SymbolWriter public readonly int ID; #endregion - ArrayList captured_vars = new ArrayList (); - ArrayList captured_scopes = new ArrayList (); + List captured_vars = new List (); + List captured_scopes = new List (); public AnonymousScopeEntry (int id) { @@ -529,8 +523,8 @@ namespace Mono.CompilerServices.SymbolWriter MonoSymbolFile file; SourceFileEntry source; - ArrayList include_files; - ArrayList namespaces; + List include_files; + List namespaces; bool creating; @@ -550,7 +544,7 @@ namespace Mono.CompilerServices.SymbolWriter this.Index = file.AddCompileUnit (this); creating = true; - namespaces = new ArrayList (); + namespaces = new List (); } public void AddFile (SourceFileEntry file) @@ -559,7 +553,7 @@ namespace Mono.CompilerServices.SymbolWriter throw new InvalidOperationException (); if (include_files == null) - include_files = new ArrayList (); + include_files = new List (); include_files.Add (file); } @@ -635,13 +629,13 @@ namespace Mono.CompilerServices.SymbolWriter int count_includes = reader.ReadLeb128 (); if (count_includes > 0) { - include_files = new ArrayList (); + include_files = new List (); for (int i = 0; i < count_includes; i++) include_files.Add (file.GetSourceFile (reader.ReadLeb128 ())); } int count_ns = reader.ReadLeb128 (); - namespaces = new ArrayList (); + namespaces = new List (); for (int i = 0; i < count_ns; i ++) namespaces.Add (new NamespaceEntry (file, reader)); @@ -913,7 +907,7 @@ namespace Mono.CompilerServices.SymbolWriter void DoRead (MonoSymbolFile file, MyBinaryReader br) { - ArrayList lines = new ArrayList (); + var lines = new List (); bool is_hidden = false, modified = false; int stm_line = 1, stm_offset = 0, stm_file = 1; @@ -1118,9 +1112,9 @@ namespace Mono.CompilerServices.SymbolWriter locals_check_done : ; } else { - Hashtable local_names = new Hashtable (); + var local_names = new Dictionary (); foreach (LocalVariableEntry local in locals) { - if (local_names.Contains (local.Name)) { + if (local_names.ContainsKey (local.Name)) { flags |= Flags.LocalNamesAmbiguous; break; }