Browse Source

Merge branch 'master' of github.com:icsharpcode/NRefactory

newNRvisualizers
mike 14 years ago
parent
commit
698164add6
  1. 2
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs
  2. 142
      ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolFile.cs
  3. 6
      ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs
  4. 8
      ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs
  5. 6
      ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs
  6. 50
      ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs
  7. 185
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
  8. 3
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay
  9. 7
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs
  10. 2
      ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs
  11. 4
      ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs
  12. 2
      ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs
  13. 9
      ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs
  14. 2
      ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs
  15. 10
      ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs
  16. 6
      ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs
  17. 4
      ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs
  18. 17
      ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs
  19. 5
      ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs
  20. 39
      ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs
  21. 2
      ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs
  22. 2
      ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs
  23. 6
      ICSharpCode.NRefactory.CSharp/Parser/mcs/typespec.cs
  24. 29
      ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs
  25. 6
      ICSharpCode.NRefactory.Xml/AXmlReader.cs
  26. 11
      ICSharpCode.NRefactory.Xml/ICSharpCode.NRefactory.Xml.csproj

2
ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

@ -3652,7 +3652,7 @@ namespace ICSharpCode.NRefactory.CSharp
Location.Initialize (new List<SourceFile> (new [] { file })); Location.Initialize (new List<SourceFile> (new [] { file }));
var module = new ModuleContainer (ctx); var module = new ModuleContainer (ctx);
var driver = new Driver (ctx); var driver = new Driver (ctx);
var parser = driver.Parse (reader, file, module); var parser = Driver.Parse (reader, file, module);
var top = new CompilerCompilationUnit () { var top = new CompilerCompilationUnit () {
ModuleCompiled = module, ModuleCompiled = module,

142
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) // Martin Baulig (martin@ximian.com)
// Marek Safar (marek.safar@gmail.com)
// //
// (C) 2003 Ximian, Inc. http://www.ximian.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 // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
@ -30,10 +31,7 @@
using System; using System;
using System.Reflection; using System.Reflection;
using SRE = System.Reflection.Emit;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.IO; using System.IO;
namespace Mono.CompilerServices.SymbolWriter namespace Mono.CompilerServices.SymbolWriter
@ -46,7 +44,13 @@ namespace Mono.CompilerServices.SymbolWriter
public MonoSymbolFileException (string message, params object[] args) public MonoSymbolFileException (string message, params object[] args)
: base (String.Format (message, args)) : base (String.Format (message, args))
{ } {
}
public MonoSymbolFileException (string message, Exception innerException)
: base (message, innerException)
{
}
} }
internal class MyBinaryWriter : BinaryWriter 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 public class MonoSymbolFile : IDisposable
{ {
List<MethodEntry> methods = new List<MethodEntry> (); List<MethodEntry> methods = new List<MethodEntry> ();
@ -163,7 +125,6 @@ namespace Mono.CompilerServices.SymbolWriter
int last_method_index; int last_method_index;
int last_namespace_index; int last_namespace_index;
public readonly string FileName = "<dynamic>";
public readonly int MajorVersion = OffsetTable.MajorVersion; public readonly int MajorVersion = OffsetTable.MajorVersion;
public readonly int MinorVersion = OffsetTable.MinorVersion; public readonly int MinorVersion = OffsetTable.MinorVersion;
@ -369,10 +330,8 @@ namespace Mono.CompilerServices.SymbolWriter
Guid guid; Guid guid;
MonoSymbolFile (string filename) MonoSymbolFile (Stream stream)
{ {
this.FileName = filename;
FileStream stream = new FileStream (filename, FileMode.Open, FileAccess.Read);
reader = new MyBinaryReader (stream); reader = new MyBinaryReader (stream);
try { try {
@ -381,89 +340,56 @@ namespace Mono.CompilerServices.SymbolWriter
int minor_version = reader.ReadInt32 (); int minor_version = reader.ReadInt32 ();
if (magic != OffsetTable.Magic) if (magic != OffsetTable.Magic)
throw new MonoSymbolFileException ( throw new MonoSymbolFileException ("Symbol file is not a valid");
"Symbol file `{0}' is not a valid " +
"Mono symbol file", filename);
if (major_version != OffsetTable.MajorVersion) if (major_version != OffsetTable.MajorVersion)
throw new MonoSymbolFileException ( throw new MonoSymbolFileException (
"Symbol file `{0}' has version {1}, " + "Symbol file has version {0} but expected {1}", major_version, OffsetTable.MajorVersion);
"but expected {2}", filename, major_version,
OffsetTable.MajorVersion);
if (minor_version != OffsetTable.MinorVersion) if (minor_version != OffsetTable.MinorVersion)
throw new MonoSymbolFileException ( throw new MonoSymbolFileException ("Symbol file has version {0}.{1} but expected {2}.{3}",
"Symbol file `{0}' has version {1}.{2}, " + major_version, minor_version,
"but expected {3}.{4}", filename, major_version, OffsetTable.MajorVersion, OffsetTable.MinorVersion);
minor_version, OffsetTable.MajorVersion,
OffsetTable.MinorVersion);
MajorVersion = major_version; MajorVersion = major_version;
MinorVersion = minor_version; MinorVersion = minor_version;
guid = new Guid (reader.ReadBytes (16)); guid = new Guid (reader.ReadBytes (16));
ot = new OffsetTable (reader, major_version, minor_version); ot = new OffsetTable (reader, major_version, minor_version);
} catch { } catch (Exception e) {
throw new MonoSymbolFileException ( throw new MonoSymbolFileException ("Cannot read symbol file", e);
"Cannot read symbol file `{0}'", filename);
} }
source_file_hash = new Dictionary<int, SourceFileEntry> (); source_file_hash = new Dictionary<int, SourceFileEntry> ();
compile_unit_hash = new Dictionary<int, CompileUnitEntry> (); compile_unit_hash = new Dictionary<int, CompileUnitEntry> ();
} }
void CheckGuidMatch (Guid other, string filename, string assembly) public static MonoSymbolFile ReadSymbolFile (Assembly assembly)
{ {
if (other == guid) string filename = assembly.Location;
return; string name = filename + ".mdb";
throw new MonoSymbolFileException (
"Symbol file `{0}' does not match assembly `{1}'",
filename, assembly);
}
#if CECIL Module[] modules = assembly.GetModules ();
protected MonoSymbolFile (string filename, Mono.Cecil.ModuleDefinition module) Guid assembly_guid = modules[0].ModuleVersionId;
: this (filename)
{
CheckGuidMatch (module.Mvid, filename, module.FullyQualifiedName);
}
public static MonoSymbolFile ReadSymbolFile (Mono.Cecil.ModuleDefinition module) return ReadSymbolFile (name, assembly_guid);
{
return ReadSymbolFile (module, module.FullyQualifiedName);
} }
public static MonoSymbolFile ReadSymbolFile (Mono.Cecil.ModuleDefinition module, string filename) public static MonoSymbolFile ReadSymbolFile (string mdbFilename)
{
string name = filename + ".mdb";
return new MonoSymbolFile (name, module);
}
#else
protected MonoSymbolFile (string filename, Assembly assembly) : this (filename)
{ {
// Check that the MDB file matches the assembly, if we have been return ReadSymbolFile (new FileStream (mdbFilename, FileMode.Open, FileAccess.Read));
// passed an assembly.
if (assembly == null)
return;
Module[] modules = assembly.GetModules ();
Guid assembly_guid = MonoDebuggerSupport.GetGuid (modules [0]);
CheckGuidMatch (assembly_guid, filename, assembly.Location);
} }
public static MonoSymbolFile ReadSymbolFile (Assembly assembly) public static MonoSymbolFile ReadSymbolFile (string mdbFilename, Guid assemblyGuid)
{ {
string filename = assembly.Location; var sf = ReadSymbolFile (mdbFilename);
string name = filename + ".mdb"; 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 { public int CompileUnitCount {

6
ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs

@ -920,9 +920,7 @@ namespace Mono.CompilerServices.SymbolWriter
(opcode <= DW_LNE_MONO__extensions_end)) { (opcode <= DW_LNE_MONO__extensions_end)) {
; // reserved for future extensions ; // reserved for future extensions
} else { } else {
throw new MonoSymbolFileException ( throw new MonoSymbolFileException ("Unknown extended opcode {0:x}", opcode);
"Unknown extended opcode {0:x} in LNT ({1})",
opcode, file.FileName);
} }
br.BaseStream.Position = end_pos; 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_offset = -1;
int last_row = -1; int last_row = -1;

8
ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs

@ -768,14 +768,6 @@ namespace Mono.CSharp {
: base (storey, name, local.Type) : base (storey, name, local.Type)
{ {
} }
//
// For compiler generated local variables
//
public HoistedLocalVariable (AnonymousMethodStorey storey, Field field)
: base (storey, field)
{
}
} }
public class HoistedThis : HoistedVariable public class HoistedThis : HoistedVariable

6
ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs

@ -179,12 +179,6 @@ namespace Mono.CSharp
} }
} }
public TypeSpec Type {
get {
return type;
}
}
public TypeSpec ResultType { public TypeSpec ResultType {
get { get {
return result_type; return result_type;

50
ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs

@ -1557,56 +1557,6 @@ namespace Mono.CSharp {
/// </summary> /// </summary>
static class AttributeTester static class AttributeTester
{ {
public enum Result {
Ok,
RefOutArrayError,
ArrayArrayError
}
/// <summary>
/// Returns true if parameters of two compared methods are CLS-Compliant.
/// It tests differing only in ref or out, or in array rank.
/// </summary>
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;
}
/// <summary> /// <summary>
/// Common method for Obsolete error/warning reporting. /// Common method for Obsolete error/warning reporting.
/// </summary> /// </summary>

185
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs

@ -3686,7 +3686,7 @@ case 851:
case_851(); case_851();
break; break;
case 854: case 854:
#line 5643 "cs-parser.jay" #line 5644 "cs-parser.jay"
{ {
yyVal = new Catch ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); yyVal = new Catch ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
} }
@ -3695,7 +3695,7 @@ case 855:
case_855(); case_855();
break; break;
case 856: case 856:
#line 5662 "cs-parser.jay" #line 5663 "cs-parser.jay"
{ {
yyVal = yyVals[-1+yyTop]; yyVal = yyVals[-1+yyTop];
} }
@ -3704,13 +3704,13 @@ case 857:
case_857(); case_857();
break; break;
case 858: case 858:
#line 5680 "cs-parser.jay" #line 5681 "cs-parser.jay"
{ {
yyVal = new Checked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); yyVal = new Checked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
} }
break; break;
case 859: case 859:
#line 5687 "cs-parser.jay" #line 5688 "cs-parser.jay"
{ {
yyVal = new Unchecked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); yyVal = new Unchecked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
} }
@ -3719,7 +3719,7 @@ case 860:
case_860(); case_860();
break; break;
case 861: case 861:
#line 5697 "cs-parser.jay" #line 5698 "cs-parser.jay"
{ {
yyVal = new Unsafe ((Block) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); yyVal = new Unsafe ((Block) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]));
} }
@ -3758,7 +3758,7 @@ case 873:
case_873(); case_873();
break; break;
case 874: case 874:
#line 5802 "cs-parser.jay" #line 5803 "cs-parser.jay"
{ {
Error_MissingInitializer (lexer.Location); Error_MissingInitializer (lexer.Location);
} }
@ -3791,7 +3791,7 @@ case 883:
case_883(); case_883();
break; break;
case 884: case 884:
#line 5903 "cs-parser.jay" #line 5904 "cs-parser.jay"
{ {
current_block = new Linq.QueryBlock (current_block, lexer.Location); current_block = new Linq.QueryBlock (current_block, lexer.Location);
} }
@ -3800,7 +3800,7 @@ case 885:
case_885(); case_885();
break; break;
case 886: case 886:
#line 5918 "cs-parser.jay" #line 5919 "cs-parser.jay"
{ {
current_block = new Linq.QueryBlock (current_block, lexer.Location); current_block = new Linq.QueryBlock (current_block, lexer.Location);
} }
@ -3815,7 +3815,7 @@ case 890:
case_890(); case_890();
break; break;
case 891: case 891:
#line 5963 "cs-parser.jay" #line 5964 "cs-parser.jay"
{ {
current_block = new Linq.QueryBlock (current_block, lexer.Location); current_block = new Linq.QueryBlock (current_block, lexer.Location);
} }
@ -3836,7 +3836,7 @@ case 899:
case_899(); case_899();
break; break;
case 905: case 905:
#line 6022 "cs-parser.jay" #line 6023 "cs-parser.jay"
{ {
current_block = new Linq.QueryBlock (current_block, lexer.Location); current_block = new Linq.QueryBlock (current_block, lexer.Location);
} }
@ -3845,7 +3845,7 @@ case 906:
case_906(); case_906();
break; break;
case 907: case 907:
#line 6041 "cs-parser.jay" #line 6042 "cs-parser.jay"
{ {
current_block = new Linq.QueryBlock (current_block, lexer.Location); current_block = new Linq.QueryBlock (current_block, lexer.Location);
} }
@ -3878,13 +3878,13 @@ case 916:
case_916(); case_916();
break; break;
case 918: case 918:
#line 6185 "cs-parser.jay" #line 6186 "cs-parser.jay"
{ {
yyVal = yyVals[0+yyTop]; yyVal = yyVals[0+yyTop];
} }
break; break;
case 919: case 919:
#line 6192 "cs-parser.jay" #line 6193 "cs-parser.jay"
{ {
current_block = new Linq.QueryBlock (current_block, lexer.Location); current_block = new Linq.QueryBlock (current_block, lexer.Location);
} }
@ -3905,7 +3905,7 @@ case 926:
case_926(); case_926();
break; break;
case 927: case 927:
#line 6238 "cs-parser.jay" #line 6239 "cs-parser.jay"
{ {
yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]);
} }
@ -3917,7 +3917,7 @@ case 929:
case_929(); case_929();
break; break;
case 930: case 930:
#line 6255 "cs-parser.jay" #line 6256 "cs-parser.jay"
{ {
yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]);
} }
@ -3941,13 +3941,13 @@ case 939:
case_939(); case_939();
break; break;
case 947: case 947:
#line 6377 "cs-parser.jay" #line 6378 "cs-parser.jay"
{ {
module.DocumentationBuilder.ParsedName = (MemberName) yyVals[0+yyTop]; module.DocumentationBuilder.ParsedName = (MemberName) yyVals[0+yyTop];
} }
break; break;
case 948: case 948:
#line 6384 "cs-parser.jay" #line 6385 "cs-parser.jay"
{ {
module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)yyVals[0+yyTop]; module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)yyVals[0+yyTop];
} }
@ -3959,13 +3959,13 @@ case 950:
case_950(); case_950();
break; break;
case 951: case 951:
#line 6401 "cs-parser.jay" #line 6402 "cs-parser.jay"
{ {
yyVal = new MemberName ((MemberName) yyVals[-2+yyTop], MemberCache.IndexerNameAlias, Location.Null); yyVal = new MemberName ((MemberName) yyVals[-2+yyTop], MemberCache.IndexerNameAlias, Location.Null);
} }
break; break;
case 952: case 952:
#line 6405 "cs-parser.jay" #line 6406 "cs-parser.jay"
{ {
valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out;
} }
@ -3983,25 +3983,25 @@ case 956:
case_956(); case_956();
break; break;
case 958: case 958:
#line 6441 "cs-parser.jay" #line 6442 "cs-parser.jay"
{ {
yyVal = new MemberName (((MemberName) yyVals[-2+yyTop]), (MemberName) yyVals[0+yyTop]); yyVal = new MemberName (((MemberName) yyVals[-2+yyTop]), (MemberName) yyVals[0+yyTop]);
} }
break; break;
case 960: case 960:
#line 6449 "cs-parser.jay" #line 6450 "cs-parser.jay"
{ {
valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out;
} }
break; break;
case 961: case 961:
#line 6453 "cs-parser.jay" #line 6454 "cs-parser.jay"
{ {
yyVal = yyVals[-1+yyTop]; yyVal = yyVals[-1+yyTop];
} }
break; break;
case 962: case 962:
#line 6460 "cs-parser.jay" #line 6461 "cs-parser.jay"
{ {
yyVal = new List<DocumentationParameter> (0); yyVal = new List<DocumentationParameter> (0);
} }
@ -8272,19 +8272,20 @@ void case_847()
void case_848() void case_848()
#line 5601 "cs-parser.jay" #line 5601 "cs-parser.jay"
{ {
yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List<Catch>) 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<Catch>) yyVals[-2+yyTop], loc, true), (Block) yyVals[0+yyTop], loc);
lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
} }
void case_849() void case_849()
#line 5606 "cs-parser.jay" #line 5607 "cs-parser.jay"
{ {
Error_SyntaxError (1524, yyToken); Error_SyntaxError (1524, yyToken);
yyVal = new TryCatch ((Block) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop]), false); yyVal = new TryCatch ((Block) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop]), false);
} }
void case_850() void case_850()
#line 5614 "cs-parser.jay" #line 5615 "cs-parser.jay"
{ {
var l = new List<Catch> (2); var l = new List<Catch> (2);
@ -8293,7 +8294,7 @@ void case_850()
} }
void case_851() void case_851()
#line 5621 "cs-parser.jay" #line 5622 "cs-parser.jay"
{ {
var l = (List<Catch>) yyVals[-1+yyTop]; var l = (List<Catch>) yyVals[-1+yyTop];
@ -8307,7 +8308,7 @@ void case_851()
} }
void case_855() void case_855()
#line 5645 "cs-parser.jay" #line 5646 "cs-parser.jay"
{ {
start_block (GetLocation (yyVals[-3+yyTop])); start_block (GetLocation (yyVals[-3+yyTop]));
var c = new Catch (current_block, GetLocation (yyVals[-4+yyTop])); var c = new Catch (current_block, GetLocation (yyVals[-4+yyTop]));
@ -8324,7 +8325,7 @@ void case_855()
} }
void case_857() void case_857()
#line 5664 "cs-parser.jay" #line 5665 "cs-parser.jay"
{ {
if (yyToken == Token.CLOSE_PARENS) { if (yyToken == Token.CLOSE_PARENS) {
report.Error (1015, lexer.Location, report.Error (1015, lexer.Location,
@ -8337,14 +8338,14 @@ void case_857()
} }
void case_860() void case_860()
#line 5692 "cs-parser.jay" #line 5693 "cs-parser.jay"
{ {
if (!settings.Unsafe) if (!settings.Unsafe)
Error_UnsafeCodeNotAllowed (GetLocation (yyVals[0+yyTop])); Error_UnsafeCodeNotAllowed (GetLocation (yyVals[0+yyTop]));
} }
void case_862() 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) if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE)
Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); Warning_EmptyStatement (GetLocation (yyVals[0+yyTop]));
@ -8354,7 +8355,7 @@ void case_862()
} }
void case_863() void case_863()
#line 5710 "cs-parser.jay" #line 5711 "cs-parser.jay"
{ {
Error_SyntaxError (yyToken); Error_SyntaxError (yyToken);
@ -8363,7 +8364,7 @@ void case_863()
} }
void case_864() void case_864()
#line 5720 "cs-parser.jay" #line 5721 "cs-parser.jay"
{ {
start_block (GetLocation (yyVals[-2+yyTop])); start_block (GetLocation (yyVals[-2+yyTop]));
@ -8375,14 +8376,14 @@ void case_864()
} }
void case_865() void case_865()
#line 5730 "cs-parser.jay" #line 5731 "cs-parser.jay"
{ {
yyVal = current_variable; yyVal = current_variable;
current_variable = null; current_variable = null;
} }
void case_866() 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) if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE)
Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); Warning_EmptyStatement (GetLocation (yyVals[0+yyTop]));
@ -8394,7 +8395,7 @@ void case_866()
} }
void case_867() void case_867()
#line 5748 "cs-parser.jay" #line 5749 "cs-parser.jay"
{ {
start_block (GetLocation (yyVals[-2+yyTop])); start_block (GetLocation (yyVals[-2+yyTop]));
@ -8406,14 +8407,14 @@ void case_867()
} }
void case_868() void case_868()
#line 5758 "cs-parser.jay" #line 5759 "cs-parser.jay"
{ {
yyVal = current_variable; yyVal = current_variable;
current_variable = null; current_variable = null;
} }
void case_869() 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) if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE)
Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); Warning_EmptyStatement (GetLocation (yyVals[0+yyTop]));
@ -8425,7 +8426,7 @@ void case_869()
} }
void case_870() 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) if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE)
Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); Warning_EmptyStatement (GetLocation (yyVals[0+yyTop]));
@ -8435,7 +8436,7 @@ void case_870()
} }
void case_871() void case_871()
#line 5781 "cs-parser.jay" #line 5782 "cs-parser.jay"
{ {
Error_SyntaxError (yyToken); Error_SyntaxError (yyToken);
@ -8444,14 +8445,14 @@ void case_871()
} }
void case_873() 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*/ /* It has to be here for the parent to safely restore artificial block*/
Error_SyntaxError (yyToken); Error_SyntaxError (yyToken);
} }
void case_875() void case_875()
#line 5804 "cs-parser.jay" #line 5805 "cs-parser.jay"
{ {
current_variable.Initializer = (Expression) yyVals[0+yyTop]; current_variable.Initializer = (Expression) yyVals[0+yyTop];
lbag.AppendTo (current_variable, GetLocation (yyVals[-1+yyTop])); lbag.AppendTo (current_variable, GetLocation (yyVals[-1+yyTop]));
@ -8459,7 +8460,7 @@ void case_875()
} }
void case_876() void case_876()
#line 5816 "cs-parser.jay" #line 5817 "cs-parser.jay"
{ {
lexer.query_parsing = false; lexer.query_parsing = false;
@ -8473,7 +8474,7 @@ void case_876()
} }
void case_877() void case_877()
#line 5828 "cs-parser.jay" #line 5829 "cs-parser.jay"
{ {
Linq.AQueryClause from = yyVals[-1+yyTop] as Linq.AQueryClause; Linq.AQueryClause from = yyVals[-1+yyTop] as Linq.AQueryClause;
@ -8485,7 +8486,7 @@ void case_877()
} }
void case_878() void case_878()
#line 5839 "cs-parser.jay" #line 5840 "cs-parser.jay"
{ {
lexer.query_parsing = false; lexer.query_parsing = false;
yyVal = yyVals[-1+yyTop]; yyVal = yyVals[-1+yyTop];
@ -8495,7 +8496,7 @@ void case_878()
} }
void case_879() void case_879()
#line 5846 "cs-parser.jay" #line 5847 "cs-parser.jay"
{ {
yyVal = yyVals[-1+yyTop]; yyVal = yyVals[-1+yyTop];
current_block.SetEndLocation (lexer.Location); current_block.SetEndLocation (lexer.Location);
@ -8503,7 +8504,7 @@ void case_879()
} }
void case_880() void case_880()
#line 5855 "cs-parser.jay" #line 5856 "cs-parser.jay"
{ {
current_block = new Linq.QueryBlock (current_block, lexer.Location); current_block = new Linq.QueryBlock (current_block, lexer.Location);
@ -8513,7 +8514,7 @@ void case_880()
} }
void case_881() void case_881()
#line 5863 "cs-parser.jay" #line 5864 "cs-parser.jay"
{ {
current_block = new Linq.QueryBlock (current_block, lexer.Location); current_block = new Linq.QueryBlock (current_block, lexer.Location);
@ -8527,7 +8528,7 @@ void case_881()
} }
void case_882() void case_882()
#line 5878 "cs-parser.jay" #line 5879 "cs-parser.jay"
{ {
current_block = new Linq.QueryBlock (current_block, lexer.Location); current_block = new Linq.QueryBlock (current_block, lexer.Location);
@ -8537,7 +8538,7 @@ void case_882()
} }
void case_883() void case_883()
#line 5886 "cs-parser.jay" #line 5887 "cs-parser.jay"
{ {
current_block = new Linq.QueryBlock (current_block, lexer.Location); current_block = new Linq.QueryBlock (current_block, lexer.Location);
@ -8551,7 +8552,7 @@ void case_883()
} }
void case_885() void case_885()
#line 5905 "cs-parser.jay" #line 5906 "cs-parser.jay"
{ {
var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop];
var sn = new Linq.RangeVariable (lt.Value, lt.Location); var sn = new Linq.RangeVariable (lt.Value, lt.Location);
@ -8564,7 +8565,7 @@ void case_885()
} }
void case_887() void case_887()
#line 5920 "cs-parser.jay" #line 5921 "cs-parser.jay"
{ {
var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop];
var sn = new Linq.RangeVariable (lt.Value, lt.Location); var sn = new Linq.RangeVariable (lt.Value, lt.Location);
@ -8580,7 +8581,7 @@ void case_887()
} }
void case_888() void case_888()
#line 5937 "cs-parser.jay" #line 5938 "cs-parser.jay"
{ {
Linq.AQueryClause head = (Linq.AQueryClause)yyVals[-1+yyTop]; Linq.AQueryClause head = (Linq.AQueryClause)yyVals[-1+yyTop];
@ -8597,14 +8598,14 @@ void case_888()
} }
void case_890() void case_890()
#line 5953 "cs-parser.jay" #line 5954 "cs-parser.jay"
{ {
Error_SyntaxError (yyToken); Error_SyntaxError (yyToken);
yyVal = null; yyVal = null;
} }
void case_892() 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])); 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() void case_893()
#line 5972 "cs-parser.jay" #line 5973 "cs-parser.jay"
{ {
if (linq_clause_blocks == null) if (linq_clause_blocks == null)
linq_clause_blocks = new Stack<Linq.QueryBlock> (); linq_clause_blocks = new Stack<Linq.QueryBlock> ();
@ -8623,7 +8624,7 @@ void case_893()
} }
void case_894() void case_894()
#line 5980 "cs-parser.jay" #line 5981 "cs-parser.jay"
{ {
current_block.SetEndLocation (lexer.Location); current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent; current_block = current_block.Parent;
@ -8632,7 +8633,7 @@ void case_894()
} }
void case_895() 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])); 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])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
@ -8642,14 +8643,14 @@ void case_895()
} }
void case_899() 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]; ((Linq.AQueryClause)yyVals[-1+yyTop]).Tail.Next = (Linq.AQueryClause)yyVals[0+yyTop];
yyVal = yyVals[-1+yyTop]; yyVal = yyVals[-1+yyTop];
} }
void case_906() void case_906()
#line 6024 "cs-parser.jay" #line 6025 "cs-parser.jay"
{ {
var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop];
var sn = new Linq.RangeVariable (lt.Value, lt.Location); var sn = new Linq.RangeVariable (lt.Value, lt.Location);
@ -8663,7 +8664,7 @@ void case_906()
} }
void case_908() 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])); 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() void case_909()
#line 6053 "cs-parser.jay" #line 6054 "cs-parser.jay"
{ {
if (linq_clause_blocks == null) if (linq_clause_blocks == null)
linq_clause_blocks = new Stack<Linq.QueryBlock> (); linq_clause_blocks = new Stack<Linq.QueryBlock> ();
@ -8682,7 +8683,7 @@ void case_909()
} }
void case_910() void case_910()
#line 6061 "cs-parser.jay" #line 6062 "cs-parser.jay"
{ {
current_block.SetEndLocation (lexer.Location); current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent; current_block = current_block.Parent;
@ -8692,7 +8693,7 @@ void case_910()
} }
void case_911() void case_911()
#line 6069 "cs-parser.jay" #line 6070 "cs-parser.jay"
{ {
current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop]));
current_block.SetEndLocation (lexer.Location); current_block.SetEndLocation (lexer.Location);
@ -8702,7 +8703,7 @@ void case_911()
} }
void case_912() void case_912()
#line 6077 "cs-parser.jay" #line 6078 "cs-parser.jay"
{ {
current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop]));
current_block.SetEndLocation (lexer.Location); current_block.SetEndLocation (lexer.Location);
@ -8742,7 +8743,7 @@ void case_912()
} }
void case_913() void case_913()
#line 6115 "cs-parser.jay" #line 6116 "cs-parser.jay"
{ {
if (linq_clause_blocks == null) if (linq_clause_blocks == null)
linq_clause_blocks = new Stack<Linq.QueryBlock> (); linq_clause_blocks = new Stack<Linq.QueryBlock> ();
@ -8752,7 +8753,7 @@ void case_913()
} }
void case_914() void case_914()
#line 6123 "cs-parser.jay" #line 6124 "cs-parser.jay"
{ {
current_block.SetEndLocation (lexer.Location); current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent; current_block = current_block.Parent;
@ -8762,7 +8763,7 @@ void case_914()
} }
void case_915() void case_915()
#line 6131 "cs-parser.jay" #line 6132 "cs-parser.jay"
{ {
current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop]));
current_block.SetEndLocation (lexer.Location); current_block.SetEndLocation (lexer.Location);
@ -8772,7 +8773,7 @@ void case_915()
} }
void case_916() void case_916()
#line 6139 "cs-parser.jay" #line 6140 "cs-parser.jay"
{ {
current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop]));
current_block.SetEndLocation (lexer.Location); current_block.SetEndLocation (lexer.Location);
@ -8814,7 +8815,7 @@ void case_916()
} }
void case_920() void case_920()
#line 6194 "cs-parser.jay" #line 6195 "cs-parser.jay"
{ {
current_block.SetEndLocation (lexer.Location); current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent; current_block = current_block.Parent;
@ -8823,7 +8824,7 @@ void case_920()
} }
void case_922() void case_922()
#line 6205 "cs-parser.jay" #line 6206 "cs-parser.jay"
{ {
current_block.SetEndLocation (lexer.Location); current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent; current_block = current_block.Parent;
@ -8832,14 +8833,14 @@ void case_922()
} }
void case_923() void case_923()
#line 6212 "cs-parser.jay" #line 6213 "cs-parser.jay"
{ {
((Linq.AQueryClause)yyVals[-3+yyTop]).Next = (Linq.AQueryClause)yyVals[0+yyTop]; ((Linq.AQueryClause)yyVals[-3+yyTop]).Next = (Linq.AQueryClause)yyVals[0+yyTop];
yyVal = yyVals[-3+yyTop]; yyVal = yyVals[-3+yyTop];
} }
void case_925() void case_925()
#line 6221 "cs-parser.jay" #line 6222 "cs-parser.jay"
{ {
current_block.SetEndLocation (lexer.Location); current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent; current_block = current_block.Parent;
@ -8848,42 +8849,42 @@ void case_925()
} }
void case_926() 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]; ((Linq.AQueryClause)yyVals[-3+yyTop]).Tail.Next = (Linq.AQueryClause)yyVals[0+yyTop];
yyVal = yyVals[-3+yyTop]; yyVal = yyVals[-3+yyTop];
} }
void case_928() 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]); yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
} }
void case_929() 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]); yyVal = new Linq.OrderByDescending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
} }
void case_931() 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]); yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
} }
void case_932() 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]); yyVal = new Linq.ThenByDescending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
} }
void case_934() 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*/ /* query continuation block is not linked with query block but with block*/
/* before. This means each query can use same range variable names for*/ /* before. This means each query can use same range variable names for*/
@ -8901,7 +8902,7 @@ void case_934()
} }
void case_935() void case_935()
#line 6288 "cs-parser.jay" #line 6289 "cs-parser.jay"
{ {
var current_block = linq_clause_blocks.Pop (); var current_block = linq_clause_blocks.Pop ();
var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop];
@ -8912,7 +8913,7 @@ void case_935()
} }
void case_938() void case_938()
#line 6315 "cs-parser.jay" #line 6316 "cs-parser.jay"
{ {
current_container = current_type = new Class (current_container, new MemberName ("<InteractiveExpressionClass>"), Modifiers.PUBLIC, null); current_container = current_type = new Class (current_container, new MemberName ("<InteractiveExpressionClass>"), Modifiers.PUBLIC, null);
@ -8942,7 +8943,7 @@ void case_938()
} }
void case_939() void case_939()
#line 6343 "cs-parser.jay" #line 6344 "cs-parser.jay"
{ {
--lexer.parsing_block; --lexer.parsing_block;
Method method = (Method) oob_stack.Pop (); Method method = (Method) oob_stack.Pop ();
@ -8954,7 +8955,7 @@ void case_939()
} }
void case_949() void case_949()
#line 6386 "cs-parser.jay" #line 6387 "cs-parser.jay"
{ {
module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)yyVals[-1+yyTop]; module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)yyVals[-1+yyTop];
module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)yyVals[0+yyTop]; module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)yyVals[0+yyTop];
@ -8962,7 +8963,7 @@ void case_949()
} }
void case_950() void case_950()
#line 6392 "cs-parser.jay" #line 6393 "cs-parser.jay"
{ {
module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)yyVals[-3+yyTop]; module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)yyVals[-3+yyTop];
module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)yyVals[0+yyTop]; module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)yyVals[0+yyTop];
@ -8971,14 +8972,14 @@ void case_950()
} }
void case_953() void case_953()
#line 6407 "cs-parser.jay" #line 6408 "cs-parser.jay"
{ {
module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)yyVals[-1+yyTop]; module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)yyVals[-1+yyTop];
yyVal = new MemberName ((MemberName) yyVals[-6+yyTop], MemberCache.IndexerNameAlias, Location.Null); yyVal = new MemberName ((MemberName) yyVals[-6+yyTop], MemberCache.IndexerNameAlias, Location.Null);
} }
void case_954() void case_954()
#line 6412 "cs-parser.jay" #line 6413 "cs-parser.jay"
{ {
var p = (List<DocumentationParameter>)yyVals[0+yyTop] ?? new List<DocumentationParameter> (1); var p = (List<DocumentationParameter>)yyVals[0+yyTop] ?? new List<DocumentationParameter> (1);
p.Add (new DocumentationParameter ((FullNamedExpression) yyVals[-1+yyTop])); p.Add (new DocumentationParameter ((FullNamedExpression) yyVals[-1+yyTop]));
@ -8988,7 +8989,7 @@ void case_954()
} }
void case_955() void case_955()
#line 6420 "cs-parser.jay" #line 6421 "cs-parser.jay"
{ {
var p = (List<DocumentationParameter>)yyVals[0+yyTop] ?? new List<DocumentationParameter> (1); var p = (List<DocumentationParameter>)yyVals[0+yyTop] ?? new List<DocumentationParameter> (1);
p.Add (new DocumentationParameter ((FullNamedExpression) yyVals[-1+yyTop])); p.Add (new DocumentationParameter ((FullNamedExpression) yyVals[-1+yyTop]));
@ -8998,7 +8999,7 @@ void case_955()
} }
void case_956() void case_956()
#line 6428 "cs-parser.jay" #line 6429 "cs-parser.jay"
{ {
var p = (List<DocumentationParameter>)yyVals[0+yyTop] ?? new List<DocumentationParameter> (1); var p = (List<DocumentationParameter>)yyVals[0+yyTop] ?? new List<DocumentationParameter> (1);
module.DocumentationBuilder.ParsedParameters = p; module.DocumentationBuilder.ParsedParameters = p;
@ -9007,7 +9008,7 @@ void case_956()
} }
void case_964() void case_964()
#line 6466 "cs-parser.jay" #line 6467 "cs-parser.jay"
{ {
var parameters = new List<DocumentationParameter> (); var parameters = new List<DocumentationParameter> ();
parameters.Add ((DocumentationParameter) yyVals[0+yyTop]); parameters.Add ((DocumentationParameter) yyVals[0+yyTop]);
@ -9015,7 +9016,7 @@ void case_964()
} }
void case_965() void case_965()
#line 6472 "cs-parser.jay" #line 6473 "cs-parser.jay"
{ {
var parameters = yyVals[-2+yyTop] as List<DocumentationParameter>; var parameters = yyVals[-2+yyTop] as List<DocumentationParameter>;
parameters.Add ((DocumentationParameter) yyVals[0+yyTop]); parameters.Add ((DocumentationParameter) yyVals[0+yyTop]);
@ -9023,7 +9024,7 @@ void case_965()
} }
void case_966() void case_966()
#line 6481 "cs-parser.jay" #line 6482 "cs-parser.jay"
{ {
if (yyVals[-1+yyTop] != null) if (yyVals[-1+yyTop] != null)
yyVal = new DocumentationParameter ((Parameter.Modifier) yyVals[-1+yyTop], (FullNamedExpression) yyVals[0+yyTop]); 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, -1, -1, -1, -1, -1, 362,
}; };
#line 6490 "cs-parser.jay" #line 6491 "cs-parser.jay"
// <summary> // <summary>
// A class used to hold info about an operator declarator // A class used to hold info about an operator declarator

