diff --git a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index 606496d065..c697f92c9e 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -3652,7 +3652,7 @@ namespace ICSharpCode.NRefactory.CSharp Location.Initialize (new List (new [] { file })); var module = new ModuleContainer (ctx); var driver = new Driver (ctx); - var parser = driver.Parse (reader, file, module); + var parser = Driver.Parse (reader, file, module); var top = new CompilerCompilationUnit () { ModuleCompiled = module, diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolFile.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolFile.cs index 583289595f..664cdf0cf8 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolFile.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolFile.cs @@ -1,12 +1,13 @@ // -// Mono.CSharp.Debugger/MonoSymbolFile.cs +// MonoSymbolFile.cs // -// Author: +// Authors: // Martin Baulig (martin@ximian.com) +// Marek Safar (marek.safar@gmail.com) // // (C) 2003 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com) // - // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -30,10 +31,7 @@ using System; using System.Reflection; -using SRE = System.Reflection.Emit; using System.Collections.Generic; -using System.Text; -using System.Threading; using System.IO; namespace Mono.CompilerServices.SymbolWriter @@ -46,7 +44,13 @@ namespace Mono.CompilerServices.SymbolWriter public MonoSymbolFileException (string message, params object[] args) : base (String.Format (message, args)) - { } + { + } + + public MonoSymbolFileException (string message, Exception innerException) + : base (message, innerException) + { + } } internal class MyBinaryWriter : BinaryWriter @@ -109,48 +113,6 @@ namespace Mono.CompilerServices.SymbolWriter } } -#if !CECIL - // TODO: Obsolete under .net 4 - internal class MonoDebuggerSupport - { - static GetMethodTokenFunc get_method_token; - static GetGuidFunc get_guid; - - delegate int GetMethodTokenFunc (MethodBase method); - delegate Guid GetGuidFunc (Module module); - - static Delegate create_delegate (Type type, Type delegate_type, string name) - { - MethodInfo mi = type.GetMethod (name, BindingFlags.Static | - BindingFlags.NonPublic); - if (mi == null) - throw new Exception ("Can't find " + name); - - return Delegate.CreateDelegate (delegate_type, mi); - } - - static MonoDebuggerSupport () - { - get_method_token = (GetMethodTokenFunc) create_delegate ( - typeof (Assembly), typeof (GetMethodTokenFunc), - "MonoDebugger_GetMethodToken"); - - get_guid = (GetGuidFunc) create_delegate ( - typeof (Module), typeof (GetGuidFunc), "Mono_GetGuid"); - } - - public static int GetMethodToken (MethodBase method) - { - return get_method_token (method); - } - - public static Guid GetGuid (Module module) - { - return get_guid (module); - } - } -#endif - public class MonoSymbolFile : IDisposable { List methods = new List (); @@ -163,7 +125,6 @@ namespace Mono.CompilerServices.SymbolWriter int last_method_index; int last_namespace_index; - public readonly string FileName = ""; public readonly int MajorVersion = OffsetTable.MajorVersion; public readonly int MinorVersion = OffsetTable.MinorVersion; @@ -369,10 +330,8 @@ namespace Mono.CompilerServices.SymbolWriter Guid guid; - MonoSymbolFile (string filename) + MonoSymbolFile (Stream stream) { - this.FileName = filename; - FileStream stream = new FileStream (filename, FileMode.Open, FileAccess.Read); reader = new MyBinaryReader (stream); try { @@ -381,89 +340,56 @@ namespace Mono.CompilerServices.SymbolWriter int minor_version = reader.ReadInt32 (); if (magic != OffsetTable.Magic) - throw new MonoSymbolFileException ( - "Symbol file `{0}' is not a valid " + - "Mono symbol file", filename); + throw new MonoSymbolFileException ("Symbol file is not a valid"); if (major_version != OffsetTable.MajorVersion) throw new MonoSymbolFileException ( - "Symbol file `{0}' has version {1}, " + - "but expected {2}", filename, major_version, - OffsetTable.MajorVersion); + "Symbol file has version {0} but expected {1}", major_version, OffsetTable.MajorVersion); if (minor_version != OffsetTable.MinorVersion) - throw new MonoSymbolFileException ( - "Symbol file `{0}' has version {1}.{2}, " + - "but expected {3}.{4}", filename, major_version, - minor_version, OffsetTable.MajorVersion, - OffsetTable.MinorVersion); + throw new MonoSymbolFileException ("Symbol file has version {0}.{1} but expected {2}.{3}", + major_version, minor_version, + OffsetTable.MajorVersion, OffsetTable.MinorVersion); MajorVersion = major_version; MinorVersion = minor_version; guid = new Guid (reader.ReadBytes (16)); ot = new OffsetTable (reader, major_version, minor_version); - } catch { - throw new MonoSymbolFileException ( - "Cannot read symbol file `{0}'", filename); + } catch (Exception e) { + throw new MonoSymbolFileException ("Cannot read symbol file", e); } source_file_hash = new Dictionary (); compile_unit_hash = new Dictionary (); } - void CheckGuidMatch (Guid other, string filename, string assembly) + public static MonoSymbolFile ReadSymbolFile (Assembly assembly) { - if (other == guid) - return; - - throw new MonoSymbolFileException ( - "Symbol file `{0}' does not match assembly `{1}'", - filename, assembly); - } + string filename = assembly.Location; + string name = filename + ".mdb"; -#if CECIL - protected MonoSymbolFile (string filename, Mono.Cecil.ModuleDefinition module) - : this (filename) - { - CheckGuidMatch (module.Mvid, filename, module.FullyQualifiedName); - } + Module[] modules = assembly.GetModules (); + Guid assembly_guid = modules[0].ModuleVersionId; - public static MonoSymbolFile ReadSymbolFile (Mono.Cecil.ModuleDefinition module) - { - return ReadSymbolFile (module, module.FullyQualifiedName); + return ReadSymbolFile (name, assembly_guid); } - public static MonoSymbolFile ReadSymbolFile (Mono.Cecil.ModuleDefinition module, string filename) - { - string name = filename + ".mdb"; - - return new MonoSymbolFile (name, module); - } -#else - protected MonoSymbolFile (string filename, Assembly assembly) : this (filename) + public static MonoSymbolFile ReadSymbolFile (string mdbFilename) { - // Check that the MDB file matches the assembly, if we have been - // passed an assembly. - if (assembly == null) - return; - - Module[] modules = assembly.GetModules (); - Guid assembly_guid = MonoDebuggerSupport.GetGuid (modules [0]); - - CheckGuidMatch (assembly_guid, filename, assembly.Location); + return ReadSymbolFile (new FileStream (mdbFilename, FileMode.Open, FileAccess.Read)); } - public static MonoSymbolFile ReadSymbolFile (Assembly assembly) + public static MonoSymbolFile ReadSymbolFile (string mdbFilename, Guid assemblyGuid) { - string filename = assembly.Location; - string name = filename + ".mdb"; + var sf = ReadSymbolFile (mdbFilename); + if (assemblyGuid != sf.guid) + throw new MonoSymbolFileException ("Symbol file `{0}' does not match assembly", mdbFilename); - return new MonoSymbolFile (name, assembly); + return sf; } -#endif - public static MonoSymbolFile ReadSymbolFile (string mdbFilename) + public static MonoSymbolFile ReadSymbolFile (Stream stream) { - return new MonoSymbolFile (mdbFilename, null); + return new MonoSymbolFile (stream); } public int CompileUnitCount { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs index f92c8d4840..c9beaa0d43 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs @@ -920,9 +920,7 @@ namespace Mono.CompilerServices.SymbolWriter (opcode <= DW_LNE_MONO__extensions_end)) { ; // reserved for future extensions } else { - throw new MonoSymbolFileException ( - "Unknown extended opcode {0:x} in LNT ({1})", - opcode, file.FileName); + throw new MonoSymbolFileException ("Unknown extended opcode {0:x}", opcode); } br.BaseStream.Position = end_pos; @@ -1112,7 +1110,7 @@ namespace Mono.CompilerServices.SymbolWriter } } - void CheckLineNumberTable (LineNumberEntry[] line_numbers) + static void CheckLineNumberTable (LineNumberEntry[] line_numbers) { int last_offset = -1; int last_row = -1; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs index afa794466d..d4caad9001 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs @@ -768,14 +768,6 @@ namespace Mono.CSharp { : base (storey, name, local.Type) { } - - // - // For compiler generated local variables - // - public HoistedLocalVariable (AnonymousMethodStorey storey, Field field) - : base (storey, field) - { - } } public class HoistedThis : HoistedVariable diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs index 5311d298eb..0859d718c9 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs @@ -179,12 +179,6 @@ namespace Mono.CSharp } } - public TypeSpec Type { - get { - return type; - } - } - public TypeSpec ResultType { get { return result_type; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs index 16727acd7d..370cf5fce4 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs @@ -1557,56 +1557,6 @@ namespace Mono.CSharp { /// static class AttributeTester { - public enum Result { - Ok, - RefOutArrayError, - ArrayArrayError - } - - /// - /// Returns true if parameters of two compared methods are CLS-Compliant. - /// It tests differing only in ref or out, or in array rank. - /// - public static Result AreOverloadedMethodParamsClsCompliant (AParametersCollection pa, AParametersCollection pb) - { - TypeSpec [] types_a = pa.Types; - TypeSpec [] types_b = pb.Types; - if (types_a == null || types_b == null) - return Result.Ok; - - if (types_a.Length != types_b.Length) - return Result.Ok; - - Result result = Result.Ok; - for (int i = 0; i < types_b.Length; ++i) { - TypeSpec aType = types_a [i]; - TypeSpec bType = types_b [i]; - - var ac_a = aType as ArrayContainer; - var ac_b = aType as ArrayContainer; - - if (ac_a != null && ac_b != null) { - if (ac_a.Rank != ac_b.Rank && ac_a.Element == ac_b.Element) { - result = Result.RefOutArrayError; - continue; - } - - if (ac_a.Element.IsArray || ac_b.Element.IsArray) { - result = Result.ArrayArrayError; - continue; - } - } - - if (aType != bType) - return Result.Ok; - - const Parameter.Modifier out_ref_mod = (Parameter.Modifier.OUTMASK | Parameter.Modifier.REFMASK); - if ((pa.FixedParameters[i].ModFlags & out_ref_mod) != (pb.FixedParameters[i].ModFlags & out_ref_mod)) - result = Result.RefOutArrayError; - } - return result; - } - /// /// Common method for Obsolete error/warning reporting. /// diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs index e04ba9ea3c..fcf8e59023 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs @@ -3686,7 +3686,7 @@ case 851: case_851(); break; case 854: -#line 5643 "cs-parser.jay" +#line 5644 "cs-parser.jay" { yyVal = new Catch ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } @@ -3695,7 +3695,7 @@ case 855: case_855(); break; case 856: -#line 5662 "cs-parser.jay" +#line 5663 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } @@ -3704,13 +3704,13 @@ case 857: case_857(); break; case 858: -#line 5680 "cs-parser.jay" +#line 5681 "cs-parser.jay" { yyVal = new Checked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 859: -#line 5687 "cs-parser.jay" +#line 5688 "cs-parser.jay" { yyVal = new Unchecked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } @@ -3719,7 +3719,7 @@ case 860: case_860(); break; case 861: -#line 5697 "cs-parser.jay" +#line 5698 "cs-parser.jay" { yyVal = new Unsafe ((Block) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); } @@ -3758,7 +3758,7 @@ case 873: case_873(); break; case 874: -#line 5802 "cs-parser.jay" +#line 5803 "cs-parser.jay" { Error_MissingInitializer (lexer.Location); } @@ -3791,7 +3791,7 @@ case 883: case_883(); break; case 884: -#line 5903 "cs-parser.jay" +#line 5904 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -3800,7 +3800,7 @@ case 885: case_885(); break; case 886: -#line 5918 "cs-parser.jay" +#line 5919 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -3815,7 +3815,7 @@ case 890: case_890(); break; case 891: -#line 5963 "cs-parser.jay" +#line 5964 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -3836,7 +3836,7 @@ case 899: case_899(); break; case 905: -#line 6022 "cs-parser.jay" +#line 6023 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -3845,7 +3845,7 @@ case 906: case_906(); break; case 907: -#line 6041 "cs-parser.jay" +#line 6042 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -3878,13 +3878,13 @@ case 916: case_916(); break; case 918: -#line 6185 "cs-parser.jay" +#line 6186 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 919: -#line 6192 "cs-parser.jay" +#line 6193 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -3905,7 +3905,7 @@ case 926: case_926(); break; case 927: -#line 6238 "cs-parser.jay" +#line 6239 "cs-parser.jay" { yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); } @@ -3917,7 +3917,7 @@ case 929: case_929(); break; case 930: -#line 6255 "cs-parser.jay" +#line 6256 "cs-parser.jay" { yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); } @@ -3941,13 +3941,13 @@ case 939: case_939(); break; case 947: -#line 6377 "cs-parser.jay" +#line 6378 "cs-parser.jay" { module.DocumentationBuilder.ParsedName = (MemberName) yyVals[0+yyTop]; } break; case 948: -#line 6384 "cs-parser.jay" +#line 6385 "cs-parser.jay" { module.DocumentationBuilder.ParsedParameters = (List)yyVals[0+yyTop]; } @@ -3959,13 +3959,13 @@ case 950: case_950(); break; case 951: -#line 6401 "cs-parser.jay" +#line 6402 "cs-parser.jay" { yyVal = new MemberName ((MemberName) yyVals[-2+yyTop], MemberCache.IndexerNameAlias, Location.Null); } break; case 952: -#line 6405 "cs-parser.jay" +#line 6406 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } @@ -3983,25 +3983,25 @@ case 956: case_956(); break; case 958: -#line 6441 "cs-parser.jay" +#line 6442 "cs-parser.jay" { yyVal = new MemberName (((MemberName) yyVals[-2+yyTop]), (MemberName) yyVals[0+yyTop]); } break; case 960: -#line 6449 "cs-parser.jay" +#line 6450 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 961: -#line 6453 "cs-parser.jay" +#line 6454 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 962: -#line 6460 "cs-parser.jay" +#line 6461 "cs-parser.jay" { yyVal = new List (0); } @@ -8272,19 +8272,20 @@ void case_847() void case_848() #line 5601 "cs-parser.jay" { - yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List) yyVals[-2+yyTop], Location.Null, true), (Block) yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop])); + var loc = GetLocation (yyVals[-4+yyTop]); + yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List) yyVals[-2+yyTop], loc, true), (Block) yyVals[0+yyTop], loc); lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_849() -#line 5606 "cs-parser.jay" +#line 5607 "cs-parser.jay" { Error_SyntaxError (1524, yyToken); yyVal = new TryCatch ((Block) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop]), false); } void case_850() -#line 5614 "cs-parser.jay" +#line 5615 "cs-parser.jay" { var l = new List (2); @@ -8293,7 +8294,7 @@ void case_850() } void case_851() -#line 5621 "cs-parser.jay" +#line 5622 "cs-parser.jay" { var l = (List) yyVals[-1+yyTop]; @@ -8307,7 +8308,7 @@ void case_851() } void case_855() -#line 5645 "cs-parser.jay" +#line 5646 "cs-parser.jay" { start_block (GetLocation (yyVals[-3+yyTop])); var c = new Catch (current_block, GetLocation (yyVals[-4+yyTop])); @@ -8324,7 +8325,7 @@ void case_855() } void case_857() -#line 5664 "cs-parser.jay" +#line 5665 "cs-parser.jay" { if (yyToken == Token.CLOSE_PARENS) { report.Error (1015, lexer.Location, @@ -8337,14 +8338,14 @@ void case_857() } void case_860() -#line 5692 "cs-parser.jay" +#line 5693 "cs-parser.jay" { if (!settings.Unsafe) Error_UnsafeCodeNotAllowed (GetLocation (yyVals[0+yyTop])); } void case_862() -#line 5702 "cs-parser.jay" +#line 5703 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8354,7 +8355,7 @@ void case_862() } void case_863() -#line 5710 "cs-parser.jay" +#line 5711 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8363,7 +8364,7 @@ void case_863() } void case_864() -#line 5720 "cs-parser.jay" +#line 5721 "cs-parser.jay" { start_block (GetLocation (yyVals[-2+yyTop])); @@ -8375,14 +8376,14 @@ void case_864() } void case_865() -#line 5730 "cs-parser.jay" +#line 5731 "cs-parser.jay" { yyVal = current_variable; current_variable = null; } void case_866() -#line 5735 "cs-parser.jay" +#line 5736 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8394,7 +8395,7 @@ void case_866() } void case_867() -#line 5748 "cs-parser.jay" +#line 5749 "cs-parser.jay" { start_block (GetLocation (yyVals[-2+yyTop])); @@ -8406,14 +8407,14 @@ void case_867() } void case_868() -#line 5758 "cs-parser.jay" +#line 5759 "cs-parser.jay" { yyVal = current_variable; current_variable = null; } void case_869() -#line 5763 "cs-parser.jay" +#line 5764 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8425,7 +8426,7 @@ void case_869() } void case_870() -#line 5773 "cs-parser.jay" +#line 5774 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8435,7 +8436,7 @@ void case_870() } void case_871() -#line 5781 "cs-parser.jay" +#line 5782 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8444,14 +8445,14 @@ void case_871() } void case_873() -#line 5792 "cs-parser.jay" +#line 5793 "cs-parser.jay" { /* It has to be here for the parent to safely restore artificial block*/ Error_SyntaxError (yyToken); } void case_875() -#line 5804 "cs-parser.jay" +#line 5805 "cs-parser.jay" { current_variable.Initializer = (Expression) yyVals[0+yyTop]; lbag.AppendTo (current_variable, GetLocation (yyVals[-1+yyTop])); @@ -8459,7 +8460,7 @@ void case_875() } void case_876() -#line 5816 "cs-parser.jay" +#line 5817 "cs-parser.jay" { lexer.query_parsing = false; @@ -8473,7 +8474,7 @@ void case_876() } void case_877() -#line 5828 "cs-parser.jay" +#line 5829 "cs-parser.jay" { Linq.AQueryClause from = yyVals[-1+yyTop] as Linq.AQueryClause; @@ -8485,7 +8486,7 @@ void case_877() } void case_878() -#line 5839 "cs-parser.jay" +#line 5840 "cs-parser.jay" { lexer.query_parsing = false; yyVal = yyVals[-1+yyTop]; @@ -8495,7 +8496,7 @@ void case_878() } void case_879() -#line 5846 "cs-parser.jay" +#line 5847 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; current_block.SetEndLocation (lexer.Location); @@ -8503,7 +8504,7 @@ void case_879() } void case_880() -#line 5855 "cs-parser.jay" +#line 5856 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); @@ -8513,7 +8514,7 @@ void case_880() } void case_881() -#line 5863 "cs-parser.jay" +#line 5864 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); @@ -8527,7 +8528,7 @@ void case_881() } void case_882() -#line 5878 "cs-parser.jay" +#line 5879 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); @@ -8537,7 +8538,7 @@ void case_882() } void case_883() -#line 5886 "cs-parser.jay" +#line 5887 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); @@ -8551,7 +8552,7 @@ void case_883() } void case_885() -#line 5905 "cs-parser.jay" +#line 5906 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; var sn = new Linq.RangeVariable (lt.Value, lt.Location); @@ -8564,7 +8565,7 @@ void case_885() } void case_887() -#line 5920 "cs-parser.jay" +#line 5921 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; var sn = new Linq.RangeVariable (lt.Value, lt.Location); @@ -8580,7 +8581,7 @@ void case_887() } void case_888() -#line 5937 "cs-parser.jay" +#line 5938 "cs-parser.jay" { Linq.AQueryClause head = (Linq.AQueryClause)yyVals[-1+yyTop]; @@ -8597,14 +8598,14 @@ void case_888() } void case_890() -#line 5953 "cs-parser.jay" +#line 5954 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = null; } void case_892() -#line 5965 "cs-parser.jay" +#line 5966 "cs-parser.jay" { yyVal = new Linq.Select ((Linq.QueryBlock)current_block, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); @@ -8613,7 +8614,7 @@ void case_892() } void case_893() -#line 5972 "cs-parser.jay" +#line 5973 "cs-parser.jay" { if (linq_clause_blocks == null) linq_clause_blocks = new Stack (); @@ -8623,7 +8624,7 @@ void case_893() } void case_894() -#line 5980 "cs-parser.jay" +#line 5981 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -8632,7 +8633,7 @@ void case_894() } void case_895() -#line 5987 "cs-parser.jay" +#line 5988 "cs-parser.jay" { yyVal = new Linq.GroupBy ((Linq.QueryBlock)current_block, (Expression)yyVals[-3+yyTop], linq_clause_blocks.Pop (), (Expression)yyVals[0+yyTop], GetLocation (yyVals[-5+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); @@ -8642,14 +8643,14 @@ void case_895() } void case_899() -#line 6004 "cs-parser.jay" +#line 6005 "cs-parser.jay" { ((Linq.AQueryClause)yyVals[-1+yyTop]).Tail.Next = (Linq.AQueryClause)yyVals[0+yyTop]; yyVal = yyVals[-1+yyTop]; } void case_906() -#line 6024 "cs-parser.jay" +#line 6025 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; var sn = new Linq.RangeVariable (lt.Value, lt.Location); @@ -8663,7 +8664,7 @@ void case_906() } void case_908() -#line 6043 "cs-parser.jay" +#line 6044 "cs-parser.jay" { yyVal = new Linq.Where ((Linq.QueryBlock)current_block, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); @@ -8672,7 +8673,7 @@ void case_908() } void case_909() -#line 6053 "cs-parser.jay" +#line 6054 "cs-parser.jay" { if (linq_clause_blocks == null) linq_clause_blocks = new Stack (); @@ -8682,7 +8683,7 @@ void case_909() } void case_910() -#line 6061 "cs-parser.jay" +#line 6062 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -8692,7 +8693,7 @@ void case_910() } void case_911() -#line 6069 "cs-parser.jay" +#line 6070 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -8702,7 +8703,7 @@ void case_911() } void case_912() -#line 6077 "cs-parser.jay" +#line 6078 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -8742,7 +8743,7 @@ void case_912() } void case_913() -#line 6115 "cs-parser.jay" +#line 6116 "cs-parser.jay" { if (linq_clause_blocks == null) linq_clause_blocks = new Stack (); @@ -8752,7 +8753,7 @@ void case_913() } void case_914() -#line 6123 "cs-parser.jay" +#line 6124 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -8762,7 +8763,7 @@ void case_914() } void case_915() -#line 6131 "cs-parser.jay" +#line 6132 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -8772,7 +8773,7 @@ void case_915() } void case_916() -#line 6139 "cs-parser.jay" +#line 6140 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -8814,7 +8815,7 @@ void case_916() } void case_920() -#line 6194 "cs-parser.jay" +#line 6195 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -8823,7 +8824,7 @@ void case_920() } void case_922() -#line 6205 "cs-parser.jay" +#line 6206 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -8832,14 +8833,14 @@ void case_922() } void case_923() -#line 6212 "cs-parser.jay" +#line 6213 "cs-parser.jay" { ((Linq.AQueryClause)yyVals[-3+yyTop]).Next = (Linq.AQueryClause)yyVals[0+yyTop]; yyVal = yyVals[-3+yyTop]; } void case_925() -#line 6221 "cs-parser.jay" +#line 6222 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -8848,42 +8849,42 @@ void case_925() } void case_926() -#line 6228 "cs-parser.jay" +#line 6229 "cs-parser.jay" { ((Linq.AQueryClause)yyVals[-3+yyTop]).Tail.Next = (Linq.AQueryClause)yyVals[0+yyTop]; yyVal = yyVals[-3+yyTop]; } void case_928() -#line 6240 "cs-parser.jay" +#line 6241 "cs-parser.jay" { yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_929() -#line 6245 "cs-parser.jay" +#line 6246 "cs-parser.jay" { yyVal = new Linq.OrderByDescending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_931() -#line 6257 "cs-parser.jay" +#line 6258 "cs-parser.jay" { yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_932() -#line 6262 "cs-parser.jay" +#line 6263 "cs-parser.jay" { yyVal = new Linq.ThenByDescending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_934() -#line 6272 "cs-parser.jay" +#line 6273 "cs-parser.jay" { /* query continuation block is not linked with query block but with block*/ /* before. This means each query can use same range variable names for*/ @@ -8901,7 +8902,7 @@ void case_934() } void case_935() -#line 6288 "cs-parser.jay" +#line 6289 "cs-parser.jay" { var current_block = linq_clause_blocks.Pop (); var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; @@ -8912,7 +8913,7 @@ void case_935() } void case_938() -#line 6315 "cs-parser.jay" +#line 6316 "cs-parser.jay" { current_container = current_type = new Class (current_container, new MemberName (""), Modifiers.PUBLIC, null); @@ -8942,7 +8943,7 @@ void case_938() } void case_939() -#line 6343 "cs-parser.jay" +#line 6344 "cs-parser.jay" { --lexer.parsing_block; Method method = (Method) oob_stack.Pop (); @@ -8954,7 +8955,7 @@ void case_939() } void case_949() -#line 6386 "cs-parser.jay" +#line 6387 "cs-parser.jay" { module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)yyVals[-1+yyTop]; module.DocumentationBuilder.ParsedParameters = (List)yyVals[0+yyTop]; @@ -8962,7 +8963,7 @@ void case_949() } void case_950() -#line 6392 "cs-parser.jay" +#line 6393 "cs-parser.jay" { module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)yyVals[-3+yyTop]; module.DocumentationBuilder.ParsedParameters = (List)yyVals[0+yyTop]; @@ -8971,14 +8972,14 @@ void case_950() } void case_953() -#line 6407 "cs-parser.jay" +#line 6408 "cs-parser.jay" { module.DocumentationBuilder.ParsedParameters = (List)yyVals[-1+yyTop]; yyVal = new MemberName ((MemberName) yyVals[-6+yyTop], MemberCache.IndexerNameAlias, Location.Null); } void case_954() -#line 6412 "cs-parser.jay" +#line 6413 "cs-parser.jay" { var p = (List)yyVals[0+yyTop] ?? new List (1); p.Add (new DocumentationParameter ((FullNamedExpression) yyVals[-1+yyTop])); @@ -8988,7 +8989,7 @@ void case_954() } void case_955() -#line 6420 "cs-parser.jay" +#line 6421 "cs-parser.jay" { var p = (List)yyVals[0+yyTop] ?? new List (1); p.Add (new DocumentationParameter ((FullNamedExpression) yyVals[-1+yyTop])); @@ -8998,7 +8999,7 @@ void case_955() } void case_956() -#line 6428 "cs-parser.jay" +#line 6429 "cs-parser.jay" { var p = (List)yyVals[0+yyTop] ?? new List (1); module.DocumentationBuilder.ParsedParameters = p; @@ -9007,7 +9008,7 @@ void case_956() } void case_964() -#line 6466 "cs-parser.jay" +#line 6467 "cs-parser.jay" { var parameters = new List (); parameters.Add ((DocumentationParameter) yyVals[0+yyTop]); @@ -9015,7 +9016,7 @@ void case_964() } void case_965() -#line 6472 "cs-parser.jay" +#line 6473 "cs-parser.jay" { var parameters = yyVals[-2+yyTop] as List; parameters.Add ((DocumentationParameter) yyVals[0+yyTop]); @@ -9023,7 +9024,7 @@ void case_965() } void case_966() -#line 6481 "cs-parser.jay" +#line 6482 "cs-parser.jay" { if (yyVals[-1+yyTop] != null) yyVal = new DocumentationParameter ((Parameter.Modifier) yyVals[-1+yyTop], (FullNamedExpression) yyVals[0+yyTop]); @@ -12413,7 +12414,7 @@ void case_966() -1, -1, -1, -1, -1, 362, }; -#line 6490 "cs-parser.jay" +#line 6491 "cs-parser.jay" // // A class used to hold info about an operator declarator diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay index 76b82cac43..4eb77d3290 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay @@ -5599,7 +5599,8 @@ try_statement } | TRY block catch_clauses FINALLY block { - $$ = new TryFinally (new TryCatch ((Block) $2, (List) $3, Location.Null, true), (Block) $5, GetLocation ($1)); + var loc = GetLocation ($1); + $$ = new TryFinally (new TryCatch ((Block) $2, (List) $3, loc, true), (Block) $5, loc); lbag.AddStatement ($$, GetLocation ($4)); } | TRY block error diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs index 8fc3d9c0a8..7f33a3b65b 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs @@ -2242,6 +2242,9 @@ namespace Mono.CSharp return true; } +#if !FULL_AST + static +#endif bool IsTokenIdentifierEqual (char[] identifier) { for (int i = 0; i < identifier.Length; ++i) { @@ -2288,6 +2291,7 @@ namespace Mono.CSharp Report.Warning (1709, 1, Location, "Filename specified for preprocessor directive is empty"); } + return string_builder.ToString (); } @@ -3003,6 +3007,9 @@ namespace Mono.CSharp return Token.IDENTIFIER; } +#if !FULL_AST + static +#endif string InternIdentifier (char[] charBuffer, int length) { // diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs index ce88013eef..0f4a01e26c 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs @@ -676,7 +676,7 @@ namespace Mono.CSharp { do { var ns = m as NamespaceContainer; if (ns != null) - return ns.LookupExtensionMethod (this, extensionType, name, arity, ns, 0); + return ns.LookupExtensionMethod (this, extensionType, name, arity, 0); m = m.Parent; } while (m != null); diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs index 19340bf6c1..369bbc5a31 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs @@ -241,7 +241,7 @@ namespace Mono.CSharp // // Handles node // - void HandleTypeParam (MemberCore mc, XmlElement node) + static void HandleTypeParam (MemberCore mc, XmlElement node) { if (!node.HasAttribute ("name")) return; @@ -262,7 +262,7 @@ namespace Mono.CSharp // // Handles node // - void HandleTypeParamRef (MemberCore mc, XmlElement node) + static void HandleTypeParamRef (MemberCore mc, XmlElement node) { if (!node.HasAttribute ("name")) return; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs index 0ff69e4587..b9a0c75e70 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs @@ -113,7 +113,7 @@ namespace Mono.CSharp input.Close (); } - public CSharpParser Parse (SeekableStreamReader reader, SourceFile sourceFile, ModuleContainer module) + public static CSharpParser Parse (SeekableStreamReader reader, SourceFile sourceFile, ModuleContainer module) { var file = new CompilationSourceFile (module, sourceFile); module.AddTypeContainer (file); diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs index 93b2e2e5c7..1a0288e960 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs @@ -734,15 +734,6 @@ namespace Mono.CSharp this.member = member; } - // - // When a return type is known not to be dynamic - // - public DynamicInvocation (ATypeNameExpression member, Arguments args, TypeSpec type, Location loc) - : this (member, args, loc) - { - this.type = type; - } - public static DynamicInvocation CreateSpecialNameInvoke (ATypeNameExpression member, Arguments args, Location loc) { return new DynamicInvocation (member, args, loc) { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs index 4154edbf19..65ae6c2fb3 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs @@ -3106,7 +3106,7 @@ namespace Mono.CSharp { int arity = type_arguments == null ? 0 : type_arguments.Count; - candidates = candidates.Container.LookupExtensionMethod (candidates.Context, ExtensionExpression.Type, Name, arity, candidates.Container, candidates.LookupIndex); + candidates = candidates.Container.LookupExtensionMethod (candidates.Context, ExtensionExpression.Type, Name, arity, candidates.LookupIndex); if (candidates == null) return null; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs index acfa5669d6..da92cae7fa 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs @@ -5422,16 +5422,6 @@ namespace Mono.CSharp return mg.OverloadResolve (ec, ref arguments, null, OverloadResolver.Restrictions.None); } - static MetaType[] GetVarargsTypes (MethodSpec mb, Arguments arguments) - { - AParametersCollection pd = mb.Parameters; - - Argument a = arguments[pd.Count - 1]; - Arglist list = (Arglist) a.Expr; - - return list.ArgumentTypes; - } - public override string GetSignatureForError () { return mg.GetSignatureForError (); diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs index f8d349f789..62fd13aefb 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs @@ -2146,10 +2146,6 @@ namespace Mono.CSharp { this.args = args; } - public TypeArguments TypeArguments { - get { return args; } - } - public override string GetSignatureForError () { return TypeManager.CSharpName (type); @@ -2504,7 +2500,7 @@ namespace Mono.CSharp { return false; } - bool HasDefaultConstructor (TypeSpec atype) + static bool HasDefaultConstructor (TypeSpec atype) { var tp = atype as TypeParameterSpec; if (tp != null) { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs index 7a3081c7cb..25497512fa 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs @@ -912,7 +912,7 @@ namespace Mono.CSharp // Test for a custom attribute type match. Custom attributes are not really predefined globaly // they can be assembly specific therefore we do check based on names only // - public bool HasAttribute (IList attributesData, string attrName, string attrNamespace) + public static bool HasAttribute (IList attributesData, string attrName, string attrNamespace) { if (attributesData.Count == 0) return false; @@ -1940,7 +1940,7 @@ namespace Mono.CSharp continue; // Ignore compiler generated methods - if (importer.HasAttribute (CustomAttributeData.GetCustomAttributes (mb), "CompilerGeneratedAttribute", MetadataImporter.CompilerServicesNamespace)) + if (MetadataImporter.HasAttribute (CustomAttributeData.GetCustomAttributes (mb), "CompilerGeneratedAttribute", MetadataImporter.CompilerServicesNamespace)) continue; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs index 770259c038..009683e90d 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs @@ -73,15 +73,6 @@ namespace Mono.CSharp { public readonly TypeSpec MemberType; public readonly int Arity; // -1 to ignore the check - private MemberFilter (string name, MemberKind kind) - { - Name = name; - Kind = kind; - Parameters = null; - MemberType = null; - Arity = -1; - } - public MemberFilter (MethodSpec m) { Name = m.Name; @@ -797,7 +788,7 @@ namespace Mono.CSharp { while (true) { foreach (var entry in abstract_type.MemberCache.member_hash) { foreach (var name_entry in entry.Value) { - if ((name_entry.Modifiers & Modifiers.ABSTRACT) == 0) + if ((name_entry.Modifiers & (Modifiers.ABSTRACT | Modifiers.OVERRIDE)) != Modifiers.ABSTRACT) continue; if (name_entry.Kind != MemberKind.Method) @@ -846,6 +837,12 @@ namespace Mono.CSharp { if ((item.Modifiers & (Modifiers.OVERRIDE | Modifiers.VIRTUAL)) == 0) continue; + // + // Abstract override does not override anything + // + if ((item.Modifiers & Modifiers.ABSTRACT) != 0) + continue; + if (filter.Equals (item)) { --not_implemented_count; abstract_methods [i] = null; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs index be9558932c..50f98c71f3 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs @@ -2236,11 +2236,6 @@ namespace Mono.CSharp { } } - public bool IsExcluded () - { - return false; - } - public MemberName MethodName { get { return MemberName; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs index cc5da698f1..9ac87e6db7 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs @@ -327,37 +327,6 @@ namespace Mono.CSharp { return te; } - TypeSpec LookupType (string name, int arity) - { - if (types == null) - return null; - - IList found; - if (types.TryGetValue (name, out found)) { - TypeSpec best = null; - - foreach (var ts in found) { - if (ts.Arity == arity) - return ts; - - // - // Lookup for the best candidate with closest arity match - // - if (arity < 0) { - if (best == null) { - best = ts; - } else if (System.Math.Abs (ts.Arity + arity) < System.Math.Abs (best.Arity + arity)) { - best = ts; - } - } - } - - return best; - } - - return null; - } - public FullNamedExpression LookupTypeOrNamespace (IMemberContext ctx, string name, int arity, LookupMode mode, Location loc) { var texpr = LookupType (ctx, name, arity, mode, loc); @@ -869,7 +838,7 @@ namespace Mono.CSharp { base.EmitContainer (); } - public ExtensionMethodCandidates LookupExtensionMethod (IMemberContext invocationContext, TypeSpec extensionType, string name, int arity, NamespaceContainer container, int position) + public ExtensionMethodCandidates LookupExtensionMethod (IMemberContext invocationContext, TypeSpec extensionType, string name, int arity, int position) { // // Here we try to resume the search for extension method at the point @@ -890,7 +859,8 @@ namespace Mono.CSharp { // checked before we hit A.N1 using // ExtensionMethodCandidates candidates; - for (; container != null; container = container.Parent) { + var container = this; + do { candidates = container.LookupExtensionMethodCandidates (invocationContext, extensionType, name, arity, ref position); if (candidates != null || container.MemberName == null) return candidates; @@ -916,7 +886,8 @@ namespace Mono.CSharp { } position = 0; - } + container = container.Parent; + } while (container != null); return null; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs index c2cdd700ea..0860b91565 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs @@ -494,7 +494,7 @@ namespace Mono.CSharp.Nullable ec.MarkLabel (end_label); } - Expression LiftExpression (ResolveContext ec, Expression expr) + static Expression LiftExpression (ResolveContext ec, Expression expr) { var lifted_type = new NullableType (expr.Type, expr.Location); if (lifted_type.ResolveAsType (ec) == null) diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs index 493742fe28..9924f55253 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs @@ -1465,7 +1465,7 @@ namespace Mono.CSharp { declarators.Add (decl); } - void CreateEvaluatorVariable (BlockContext bc, LocalVariable li) + static void CreateEvaluatorVariable (BlockContext bc, LocalVariable li) { if (bc.Report.Errors != 0) return; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/typespec.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/typespec.cs index 7ed97604a0..25cf460531 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/typespec.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/typespec.cs @@ -1325,12 +1325,6 @@ namespace Mono.CSharp readonly string name; - InternalType (string name, MemberCache cache) - : this (name) - { - this.cache = cache; - } - InternalType (string name) : base (MemberKind.InternalCompilerType, null, null, null, Modifiers.PUBLIC) { diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs index 033bf19245..207376bf53 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs @@ -409,5 +409,34 @@ namespace B { } }"); } + + [Test()] + public void TestTryCatchWithBannerStyle () + { + CSharpFormattingOptions policy = new CSharpFormattingOptions (); + policy.StatementBraceStyle = BraceStyle.BannerStyle; + Test (policy, @"class Test +{ + void Foo () + { + try { + Foo (); } catch (Exception) { } catch (Exception) { } finally { Foo ();} + } +}", +@"class Test +{ + void Foo () + { + try { + Foo (); + } catch (Exception) { + } catch (Exception) { + } finally { + Foo (); + } + } +}"); + } + } } \ No newline at end of file diff --git a/ICSharpCode.NRefactory.Xml/AXmlReader.cs b/ICSharpCode.NRefactory.Xml/AXmlReader.cs index af4bf40630..a9db21aa0b 100644 --- a/ICSharpCode.NRefactory.Xml/AXmlReader.cs +++ b/ICSharpCode.NRefactory.Xml/AXmlReader.cs @@ -180,6 +180,12 @@ namespace ICSharpCode.NRefactory.Xml } } + public override bool HasValue { + get { + return !string.IsNullOrEmpty (Value); + } + } + public override XmlNodeType NodeType { get { if (attributeIndex >= 0) diff --git a/ICSharpCode.NRefactory.Xml/ICSharpCode.NRefactory.Xml.csproj b/ICSharpCode.NRefactory.Xml/ICSharpCode.NRefactory.Xml.csproj index 6ea7abad62..f8d1fa81e1 100644 --- a/ICSharpCode.NRefactory.Xml/ICSharpCode.NRefactory.Xml.csproj +++ b/ICSharpCode.NRefactory.Xml/ICSharpCode.NRefactory.Xml.csproj @@ -7,18 +7,18 @@ Library ICSharpCode.NRefactory.Xml ICSharpCode.NRefactory.Xml - v4.0 - Client Properties False False 4 false ..\ICSharpCode.NRefactory\bin\$(Configuration)\ICSharpCode.NRefactory.Xml.xml - True + true ..\ICSharpCode.NRefactory.snk False File + 10.0.0 + 2.0 AnyCPU @@ -40,12 +40,11 @@ TRACE - Full + full true - PdbOnly - false + none