3
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay

@ -5599,7 +5599,8 @@ try_statement
} }
| TRY block catch_clauses FINALLY block | TRY block catch_clauses FINALLY block
{ {
$$ = new TryFinally (new TryCatch ((Block) $2, (List<Catch>) $3, Location.Null, true), (Block) $5, GetLocation ($1)); var loc = GetLocation ($1);
$$ = new TryFinally (new TryCatch ((Block) $2, (List<Catch>) $3, loc, true), (Block) $5, loc);
lbag.AddStatement ($$, GetLocation ($4)); lbag.AddStatement ($$, GetLocation ($4));
} }
| TRY block error | TRY block error

7
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs

@ -2242,6 +2242,9 @@ namespace Mono.CSharp
return true; return true;
} }
#if !FULL_AST
static
#endif
bool IsTokenIdentifierEqual (char[] identifier) bool IsTokenIdentifierEqual (char[] identifier)
{ {
for (int i = 0; i < identifier.Length; ++i) { 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"); Report.Warning (1709, 1, Location, "Filename specified for preprocessor directive is empty");
} }
return string_builder.ToString (); return string_builder.ToString ();
} }
@ -3003,6 +3007,9 @@ namespace Mono.CSharp
return Token.IDENTIFIER; return Token.IDENTIFIER;
} }
#if !FULL_AST
static
#endif
string InternIdentifier (char[] charBuffer, int length) string InternIdentifier (char[] charBuffer, int length)
{ {
// //

2
ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs

@ -676,7 +676,7 @@ namespace Mono.CSharp {
do { do {
var ns = m as NamespaceContainer; var ns = m as NamespaceContainer;
if (ns != null) if (ns != null)
return ns.LookupExtensionMethod (this, extensionType, name, arity, ns, 0); return ns.LookupExtensionMethod (this, extensionType, name, arity, 0);
m = m.Parent; m = m.Parent;
} while (m != null); } while (m != null);

4
ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs

@ -241,7 +241,7 @@ namespace Mono.CSharp
// //
// Handles <typeparam /> node // Handles <typeparam /> node
// //
void HandleTypeParam (MemberCore mc, XmlElement node) static void HandleTypeParam (MemberCore mc, XmlElement node)
{ {
if (!node.HasAttribute ("name")) if (!node.HasAttribute ("name"))
return; return;
@ -262,7 +262,7 @@ namespace Mono.CSharp
// //
// Handles <typeparamref /> node // Handles <typeparamref /> node
// //
void HandleTypeParamRef (MemberCore mc, XmlElement node) static void HandleTypeParamRef (MemberCore mc, XmlElement node)
{ {
if (!node.HasAttribute ("name")) if (!node.HasAttribute ("name"))
return; return;

2
ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs

@ -113,7 +113,7 @@ namespace Mono.CSharp
input.Close (); 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); var file = new CompilationSourceFile (module, sourceFile);
module.AddTypeContainer (file); module.AddTypeContainer (file);

9
ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs

@ -734,15 +734,6 @@ namespace Mono.CSharp
this.member = member; 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) public static DynamicInvocation CreateSpecialNameInvoke (ATypeNameExpression member, Arguments args, Location loc)
{ {
return new DynamicInvocation (member, args, loc) { return new DynamicInvocation (member, args, loc) {

2
ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs

@ -3106,7 +3106,7 @@ namespace Mono.CSharp {
int arity = type_arguments == null ? 0 : type_arguments.Count; 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) if (candidates == null)
return null; return null;

10
ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs

@ -5422,16 +5422,6 @@ namespace Mono.CSharp
return mg.OverloadResolve (ec, ref arguments, null, OverloadResolver.Restrictions.None); 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 () public override string GetSignatureForError ()
{ {
return mg.GetSignatureForError (); return mg.GetSignatureForError ();

6
ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs

@ -2146,10 +2146,6 @@ namespace Mono.CSharp {
this.args = args; this.args = args;
} }
public TypeArguments TypeArguments {
get { return args; }
}
public override string GetSignatureForError () public override string GetSignatureForError ()
{ {
return TypeManager.CSharpName (type); return TypeManager.CSharpName (type);
@ -2504,7 +2500,7 @@ namespace Mono.CSharp {
return false; return false;
} }
bool HasDefaultConstructor (TypeSpec atype) static bool HasDefaultConstructor (TypeSpec atype)
{ {
var tp = atype as TypeParameterSpec; var tp = atype as TypeParameterSpec;
if (tp != null) { if (tp != null) {

4
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 // 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 // they can be assembly specific therefore we do check based on names only
// //
public bool HasAttribute (IList<CustomAttributeData> attributesData, string attrName, string attrNamespace) public static bool HasAttribute (IList<CustomAttributeData> attributesData, string attrName, string attrNamespace)
{ {
if (attributesData.Count == 0) if (attributesData.Count == 0)
return false; return false;
@ -1940,7 +1940,7 @@ namespace Mono.CSharp
continue; continue;
// Ignore compiler generated methods // Ignore compiler generated methods
if (importer.HasAttribute (CustomAttributeData.GetCustomAttributes (mb), "CompilerGeneratedAttribute", MetadataImporter.CompilerServicesNamespace)) if (MetadataImporter.HasAttribute (CustomAttributeData.GetCustomAttributes (mb), "CompilerGeneratedAttribute", MetadataImporter.CompilerServicesNamespace))
continue; continue;
} }

17
ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs

@ -73,15 +73,6 @@ namespace Mono.CSharp {
public readonly TypeSpec MemberType; public readonly TypeSpec MemberType;
public readonly int Arity; // -1 to ignore the check 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) public MemberFilter (MethodSpec m)
{ {
Name = m.Name; Name = m.Name;
@ -797,7 +788,7 @@ namespace Mono.CSharp {
while (true) { while (true) {
foreach (var entry in abstract_type.MemberCache.member_hash) { foreach (var entry in abstract_type.MemberCache.member_hash) {
foreach (var name_entry in entry.Value) { 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; continue;
if (name_entry.Kind != MemberKind.Method) if (name_entry.Kind != MemberKind.Method)
@ -846,6 +837,12 @@ namespace Mono.CSharp {
if ((item.Modifiers & (Modifiers.OVERRIDE | Modifiers.VIRTUAL)) == 0) if ((item.Modifiers & (Modifiers.OVERRIDE | Modifiers.VIRTUAL)) == 0)
continue; continue;
//
// Abstract override does not override anything
//
if ((item.Modifiers & Modifiers.ABSTRACT) != 0)
continue;
if (filter.Equals (item)) { if (filter.Equals (item)) {
--not_implemented_count; --not_implemented_count;
abstract_methods [i] = null; abstract_methods [i] = null;

5
ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs

@ -2236,11 +2236,6 @@ namespace Mono.CSharp {
} }
} }
public bool IsExcluded ()
{
return false;
}
public MemberName MethodName { public MemberName MethodName {
get { get {
return MemberName; return MemberName;

39
ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs

@ -327,37 +327,6 @@ namespace Mono.CSharp {
return te; return te;
} }
TypeSpec LookupType (string name, int arity)
{
if (types == null)
return null;
IList<TypeSpec> 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) public FullNamedExpression LookupTypeOrNamespace (IMemberContext ctx, string name, int arity, LookupMode mode, Location loc)
{ {
var texpr = LookupType (ctx, name, arity, mode, loc); var texpr = LookupType (ctx, name, arity, mode, loc);
@ -869,7 +838,7 @@ namespace Mono.CSharp {
base.EmitContainer (); 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 // 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 // checked before we hit A.N1 using
// //
ExtensionMethodCandidates candidates; ExtensionMethodCandidates candidates;
for (; container != null; container = container.Parent) { var container = this;
do {
candidates = container.LookupExtensionMethodCandidates (invocationContext, extensionType, name, arity, ref position); candidates = container.LookupExtensionMethodCandidates (invocationContext, extensionType, name, arity, ref position);
if (candidates != null || container.MemberName == null) if (candidates != null || container.MemberName == null)
return candidates; return candidates;
@ -916,7 +886,8 @@ namespace Mono.CSharp {
} }
position = 0; position = 0;
} container = container.Parent;
} while (container != null);
return null; return null;
} }

2
ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs

@ -494,7 +494,7 @@ namespace Mono.CSharp.Nullable
ec.MarkLabel (end_label); 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); var lifted_type = new NullableType (expr.Type, expr.Location);
if (lifted_type.ResolveAsType (ec) == null) if (lifted_type.ResolveAsType (ec) == null)

2
ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs

@ -1465,7 +1465,7 @@ namespace Mono.CSharp {
declarators.Add (decl); declarators.Add (decl);
} }
void CreateEvaluatorVariable (BlockContext bc, LocalVariable li) static void CreateEvaluatorVariable (BlockContext bc, LocalVariable li)
{ {
if (bc.Report.Errors != 0) if (bc.Report.Errors != 0)
return; return;

6
ICSharpCode.NRefactory.CSharp/Parser/mcs/typespec.cs

@ -1325,12 +1325,6 @@ namespace Mono.CSharp
readonly string name; readonly string name;
InternalType (string name, MemberCache cache)
: this (name)
{
this.cache = cache;
}
InternalType (string name) InternalType (string name)
: base (MemberKind.InternalCompilerType, null, null, null, Modifiers.PUBLIC) : base (MemberKind.InternalCompilerType, null, null, null, Modifiers.PUBLIC)
{ {

29
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 ();
}
}
}");
}
} }
} }

6
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 { public override XmlNodeType NodeType {
get { get {
if (attributeIndex >= 0) if (attributeIndex >= 0)

11
ICSharpCode.NRefactory.Xml/ICSharpCode.NRefactory.Xml.csproj

@ -7,18 +7,18 @@
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.NRefactory.Xml</RootNamespace> <RootNamespace>ICSharpCode.NRefactory.Xml</RootNamespace>
<AssemblyName>ICSharpCode.NRefactory.Xml</AssemblyName> <AssemblyName>ICSharpCode.NRefactory.Xml</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib> <NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<DocumentationFile>..\ICSharpCode.NRefactory\bin\$(Configuration)\ICSharpCode.NRefactory.Xml.xml</DocumentationFile> <DocumentationFile>..\ICSharpCode.NRefactory\bin\$(Configuration)\ICSharpCode.NRefactory.Xml.xml</DocumentationFile>
<SignAssembly>True</SignAssembly> <SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\ICSharpCode.NRefactory.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>..\ICSharpCode.NRefactory.snk</AssemblyOriginatorKeyFile>
<DelaySign>False</DelaySign> <DelaySign>False</DelaySign>
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode> <AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> <PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -40,12 +40,11 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>Full</DebugType> <DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>PdbOnly</DebugType> <DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />

Loading…
Cancel
Save