From 0ca084bb077e305a94250fe7083aa7a7d9131bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Sat, 11 May 2013 04:54:01 +0200 Subject: [PATCH 01/55] Updated mcs. --- .../Parser/CSharpParser.cs | 29 +- .../Parser/mcs/anonymous.cs | 29 +- .../Parser/mcs/argument.cs | 4 +- .../Parser/mcs/assembly.cs | 32 +- .../Parser/mcs/async.cs | 4 + .../Parser/mcs/attribute.cs | 24 +- .../Parser/mcs/class.cs | 65 +- .../Parser/mcs/const.cs | 4 +- .../Parser/mcs/constant.cs | 6 +- .../Parser/mcs/context.cs | 2 +- .../Parser/mcs/cs-parser.cs | 4697 ++++++++--------- .../Parser/mcs/cs-parser.jay | 289 +- .../Parser/mcs/cs-tokenizer.cs | 74 +- .../Parser/mcs/decl.cs | 11 +- .../Parser/mcs/delegate.cs | 18 +- .../Parser/mcs/driver.cs | 2 +- .../Parser/mcs/dynamic.cs | 1 + .../Parser/mcs/ecore.cs | 50 +- .../Parser/mcs/enum.cs | 2 +- .../Parser/mcs/eval.cs | 3 +- .../Parser/mcs/expression.cs | 65 +- .../Parser/mcs/field.cs | 15 +- .../Parser/mcs/generic.cs | 73 +- .../Parser/mcs/import.cs | 39 +- .../Parser/mcs/iterators.cs | 31 +- .../Parser/mcs/linq.cs | 2 +- .../Parser/mcs/literal.cs | 2 +- .../Parser/mcs/membercache.cs | 16 +- .../Parser/mcs/method.cs | 280 +- .../Parser/mcs/modifiers.cs | 2 +- .../Parser/mcs/namespace.cs | 11 +- .../Parser/mcs/nullable.cs | 6 +- .../Parser/mcs/parameter.cs | 8 +- .../Parser/mcs/pending.cs | 34 +- .../Parser/mcs/property.cs | 16 +- .../Parser/mcs/report.cs | 23 + .../Parser/mcs/settings.cs | 26 +- .../Parser/mcs/statement.cs | 146 +- .../Parser/mcs/typemanager.cs | 24 +- .../Parser/mcs/visit.cs | 4 +- .../CodeActions/IterateViaForeachTests.cs | 2 +- .../Statements/InvalidStatementsTests.cs | 2 +- 42 files changed, 3207 insertions(+), 2966 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index 3fa127dc4a..7797855db4 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -213,9 +213,10 @@ namespace ICSharpCode.NRefactory.CSharp var memberType = new MemberType (); memberType.AddChild (ConvertToType (ma.LeftExpression), MemberType.TargetRole); - if (!ma.DotLocation.IsNull) - memberType.AddChild (new CSharpTokenNode (Convert (ma.DotLocation), Roles.Dot), Roles.Dot); - + var loc = LocationsBag.GetLocations (memberType); + if (loc != null) + memberType.AddChild (new CSharpTokenNode (Convert (loc[0]), Roles.Dot), Roles.Dot); + memberType.MemberNameToken = Identifier.Create (ma.Name, Convert (ma.Location)); AddTypeArguments (ma, memberType); @@ -424,9 +425,9 @@ namespace ICSharpCode.NRefactory.CSharp if (newIdent.Name != "") { namespaceDecl.InsertChildBefore (insertPos, newIdent, Roles.Identifier); insertPos = newIdent; - - if (!memberName.DotLocation.IsNull) { - var dotToken = new CSharpTokenNode (Convert (memberName.DotLocation), Roles.Dot); + var loc = LocationsBag.GetLocations (memberName); + if (loc != null) { + var dotToken = new CSharpTokenNode (Convert (loc[0]), Roles.Dot); namespaceDecl.InsertChildBefore (insertPos, dotToken, Roles.Dot); insertPos = dotToken; } @@ -483,9 +484,9 @@ namespace ICSharpCode.NRefactory.CSharp var t = new MemberType (); // t.IsDoubleColon = memberName.IsDoubleColon; t.AddChild (ConvertImport (memberName.Left), MemberType.TargetRole); - - if (!memberName.DotLocation.IsNull) - t.AddChild (new CSharpTokenNode (Convert (memberName.DotLocation), Roles.Dot), Roles.Dot); + var loc = LocationsBag.GetLocations (memberName); + if (loc != null) + t.AddChild (new CSharpTokenNode (Convert (loc[0]), Roles.Dot), Roles.Dot); t.AddChild (Identifier.Create (memberName.Name, Convert (memberName.Location)), Roles.Identifier); AddTypeArguments (t, memberName); @@ -1368,7 +1369,7 @@ namespace ICSharpCode.NRefactory.CSharp return null; } - public override object Visit (BlockVariableDeclaration blockVariableDeclaration) + public override object Visit (BlockVariable blockVariableDeclaration) { var result = new VariableDeclarationStatement (); result.AddChild (ConvertToType (blockVariableDeclaration.TypeExpression), Roles.Type); @@ -1405,7 +1406,7 @@ namespace ICSharpCode.NRefactory.CSharp return result; } - public override object Visit (BlockConstantDeclaration blockVariableDeclaration) + public override object Visit (BlockConstant blockVariableDeclaration) { var result = new VariableDeclarationStatement (); @@ -2155,8 +2156,10 @@ namespace ICSharpCode.NRefactory.CSharp var leftExpr = memberAccess.LeftExpression.Accept (this); result.AddChild ((Expression)leftExpr, Roles.TargetExpression); } - if (!memberAccess.DotLocation.IsNull) { - result.AddChild (new CSharpTokenNode (Convert (memberAccess.DotLocation), Roles.Dot), Roles.Dot); + var loc = LocationsBag.GetLocations (memberAccess); + + if (loc != null) { + result.AddChild (new CSharpTokenNode (Convert (loc[0]), Roles.Dot), Roles.Dot); } } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs index c6380f11a4..7893986fcf 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs @@ -570,6 +570,9 @@ namespace Mono.CSharp { protected virtual void EmitHoistedParameters (EmitContext ec, List hoisted) { foreach (HoistedParameter hp in hoisted) { + if (hp == null) + continue; + // // Parameters could be proxied via local fields for value type storey // @@ -852,6 +855,8 @@ namespace Mono.CSharp { } } + public bool IsAssigned { get; set; } + public ParameterReference Parameter { get { return parameter; @@ -1002,12 +1007,12 @@ namespace Mono.CSharp { return delegate_type; ec.Report.Error (835, loc, "Cannot convert `{0}' to an expression tree of non-delegate type `{1}'", - GetSignatureForError (), TypeManager.CSharpName (delegate_type)); + GetSignatureForError (), delegate_type.GetSignatureForError ()); return null; } ec.Report.Error (1660, loc, "Cannot convert `{0}' to non-delegate type `{1}'", - GetSignatureForError (), TypeManager.CSharpName (delegate_type)); + GetSignatureForError (), delegate_type.GetSignatureForError ()); return null; } @@ -1019,7 +1024,7 @@ namespace Mono.CSharp { if (!ec.IsInProbingMode) ec.Report.Error (1661, loc, "Cannot convert `{0}' to delegate type `{1}' since there is a parameter mismatch", - GetSignatureForError (), TypeManager.CSharpName (delegate_type)); + GetSignatureForError (), delegate_type.GetSignatureForError ()); return false; } @@ -1031,7 +1036,7 @@ namespace Mono.CSharp { return false; ec.Report.Error (1593, loc, "Delegate `{0}' does not take `{1}' arguments", - TypeManager.CSharpName (delegate_type), Parameters.Count.ToString ()); + delegate_type.GetSignatureForError (), Parameters.Count.ToString ()); return false; } @@ -1071,8 +1076,8 @@ namespace Mono.CSharp { ec.Report.Error (1678, loc, "Parameter `{0}' is declared as type `{1}' but should be `{2}'", (i+1).ToString (), - TypeManager.CSharpName (Parameters.Types [i]), - TypeManager.CSharpName (invoke_pd.Types [i])); + Parameters.Types [i].GetSignatureForError (), + invoke_pd.Types [i].GetSignatureForError ()); error = true; } } @@ -1376,7 +1381,7 @@ namespace Mono.CSharp { return null; } - b = b.ConvertToAsyncTask (ec, ec.CurrentMemberDefinition.Parent.PartialContainer, p, return_type, loc); + b = b.ConvertToAsyncTask (ec, ec.CurrentMemberDefinition.Parent.PartialContainer, p, return_type, delegate_type, loc); } return CompatibleMethodFactory (return_type ?? InternalType.ErrorType, delegate_type, p, b); @@ -1739,6 +1744,7 @@ namespace Mono.CSharp { // method = DoCreateMethodHost (ec); method.Define (); + method.PrepareEmit (); } bool is_static = (method.ModFlags & Modifiers.STATIC) != 0; @@ -1865,7 +1871,7 @@ namespace Mono.CSharp { public override string GetSignatureForError () { - return TypeManager.CSharpName (type); + return type.GetSignatureForError (); } } @@ -2004,7 +2010,7 @@ namespace Mono.CSharp { } var li_other = LocalVariable.CreateCompilerGenerated (CurrentType, equals_block, loc); - equals_block.AddStatement (new BlockVariableDeclaration (new TypeExpression (li_other.Type, loc), li_other)); + equals_block.AddStatement (new BlockVariable (new TypeExpression (li_other.Type, loc), li_other)); var other_variable = new LocalVariableReference (li_other, loc); MemberAccess system_collections_generic = new MemberAccess (new MemberAccess ( @@ -2087,6 +2093,7 @@ namespace Mono.CSharp { equals.Block = equals_block; equals.Define (); + equals.PrepareEmit (); Members.Add (equals); // @@ -2116,7 +2123,7 @@ namespace Mono.CSharp { hashcode_top.AddStatement (new Unchecked (hashcode_block, loc)); var li_hash = LocalVariable.CreateCompilerGenerated (Compiler.BuiltinTypes.Int, hashcode_top, loc); - hashcode_block.AddStatement (new BlockVariableDeclaration (new TypeExpression (li_hash.Type, loc), li_hash)); + hashcode_block.AddStatement (new BlockVariable (new TypeExpression (li_hash.Type, loc), li_hash)); LocalVariableReference hash_variable_assign = new LocalVariableReference (li_hash, loc); hashcode_block.AddStatement (new StatementExpression ( new SimpleAssign (hash_variable_assign, rs_hashcode))); @@ -2141,6 +2148,7 @@ namespace Mono.CSharp { hashcode_block.AddStatement (new Return (hash_variable, loc)); hashcode.Block = hashcode_top; hashcode.Define (); + hashcode.PrepareEmit (); Members.Add (hashcode); // @@ -2151,6 +2159,7 @@ namespace Mono.CSharp { tostring_block.AddStatement (new Return (string_concat, loc)); tostring.Block = tostring_block; tostring.Define (); + tostring.PrepareEmit (); Members.Add (tostring); return true; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/argument.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/argument.cs index 03b18b7f37..facb0eb28c 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/argument.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/argument.cs @@ -132,7 +132,7 @@ namespace Mono.CSharp if (Expr.eclass == ExprClass.MethodGroup) return Expr.ExprClassName; - return TypeManager.CSharpName (Expr.Type); + return Expr.Type.GetSignatureForError (); } public bool ResolveMethodGroup (ResolveContext ec) @@ -347,7 +347,7 @@ namespace Mono.CSharp } else if (arg_type.Kind == MemberKind.Void || arg_type == InternalType.Arglist || arg_type.IsPointer) { rc.Report.Error (1978, a.Expr.Location, "An expression of type `{0}' cannot be used as an argument of dynamic operation", - TypeManager.CSharpName (arg_type)); + arg_type.GetSignatureForError ()); } info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags, diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/assembly.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/assembly.cs index fa0a61b175..3a7cb71aaa 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/assembly.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/assembly.cs @@ -7,7 +7,7 @@ // // Copyright 2001, 2002, 2003 Ximian, Inc. // Copyright 2004-2011 Novell, Inc. -// Copyright 2011 Xamarin Inc +// Copyright 2011-2013 Xamarin Inc // @@ -74,6 +74,9 @@ namespace Mono.CSharp Dictionary emitted_forwarders; AssemblyAttributesPlaceholder module_target_attrs; + // Win32 version info values + string vi_product, vi_product_version, vi_company, vi_copyright, vi_trademark; + protected AssemblyDefinition (ModuleContainer module, string name) { this.module = module; @@ -288,7 +291,7 @@ namespace Mono.CSharp } else if (emitted_forwarders.ContainsKey (t.MemberDefinition)) { Report.SymbolRelatedToPreviousError (emitted_forwarders[t.MemberDefinition].Location, null); Report.Error (739, a.Location, "A duplicate type forward of type `{0}'", - TypeManager.CSharpName (t)); + t.GetSignatureForError ()); return; } @@ -297,13 +300,13 @@ namespace Mono.CSharp if (t.MemberDefinition.DeclaringAssembly == this) { Report.SymbolRelatedToPreviousError (t); Report.Error (729, a.Location, "Cannot forward type `{0}' because it is defined in this assembly", - TypeManager.CSharpName (t)); + t.GetSignatureForError ()); return; } if (t.IsNested) { Report.Error (730, a.Location, "Cannot forward type `{0}' because it is a nested type", - TypeManager.CSharpName (t)); + t.GetSignatureForError ()); return; } @@ -347,15 +350,24 @@ namespace Mono.CSharp } else if (a.Type == pa.RuntimeCompatibility) { wrap_non_exception_throws_custom = true; } else if (a.Type == pa.AssemblyFileVersion) { - string value = a.GetString (); - if (string.IsNullOrEmpty (value) || IsValidAssemblyVersion (value, false) == null) { + vi_product_version = a.GetString (); + if (string.IsNullOrEmpty (vi_product_version) || IsValidAssemblyVersion (vi_product_version, false) == null) { Report.Warning (1607, 1, a.Location, "The version number `{0}' specified for `{1}' is invalid", - value, a.Name); + vi_product_version, a.Name); return; } + } else if (a.Type == pa.AssemblyProduct) { + vi_product = a.GetString (); + } else if (a.Type == pa.AssemblyCompany) { + vi_company = a.GetString (); + } else if (a.Type == pa.AssemblyDescription) { + // TODO: Needs extra api + } else if (a.Type == pa.AssemblyCopyright) { + vi_copyright = a.GetString (); + } else if (a.Type == pa.AssemblyTrademark) { + vi_trademark = a.GetString (); } - SetCustomAttribute (ctor, cdata); } @@ -370,7 +382,7 @@ namespace Mono.CSharp // no working SRE API foreach (var entry in Importer.Assemblies) { var a = entry as ImportedAssemblyDefinition; - if (a == null) + if (a == null || a.IsMissing) continue; if (public_key != null && !a.HasStrongName) { @@ -749,7 +761,7 @@ namespace Mono.CSharp if (Compiler.Settings.Win32ResourceFile != null) { Builder.DefineUnmanagedResource (Compiler.Settings.Win32ResourceFile); } else { - Builder.DefineVersionInfoResource (); + Builder.DefineVersionInfoResource (vi_product, vi_product_version, vi_company, vi_copyright, vi_trademark); } if (Compiler.Settings.Win32IconFile != null) { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs index 4357d78745..a875fe74fc 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs @@ -384,6 +384,10 @@ namespace Mono.CSharp } } + public TypeSpec DelegateType { + get; set; + } + public override bool IsIterator { get { return false; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs index 27ee55ef8a..f105742ada 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs @@ -1,14 +1,14 @@ // -// attribute.cs: Attribute Handler +// attribute.cs: Attributes handling // // Author: Ravi Pratap (ravi@ximian.com) -// Marek Safar (marek.safar@seznam.cz) +// Marek Safar (marek.safar@gmail.com) // // Dual licensed under the terms of the MIT X11 or GNU GPL // // Copyright 2001-2003 Ximian, Inc (http://www.ximian.com) // Copyright 2003-2008 Novell, Inc. -// Copyright 2011 Xamarin Inc +// Copyright 2011-2013 Xamarin Inc // using System; @@ -264,7 +264,7 @@ namespace Mono.CSharp { public void Error_AttributeEmitError (string inner) { Report.Error (647, Location, "Error during emitting `{0}' attribute. The reason is `{1}'", - TypeManager.CSharpName (Type), inner); + Type.GetSignatureForError (), inner); } public void Error_InvalidSecurityParent () @@ -367,7 +367,7 @@ namespace Mono.CSharp { public string GetSignatureForError () { if (Type != null) - return TypeManager.CSharpName (Type); + return Type.GetSignatureForError (); return expression.GetSignatureForError (); } @@ -454,7 +454,7 @@ namespace Mono.CSharp { ObsoleteAttribute obsolete_attr = Type.GetAttributeObsolete (); if (obsolete_attr != null) { - AttributeTester.Report_ObsoleteMessage (obsolete_attr, TypeManager.CSharpName (Type), Location, Report); + AttributeTester.Report_ObsoleteMessage (obsolete_attr, Type.GetSignatureForError (), Location, Report); } ResolveContext rc = null; @@ -1669,6 +1669,11 @@ namespace Mono.CSharp { public readonly PredefinedDecimalAttribute DecimalConstant; public readonly PredefinedAttribute StructLayout; public readonly PredefinedAttribute FieldOffset; + public readonly PredefinedAttribute AssemblyProduct; + public readonly PredefinedAttribute AssemblyCompany; + public readonly PredefinedAttribute AssemblyDescription; + public readonly PredefinedAttribute AssemblyCopyright; + public readonly PredefinedAttribute AssemblyTrademark; public readonly PredefinedAttribute CallerMemberNameAttribute; public readonly PredefinedAttribute CallerLineNumberAttribute; public readonly PredefinedAttribute CallerFilePathAttribute; @@ -1722,6 +1727,11 @@ namespace Mono.CSharp { DecimalConstant = new PredefinedDecimalAttribute (module, "System.Runtime.CompilerServices", "DecimalConstantAttribute"); StructLayout = new PredefinedAttribute (module, "System.Runtime.InteropServices", "StructLayoutAttribute"); FieldOffset = new PredefinedAttribute (module, "System.Runtime.InteropServices", "FieldOffsetAttribute"); + AssemblyProduct = new PredefinedAttribute (module, "System.Reflection", "AssemblyProductAttribute"); + AssemblyCompany = new PredefinedAttribute (module, "System.Reflection", "AssemblyCompanyAttribute"); + AssemblyDescription = new PredefinedAttribute (module, "System.Reflection", "AssemblyDescriptionAttribute"); + AssemblyCopyright = new PredefinedAttribute (module, "System.Reflection", "AssemblyCopyrightAttribute"); + AssemblyTrademark = new PredefinedAttribute (module, "System.Reflection", "AssemblyTrademarkAttribute"); AsyncStateMachine = new PredefinedStateMachineAttribute (module, "System.Runtime.CompilerServices", "AsyncStateMachineAttribute"); @@ -1839,7 +1849,7 @@ namespace Mono.CSharp { // // Handle all parameter-less attributes as optional // - if (!IsDefined) + if (!Define ()) return false; ctor = (MethodSpec) MemberCache.FindMember (type, MemberFilter.Constructor (ParametersCompiled.EmptyReadOnlyParameters), BindingRestriction.DeclaredOnly); diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs index 9fe29a421c..048127505f 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; -using System.Linq; using System.Text; using System.Diagnostics; using Mono.CompilerServices.SymbolWriter; @@ -1090,9 +1089,9 @@ namespace Mono.CSharp } } - public virtual void AddBasesForPart (List bases) + public virtual void SetBaseTypes (List baseTypes) { - type_bases = bases; + type_bases = baseTypes; } /// @@ -1283,8 +1282,10 @@ namespace Mono.CSharp all_tp_builders = TypeBuilder.DefineGenericParameters (tparam_names); - if (CurrentTypeParameters != null) - CurrentTypeParameters.Define (all_tp_builders, spec, CurrentTypeParametersStartIndex, this); + if (CurrentTypeParameters != null) { + CurrentTypeParameters.Create (spec, CurrentTypeParametersStartIndex, this); + CurrentTypeParameters.Define (all_tp_builders); + } } return true; @@ -1445,6 +1446,7 @@ namespace Mono.CSharp members.Add (proxy_method); proxy_method.Define (); + proxy_method.PrepareEmit (); hoisted_base_call_proxies.Add (method, proxy_method); } @@ -1627,6 +1629,10 @@ namespace Mono.CSharp foreach (var member in members) { var pm = member as IParametersMember; if (pm != null) { + var mc = member as MethodOrOperator; + if (mc != null) { + mc.PrepareEmit (); + } var p = pm.Parameters; if (p.IsEmpty) @@ -1698,19 +1704,6 @@ namespace Mono.CSharp current_type = null; } - void UpdateTypeParameterConstraints (TypeDefinition part) - { - for (int i = 0; i < CurrentTypeParameters.Count; i++) { - if (CurrentTypeParameters[i].AddPartialConstraints (part, part.MemberName.TypeParameters[i])) - continue; - - Report.SymbolRelatedToPreviousError (Location, ""); - Report.Error (265, part.Location, - "Partial declarations of `{0}' have inconsistent constraints for type parameter `{1}'", - GetSignatureForError (), CurrentTypeParameters[i].GetSignatureForError ()); - } - } - public override void RemoveContainer (TypeContainer cont) { base.RemoveContainer (cont); @@ -1735,7 +1728,7 @@ namespace Mono.CSharp } if (IsPartialPart) { - PartialContainer.UpdateTypeParameterConstraints (this); + PartialContainer.CurrentTypeParameters.UpdateConstraints (this); } return true; @@ -2296,7 +2289,7 @@ namespace Mono.CSharp Report.SymbolRelatedToPreviousError (mb.InterfaceType); Report.Error (540, mb.Location, "`{0}': containing type does not implement interface `{1}'", - mb.GetSignatureForError (), TypeManager.CSharpName (mb.InterfaceType)); + mb.GetSignatureForError (), mb.InterfaceType.GetSignatureForError ()); return false; } @@ -2526,7 +2519,7 @@ namespace Mono.CSharp /// /// Defines the default constructors /// - protected Constructor DefineDefaultConstructor (bool is_static) + protected virtual Constructor DefineDefaultConstructor (bool is_static) { // The default instance constructor is public // If the class is abstract, the default constructor is protected @@ -2607,14 +2600,14 @@ namespace Mono.CSharp visitor.Visit (this); } - public override void AddBasesForPart (List bases) + public override void SetBaseTypes (List baseTypes) { var pmn = MemberName; if (pmn.Name == "Object" && !pmn.IsGeneric && Parent.MemberName.Name == "System" && Parent.MemberName.Left == null) Report.Error (537, Location, "The class System.Object cannot have a base class or implement an interface."); - base.AddBasesForPart (bases); + base.SetBaseTypes (baseTypes); } public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa) @@ -3047,7 +3040,7 @@ namespace Mono.CSharp Report.SymbolRelatedToPreviousError (iface); Report.Warning (3027, 1, Location, "`{0}' is not CLS-compliant because base interface `{1}' is not CLS-compliant", - GetSignatureForError (), TypeManager.CSharpName (iface)); + GetSignatureForError (), iface.GetSignatureForError ()); } } @@ -3282,10 +3275,10 @@ namespace Mono.CSharp Report.SymbolRelatedToPreviousError (base_member); if (this is PropertyBasedMember) { Report.Error (1715, Location, "`{0}': type must be `{1}' to match overridden member `{2}'", - GetSignatureForError (), TypeManager.CSharpName (base_member_type), TypeManager.CSharpSignature (base_member)); + GetSignatureForError (), base_member_type.GetSignatureForError (), base_member.GetSignatureForError ()); } else { Report.Error (508, Location, "`{0}': return type must be `{1}' to match overridden member `{2}'", - GetSignatureForError (), TypeManager.CSharpName (base_member_type), TypeManager.CSharpSignature (base_member)); + GetSignatureForError (), base_member_type.GetSignatureForError (), base_member.GetSignatureForError ()); } ok = false; } @@ -3359,7 +3352,7 @@ namespace Mono.CSharp if (!InterfaceType.IsInterface) { Report.SymbolRelatedToPreviousError (InterfaceType); Report.Error (538, Location, "The type `{0}' in explicit interface declaration is not an interface", - TypeManager.CSharpName (InterfaceType)); + InterfaceType.GetSignatureForError ()); } else { Parent.PartialContainer.VerifyImplements (this); } @@ -3390,15 +3383,15 @@ namespace Mono.CSharp if (this is Indexer) Report.Error (55, Location, "Inconsistent accessibility: parameter type `{0}' is less accessible than indexer `{1}'", - TypeManager.CSharpName (t), GetSignatureForError ()); + t.GetSignatureForError (), GetSignatureForError ()); else if (this is Operator) Report.Error (57, Location, "Inconsistent accessibility: parameter type `{0}' is less accessible than operator `{1}'", - TypeManager.CSharpName (t), GetSignatureForError ()); + t.GetSignatureForError (), GetSignatureForError ()); else Report.Error (51, Location, "Inconsistent accessibility: parameter type `{0}' is less accessible than method `{1}'", - TypeManager.CSharpName (t), GetSignatureForError ()); + t.GetSignatureForError (), GetSignatureForError ()); error = true; } return !error; @@ -3507,7 +3500,7 @@ namespace Mono.CSharp // replacing predefined names which saves some space and name // is still unique // - return TypeManager.CSharpName (InterfaceType) + "." + name; + return InterfaceType.GetSignatureForError () + "." + name; } public override string GetSignatureForDocumentation () @@ -3607,28 +3600,28 @@ namespace Mono.CSharp if (this is Property) Report.Error (53, Location, "Inconsistent accessibility: property type `" + - TypeManager.CSharpName (MemberType) + "' is less " + + MemberType.GetSignatureForError () + "' is less " + "accessible than property `" + GetSignatureForError () + "'"); else if (this is Indexer) Report.Error (54, Location, "Inconsistent accessibility: indexer return type `" + - TypeManager.CSharpName (MemberType) + "' is less " + + MemberType.GetSignatureForError () + "' is less " + "accessible than indexer `" + GetSignatureForError () + "'"); else if (this is MethodCore) { if (this is Operator) Report.Error (56, Location, "Inconsistent accessibility: return type `" + - TypeManager.CSharpName (MemberType) + "' is less " + + MemberType.GetSignatureForError () + "' is less " + "accessible than operator `" + GetSignatureForError () + "'"); else Report.Error (50, Location, "Inconsistent accessibility: return type `" + - TypeManager.CSharpName (MemberType) + "' is less " + + MemberType.GetSignatureForError () + "' is less " + "accessible than method `" + GetSignatureForError () + "'"); } else { Report.Error (52, Location, "Inconsistent accessibility: field type `" + - TypeManager.CSharpName (MemberType) + "' is less " + + MemberType.GetSignatureForError () + "' is less " + "accessible than field `" + GetSignatureForError () + "'"); } } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/const.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/const.cs index 31cba91fe0..eef90b3460 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/const.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/const.cs @@ -100,10 +100,10 @@ namespace Mono.CSharp { { if (t.IsGenericParameter) { Report.Error (1959, loc, - "Type parameter `{0}' cannot be declared const", TypeManager.CSharpName (t)); + "Type parameter `{0}' cannot be declared const", t.GetSignatureForError ()); } else { Report.Error (283, loc, - "The type `{0}' cannot be declared const", TypeManager.CSharpName (t)); + "The type `{0}' cannot be declared const", t.GetSignatureForError ()); } } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/constant.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/constant.cs index 72d96fddf9..ff114f5203 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/constant.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/constant.cs @@ -64,7 +64,7 @@ namespace Mono.CSharp { BuiltinTypeSpec.IsPrimitiveTypeOrDecimal (target) && BuiltinTypeSpec.IsPrimitiveTypeOrDecimal (type)) { ec.Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'", - GetValueAsLiteral (), TypeManager.CSharpName (target)); + GetValueAsLiteral (), target.GetSignatureForError ()); } else { base.Error_ValueCannotBeConverted (ec, target, expl); } @@ -100,7 +100,7 @@ namespace Mono.CSharp { // reached, by calling Convert.ImplicitStandardConversionExists // throw new InternalErrorException ("Missing constant conversion between `{0}' and `{1}'", - TypeManager.CSharpName (Type), TypeManager.CSharpName (type)); + Type.GetSignatureForError (), type.GetSignatureForError ()); } return CreateConstantFromValue (type, constant_value, loc); @@ -402,7 +402,7 @@ namespace Mono.CSharp { catch { ec.Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'", - GetValue ().ToString (), TypeManager.CSharpName (target)); + GetValue ().ToString (), target.GetSignatureForError ()); } } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/context.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/context.cs index c06c1c478a..f636ffdb0a 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/context.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/context.cs @@ -782,7 +782,7 @@ namespace Mono.CSharp public LocationsBag LocationsBag { get; set; } public bool UseJayGlobalArrays { get; set; } - public Tokenizer.LocatedToken[] LocatedTokens { get; set; } + public LocatedToken[] LocatedTokens { get; set; } public MD5 GetChecksumAlgorithm () { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs index d22fa412a0..84238148de 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs @@ -56,7 +56,7 @@ namespace Mono.CSharp /// Block current_block; - BlockVariableDeclaration current_variable; + BlockVariable current_variable; Delegate current_delegate; @@ -275,7 +275,7 @@ namespace Mono.CSharp //t "positional_or_named_argument : error", //t "$$7 :", //t "named_attribute_argument : IDENTIFIER ASSIGN $$7 expression", -//t "named_argument : identifier_inside_body COLON opt_named_modifier expression", +//t "named_argument : identifier_inside_body COLON opt_named_modifier expression_or_error", //t "opt_named_modifier :", //t "opt_named_modifier : REF", //t "opt_named_modifier : OUT", @@ -1541,7 +1541,7 @@ case 43: case_43(); break; case 44: -#line 636 "cs-parser.jay" +#line 635 "cs-parser.jay" { current_namespace.DeclarationFound = true; } @@ -1580,15 +1580,15 @@ case 62: case_62(); break; case 63: -#line 771 "cs-parser.jay" +#line 770 "cs-parser.jay" { yyVal = "event"; savedCloseLocation = GetLocation (yyVals[0+yyTop]); } break; case 64: -#line 772 "cs-parser.jay" +#line 771 "cs-parser.jay" { yyVal = "return"; savedCloseLocation = GetLocation (yyVals[0+yyTop]); } break; case 65: -#line 779 "cs-parser.jay" +#line 778 "cs-parser.jay" { yyVal = new List (4) { (Attribute) yyVals[0+yyTop] }; } @@ -1597,7 +1597,7 @@ case 66: case_66(); break; case 67: -#line 796 "cs-parser.jay" +#line 795 "cs-parser.jay" { ++lexer.parsing_block; } @@ -1606,14 +1606,14 @@ case 68: case_68(); break; case 70: -#line 824 "cs-parser.jay" +#line 823 "cs-parser.jay" { yyVal = null; HadAttributeParens = false; } break; case 71: case_71(); break; case 72: -#line 836 "cs-parser.jay" +#line 835 "cs-parser.jay" { yyVal = null; } break; case 73: @@ -1629,7 +1629,7 @@ case 76: case_76(); break; case 77: -#line 880 "cs-parser.jay" +#line 879 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } @@ -1638,7 +1638,7 @@ case 79: case_79(); break; case 80: -#line 893 "cs-parser.jay" +#line 892 "cs-parser.jay" { ++lexer.parsing_block; } @@ -1650,29 +1650,29 @@ case 82: case_82(); break; case 83: -#line 919 "cs-parser.jay" +#line 918 "cs-parser.jay" { yyVal = null; } break; case 84: -#line 923 "cs-parser.jay" +#line 922 "cs-parser.jay" { yyVal = Argument.AType.Ref; } break; case 85: -#line 927 "cs-parser.jay" +#line 926 "cs-parser.jay" { yyVal = Argument.AType.Out; } break; case 88: -#line 939 "cs-parser.jay" +#line 938 "cs-parser.jay" { lexer.parsing_modifiers = true; } break; case 89: -#line 943 "cs-parser.jay" +#line 942 "cs-parser.jay" { lexer.parsing_modifiers = true; } @@ -1681,7 +1681,7 @@ case 102: case_102(); break; case 103: -#line 974 "cs-parser.jay" +#line 973 "cs-parser.jay" { } break; @@ -1701,7 +1701,7 @@ case 108: case_108(); break; case 109: -#line 1018 "cs-parser.jay" +#line 1017 "cs-parser.jay" { Error_SyntaxError (yyToken); } @@ -1716,13 +1716,13 @@ case 112: case_112(); break; case 115: -#line 1067 "cs-parser.jay" +#line 1066 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 116: -#line 1071 "cs-parser.jay" +#line 1070 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } @@ -1731,7 +1731,7 @@ case 117: case_117(); break; case 118: -#line 1087 "cs-parser.jay" +#line 1086 "cs-parser.jay" { ++lexer.parsing_block; } @@ -1755,7 +1755,7 @@ case 126: case_126(); break; case 127: -#line 1166 "cs-parser.jay" +#line 1165 "cs-parser.jay" { report.Error (1641, GetLocation (yyVals[-1+yyTop]), "A fixed size buffer field must have the array size specifier after the field name"); } @@ -1767,13 +1767,13 @@ case 130: case_130(); break; case 133: -#line 1196 "cs-parser.jay" +#line 1195 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 134: -#line 1200 "cs-parser.jay" +#line 1199 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } @@ -1782,7 +1782,7 @@ case 135: case_135(); break; case 136: -#line 1213 "cs-parser.jay" +#line 1212 "cs-parser.jay" { ++lexer.parsing_block; } @@ -1791,13 +1791,13 @@ case 137: case_137(); break; case 140: -#line 1232 "cs-parser.jay" +#line 1231 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 141: -#line 1236 "cs-parser.jay" +#line 1235 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } @@ -1806,7 +1806,7 @@ case 142: case_142(); break; case 143: -#line 1252 "cs-parser.jay" +#line 1251 "cs-parser.jay" { ++lexer.parsing_block; } @@ -1827,7 +1827,7 @@ case 150: case_150(); break; case 151: -#line 1320 "cs-parser.jay" +#line 1319 "cs-parser.jay" { valid_param_mod = ParameterModifierType.All; } @@ -1839,7 +1839,7 @@ case 153: case_153(); break; case 154: -#line 1359 "cs-parser.jay" +#line 1358 "cs-parser.jay" { lexer.parsing_generic_declaration = true; } @@ -1848,7 +1848,7 @@ case 155: case_155(); break; case 156: -#line 1369 "cs-parser.jay" +#line 1368 "cs-parser.jay" { lexer.ConstraintsParsing = true; } @@ -1863,11 +1863,11 @@ case 159: case_159(); break; case 161: -#line 1440 "cs-parser.jay" +#line 1441 "cs-parser.jay" { savedLocation = GetLocation (yyVals[0+yyTop]); yyVal = null; } break; case 162: -#line 1444 "cs-parser.jay" +#line 1445 "cs-parser.jay" { yyVal = ParametersCompiled.EmptyReadOnlyParameters; } break; case 164: @@ -1892,13 +1892,13 @@ case 170: case_170(); break; case 171: -#line 1516 "cs-parser.jay" +#line 1517 "cs-parser.jay" { yyVal = new ParametersCompiled (new Parameter[] { (Parameter) yyVals[0+yyTop] } ); } break; case 172: -#line 1520 "cs-parser.jay" +#line 1521 "cs-parser.jay" { yyVal = new ParametersCompiled (new Parameter [] { new ArglistParameter (GetLocation (yyVals[0+yyTop])) }, true); } @@ -1925,7 +1925,7 @@ case 179: case_179(); break; case 180: -#line 1601 "cs-parser.jay" +#line 1602 "cs-parser.jay" { ++lexer.parsing_block; } @@ -1934,11 +1934,11 @@ case 181: case_181(); break; case 182: -#line 1642 "cs-parser.jay" +#line 1643 "cs-parser.jay" { yyVal = Parameter.Modifier.NONE; } break; case 184: -#line 1650 "cs-parser.jay" +#line 1651 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -1971,7 +1971,7 @@ case 193: case_193(); break; case 194: -#line 1744 "cs-parser.jay" +#line 1745 "cs-parser.jay" { Error_DuplicateParameterModifier (GetLocation (yyVals[-1+yyTop]), Parameter.Modifier.PARAMS); } @@ -1992,7 +1992,7 @@ case 199: case_199(); break; case 200: -#line 1798 "cs-parser.jay" +#line 1799 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Params | ParameterModifierType.DefaultValue; } @@ -2001,7 +2001,7 @@ case 201: case_201(); break; case 202: -#line 1827 "cs-parser.jay" +#line 1828 "cs-parser.jay" { lexer.PropertyParsing = false; } @@ -2031,7 +2031,7 @@ case 215: case_215(); break; case 216: -#line 1975 "cs-parser.jay" +#line 1976 "cs-parser.jay" { } break; @@ -2048,55 +2048,55 @@ case 220: case_220(); break; case 221: -#line 2015 "cs-parser.jay" +#line 2016 "cs-parser.jay" { Error_SyntaxError (yyToken); } break; case 224: -#line 2027 "cs-parser.jay" +#line 2028 "cs-parser.jay" { lexer.parsing_modifiers = true; } break; case 225: -#line 2031 "cs-parser.jay" +#line 2032 "cs-parser.jay" { lexer.parsing_modifiers = true; } break; case 226: -#line 2038 "cs-parser.jay" +#line 2039 "cs-parser.jay" { report.Error (525, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain fields or constants"); } break; case 227: -#line 2042 "cs-parser.jay" +#line 2043 "cs-parser.jay" { report.Error (525, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain fields or constants"); } break; case 232: -#line 2050 "cs-parser.jay" +#line 2051 "cs-parser.jay" { report.Error (567, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain operators"); } break; case 233: -#line 2054 "cs-parser.jay" +#line 2055 "cs-parser.jay" { report.Error (526, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain contructors"); } break; case 234: -#line 2058 "cs-parser.jay" +#line 2059 "cs-parser.jay" { report.Error (524, GetLocation (yyVals[0+yyTop]), "Interfaces cannot declare classes, structs, interfaces, delegates, or enumerations"); } break; case 235: -#line 2064 "cs-parser.jay" +#line 2065 "cs-parser.jay" { } break; @@ -2104,14 +2104,14 @@ case 236: case_236(); break; case 238: -#line 2097 "cs-parser.jay" +#line 2098 "cs-parser.jay" { savedLocation = GetLocation (yyVals[0+yyTop]); yyVal = null; } break; case 240: case_240(); break; case 241: -#line 2113 "cs-parser.jay" +#line 2114 "cs-parser.jay" { valid_param_mod = ParameterModifierType.DefaultValue; } @@ -2120,95 +2120,95 @@ case 242: case_242(); break; case 244: -#line 2159 "cs-parser.jay" +#line 2160 "cs-parser.jay" { yyVal = Operator.OpType.LogicalNot; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 245: -#line 2160 "cs-parser.jay" +#line 2161 "cs-parser.jay" { yyVal = Operator.OpType.OnesComplement; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 246: -#line 2161 "cs-parser.jay" +#line 2162 "cs-parser.jay" { yyVal = Operator.OpType.Increment; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 247: -#line 2162 "cs-parser.jay" +#line 2163 "cs-parser.jay" { yyVal = Operator.OpType.Decrement; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 248: -#line 2163 "cs-parser.jay" +#line 2164 "cs-parser.jay" { yyVal = Operator.OpType.True; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 249: -#line 2164 "cs-parser.jay" +#line 2165 "cs-parser.jay" { yyVal = Operator.OpType.False; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 250: -#line 2166 "cs-parser.jay" +#line 2167 "cs-parser.jay" { yyVal = Operator.OpType.Addition; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 251: -#line 2167 "cs-parser.jay" +#line 2168 "cs-parser.jay" { yyVal = Operator.OpType.Subtraction; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 252: -#line 2169 "cs-parser.jay" +#line 2170 "cs-parser.jay" { yyVal = Operator.OpType.Multiply; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 253: -#line 2170 "cs-parser.jay" +#line 2171 "cs-parser.jay" { yyVal = Operator.OpType.Division; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 254: -#line 2171 "cs-parser.jay" +#line 2172 "cs-parser.jay" { yyVal = Operator.OpType.Modulus; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 255: -#line 2172 "cs-parser.jay" +#line 2173 "cs-parser.jay" { yyVal = Operator.OpType.BitwiseAnd; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 256: -#line 2173 "cs-parser.jay" +#line 2174 "cs-parser.jay" { yyVal = Operator.OpType.BitwiseOr; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 257: -#line 2174 "cs-parser.jay" +#line 2175 "cs-parser.jay" { yyVal = Operator.OpType.ExclusiveOr; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 258: -#line 2175 "cs-parser.jay" +#line 2176 "cs-parser.jay" { yyVal = Operator.OpType.LeftShift; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 259: -#line 2176 "cs-parser.jay" +#line 2177 "cs-parser.jay" { yyVal = Operator.OpType.RightShift; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 260: -#line 2177 "cs-parser.jay" +#line 2178 "cs-parser.jay" { yyVal = Operator.OpType.Equality; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 261: -#line 2178 "cs-parser.jay" +#line 2179 "cs-parser.jay" { yyVal = Operator.OpType.Inequality; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 262: -#line 2179 "cs-parser.jay" +#line 2180 "cs-parser.jay" { yyVal = Operator.OpType.GreaterThan; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 263: -#line 2180 "cs-parser.jay" +#line 2181 "cs-parser.jay" { yyVal = Operator.OpType.LessThan; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 264: -#line 2181 "cs-parser.jay" +#line 2182 "cs-parser.jay" { yyVal = Operator.OpType.GreaterThanOrEqual; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 265: -#line 2182 "cs-parser.jay" +#line 2183 "cs-parser.jay" { yyVal = Operator.OpType.LessThanOrEqual; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 266: -#line 2189 "cs-parser.jay" +#line 2190 "cs-parser.jay" { valid_param_mod = ParameterModifierType.DefaultValue; } @@ -2217,7 +2217,7 @@ case 267: case_267(); break; case 268: -#line 2212 "cs-parser.jay" +#line 2213 "cs-parser.jay" { valid_param_mod = ParameterModifierType.DefaultValue; } @@ -2244,11 +2244,11 @@ case 275: case_275(); break; case 277: -#line 2322 "cs-parser.jay" +#line 2323 "cs-parser.jay" { current_block = null; yyVal = null; } break; case 280: -#line 2334 "cs-parser.jay" +#line 2335 "cs-parser.jay" { ++lexer.parsing_block; } @@ -2257,7 +2257,7 @@ case 281: case_281(); break; case 282: -#line 2344 "cs-parser.jay" +#line 2345 "cs-parser.jay" { ++lexer.parsing_block; } @@ -2296,7 +2296,7 @@ case 293: case_293(); break; case 295: -#line 2471 "cs-parser.jay" +#line 2472 "cs-parser.jay" { ++lexer.parsing_block; } @@ -2305,13 +2305,13 @@ case 296: case_296(); break; case 299: -#line 2489 "cs-parser.jay" +#line 2490 "cs-parser.jay" { current_event_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 300: -#line 2493 "cs-parser.jay" +#line 2494 "cs-parser.jay" { current_event_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } @@ -2320,7 +2320,7 @@ case 301: case_301(); break; case 302: -#line 2506 "cs-parser.jay" +#line 2507 "cs-parser.jay" { ++lexer.parsing_block; } @@ -2332,7 +2332,7 @@ case 304: case_304(); break; case 305: -#line 2531 "cs-parser.jay" +#line 2532 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -2386,7 +2386,7 @@ case 325: case_325(); break; case 328: -#line 2717 "cs-parser.jay" +#line 2718 "cs-parser.jay" { lbag.AppendToMember (current_container, GetLocation (yyVals[0+yyTop])); } @@ -2407,7 +2407,7 @@ case 334: case_334(); break; case 336: -#line 2791 "cs-parser.jay" +#line 2792 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out | ParameterModifierType.Params | ParameterModifierType.DefaultValue; } @@ -2416,7 +2416,7 @@ case 337: case_337(); break; case 338: -#line 2810 "cs-parser.jay" +#line 2811 "cs-parser.jay" { lexer.ConstraintsParsing = false; } @@ -2653,7 +2653,7 @@ case 440: case_440(); break; case 441: -#line 3291 "cs-parser.jay" +#line 3288 "cs-parser.jay" { yyVal = new CompletionMemberAccess ((Expression) yyVals[-2+yyTop], null,GetLocation (yyVals[0+yyTop])); } @@ -2662,7 +2662,7 @@ case 442: case_442(); break; case 443: -#line 3299 "cs-parser.jay" +#line 3296 "cs-parser.jay" { yyVal = new CompletionMemberAccess ((Expression) yyVals[-2+yyTop], null, lexer.Location); } @@ -2680,7 +2680,7 @@ case 447: case_447(); break; case 448: -#line 3329 "cs-parser.jay" +#line 3326 "cs-parser.jay" { yyVal = null; } break; case 450: @@ -2690,11 +2690,11 @@ case 451: case_451(); break; case 452: -#line 3351 "cs-parser.jay" +#line 3348 "cs-parser.jay" { yyVal = null; } break; case 453: -#line 3355 "cs-parser.jay" +#line 3352 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -2715,7 +2715,7 @@ case 458: case_458(); break; case 459: -#line 3394 "cs-parser.jay" +#line 3391 "cs-parser.jay" { yyVal = new CompletionElementInitializer (null, GetLocation (yyVals[0+yyTop])); } @@ -2730,7 +2730,7 @@ case 462: case_462(); break; case 465: -#line 3425 "cs-parser.jay" +#line 3422 "cs-parser.jay" { yyVal = null; } break; case 467: @@ -2749,7 +2749,7 @@ case 471: case_471(); break; case 472: -#line 3479 "cs-parser.jay" +#line 3476 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } @@ -2788,13 +2788,13 @@ case 487: case_487(); break; case 488: -#line 3572 "cs-parser.jay" +#line 3569 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } break; case 490: -#line 3580 "cs-parser.jay" +#line 3577 "cs-parser.jay" { yyVal = new This (GetLocation (yyVals[0+yyTop])); } @@ -2806,13 +2806,13 @@ case 492: case_492(); break; case 493: -#line 3600 "cs-parser.jay" +#line 3597 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PostIncrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop])); } break; case 494: -#line 3607 "cs-parser.jay" +#line 3604 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PostDecrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop])); } @@ -2839,7 +2839,7 @@ case 501: case_501(); break; case 502: -#line 3674 "cs-parser.jay" +#line 3671 "cs-parser.jay" { ++lexer.parsing_type; } @@ -2851,7 +2851,7 @@ case 504: case_504(); break; case 507: -#line 3701 "cs-parser.jay" +#line 3698 "cs-parser.jay" { yyVal = null; } break; case 509: @@ -2882,25 +2882,25 @@ case 520: case_520(); break; case 521: -#line 3779 "cs-parser.jay" +#line 3776 "cs-parser.jay" { yyVal = 2; } break; case 522: -#line 3783 "cs-parser.jay" +#line 3780 "cs-parser.jay" { yyVal = ((int) yyVals[-1+yyTop]) + 1; } break; case 523: -#line 3790 "cs-parser.jay" +#line 3787 "cs-parser.jay" { yyVal = null; } break; case 524: -#line 3794 "cs-parser.jay" +#line 3791 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -2918,7 +2918,7 @@ case 528: case_528(); break; case 529: -#line 3838 "cs-parser.jay" +#line 3835 "cs-parser.jay" { lexer.TypeOfParsing = true; } @@ -2972,7 +2972,7 @@ case 547: case_547(); break; case 548: -#line 3983 "cs-parser.jay" +#line 3978 "cs-parser.jay" { start_anonymous (false, (ParametersCompiled) yyVals[0+yyTop], false, GetLocation (yyVals[-1+yyTop])); } @@ -2981,7 +2981,7 @@ case 549: case_549(); break; case 550: -#line 3996 "cs-parser.jay" +#line 3991 "cs-parser.jay" { start_anonymous (false, (ParametersCompiled) yyVals[0+yyTop], true, GetLocation (yyVals[-2+yyTop])); } @@ -2990,13 +2990,13 @@ case 551: case_551(); break; case 552: -#line 4013 "cs-parser.jay" +#line 4008 "cs-parser.jay" { yyVal = ParametersCompiled.Undefined; } break; case 554: -#line 4021 "cs-parser.jay" +#line 4016 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } @@ -3008,13 +3008,13 @@ case 556: case_556(); break; case 558: -#line 4047 "cs-parser.jay" +#line 4042 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.LogicalNot, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 559: -#line 4051 "cs-parser.jay" +#line 4046 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.OnesComplement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } @@ -3038,37 +3038,37 @@ case 565: case_565(); break; case 567: -#line 4112 "cs-parser.jay" +#line 4107 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.UnaryPlus, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 568: -#line 4116 "cs-parser.jay" +#line 4111 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.UnaryNegation, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 569: -#line 4120 "cs-parser.jay" +#line 4115 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PreIncrement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 570: -#line 4124 "cs-parser.jay" +#line 4119 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PreDecrement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 571: -#line 4128 "cs-parser.jay" +#line 4123 "cs-parser.jay" { yyVal = new Indirection ((Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 572: -#line 4132 "cs-parser.jay" +#line 4127 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.AddressOf, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } @@ -3116,13 +3116,13 @@ case 588: case_588(); break; case 589: -#line 4226 "cs-parser.jay" +#line 4221 "cs-parser.jay" { yyVal = new As ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 590: -#line 4230 "cs-parser.jay" +#line 4225 "cs-parser.jay" { yyVal = new Is ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } @@ -3284,14 +3284,14 @@ case 652: case_652(); break; case 653: -#line 4596 "cs-parser.jay" +#line 4591 "cs-parser.jay" { yyVal = ParametersCompiled.EmptyReadOnlyParameters; } break; case 654: case_654(); break; case 655: -#line 4607 "cs-parser.jay" +#line 4602 "cs-parser.jay" { start_block (Location.Null); } @@ -3324,7 +3324,7 @@ case 666: case_666(); break; case 667: -#line 4674 "cs-parser.jay" +#line 4669 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } @@ -3336,7 +3336,7 @@ case 669: case_669(); break; case 670: -#line 4688 "cs-parser.jay" +#line 4683 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } @@ -3348,7 +3348,7 @@ case 672: case_672(); break; case 678: -#line 4713 "cs-parser.jay" +#line 4708 "cs-parser.jay" { yyVal = new ArglistAccess (GetLocation (yyVals[0+yyTop])); } @@ -3363,13 +3363,13 @@ case 681: case_681(); break; case 683: -#line 4742 "cs-parser.jay" +#line 4737 "cs-parser.jay" { yyVal = new BooleanExpression ((Expression) yyVals[0+yyTop]); } break; case 684: -#line 4754 "cs-parser.jay" +#line 4749 "cs-parser.jay" { } break; @@ -3386,18 +3386,18 @@ case 688: case_688(); break; case 689: -#line 4801 "cs-parser.jay" +#line 4796 "cs-parser.jay" { yyVal = null; } break; case 690: -#line 4803 "cs-parser.jay" +#line 4798 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; StoreModifierLocation (Modifiers.PARTIAL, GetLocation (yyVals[0+yyTop])); } break; case 691: case_691(); break; case 692: -#line 4816 "cs-parser.jay" +#line 4811 "cs-parser.jay" { lexer.parsing_modifiers = false; } @@ -3457,7 +3457,7 @@ case 712: case_712(); break; case 714: -#line 4942 "cs-parser.jay" +#line 4937 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -3487,19 +3487,19 @@ case 722: case_722(); break; case 723: -#line 5035 "cs-parser.jay" +#line 5030 "cs-parser.jay" { yyVal = new SpecialContraintExpr (SpecialConstraint.Class, GetLocation (yyVals[0+yyTop])); } break; case 724: -#line 5039 "cs-parser.jay" +#line 5034 "cs-parser.jay" { yyVal = new SpecialContraintExpr (SpecialConstraint.Struct, GetLocation (yyVals[0+yyTop])); } break; case 725: -#line 5046 "cs-parser.jay" +#line 5041 "cs-parser.jay" { yyVal = Variance.None; } @@ -3517,7 +3517,7 @@ case 729: case_729(); break; case 730: -#line 5091 "cs-parser.jay" +#line 5086 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -3544,13 +3544,13 @@ case 737: case_737(); break; case 742: -#line 5153 "cs-parser.jay" +#line 5148 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 743: -#line 5157 "cs-parser.jay" +#line 5152 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } @@ -3562,13 +3562,13 @@ case 746: case_746(); break; case 749: -#line 5191 "cs-parser.jay" +#line 5186 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 750: -#line 5195 "cs-parser.jay" +#line 5190 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } @@ -3601,13 +3601,13 @@ case 789: case_789(); break; case 790: -#line 5339 "cs-parser.jay" +#line 5334 "cs-parser.jay" { yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 791: -#line 5343 "cs-parser.jay" +#line 5338 "cs-parser.jay" { yyVal = new ComposedCast (new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[-1+yyTop])), (ComposedTypeSpecifier) yyVals[0+yyTop]); } @@ -3619,13 +3619,13 @@ case 794: case_794(); break; case 795: -#line 5364 "cs-parser.jay" +#line 5359 "cs-parser.jay" { yyVal = ComposedTypeSpecifier.CreatePointer (GetLocation (yyVals[0+yyTop])); } break; case 797: -#line 5372 "cs-parser.jay" +#line 5367 "cs-parser.jay" { yyVal = Error_AwaitAsIdentifier (yyVals[0+yyTop]); } @@ -3661,7 +3661,7 @@ case 814: case_814(); break; case 815: -#line 5486 "cs-parser.jay" +#line 5481 "cs-parser.jay" { report.Error (145, lexer.Location, "A const field requires a value to be provided"); } @@ -3682,18 +3682,18 @@ case 825: case_825(); break; case 826: -#line 5536 "cs-parser.jay" +#line 5531 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 827: case_827(); break; case 828: -#line 5546 "cs-parser.jay" +#line 5541 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 829: -#line 5547 "cs-parser.jay" +#line 5542 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 830: @@ -3715,7 +3715,7 @@ case 837: case_837(); break; case 838: -#line 5623 "cs-parser.jay" +#line 5617 "cs-parser.jay" { start_block (GetLocation (yyVals[0+yyTop])); } @@ -3727,13 +3727,13 @@ case 840: case_840(); break; case 841: -#line 5643 "cs-parser.jay" +#line 5637 "cs-parser.jay" { report.Warning (1522, 1, current_block.StartLocation, "Empty switch block"); } break; case 845: -#line 5653 "cs-parser.jay" +#line 5647 "cs-parser.jay" { Error_SyntaxError (yyToken); } @@ -3742,7 +3742,7 @@ case 847: case_847(); break; case 848: -#line 5670 "cs-parser.jay" +#line 5664 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } @@ -3754,7 +3754,7 @@ case 850: case_850(); break; case 851: -#line 5687 "cs-parser.jay" +#line 5681 "cs-parser.jay" { yyVal = new SwitchLabel (null, GetLocation (yyVals[0+yyTop])); } @@ -3778,7 +3778,7 @@ case 861: case_861(); break; case 862: -#line 5748 "cs-parser.jay" +#line 5742 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -3787,7 +3787,7 @@ case 863: case_863(); break; case 864: -#line 5763 "cs-parser.jay" +#line 5757 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -3799,7 +3799,7 @@ case 866: case_866(); break; case 867: -#line 5784 "cs-parser.jay" +#line 5778 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -3814,7 +3814,7 @@ case 870: case_870(); break; case 871: -#line 5818 "cs-parser.jay" +#line 5812 "cs-parser.jay" { yyVal = new EmptyStatement (lexer.Location); } break; case 873: @@ -3824,11 +3824,11 @@ case 874: case_874(); break; case 876: -#line 5842 "cs-parser.jay" +#line 5836 "cs-parser.jay" { yyVal = null; } break; case 878: -#line 5847 "cs-parser.jay" +#line 5841 "cs-parser.jay" { yyVal = new EmptyStatement (lexer.Location); } break; case 882: @@ -3895,7 +3895,7 @@ case 908: case_908(); break; case 911: -#line 6087 "cs-parser.jay" +#line 6082 "cs-parser.jay" { yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false); } @@ -3916,7 +3916,7 @@ case 916: case_916(); break; case 919: -#line 6136 "cs-parser.jay" +#line 6131 "cs-parser.jay" { yyVal = new Catch ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } @@ -3925,7 +3925,7 @@ case 920: case_920(); break; case 921: -#line 6155 "cs-parser.jay" +#line 6150 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } @@ -3937,13 +3937,13 @@ case 923: case_923(); break; case 924: -#line 6196 "cs-parser.jay" +#line 6191 "cs-parser.jay" { yyVal = new Checked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 925: -#line 6203 "cs-parser.jay" +#line 6198 "cs-parser.jay" { yyVal = new Unchecked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } @@ -3952,7 +3952,7 @@ case 926: case_926(); break; case 927: -#line 6213 "cs-parser.jay" +#line 6208 "cs-parser.jay" { yyVal = new Unsafe ((Block) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); } @@ -3991,7 +3991,7 @@ case 939: case_939(); break; case 940: -#line 6318 "cs-parser.jay" +#line 6313 "cs-parser.jay" { Error_MissingInitializer (lexer.Location); } @@ -4024,7 +4024,7 @@ case 949: case_949(); break; case 950: -#line 6423 "cs-parser.jay" +#line 6418 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -4033,7 +4033,7 @@ case 951: case_951(); break; case 952: -#line 6439 "cs-parser.jay" +#line 6434 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -4054,7 +4054,7 @@ case 958: case_958(); break; case 959: -#line 6503 "cs-parser.jay" +#line 6498 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -4072,7 +4072,7 @@ case 963: case_963(); break; case 964: -#line 6542 "cs-parser.jay" +#line 6537 "cs-parser.jay" { yyVal = new object[] { yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]) }; } @@ -4084,7 +4084,7 @@ case 967: case_967(); break; case 973: -#line 6571 "cs-parser.jay" +#line 6566 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -4093,7 +4093,7 @@ case 974: case_974(); break; case 975: -#line 6590 "cs-parser.jay" +#line 6585 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -4147,7 +4147,7 @@ case 994: case_994(); break; case 995: -#line 6791 "cs-parser.jay" +#line 6786 "cs-parser.jay" { yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); } @@ -4159,7 +4159,7 @@ case 997: case_997(); break; case 998: -#line 6808 "cs-parser.jay" +#line 6803 "cs-parser.jay" { yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); } @@ -4183,13 +4183,13 @@ case 1007: case_1007(); break; case 1015: -#line 6930 "cs-parser.jay" +#line 6925 "cs-parser.jay" { module.DocumentationBuilder.ParsedName = (MemberName) yyVals[0+yyTop]; } break; case 1016: -#line 6937 "cs-parser.jay" +#line 6932 "cs-parser.jay" { module.DocumentationBuilder.ParsedParameters = (List)yyVals[0+yyTop]; } @@ -4201,13 +4201,13 @@ case 1018: case_1018(); break; case 1019: -#line 6954 "cs-parser.jay" +#line 6949 "cs-parser.jay" { yyVal = new MemberName ((MemberName) yyVals[-2+yyTop], MemberCache.IndexerNameAlias, Location.Null); } break; case 1020: -#line 6958 "cs-parser.jay" +#line 6953 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } @@ -4225,25 +4225,25 @@ case 1024: case_1024(); break; case 1026: -#line 6994 "cs-parser.jay" +#line 6989 "cs-parser.jay" { yyVal = new MemberName (((MemberName) yyVals[-2+yyTop]), (MemberName) yyVals[0+yyTop]); } break; case 1028: -#line 7002 "cs-parser.jay" +#line 6997 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 1029: -#line 7006 "cs-parser.jay" +#line 7001 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 1030: -#line 7013 "cs-parser.jay" +#line 7008 "cs-parser.jay" { yyVal = new List (0); } @@ -4316,7 +4316,7 @@ void case_8() void case_13() #line 428 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; string s = lt.Value; if (s != "alias") { syntax_error (lt.Location, "`alias' expected"); @@ -4324,7 +4324,7 @@ void case_13() if (lang_version == LanguageVersion.ISO_1) FeatureIsNotAvailable (lt.Location, "external alias"); - lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + lt = (LocatedToken) yyVals[-1+yyTop]; if (lt.Value == QualifiedAliasMember.GlobalAlias) { RootNamespace.Error_GlobalNamespaceRedefined (report, lt.Location); } @@ -4355,7 +4355,7 @@ void case_18() void case_19() #line 476 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; if (lang_version != LanguageVersion.ISO_1 && lt.Value == "global") { report.Warning (440, 2, lt.Location, "An alias named `global' will not be used when resolving `global::'. The global namespace will be used instead"); @@ -4442,28 +4442,27 @@ void case_27() void case_28() #line 565 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; yyVal = new MemberName (lt.Value, lt.Location); } void case_29() #line 570 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; - yyVal = new MemberName ((MemberName) yyVals[-2+yyTop], lt.Value, lt.Location) { - DotLocation = GetLocation (yyVals[-1+yyTop]) - }; + var lt = (LocatedToken) yyVals[0+yyTop]; + yyVal = new MemberName ((MemberName) yyVals[-2+yyTop], lt.Value, lt.Location); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_30() -#line 577 "cs-parser.jay" +#line 576 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new MemberName ("", lexer.Location); } void case_43() -#line 615 "cs-parser.jay" +#line 614 "cs-parser.jay" { if (yyVals[0+yyTop] != null) { TypeContainer ds = (TypeContainer)yyVals[0+yyTop]; @@ -4484,7 +4483,7 @@ void case_43() } void case_45() -#line 637 "cs-parser.jay" +#line 636 "cs-parser.jay" { current_namespace.UnattachedAttributes = (Attributes) yyVals[-1+yyTop]; report.Error (1518, lexer.Location, "Attributes must be attached to class, delegate, enum, interface or struct"); @@ -4492,7 +4491,7 @@ void case_45() } void case_53() -#line 670 "cs-parser.jay" +#line 669 "cs-parser.jay" { var sect = (List) yyVals[0+yyTop]; yyVal = new Attributes (sect); @@ -4505,7 +4504,7 @@ void case_53() } void case_54() -#line 681 "cs-parser.jay" +#line 680 "cs-parser.jay" { Attributes attrs = yyVals[-1+yyTop] as Attributes; var sect = (List) yyVals[0+yyTop]; @@ -4520,7 +4519,7 @@ void case_54() } void case_55() -#line 697 "cs-parser.jay" +#line 696 "cs-parser.jay" { PushLocation (GetLocation (yyVals[0+yyTop])); lexer.parsing_attribute_section = true; @@ -4528,14 +4527,14 @@ void case_55() } void case_56() -#line 703 "cs-parser.jay" +#line 702 "cs-parser.jay" { lexer.parsing_attribute_section = false; yyVal = yyVals[0+yyTop]; } void case_57() -#line 711 "cs-parser.jay" +#line 710 "cs-parser.jay" { current_attr_target = (string) yyVals[-1+yyTop]; if (current_attr_target == "assembly" || current_attr_target == "module") { @@ -4544,7 +4543,7 @@ void case_57() } void case_58() -#line 718 "cs-parser.jay" +#line 717 "cs-parser.jay" { /* when attribute target is invalid*/ if (current_attr_target == string.Empty) @@ -4564,7 +4563,7 @@ void case_58() } void case_59() -#line 736 "cs-parser.jay" +#line 735 "cs-parser.jay" { yyVal = yyVals[-2+yyTop]; @@ -4577,11 +4576,11 @@ void case_59() } void case_60() -#line 747 "cs-parser.jay" +#line 746 "cs-parser.jay" { Error_SyntaxError (yyToken); - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; var tne = new SimpleName (lt.Value, null, lt.Location); yyVal = new List () { @@ -4590,22 +4589,22 @@ void case_60() } void case_61() -#line 758 "cs-parser.jay" +#line 757 "cs-parser.jay" { yyVal = CheckAttributeTarget (GetTokenName (yyToken), GetLocation (yyVals[0+yyTop])); yyVal = null; } void case_62() -#line 766 "cs-parser.jay" +#line 765 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; yyVal = CheckAttributeTarget (lt.Value, lt.Location); savedCloseLocation = GetLocation (yyVals[0+yyTop]); } void case_66() -#line 781 "cs-parser.jay" +#line 780 "cs-parser.jay" { var attrs = (List) yyVals[-2+yyTop]; if (attrs != null) { @@ -4617,7 +4616,7 @@ void case_66() } void case_68() -#line 798 "cs-parser.jay" +#line 797 "cs-parser.jay" { --lexer.parsing_block; @@ -4639,7 +4638,7 @@ void case_68() } void case_71() -#line 826 "cs-parser.jay" +#line 825 "cs-parser.jay" { savedAttrParenOpenLocation = GetLocation (yyVals[-2+yyTop]); savedAttrParenCloseLocation = GetLocation (yyVals[0+yyTop]); @@ -4648,7 +4647,7 @@ void case_71() } void case_73() -#line 838 "cs-parser.jay" +#line 837 "cs-parser.jay" { Arguments a = new Arguments (4); a.Add ((Argument) yyVals[0+yyTop]); @@ -4656,7 +4655,7 @@ void case_73() } void case_74() -#line 844 "cs-parser.jay" +#line 843 "cs-parser.jay" { Arguments a = new Arguments (4); a.Add ((Argument) yyVals[0+yyTop]); @@ -4664,7 +4663,7 @@ void case_74() } void case_75() -#line 850 "cs-parser.jay" +#line 849 "cs-parser.jay" { Arguments[] o = (Arguments[]) yyVals[-2+yyTop]; if (o [1] != null) { @@ -4681,7 +4680,7 @@ void case_75() } void case_76() -#line 865 "cs-parser.jay" +#line 864 "cs-parser.jay" { Arguments[] o = (Arguments[]) yyVals[-2+yyTop]; if (o [1] == null) { @@ -4693,23 +4692,23 @@ void case_76() } void case_79() -#line 883 "cs-parser.jay" +#line 882 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = null; } void case_81() -#line 895 "cs-parser.jay" +#line 894 "cs-parser.jay" { --lexer.parsing_block; - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; yyVal = new NamedArgument (lt.Value, lt.Location, (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation(yyVals[-2+yyTop])); } void case_82() -#line 905 "cs-parser.jay" +#line 904 "cs-parser.jay" { if (lang_version <= LanguageVersion.V_3) FeatureIsNotAvailable (GetLocation (yyVals[-3+yyTop]), "named argument"); @@ -4717,13 +4716,13 @@ void case_82() /* Avoid boxing in common case (no modifier)*/ var arg_mod = yyVals[-1+yyTop] == null ? Argument.AType.None : (Argument.AType) yyVals[-1+yyTop]; - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; yyVal = new NamedArgument (lt.Value, lt.Location, (Expression) yyVals[0+yyTop], arg_mod); lbag.AddLocation (yyVal, GetLocation(yyVals[-2+yyTop])); } void case_102() -#line 960 "cs-parser.jay" +#line 959 "cs-parser.jay" { report.Error (1519, lexer.Location, "Unexpected symbol `{0}' in class, struct, or interface member declaration", GetSymbolName (yyToken)); @@ -4732,7 +4731,7 @@ void case_102() } void case_104() -#line 976 "cs-parser.jay" +#line 975 "cs-parser.jay" { lexer.ConstraintsParsing = true; push_current_container (new Struct (current_container, (MemberName) yyVals[0+yyTop], (Modifiers) yyVals[-4+yyTop], (Attributes) yyVals[-5+yyTop]), yyVals[-3+yyTop]); @@ -4740,7 +4739,7 @@ void case_104() } void case_105() -#line 983 "cs-parser.jay" +#line 982 "cs-parser.jay" { lexer.ConstraintsParsing = false; @@ -4755,14 +4754,14 @@ void case_105() } void case_106() -#line 996 "cs-parser.jay" +#line 995 "cs-parser.jay" { if (doc_support) Lexer.doc_state = XmlCommentState.Allowed; } void case_107() -#line 1001 "cs-parser.jay" +#line 1000 "cs-parser.jay" { --lexer.parsing_declaration; if (doc_support) @@ -4770,7 +4769,7 @@ void case_107() } void case_108() -#line 1007 "cs-parser.jay" +#line 1006 "cs-parser.jay" { if (yyVals[0+yyTop] == null) { lbag.AppendToMember (current_container, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-2+yyTop])); @@ -4781,9 +4780,9 @@ void case_108() } void case_110() -#line 1025 "cs-parser.jay" +#line 1024 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; var mod = (Modifiers) yyVals[-3+yyTop]; current_field = new Const (current_type, (FullNamedExpression) yyVals[-1+yyTop], mod, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-4+yyTop]); current_type.AddMember (current_field); @@ -4796,7 +4795,7 @@ void case_110() } void case_111() -#line 1038 "cs-parser.jay" +#line 1037 "cs-parser.jay" { if (doc_support) { current_field.DocComment = Lexer.consume_doc_comment (); @@ -4809,7 +4808,7 @@ void case_111() } void case_112() -#line 1051 "cs-parser.jay" +#line 1050 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -4817,15 +4816,15 @@ void case_112() } void case_117() -#line 1076 "cs-parser.jay" +#line 1075 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (ConstInitializer) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } void case_119() -#line 1089 "cs-parser.jay" +#line 1088 "cs-parser.jay" { --lexer.parsing_block; yyVal = new ConstInitializer (current_field, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); @@ -4833,14 +4832,14 @@ void case_119() } void case_120() -#line 1095 "cs-parser.jay" +#line 1094 "cs-parser.jay" { report.Error (145, lexer.Location, "A const field requires a value to be provided"); yyVal = null; } void case_123() -#line 1110 "cs-parser.jay" +#line 1109 "cs-parser.jay" { lexer.parsing_generic_declaration = false; @@ -4848,14 +4847,14 @@ void case_123() if (type.Type != null && type.Type.Kind == MemberKind.Void) report.Error (670, GetLocation (yyVals[-1+yyTop]), "Fields cannot have void type"); - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; current_field = new Field (current_type, type, (Modifiers) yyVals[-2+yyTop], new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-3+yyTop]); current_type.AddField (current_field); yyVal = current_field; } void case_124() -#line 1125 "cs-parser.jay" +#line 1124 "cs-parser.jay" { if (doc_support) { current_field.DocComment = Lexer.consume_doc_comment (); @@ -4868,12 +4867,12 @@ void case_124() } void case_125() -#line 1138 "cs-parser.jay" +#line 1137 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-2+yyTop]), "fixed size buffers"); - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; current_field = new FixedField (current_type, (FullNamedExpression) yyVals[-1+yyTop], (Modifiers) yyVals[-3+yyTop], new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-4+yyTop]); @@ -4881,7 +4880,7 @@ void case_125() } void case_126() -#line 1149 "cs-parser.jay" +#line 1148 "cs-parser.jay" { if (doc_support) { current_field.DocComment = Lexer.consume_doc_comment (); @@ -4895,7 +4894,7 @@ void case_126() } void case_129() -#line 1172 "cs-parser.jay" +#line 1171 "cs-parser.jay" { ++lexer.parsing_block; current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters; @@ -4903,7 +4902,7 @@ void case_129() } void case_130() -#line 1178 "cs-parser.jay" +#line 1177 "cs-parser.jay" { --lexer.parsing_block; current_field.Initializer = (Expression) yyVals[0+yyTop]; @@ -4913,32 +4912,32 @@ void case_130() } void case_135() -#line 1205 "cs-parser.jay" +#line 1204 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; yyVal = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_137() -#line 1215 "cs-parser.jay" +#line 1214 "cs-parser.jay" { --lexer.parsing_block; - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; yyVal = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop])); } void case_142() -#line 1241 "cs-parser.jay" +#line 1240 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (ConstInitializer) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } void case_144() -#line 1254 "cs-parser.jay" +#line 1253 "cs-parser.jay" { --lexer.parsing_block; yyVal = new ConstInitializer (current_field, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); @@ -4946,14 +4945,14 @@ void case_144() } void case_145() -#line 1260 "cs-parser.jay" +#line 1259 "cs-parser.jay" { report.Error (443, lexer.Location, "Value or constant expected"); yyVal = null; } void case_148() -#line 1270 "cs-parser.jay" +#line 1269 "cs-parser.jay" { /* It has to be here for the parent to safely restore artificial block*/ Error_SyntaxError (yyToken); @@ -4961,7 +4960,7 @@ void case_148() } void case_149() -#line 1279 "cs-parser.jay" +#line 1278 "cs-parser.jay" { if (doc_support) Lexer.doc_state = XmlCommentState.NotAllowed; @@ -4970,7 +4969,7 @@ void case_149() } void case_150() -#line 1286 "cs-parser.jay" +#line 1285 "cs-parser.jay" { Method method = (Method) yyVals[-2+yyTop]; method.Block = (ToplevelBlock) yyVals[0+yyTop]; @@ -4998,7 +4997,7 @@ void case_150() } void case_152() -#line 1322 "cs-parser.jay" +#line 1321 "cs-parser.jay" { valid_param_mod = 0; MemberName name = (MemberName) yyVals[-4+yyTop]; @@ -5021,7 +5020,7 @@ void case_152() } void case_153() -#line 1343 "cs-parser.jay" +#line 1342 "cs-parser.jay" { lexer.ConstraintsParsing = false; @@ -5034,14 +5033,14 @@ void case_153() } void case_155() -#line 1362 "cs-parser.jay" +#line 1361 "cs-parser.jay" { lexer.parsing_generic_declaration = false; valid_param_mod = ParameterModifierType.All; } void case_157() -#line 1371 "cs-parser.jay" +#line 1370 "cs-parser.jay" { lexer.ConstraintsParsing = false; valid_param_mod = 0; @@ -5057,8 +5056,10 @@ void case_157() current_type.AddMember (method); - if (yyVals[-1+yyTop] != null) - method.SetConstraints ((List) yyVals[-1+yyTop]); + async_block = (method.ModFlags & Modifiers.ASYNC) != 0; + + if (yyVals[0+yyTop] != null) + method.SetConstraints ((List) yyVals[0+yyTop]); if (doc_support) method.DocComment = Lexer.consume_doc_comment (); @@ -5069,7 +5070,7 @@ void case_157() } void case_158() -#line 1400 "cs-parser.jay" +#line 1401 "cs-parser.jay" { MemberName name = (MemberName) yyVals[-3+yyTop]; report.Error (1585, name.Location, @@ -5089,7 +5090,7 @@ void case_158() } void case_159() -#line 1421 "cs-parser.jay" +#line 1422 "cs-parser.jay" { Error_SyntaxError (yyToken); current_local_parameters = ParametersCompiled.Undefined; @@ -5107,7 +5108,7 @@ void case_159() } void case_164() -#line 1450 "cs-parser.jay" +#line 1451 "cs-parser.jay" { var pars_list = (List) yyVals[0+yyTop]; yyVal = new ParametersCompiled (pars_list.ToArray ()); @@ -5115,7 +5116,7 @@ void case_164() } void case_165() -#line 1456 "cs-parser.jay" +#line 1457 "cs-parser.jay" { var pars_list = (List) yyVals[-2+yyTop]; pars_list.Add ((Parameter) yyVals[0+yyTop]); @@ -5126,7 +5127,7 @@ void case_165() } void case_166() -#line 1465 "cs-parser.jay" +#line 1466 "cs-parser.jay" { var pars_list = (List) yyVals[-2+yyTop]; pars_list.Add (new ArglistParameter (GetLocation (yyVals[0+yyTop]))); @@ -5137,7 +5138,7 @@ void case_166() } void case_167() -#line 1474 "cs-parser.jay" +#line 1475 "cs-parser.jay" { if (yyVals[-2+yyTop] != null) report.Error (231, ((Parameter) yyVals[-2+yyTop]).Location, "A params parameter must be the last parameter in a formal parameter list"); @@ -5147,7 +5148,7 @@ void case_167() } void case_168() -#line 1482 "cs-parser.jay" +#line 1483 "cs-parser.jay" { if (yyVals[-2+yyTop] != null) report.Error (231, ((Parameter) yyVals[-2+yyTop]).Location, "A params parameter must be the last parameter in a formal parameter list"); @@ -5162,7 +5163,7 @@ void case_168() } void case_169() -#line 1495 "cs-parser.jay" +#line 1496 "cs-parser.jay" { report.Error (257, GetLocation (yyVals[-2+yyTop]), "An __arglist parameter must be the last parameter in a formal parameter list"); @@ -5171,7 +5172,7 @@ void case_169() } void case_170() -#line 1502 "cs-parser.jay" +#line 1503 "cs-parser.jay" { report.Error (257, GetLocation (yyVals[-2+yyTop]), "An __arglist parameter must be the last parameter in a formal parameter list"); @@ -5185,14 +5186,14 @@ void case_170() } void case_173() -#line 1522 "cs-parser.jay" +#line 1523 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = ParametersCompiled.EmptyReadOnlyParameters; } void case_174() -#line 1530 "cs-parser.jay" +#line 1531 "cs-parser.jay" { parameters_bucket.Clear (); Parameter p = (Parameter) yyVals[0+yyTop]; @@ -5203,7 +5204,7 @@ void case_174() } void case_175() -#line 1539 "cs-parser.jay" +#line 1540 "cs-parser.jay" { var pars = (List) yyVals[-2+yyTop]; Parameter p = (Parameter) yyVals[0+yyTop]; @@ -5223,24 +5224,24 @@ void case_175() } void case_176() -#line 1563 "cs-parser.jay" +#line 1564 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; yyVal = new Parameter ((FullNamedExpression) yyVals[-1+yyTop], lt.Value, (Parameter.Modifier) yyVals[-2+yyTop], (Attributes) yyVals[-3+yyTop], lt.Location); lbag.AddLocation (yyVal, parameterModifierLocation); } void case_177() -#line 1572 "cs-parser.jay" +#line 1573 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; report.Error (1552, lt.Location, "Array type specifier, [], must appear before parameter name"); yyVal = new Parameter ((FullNamedExpression) yyVals[-3+yyTop], lt.Value, (Parameter.Modifier) yyVals[-4+yyTop], (Attributes) yyVals[-5+yyTop], lt.Location); lbag.AddLocation (yyVal, parameterModifierLocation); } void case_178() -#line 1579 "cs-parser.jay" +#line 1580 "cs-parser.jay" { Error_SyntaxError (yyToken); Location l = GetLocation (yyVals[0+yyTop]); @@ -5248,7 +5249,7 @@ void case_178() } void case_179() -#line 1588 "cs-parser.jay" +#line 1589 "cs-parser.jay" { Error_SyntaxError (yyToken); Location l = GetLocation (yyVals[0+yyTop]); @@ -5257,7 +5258,7 @@ void case_179() } void case_181() -#line 1603 "cs-parser.jay" +#line 1604 "cs-parser.jay" { --lexer.parsing_block; if (lang_version <= LanguageVersion.V_3) { @@ -5287,7 +5288,7 @@ void case_181() if ((valid_param_mod & ParameterModifierType.DefaultValue) == 0) report.Error (1065, GetLocation (yyVals[-2+yyTop]), "Optional parameter is not valid in this context"); - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; yyVal = new Parameter ((FullNamedExpression) yyVals[-4+yyTop], lt.Value, mod, (Attributes) yyVals[-6+yyTop], lt.Location); lbag.AddLocation (yyVal, parameterModifierLocation, GetLocation (yyVals[-2+yyTop])); /* parameterModifierLocation should be ignored when mod == NONE*/ @@ -5296,7 +5297,7 @@ void case_181() } void case_185() -#line 1652 "cs-parser.jay" +#line 1653 "cs-parser.jay" { Parameter.Modifier p2 = (Parameter.Modifier)yyVals[0+yyTop]; Parameter.Modifier mod = (Parameter.Modifier)yyVals[-1+yyTop] | p2; @@ -5319,7 +5320,7 @@ void case_185() } void case_186() -#line 1676 "cs-parser.jay" +#line 1677 "cs-parser.jay" { if ((valid_param_mod & ParameterModifierType.Ref) == 0) Error_ParameterModifierNotValid ("ref", GetLocation (yyVals[0+yyTop])); @@ -5328,7 +5329,7 @@ void case_186() } void case_187() -#line 1683 "cs-parser.jay" +#line 1684 "cs-parser.jay" { if ((valid_param_mod & ParameterModifierType.Out) == 0) Error_ParameterModifierNotValid ("out", GetLocation (yyVals[0+yyTop])); @@ -5337,7 +5338,7 @@ void case_187() } void case_188() -#line 1690 "cs-parser.jay" +#line 1691 "cs-parser.jay" { if ((valid_param_mod & ParameterModifierType.This) == 0) Error_ParameterModifierNotValid ("this", GetLocation (yyVals[0+yyTop])); @@ -5349,25 +5350,25 @@ void case_188() } void case_189() -#line 1703 "cs-parser.jay" +#line 1704 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; yyVal = new ParamsParameter ((FullNamedExpression) yyVals[-1+yyTop], lt.Value, (Attributes) yyVals[-3+yyTop], lt.Location); lbag.AddLocation (yyVal, savedLocation); } void case_190() -#line 1709 "cs-parser.jay" +#line 1710 "cs-parser.jay" { report.Error (1751, GetLocation (yyVals[-4+yyTop]), "Cannot specify a default value for a parameter array"); - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; yyVal = new ParamsParameter ((FullNamedExpression) yyVals[-3+yyTop], lt.Value, (Attributes) yyVals[-5+yyTop], lt.Location); lbag.AddLocation (yyVal, savedLocation); } void case_191() -#line 1717 "cs-parser.jay" +#line 1718 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -5375,7 +5376,7 @@ void case_191() } void case_192() -#line 1726 "cs-parser.jay" +#line 1727 "cs-parser.jay" { if ((valid_param_mod & ParameterModifierType.Params) == 0) report.Error (1670, (GetLocation (yyVals[0+yyTop])), "The `params' modifier is not allowed in current context"); @@ -5383,7 +5384,7 @@ void case_192() } void case_193() -#line 1732 "cs-parser.jay" +#line 1733 "cs-parser.jay" { Parameter.Modifier mod = (Parameter.Modifier)yyVals[0+yyTop]; if ((mod & Parameter.Modifier.This) != 0) { @@ -5395,21 +5396,21 @@ void case_193() } void case_195() -#line 1749 "cs-parser.jay" +#line 1750 "cs-parser.jay" { if ((valid_param_mod & ParameterModifierType.Arglist) == 0) report.Error (1669, GetLocation (yyVals[0+yyTop]), "__arglist is not valid in this context"); } void case_196() -#line 1760 "cs-parser.jay" +#line 1761 "cs-parser.jay" { if (doc_support) tmpComment = Lexer.consume_doc_comment (); } void case_197() -#line 1765 "cs-parser.jay" +#line 1766 "cs-parser.jay" { var type = (FullNamedExpression) yyVals[-3+yyTop]; current_property = new Property (current_type, type, (Modifiers) yyVals[-4+yyTop], @@ -5425,7 +5426,7 @@ void case_197() } void case_198() -#line 1779 "cs-parser.jay" +#line 1780 "cs-parser.jay" { lexer.PropertyParsing = false; @@ -5434,14 +5435,14 @@ void case_198() } void case_199() -#line 1786 "cs-parser.jay" +#line 1787 "cs-parser.jay" { lbag.AppendToMember (current_property, GetLocation (yyVals[0+yyTop])); current_property = null; } void case_201() -#line 1800 "cs-parser.jay" +#line 1801 "cs-parser.jay" { valid_param_mod = 0; var type = (FullNamedExpression) yyVals[-5+yyTop]; @@ -5468,7 +5469,7 @@ void case_201() } void case_203() -#line 1829 "cs-parser.jay" +#line 1830 "cs-parser.jay" { if (current_property.AccessorFirst != null && current_property.AccessorFirst.Block == null) ((Indexer) current_property).ParameterInfo.CheckParameters (current_property); @@ -5481,7 +5482,7 @@ void case_203() } void case_208() -#line 1848 "cs-parser.jay" +#line 1849 "cs-parser.jay" { if (yyToken == Token.CLOSE_BRACE) { report.Error (548, lexer.Location, "`{0}': property or indexer must have at least one accessor", current_property.GetSignatureForError ()); @@ -5494,7 +5495,7 @@ void case_208() } void case_209() -#line 1862 "cs-parser.jay" +#line 1863 "cs-parser.jay" { if (yyVals[-1+yyTop] != ModifierNone && lang_version == LanguageVersion.ISO_1) { FeatureIsNotAvailable (GetLocation (yyVals[-1+yyTop]), "access modifiers on properties"); @@ -5517,7 +5518,7 @@ void case_209() } void case_210() -#line 1883 "cs-parser.jay" +#line 1884 "cs-parser.jay" { if (yyVals[0+yyTop] != null) { current_property.Get.Block = (ToplevelBlock) yyVals[0+yyTop]; @@ -5540,7 +5541,7 @@ void case_210() } void case_211() -#line 1907 "cs-parser.jay" +#line 1908 "cs-parser.jay" { if (yyVals[-1+yyTop] != ModifierNone && lang_version == LanguageVersion.ISO_1) { FeatureIsNotAvailable (GetLocation (yyVals[-1+yyTop]), "access modifiers on properties"); @@ -5568,7 +5569,7 @@ void case_211() } void case_212() -#line 1933 "cs-parser.jay" +#line 1934 "cs-parser.jay" { if (yyVals[0+yyTop] != null) { current_property.Set.Block = (ToplevelBlock) yyVals[0+yyTop]; @@ -5591,21 +5592,21 @@ void case_212() } void case_214() -#line 1958 "cs-parser.jay" +#line 1959 "cs-parser.jay" { savedLocation = GetLocation (yyVals[0+yyTop]); yyVal = null; } void case_215() -#line 1963 "cs-parser.jay" +#line 1964 "cs-parser.jay" { Error_SyntaxError (1043, yyToken, "Invalid accessor body"); yyVal = null; } void case_217() -#line 1977 "cs-parser.jay" +#line 1978 "cs-parser.jay" { lexer.ConstraintsParsing = true; push_current_container (new Interface (current_container, (MemberName) yyVals[0+yyTop], (Modifiers) yyVals[-4+yyTop], (Attributes) yyVals[-5+yyTop]), yyVals[-3+yyTop]); @@ -5613,7 +5614,7 @@ void case_217() } void case_218() -#line 1984 "cs-parser.jay" +#line 1985 "cs-parser.jay" { lexer.ConstraintsParsing = false; @@ -5629,7 +5630,7 @@ void case_218() } void case_219() -#line 1998 "cs-parser.jay" +#line 1999 "cs-parser.jay" { --lexer.parsing_declaration; if (doc_support) @@ -5637,7 +5638,7 @@ void case_219() } void case_220() -#line 2004 "cs-parser.jay" +#line 2005 "cs-parser.jay" { if (yyVals[0+yyTop] == null) { lbag.AppendToMember (current_container, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop])); @@ -5648,7 +5649,7 @@ void case_220() } void case_236() -#line 2066 "cs-parser.jay" +#line 2067 "cs-parser.jay" { OperatorDeclaration decl = (OperatorDeclaration) yyVals[-2+yyTop]; if (decl != null) { @@ -5678,14 +5679,14 @@ void case_236() } void case_240() -#line 2103 "cs-parser.jay" +#line 2104 "cs-parser.jay" { report.Error (590, GetLocation (yyVals[0+yyTop]), "User-defined operators cannot return void"); yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); } void case_242() -#line 2115 "cs-parser.jay" +#line 2116 "cs-parser.jay" { valid_param_mod = 0; @@ -5709,11 +5710,11 @@ void case_242() Operator.GetName (op)); } } else { - if (p_count > 2) { + if (p_count == 1) { + report.Error (1019, loc, "Overloadable unary operator expected"); + } else if (p_count != 2) { report.Error (1534, loc, "Overloaded binary operator `{0}' takes two parameters", Operator.GetName (op)); - } else if (p_count != 2) { - report.Error (1019, loc, "Overloadable unary operator expected"); } } @@ -5727,7 +5728,7 @@ void case_242() } void case_267() -#line 2191 "cs-parser.jay" +#line 2192 "cs-parser.jay" { valid_param_mod = 0; @@ -5748,7 +5749,7 @@ void case_267() } void case_269() -#line 2214 "cs-parser.jay" +#line 2215 "cs-parser.jay" { valid_param_mod = 0; @@ -5769,7 +5770,7 @@ void case_269() } void case_270() -#line 2233 "cs-parser.jay" +#line 2234 "cs-parser.jay" { Error_SyntaxError (yyToken); current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters; @@ -5777,7 +5778,7 @@ void case_270() } void case_271() -#line 2239 "cs-parser.jay" +#line 2240 "cs-parser.jay" { Error_SyntaxError (yyToken); current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters; @@ -5785,7 +5786,7 @@ void case_271() } void case_272() -#line 2249 "cs-parser.jay" +#line 2250 "cs-parser.jay" { Constructor c = (Constructor) yyVals[-1+yyTop]; c.Block = (ToplevelBlock) yyVals[0+yyTop]; @@ -5799,7 +5800,7 @@ void case_272() } void case_273() -#line 2266 "cs-parser.jay" +#line 2267 "cs-parser.jay" { if (doc_support) { tmpComment = Lexer.consume_doc_comment (); @@ -5810,12 +5811,12 @@ void case_273() } void case_274() -#line 2275 "cs-parser.jay" +#line 2276 "cs-parser.jay" { valid_param_mod = 0; current_local_parameters = (ParametersCompiled) yyVals[-1+yyTop]; - var lt = (Tokenizer.LocatedToken) yyVals[-4+yyTop]; + var lt = (LocatedToken) yyVals[-4+yyTop]; var mods = (Modifiers) yyVals[-5+yyTop]; var c = new Constructor (current_type, lt.Value, mods, (Attributes) yyVals[-6+yyTop], current_local_parameters, lt.Location); @@ -5841,7 +5842,7 @@ void case_274() } void case_275() -#line 2304 "cs-parser.jay" +#line 2305 "cs-parser.jay" { if (yyVals[0+yyTop] != null) { var c = (Constructor) yyVals[-1+yyTop]; @@ -5858,7 +5859,7 @@ void case_275() } void case_281() -#line 2336 "cs-parser.jay" +#line 2337 "cs-parser.jay" { --lexer.parsing_block; yyVal = new ConstructorBaseInitializer ((Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop])); @@ -5866,7 +5867,7 @@ void case_281() } void case_283() -#line 2346 "cs-parser.jay" +#line 2347 "cs-parser.jay" { --lexer.parsing_block; yyVal = new ConstructorThisInitializer ((Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop])); @@ -5874,7 +5875,7 @@ void case_283() } void case_284() -#line 2352 "cs-parser.jay" +#line 2353 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new ConstructorThisInitializer (null, GetLocation (yyVals[0+yyTop])); @@ -5882,14 +5883,14 @@ void case_284() } void case_285() -#line 2358 "cs-parser.jay" +#line 2359 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = null; } void case_286() -#line 2366 "cs-parser.jay" +#line 2367 "cs-parser.jay" { if (doc_support) { tmpComment = Lexer.consume_doc_comment (); @@ -5900,9 +5901,9 @@ void case_286() } void case_287() -#line 2375 "cs-parser.jay" +#line 2376 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; if (lt.Value != current_container.MemberName.Name){ report.Error (574, lt.Location, "Name of destructor must match name of class"); } else if (current_container.Kind != MemberKind.Class){ @@ -5923,7 +5924,7 @@ void case_287() } void case_288() -#line 2401 "cs-parser.jay" +#line 2402 "cs-parser.jay" { current_event_field = new EventField (current_type, (FullNamedExpression) yyVals[-1+yyTop], (Modifiers) yyVals[-3+yyTop], (MemberName) yyVals[0+yyTop], (Attributes) yyVals[-4+yyTop]); current_type.AddMember (current_event_field); @@ -5937,7 +5938,7 @@ void case_288() } void case_289() -#line 2415 "cs-parser.jay" +#line 2416 "cs-parser.jay" { if (doc_support) { current_event_field.DocComment = Lexer.consume_doc_comment (); @@ -5952,7 +5953,7 @@ void case_289() } void case_290() -#line 2431 "cs-parser.jay" +#line 2432 "cs-parser.jay" { current_event = new EventProperty (current_type, (FullNamedExpression) yyVals[-2+yyTop], (Modifiers) yyVals[-4+yyTop], (MemberName) yyVals[-1+yyTop], (Attributes) yyVals[-5+yyTop]); current_type.AddMember (current_event); @@ -5962,7 +5963,7 @@ void case_290() } void case_291() -#line 2439 "cs-parser.jay" +#line 2440 "cs-parser.jay" { if (current_container.Kind == MemberKind.Interface) report.Error (69, GetLocation (yyVals[-2+yyTop]), "Event in interface cannot have add or remove accessors"); @@ -5971,7 +5972,7 @@ void case_291() } void case_292() -#line 2446 "cs-parser.jay" +#line 2447 "cs-parser.jay" { if (doc_support) { current_event.DocComment = Lexer.consume_doc_comment (); @@ -5984,7 +5985,7 @@ void case_292() } void case_293() -#line 2459 "cs-parser.jay" +#line 2460 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -5992,7 +5993,7 @@ void case_293() } void case_296() -#line 2473 "cs-parser.jay" +#line 2474 "cs-parser.jay" { --lexer.parsing_block; savedEventAssignLocation = GetLocation (yyVals[-2+yyTop]); @@ -6000,24 +6001,24 @@ void case_296() } void case_301() -#line 2498 "cs-parser.jay" +#line 2499 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; yyVal = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_303() -#line 2508 "cs-parser.jay" +#line 2509 "cs-parser.jay" { --lexer.parsing_block; - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; yyVal = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop])); } void case_304() -#line 2517 "cs-parser.jay" +#line 2518 "cs-parser.jay" { if (current_container.Kind == MemberKind.Interface) { report.Error (68, lexer.Location, "`{0}': event in interface cannot have an initializer", @@ -6031,28 +6032,28 @@ void case_304() } void case_308() -#line 2538 "cs-parser.jay" +#line 2539 "cs-parser.jay" { report.Error (65, lexer.Location, "`{0}': event property must have both add and remove accessors", current_event.GetSignatureForError ()); } void case_309() -#line 2543 "cs-parser.jay" +#line 2544 "cs-parser.jay" { report.Error (65, lexer.Location, "`{0}': event property must have both add and remove accessors", current_event.GetSignatureForError ()); } void case_310() -#line 2548 "cs-parser.jay" +#line 2549 "cs-parser.jay" { report.Error (1055, GetLocation (yyVals[0+yyTop]), "An add or remove accessor expected"); yyVal = null; } void case_311() -#line 2556 "cs-parser.jay" +#line 2557 "cs-parser.jay" { if (yyVals[-1+yyTop] != ModifierNone) { report.Error (1609, GetLocation (yyVals[-1+yyTop]), "Modifiers cannot be placed on event accessor declarations"); @@ -6066,7 +6067,7 @@ void case_311() } void case_312() -#line 2568 "cs-parser.jay" +#line 2569 "cs-parser.jay" { lexer.EventParsing = true; @@ -6081,7 +6082,7 @@ void case_312() } void case_313() -#line 2584 "cs-parser.jay" +#line 2585 "cs-parser.jay" { if (yyVals[-1+yyTop] != ModifierNone) { report.Error (1609, GetLocation (yyVals[-1+yyTop]), "Modifiers cannot be placed on event accessor declarations"); @@ -6095,7 +6096,7 @@ void case_313() } void case_314() -#line 2596 "cs-parser.jay" +#line 2597 "cs-parser.jay" { lexer.EventParsing = true; @@ -6110,14 +6111,14 @@ void case_314() } void case_315() -#line 2612 "cs-parser.jay" +#line 2613 "cs-parser.jay" { report.Error (73, lexer.Location, "An add or remove accessor must have a body"); yyVal = null; } void case_317() -#line 2621 "cs-parser.jay" +#line 2622 "cs-parser.jay" { current_type.UnattachedAttributes = (Attributes) yyVals[-1+yyTop]; report.Error (1519, GetLocation (yyVals[-1+yyTop]), "An attribute is missing member declaration"); @@ -6125,7 +6126,7 @@ void case_317() } void case_318() -#line 2632 "cs-parser.jay" +#line 2633 "cs-parser.jay" { report.Error (1519, lexer.Location, "Unexpected symbol `}' in class, struct, or interface member declaration"); @@ -6140,14 +6141,14 @@ void case_318() } void case_319() -#line 2652 "cs-parser.jay" +#line 2653 "cs-parser.jay" { if (doc_support) enumTypeComment = Lexer.consume_doc_comment (); } void case_320() -#line 2657 "cs-parser.jay" +#line 2658 "cs-parser.jay" { if (doc_support) Lexer.doc_state = XmlCommentState.Allowed; @@ -6166,7 +6167,7 @@ void case_320() } void case_321() -#line 2674 "cs-parser.jay" +#line 2675 "cs-parser.jay" { /* here will be evaluated after CLOSE_BLACE is consumed.*/ if (doc_support) @@ -6174,7 +6175,7 @@ void case_321() } void case_322() -#line 2680 "cs-parser.jay" +#line 2681 "cs-parser.jay" { lbag.AppendToMember (current_container, GetLocation (yyVals[-1+yyTop])); if (yyVals[0+yyTop] != null) { @@ -6192,30 +6193,30 @@ void case_322() } void case_324() -#line 2700 "cs-parser.jay" +#line 2701 "cs-parser.jay" { savedLocation = GetLocation (yyVals[-1+yyTop]); yyVal = yyVals[0+yyTop]; } void case_325() -#line 2705 "cs-parser.jay" +#line 2706 "cs-parser.jay" { Error_TypeExpected (GetLocation (yyVals[-1+yyTop])); yyVal = null; } void case_330() -#line 2723 "cs-parser.jay" +#line 2724 "cs-parser.jay" { lbag.AppendToMember (current_container, GetLocation (yyVals[-1+yyTop])); yyVal = yyVals[0+yyTop]; } void case_331() -#line 2731 "cs-parser.jay" +#line 2732 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-1+yyTop]); ((Enum) current_type).AddEnumMember (em); @@ -6228,7 +6229,7 @@ void case_331() } void case_332() -#line 2744 "cs-parser.jay" +#line 2745 "cs-parser.jay" { ++lexer.parsing_block; if (doc_support) { @@ -6238,11 +6239,11 @@ void case_332() } void case_333() -#line 2752 "cs-parser.jay" +#line 2753 "cs-parser.jay" { --lexer.parsing_block; - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-4+yyTop]); em.Initializer = new ConstInitializer (em, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); ((Enum) current_type).AddEnumMember (em); @@ -6254,11 +6255,11 @@ void case_333() } void case_334() -#line 2766 "cs-parser.jay" +#line 2767 "cs-parser.jay" { Error_SyntaxError (yyToken); - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-2+yyTop]); ((Enum) current_type).AddEnumMember (em); @@ -6271,7 +6272,7 @@ void case_334() } void case_337() -#line 2793 "cs-parser.jay" +#line 2794 "cs-parser.jay" { valid_param_mod = 0; @@ -6288,7 +6289,7 @@ void case_337() } void case_339() -#line 2812 "cs-parser.jay" +#line 2813 "cs-parser.jay" { if (doc_support) { current_delegate.DocComment = Lexer.consume_doc_comment (); @@ -6305,7 +6306,7 @@ void case_339() } void case_341() -#line 2831 "cs-parser.jay" +#line 2832 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[0+yyTop]), "nullable types"); @@ -6314,28 +6315,27 @@ void case_341() } void case_343() -#line 2842 "cs-parser.jay" +#line 2843 "cs-parser.jay" { - var lt1 = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; - var lt2 = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt1 = (LocatedToken) yyVals[-2+yyTop]; + var lt2 = (LocatedToken) yyVals[-1+yyTop]; yyVal = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) yyVals[0+yyTop], lt1.Location); lbag.AddLocation (yyVal, savedLocation, GetLocation (yyVals[-1+yyTop])); } void case_345() -#line 2854 "cs-parser.jay" +#line 2855 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; - yyVal = new MemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location) { - DotLocation = GetLocation (yyVals[-2+yyTop]) - }; + var lt = (LocatedToken) yyVals[-1+yyTop]; + yyVal = new MemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location); + lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } void case_346() #line 2864 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new SimpleName (lt.Value, (TypeArguments)yyVals[0+yyTop], lt.Location); } @@ -6381,7 +6381,7 @@ void case_353() #line 2919 "cs-parser.jay" { lexer.parsing_generic_declaration = false; - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; yyVal = new MemberName (lt.Value, (TypeParameters)yyVals[0+yyTop], lt.Location); } @@ -6398,7 +6398,7 @@ void case_356() #line 2939 "cs-parser.jay" { lexer.parsing_generic_declaration = false; - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new MemberName (lt.Value, (TypeParameters) yyVals[0+yyTop], (ATypeNameExpression) yyVals[-2+yyTop], lt.Location); } @@ -6419,7 +6419,7 @@ void case_358() void case_359() #line 2961 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; yyVal = new SimpleName (lt.Value, (TypeArguments) yyVals[-1+yyTop], lt.Location); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } @@ -6427,8 +6427,8 @@ void case_359() void case_360() #line 2967 "cs-parser.jay" { - var lt1 = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; - var lt2 = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt1 = (LocatedToken) yyVals[-3+yyTop]; + var lt2 = (LocatedToken) yyVals[-2+yyTop]; yyVal = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) yyVals[-1+yyTop], lt1.Location); lbag.AddLocation (yyVal, savedLocation, GetLocation (yyVals[0+yyTop])); @@ -6437,7 +6437,7 @@ void case_360() void case_361() #line 2975 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; yyVal = new MemberAccess ((ATypeNameExpression) yyVals[-3+yyTop], lt.Value, (TypeArguments) yyVals[-1+yyTop], lt.Location); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } @@ -6476,7 +6476,7 @@ void case_365() void case_366() #line 3016 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken)yyVals[0+yyTop]; + var lt = (LocatedToken)yyVals[0+yyTop]; var variance = (Variance) yyVals[-1+yyTop]; yyVal = new TypeParameter (new MemberName (lt.Value, lt.Location), (Attributes)yyVals[-2+yyTop], variance); if (variance != Variance.None) @@ -6565,14 +6565,14 @@ void case_386() void case_423() #line 3204 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new SimpleName (lt.Value, (TypeArguments)yyVals[0+yyTop], lt.Location); } void case_424() #line 3208 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new CompletionSimpleName (MemberName.MakeName (lt.Value, null), lt.Location); } @@ -6586,63 +6586,60 @@ void case_435() void case_437() #line 3261 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; - yyVal = new MemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location) { - DotLocation = GetLocation (yyVals[-2+yyTop]) - }; + var lt = (LocatedToken) yyVals[-1+yyTop]; + yyVal = new MemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location); + lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } void case_438() -#line 3268 "cs-parser.jay" +#line 3267 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; - yyVal = new MemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location) { - DotLocation = GetLocation (yyVals[-2+yyTop]) - }; + var lt = (LocatedToken) yyVals[-1+yyTop]; + yyVal = new MemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location); + lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } void case_439() -#line 3275 "cs-parser.jay" +#line 3273 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; - yyVal = new MemberAccess (new BaseThis (GetLocation (yyVals[-3+yyTop])), lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location) { - DotLocation = GetLocation (yyVals[-2+yyTop]) - }; + var lt = (LocatedToken) yyVals[-1+yyTop]; + yyVal = new MemberAccess (new BaseThis (GetLocation (yyVals[-3+yyTop])), lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location); + lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } void case_440() -#line 3282 "cs-parser.jay" +#line 3279 "cs-parser.jay" { - var lt1 = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; - var lt2 = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt1 = (LocatedToken) yyVals[-2+yyTop]; + var lt2 = (LocatedToken) yyVals[-1+yyTop]; yyVal = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) yyVals[0+yyTop], lt1.Location); lbag.AddLocation (yyVal, savedLocation, GetLocation (yyVals[-1+yyTop])); } void case_442() -#line 3292 "cs-parser.jay" +#line 3289 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new CompletionMemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, lt.Location); } void case_444() -#line 3300 "cs-parser.jay" +#line 3297 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new CompletionMemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, lt.Location); } void case_445() -#line 3308 "cs-parser.jay" +#line 3305 "cs-parser.jay" { yyVal = new Invocation ((Expression) yyVals[-3+yyTop], (Arguments) yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_446() -#line 3313 "cs-parser.jay" +#line 3310 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -6651,7 +6648,7 @@ void case_446() } void case_447() -#line 3320 "cs-parser.jay" +#line 3317 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -6660,7 +6657,7 @@ void case_447() } void case_450() -#line 3335 "cs-parser.jay" +#line 3332 "cs-parser.jay" { if (yyVals[-1+yyTop] == null) { yyVal = new CollectionOrObjectInitializers (GetLocation (yyVals[-2+yyTop])); @@ -6671,14 +6668,14 @@ void case_450() } void case_451() -#line 3344 "cs-parser.jay" +#line 3341 "cs-parser.jay" { yyVal = new CollectionOrObjectInitializers ((List) yyVals[-2+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_454() -#line 3360 "cs-parser.jay" +#line 3357 "cs-parser.jay" { var a = new List (); a.Add ((Expression) yyVals[0+yyTop]); @@ -6686,7 +6683,7 @@ void case_454() } void case_455() -#line 3366 "cs-parser.jay" +#line 3363 "cs-parser.jay" { var a = (List)yyVals[-2+yyTop]; a.Add ((Expression) yyVals[0+yyTop]); @@ -6695,30 +6692,30 @@ void case_455() } void case_456() -#line 3372 "cs-parser.jay" +#line 3369 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = yyVals[-1+yyTop]; } void case_457() -#line 3380 "cs-parser.jay" +#line 3377 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; yyVal = new ElementInitializer (lt.Value, (Expression)yyVals[0+yyTop], lt.Location); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_458() -#line 3386 "cs-parser.jay" +#line 3383 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) Error_AwaitAsIdentifier (yyVals[-2+yyTop]); + var lt = (LocatedToken) Error_AwaitAsIdentifier (yyVals[-2+yyTop]); yyVal = new ElementInitializer (lt.Value, (Expression)yyVals[0+yyTop], lt.Location); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_460() -#line 3395 "cs-parser.jay" +#line 3392 "cs-parser.jay" { CompletionSimpleName csn = yyVals[-1+yyTop] as CompletionSimpleName; if (csn == null) @@ -6728,7 +6725,7 @@ void case_460() } void case_461() -#line 3403 "cs-parser.jay" +#line 3400 "cs-parser.jay" { if (yyVals[-1+yyTop] == null) yyVal = null; @@ -6739,7 +6736,7 @@ void case_461() } void case_462() -#line 3412 "cs-parser.jay" +#line 3409 "cs-parser.jay" { report.Error (1920, GetLocation (yyVals[-1+yyTop]), "An element initializer cannot be empty"); yyVal = new CollectionElementInitializer (new List (), GetLocation (yyVals[-1+yyTop])); @@ -6747,7 +6744,7 @@ void case_462() } void case_467() -#line 3431 "cs-parser.jay" +#line 3428 "cs-parser.jay" { Arguments list = new Arguments (4); list.Add ((Argument) yyVals[0+yyTop]); @@ -6755,7 +6752,7 @@ void case_467() } void case_468() -#line 3437 "cs-parser.jay" +#line 3434 "cs-parser.jay" { Arguments list = (Arguments) yyVals[-2+yyTop]; if (list [list.Count - 1] is NamedArgument) @@ -6767,7 +6764,7 @@ void case_468() } void case_469() -#line 3447 "cs-parser.jay" +#line 3444 "cs-parser.jay" { Arguments list = (Arguments) yyVals[-2+yyTop]; NamedArgument a = (NamedArgument) yyVals[0+yyTop]; @@ -6784,7 +6781,7 @@ void case_469() } void case_470() -#line 3462 "cs-parser.jay" +#line 3459 "cs-parser.jay" { if (lexer.putback_char == -1) lexer.putback (')'); /* TODO: Wrong but what can I do*/ @@ -6793,63 +6790,63 @@ void case_470() } void case_471() -#line 3469 "cs-parser.jay" +#line 3466 "cs-parser.jay" { report.Error (839, GetLocation (yyVals[-1+yyTop]), "An argument is missing"); yyVal = null; } void case_476() -#line 3490 "cs-parser.jay" +#line 3487 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop], Argument.AType.Ref); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_477() -#line 3495 "cs-parser.jay" +#line 3492 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop], Argument.AType.Out); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_478() -#line 3500 "cs-parser.jay" +#line 3497 "cs-parser.jay" { yyVal = new Argument (new Arglist ((Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop]))); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_479() -#line 3505 "cs-parser.jay" +#line 3502 "cs-parser.jay" { yyVal = new Argument (new Arglist (GetLocation (yyVals[-2+yyTop]))); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_481() -#line 3517 "cs-parser.jay" +#line 3514 "cs-parser.jay" { yyVal = new ElementAccess ((Expression) yyVals[-3+yyTop], (Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_482() -#line 3522 "cs-parser.jay" +#line 3519 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new ElementAccess ((Expression) yyVals[-3+yyTop], (Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); } void case_483() -#line 3527 "cs-parser.jay" +#line 3524 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new ElementAccess ((Expression) yyVals[-2+yyTop], null, GetLocation (yyVals[-1+yyTop])); } void case_484() -#line 3535 "cs-parser.jay" +#line 3532 "cs-parser.jay" { var list = new List (4); list.Add ((Expression) yyVals[0+yyTop]); @@ -6857,7 +6854,7 @@ void case_484() } void case_485() -#line 3541 "cs-parser.jay" +#line 3538 "cs-parser.jay" { var list = (List) yyVals[-2+yyTop]; list.Add ((Expression) yyVals[0+yyTop]); @@ -6866,7 +6863,7 @@ void case_485() } void case_486() -#line 3551 "cs-parser.jay" +#line 3548 "cs-parser.jay" { Arguments args = new Arguments (4); args.Add ((Argument) yyVals[0+yyTop]); @@ -6874,7 +6871,7 @@ void case_486() } void case_487() -#line 3557 "cs-parser.jay" +#line 3554 "cs-parser.jay" { Arguments args = (Arguments) yyVals[-2+yyTop]; if (args [args.Count - 1] is NamedArgument && !(yyVals[0+yyTop] is NamedArgument)) @@ -6886,21 +6883,21 @@ void case_487() } void case_491() -#line 3585 "cs-parser.jay" +#line 3582 "cs-parser.jay" { yyVal = new ElementAccess (new BaseThis (GetLocation (yyVals[-3+yyTop])), (Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_492() -#line 3590 "cs-parser.jay" +#line 3587 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new ElementAccess (null, null, GetLocation (yyVals[-1+yyTop])); } void case_495() -#line 3612 "cs-parser.jay" +#line 3609 "cs-parser.jay" { if (yyVals[0+yyTop] != null) { if (lang_version <= LanguageVersion.ISO_2) @@ -6915,7 +6912,7 @@ void case_495() } void case_496() -#line 3625 "cs-parser.jay" +#line 3622 "cs-parser.jay" { if (lang_version <= LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-2+yyTop]), "collection initializers"); @@ -6924,7 +6921,7 @@ void case_496() } void case_497() -#line 3637 "cs-parser.jay" +#line 3634 "cs-parser.jay" { yyVal = new ArrayCreation ((FullNamedExpression) yyVals[-5+yyTop], (List) yyVals[-3+yyTop], new ComposedTypeSpecifier (((List) yyVals[-3+yyTop]).Count, GetLocation (yyVals[-4+yyTop])) { @@ -6934,7 +6931,7 @@ void case_497() } void case_498() -#line 3645 "cs-parser.jay" +#line 3642 "cs-parser.jay" { if (yyVals[0+yyTop] == null) report.Error (1586, GetLocation (yyVals[-3+yyTop]), "Array creation must have array size or array initializer"); @@ -6943,7 +6940,7 @@ void case_498() } void case_499() -#line 3652 "cs-parser.jay" +#line 3649 "cs-parser.jay" { if (lang_version <= LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-2+yyTop]), "implicitly typed arrays"); @@ -6952,14 +6949,14 @@ void case_499() } void case_500() -#line 3659 "cs-parser.jay" +#line 3656 "cs-parser.jay" { report.Error (178, GetLocation (yyVals[-1+yyTop]), "Invalid rank specifier, expecting `,' or `]'"); yyVal = new ArrayCreation ((FullNamedExpression) yyVals[-5+yyTop], null, GetLocation (yyVals[-6+yyTop])); } void case_501() -#line 3664 "cs-parser.jay" +#line 3661 "cs-parser.jay" { Error_SyntaxError (yyToken); /* It can be any of new expression, create the most common one*/ @@ -6967,14 +6964,14 @@ void case_501() } void case_503() -#line 3676 "cs-parser.jay" +#line 3673 "cs-parser.jay" { --lexer.parsing_type; yyVal = yyVals[0+yyTop]; } void case_504() -#line 3684 "cs-parser.jay" +#line 3681 "cs-parser.jay" { if (lang_version <= LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-3+yyTop]), "anonymous types"); @@ -6986,7 +6983,7 @@ void case_504() } void case_509() -#line 3707 "cs-parser.jay" +#line 3704 "cs-parser.jay" { var a = new List (4); a.Add ((AnonymousTypeParameter) yyVals[0+yyTop]); @@ -6994,7 +6991,7 @@ void case_509() } void case_510() -#line 3713 "cs-parser.jay" +#line 3710 "cs-parser.jay" { var a = (List) yyVals[-2+yyTop]; a.Add ((AnonymousTypeParameter) yyVals[0+yyTop]); @@ -7004,30 +7001,30 @@ void case_510() } void case_511() -#line 3724 "cs-parser.jay" +#line 3721 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken)yyVals[-2+yyTop]; + var lt = (LocatedToken)yyVals[-2+yyTop]; yyVal = new AnonymousTypeParameter ((Expression)yyVals[0+yyTop], lt.Value, lt.Location); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_512() -#line 3730 "cs-parser.jay" +#line 3727 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken)yyVals[0+yyTop]; + var lt = (LocatedToken)yyVals[0+yyTop]; yyVal = new AnonymousTypeParameter (new SimpleName (lt.Value, lt.Location), lt.Value, lt.Location); } void case_513() -#line 3736 "cs-parser.jay" +#line 3733 "cs-parser.jay" { MemberAccess ma = (MemberAccess) yyVals[0+yyTop]; yyVal = new AnonymousTypeParameter (ma, ma.Name, ma.Location); } void case_514() -#line 3741 "cs-parser.jay" +#line 3738 "cs-parser.jay" { report.Error (746, lexer.Location, "Invalid anonymous type member declarator. Anonymous type members must be a member assignment, simple name or member access expression"); @@ -7035,28 +7032,28 @@ void case_514() } void case_518() -#line 3756 "cs-parser.jay" +#line 3753 "cs-parser.jay" { ((ComposedTypeSpecifier) yyVals[-1+yyTop]).Next = (ComposedTypeSpecifier) yyVals[0+yyTop]; yyVal = yyVals[-1+yyTop]; } void case_519() -#line 3764 "cs-parser.jay" +#line 3761 "cs-parser.jay" { yyVal = ComposedTypeSpecifier.CreateArrayDimension (1, GetLocation (yyVals[-1+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_520() -#line 3769 "cs-parser.jay" +#line 3766 "cs-parser.jay" { yyVal = ComposedTypeSpecifier.CreateArrayDimension ((int)yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_525() -#line 3799 "cs-parser.jay" +#line 3796 "cs-parser.jay" { var ai = new ArrayInitializer (0, GetLocation (yyVals[-1+yyTop])); ai.VariableDeclaration = current_variable; @@ -7065,7 +7062,7 @@ void case_525() } void case_526() -#line 3806 "cs-parser.jay" +#line 3803 "cs-parser.jay" { var ai = new ArrayInitializer ((List) yyVals[-2+yyTop], GetLocation (yyVals[-3+yyTop])); ai.VariableDeclaration = current_variable; @@ -7078,7 +7075,7 @@ void case_526() } void case_527() -#line 3820 "cs-parser.jay" +#line 3817 "cs-parser.jay" { var list = new List (4); list.Add ((Expression) yyVals[0+yyTop]); @@ -7086,7 +7083,7 @@ void case_527() } void case_528() -#line 3826 "cs-parser.jay" +#line 3823 "cs-parser.jay" { var list = (List) yyVals[-2+yyTop]; list.Add ((Expression) yyVals[0+yyTop]); @@ -7095,7 +7092,7 @@ void case_528() } void case_530() -#line 3840 "cs-parser.jay" +#line 3837 "cs-parser.jay" { lexer.TypeOfParsing = false; yyVal = new TypeOf ((FullNamedExpression) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop])); @@ -7103,26 +7100,28 @@ void case_530() } void case_533() -#line 3851 "cs-parser.jay" +#line 3848 "cs-parser.jay" { Error_TypeExpected (lexer.Location); yyVal = null; } void case_534() -#line 3859 "cs-parser.jay" +#line 3856 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; + var sn = new SimpleName (lt.Value, (int) yyVals[0+yyTop], lt.Location); yyVal = sn; lbag.AddLocation (sn.TypeArguments, Lexer.GetGenericDimensionLocations ()); } void case_535() -#line 3866 "cs-parser.jay" +#line 3864 "cs-parser.jay" { - var lt1 = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; - var lt2 = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt1 = (LocatedToken) yyVals[-2+yyTop]; + var lt2 = (LocatedToken) yyVals[-1+yyTop]; + var qam = new QualifiedAliasMember (lt1.Value, lt2.Value, (int) yyVals[0+yyTop], lt1.Location); yyVal = qam; lbag.AddLocation (qam.TypeArguments, Lexer.GetGenericDimensionLocations ()); @@ -7130,44 +7129,40 @@ void case_535() } void case_536() -#line 3875 "cs-parser.jay" +#line 3874 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; - yyVal = new MemberAccess ((Expression) yyVals[-2+yyTop], lt.Value, lt.Location) { - DotLocation = GetLocation (yyVals[-1+yyTop]) - }; + yyVal = new MemberAccess ((Expression) yyVals[-2+yyTop], lt.Value, lt.Location); + lbag.AddLocation (yyVal, savedLocation, GetLocation (yyVals[-1+yyTop])); } void case_537() -#line 3883 "cs-parser.jay" +#line 3881 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; - var ma = new MemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, (int) yyVals[0+yyTop], lt.Location) { - DotLocation = GetLocation (yyVals[-2+yyTop]) - }; + var ma = new MemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, (int) yyVals[0+yyTop], lt.Location); yyVal = ma; + lbag.AddLocation (yyVal, savedLocation, GetLocation (yyVals[-2+yyTop])); lbag.AddLocation (ma.TypeArguments, Lexer.GetGenericDimensionLocations ()); } void case_538() -#line 3893 "cs-parser.jay" +#line 3890 "cs-parser.jay" { var tne = (ATypeNameExpression) yyVals[-3+yyTop]; if (tne.HasTypeArguments) Error_TypeExpected (GetLocation (yyVals[0+yyTop])); - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; - var ma = new MemberAccess (tne, lt.Value, (int) yyVals[0+yyTop], lt.Location) { - DotLocation = GetLocation (yyVals[-2+yyTop]) - }; + var lt = (LocatedToken) yyVals[-1+yyTop]; + var ma = new MemberAccess (tne, lt.Value, (int) yyVals[0+yyTop], lt.Location); yyVal = ma; lbag.AddLocation (ma.TypeArguments, Lexer.GetGenericDimensionLocations ()); } void case_539() -#line 3909 "cs-parser.jay" +#line 3904 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[0+yyTop]), "generics"); @@ -7176,9 +7171,9 @@ void case_539() } void case_540() -#line 3919 "cs-parser.jay" +#line 3914 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; if (lang_version == LanguageVersion.ISO_1) FeatureIsNotAvailable (lt.Location, "namespace alias qualifier"); savedLocation = GetLocation (yyVals[0+yyTop]); @@ -7186,14 +7181,14 @@ void case_540() } void case_541() -#line 3930 "cs-parser.jay" +#line 3925 "cs-parser.jay" { yyVal = new SizeOf ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_542() -#line 3935 "cs-parser.jay" +#line 3930 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7202,14 +7197,14 @@ void case_542() } void case_543() -#line 3945 "cs-parser.jay" +#line 3940 "cs-parser.jay" { yyVal = new CheckedExpr ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_544() -#line 3950 "cs-parser.jay" +#line 3945 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7217,14 +7212,14 @@ void case_544() } void case_545() -#line 3959 "cs-parser.jay" +#line 3954 "cs-parser.jay" { yyVal = new UnCheckedExpr ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_546() -#line 3964 "cs-parser.jay" +#line 3959 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7232,14 +7227,14 @@ void case_546() } void case_547() -#line 3973 "cs-parser.jay" +#line 3968 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new MemberAccess (new Indirection ((Expression) yyVals[-3+yyTop], GetLocation (yyVals[-2+yyTop])), lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location); } void case_549() -#line 3985 "cs-parser.jay" +#line 3980 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); if ((ParametersCompiled) yyVals[-2+yyTop] != ParametersCompiled.Undefined) { @@ -7250,7 +7245,7 @@ void case_549() } void case_551() -#line 3998 "cs-parser.jay" +#line 3993 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); @@ -7262,7 +7257,7 @@ void case_551() } void case_555() -#line 4023 "cs-parser.jay" +#line 4018 "cs-parser.jay" { valid_param_mod = 0; yyVal = yyVals[-1+yyTop]; @@ -7271,7 +7266,7 @@ void case_555() } void case_556() -#line 4033 "cs-parser.jay" +#line 4028 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-3+yyTop]), "default value expression"); @@ -7281,14 +7276,14 @@ void case_556() } void case_560() -#line 4053 "cs-parser.jay" +#line 4048 "cs-parser.jay" { yyVal = new Cast ((FullNamedExpression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_561() -#line 4058 "cs-parser.jay" +#line 4053 "cs-parser.jay" { if (!async_block) { if (current_anonymous_method is LambdaExpression) { @@ -7309,7 +7304,7 @@ void case_561() } void case_562() -#line 4077 "cs-parser.jay" +#line 4072 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7317,7 +7312,7 @@ void case_562() } void case_563() -#line 4083 "cs-parser.jay" +#line 4078 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7325,7 +7320,7 @@ void case_563() } void case_564() -#line 4089 "cs-parser.jay" +#line 4084 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7334,7 +7329,7 @@ void case_564() } void case_565() -#line 4096 "cs-parser.jay" +#line 4091 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7342,7 +7337,7 @@ void case_565() } void case_573() -#line 4134 "cs-parser.jay" +#line 4129 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7350,7 +7345,7 @@ void case_573() } void case_574() -#line 4140 "cs-parser.jay" +#line 4135 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7358,7 +7353,7 @@ void case_574() } void case_575() -#line 4146 "cs-parser.jay" +#line 4141 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7366,7 +7361,7 @@ void case_575() } void case_576() -#line 4152 "cs-parser.jay" +#line 4147 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7374,7 +7369,7 @@ void case_576() } void case_577() -#line 4158 "cs-parser.jay" +#line 4153 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7382,7 +7377,7 @@ void case_577() } void case_578() -#line 4164 "cs-parser.jay" +#line 4159 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7390,28 +7385,28 @@ void case_578() } void case_580() -#line 4174 "cs-parser.jay" +#line 4169 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.Multiply, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_581() -#line 4179 "cs-parser.jay" +#line 4174 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.Division, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_582() -#line 4184 "cs-parser.jay" +#line 4179 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.Modulus, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_583() -#line 4189 "cs-parser.jay" +#line 4184 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7420,7 +7415,7 @@ void case_583() } void case_584() -#line 4196 "cs-parser.jay" +#line 4191 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7429,7 +7424,7 @@ void case_584() } void case_585() -#line 4203 "cs-parser.jay" +#line 4198 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7438,21 +7433,21 @@ void case_585() } void case_587() -#line 4214 "cs-parser.jay" +#line 4209 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.Addition, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_588() -#line 4219 "cs-parser.jay" +#line 4214 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_591() -#line 4232 "cs-parser.jay" +#line 4227 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7461,7 +7456,7 @@ void case_591() } void case_592() -#line 4239 "cs-parser.jay" +#line 4234 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7470,7 +7465,7 @@ void case_592() } void case_593() -#line 4246 "cs-parser.jay" +#line 4241 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7478,7 +7473,7 @@ void case_593() } void case_594() -#line 4252 "cs-parser.jay" +#line 4247 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7486,21 +7481,21 @@ void case_594() } void case_596() -#line 4262 "cs-parser.jay" +#line 4257 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.LeftShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_597() -#line 4267 "cs-parser.jay" +#line 4262 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.RightShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_598() -#line 4272 "cs-parser.jay" +#line 4267 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7509,7 +7504,7 @@ void case_598() } void case_599() -#line 4279 "cs-parser.jay" +#line 4274 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7518,35 +7513,35 @@ void case_599() } void case_601() -#line 4290 "cs-parser.jay" +#line 4285 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.LessThan, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_602() -#line 4295 "cs-parser.jay" +#line 4290 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.GreaterThan, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_603() -#line 4300 "cs-parser.jay" +#line 4295 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.LessThanOrEqual, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_604() -#line 4305 "cs-parser.jay" +#line 4300 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.GreaterThanOrEqual, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_605() -#line 4310 "cs-parser.jay" +#line 4305 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7555,7 +7550,7 @@ void case_605() } void case_606() -#line 4317 "cs-parser.jay" +#line 4312 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7564,7 +7559,7 @@ void case_606() } void case_607() -#line 4324 "cs-parser.jay" +#line 4319 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7573,7 +7568,7 @@ void case_607() } void case_608() -#line 4331 "cs-parser.jay" +#line 4326 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7582,21 +7577,21 @@ void case_608() } void case_610() -#line 4342 "cs-parser.jay" +#line 4337 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.Equality, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_611() -#line 4347 "cs-parser.jay" +#line 4342 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.Inequality, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_612() -#line 4352 "cs-parser.jay" +#line 4347 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7605,7 +7600,7 @@ void case_612() } void case_613() -#line 4359 "cs-parser.jay" +#line 4354 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7614,14 +7609,14 @@ void case_613() } void case_615() -#line 4370 "cs-parser.jay" +#line 4365 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.BitwiseAnd, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_616() -#line 4375 "cs-parser.jay" +#line 4370 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7630,14 +7625,14 @@ void case_616() } void case_618() -#line 4386 "cs-parser.jay" +#line 4381 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.ExclusiveOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_619() -#line 4391 "cs-parser.jay" +#line 4386 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7646,14 +7641,14 @@ void case_619() } void case_621() -#line 4402 "cs-parser.jay" +#line 4397 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.BitwiseOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_622() -#line 4407 "cs-parser.jay" +#line 4402 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7662,14 +7657,14 @@ void case_622() } void case_624() -#line 4418 "cs-parser.jay" +#line 4413 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.LogicalAnd, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_625() -#line 4423 "cs-parser.jay" +#line 4418 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7678,14 +7673,14 @@ void case_625() } void case_627() -#line 4434 "cs-parser.jay" +#line 4429 "cs-parser.jay" { yyVal = new Binary (Binary.Operator.LogicalOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_628() -#line 4439 "cs-parser.jay" +#line 4434 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7694,7 +7689,7 @@ void case_628() } void case_630() -#line 4450 "cs-parser.jay" +#line 4445 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-1+yyTop]), "null coalescing operator"); @@ -7704,14 +7699,14 @@ void case_630() } void case_632() -#line 4462 "cs-parser.jay" +#line 4457 "cs-parser.jay" { yyVal = new Conditional (new BooleanExpression ((Expression) yyVals[-4+yyTop]), (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_633() -#line 4467 "cs-parser.jay" +#line 4462 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7719,7 +7714,7 @@ void case_633() } void case_634() -#line 4473 "cs-parser.jay" +#line 4468 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7728,7 +7723,7 @@ void case_634() } void case_635() -#line 4480 "cs-parser.jay" +#line 4475 "cs-parser.jay" { Error_SyntaxError (Token.CLOSE_BRACE); @@ -7738,84 +7733,84 @@ void case_635() } void case_636() -#line 4491 "cs-parser.jay" +#line 4486 "cs-parser.jay" { yyVal = new SimpleAssign ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_637() -#line 4496 "cs-parser.jay" +#line 4491 "cs-parser.jay" { yyVal = new CompoundAssign (Binary.Operator.Multiply, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_638() -#line 4501 "cs-parser.jay" +#line 4496 "cs-parser.jay" { yyVal = new CompoundAssign (Binary.Operator.Division, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_639() -#line 4506 "cs-parser.jay" +#line 4501 "cs-parser.jay" { yyVal = new CompoundAssign (Binary.Operator.Modulus, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_640() -#line 4511 "cs-parser.jay" +#line 4506 "cs-parser.jay" { yyVal = new CompoundAssign (Binary.Operator.Addition, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_641() -#line 4516 "cs-parser.jay" +#line 4511 "cs-parser.jay" { yyVal = new CompoundAssign (Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_642() -#line 4521 "cs-parser.jay" +#line 4516 "cs-parser.jay" { yyVal = new CompoundAssign (Binary.Operator.LeftShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_643() -#line 4526 "cs-parser.jay" +#line 4521 "cs-parser.jay" { yyVal = new CompoundAssign (Binary.Operator.RightShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_644() -#line 4531 "cs-parser.jay" +#line 4526 "cs-parser.jay" { yyVal = new CompoundAssign (Binary.Operator.BitwiseAnd, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_645() -#line 4536 "cs-parser.jay" +#line 4531 "cs-parser.jay" { yyVal = new CompoundAssign (Binary.Operator.BitwiseOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_646() -#line 4541 "cs-parser.jay" +#line 4536 "cs-parser.jay" { yyVal = new CompoundAssign (Binary.Operator.ExclusiveOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_647() -#line 4549 "cs-parser.jay" +#line 4544 "cs-parser.jay" { var pars = new List (4); pars.Add ((Parameter) yyVals[0+yyTop]); @@ -7824,7 +7819,7 @@ void case_647() } void case_648() -#line 4556 "cs-parser.jay" +#line 4551 "cs-parser.jay" { var pars = (List) yyVals[-2+yyTop]; Parameter p = (Parameter)yyVals[0+yyTop]; @@ -7839,37 +7834,37 @@ void case_648() } void case_649() -#line 4572 "cs-parser.jay" +#line 4567 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; yyVal = new Parameter ((FullNamedExpression) yyVals[-1+yyTop], lt.Value, (Parameter.Modifier) yyVals[-2+yyTop], null, lt.Location); } void case_650() -#line 4578 "cs-parser.jay" +#line 4573 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; yyVal = new Parameter ((FullNamedExpression) yyVals[-1+yyTop], lt.Value, Parameter.Modifier.NONE, null, lt.Location); } void case_651() -#line 4584 "cs-parser.jay" +#line 4579 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; yyVal = new ImplicitLambdaParameter (lt.Value, lt.Location); } void case_652() -#line 4589 "cs-parser.jay" +#line 4584 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) Error_AwaitAsIdentifier (yyVals[0+yyTop]); + var lt = (LocatedToken) Error_AwaitAsIdentifier (yyVals[0+yyTop]); yyVal = new ImplicitLambdaParameter (lt.Value, lt.Location); } void case_654() -#line 4597 "cs-parser.jay" +#line 4592 "cs-parser.jay" { var pars_list = (List) yyVals[0+yyTop]; yyVal = new ParametersCompiled (pars_list.ToArray ()); @@ -7877,7 +7872,7 @@ void case_654() } void case_656() -#line 4609 "cs-parser.jay" +#line 4604 "cs-parser.jay" { Block b = end_block (Location.Null); b.IsCompilerGenerated = true; @@ -7886,7 +7881,7 @@ void case_656() } void case_658() -#line 4617 "cs-parser.jay" +#line 4612 "cs-parser.jay" { /* Handles only cases like foo = x.FirstOrDefault (l => );*/ /* where we must restore current_variable*/ @@ -7898,108 +7893,108 @@ void case_658() } void case_660() -#line 4631 "cs-parser.jay" +#line 4626 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = null; } void case_661() -#line 4639 "cs-parser.jay" +#line 4634 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location); start_anonymous (true, new ParametersCompiled (p), false, lt.Location); } void case_662() -#line 4645 "cs-parser.jay" +#line 4640 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } void case_663() -#line 4650 "cs-parser.jay" +#line 4645 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) Error_AwaitAsIdentifier (yyVals[-1+yyTop]); + var lt = (LocatedToken) Error_AwaitAsIdentifier (yyVals[-1+yyTop]); Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location); start_anonymous (true, new ParametersCompiled (p), false, lt.Location); } void case_664() -#line 4656 "cs-parser.jay" +#line 4651 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } void case_665() -#line 4661 "cs-parser.jay" +#line 4656 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location); start_anonymous (true, new ParametersCompiled (p), true, lt.Location); } void case_666() -#line 4667 "cs-parser.jay" +#line 4662 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop])); } void case_668() -#line 4676 "cs-parser.jay" +#line 4671 "cs-parser.jay" { valid_param_mod = 0; start_anonymous (true, (ParametersCompiled) yyVals[-2+yyTop], false, GetLocation (yyVals[-4+yyTop])); } void case_669() -#line 4681 "cs-parser.jay" +#line 4676 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-2+yyTop])); } void case_671() -#line 4690 "cs-parser.jay" +#line 4685 "cs-parser.jay" { valid_param_mod = 0; start_anonymous (true, (ParametersCompiled) yyVals[-2+yyTop], true, GetLocation (yyVals[-5+yyTop])); } void case_672() -#line 4695 "cs-parser.jay" +#line 4690 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-7+yyTop]), GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-2+yyTop])); } void case_679() -#line 4718 "cs-parser.jay" +#line 4713 "cs-parser.jay" { yyVal = new RefValueExpr ((Expression) yyVals[-3+yyTop], (FullNamedExpression) yyVals[-1+yyTop], GetLocation (yyVals[-5+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_680() -#line 4723 "cs-parser.jay" +#line 4718 "cs-parser.jay" { yyVal = new RefTypeExpr ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_681() -#line 4728 "cs-parser.jay" +#line 4723 "cs-parser.jay" { yyVal = new MakeRefExpr ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_685() -#line 4756 "cs-parser.jay" +#line 4751 "cs-parser.jay" { lexer.ConstraintsParsing = true; @@ -8013,7 +8008,7 @@ void case_685() } void case_686() -#line 4769 "cs-parser.jay" +#line 4764 "cs-parser.jay" { lexer.ConstraintsParsing = false; @@ -8029,7 +8024,7 @@ void case_686() } void case_687() -#line 4783 "cs-parser.jay" +#line 4778 "cs-parser.jay" { --lexer.parsing_declaration; if (doc_support) @@ -8037,7 +8032,7 @@ void case_687() } void case_688() -#line 4789 "cs-parser.jay" +#line 4784 "cs-parser.jay" { if (yyVals[0+yyTop] == null) { lbag.AppendToMember (current_container, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop])); @@ -8048,7 +8043,7 @@ void case_688() } void case_691() -#line 4808 "cs-parser.jay" +#line 4803 "cs-parser.jay" { mod_locations = null; yyVal = ModifierNone; @@ -8056,7 +8051,7 @@ void case_691() } void case_694() -#line 4822 "cs-parser.jay" +#line 4817 "cs-parser.jay" { var m1 = (Modifiers) yyVals[-1+yyTop]; var m2 = (Modifiers) yyVals[0+yyTop]; @@ -8074,7 +8069,7 @@ void case_694() } void case_695() -#line 4841 "cs-parser.jay" +#line 4836 "cs-parser.jay" { yyVal = Modifiers.NEW; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); @@ -8084,91 +8079,91 @@ void case_695() } void case_696() -#line 4849 "cs-parser.jay" +#line 4844 "cs-parser.jay" { yyVal = Modifiers.PUBLIC; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_697() -#line 4854 "cs-parser.jay" +#line 4849 "cs-parser.jay" { yyVal = Modifiers.PROTECTED; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_698() -#line 4859 "cs-parser.jay" +#line 4854 "cs-parser.jay" { yyVal = Modifiers.INTERNAL; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_699() -#line 4864 "cs-parser.jay" +#line 4859 "cs-parser.jay" { yyVal = Modifiers.PRIVATE; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_700() -#line 4869 "cs-parser.jay" +#line 4864 "cs-parser.jay" { yyVal = Modifiers.ABSTRACT; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_701() -#line 4874 "cs-parser.jay" +#line 4869 "cs-parser.jay" { yyVal = Modifiers.SEALED; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_702() -#line 4879 "cs-parser.jay" +#line 4874 "cs-parser.jay" { yyVal = Modifiers.STATIC; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_703() -#line 4884 "cs-parser.jay" +#line 4879 "cs-parser.jay" { yyVal = Modifiers.READONLY; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_704() -#line 4889 "cs-parser.jay" +#line 4884 "cs-parser.jay" { yyVal = Modifiers.VIRTUAL; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_705() -#line 4894 "cs-parser.jay" +#line 4889 "cs-parser.jay" { yyVal = Modifiers.OVERRIDE; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_706() -#line 4899 "cs-parser.jay" +#line 4894 "cs-parser.jay" { yyVal = Modifiers.EXTERN; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_707() -#line 4904 "cs-parser.jay" +#line 4899 "cs-parser.jay" { yyVal = Modifiers.VOLATILE; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_708() -#line 4909 "cs-parser.jay" +#line 4904 "cs-parser.jay" { yyVal = Modifiers.UNSAFE; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); @@ -8177,29 +8172,29 @@ void case_708() } void case_709() -#line 4916 "cs-parser.jay" +#line 4911 "cs-parser.jay" { yyVal = Modifiers.ASYNC; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_711() -#line 4925 "cs-parser.jay" +#line 4920 "cs-parser.jay" { - current_type.AddBasesForPart ((List) yyVals[0+yyTop]); + current_type.SetBaseTypes ((List) yyVals[0+yyTop]); lbag.AppendToMember (current_type, GetLocation (yyVals[-1+yyTop])); } void case_712() -#line 4930 "cs-parser.jay" +#line 4925 "cs-parser.jay" { Error_SyntaxError (yyToken); - current_type.AddBasesForPart ((List) yyVals[-1+yyTop]); + current_type.SetBaseTypes ((List) yyVals[-1+yyTop]); } void case_715() -#line 4947 "cs-parser.jay" +#line 4942 "cs-parser.jay" { var constraints = new List (1); constraints.Add ((Constraints) yyVals[0+yyTop]); @@ -8207,7 +8202,7 @@ void case_715() } void case_716() -#line 4953 "cs-parser.jay" +#line 4948 "cs-parser.jay" { var constraints = (List) yyVals[-1+yyTop]; Constraints new_constraint = (Constraints)yyVals[0+yyTop]; @@ -8225,24 +8220,24 @@ void case_716() } void case_717() -#line 4972 "cs-parser.jay" +#line 4967 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; yyVal = new Constraints (new SimpleMemberName (lt.Value, lt.Location), (List) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_718() -#line 4978 "cs-parser.jay" +#line 4973 "cs-parser.jay" { Error_SyntaxError (yyToken); - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new Constraints (new SimpleMemberName (lt.Value, lt.Location), null, GetLocation (yyVals[-2+yyTop])); } void case_719() -#line 4988 "cs-parser.jay" +#line 4983 "cs-parser.jay" { var constraints = new List (1); constraints.Add ((FullNamedExpression) yyVals[0+yyTop]); @@ -8250,7 +8245,7 @@ void case_719() } void case_720() -#line 4994 "cs-parser.jay" +#line 4989 "cs-parser.jay" { var constraints = (List) yyVals[-2+yyTop]; var prev = constraints [constraints.Count - 1] as SpecialContraintExpr; @@ -8276,7 +8271,7 @@ void case_720() } void case_721() -#line 5021 "cs-parser.jay" +#line 5016 "cs-parser.jay" { if (yyVals[0+yyTop] is ComposedCast) report.Error (706, GetLocation (yyVals[0+yyTop]), "Invalid constraint type `{0}'", ((ComposedCast)yyVals[0+yyTop]).GetSignatureForError ()); @@ -8285,14 +8280,14 @@ void case_721() } void case_722() -#line 5028 "cs-parser.jay" +#line 5023 "cs-parser.jay" { yyVal = new SpecialContraintExpr (SpecialConstraint.Constructor, GetLocation (yyVals[-2+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_726() -#line 5048 "cs-parser.jay" +#line 5043 "cs-parser.jay" { if (lang_version <= LanguageVersion.V_3) FeatureIsNotAvailable (lexer.Location, "generic type variance"); @@ -8301,56 +8296,56 @@ void case_726() } void case_727() -#line 5058 "cs-parser.jay" +#line 5053 "cs-parser.jay" { yyVal = Variance.Covariant; savedLocation = GetLocation (yyVals[0+yyTop]); } void case_728() -#line 5063 "cs-parser.jay" +#line 5058 "cs-parser.jay" { yyVal = Variance.Contravariant; savedLocation = GetLocation (yyVals[0+yyTop]); } void case_729() -#line 5084 "cs-parser.jay" +#line 5079 "cs-parser.jay" { ++lexer.parsing_block; start_block (GetLocation (yyVals[0+yyTop])); } void case_731() -#line 5096 "cs-parser.jay" +#line 5091 "cs-parser.jay" { --lexer.parsing_block; yyVal = end_block (GetLocation (yyVals[0+yyTop])); } void case_732() -#line 5101 "cs-parser.jay" +#line 5096 "cs-parser.jay" { --lexer.parsing_block; yyVal = end_block (lexer.Location); } void case_733() -#line 5110 "cs-parser.jay" +#line 5105 "cs-parser.jay" { ++lexer.parsing_block; current_block.StartLocation = GetLocation (yyVals[0+yyTop]); } void case_734() -#line 5115 "cs-parser.jay" +#line 5110 "cs-parser.jay" { --lexer.parsing_block; yyVal = end_block (GetLocation (yyVals[0+yyTop])); } void case_735() -#line 5119 "cs-parser.jay" +#line 5114 "cs-parser.jay" { report.Error (1525, GetLocation (yyVals[0+yyTop]), "Unexpected symbol '}', expected '{'"); lexer.putback ('}'); @@ -8358,68 +8353,68 @@ void case_735() } void case_736() -#line 5128 "cs-parser.jay" +#line 5123 "cs-parser.jay" { ++lexer.parsing_block; current_block.StartLocation = GetLocation (yyVals[0+yyTop]); } void case_737() -#line 5133 "cs-parser.jay" +#line 5128 "cs-parser.jay" { --lexer.parsing_block; yyVal = end_block (GetLocation (yyVals[0+yyTop])); } void case_745() -#line 5161 "cs-parser.jay" +#line 5156 "cs-parser.jay" { Error_SyntaxError (yyToken); - var lt =(Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt =(LocatedToken) yyVals[-1+yyTop]; var sn = new SimpleName (lt.Value, lt.Location); current_block.AddStatement(new StatementErrorExpression (sn)); yyVal = null; } void case_746() -#line 5170 "cs-parser.jay" +#line 5165 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = null; } void case_779() -#line 5234 "cs-parser.jay" +#line 5229 "cs-parser.jay" { report.Error (1023, GetLocation (yyVals[0+yyTop]), "An embedded statement may not be a declaration or labeled statement"); yyVal = null; } void case_780() -#line 5239 "cs-parser.jay" +#line 5234 "cs-parser.jay" { report.Error (1023, GetLocation (yyVals[0+yyTop]), "An embedded statement may not be a declaration or labeled statement"); yyVal = null; } void case_781() -#line 5244 "cs-parser.jay" +#line 5239 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new EmptyStatement (GetLocation (yyVals[0+yyTop])); } void case_782() -#line 5252 "cs-parser.jay" +#line 5247 "cs-parser.jay" { /* Uses lexer.Location because semicolon location is not kept in quick mode*/ yyVal = new EmptyStatement (lexer.Location); } void case_783() -#line 5260 "cs-parser.jay" +#line 5255 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; LabeledStatement labeled = new LabeledStatement (lt.Value, current_block, lt.Location); lbag.AddLocation (labeled, GetLocation (yyVals[0+yyTop])); current_block.AddLabel (labeled); @@ -8427,7 +8422,7 @@ void case_783() } void case_786() -#line 5273 "cs-parser.jay" +#line 5268 "cs-parser.jay" { if (yyVals[-1+yyTop] is VarExpr) yyVals[-1+yyTop] = new SimpleName ("var", ((VarExpr) yyVals[-1+yyTop]).Location); @@ -8436,7 +8431,7 @@ void case_786() } void case_787() -#line 5289 "cs-parser.jay" +#line 5284 "cs-parser.jay" { /* Ok, the above "primary_expression" is there to get rid of*/ /* both reduce/reduce and shift/reduces in the grammar, it should*/ @@ -8468,7 +8463,7 @@ void case_787() } void case_788() -#line 5319 "cs-parser.jay" +#line 5314 "cs-parser.jay" { ATypeNameExpression expr = yyVals[-1+yyTop] as ATypeNameExpression; @@ -8481,7 +8476,7 @@ void case_788() } void case_789() -#line 5330 "cs-parser.jay" +#line 5325 "cs-parser.jay" { if (yyVals[0+yyTop] == null) yyVal = yyVals[-1+yyTop]; @@ -8490,30 +8485,30 @@ void case_789() } void case_792() -#line 5345 "cs-parser.jay" +#line 5340 "cs-parser.jay" { Expression.Error_VoidInvalidInTheContext (GetLocation (yyVals[0+yyTop]), report); yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); } void case_794() -#line 5354 "cs-parser.jay" +#line 5349 "cs-parser.jay" { ((ComposedTypeSpecifier) yyVals[-1+yyTop]).Next = (ComposedTypeSpecifier) yyVals[0+yyTop]; yyVal = yyVals[-1+yyTop]; } void case_798() -#line 5377 "cs-parser.jay" +#line 5372 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; var li = new LocalVariable (current_block, lt.Value, lt.Location); current_block.AddLocalName (li); - current_variable = new BlockVariableDeclaration ((FullNamedExpression) yyVals[-1+yyTop], li); + current_variable = new BlockVariable ((FullNamedExpression) yyVals[-1+yyTop], li); } void case_799() -#line 5384 "cs-parser.jay" +#line 5379 "cs-parser.jay" { yyVal = current_variable; current_variable = null; @@ -8524,16 +8519,16 @@ void case_799() } void case_800() -#line 5393 "cs-parser.jay" +#line 5388 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.Constant, lt.Location); current_block.AddLocalName (li); - current_variable = new BlockConstantDeclaration ((FullNamedExpression) yyVals[-1+yyTop], li); + current_variable = new BlockConstant ((FullNamedExpression) yyVals[-1+yyTop], li); } void case_801() -#line 5400 "cs-parser.jay" +#line 5395 "cs-parser.jay" { if (current_variable.Initializer != null) { lbag.AddLocation (current_variable, GetLocation (yyVals[-6+yyTop]), savedLocation, GetLocation (yyVals[0+yyTop])); @@ -8545,7 +8540,7 @@ void case_801() } void case_803() -#line 5413 "cs-parser.jay" +#line 5408 "cs-parser.jay" { /* Redundant, but wont regress*/ report.Error (1525, lexer.Location, "Unexpected symbol }"); @@ -8554,7 +8549,7 @@ void case_803() } void case_805() -#line 5424 "cs-parser.jay" +#line 5419 "cs-parser.jay" { current_variable.Initializer = (Expression) yyVals[0+yyTop]; PushLocation (GetLocation (yyVals[-1+yyTop])); @@ -8562,7 +8557,7 @@ void case_805() } void case_806() -#line 5430 "cs-parser.jay" +#line 5425 "cs-parser.jay" { if (yyToken == Token.OPEN_BRACKET_EXPR) { report.Error (650, lexer.Location, @@ -8573,7 +8568,7 @@ void case_806() } void case_810() -#line 5448 "cs-parser.jay" +#line 5443 "cs-parser.jay" { foreach (var d in current_variable.Declarators) { if (d.Initializer == null) @@ -8582,68 +8577,68 @@ void case_810() } void case_813() -#line 5463 "cs-parser.jay" +#line 5458 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; var li = new LocalVariable (current_variable.Variable, lt.Value, lt.Location); - var d = new BlockVariableDeclaration.Declarator (li, null); + var d = new BlockVariableDeclarator (li, null); current_variable.AddDeclarator (d); current_block.AddLocalName (li); lbag.AddLocation (d, GetLocation (yyVals[-1+yyTop])); } void case_814() -#line 5472 "cs-parser.jay" +#line 5467 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; var li = new LocalVariable (current_variable.Variable, lt.Value, lt.Location); - var d = new BlockVariableDeclaration.Declarator (li, (Expression) yyVals[0+yyTop]); + var d = new BlockVariableDeclarator (li, (Expression) yyVals[0+yyTop]); current_variable.AddDeclarator (d); current_block.AddLocalName (li); lbag.AddLocation (d, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop])); } void case_816() -#line 5488 "cs-parser.jay" +#line 5483 "cs-parser.jay" { savedLocation = GetLocation (yyVals[-1+yyTop]); current_variable.Initializer = (Expression) yyVals[0+yyTop]; } void case_821() -#line 5506 "cs-parser.jay" +#line 5501 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.Constant, lt.Location); - var d = new BlockVariableDeclaration.Declarator (li, (Expression) yyVals[0+yyTop]); + var d = new BlockVariableDeclarator (li, (Expression) yyVals[0+yyTop]); current_variable.AddDeclarator (d); current_block.AddLocalName (li); lbag.AddLocation (d, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop])); } void case_823() -#line 5519 "cs-parser.jay" +#line 5514 "cs-parser.jay" { yyVal = new StackAlloc ((Expression) yyVals[-3+yyTop], (Expression) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_824() -#line 5524 "cs-parser.jay" +#line 5519 "cs-parser.jay" { report.Error (1575, GetLocation (yyVals[-1+yyTop]), "A stackalloc expression requires [] after type"); yyVal = new StackAlloc ((Expression) yyVals[0+yyTop], null, GetLocation (yyVals[-1+yyTop])); } void case_825() -#line 5532 "cs-parser.jay" +#line 5527 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop])); } void case_827() -#line 5538 "cs-parser.jay" +#line 5533 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; report.Error (1002, GetLocation (yyVals[0+yyTop]), "; expected"); @@ -8651,12 +8646,11 @@ void case_827() } void case_830() -#line 5556 "cs-parser.jay" +#line 5551 "cs-parser.jay" { ExpressionStatement s = yyVals[0+yyTop] as ExpressionStatement; if (s == null) { var expr = yyVals[0+yyTop] as Expression; - expr.Error_InvalidExpressionStatement (report); yyVal = new StatementErrorExpression (expr); } else { yyVal = new StatementExpression (s); @@ -8664,7 +8658,7 @@ void case_830() } void case_831() -#line 5570 "cs-parser.jay" +#line 5564 "cs-parser.jay" { Expression expr = (Expression) yyVals[0+yyTop]; ExpressionStatement s; @@ -8674,14 +8668,14 @@ void case_831() } void case_832() -#line 5578 "cs-parser.jay" +#line 5572 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new EmptyStatement (GetLocation (yyVals[0+yyTop])); } void case_835() -#line 5592 "cs-parser.jay" +#line 5586 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8691,7 +8685,7 @@ void case_835() } void case_836() -#line 5601 "cs-parser.jay" +#line 5595 "cs-parser.jay" { yyVal = new If ((BooleanExpression) yyVals[-4+yyTop], (Statement) yyVals[-2+yyTop], (Statement) yyVals[0+yyTop], GetLocation (yyVals[-6+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop])); @@ -8703,7 +8697,7 @@ void case_836() } void case_837() -#line 5611 "cs-parser.jay" +#line 5605 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8712,7 +8706,7 @@ void case_837() } void case_839() -#line 5625 "cs-parser.jay" +#line 5619 "cs-parser.jay" { yyVal = new Switch ((Expression) yyVals[-5+yyTop], (ExplicitBlock) current_block.Explicit, GetLocation (yyVals[-7+yyTop])); end_block (GetLocation (yyVals[0+yyTop])); @@ -8720,7 +8714,7 @@ void case_839() } void case_840() -#line 5631 "cs-parser.jay" +#line 5625 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8729,7 +8723,7 @@ void case_840() } void case_847() -#line 5662 "cs-parser.jay" +#line 5656 "cs-parser.jay" { var label = (SwitchLabel) yyVals[0+yyTop]; label.SectionStart = true; @@ -8737,21 +8731,21 @@ void case_847() } void case_849() -#line 5675 "cs-parser.jay" +#line 5669 "cs-parser.jay" { yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_850() -#line 5680 "cs-parser.jay" +#line 5674 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); } void case_856() -#line 5699 "cs-parser.jay" +#line 5693 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8761,7 +8755,7 @@ void case_856() } void case_857() -#line 5707 "cs-parser.jay" +#line 5701 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8770,21 +8764,21 @@ void case_857() } void case_858() -#line 5717 "cs-parser.jay" +#line 5711 "cs-parser.jay" { yyVal = new Do ((Statement) yyVals[-5+yyTop], (BooleanExpression) yyVals[-2+yyTop], GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[-4+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_859() -#line 5722 "cs-parser.jay" +#line 5716 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new Do ((Statement) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop]), Location.Null); } void case_860() -#line 5727 "cs-parser.jay" +#line 5721 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8793,7 +8787,7 @@ void case_860() } void case_861() -#line 5737 "cs-parser.jay" +#line 5731 "cs-parser.jay" { start_block (GetLocation (yyVals[0+yyTop])); current_block.IsCompilerGenerated = true; @@ -8804,7 +8798,7 @@ void case_861() } void case_863() -#line 5754 "cs-parser.jay" +#line 5748 "cs-parser.jay" { For f = (For) yyVals[-2+yyTop]; f.Initializer = (Statement) yyVals[-1+yyTop]; @@ -8813,7 +8807,7 @@ void case_863() } void case_865() -#line 5764 "cs-parser.jay" +#line 5758 "cs-parser.jay" { report.Error (1525, GetLocation (yyVals[0+yyTop]), "Unexpected symbol ')', expected ';'"); For f = (For) yyVals[-2+yyTop]; @@ -8823,7 +8817,7 @@ void case_865() } void case_866() -#line 5775 "cs-parser.jay" +#line 5769 "cs-parser.jay" { For f = (For) yyVals[-2+yyTop]; f.Condition = (BooleanExpression) yyVals[-1+yyTop]; @@ -8832,7 +8826,7 @@ void case_866() } void case_868() -#line 5786 "cs-parser.jay" +#line 5780 "cs-parser.jay" { report.Error (1525, GetLocation (yyVals[0+yyTop]), "Unexpected symbol ')', expected ';'"); For f = (For) yyVals[-2+yyTop]; @@ -8842,7 +8836,7 @@ void case_868() } void case_869() -#line 5798 "cs-parser.jay" +#line 5792 "cs-parser.jay" { For f = (For) yyVals[-3+yyTop]; f.Iterator = (Statement) yyVals[-2+yyTop]; @@ -8857,23 +8851,23 @@ void case_869() } void case_870() -#line 5811 "cs-parser.jay" +#line 5805 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = end_block (current_block.StartLocation); } void case_873() -#line 5824 "cs-parser.jay" +#line 5818 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; var li = new LocalVariable (current_block, lt.Value, lt.Location); current_block.AddLocalName (li); - current_variable = new BlockVariableDeclaration ((FullNamedExpression) yyVals[-1+yyTop], li); + current_variable = new BlockVariable ((FullNamedExpression) yyVals[-1+yyTop], li); } void case_874() -#line 5831 "cs-parser.jay" +#line 5825 "cs-parser.jay" { yyVal = current_variable; if (yyVals[-1+yyTop] != null) @@ -8883,7 +8877,7 @@ void case_874() } void case_882() -#line 5858 "cs-parser.jay" +#line 5852 "cs-parser.jay" { var sl = yyVals[-2+yyTop] as StatementList; if (sl == null) { @@ -8899,7 +8893,7 @@ void case_882() } void case_883() -#line 5875 "cs-parser.jay" +#line 5869 "cs-parser.jay" { report.Error (230, GetLocation (yyVals[-3+yyTop]), "Type and identifier are both required in a foreach statement"); @@ -8914,14 +8908,14 @@ void case_883() } void case_884() -#line 5888 "cs-parser.jay" +#line 5882 "cs-parser.jay" { Error_SyntaxError (yyToken); start_block (GetLocation (yyVals[-3+yyTop])); current_block.IsCompilerGenerated = true; - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location); current_block.AddLocalName (li); @@ -8933,18 +8927,19 @@ void case_884() } void case_885() -#line 5905 "cs-parser.jay" +#line 5899 "cs-parser.jay" { start_block (GetLocation (yyVals[-5+yyTop])); current_block.IsCompilerGenerated = true; - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + + var lt = (LocatedToken) yyVals[-3+yyTop]; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location); current_block.AddLocalName (li); yyVal = li; } void case_886() -#line 5914 "cs-parser.jay" +#line 5909 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8957,11 +8952,11 @@ void case_886() } void case_887() -#line 5925 "cs-parser.jay" +#line 5920 "cs-parser.jay" { start_block (GetLocation (yyVals[-3+yyTop])); current_block.IsCompilerGenerated = true; - var lt = yyVals[-1+yyTop] as Tokenizer.LocatedToken; + var lt = yyVals[-1+yyTop] as LocatedToken; var li = lt != null ? new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location) : null; Foreach f = new Foreach ((Expression) yyVals[-2+yyTop], li, null, null, null, GetLocation (yyVals[-4+yyTop])); @@ -8972,7 +8967,7 @@ void case_887() } void case_888() -#line 5938 "cs-parser.jay" +#line 5933 "cs-parser.jay" { Foreach f = new Foreach ((Expression) yyVals[-1+yyTop], null, null, null, null, GetLocation (yyVals[-3+yyTop])); current_block.AddStatement (f); @@ -8982,87 +8977,87 @@ void case_888() } void case_895() -#line 5958 "cs-parser.jay" +#line 5953 "cs-parser.jay" { yyVal = new Break (GetLocation (yyVals[-1+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop])); } void case_896() -#line 5966 "cs-parser.jay" +#line 5961 "cs-parser.jay" { yyVal = new Continue (GetLocation (yyVals[-1+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop])); } void case_897() -#line 5971 "cs-parser.jay" +#line 5966 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new Continue (GetLocation (yyVals[-1+yyTop])); } void case_898() -#line 5979 "cs-parser.jay" +#line 5974 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new Goto (lt.Value, GetLocation (yyVals[-2+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_899() -#line 5985 "cs-parser.jay" +#line 5980 "cs-parser.jay" { yyVal = new GotoCase ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_900() -#line 5990 "cs-parser.jay" +#line 5985 "cs-parser.jay" { yyVal = new GotoDefault (GetLocation (yyVals[-2+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_901() -#line 5998 "cs-parser.jay" +#line 5993 "cs-parser.jay" { yyVal = new Return ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop])); } void case_902() -#line 6003 "cs-parser.jay" +#line 5998 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new Return ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); } void case_903() -#line 6008 "cs-parser.jay" +#line 6003 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new Return (null, GetLocation (yyVals[-1+yyTop])); } void case_904() -#line 6016 "cs-parser.jay" +#line 6011 "cs-parser.jay" { yyVal = new Throw ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop])); } void case_905() -#line 6021 "cs-parser.jay" +#line 6016 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new Throw (null, GetLocation (yyVals[-1+yyTop])); } void case_906() -#line 6029 "cs-parser.jay" +#line 6024 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; string s = lt.Value; if (s != "yield"){ report.Error (1003, lt.Location, "; expected"); @@ -9078,11 +9073,11 @@ void case_906() } void case_907() -#line 6045 "cs-parser.jay" +#line 6040 "cs-parser.jay" { Error_SyntaxError (yyToken); - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; string s = lt.Value; if (s != "yield"){ report.Error (1003, lt.Location, "; expected"); @@ -9098,9 +9093,9 @@ void case_907() } void case_908() -#line 6063 "cs-parser.jay" +#line 6058 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; string s = lt.Value; if (s != "yield"){ report.Error (1003, lt.Location, "; expected"); @@ -9108,34 +9103,34 @@ void case_908() FeatureIsNotAvailable (lt.Location, "iterators"); } - current_block.Explicit.RegisterIteratorYield (); + current_block.ParametersBlock.TopBlock.IsIterator = true; yyVal = new YieldBreak (lt.Location); lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_912() -#line 6089 "cs-parser.jay" +#line 6084 "cs-parser.jay" { yyVal = new TryFinally ((Statement) yyVals[-2+yyTop], (Block) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_913() -#line 6094 "cs-parser.jay" +#line 6089 "cs-parser.jay" { yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List) yyVals[-2+yyTop], GetLocation (yyVals[-4+yyTop]), true), (Block) yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_914() -#line 6099 "cs-parser.jay" +#line 6094 "cs-parser.jay" { Error_SyntaxError (1524, yyToken); yyVal = new TryCatch ((Block) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop]), false); } void case_915() -#line 6107 "cs-parser.jay" +#line 6102 "cs-parser.jay" { var l = new List (2); @@ -9144,7 +9139,7 @@ void case_915() } void case_916() -#line 6114 "cs-parser.jay" +#line 6109 "cs-parser.jay" { var l = (List) yyVals[-1+yyTop]; @@ -9158,14 +9153,14 @@ void case_916() } void case_920() -#line 6138 "cs-parser.jay" +#line 6133 "cs-parser.jay" { start_block (GetLocation (yyVals[-3+yyTop])); var c = new Catch (current_block, GetLocation (yyVals[-4+yyTop])); c.TypeExpression = (FullNamedExpression) yyVals[-2+yyTop]; if (yyVals[-1+yyTop] != null) { - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; c.Variable = new LocalVariable (current_block, lt.Value, lt.Location); current_block.AddLocalName (c.Variable); } @@ -9175,7 +9170,7 @@ void case_920() } void case_922() -#line 6157 "cs-parser.jay" +#line 6152 "cs-parser.jay" { if (yyToken == Token.CLOSE_PARENS) { report.Error (1015, lexer.Location, @@ -9188,7 +9183,7 @@ void case_922() } void case_923() -#line 6168 "cs-parser.jay" +#line 6163 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -9198,12 +9193,12 @@ void case_923() c.TypeExpression = (FullNamedExpression) yyVals[-3+yyTop]; if (yyVals[-2+yyTop] != null) { - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; c.Variable = new LocalVariable (current_block, lt.Value, lt.Location); } if (yyVals[-2+yyTop] != null) { - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; c.Variable = new LocalVariable (current_block, lt.Value, lt.Location); } @@ -9213,14 +9208,14 @@ void case_923() } void case_926() -#line 6208 "cs-parser.jay" +#line 6203 "cs-parser.jay" { if (!settings.Unsafe) Error_UnsafeCodeNotAllowed (GetLocation (yyVals[0+yyTop])); } void case_928() -#line 6218 "cs-parser.jay" +#line 6213 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -9230,7 +9225,7 @@ void case_928() } void case_929() -#line 6226 "cs-parser.jay" +#line 6221 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -9239,26 +9234,26 @@ void case_929() } void case_930() -#line 6236 "cs-parser.jay" +#line 6231 "cs-parser.jay" { start_block (GetLocation (yyVals[-2+yyTop])); current_block.IsCompilerGenerated = true; - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.FixedVariable | LocalVariable.Flags.Used, lt.Location); current_block.AddLocalName (li); current_variable = new Fixed.VariableDeclaration ((FullNamedExpression) yyVals[-1+yyTop], li); } void case_931() -#line 6246 "cs-parser.jay" +#line 6241 "cs-parser.jay" { yyVal = current_variable; current_variable = null; } void case_932() -#line 6251 "cs-parser.jay" +#line 6246 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -9270,26 +9265,26 @@ void case_932() } void case_933() -#line 6264 "cs-parser.jay" +#line 6259 "cs-parser.jay" { start_block (GetLocation (yyVals[-2+yyTop])); current_block.IsCompilerGenerated = true; - var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + var lt = (LocatedToken) yyVals[0+yyTop]; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.UsingVariable | LocalVariable.Flags.Used, lt.Location); current_block.AddLocalName (li); current_variable = new Using.VariableDeclaration ((FullNamedExpression) yyVals[-1+yyTop], li); } void case_934() -#line 6274 "cs-parser.jay" +#line 6269 "cs-parser.jay" { yyVal = current_variable; current_variable = null; } void case_935() -#line 6279 "cs-parser.jay" +#line 6274 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -9301,7 +9296,7 @@ void case_935() } void case_936() -#line 6289 "cs-parser.jay" +#line 6284 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -9311,7 +9306,7 @@ void case_936() } void case_937() -#line 6297 "cs-parser.jay" +#line 6292 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -9320,14 +9315,14 @@ void case_937() } void case_939() -#line 6308 "cs-parser.jay" +#line 6303 "cs-parser.jay" { /* It has to be here for the parent to safely restore artificial block*/ Error_SyntaxError (yyToken); } void case_941() -#line 6320 "cs-parser.jay" +#line 6315 "cs-parser.jay" { current_variable.Initializer = (Expression) yyVals[0+yyTop]; lbag.AddLocation (current_variable, GetLocation (yyVals[-1+yyTop])); @@ -9335,7 +9330,7 @@ void case_941() } void case_942() -#line 6332 "cs-parser.jay" +#line 6327 "cs-parser.jay" { lexer.query_parsing = false; @@ -9349,7 +9344,7 @@ void case_942() } void case_943() -#line 6344 "cs-parser.jay" +#line 6339 "cs-parser.jay" { Linq.AQueryClause from = yyVals[-1+yyTop] as Linq.AQueryClause; @@ -9361,7 +9356,7 @@ void case_943() } void case_944() -#line 6355 "cs-parser.jay" +#line 6350 "cs-parser.jay" { lexer.query_parsing = false; yyVal = yyVals[-1+yyTop]; @@ -9371,7 +9366,7 @@ void case_944() } void case_945() -#line 6362 "cs-parser.jay" +#line 6357 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; current_block.SetEndLocation (lexer.Location); @@ -9379,11 +9374,11 @@ void case_945() } void case_946() -#line 6371 "cs-parser.jay" +#line 6366 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; var rv = new Linq.RangeVariable (lt.Value, lt.Location); var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)yyVals[0+yyTop], rv, GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (start, GetLocation (yyVals[-1+yyTop])); @@ -9391,11 +9386,11 @@ void case_946() } void case_947() -#line 6381 "cs-parser.jay" +#line 6376 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; var rv = new Linq.RangeVariable (lt.Value, lt.Location); var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)yyVals[0+yyTop], rv, GetLocation (yyVals[-4+yyTop])) { IdentifierType = (FullNamedExpression)yyVals[-3+yyTop] @@ -9405,11 +9400,11 @@ void case_947() } void case_948() -#line 6396 "cs-parser.jay" +#line 6391 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; var rv = new Linq.RangeVariable (lt.Value, lt.Location); var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)yyVals[0+yyTop], rv, GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (start, GetLocation (yyVals[-1+yyTop])); @@ -9417,11 +9412,11 @@ void case_948() } void case_949() -#line 6406 "cs-parser.jay" +#line 6401 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; var rv = new Linq.RangeVariable (lt.Value, lt.Location); var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)yyVals[0+yyTop], rv, GetLocation (yyVals[-4+yyTop])) { IdentifierType = (FullNamedExpression)yyVals[-3+yyTop] @@ -9431,9 +9426,9 @@ void case_949() } void case_951() -#line 6425 "cs-parser.jay" +#line 6420 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; var sn = new Linq.RangeVariable (lt.Value, lt.Location); yyVal = new Linq.SelectMany ((Linq.QueryBlock)current_block, sn, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop])); @@ -9445,9 +9440,9 @@ void case_951() } void case_953() -#line 6441 "cs-parser.jay" +#line 6436 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; var sn = new Linq.RangeVariable (lt.Value, lt.Location); yyVal = new Linq.SelectMany ((Linq.QueryBlock)current_block, sn, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-5+yyTop])) { @@ -9463,7 +9458,7 @@ void case_953() } void case_954() -#line 6460 "cs-parser.jay" +#line 6455 "cs-parser.jay" { Linq.AQueryClause head = (Linq.AQueryClause)yyVals[-1+yyTop]; @@ -9480,7 +9475,7 @@ void case_954() } void case_955() -#line 6475 "cs-parser.jay" +#line 6470 "cs-parser.jay" { Linq.AQueryClause head = (Linq.AQueryClause)yyVals[0+yyTop]; @@ -9494,21 +9489,21 @@ void case_955() } void case_957() -#line 6488 "cs-parser.jay" +#line 6483 "cs-parser.jay" { report.Error (742, GetLocation (yyVals[0+yyTop]), "Unexpected symbol `{0}'. A query body must end with select or group clause", GetSymbolName (yyToken)); yyVal = yyVals[-1+yyTop]; } void case_958() -#line 6493 "cs-parser.jay" +#line 6488 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = null; } void case_960() -#line 6505 "cs-parser.jay" +#line 6500 "cs-parser.jay" { yyVal = new Linq.Select ((Linq.QueryBlock)current_block, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); @@ -9517,7 +9512,7 @@ void case_960() } void case_961() -#line 6512 "cs-parser.jay" +#line 6507 "cs-parser.jay" { if (linq_clause_blocks == null) linq_clause_blocks = new Stack (); @@ -9527,7 +9522,7 @@ void case_961() } void case_962() -#line 6520 "cs-parser.jay" +#line 6515 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -9536,7 +9531,7 @@ void case_962() } void case_963() -#line 6527 "cs-parser.jay" +#line 6522 "cs-parser.jay" { var obj = (object[]) yyVals[0+yyTop]; @@ -9548,23 +9543,23 @@ void case_963() } void case_965() -#line 6544 "cs-parser.jay" +#line 6539 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new object[2] { null, Location.Null }; } void case_967() -#line 6553 "cs-parser.jay" +#line 6548 "cs-parser.jay" { ((Linq.AQueryClause)yyVals[-1+yyTop]).Tail.Next = (Linq.AQueryClause)yyVals[0+yyTop]; yyVal = yyVals[-1+yyTop]; } void case_974() -#line 6573 "cs-parser.jay" +#line 6568 "cs-parser.jay" { - var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + var lt = (LocatedToken) yyVals[-3+yyTop]; var sn = new Linq.RangeVariable (lt.Value, lt.Location); yyVal = new Linq.Let ((Linq.QueryBlock) current_block, sn, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); @@ -9576,7 +9571,7 @@ void case_974() } void case_976() -#line 6592 "cs-parser.jay" +#line 6587 "cs-parser.jay" { yyVal = new Linq.Where ((Linq.QueryBlock)current_block, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); @@ -9585,7 +9580,7 @@ void case_976() } void case_977() -#line 6602 "cs-parser.jay" +#line 6597 "cs-parser.jay" { if (linq_clause_blocks == null) linq_clause_blocks = new Stack (); @@ -9595,7 +9590,7 @@ void case_977() } void case_978() -#line 6610 "cs-parser.jay" +#line 6605 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -9605,7 +9600,7 @@ void case_978() } void case_979() -#line 6618 "cs-parser.jay" +#line 6613 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -9615,7 +9610,7 @@ void case_979() } void case_980() -#line 6626 "cs-parser.jay" +#line 6621 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -9623,7 +9618,7 @@ void case_980() var outer_selector = linq_clause_blocks.Pop (); var block = linq_clause_blocks.Pop (); - var lt = (Tokenizer.LocatedToken) yyVals[-10+yyTop]; + var lt = (LocatedToken) yyVals[-10+yyTop]; var sn = new Linq.RangeVariable (lt.Value, lt.Location); Linq.RangeVariable into; @@ -9643,7 +9638,7 @@ void case_980() ((Linq.QueryBlock)current_block).AddRangeVariable (sn); - lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + lt = (LocatedToken) yyVals[0+yyTop]; into = new Linq.RangeVariable (lt.Value, lt.Location); yyVal = new Linq.GroupJoin (block, sn, (Expression)yyVals[-7+yyTop], outer_selector, (Linq.QueryBlock) current_block, into, GetLocation (yyVals[-11+yyTop])); @@ -9655,7 +9650,7 @@ void case_980() } void case_981() -#line 6664 "cs-parser.jay" +#line 6659 "cs-parser.jay" { if (linq_clause_blocks == null) linq_clause_blocks = new Stack (); @@ -9665,7 +9660,7 @@ void case_981() } void case_982() -#line 6672 "cs-parser.jay" +#line 6667 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -9675,7 +9670,7 @@ void case_982() } void case_983() -#line 6680 "cs-parser.jay" +#line 6675 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -9685,7 +9680,7 @@ void case_983() } void case_984() -#line 6688 "cs-parser.jay" +#line 6683 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -9693,7 +9688,7 @@ void case_984() var outer_selector = linq_clause_blocks.Pop (); var block = linq_clause_blocks.Pop (); - var lt = (Tokenizer.LocatedToken) yyVals[-10+yyTop]; + var lt = (LocatedToken) yyVals[-10+yyTop]; var sn = new Linq.RangeVariable (lt.Value, lt.Location); Linq.RangeVariable into; @@ -9715,7 +9710,7 @@ void case_984() ((Linq.QueryBlock)current_block).AddRangeVariable (sn); - lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; + lt = (LocatedToken) yyVals[0+yyTop]; into = new Linq.RangeVariable (lt.Value, lt.Location); /* TODO:*/ yyVal = new Linq.GroupJoin (block, sn, (Expression)yyVals[-7+yyTop], outer_selector, (Linq.QueryBlock) current_block, into, GetLocation (yyVals[-12+yyTop])) { @@ -9729,21 +9724,21 @@ void case_984() } void case_986() -#line 6734 "cs-parser.jay" +#line 6729 "cs-parser.jay" { opt_intoStack.Push (GetLocation (yyVals[-1+yyTop])); yyVal = yyVals[0+yyTop]; } void case_987() -#line 6742 "cs-parser.jay" +#line 6737 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); lbag.AddLocation (current_block, GetLocation (yyVals[0+yyTop])); } void case_988() -#line 6747 "cs-parser.jay" +#line 6742 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -9752,7 +9747,7 @@ void case_988() } void case_990() -#line 6758 "cs-parser.jay" +#line 6753 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -9761,14 +9756,14 @@ void case_990() } void case_991() -#line 6765 "cs-parser.jay" +#line 6760 "cs-parser.jay" { ((Linq.AQueryClause)yyVals[-3+yyTop]).Next = (Linq.AQueryClause)yyVals[0+yyTop]; yyVal = yyVals[-3+yyTop]; } void case_993() -#line 6774 "cs-parser.jay" +#line 6769 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -9777,42 +9772,42 @@ void case_993() } void case_994() -#line 6781 "cs-parser.jay" +#line 6776 "cs-parser.jay" { ((Linq.AQueryClause)yyVals[-3+yyTop]).Tail.Next = (Linq.AQueryClause)yyVals[0+yyTop]; yyVal = yyVals[-3+yyTop]; } void case_996() -#line 6793 "cs-parser.jay" +#line 6788 "cs-parser.jay" { yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_997() -#line 6798 "cs-parser.jay" +#line 6793 "cs-parser.jay" { yyVal = new Linq.OrderByDescending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_999() -#line 6810 "cs-parser.jay" +#line 6805 "cs-parser.jay" { yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_1000() -#line 6815 "cs-parser.jay" +#line 6810 "cs-parser.jay" { yyVal = new Linq.ThenByDescending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_1002() -#line 6825 "cs-parser.jay" +#line 6820 "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*/ @@ -9830,10 +9825,10 @@ void case_1002() } void case_1003() -#line 6841 "cs-parser.jay" +#line 6836 "cs-parser.jay" { var current_block = linq_clause_blocks.Pop (); - var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; + var lt = (LocatedToken) yyVals[-2+yyTop]; var rv = new Linq.RangeVariable (lt.Value, lt.Location); yyVal = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, null, rv, GetLocation (yyVals[-3+yyTop])) { next = (Linq.AQueryClause)yyVals[0+yyTop] @@ -9841,7 +9836,7 @@ void case_1003() } void case_1006() -#line 6868 "cs-parser.jay" +#line 6863 "cs-parser.jay" { current_container = current_type = new Class (current_container, new MemberName (""), Modifiers.PUBLIC, null); @@ -9871,7 +9866,7 @@ void case_1006() } void case_1007() -#line 6896 "cs-parser.jay" +#line 6891 "cs-parser.jay" { --lexer.parsing_block; Method method = (Method) oob_stack.Pop (); @@ -9883,7 +9878,7 @@ void case_1007() } void case_1017() -#line 6939 "cs-parser.jay" +#line 6934 "cs-parser.jay" { module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)yyVals[-1+yyTop]; module.DocumentationBuilder.ParsedParameters = (List)yyVals[0+yyTop]; @@ -9891,23 +9886,23 @@ void case_1017() } void case_1018() -#line 6945 "cs-parser.jay" +#line 6940 "cs-parser.jay" { module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)yyVals[-3+yyTop]; module.DocumentationBuilder.ParsedParameters = (List)yyVals[0+yyTop]; - var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var lt = (LocatedToken) yyVals[-1+yyTop]; yyVal = new MemberName (lt.Value); } void case_1021() -#line 6960 "cs-parser.jay" +#line 6955 "cs-parser.jay" { module.DocumentationBuilder.ParsedParameters = (List)yyVals[-1+yyTop]; yyVal = new MemberName ((MemberName) yyVals[-6+yyTop], MemberCache.IndexerNameAlias, Location.Null); } void case_1022() -#line 6965 "cs-parser.jay" +#line 6960 "cs-parser.jay" { var p = (List)yyVals[0+yyTop] ?? new List (1); p.Add (new DocumentationParameter ((FullNamedExpression) yyVals[-1+yyTop])); @@ -9917,7 +9912,7 @@ void case_1022() } void case_1023() -#line 6973 "cs-parser.jay" +#line 6968 "cs-parser.jay" { var p = (List)yyVals[0+yyTop] ?? new List (1); p.Add (new DocumentationParameter ((FullNamedExpression) yyVals[-1+yyTop])); @@ -9927,7 +9922,7 @@ void case_1023() } void case_1024() -#line 6981 "cs-parser.jay" +#line 6976 "cs-parser.jay" { var p = (List)yyVals[0+yyTop] ?? new List (1); module.DocumentationBuilder.ParsedParameters = p; @@ -9936,7 +9931,7 @@ void case_1024() } void case_1032() -#line 7019 "cs-parser.jay" +#line 7014 "cs-parser.jay" { var parameters = new List (); parameters.Add ((DocumentationParameter) yyVals[0+yyTop]); @@ -9944,7 +9939,7 @@ void case_1032() } void case_1033() -#line 7025 "cs-parser.jay" +#line 7020 "cs-parser.jay" { var parameters = yyVals[-2+yyTop] as List; parameters.Add ((DocumentationParameter) yyVals[0+yyTop]); @@ -9952,7 +9947,7 @@ void case_1033() } void case_1034() -#line 7034 "cs-parser.jay" +#line 7029 "cs-parser.jay" { if (yyVals[-1+yyTop] != null) yyVal = new DocumentationParameter ((Parameter.Modifier) yyVals[-1+yyTop], (FullNamedExpression) yyVals[0+yyTop]); @@ -9970,54 +9965,54 @@ void case_1034() 9, 9, 10, 10, 34, 32, 37, 33, 33, 33, 33, 35, 35, 35, 36, 36, 41, 38, 39, 40, 40, 42, 42, 42, 42, 42, 43, 43, 43, 47, - 44, 46, 49, 49, 49, 50, 50, 51, 51, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 67, 69, 71, 72, 73, 28, 28, 76, - 53, 53, 77, 77, 78, 78, 79, 81, 75, 75, - 80, 80, 86, 54, 90, 54, 54, 85, 93, 85, - 87, 87, 94, 94, 95, 96, 95, 91, 91, 97, - 97, 98, 99, 89, 89, 92, 92, 92, 102, 55, - 105, 106, 100, 107, 108, 109, 100, 100, 100, 101, - 101, 104, 104, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 113, 113, 116, 116, 116, 116, 119, - 116, 117, 117, 120, 120, 121, 121, 121, 114, 114, - 114, 122, 122, 122, 115, 124, 126, 127, 56, 129, - 130, 131, 58, 125, 125, 125, 125, 125, 135, 132, - 136, 133, 134, 134, 134, 137, 138, 139, 141, 29, - 29, 140, 140, 142, 142, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 146, 59, 145, 145, 147, 147, - 150, 144, 144, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 152, 151, 153, 151, 151, - 151, 60, 156, 158, 154, 155, 155, 157, 157, 162, - 160, 163, 160, 160, 160, 164, 61, 166, 57, 169, - 170, 57, 57, 165, 172, 165, 167, 167, 173, 173, - 174, 175, 174, 176, 171, 168, 168, 168, 168, 168, - 180, 177, 181, 178, 179, 179, 62, 63, 183, 185, - 186, 30, 182, 182, 182, 184, 184, 184, 187, 187, - 188, 189, 188, 188, 188, 190, 191, 192, 31, 193, - 193, 16, 16, 194, 194, 197, 196, 196, 196, 198, - 198, 200, 66, 123, 103, 103, 128, 128, 201, 201, - 201, 199, 199, 202, 202, 203, 203, 205, 205, 84, - 74, 74, 88, 88, 118, 118, 148, 148, 206, 206, - 206, 206, 206, 210, 210, 211, 209, 209, 209, 209, - 209, 209, 209, 212, 212, 212, 212, 212, 212, 212, - 212, 212, 213, 213, 213, 213, 213, 213, 213, 213, - 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, - 213, 213, 214, 214, 214, 215, 215, 215, 235, 235, - 236, 236, 237, 237, 217, 217, 234, 234, 234, 234, - 234, 234, 234, 234, 219, 219, 219, 239, 239, 240, - 240, 241, 241, 243, 243, 243, 244, 244, 244, 244, - 244, 244, 245, 245, 161, 161, 238, 238, 238, 238, - 238, 250, 250, 249, 249, 251, 251, 251, 251, 252, - 220, 220, 220, 248, 248, 253, 253, 255, 255, 221, - 222, 222, 223, 224, 225, 225, 216, 216, 216, 216, - 216, 260, 256, 226, 261, 261, 262, 262, 263, 263, - 264, 264, 264, 264, 257, 257, 207, 207, 259, 259, - 265, 265, 258, 258, 83, 83, 266, 266, 267, 227, - 268, 268, 268, 269, 269, 269, 269, 269, 270, 195, - 228, 228, 229, 229, 230, 230, 231, 272, 232, 273, - 232, 271, 271, 275, 274, 218, 276, 276, 276, 276, + 44, 46, 49, 49, 49, 51, 51, 52, 52, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 68, 70, 72, 73, 74, 28, 28, 77, + 54, 54, 78, 78, 79, 79, 80, 82, 76, 76, + 81, 81, 87, 55, 91, 55, 55, 86, 94, 86, + 88, 88, 95, 95, 96, 97, 96, 92, 92, 98, + 98, 99, 100, 90, 90, 93, 93, 93, 103, 56, + 106, 107, 101, 108, 109, 110, 101, 101, 101, 102, + 102, 105, 105, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 114, 114, 117, 117, 117, 117, 120, + 117, 118, 118, 121, 121, 122, 122, 122, 115, 115, + 115, 123, 123, 123, 116, 125, 127, 128, 57, 130, + 131, 132, 59, 126, 126, 126, 126, 126, 136, 133, + 137, 134, 135, 135, 135, 138, 139, 140, 142, 29, + 29, 141, 141, 143, 143, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 147, 60, 146, 146, 148, 148, + 151, 145, 145, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 153, 152, 154, 152, 152, + 152, 61, 157, 159, 155, 156, 156, 158, 158, 163, + 161, 164, 161, 161, 161, 165, 62, 167, 58, 170, + 171, 58, 58, 166, 173, 166, 168, 168, 174, 174, + 175, 176, 175, 177, 172, 169, 169, 169, 169, 169, + 181, 178, 182, 179, 180, 180, 63, 64, 184, 186, + 187, 30, 183, 183, 183, 185, 185, 185, 188, 188, + 189, 190, 189, 189, 189, 191, 192, 193, 31, 194, + 194, 16, 16, 195, 195, 198, 197, 197, 197, 199, + 199, 201, 67, 124, 104, 104, 129, 129, 202, 202, + 202, 200, 200, 203, 203, 204, 204, 206, 206, 85, + 75, 75, 89, 89, 119, 119, 149, 149, 207, 207, + 207, 207, 207, 211, 211, 212, 210, 210, 210, 210, + 210, 210, 210, 213, 213, 213, 213, 213, 213, 213, + 213, 213, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 215, 215, 215, 216, 216, 216, 236, 236, + 237, 237, 238, 238, 218, 218, 235, 235, 235, 235, + 235, 235, 235, 235, 220, 220, 220, 240, 240, 241, + 241, 242, 242, 244, 244, 244, 245, 245, 245, 245, + 245, 245, 246, 246, 162, 162, 239, 239, 239, 239, + 239, 251, 251, 250, 250, 252, 252, 252, 252, 253, + 221, 221, 221, 249, 249, 254, 254, 255, 255, 222, + 223, 223, 224, 225, 226, 226, 217, 217, 217, 217, + 217, 260, 256, 227, 261, 261, 262, 262, 263, 263, + 264, 264, 264, 264, 257, 257, 208, 208, 259, 259, + 265, 265, 258, 258, 84, 84, 266, 266, 267, 228, + 268, 268, 268, 269, 269, 269, 269, 269, 270, 196, + 229, 229, 230, 230, 231, 231, 232, 272, 233, 273, + 233, 271, 271, 275, 274, 219, 276, 276, 276, 276, 276, 276, 276, 276, 276, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 278, 278, 278, 278, 278, 278, 278, 279, 279, 279, 279, 279, @@ -10027,21 +10022,21 @@ void case_1034() 285, 285, 286, 286, 286, 287, 287, 287, 288, 288, 289, 289, 289, 289, 289, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 291, 291, 292, 292, - 292, 292, 293, 293, 295, 294, 294, 294, 254, 254, + 292, 292, 293, 293, 295, 294, 294, 294, 50, 50, 297, 296, 298, 296, 299, 296, 300, 301, 296, 302, - 303, 296, 45, 45, 246, 246, 246, 246, 233, 233, - 233, 82, 305, 306, 307, 308, 309, 27, 65, 65, - 64, 64, 110, 110, 310, 310, 310, 310, 310, 310, - 310, 310, 310, 310, 310, 310, 310, 310, 310, 68, - 68, 68, 70, 70, 311, 311, 312, 312, 313, 313, - 314, 314, 314, 314, 204, 204, 315, 315, 317, 111, - 318, 318, 319, 159, 159, 321, 320, 316, 316, 322, + 303, 296, 45, 45, 247, 247, 247, 247, 234, 234, + 234, 83, 305, 306, 307, 308, 309, 27, 66, 66, + 65, 65, 111, 111, 310, 310, 310, 310, 310, 310, + 310, 310, 310, 310, 310, 310, 310, 310, 310, 69, + 69, 69, 71, 71, 311, 311, 312, 312, 313, 313, + 314, 314, 314, 314, 205, 205, 315, 315, 317, 112, + 318, 318, 319, 160, 160, 321, 320, 316, 316, 322, 322, 323, 323, 323, 323, 323, 327, 327, 328, 328, 328, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 343, 343, 343, 343, 330, 344, 326, 345, 345, 346, 346, 346, 346, - 346, 346, 208, 208, 347, 48, 48, 349, 324, 353, + 346, 346, 209, 209, 347, 48, 48, 349, 324, 353, 324, 351, 351, 348, 348, 348, 350, 350, 357, 357, 356, 356, 358, 358, 352, 352, 354, 354, 359, 359, 360, 355, 355, 355, 331, 331, 331, 342, 342, 361, @@ -10063,7 +10058,7 @@ void case_1034() 431, 432, 433, 423, 430, 430, 435, 424, 434, 438, 434, 437, 440, 437, 436, 436, 436, 439, 439, 439, 415, 441, 415, 3, 3, 442, 3, 3, 443, 443, - 247, 247, 242, 242, 5, 444, 444, 444, 444, 448, + 248, 248, 243, 243, 5, 444, 444, 444, 444, 448, 444, 444, 444, 444, 445, 445, 446, 449, 446, 447, 447, 450, 450, 451, }; @@ -10251,7 +10246,7 @@ void case_1034() 0, 163, 0, 0, 0, 174, 549, 0, 930, 0, 881, 862, 0, 872, 0, 883, 0, 899, 837, 0, 929, 0, 0, 504, 0, 520, 522, 0, 0, 0, - 459, 0, 0, 454, 0, 0, 660, 659, 0, 484, + 459, 0, 0, 454, 0, 0, 660, 659, 484, 0, 524, 498, 0, 0, 148, 525, 146, 147, 527, 0, 542, 541, 840, 0, 919, 0, 912, 0, 916, 533, 0, 0, 0, 368, 0, 531, 0, 0, 545, 937, @@ -10340,28 +10335,28 @@ void case_1034() 12, 13, 52, 22, 23, 326, 235, 724, 900, 1099, 1218, 1265, 1575, 897, 236, 237, 238, 239, 240, 241, 242, 243, 717, 462, 718, 719, 1003, 720, 721, 1007, - 898, 1094, 1095, 1096, 267, 618, 1190, 110, 909, 1294, - 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, - 1305, 1306, 1307, 481, 728, 1383, 1017, 1197, 1161, 1230, - 1258, 1323, 1395, 1226, 1449, 1426, 1474, 1475, 1476, 1019, - 1472, 1020, 788, 901, 1437, 1410, 1462, 534, 1455, 1431, - 1491, 983, 1460, 1463, 1464, 1559, 1492, 1493, 1489, 1308, - 1364, 1334, 1384, 741, 1439, 1538, 1407, 1495, 1568, 482, - 268, 742, 743, 744, 745, 746, 704, 591, 1202, 705, - 706, 915, 1386, 1415, 1506, 1467, 1540, 1387, 1442, 1543, - 1588, 1507, 1508, 1586, 1572, 1573, 1015, 1160, 1257, 1320, - 1368, 1321, 1322, 1358, 1422, 1390, 1359, 329, 223, 1471, - 1361, 1456, 1453, 1309, 1338, 1379, 1535, 1497, 1339, 1536, - 619, 1581, 1582, 1378, 1452, 1428, 1484, 1479, 1450, 1516, - 1521, 1482, 1485, 1486, 1567, 1522, 1480, 1481, 1577, 1565, - 1566, 1012, 1103, 1223, 1195, 1250, 1224, 1225, 1268, 1157, - 1247, 1281, 554, 193, 112, 366, 195, 584, 457, 224, - 1402, 702, 703, 885, 902, 330, 422, 553, 305, 1227, - 1228, 45, 114, 306, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 253, 860, 784, 1056, 1046, - 772, 939, 773, 774, 1047, 137, 198, 779, 621, 622, - 623, 854, 491, 780, 492, 298, 1054, 782, 423, 300, + 898, 1094, 1095, 1096, 267, 618, 1190, 110, 909, 779, + 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, + 1304, 1305, 1306, 1307, 481, 728, 1383, 1017, 1197, 1161, + 1230, 1258, 1323, 1395, 1226, 1449, 1426, 1474, 1475, 1476, + 1019, 1472, 1020, 788, 901, 1437, 1410, 1462, 534, 1455, + 1431, 1491, 983, 1460, 1463, 1464, 1559, 1492, 1493, 1489, + 1308, 1364, 1334, 1384, 741, 1439, 1538, 1407, 1495, 1568, + 482, 268, 742, 743, 744, 745, 746, 704, 591, 1202, + 705, 706, 915, 1386, 1415, 1506, 1467, 1540, 1387, 1442, + 1543, 1588, 1507, 1508, 1586, 1572, 1573, 1015, 1160, 1257, + 1320, 1368, 1321, 1322, 1358, 1422, 1390, 1359, 329, 223, + 1471, 1361, 1456, 1453, 1309, 1338, 1379, 1535, 1497, 1339, + 1536, 619, 1581, 1582, 1378, 1452, 1428, 1484, 1479, 1450, + 1516, 1521, 1482, 1485, 1486, 1567, 1522, 1480, 1481, 1577, + 1565, 1566, 1012, 1103, 1223, 1195, 1250, 1224, 1225, 1268, + 1157, 1247, 1281, 554, 193, 112, 366, 195, 584, 457, + 224, 1402, 702, 703, 885, 902, 330, 422, 553, 305, + 1227, 1228, 45, 114, 306, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, 134, 135, 136, 253, 860, 784, 1056, + 1046, 772, 939, 773, 774, 1047, 137, 198, 780, 621, + 622, 623, 854, 491, 492, 298, 1054, 782, 423, 300, 517, 518, 519, 520, 523, 790, 314, 807, 808, 955, 264, 497, 822, 265, 496, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, @@ -10384,376 +10379,376 @@ void case_1034() 709, }; protected static readonly short [] yySindex = { -69, - 0, -197, 55, -20, 16, 1599, 0, 135, 0, 0, - 16, -20, 0, 0, 129, 0, 6984, 16, 0, -180, + 0, -197, 55, -20, 138, 1599, 0, 135, 0, 0, + 138, -20, 0, 0, -93, 0, 6984, 138, 0, -180, -262, 0, 0, 0, 0, 0, 0, 0, 101, 0, - 296, 0, 0, 0, 999, 0, 0, 0, 0, 0, - 0, 0, 0, 572, 0, 0, 662, 0, 0, 135, - 48, 16, 0, 230, 0, 242, 251, -174,16437, -162, - 278, 313, 7141, 0, 278, 278, 278, -171, 278, 278, - -42, 0, 8985, 278, 278, 0, 9142, 0, 374, 0, - -156, 0, 278, 365, 278, 0,16981,16981, 412, 278, - 278, 17,10058, 0,15540, 0,10189,10320,10451,10582, -10713,10844,10975,11106, 0, 336, 0, 7943, 0, 174, - 0, 218, -244, 939, -247, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1167, 861, - 208, 705, 664, 897, 420, 428, 442, 437, 451, 492, + 211, 0, 0, 0, 999, 0, 0, 0, 0, 0, + 0, 0, 0, 662, 0, 0, 737, 0, 0, 135, + 167, 138, 0, 319, 0, 385, 349, -174,16458, -162, + 378, 268, 7141, 0, 378, 378, 378, -171, 378, 378, + 768, 0, 8985, 378, 378, 0, 9142, 0, 396, 0, + -156, 0, 378, 397, 378, 0,17002,17002, 493, 378, + 378, 17,10215, 0,15697, 0,10346,10477,10608,10739, +10870,11001,11132,11263, 0, 269, 0, 7943, 0, 174, + 0, 229, -244, 939, -247, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1167, 817, + 208, 596, 664, 829, 453, 556, 497, 521, 421, 653, 0, 0, 0, 0, 0, 0, 3497, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 218, 557, 219, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 226, 362, 48, 0, - 540, 706, 0, 535, 0, 0, 0, 0, 7943, 7943, + 0, 229, 682, 297, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 226, 362, 167, 0, + 545, 625, 0, 638, 0, 0, 0, 0, 7943, 7943, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 604, 568, 0, 573, 0, -5, 0, 0, - 0, 48,17517, 859, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 742, 218,15676, 0, 0, 0, - 0, 0,15540, -163, -153, 736, -282, 939, 218, 0, + 0, 0, 692, 675, 0, 711, 0, -5, 0, 0, + 0, 167,17538, 880, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 886, 229,15833, 0, 0, 0, + 0, 0,15697, -163, -153, 884, -282, 939, 229, 0, 0, 7943, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -191, -252,16437, 0, 7943,15540, 672, - 0, 0, 714,15540,15540,13857, 741, -165, 762, 8100, - 0,10058, 336, 886, 788, 0, 807, 7943,15540, 0, - 0, 817, 656, 278, 0, 0,15540, 374,15132, 0, - 0, 365,15540, 365, 82, 467, 877, 218, 0, 557, - -247, 906, 218,15540,15540,15540, 313, 0, 881, 0, - 0,11237, 0, 7298, -277, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 3903, 0, 0,16834, 82, 860, 863, -15540, 0, 821, 0, 139, 0, 0, 146, 0, 0, - 834, 9299, 7612, 0, 0,15540,15540,15540,15540,15540, -15540,15540,15540,15540,15540,15540,11368,11499,11630, 4062, - 4380,11761,11892,12023,12154,12285,12416,12547,12678,12809, -12940,13071,13202,13333,13464,13595,16220,15540, 0, 0, - 0, 0, 557, 0, 0, 0, 0,16981,16981, 0, - 0, 218, 0, 0, 0, 0, 384, 889, 0, 0, - 0, 0, 0, 0, 0, 48, 859, 837, 0, 855, - 0, 821, 604, 604, 0, -53, 0, 590, 604, 891, - 0, -195,17517, 0, 0, 0, 0, -150, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 261,17547, 0, 0, 0, 0, 821, 0, 0, 901, - 751, 0, 907, 0, 911, 222, 374, 0, 278, 0, - 0, 0, 218,15132, -179, 0, 940, 0, 0, 0, - 54, 103, 0, -282, 944, 0, 919, 0, 947, 0, - 0, 0, 760, 0, 8355, 766, 9456, 762,14996, 0, - 7769, 0, 365, 0, 0, 0, 0, 143, 147, 0, - 0, 293, 374, 649, 0, 828, 986, 0, 148, 218, - 0, 151, 0, 0, 0,15540, 1053, 0, 0, 0, -15540, 1072, 994, 0, 998, 1018, 0,16834, 0, 75, - 0, -172, 43, 7298, 0, 0, 0, 0, 0, 0, - 75, 0, 0, -272, 0, 0, 0, 365, 0, 82, - 218, 8531, 0, 1029, 0, 1033,13726, 0, 1150, 1031, - 7298, 0, 980, 0, 821, 984, 0, 821, 821, 0, - 137, 0,15540,15540, 1040, 1157, 0, 0, 108, -78, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 861, 0, 861, 0, 208, - 0, 208, 0, 705, 0, 705, 0, 705, 0, 705, - 0, 664, 0, 664, 0, 897, 0, 420, 0, 428, - 0, 442, 0, 437, 0, 68, -141, 0, 9456, 1122, - 218, 1123, 218, 9456, 9456, 1038,15540, 0, 0, 889, - 0, 218, 0, 780, 821, 0, 0, 0, 0, 630, - 48, 306, 0, 8531, 590, 0, 1048, 1047, 0, 0, - 0, 0, 0, 0, -80, 1049, 0, 1050, 1054, 0, - 0, 0, 0, 1051, 8688, 1005, 0, 466, 0, 0, - 737, 0,15676, 0, 1046, 0, 0, 0, 686, 107, - 1057, 0, 1056, 1058, 1061, 0, 0,15540, 0, 218, - 0, 0, 309, 0, 1062, 0, 469, 0, 0, 7141, - 0, 7141, 8514, 0,13857, 0, 0, 9927, 8671, 329, - 0, 175, 91, 0, 1002, 1014, 0, 0, 800, 0, - 0, 0, 1069, 1068, 0, 0, 0, 0, 0, 1070, - 0, 0, 0, 1079, 0, 4539, 0, 374, 0, 0, - 365, 560, 1028, 0, 281, 0, 1078, 1080, 0, 0, - 7141, 0, 0, 7141, 0,15540, 0,15540, 7943, 0, - 0, 374, 1082, 75, 0, 0, 0,15540, 0, 0, - 0, 0, 0, 0, 7943, 0, 0, 218,16834, 1108, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0,14860, 0, 0, 0, 0, - 0, 7926, 0, 8828, 0, 8083, 1084, 0, 0, 1158, - 0, 1162, 0, 0, 0, 946, 0, 1085, 0, 0, - 0, 0, 0, 0, 1042, 0, -53, 0, 0, 0, - 0, 590, 590, 0, 0, 837, 1092, 1093, 1045, 1098, - 1005, 0, 1094, 0, 1212, 1214, 0, 0,15540, 0, -15268, 1097, 686, 8531, 7943, 0, 0, 152, 1217, 1218, - 154, 1095, 0, 0, 0,15540, 0,15540, 1195, 0, - 0, 0,15404, 0, 635,15404, 0, 0, 0, 0, - 8219, 0, 1221, 557, 9456, 1111, 8514, 1112, 0, 0, - 218, 0, 308, 0, 0, 821, 1028, 0, 218, 0, - -121, 0, 0, 0, 1107, 0, 1139, 0, 0, 0, - 0, 0, 0, 0, 682, 0, 0, 0, 0, 0, - 0, 8100, 0, 0, 218, -246, 1084, 0, 9456, 0, + 0, 0, 0, -191, -252,16458, 0, 7943,15697, 807, + 0, 0, 820,15697,15697,14014, 478, -165, 804, 8100, + 0,10215, 269, 930, 851, 0, 856, 7943,15697, 0, + 0, 859, 531, 378, 0, 0,15697, 396,15289, 0, + 0, 397,15697, 397, 413, 467, 899, 229, 0, 682, + -247, 945, 229,15697,15697,15697, 268, 0, 909, 0, + 0,11394, 0, 7298, -277, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3903, 0, 0,16855, 413, 883, 897, +15697, 0, 846, 0, 139, 0, 0, 225, 0, 0, + 858, 9299, 7612, 0, 0,15697,15697,15697,15697,15697, +15697,15697,15697,15697,15697,15697,11525,11656,11787, 4062, + 4380,11918,12049,12180,12311,12442,12573,12704,12835,12966, +13097,13228,13359,13490,13621,13752,16241,15697, 0, 0, + 0, 0, 682, 0, 0, 0, 0,17002,17002, 0, + 0, 229, 0, 0, 0, 0, 384, 923, 0, 0, + 0, 0, 0, 0, 0, 167, 880, 865, 0, 903, + 0, 846, 692, 692, 0, -53, 0, 575, 692, 918, + 0, -195,17538, 0, 0, 0, 0, -150, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 195,17568, 0, 0, 0, 0, 846, 0, 0, 942, + 639, 0, 974, 0, 986, 253, 396, 0, 378, 0, + 0, 0, 229,15289, -179, 0, 949, 0, 0, 0, + 54, 103, 0, -282, 982, 0, 996, 0, 992, 0, + 0, 0, 680, 0, 8355, 695, 9456, 804,15153, 0, + 7769, 0, 397, 0, 0, 0, 0, 143, 147, 0, + 0, 278, 396, 252, 0, 828, 998, 0, 148, 229, + 0, 151, 0, 0, 0,15697, 1074, 0, 0, 0, +15697, 1096, 1025, 0, 1028, 1031, 0,16855, 0, 75, + 0, -172, 215, 7298, 0, 0, 0, 0, 0, 0, + 75, 0, 0, -272, 0, 0, 0, 397, 0, 413, + 229, 8531, 0, 1032, 0, 1033,13883, 0, 1151, 1035, + 7298, 0, 980, 0, 846, 985, 0, 846, 846, 0, + 137, 0,15697,15697, 1041, 1160, 0, 0, 145, -78, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 817, 0, 817, 0, 208, + 0, 208, 0, 596, 0, 596, 0, 596, 0, 596, + 0, 664, 0, 664, 0, 829, 0, 453, 0, 556, + 0, 497, 0, 521, 0, 68, -141, 0, 9456, 1123, + 229, 1125, 229, 9456, 9456, 1039,15697, 0, 0, 923, + 0, 229, 0, 706, 846, 0, 0, 0, 0, 532, + 167, 331, 0, 8531, 575, 0, 1049, 1048, 0, 0, + 0, 0, 0, 0, -80, 1050, 0, 1052, 1051, 0, + 0, 0, 0, 1055, 8688, 1006, 0, 466, 0, 0, + 697, 0,15833, 0, 1054, 0, 0, 0, 686, 162, + 1057, 0, 1056, 1058, 1062, 0, 0,15697, 0, 229, + 0, 0, 739, 0, 1063, 0, 249, 0, 0, 7141, + 0, 7141, 8514, 0,14014, 0, 0,10084, 8671, 220, + 0, 234, 91, 0, 1002, 1018, 0, 0, 0, 751, + 0, 0, 1070, 1072, 0, 0, 0, 0, 0, 1075, + 0, 0, 0, 1077, 0, 4539, 0, 396, 0, 0, + 397, 568, 1029, 0, 261, 0, 1079, 1080, 0, 0, + 7141, 0, 0, 7141, 0,15697, 0,15697, 7943, 0, + 0, 396, 1082, 75, 0, 0, 0,15697, 0, 0, + 0, 0, 0, 0, 7943, 0, 0, 229,16855, 1109, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,15017, 0, 0, 0, 0, + 0, 7926, 0, 8828, 0, 8083, 1084, 0, 0, 1162, + 0, 1165, 0, 0, 0, 745, 0, 1086, 0, 0, + 0, 0, 0, 0, 1044, 0, -53, 0, 0, 0, + 0, 575, 575, 0, 0, 865, 1093, 1094, 1046, 1101, + 1006, 0, 1095, 0, 1213, 1215, 0, 0, 9456, 0, +15425, 1099, 686, 8531, 7943, 0, 0, 428, 1218, 1219, + 154, 1097, 0, 0, 0,15697, 0,15697, 1196, 0, + 0, 0,15561, 0, 43,15561, 0, 0, 0, 0, + 8219, 0, 1221, 682, 9456, 1112, 8514, 1114, 0, 0, + 229, 0, 291, 0, 0, 846, 1029, 0, 229, 0, + -121, 0, 0, 0, 1108, 0, 1140, 0, 0, 0, + 0, 0, 0, 0, 818, 0, 0, 0, 0, 0, + 0, 8100, 0, 0, 229, -246, 1084, 0, 9456, 0, 9456, 0, 90, 9456, 0, 0, 0, 728, 0, 0, - 0, 1113, 837, 0, 0, 9613, 0, 0, 0, 1114, - 4704, 0, 1005, 0, 1005, 0, 1005, 0, 0, 0, - 0, 218, 1110, 1097, 0, 0, 0, -167, -145, 1115, - 1116, 0, 0, 0, 0, 0, 1117, 8514, 1084, -141, -15540, 0, 1125, 7141, 0, 0, 0, 0, 0, 0, - 0, 1118, 0, 762, 0, 0, 0, 0, 0, -189, - 0, 1126, 821, 1028, 0, 1028, 0, 1084, 1128, 0, - 0, 75, 0, 1064, 1103, 0, 0, 0, 0, 0, - 9456, 1147, 9456, 0, 9456, 0, 0,15540, 0, 0, - 1054, 0, 406, 691, 0, 0, 0, 0, -20, 0, - 0, 0, 1135, 0, 0, 0, 1132, 0, 0, 0, - 519, 0, 1133, 1239, 1247, 0, 0, 1084, 1134, 1084, - 1143, 0, 1140, 0, 0, 0, 0, 0,15540, 0, - 1149, -217, 0, 6825, 0, 1263, 0, 0, 0, 0, - 75, 0,15540, 8083, 0, 0, 1174, 0, 975, 1148, - 0, 1155, 0, 0, 9613, 16, 222, 0, 1151, 1151, - 1151,15268, 1159, 0,15540, 0, 0, 0, 0, 0, - 0, 7141, 77, 0, 0, 7298, 0, 0, 1160, 7141, - 0, 1161, 0, 9456, 0, 0, 0, 0, 0,15540, - 0, 0, 48, 1166, 48, 7943, 1191, 1191, 1191, 0, - 0,15540, 0, 7141, 9770, 0, 0, 0, 0, 0, - 0, 0, 1185, 9456,15540, 0, 48, 1172, 0, 1127, - 977, 0, 0, 1169, 0, 0, 112, 0, 1131, 0, - 1191, 0, 0, 0, 0, 0, 0, 0, 1178, 1062, - 0, 7298, 0, 1193, 0, -160, 1191, 1288, 0, 1184, - 48, 0, 7943, 88, 1186, 0, 1187, 1190, 7141, 1192, - 9456, 0, 0, 0, 0, 0, 0, 1177, 1183, 0, - 0, 0,16516, 162, 48, 0, 0, 0, 1210, 9456, - 1203,15540, 0, 0, 0, 1209, 0, 0, 1207, 0, - 0,17547, 0, 1215, 162, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 588,17547, + 0, 1115, 865, 0, 0, 9613, 0, 0, 0, 1113, + 4704, 0, 1006, 0, 1006, 0, 1006, 0, 0, 0, + 0, 229, 1110, 1099, 0, 0, 0, -167, -145, 1116, + 1119, 0, 0, 0, 0, 0, 1111, 8514, 1084, -141, +15697, 0, 1117, 7141, 0, 0, 0, 0, 0, 0, + 0, 1118, 0, 804, 0, 0, 0, 0, 0, -189, + 0, 1122, 846, 1029, 0, 1029, 0, 1084, 1126, 0, + 0, 75, 0, 1083, 1121, 0, 0, 0, 0, 0, + 9456, 1148, 9456, 0, 9456, 0, 0,15697, 0, 0, + 1051, 0, 329, 834, 0, 0, 0, 0, -20, 0, + 0, 0, 1130, 0, 0, 0, 1132, 0, 0, 0, + 475, 0, 1133, 1244, 1247, 0, 0, 1084, 1143, 1084, + 1144, 0, 1141, 0, 0, 0, 0, 0,15697, 0, + 1153, -217, 0, 6825, 0, 1263, 0, 0, 0, 0, + 75, 0,15697, 8083, 0, 0, 1175, 0, 946, 1152, + 0, 1155, 0, 0, 9613, 138, 253, 0, 1154, 1154, + 1154,15425, 1157, 0,15697, 0, 0, 0, 0, 0, + 0, 7141, 77, 0, 0, 7298, 0, 0, 1163, 7141, + 0, 1161, 0, 9456, 0, 0, 0, 0, 0,15697, + 0, 0, 167, 1166, 167, 7943, 1194, 1194, 1194, 0, + 0,15697, 0, 7141, 9770, 0, 0, 0, 0, 0, + 0, 0, 1192, 9456,15697, 0, 167, 1173, 0, 1127, + 927, 0, 0, 1169, 0, 0, 112, 0, 1131, 0, + 1194, 0, 0, 0, 0, 0, 0, 0, 1172, 1063, + 0, 7298, 0, 1202, 0, -160, 1194, 1296, 0, 1185, + 167, 0, 7943, 88, 1187, 0, 1190, 1191, 7141, 1193, + 9456, 0, 0, 0, 0, 0, 0, 1178, 1184, 0, + 0, 0,16537, 166, 167, 0, 0, 0, 1210, 9456, + 1203,15697, 0, 0, 0, 1209, 0, 0, 1207, 0, + 0,17568, 0, 1214, 166, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 239,17568, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1216, - 48, 0, 162, 218, 0, 1210, 0, 0, 1189,16516, -16682, 0, 0, -240, 0, 0, 0, 0, 0,16714, - 0, 0, 1219, 0, 0, 0, 0, 7943, 7943, 368, - 8100, 449, 365, 1245, 0, 82,14714, 0, 1280, 0, - 0, 1183, 0, 0, 0, 7298,14752, 1183, 0, -139, - -138, 0, 7943, -128, 0, 7943, 0, 1168, 1220, 0, - 0, 82, 0, 49,14790, 0, 1223, 1170, 72, 574, - 999, 0, 1222, 0, 1183, 0, 0, 0, 82, 0, - 1226, 1171, 1224, 1225, 0, 1227, 1176, 1234, 222, 1242, - 1233, 0, 0, 1254, 1229, 0, 821, 0, 934, 0, + 167, 0, 166, 229, 0, 1210, 0, 0, 1211,16537, +16703, 0, 0, -240, 0, 0, 0, 0, 0,16735, + 0, 0, 1217, 0, 0, 0, 0, 7943, 7943, 510, + 8100, 538, 397, 1249, 0, 413,14871, 0, 1282, 0, + 0, 1184, 0, 0, 0, 7298,14909, 1184, 0, -139, + -138, 0, 7943, -128, 0, 7943, 0, 1170, 1220, 0, + 0, 413, 0, 107,14947, 0, 1223, 1171, 2, 104, + 999, 0, 1222, 0, 1184, 0, 0, 0, 413, 0, + 1226, 1176, 1224, 1225, 0, 1227, 1179, 1234, 253, 1242, + 1233, 0, 0, 1254, 1229, 0, 846, 0, 901, 0, 0, 0, 1256, 0, 0, -77, 0, 1243, 0, 0, - 1228, 0, 1257, 1259, 1260, 0, 1255, 0, 222, 222, - 0, 222, 1261, 1262, 0, 0, 0, 0, 1264, 166, - 0, 1266, 222, 1377, 1268, 222, 0, -240, 0, 8514, - 1230, 1267, 1255, 0, 1265, 1272, 199, 1275, 0, 0, - 222,15268, 1231, 1271, 1264, 0, 0,17547, 0, 48, - 48, 0, 1236, 1276, 1266, 0, 1279, 0,15540, 1237, - 1281, 1268, 0, 1284, 222, 0, 89, 0, 1277, 0, - 0, 0, 0, 0,17547, 0, 199, 199, 0, 1287, - 0, -77, 0, 0, 221, 1292,17547, 0,17547, 0, - 0, 8514, 1282, 0, 0, 0, 1291, 1228, 0, 0, - 0, 1290, 0, 338, 0, 0, 0, 1191, 988, 1296, - 0, 0, 1269, 0, 0, 0, 0, 0, 1353, 1406, - 0, 0, 0, 0, 0, 0, 1301, 1302, 8514, 0, - 0, 0, 0, 199, 611, 611, 0, 1191, 0, 0, + 1259, 0, 1258, 1260, 1261, 0, 1257, 0, 253, 253, + 0, 253, 1262, 1264, 0, 0, 0, 0, 1266, 199, + 0, 1268, 253, 1378, 1269, 253, 0, -240, 0, 8514, + 1230, 1271, 1257, 0, 1272, 1273, 212, 1279, 0, 0, + 253,15425, 1236, 1275, 1266, 0, 0,17568, 0, 167, + 167, 0, 1237, 1276, 1268, 0, 1284, 0,15697, 1239, + 1283, 1269, 0, 1286, 253, 0, 89, 0, 1255, 0, + 0, 0, 0, 0,17568, 0, 212, 212, 0, 1288, + 0, -77, 0, 0, 370, 1270,17568, 0,17568, 0, + 0, 8514, 1280, 0, 0, 0, 1292, 1259, 0, 0, + 0, 1291, 0, 339, 0, 0, 0, 1194, 984, 1300, + 0, 0, 1297, 0, 0, 0, 0, 0, 1354, 1409, + 0, 0, 0, 0, 0, 0, 1302, 1303, 8514, 0, + 0, 0, 0, 212, 536, 536, 0, 1194, 0, 0, 0, 58, 58, 0, 0, 0, 0, 0, 0, 0, -14996,14996, 0, 0, 0, 0, 0, 1306, 1303, 1305, +15153,15153, 0, 0, 0, 0, 0, 1307, 1305, 1310, 0, 0, 0, }; protected static readonly short [] yyRindex = { 3000, - 0, 0, 7455, 3000, 0, 0, 0, 1682, 0, 0, + 0, 0, 7455, 3000, 0, 0, 0, 1683, 0, 0, 3160, 1369, 0, 0, 0, 0, 0, 3160, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1683, 0, 0, 1683, 0, 0, 1682, + 0, 0, 0, 1684, 0, 0, 1684, 0, 0, 1683, 3203, 3043, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1317, 0, 0, 0, 0, 0, 0, 0, 0, - 8845, 0, 1309, 0, 0, 0, 1309, 0, 0, 0, - 0, 0, 0, 276, 0, 0, 0, 0, 0, 0, - 0, 0, 202, 0, 0, 0, 0, 0, 0, 0, + 0, 1318, 0, 0, 0, 0, 0, 0, 0, 0, + 8845, 0, 1311, 0, 0, 0, 1311, 0, 0, 0, + 0, 0, 0, 130, 0, 0, 0, 0, 0, 0, + 0, 0, 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4697, 0, 0, 0, 0, - 0, 0, 340, 4790, 4132, 0, 0, 0, 0, 0, + 0, 0, 417, 4790, 4132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4946, 5014, 5254, 5458, 5798, 6002, 6138, 6274, 6410, 6546, 4877, 523, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 327, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 359, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3246, 0, - 829, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 780, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1683, 57, 0, 0, 0, 0, 0, 0, - 0, 3289, 311, 3332, 0, 0, 0, 0, 0, 0, + 0, 0, 1684, 57, 0, 0, 0, 0, 0, 0, + 0, 3289, 422, 3332, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3743, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1319, 0, 0, 0, 0, - 0, 0, 3743, 1312, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1320, 0, 0, 0, 0, + 0, 0, 3743, 1313, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2373, 0, 2753, 256, 2503, 0, 0, 0, 1438, - 2503, 0, 0, 0, 0, 0, 1317, 0, 0, 0, - 0, 0, 0, 225, 0, 0, 0, 0, 0, 0, + 2503, 0, 0, 0, 0, 0, 1318, 0, 0, 0, + 0, 0, 0, 263, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1321, 2607, 0, 0, - 1309, 0, 3743, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 119, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1319, 2607, 0, 0, + 1311, 0, 3743, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1766, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2715, 0, 0, 0, 0, 0, 0, 0, 3375, 3418, 0, 0, 0, - 0, 2227, 1683, 1683, 0, 36, 0, 7629, 1683, 1689, + 0, 2227, 1684, 1684, 0, 36, 0, 7629, 1684, 1693, 0, 0, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 537,16369, 0, 0, 0, 0, 3743, 0, 0, 0, - 0, 0, 0, 0, 0,16758, 0, 0, 0, 0, - 0, 0, 0, 805, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 869, 677, 795, 0, 0, 1323, 0, - 0, 0, 0, 0, 253, 0, 0, 4220, 1325, 0, + 537,16390, 0, 0, 0, 0, 3743, 0, 0, 0, + 0, 0, 0, 0, 0,16779, 0, 0, 0, 0, + 0, 0, 0, 758, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 869, 668, 795, 0, 0, 1327, 0, + 0, 0, 0, 0, 264, 0, 0, 4220, 1325, 0, 0, 0, 594, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1934, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1321, 0,15812, - 0, 6665, 0, 254, 0, 0, 0, 0, 0, 0, -15812, 0, 0, 0, 0, 0, 0, 28, 0, 433, - 0, 0, 0, 1326, 0, 0, 0, 0, 1312, 0, + 0, 0, 0, 0, 0, 0, 0, 1319, 0,15969, + 0, 6665, 0, 312, 0, 0, 0, 0, 0, 0, +15969, 0, 0, 0, 0, 0, 0, 28, 0, 433, + 0, 0, 0, 1326, 0, 0, 0, 0, 1313, 0, 0, 0, 3584, 0, 3743, 3584, 0, 3743, 4379, 0, - 0, 0, 0, 0, -202, 0, 0, 0, 0, 127, + 0, 0, 0, 0, -202, 0, 0, 0, 0, 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5118, 0, 5186, 0, 5322, 0, 5390, 0, 5526, 0, 5594, 0, 5662, 0, 5730, 0, 5866, 0, 5934, 0, 6070, 0, 6206, 0, 6342, - 0, 6478, 0, 6602, 0, 0, 668, 0, 0, 0, + 0, 6478, 0, 6602, 0, 0, 607, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2715, - 0, 0, 0, 0, 2227, 0, 0, 0, 0, 1283, -14019, 0, 0, 0, 9002, 0, 0, 738, 0, 0, - 0, 0, 0, 0, 731, 699, 0, 0, 1333, 0, + 0, 0, 0, 0, 2227, 0, 0, 0, 0, 1285, +14176, 0, 0, 0, 9002, 0, 0, 839, 0, 0, + 0, 0, 0, 0, 731, 674, 0, 0, 1331, 0, 0, 0, 0, 1639, 0, 0, 0, 0, 0, 0, -15948, 0, 0, 0, 761, 0, 0, 0, 9159,16905, - 0, 0, 836, 839, 842, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 814, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1327, 0, 0, 0, 0, 3650, - 0, 0, 263, 0, 92, 3902, 0, 0, 0, 0, - 0, 0, 0, 1334, 0, 0, 0, 0, 0, 1340, + 9927, 0, 0, 0, 838, 0, 0, 0, 9159,16926, + 0, 0, 847, 875, 896, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 764, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1338, 0, 0, 0, 0, 3650, + 0, 0, 321, 0, 92, 3902, 0, 0, 0, 0, + 0, 0, 0, 1336, 0, 0, 0, 0, 0, 1341, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -273, 832, 0, 0, 0, 0, 0, 1337, 0, 0, + -273, 701, 0, 0, 0, 0, 0, 1340, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,15812, 0, 0, 0, 0, 0, 0, + 0, 0, 0,15969, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 480, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 574, 0, 0, 0, 0, 0, 0, 0, 0, -184, 0, 432, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, - 0, 9159, 7786, 0, 0, 1342, 0, 822, 0, 0, - 0, 0, 1343, 0, 1295, 1297, 0, 0, 0, 0, - 0, 1338, 9316, 0, 0, 0, 0,16937, 0, 0, - 0, 845, 0, 0, 0, 0, 0, 0, 2101, 0, + 0, 9159, 7786, 0, 0, 1343, 0, 800, 0, 0, + 0, 0, 1347, 0, 1298, 1299, 0, 0, 0, 0, + 0, 1334, 9316, 0, 0, 0, 0,16958, 0, 0, + 0, 900, 0, 0, 0, 0, 0, 0, 2101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 4061, 0, 4538, 1348, 0, 0, 0, + 0, 0, 0, 4061, 0, 4538, 1350, 0, 0, 0, 1057, 0, 0, 0, 0, 565, 0, 0, 0, 0, - 845, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 900, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 647, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 894, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 916, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1341, 0, 0, 0, 0, 0, 902, - 918, 0, 0, 0, 0, 0, 0, 0, 986, 748, + 0, 0, 0, 1339, 0, 0, 0, 0, 0, 921, + 941, 0, 0, 0, 0, 0, 0, 0, 998, 748, 1344, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 4220, 0, 0, 0, 0, 0, 1350, - 0, 0, 565, 0, 0, 983, 0, 986, 0, 0, - 0,15812, 0, 715, 720, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1333, 0,13858, 0, 0, 0, 0, 0,17029, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 777, 0, 810, 0, 0, 0, 0, 1347, 0, 827, - 1345, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1355, 0, 0, 0, 1357, 0, 0, 0, 0, -15812, 0, 0, 0, 0, 0, 0, 0, -164, 479, - 0, 0, 0, 0, 0,17105,16758, 0, 354, 354, - 354, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 4220, 0, 0, 0, 0, 0, 1351, + 0, 0, 565, 0, 0, 957, 0, 998, 0, 0, + 0,15969, 0, 715, 720, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1331, 0,14015, 0, 0, 0, 0, 0,17050, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 777, 0, 810, 0, 0, 0, 0, 1349, 0, 805, + 1348, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1355, 0, 0, 0, 1358, 0, 0, 0, 0, +15969, 0, 0, 0, 0, 0, 0, 0, -164, 479, + 0, 0, 0, 0, 0,17126,16779, 0, 576, 576, + 576, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,17210, 0, -245, 0, 1358, 1358, 1358, 0, - 0, 0, 0, 0, 1354, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0,17253, 0, 0, 0, -14322, 0, 0, 1359, 0, 0, 499, 0, 0, 0, - 612, 0, 0, 0, 0, 0, 0, 0, 0, 1356, - 0, 1364, 0, 0, 0, 3086, 1363, -243, 0, 0, - 279, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,17231, 0, -245, 0, 1359, 1359, 1359, 0, + 0, 0, 0, 0, 1356, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,17274, 0, 0, 0, +14479, 0, 0, 1364, 0, 0, 579, 0, 0, 0, + 591, 0, 0, 0, 0, 0, 0, 0, 0, 1361, + 0, 1366, 0, 0, 0, 3086, 1363, -243, 0, 0, + 209, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2911, 0, - 0, 0, 0,14124,14408, 0, 0, 0, 688, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 427, 0, - 0,16540, 0, 0,14223, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0,16608, + 0, 0, 0,14281,14565, 0, 0, 0, 688, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 557, 0, + 0,16561, 0, 0,14380, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,16629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -14502, 0,14124, 0, 0, 688, 0, 0, 0, 0, +14659, 0,14281, 0, 0, 688, 0, 0, 0, 0, 537, 0, 0, 0, 0, 0, 0, 0, 0, 537, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,14614, 587, 0,14544, 0, 0, 0,14676, - 0, 2911, 0, 0, 0, 1364, 0, 2911, 0, 0, + 0, 0,14771, 587, 0,14701, 0, 0, 0,14833, + 0, 2911, 0, 0, 0, 1366, 0, 2911, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 285, 0, 1366, 0, 0, 0, 0, 0, 0, + 0, 285, 0, 1360, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2911, 0, 0, 0, 849, 0, - 644, 0, 0, 0, 0, 0, 0, 0,16758, 917, - 0, 0, 0, 0, 0, 0, 1361, 0, 394, 0, - 0, 0, 0, 0, 0, 0, 0, 937, 0, 0, - 0, 0, 0, 0, 0, 0, 1365, 0,16758,16758, - 0,16790, 0, 0, 0, 0, 0, 0, 1368,17477, - 0, 1370,16758,16084, 1375,16758, 0, 0, 0, 0, - 0, 0, 1378, 0, 0, 0,17447, 0, 0, 0, -16758, 0, 0, 0, 1380, 0, 0, 380, 0,17371, -17409, 0, 0, 0, 1381, 0, 0, 0, 0, 0, - 0, 1382, 0, 0,16758, 0, 591, 0, 941, 0, - 0, 0, 0, 0, 996, 0,17295,17333, 0, 0, - 0, 0, 0, 0, 0, 0, 1427, 0, 1490, 0, - 0, 0, 959, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 614, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,17447,16256,17147, 0, 614, 0, 0, + 644, 0, 0, 0, 0, 0, 0, 0,16779, 959, + 0, 0, 0, 0, 0, 0, 1368, 0, 394, 0, + 0, 0, 0, 0, 0, 0, 0, 965, 0, 0, + 0, 0, 0, 0, 0, 0, 1370, 0,16779,16779, + 0,16811, 0, 0, 0, 0, 0, 0, 1375,17498, + 0, 1377,16779,16105, 1380,16779, 0, 0, 0, 0, + 0, 0, 1381, 0, 0, 0,17468, 0, 0, 0, +16779, 0, 0, 0, 1382, 0, 0, 488, 0,17392, +17430, 0, 0, 0, 1384, 0, 0, 0, 0, 0, + 0, 1385, 0, 0,16779, 0, 588, 0, 966, 0, + 0, 0, 0, 0, 988, 0,17316,17354, 0, 0, + 0, 0, 0, 0, 0, 0, 1427, 0, 1481, 0, + 0, 0, 971, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 611, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,17468,16277,17168, 0, 611, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1325, 1325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; protected static readonly short [] yyGindex = { 0, - 0, 1710, 0, 0, 0, -2, -15, -177, -41, -38, - 0, 1749, 1757, 756, 0, 5, 0, 0, 0, 0, + 0, 1704, 0, 0, 0, -2, -15, -177, -41, -38, + 0, 1750, 1759, 669, 0, 5, 0, 0, 0, 0, 0, 0, -974, -751, -211, -326, 0, 0, 0, 0, - 0, -216, 0, 0, 0, 764, 0, 868, 0, 0, - 0, 0, 610, 613, -17, -232, 0, -46, 0, 446, - 0, 475, -804, -506, -495, -477, -440, -434, -432, -417, - 0,-1088, 0,-1202, 0, 13, 0, 203, 0,-1149, - 0, 0, 0, -79, 260, 0, 0, 0, 298,-1119, - 0, -275, -294, -330, 0, 0, 0, -942, 247, 0, - 0, -520, 0, 0, 315, 0, 0, 287, 0, 0, - 322, 0, -585, -887, 0, 0, 0, 0, 0,-1224, - -10, 0, 0, 865, 878, 879, 1059, -530, 0, 0, - -293, 890, 410, 0, -875, 0, 0, 0, 0, 0, - 0, 0, 0, 231, 0, 0, 0, 0, 0, 0, - 0, 0, 478, 0, 0, 0, 0, -309, 416, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -523, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 244, 0, 0, 330, 0, 0, 337, 344, 259, 0, - 0, 0, 0, 0, 0, 0, 0, 575, 0, 0, - 0, 0, -45, 0, 161, -161, 0, 0, 411, 0, - -741, 0, 942, 0, 1285, -296, -266, -60, 685, 0, - 589, 0, -33, 95, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -268, 0, 1253, 0, -348, 0, -271, - 0, 0, 0, 899, 905, -300, -124, 1074, 0, 982, - 0, 1232, 1463, -604, 1119, 0, 0, 793, 1777, 0, - 0, 0, 0, 1088, 0, 0, 0, 0, 0, -452, - 1512, 0, 0, 0, 0, 0, 1205, 970, 995, 933, - 964, 1443, 1437, 1444, 1445, 1446, 0, 1442, 0, 0, - 0, 1024, 1300, -543, 0, 0, 0, 0, 0, 0, + 0, -216, 0, 0, 0, 762, 0, 871, 0, 0, + 0, 0, 613, 614, -17, -232, 0, -46, 0, -604, + 447, 0, 477, -924, -779, -639, -594, -455, -434, -417, + -386, 0,-1088, 0,-1202, 0, 13, 0, 200, 0, +-1149, 0, 0, 0, -79, 266, 0, 0, 0, 298, +-1119, 0, -275, -294, -352, 0, 0, 0, -942, 247, + 0, 0, -520, 0, 0, 316, 0, 0, 288, 0, + 0, 323, 0, -454, -887, 0, 0, 0, 0, 0, +-1224, -10, 0, 0, 878, 879, 881, 1059, -530, 0, + 0, -293, 870, 436, 0,-1017, 0, 0, 0, 0, + 0, 0, 0, 0, 230, 0, 0, 0, 0, 0, + 0, 0, 0, 483, 0, 0, 0, 0, -309, 420, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -523, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 248, 0, 0, 333, 0, 0, 343, 345, 260, + 0, 0, 0, 0, 0, 0, 0, 0, 578, 0, + 0, 0, 0, -45, 0, 161, -161, 0, 0, 411, + 0, -741, 0, 944, 0, 1294, -296, -266, -60, 685, + 0, 589, 0, -33, 95, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -268, 0, 1253, 0, -348, 0, + -271, 0, 0, 0, 902, 905, -300, -124, 1076, 0, + 987, 0, 1232, 1462, 1120, 0, 0, 794, 1776, 0, + 0, 0, 0, 1085, 0, 0, 0, 0, 0, -473, + 1515, 0, 0, 0, 0, 0, 1205, 953, 968, 793, + 964, 1443, 1445, 1446, 1444, 1447, 0, 1451, 0, 0, + 0, 1023, 1304, -543, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -286, 0, 0, 0, 0, -465, - 0, 639, 0, 541, 0,-1043, 0, 0, 0, 0, - 0, 739, -538, -16, -313, -1, 0, 1715, 0, 69, + 0, 640, 0, 540, 0,-1043, 0, 0, 0, 0, + 0, 741, -538, -16, -313, -1, 0, 1716, 0, 69, 0, 71, 87, 97, 136, 142, 144, 178, 205, 207, - 280, 0, -677, 0, -12, 0, 0, 835, 0, 757, - 0, 0, 0, 0, 732, -321, 811, -886, 0, 856, - -481, 0, 0, 0, 0, 0, 0, 752, 0, 749, + 280, 0, -677, 0, -12, 0, 0, 836, 0, 757, + 0, 0, 0, 0, 735, -355, 812, -886, 0, 860, + -481, 0, 0, 0, 0, 0, 0, 753, 0, 749, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 680, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 681, 0, 0, 0, 0, 0, 0, 0, 0, -32, 0, 1346, 0, 0, 0, - 925, 0, 0, 0, 0, 0, 0, -168, 0, 0, - 0, 0, 0, 1451, 1201, 0, 0, 0, 0, 1456, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 569, + 932, 0, 0, 0, 0, 0, 0, -168, 0, 0, + 0, 0, 0, 1454, 1198, 0, 0, 0, 0, 1458, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 571, 0, 0, 0, 0, 0, 0, 0, 0, 683, 0, - 0, 0, 0, 0, 0, -3, 1004, 0, 0, 0, - 1009, + 0, 0, 0, 0, 0, -3, 1008, 0, 0, 0, + 1010, }; protected static readonly short [] yyTable = { 109, 155, 18, 189, 535, 532, 783, 111, 328, 333, 233, @@ -10786,167 +10781,167 @@ void case_1034() 560, 506, 1113, 503, 592, 1515, 510, 512, 1397, 1399, 968, 557, 593, 376, 583, 559, 562, 577, 2, 1405, 696, 539, 164, 337, 1284, 862, 170, 846, 165, 547, - 166, 549, 1539, 1448, 1412, 510, 550, 548, 1011, 759, + 166, 549, 1539, 1448, 1018, 510, 550, 548, 1011, 759, 363, 16, 362, 1583, 1549, 231, 1550, 565, 566, 460, - 642, 644, 1393, 863, 296, 730, 297, 576, 605, 51, + 642, 644, 1393, 863, 54, 730, 1418, 576, 605, 51, 825, 608, 1207, 364, 167, 490, 490, 2, 600, 1152, 1055, 51, 578, 1272, 1533, 1084, 940, 1011, 681, 683, - 20, 846, 1511, 599, 3, 4, 5, 6, 761, 194, - 194, 168, 916, 169, 488, 617, 1125, 1252, 624, 625, + 1312, 846, 1511, 599, 3, 4, 5, 6, 761, 194, + 194, 168, 1412, 169, 488, 617, 1125, 1252, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 291, 115, 680, 682, 1028, 1080, 686, 1082, 1392, 1560, 1087, - 376, 48, 851, 1394, 593, 362, 1418, 376, 791, 376, + 376, 48, 851, 1394, 593, 362, 1312, 376, 791, 376, 676, 376, 793, 810, 233, 199, 813, 447, 1374, 1036, - 830, 890, 42, 115, 700, 804, 231, 1291, 1580, 1413, - 1425, 1477, 194, 362, 94, 760, 1058, 362, 449, 362, + 1048, 890, 42, 115, 700, 804, 945, 916, 1580, 1419, + 1425, 1291, 194, 362, 94, 760, 1058, 362, 449, 362, 362, 362, 362, 1584, 292, 338, 170, 362, 115, 370, 1085, 94, 864, 847, 1042, 376, 849, 850, 194, 697, - 698, 1208, 694, 51, 1504, 710, 749, 740, 757, 1011, - 194, 921, 1273, 1534, 941, 1011, 716, 797, 194, 400, - 1312, 831, 363, 6, 762, 231, 1145, 737, 1147, 858, - 1148, 426, 490, 1546, 485, 1253, 747, 371, 691, 1419, - 465, 750, 1030, 691, 1206, 364, 516, 691, 466, 803, - 489, 291, 1211, 812, 1065, 401, 852, 975, 291, 778, - 733, 617, 691, 787, 792, 797, 1312, 1117, 794, 811, - 231, 1435, 814, 485, 194, 1037, 1236, 194, 1142, 593, - 231, 795, 797, 882, 231, 1547, 859, 725, 815, 691, - 352, 726, 937, 817, 837, 592, 54, 465, 372, 796, - 802, 1465, 1466, 449, 1468, 466, 603, 576, 691, 826, - 194, 194, 738, 606, 427, 1487, 604, 231, 1494, 428, - 826, 429, 578, 607, 430, 431, 797, 432, 433, 1213, - 291, 1277, 691, 1510, 576, 402, 403, 691, 194, 194, - 231, 691, 738, 1556, 424, 853, 853, 1181, 115, 578, - 200, 1557, 727, 938, 593, 244, 691, 1532, 194, 1244, - 245, 1137, 347, 1138, 246, 1389, 1021, 426, 347, 1026, - 452, 739, 194, 1372, 347, 1389, 248, 347, 347, 977, - 453, 1541, 1542, 691, 870, 292, 872, 833, 792, 688, - 775, 347, 691, 291, 792, 880, 328, 425, 250, 362, - 942, 352, 691, 738, 434, 352, 1279, 347, 123, 94, - 123, 778, 1558, 250, 247, 123, 778, 778, 115, 876, - 291, 362, 1373, 347, 1057, 1326, 796, 1053, 362, 887, - 924, 452, 739, 263, 925, 535, 490, 989, 1574, 785, - 44, 453, 710, 792, 691, 115, 51, 251, 956, 352, - 427, 113, 340, 923, 1375, 428, 805, 429, 340, 936, - 430, 431, 251, 432, 433, 488, 951, 1118, 515, 363, - 710, 888, 427, 751, 927, 1063, 363, 428, 194, 429, + 698, 1208, 694, 51, 1477, 710, 749, 740, 757, 1011, + 194, 921, 1273, 1534, 941, 1011, 716, 1504, 194, 400, + 94, 725, 20, 6, 762, 726, 1145, 1413, 1147, 1420, + 1148, 426, 490, 1065, 485, 1253, 747, 371, 691, 1541, + 1542, 750, 792, 691, 1206, 1313, 516, 691, 792, 803, + 489, 291, 1211, 812, 927, 401, 852, 975, 737, 778, + 733, 617, 691, 787, 792, 200, 858, 1117, 794, 811, + 542, 1435, 814, 485, 194, 1037, 1236, 194, 1142, 593, + 231, 795, 797, 882, 231, 231, 727, 798, 815, 691, + 352, 1313, 928, 817, 837, 592, 1574, 792, 372, 796, + 802, 1465, 1466, 449, 1468, 797, 603, 576, 691, 826, + 194, 194, 362, 465, 427, 1487, 604, 231, 1494, 428, + 826, 429, 578, 859, 430, 431, 328, 432, 433, 1213, + 231, 1277, 830, 1510, 576, 402, 403, 291, 194, 194, + 1137, 291, 1138, 738, 1556, 853, 853, 1181, 115, 578, + 936, 937, 1557, 797, 593, 1335, 1336, 1532, 194, 1244, + 363, 362, 347, 466, 1337, 1389, 1021, 426, 347, 1026, + 465, 231, 194, 291, 347, 1389, 51, 347, 347, 977, + 738, 452, 1546, 364, 870, 1314, 872, 833, 263, 688, + 775, 347, 606, 831, 94, 880, 292, 365, 250, 362, + 942, 352, 607, 291, 434, 352, 1279, 347, 123, 363, + 123, 778, 938, 1558, 797, 123, 778, 778, 115, 876, + 466, 362, 424, 347, 1057, 1326, 796, 1053, 956, 739, + 1315, 1314, 364, 1118, 1547, 535, 490, 989, 453, 197, + 44, 738, 452, 691, 244, 115, 365, 251, 691, 352, + 427, 113, 691, 923, 887, 428, 805, 429, 1063, 1153, + 430, 431, 1118, 432, 433, 488, 951, 691, 515, 363, + 197, 785, 427, 751, 248, 425, 1315, 428, 194, 429, 510, 258, 430, 431, 991, 432, 433, 904, 903, 965, - 94, 555, 364, 113, 785, 787, 1118, 113, 362, 364, - 320, 778, 194, 1376, 1121, 970, 365, 340, 957, 781, - 362, 905, 928, 365, 362, 717, 347, 362, 1313, 362, - 989, 331, 331, 1098, 362, 989, 197, 989, 631, 1314, - 989, 989, 334, 989, 989, 1400, 1153, 952, 906, 347, - 444, 971, 331, 717, 696, 347, 363, 1315, 963, 1414, - 964, 347, 717, 412, 651, 347, 651, 197, 689, 490, - 969, 966, 689, 826, 1313, 490, 413, 991, 347, 364, - 577, 1433, 991, 374, 991, 1314, 414, 991, 991, 1089, - 991, 991, 689, 365, 1316, 1029, 415, 711, 617, 450, - 1317, 113, 1318, 1315, 617, 700, 981, 807, 787, 374, - 347, 416, 320, 1173, 115, 807, 115, 1319, 690, 689, - 989, 631, 577, 417, 194, 711, 631, 1021, 631, 631, + 739, 555, 364, 113, 691, 787, 888, 113, 250, 453, + 691, 778, 194, 245, 1121, 970, 365, 246, 957, 781, + 362, 905, 94, 691, 362, 1372, 347, 362, 1030, 362, + 989, 331, 331, 1098, 362, 989, 785, 989, 631, 340, + 989, 989, 320, 989, 989, 340, 541, 952, 906, 347, + 444, 971, 331, 1375, 696, 347, 231, 251, 963, 542, + 964, 347, 691, 363, 651, 347, 651, 247, 689, 490, + 969, 966, 689, 826, 1373, 490, 543, 991, 347, 1316, + 577, 416, 991, 374, 991, 883, 364, 991, 991, 1089, + 991, 991, 689, 417, 340, 1029, 412, 884, 617, 450, + 1317, 113, 1376, 1163, 617, 700, 981, 521, 787, 374, + 347, 522, 320, 1173, 115, 1164, 115, 1318, 690, 689, + 989, 631, 577, 334, 194, 1316, 631, 1021, 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, 740, - 1316, 418, 690, 331, 331, 194, 1317, 1163, 1318, 1203, - 631, 1018, 631, 506, 631, 585, 631, 631, 631, 1164, - 716, 882, 586, 1319, 1061, 115, 1064, 991, 115, 690, - 1043, 541, 1066, 1010, 587, 1045, 374, 542, 1045, 729, - 448, 347, 1098, 883, 542, 297, 1235, 778, 577, 787, - 363, 1102, 953, 347, 798, 884, 347, 347, 1075, 1498, - 94, 543, 225, 985, 226, 320, 331, 1293, 1311, 1420, - 347, 631, 452, 364, 1335, 1336, 194, 278, 278, 490, - 374, 374, 374, 1337, 374, 374, 278, 374, 1293, 374, - 113, 778, 331, 778, 225, 1107, 778, 94, 714, 194, - 713, 1111, 456, 426, 331, 796, 1283, 714, 1097, 713, - 459, 585, 331, 913, 1311, 194, 1293, 486, 586, 194, - 1357, 1551, 1048, 113, 485, 464, 1328, 716, 945, 1367, - 587, 374, 337, 374, 808, 1217, 374, 288, 808, 288, + 585, 414, 690, 331, 331, 194, 1317, 586, 1319, 1203, + 631, 778, 631, 506, 631, 717, 631, 631, 631, 587, + 716, 882, 94, 1318, 1061, 115, 1064, 991, 115, 690, + 1043, 1283, 1066, 1010, 710, 1045, 1400, 711, 1045, 729, + 415, 347, 1098, 717, 374, 448, 1235, 778, 577, 787, + 1414, 1102, 717, 347, 1319, 363, 347, 347, 1075, 1498, + 953, 807, 710, 985, 413, 711, 331, 1293, 1311, 807, + 347, 631, 1433, 320, 278, 278, 194, 714, 364, 490, + 374, 374, 374, 278, 374, 374, 714, 374, 1293, 374, + 113, 778, 331, 778, 804, 1107, 778, 713, 1357, 194, + 804, 1111, 804, 426, 331, 796, 713, 1367, 1097, 404, + 405, 585, 331, 913, 1311, 194, 1293, 450, 586, 194, + 451, 1551, 907, 113, 485, 464, 1328, 716, 732, 908, + 587, 374, 733, 374, 808, 1217, 374, 288, 808, 288, 787, 1360, 808, 510, 288, 1104, 985, 1105, 113, 1106, - 1360, 985, 225, 985, 228, 804, 985, 985, 1571, 985, - 985, 804, 907, 804, 512, 406, 407, 508, 331, 908, - 512, 331, 577, 1073, 535, 862, 194, 1589, 1590, 408, - 409, 826, 1154, 778, 1155, 778, 427, 778, 69, 69, - 1149, 428, 69, 429, 194, 194, 430, 431, 450, 432, - 433, 451, 824, 800, 331, 331, 824, 813, 824, 509, - 824, 813, 24, 813, 25, 813, 1156, 26, 404, 405, - 347, 347, 27, 347, 347, 62, 28, 1031, 490, 1031, - 521, 506, 331, 331, 522, 30, 985, 576, 740, 804, - 732, 804, 32, 804, 733, 1182, 787, 33, 531, 766, - 826, 34, 578, 767, 815, 776, 815, 1097, 115, 522, - 1193, 536, 194, 36, 506, 37, 176, 506, 176, 38, - 176, 233, 450, 1220, 447, 881, 1221, 39, 40, 576, - 375, 41, 513, 194, 801, 425, 778, 425, 513, 944, - 556, 194, 1216, 945, 578, 233, 871, 1021, 447, 189, - 871, 189, 537, 189, 506, 875, 425, 425, 113, 875, - 291, 70, 540, 1288, 449, 70, 778, 1149, 807, 561, - 340, 347, 807, 340, 347, 164, 425, 164, 171, 1220, - 171, 172, 1221, 172, 425, 352, 940, 425, 940, 352, - 1411, 347, 352, 569, 352, 576, 484, 231, 115, 352, - 331, 597, 1292, 1310, 364, 1221, 796, 1411, 598, 347, - 578, 347, 796, 778, 692, 325, 397, 398, 399, 796, - 1288, 609, 331, 1292, 368, 1443, 1221, 1444, 113, 711, - 347, 347, 778, 352, 506, 72, 115, 72, 1370, 1371, - 115, 195, 695, 195, 115, 731, 331, 1344, 734, 1310, - 347, 1292, 736, 201, 1221, 113, 764, 165, 347, 165, - 128, 347, 128, 1403, 410, 411, 1406, 343, 115, 995, - 996, 347, 349, 351, 353, 355, 357, 359, 361, 250, - 294, 378, 294, 262, 135, 758, 135, 286, 287, 288, - 765, 294, 295, 1365, 763, 202, 308, 309, 1186, 1187, - 379, 380, 301, 317, 301, 319, 115, 323, 654, 656, - 658, 660, 335, 336, 1249, 231, 816, 364, 456, 576, - 381, 1561, 1562, 115, 536, 536, 194, 809, 251, 691, - 691, 382, 1198, 1199, 578, 818, 383, 819, 38, 820, - 740, 646, 648, 662, 664, 203, 204, 205, 206, 1421, - 207, 208, 209, 210, 211, 212, 213, 214, 331, 821, - 215, 216, 217, 218, 219, 220, 221, 222, 650, 652, - 740, 740, 839, 740, 840, 843, 844, 846, 1478, 331, - 856, 848, 857, 194, 740, 869, 871, 740, 875, 891, - 892, 450, 42, 899, 895, 1505, 911, 896, 917, 918, - 196, 919, 740, 194, 920, 926, 943, 377, 1517, 1519, - 946, 862, 787, 947, 113, 949, 113, 1365, 954, 958, - 973, 990, 959, 967, 506, 992, 740, 985, 997, 999, - 115, 1005, 1008, 1006, 1009, 1505, 1505, 1014, 1011, 1016, - 1022, 1527, 1034, 1035, 1044, 1038, 1052, 525, 1070, 1059, - 331, 1071, 1090, 1144, 1100, 1108, 1143, 1126, 1114, 1115, - 194, 194, 1116, 1146, 1166, 113, 1124, 1136, 113, 1140, - 194, 1158, 1167, 331, 787, 1168, 343, 317, 194, 194, - 383, 194, 1162, 1165, 1170, 1171, 1174, 1388, 1178, 331, - 1185, 1188, 1505, 331, 1189, 1196, 1209, 1388, 1201, 1229, - 1212, 1388, 1243, 194, 490, 490, 194, 1219, 564, 1246, - 1262, 787, 1251, 1267, 1248, 1388, 343, 386, 1254, 1259, - 529, 1269, 1274, 1275, 1576, 1576, 1276, 1282, 1283, 1278, - 1346, 1585, 1585, 617, 617, 1324, 546, 1388, 387, 388, + 1360, 985, 225, 985, 226, 512, 985, 985, 1571, 985, + 985, 512, 418, 69, 69, 406, 407, 69, 331, 766, + 297, 331, 577, 767, 535, 452, 194, 1589, 1590, 408, + 409, 826, 225, 778, 776, 778, 427, 778, 522, 340, + 1149, 428, 340, 429, 194, 194, 430, 431, 450, 432, + 433, 881, 824, 800, 331, 331, 824, 813, 824, 456, + 824, 813, 24, 813, 25, 813, 1156, 26, 995, 996, + 347, 347, 27, 347, 347, 62, 28, 225, 490, 228, + 924, 506, 331, 331, 925, 30, 985, 576, 740, 804, + 944, 804, 32, 804, 945, 1182, 787, 33, 459, 871, + 826, 34, 578, 871, 296, 875, 297, 1097, 115, 875, + 1193, 486, 194, 36, 506, 37, 176, 506, 176, 38, + 176, 233, 347, 1220, 447, 347, 1221, 39, 40, 576, + 337, 41, 513, 194, 801, 425, 778, 425, 513, 70, + 531, 194, 1216, 70, 578, 233, 807, 1021, 447, 189, + 807, 189, 508, 189, 506, 536, 425, 425, 113, 1073, + 291, 862, 556, 1288, 449, 509, 778, 1149, 654, 656, + 658, 660, 397, 398, 399, 1154, 425, 1155, 1031, 1220, + 1031, 815, 1221, 815, 425, 352, 164, 425, 164, 352, + 1411, 347, 352, 375, 352, 576, 410, 411, 115, 352, + 331, 537, 1292, 1310, 540, 1221, 796, 1411, 561, 347, + 578, 347, 796, 778, 171, 325, 171, 484, 231, 796, + 1288, 569, 331, 1292, 597, 1443, 1221, 1444, 113, 364, + 347, 347, 778, 352, 506, 172, 115, 172, 1370, 1371, + 115, 940, 598, 940, 115, 609, 331, 1344, 692, 1310, + 347, 1292, 368, 201, 1221, 113, 711, 72, 347, 72, + 195, 347, 195, 1403, 1249, 231, 1406, 343, 115, 1186, + 1187, 347, 349, 351, 353, 355, 357, 359, 361, 250, + 165, 378, 165, 262, 364, 456, 731, 286, 287, 288, + 695, 294, 295, 1365, 758, 202, 308, 309, 536, 536, + 379, 380, 128, 317, 128, 319, 115, 323, 294, 135, + 294, 135, 335, 336, 301, 734, 301, 1561, 1562, 576, + 381, 691, 691, 115, 646, 648, 194, 736, 251, 1198, + 1199, 382, 763, 764, 578, 765, 383, 816, 38, 809, + 740, 650, 652, 662, 664, 203, 204, 205, 206, 1421, + 207, 208, 209, 210, 211, 212, 213, 214, 331, 818, + 215, 216, 217, 218, 219, 220, 221, 222, 819, 820, + 740, 740, 821, 740, 840, 839, 843, 846, 1478, 331, + 844, 856, 848, 194, 740, 857, 869, 740, 871, 875, + 891, 892, 450, 42, 896, 1505, 895, 899, 917, 918, + 196, 919, 740, 194, 911, 920, 926, 377, 1517, 1519, + 943, 946, 787, 949, 113, 862, 113, 1365, 947, 954, + 958, 973, 959, 967, 506, 990, 740, 985, 992, 997, + 115, 999, 1005, 1008, 1006, 1505, 1505, 1009, 1014, 1011, + 1016, 1527, 1022, 1034, 1035, 1044, 1052, 1038, 525, 1070, + 331, 1059, 1071, 1100, 1090, 1108, 1116, 1126, 1124, 1114, + 194, 194, 1115, 1136, 1146, 113, 1158, 1140, 113, 1166, + 194, 1144, 1167, 331, 787, 1143, 343, 317, 194, 194, + 383, 194, 1162, 1165, 1168, 1170, 1171, 1388, 1178, 331, + 1174, 1185, 1505, 331, 1189, 1188, 1201, 1388, 1196, 1209, + 1212, 1388, 1229, 194, 490, 490, 194, 1219, 564, 1243, + 1246, 787, 1251, 1259, 1248, 1388, 343, 386, 1254, 1262, + 529, 1267, 1269, 1274, 1576, 1576, 1275, 1276, 1282, 1283, + 1278, 1585, 1585, 617, 617, 1324, 546, 1388, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 1327, 1329, - 1330, 1377, 1332, 1341, 1391, 1408, 1369, 1417, 1419, 1424, - 1409, 1416, 1427, 1399, 1429, 1441, 1454, 1432, 331, 331, + 1330, 1332, 1346, 1341, 1369, 1377, 1391, 1408, 1417, 1424, + 1409, 1416, 1427, 1419, 1429, 1441, 1399, 1432, 331, 331, 1430, 636, 638, 640, 1434, 1438, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, - 564, 564, 1436, 1451, 1440, 38, 1446, 1457, 1461, 38, - 1458, 1459, 1488, 1469, 1470, 1564, 1502, 1473, 24, 1483, - 38, 1490, 1500, 1503, 1509, 38, 1513, 1499, 1512, 38, - 1526, 1524, 38, 1523, 1528, 1531, 1529, 1537, 1544, 1548, - 1553, 1555, 1552, 1563, 38, 38, 331, 1547, 1546, 38, - 38, 1569, 1570, 1591, 1592, 38, 1593, 38, 38, 38, - 38, 9, 1027, 552, 909, 38, 507, 910, 1019, 38, - 508, 38, 653, 377, 506, 331, 465, 654, 377, 377, - 725, 38, 33, 38, 38, 466, 38, 33, 532, 323, - 38, 34, 216, 817, 103, 34, 818, 841, 810, 876, - 877, 377, 842, 920, 713, 878, 327, 880, 113, 564, - 38, 738, 354, 347, 377, 377, 38, 38, 713, 377, - 131, 691, 377, 113, 377, 297, 377, 377, 377, 377, - 138, 748, 691, 132, 377, 114, 298, 139, 377, 230, - 53, 21, 377, 1004, 1191, 517, 1091, 1192, 1343, 1333, - 377, 1545, 1514, 377, 1554, 377, 377, 1501, 1530, 1496, - 1401, 377, 1031, 377, 377, 377, 377, 377, 377, 377, - 377, 377, 377, 377, 796, 1032, 1033, 914, 1342, 377, - 377, 842, 1027, 1587, 377, 377, 1423, 377, 377, 377, - 1579, 377, 377, 377, 1525, 377, 377, 1520, 113, 377, - 377, 377, 377, 1518, 1578, 1270, 377, 377, 1000, 1445, - 806, 377, 377, 377, 377, 377, 377, 377, 377, 1051, - 1049, 1271, 935, 978, 611, 855, 1127, 299, 567, 668, - 377, 910, 932, 377, 666, 377, 113, 670, 675, 672, - 113, 674, 972, 24, 113, 25, 377, 823, 26, 1256, - 1347, 420, 1176, 27, 1120, 1183, 1169, 28, 1139, 1109, - 331, 29, 1177, 1175, 1240, 1068, 30, 690, 113, 799, - 879, 31, 691, 32, 1345, 24, 1002, 1245, 33, 24, - 1001, 0, 34, 35, 0, 0, 0, 0, 0, 0, + 564, 564, 1436, 1451, 1440, 38, 1446, 1454, 1457, 38, + 1461, 1458, 1459, 1488, 1469, 1537, 1470, 1548, 24, 1473, + 38, 1483, 1490, 1502, 1503, 38, 1500, 1499, 1509, 38, + 1513, 1524, 38, 1512, 1523, 1526, 1528, 1531, 1529, 1544, + 1552, 1553, 1555, 1564, 38, 38, 331, 1563, 1547, 38, + 38, 1546, 1569, 1570, 1591, 38, 1592, 38, 38, 38, + 38, 1593, 9, 1027, 552, 38, 909, 507, 910, 38, + 653, 38, 1019, 377, 508, 331, 465, 654, 377, 377, + 33, 38, 725, 38, 38, 506, 38, 466, 33, 817, + 38, 532, 34, 323, 818, 216, 103, 34, 841, 876, + 810, 377, 842, 877, 920, 713, 354, 878, 113, 564, + 38, 327, 880, 738, 377, 377, 38, 38, 713, 377, + 347, 691, 377, 691, 377, 131, 377, 377, 377, 377, + 113, 748, 297, 230, 377, 138, 132, 114, 377, 298, + 139, 53, 377, 21, 1091, 517, 1004, 1191, 1192, 1343, + 377, 1333, 1514, 377, 1554, 377, 377, 1545, 1501, 1530, + 1496, 377, 1027, 377, 377, 377, 377, 377, 377, 377, + 377, 377, 377, 377, 796, 1031, 1032, 914, 1033, 377, + 377, 842, 1587, 1342, 377, 377, 1401, 377, 377, 377, + 1423, 377, 377, 377, 1579, 377, 377, 1525, 113, 377, + 377, 377, 377, 1520, 1518, 1578, 377, 377, 1270, 1445, + 1000, 377, 377, 377, 377, 377, 377, 377, 377, 806, + 1049, 1271, 1051, 611, 935, 855, 299, 1127, 978, 932, + 377, 567, 910, 377, 666, 377, 113, 668, 672, 670, + 113, 972, 674, 24, 113, 25, 377, 675, 26, 1347, + 1256, 823, 420, 27, 1176, 1120, 1169, 28, 1183, 1139, + 331, 29, 1177, 1109, 1175, 1240, 30, 879, 113, 799, + 690, 31, 1068, 32, 691, 24, 1345, 1245, 33, 24, + 1002, 1001, 34, 35, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 36, 24, 37, 0, 0, 24, 38, 0, 24, 0, 0, 0, 113, 0, 39, 40, 0, 0, 41, 911, 24, 24, 0, 331, 0, 24, @@ -11774,33 +11769,88 @@ void case_1034() 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 340, 0, 0, 0, 105, 303, 107, 108, - 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, - 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, - 0, 64, 0, 0, 30, 0, 0, 0, 0, 0, - 0, 32, 0, 0, 0, 0, 33, 0, 71, 72, - 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 36, 0, 37, 74, 0, 0, 38, 0, - 0, 76, 0, 78, 0, 80, 39, 40, 255, 0, - 41, 0, 0, 0, 0, 0, 0, 0, 0, 341, + 0, 0, 83, 0, 0, 0, 105, 303, 107, 108, + 83, 83, 0, 83, 0, 0, 83, 83, 0, 0, + 0, 83, 83, 83, 0, 83, 0, 0, 0, 0, + 0, 83, 0, 0, 83, 0, 0, 0, 0, 0, + 0, 83, 0, 0, 0, 0, 83, 0, 83, 83, + 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 83, 0, 83, 83, 0, 0, 83, 0, + 0, 83, 0, 83, 0, 83, 83, 83, 83, 0, + 83, 0, 0, 0, 0, 0, 0, 83, 0, 0, + 83, 83, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 83, 83, 83, 83, 83, + 0, 0, 0, 0, 0, 0, 0, 83, 0, 0, + 0, 0, 0, 83, 83, 83, 83, 0, 0, 0, + 83, 0, 83, 0, 0, 0, 0, 0, 83, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, - 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, - 0, 0, 0, 97, 98, 99, 100, 933, 0, 0, - 101, 0, 102, 340, 0, 0, 0, 0, 103, 104, - 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, - 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, - 0, 0, 64, 105, 257, 30, 108, 0, 0, 0, - 0, 0, 32, 0, 0, 0, 0, 33, 0, 71, - 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 36, 0, 37, 74, 0, 0, 38, - 0, 0, 76, 0, 78, 0, 80, 39, 40, 255, - 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, - 341, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, - 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, - 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, - 0, 101, 0, 102, 346, 0, 0, 0, 0, 103, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 340, + 0, 0, 0, 83, 83, 83, 83, 56, 24, 0, + 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, + 62, 0, 28, 0, 0, 0, 0, 0, 64, 0, + 0, 30, 0, 0, 0, 0, 0, 0, 32, 0, + 0, 0, 0, 33, 0, 71, 72, 34, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, + 0, 37, 74, 0, 0, 38, 0, 0, 76, 0, + 78, 0, 80, 39, 40, 255, 0, 41, 0, 0, + 0, 0, 0, 0, 0, 0, 341, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, + 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, + 97, 98, 99, 100, 933, 0, 0, 101, 0, 102, + 340, 0, 0, 0, 0, 103, 104, 0, 56, 24, + 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, + 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, + 105, 257, 30, 108, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 33, 0, 71, 72, 34, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 37, 74, 0, 0, 38, 0, 0, 76, + 0, 78, 0, 80, 39, 40, 255, 0, 41, 0, + 0, 0, 0, 0, 0, 0, 0, 341, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, + 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, + 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, + 102, 346, 0, 0, 0, 0, 103, 104, 0, 56, + 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, + 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, + 64, 105, 257, 30, 108, 0, 0, 0, 0, 0, + 32, 0, 0, 0, 0, 33, 0, 71, 72, 34, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 36, 0, 37, 74, 0, 0, 38, 0, 0, + 76, 0, 78, 0, 80, 39, 40, 255, 0, 41, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, + 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, + 0, 102, 348, 0, 0, 0, 0, 103, 104, 0, + 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, + 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, + 0, 64, 105, 257, 30, 108, 0, 0, 0, 0, + 0, 32, 0, 0, 0, 0, 33, 0, 71, 72, + 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 36, 0, 37, 74, 0, 0, 38, 0, + 0, 76, 0, 78, 0, 80, 39, 40, 255, 0, + 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, + 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, + 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, + 101, 0, 102, 350, 0, 0, 0, 0, 103, 104, + 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, + 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, + 0, 0, 64, 105, 257, 30, 108, 0, 0, 0, + 0, 0, 32, 0, 0, 0, 0, 33, 0, 71, + 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 36, 0, 37, 74, 0, 0, 38, + 0, 0, 76, 0, 78, 0, 80, 39, 40, 255, + 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, + 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, + 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, + 0, 101, 0, 102, 352, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, @@ -11813,7 +11863,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, - 0, 0, 101, 0, 102, 348, 0, 0, 0, 0, + 0, 0, 101, 0, 102, 354, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, @@ -11826,7 +11876,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, - 0, 0, 0, 101, 0, 102, 350, 0, 0, 0, + 0, 0, 0, 101, 0, 102, 356, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, @@ -11839,7 +11889,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, - 100, 0, 0, 0, 101, 0, 102, 352, 0, 0, + 100, 0, 0, 0, 101, 0, 102, 358, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, @@ -11852,7 +11902,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, - 99, 100, 0, 0, 0, 101, 0, 102, 354, 0, + 99, 100, 0, 0, 0, 101, 0, 102, 360, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, @@ -11865,7 +11915,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, - 98, 99, 100, 0, 0, 0, 101, 0, 102, 356, + 98, 99, 100, 0, 0, 0, 101, 0, 102, 340, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, @@ -11879,7 +11929,7 @@ void case_1034() 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, - 358, 0, 0, 0, 0, 103, 104, 0, 56, 24, + 635, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, 0, 0, 0, 32, @@ -11892,7 +11942,7 @@ void case_1034() 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, - 102, 360, 0, 0, 0, 0, 103, 104, 0, 56, + 102, 637, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, 0, 0, 0, @@ -11905,7 +11955,7 @@ void case_1034() 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, - 0, 102, 340, 0, 0, 0, 0, 103, 104, 0, + 0, 102, 639, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, 0, 0, @@ -11918,7 +11968,7 @@ void case_1034() 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, - 101, 0, 102, 635, 0, 0, 0, 0, 103, 104, + 101, 0, 102, 645, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, 0, @@ -11931,7 +11981,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, - 0, 101, 0, 102, 637, 0, 0, 0, 0, 103, + 0, 101, 0, 102, 647, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, @@ -11944,7 +11994,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, - 0, 0, 101, 0, 102, 639, 0, 0, 0, 0, + 0, 0, 101, 0, 102, 649, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, @@ -11957,7 +12007,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, - 0, 0, 0, 101, 0, 102, 645, 0, 0, 0, + 0, 0, 0, 101, 0, 102, 651, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, @@ -11970,7 +12020,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, - 100, 0, 0, 0, 101, 0, 102, 647, 0, 0, + 100, 0, 0, 0, 101, 0, 102, 653, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, @@ -11983,7 +12033,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, - 99, 100, 0, 0, 0, 101, 0, 102, 649, 0, + 99, 100, 0, 0, 0, 101, 0, 102, 655, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, @@ -11996,7 +12046,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, - 98, 99, 100, 0, 0, 0, 101, 0, 102, 651, + 98, 99, 100, 0, 0, 0, 101, 0, 102, 657, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, @@ -12010,7 +12060,7 @@ void case_1034() 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, - 653, 0, 0, 0, 0, 103, 104, 0, 56, 24, + 659, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, 0, 0, 0, 32, @@ -12023,7 +12073,7 @@ void case_1034() 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, - 102, 655, 0, 0, 0, 0, 103, 104, 0, 56, + 102, 661, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, 0, 0, 0, @@ -12036,7 +12086,7 @@ void case_1034() 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, - 0, 102, 657, 0, 0, 0, 0, 103, 104, 0, + 0, 102, 663, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, 0, 0, @@ -12049,7 +12099,7 @@ void case_1034() 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, - 101, 0, 102, 659, 0, 0, 0, 0, 103, 104, + 101, 0, 102, 665, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, 0, @@ -12062,7 +12112,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, - 0, 101, 0, 102, 661, 0, 0, 0, 0, 103, + 0, 101, 0, 102, 667, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, @@ -12075,7 +12125,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, - 0, 0, 101, 0, 102, 663, 0, 0, 0, 0, + 0, 0, 101, 0, 102, 669, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, @@ -12088,7 +12138,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, - 0, 0, 0, 101, 0, 102, 665, 0, 0, 0, + 0, 0, 0, 101, 0, 102, 671, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, @@ -12101,7 +12151,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, - 100, 0, 0, 0, 101, 0, 102, 667, 0, 0, + 100, 0, 0, 0, 101, 0, 102, 673, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, @@ -12114,7 +12164,7 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, - 99, 100, 0, 0, 0, 101, 0, 102, 669, 0, + 99, 100, 0, 0, 0, 101, 0, 102, 841, 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, @@ -12127,426 +12177,373 @@ void case_1034() 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, - 98, 99, 100, 0, 0, 0, 101, 0, 102, 671, - 0, 0, 0, 0, 103, 104, 0, 56, 24, 0, + 98, 99, 100, 0, 0, 0, 101, 0, 102, 513, + 0, 0, 0, 0, 103, 104, 347, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, 105, 257, 30, 108, 0, 0, 0, 0, 0, 32, 0, - 0, 0, 0, 33, 0, 71, 72, 34, 0, 0, + 0, 0, 347, 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 37, 74, 0, 0, 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, 255, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 89, 90, 91, 256, 342, 0, 0, 0, - 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, - 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, - 673, 0, 0, 0, 0, 103, 104, 0, 56, 24, + 0, 0, 89, 90, 91, 256, 291, 0, 0, 0, + 0, 0, 0, 0, 95, 347, 347, 347, 347, 796, + 0, 0, 347, 347, 0, 0, 347, 347, 347, 347, + 347, 347, 347, 347, 347, 0, 347, 347, 347, 347, + 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + 347, 347, 347, 347, 347, 347, 347, 347, 0, 0, + 105, 514, 0, 0, 347, 0, 52, 347, 52, 0, + 52, 0, 52, 0, 0, 52, 0, 52, 52, 0, + 52, 0, 52, 0, 52, 0, 52, 52, 52, 52, + 0, 0, 52, 52, 0, 0, 0, 0, 52, 52, + 52, 52, 52, 0, 0, 52, 0, 52, 0, 52, + 0, 52, 52, 0, 52, 52, 52, 52, 0, 0, + 52, 52, 52, 52, 0, 0, 52, 52, 52, 0, + 0, 0, 0, 0, 0, 52, 52, 0, 52, 52, + 0, 52, 52, 52, 0, 0, 0, 52, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 52, 0, 52, + 52, 51, 0, 0, 0, 51, 0, 51, 0, 0, + 51, 0, 51, 51, 0, 51, 0, 51, 0, 51, + 0, 51, 51, 51, 51, 0, 0, 51, 51, 0, + 0, 0, 0, 51, 0, 51, 51, 51, 0, 0, + 51, 0, 51, 0, 51, 0, 0, 51, 0, 51, + 51, 51, 51, 52, 0, 0, 51, 51, 51, 0, + 0, 51, 51, 51, 0, 0, 0, 0, 0, 0, + 51, 51, 0, 51, 51, 0, 51, 51, 51, 0, + 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 51, 0, 51, 0, 51, 0, 51, 0, 86, 51, + 0, 51, 51, 0, 51, 0, 51, 51, 51, 0, + 51, 51, 51, 51, 0, 0, 51, 51, 0, 0, + 0, 0, 51, 0, 51, 51, 51, 0, 0, 51, + 0, 51, 0, 51, 0, 0, 51, 0, 51, 51, + 51, 51, 0, 0, 0, 51, 51, 51, 51, 0, + 51, 51, 51, 0, 0, 0, 0, 0, 0, 51, + 51, 0, 51, 51, 0, 51, 51, 51, 0, 0, + 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, + 0, 51, 0, 52, 0, 52, 0, 87, 52, 0, + 52, 52, 0, 52, 0, 52, 51, 52, 0, 52, + 52, 52, 52, 0, 0, 52, 52, 0, 0, 0, + 0, 52, 0, 52, 52, 52, 0, 0, 52, 0, + 52, 0, 52, 0, 0, 52, 0, 52, 52, 52, + 52, 0, 0, 0, 52, 52, 52, 51, 0, 52, + 52, 52, 0, 0, 0, 0, 0, 0, 52, 52, + 0, 52, 52, 0, 52, 52, 52, 0, 0, 0, + 52, 0, 0, 0, 0, 51, 0, 0, 0, 51, + 0, 51, 0, 0, 51, 0, 51, 51, 0, 51, + 52, 51, 0, 51, 0, 51, 51, 51, 51, 0, + 0, 51, 51, 0, 0, 52, 0, 51, 0, 51, + 51, 51, 0, 0, 51, 0, 51, 0, 51, 0, + 0, 51, 0, 51, 51, 51, 51, 0, 0, 0, + 51, 51, 51, 0, 0, 51, 51, 51, 0, 0, + 0, 0, 0, 0, 51, 51, 52, 51, 51, 0, + 51, 51, 51, 0, 0, 0, 51, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 0, 0, 0, 51, 0, 51, 51, 0, 51, 0, + 51, 51, 222, 51, 0, 51, 0, 51, 0, 51, + 51, 51, 51, 0, 0, 51, 51, 0, 0, 0, + 0, 51, 0, 51, 51, 51, 0, 0, 51, 0, + 51, 347, 51, 0, 0, 51, 0, 51, 51, 51, + 51, 0, 0, 0, 51, 51, 51, 0, 0, 51, + 51, 51, 51, 0, 347, 0, 0, 0, 51, 51, + 0, 51, 51, 0, 51, 51, 51, 347, 0, 0, + 51, 0, 347, 0, 0, 347, 0, 347, 0, 347, + 347, 347, 347, 0, 0, 0, 0, 347, 0, 0, + 51, 347, 0, 0, 0, 347, 223, 0, 0, 0, + 0, 369, 0, 347, 0, 0, 347, 0, 347, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 369, 0, 0, 347, 0, 0, + 0, 0, 347, 0, 0, 0, 0, 369, 347, 347, + 0, 273, 369, 347, 0, 240, 51, 369, 0, 369, + 369, 369, 369, 0, 0, 0, 347, 369, 0, 0, + 0, 369, 0, 368, 0, 369, 0, 0, 0, 0, + 0, 0, 0, 369, 0, 0, 369, 0, 369, 0, + 0, 0, 0, 0, 0, 0, 368, 0, 347, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 368, + 0, 465, 369, 0, 368, 0, 0, 239, 369, 368, + 0, 368, 368, 368, 368, 0, 0, 0, 0, 368, + 0, 0, 0, 368, 466, 0, 0, 368, 0, 0, + 0, 0, 0, 0, 0, 368, 0, 467, 368, 465, + 368, 0, 469, 0, 0, 0, 0, 470, 0, 471, + 472, 473, 474, 0, 0, 0, 0, 475, 369, 0, + 0, 476, 466, 0, 368, 1380, 0, 0, 0, 0, + 368, 0, 0, 477, 0, 467, 478, 465, 479, 0, + 469, 0, 0, 0, 0, 470, 0, 471, 472, 473, + 474, 0, 0, 0, 0, 475, 0, 0, 0, 476, + 466, 0, 480, 1380, 0, 0, 0, 0, 1381, 0, + 0, 477, 0, 467, 478, 0, 479, 0, 469, 0, + 368, 0, 0, 470, 0, 471, 472, 473, 474, 0, + 0, 0, 0, 475, 0, 0, 0, 476, 0, 0, + 480, 0, 0, 0, 0, 0, 0, 0, 0, 477, + 56, 24, 478, 25, 479, 0, 26, 254, 1382, 0, + 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, + 0, 64, 0, 0, 30, 0, 0, 0, 480, 0, + 0, 32, 0, 0, 0, 0, 33, 0, 71, 72, + 34, 0, 613, 0, 0, 0, 1382, 0, 0, 614, + 0, 0, 36, 0, 37, 74, 0, 0, 38, 0, + 0, 76, 0, 78, 0, 80, 39, 40, 255, 0, + 41, 0, 0, 0, 0, 0, 0, 615, 0, 0, + 87, 88, 0, 0, 1399, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 89, 90, 91, 92, 93, + 0, 0, 0, 0, 0, 0, 0, 95, 974, 0, + 616, 0, 0, 97, 98, 99, 100, 0, 0, 0, + 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, + 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, + 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, + 0, 28, 0, 105, 106, 107, 108, 64, 0, 0, + 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, + 0, 0, 33, 0, 71, 72, 34, 0, 613, 0, + 0, 0, 0, 0, 0, 614, 0, 0, 36, 0, + 37, 74, 0, 0, 38, 0, 0, 76, 0, 78, + 0, 80, 39, 40, 255, 0, 41, 0, 0, 0, + 0, 0, 0, 615, 0, 0, 87, 88, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 89, 90, 91, 92, 93, 0, 0, 0, 0, + 0, 0, 0, 95, 0, 0, 616, 0, 0, 97, + 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, + 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, + 0, 0, 56, 24, 0, 25, 0, 0, 26, 254, + 0, 0, 0, 27, 61, 62, 0, 28, 0, 105, + 106, 107, 108, 64, 0, 0, 30, 0, 0, 0, + 0, 0, 0, 32, 0, 0, 0, 0, 33, 0, + 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 36, 0, 37, 74, 0, 0, + 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, + 255, 0, 41, 0, 0, 84, 0, 0, 0, 86, + 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, + 92, 302, 0, 0, 0, 0, 0, 0, 0, 95, + 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, + 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, + 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, 27, - 61, 62, 0, 28, 0, 0, 0, 0, 0, 64, - 105, 257, 30, 108, 0, 0, 0, 0, 0, 32, + 61, 62, 0, 28, 0, 105, 303, 107, 108, 64, + 0, 0, 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 37, 74, 0, 0, 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, 255, 0, 41, 0, + 0, 0, 0, 0, 0, 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 89, 90, 91, 256, 342, 0, 0, - 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, + 0, 0, 0, 89, 90, 91, 92, 302, 0, 0, + 0, 531, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, - 102, 841, 0, 0, 0, 0, 103, 104, 0, 56, - 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, - 27, 61, 62, 0, 28, 0, 0, 0, 0, 0, - 64, 105, 257, 30, 108, 0, 0, 0, 0, 0, - 32, 0, 0, 0, 0, 33, 0, 71, 72, 34, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 36, 0, 37, 74, 0, 0, 38, 0, 0, - 76, 0, 78, 0, 80, 39, 40, 255, 0, 41, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 89, 90, 91, 256, 342, 0, - 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, - 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, - 0, 102, 513, 0, 0, 0, 0, 103, 104, 347, + 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, + 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, + 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, + 0, 105, 303, 107, 108, 64, 0, 0, 30, 0, + 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, + 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 36, 0, 37, 74, + 0, 0, 38, 0, 0, 76, 0, 78, 0, 80, + 39, 40, 255, 0, 41, 0, 0, 0, 0, 0, + 0, 86, 0, 0, 87, 88, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, + 90, 91, 92, 302, 0, 0, 0, 525, 0, 0, + 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, + 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, + 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, 0, - 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, - 0, 64, 105, 257, 30, 108, 0, 0, 0, 0, - 0, 32, 0, 0, 0, 347, 33, 0, 71, 72, + 0, 27, 61, 62, 0, 28, 0, 105, 303, 107, + 108, 64, 0, 0, 30, 0, 0, 0, 0, 0, + 0, 32, 0, 0, 0, 0, 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 37, 74, 0, 0, 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, 255, 0, - 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 89, 90, 91, 256, 291, - 0, 0, 0, 0, 0, 0, 0, 95, 347, 347, - 347, 347, 796, 0, 0, 347, 347, 0, 0, 347, - 347, 347, 347, 347, 347, 347, 347, 347, 0, 347, - 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, - 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, - 347, 0, 0, 105, 514, 0, 0, 347, 0, 52, - 347, 52, 0, 52, 0, 52, 0, 0, 52, 0, - 52, 52, 0, 52, 0, 52, 0, 52, 0, 52, - 52, 52, 52, 0, 0, 52, 52, 0, 0, 0, - 0, 52, 52, 52, 52, 52, 0, 0, 52, 0, - 52, 0, 52, 0, 52, 52, 0, 52, 52, 52, - 52, 0, 0, 52, 52, 52, 52, 0, 0, 52, - 52, 52, 0, 0, 0, 0, 0, 0, 52, 52, - 0, 52, 52, 0, 52, 52, 52, 0, 0, 0, - 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 52, 0, 52, 52, 51, 0, 0, 0, 51, 0, - 51, 0, 0, 51, 0, 51, 51, 0, 51, 0, - 51, 0, 51, 0, 51, 51, 51, 51, 0, 0, - 51, 51, 0, 0, 0, 0, 51, 0, 51, 51, - 51, 0, 0, 51, 0, 51, 0, 51, 0, 0, - 51, 0, 51, 51, 51, 51, 52, 0, 0, 51, - 51, 51, 0, 0, 51, 51, 51, 0, 0, 0, - 0, 0, 0, 51, 51, 0, 51, 51, 0, 51, - 51, 51, 0, 0, 0, 51, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 51, 0, 51, 0, 51, 0, 51, - 0, 86, 51, 0, 51, 51, 0, 51, 0, 51, - 51, 51, 0, 51, 51, 51, 51, 0, 0, 51, - 51, 0, 0, 0, 0, 51, 0, 51, 51, 51, - 0, 0, 51, 0, 51, 0, 51, 0, 0, 51, - 0, 51, 51, 51, 51, 0, 0, 0, 51, 51, - 51, 51, 0, 51, 51, 51, 0, 0, 0, 0, - 0, 0, 51, 51, 0, 51, 51, 0, 51, 51, - 51, 0, 0, 0, 51, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 52, 0, 51, 0, 52, 0, 52, 0, - 87, 52, 0, 52, 52, 0, 52, 0, 52, 51, - 52, 0, 52, 52, 52, 52, 0, 0, 52, 52, - 0, 0, 0, 0, 52, 0, 52, 52, 52, 0, - 0, 52, 0, 52, 0, 52, 0, 0, 52, 0, - 52, 52, 52, 52, 0, 0, 0, 52, 52, 52, - 51, 0, 52, 52, 52, 0, 0, 0, 0, 0, - 0, 52, 52, 0, 52, 52, 0, 52, 52, 52, - 0, 0, 0, 52, 0, 0, 0, 0, 51, 0, - 0, 0, 51, 0, 51, 0, 0, 51, 0, 51, - 51, 0, 51, 52, 51, 0, 51, 0, 51, 51, - 51, 51, 0, 0, 51, 51, 0, 0, 52, 0, - 51, 0, 51, 51, 51, 0, 0, 51, 0, 51, - 0, 51, 0, 0, 51, 0, 51, 51, 51, 51, - 0, 0, 0, 51, 51, 51, 0, 0, 51, 51, - 51, 0, 0, 0, 0, 0, 0, 51, 51, 52, - 51, 51, 0, 51, 51, 51, 0, 0, 0, 51, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 51, 0, 0, 0, 51, 0, 51, 51, - 0, 51, 0, 51, 51, 222, 51, 0, 51, 0, - 51, 0, 51, 51, 51, 51, 0, 0, 51, 51, - 0, 0, 0, 0, 51, 0, 51, 51, 51, 0, - 0, 51, 0, 51, 347, 51, 0, 0, 51, 0, - 51, 51, 51, 51, 0, 0, 0, 51, 51, 51, - 0, 0, 51, 51, 51, 51, 0, 347, 0, 0, - 0, 51, 51, 0, 51, 51, 0, 51, 51, 51, - 347, 0, 0, 51, 0, 347, 0, 0, 347, 0, - 347, 0, 347, 347, 347, 347, 0, 0, 0, 0, - 347, 0, 0, 51, 347, 0, 0, 0, 347, 223, - 0, 0, 0, 0, 369, 0, 347, 0, 0, 347, - 0, 347, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 369, 0, 0, - 347, 0, 0, 0, 0, 347, 0, 0, 0, 0, - 369, 347, 347, 0, 273, 369, 347, 0, 240, 51, - 369, 0, 369, 369, 369, 369, 0, 0, 0, 347, - 369, 0, 0, 0, 369, 0, 368, 0, 369, 0, - 0, 0, 0, 0, 0, 0, 369, 0, 0, 369, - 0, 369, 0, 0, 0, 0, 0, 0, 0, 368, - 0, 347, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 368, 0, 465, 369, 0, 368, 0, 0, - 239, 369, 368, 0, 368, 368, 368, 368, 0, 0, - 0, 0, 368, 0, 0, 0, 368, 466, 0, 0, - 368, 0, 0, 0, 0, 0, 0, 0, 368, 0, - 467, 368, 465, 368, 0, 469, 0, 0, 0, 0, - 470, 0, 471, 472, 473, 474, 0, 0, 0, 0, - 475, 369, 0, 0, 476, 466, 0, 368, 1380, 0, - 0, 0, 0, 368, 0, 0, 477, 0, 467, 478, - 465, 479, 0, 469, 0, 0, 0, 0, 470, 0, - 471, 472, 473, 474, 0, 0, 0, 0, 475, 0, - 0, 0, 476, 466, 0, 480, 1380, 0, 0, 0, - 0, 1381, 0, 0, 477, 0, 467, 478, 0, 479, - 0, 469, 0, 368, 0, 0, 470, 0, 471, 472, - 473, 474, 0, 0, 0, 0, 475, 0, 0, 0, - 476, 0, 0, 480, 0, 0, 0, 0, 0, 0, - 0, 0, 477, 56, 24, 478, 25, 479, 0, 26, - 254, 1382, 0, 0, 27, 61, 62, 0, 28, 0, - 0, 0, 0, 0, 64, 0, 0, 30, 0, 0, - 0, 480, 0, 0, 32, 0, 0, 0, 0, 33, - 0, 71, 72, 34, 0, 613, 0, 0, 0, 1382, - 0, 0, 614, 0, 0, 36, 0, 37, 74, 0, - 0, 38, 0, 0, 76, 0, 78, 0, 80, 39, - 40, 255, 0, 41, 0, 0, 0, 0, 0, 0, - 615, 0, 0, 87, 88, 0, 0, 1399, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, - 91, 92, 93, 0, 0, 0, 0, 0, 0, 0, - 95, 974, 0, 616, 0, 0, 97, 98, 99, 100, - 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, - 0, 103, 104, 0, 0, 0, 0, 0, 0, 56, - 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, - 27, 61, 62, 0, 28, 0, 105, 106, 107, 108, - 64, 0, 0, 30, 0, 0, 0, 0, 0, 0, - 32, 0, 0, 0, 0, 33, 0, 71, 72, 34, - 0, 613, 0, 0, 0, 0, 0, 0, 614, 0, - 0, 36, 0, 37, 74, 0, 0, 38, 0, 0, - 76, 0, 78, 0, 80, 39, 40, 255, 0, 41, - 0, 0, 0, 0, 0, 0, 615, 0, 0, 87, - 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 89, 90, 91, 92, 93, 0, - 0, 0, 0, 0, 0, 0, 95, 0, 0, 616, - 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, - 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, - 0, 0, 0, 0, 0, 56, 24, 0, 25, 0, - 0, 26, 254, 0, 0, 0, 27, 61, 62, 0, - 28, 0, 105, 106, 107, 108, 64, 0, 0, 30, - 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, - 0, 33, 0, 71, 72, 34, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 36, 0, 37, - 74, 0, 0, 38, 0, 0, 76, 0, 78, 0, - 80, 39, 40, 255, 0, 41, 0, 0, 84, 0, - 0, 0, 86, 0, 0, 87, 88, 0, 0, 0, + 41, 0, 0, 0, 0, 0, 0, 86, 0, 0, + 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 89, 90, 91, 92, 302, + 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, + 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, + 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, + 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, + 0, 0, 26, 254, 0, 0, 0, 27, 61, 62, + 0, 28, 0, 105, 303, 107, 108, 64, 0, 0, + 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, + 0, 0, 33, 0, 71, 72, 34, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, + 37, 74, 0, 0, 38, 0, 0, 76, 0, 78, + 0, 80, 39, 40, 255, 0, 41, 0, 0, 0, + 0, 0, 0, 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 89, 90, 91, 92, 302, 0, 0, 0, 0, 0, - 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, - 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, - 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, - 0, 56, 24, 0, 25, 0, 0, 26, 254, 0, - 0, 0, 27, 61, 62, 0, 28, 0, 105, 303, - 107, 108, 64, 0, 0, 30, 0, 0, 0, 0, - 0, 0, 32, 0, 0, 0, 0, 33, 0, 71, - 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 89, 90, 91, 92, 93, 0, 0, 0, 0, + 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, + 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, + 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, + 0, 0, 655, 655, 0, 655, 0, 0, 655, 655, + 0, 0, 0, 655, 655, 655, 0, 655, 0, 105, + 106, 107, 108, 655, 0, 0, 655, 0, 0, 0, + 0, 0, 0, 655, 0, 0, 0, 0, 655, 0, + 655, 655, 655, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 655, 0, 655, 655, 0, 0, + 655, 0, 0, 655, 0, 655, 0, 655, 655, 655, + 655, 0, 655, 0, 0, 0, 0, 0, 0, 655, + 0, 0, 655, 655, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 655, 655, 655, + 655, 655, 0, 0, 0, 0, 0, 0, 0, 655, + 0, 0, 0, 0, 0, 655, 655, 655, 655, 0, + 0, 0, 655, 0, 655, 0, 0, 0, 0, 0, + 655, 655, 0, 0, 0, 0, 0, 0, 143, 143, + 0, 143, 0, 0, 143, 143, 0, 0, 0, 143, + 143, 143, 0, 143, 0, 655, 655, 655, 655, 143, + 0, 0, 143, 0, 0, 0, 0, 0, 0, 143, + 0, 0, 0, 0, 143, 0, 143, 143, 143, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 143, 0, 143, 143, 0, 0, 143, 0, 0, 143, + 0, 143, 0, 143, 143, 143, 143, 0, 143, 0, + 0, 0, 0, 0, 0, 143, 0, 0, 143, 143, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 143, 143, 143, 143, 143, 0, 0, + 0, 0, 0, 0, 0, 143, 0, 0, 0, 0, + 0, 143, 143, 143, 143, 0, 0, 0, 143, 0, + 143, 0, 0, 0, 0, 0, 143, 143, 0, 0, + 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, + 26, 254, 0, 0, 0, 27, 61, 62, 0, 28, + 0, 143, 143, 143, 143, 64, 0, 0, 30, 0, + 0, 0, 0, 0, 0, 32, 0, 31, 0, 0, + 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 36, 0, 37, 74, + 31, 0, 38, 0, 0, 76, 0, 78, 0, 80, + 39, 40, 255, 31, 41, 0, 0, 0, 31, 0, + 0, 0, 0, 31, 0, 31, 31, 31, 31, 0, + 0, 31, 0, 31, 0, 0, 0, 31, 0, 89, + 90, 91, 256, 342, 0, 0, 0, 0, 0, 31, + 0, 95, 31, 0, 31, 0, 0, 97, 98, 99, + 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, + 0, 0, 103, 104, 0, 0, 0, 0, 31, 0, + 0, 0, 0, 0, 31, 31, 0, 0, 0, 0, + 0, 0, 692, 0, 692, 0, 692, 105, 257, 692, + 108, 692, 692, 0, 692, 0, 692, 0, 692, 0, + 692, 692, 692, 0, 0, 0, 692, 692, 0, 0, + 0, 0, 692, 0, 692, 692, 0, 0, 0, 692, + 0, 0, 0, 692, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 692, 692, 0, 692, 0, 0, + 0, 692, 692, 0, 0, 0, 0, 0, 0, 692, + 692, 56, 24, 692, 25, 0, 692, 26, 254, 0, + 0, 692, 27, 61, 62, 0, 28, 0, 0, 0, + 0, 0, 64, 0, 0, 30, 0, 0, 0, 0, + 0, 0, 32, 692, 692, 0, 0, 33, 0, 71, + 72, 34, 0, 0, 0, 0, 692, 0, 0, 0, 0, 0, 0, 36, 0, 37, 74, 0, 0, 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, 255, - 0, 41, 0, 0, 0, 0, 0, 0, 86, 0, - 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 89, 90, 91, 92, - 302, 0, 0, 0, 531, 0, 0, 0, 95, 0, - 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, - 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, - 104, 0, 0, 0, 0, 0, 0, 56, 24, 0, - 25, 0, 0, 26, 254, 0, 0, 0, 27, 61, - 62, 0, 28, 0, 105, 303, 107, 108, 64, 0, - 0, 30, 0, 0, 0, 0, 0, 0, 32, 0, - 0, 0, 0, 33, 0, 71, 72, 34, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, - 0, 37, 74, 0, 0, 38, 0, 0, 76, 0, - 78, 0, 80, 39, 40, 255, 0, 41, 0, 0, - 0, 0, 0, 0, 86, 0, 0, 87, 88, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 89, 90, 91, 92, 302, 0, 0, 0, - 525, 0, 0, 0, 95, 0, 0, 0, 0, 0, - 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, - 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, - 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, - 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, - 105, 303, 107, 108, 64, 0, 0, 30, 0, 0, - 0, 0, 0, 0, 32, 0, 0, 0, 0, 33, - 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 36, 0, 37, 74, 0, - 0, 38, 0, 0, 76, 0, 78, 0, 80, 39, - 40, 255, 0, 41, 0, 0, 0, 0, 0, 0, - 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, - 91, 92, 302, 0, 0, 0, 0, 0, 0, 0, - 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, - 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, - 0, 103, 104, 0, 0, 0, 0, 0, 0, 56, - 24, 0, 25, 0, 0, 26, 254, 0, 0, 0, - 27, 61, 62, 0, 28, 0, 105, 303, 107, 108, - 64, 0, 0, 30, 0, 0, 0, 0, 0, 0, - 32, 0, 0, 0, 0, 33, 0, 71, 72, 34, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 36, 0, 37, 74, 0, 0, 38, 0, 0, - 76, 0, 78, 0, 80, 39, 40, 255, 0, 41, - 0, 0, 0, 0, 0, 0, 86, 0, 0, 87, - 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 89, 90, 91, 92, 93, 0, - 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, - 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, - 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, - 0, 0, 0, 0, 0, 655, 655, 0, 655, 0, - 0, 655, 655, 0, 0, 0, 655, 655, 655, 0, - 655, 0, 105, 106, 107, 108, 655, 0, 0, 655, - 0, 0, 0, 0, 0, 0, 655, 0, 0, 0, - 0, 655, 0, 655, 655, 655, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 655, 0, 655, - 655, 0, 0, 655, 0, 0, 655, 0, 655, 0, - 655, 655, 655, 655, 0, 655, 0, 0, 0, 0, - 0, 0, 655, 0, 0, 655, 655, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 655, 655, 655, 655, 655, 0, 0, 0, 0, 0, - 0, 0, 655, 0, 0, 0, 0, 0, 655, 655, - 655, 655, 0, 0, 0, 655, 0, 655, 0, 0, - 0, 0, 0, 655, 655, 0, 0, 0, 0, 0, - 0, 83, 83, 0, 83, 0, 0, 83, 83, 0, - 0, 0, 83, 83, 83, 0, 83, 0, 655, 655, - 655, 655, 83, 0, 0, 83, 0, 0, 0, 0, - 0, 0, 83, 0, 0, 0, 0, 83, 0, 83, - 83, 83, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 83, 0, 83, 83, 0, 0, 83, - 0, 0, 83, 0, 83, 0, 83, 83, 83, 83, - 0, 83, 0, 0, 0, 0, 0, 0, 83, 0, - 0, 83, 83, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 83, 83, 83, 83, - 83, 0, 0, 0, 0, 0, 0, 0, 83, 0, - 0, 0, 0, 0, 83, 83, 83, 83, 0, 0, - 0, 83, 0, 83, 0, 0, 0, 0, 0, 83, - 83, 0, 0, 0, 0, 0, 0, 143, 143, 0, - 143, 0, 0, 143, 143, 0, 0, 0, 143, 143, - 143, 0, 143, 0, 83, 83, 83, 83, 143, 0, - 0, 143, 0, 0, 0, 0, 0, 0, 143, 0, - 0, 0, 0, 143, 0, 143, 143, 143, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, - 0, 143, 143, 0, 0, 143, 0, 0, 143, 0, - 143, 0, 143, 143, 143, 143, 0, 143, 0, 0, - 0, 0, 0, 0, 143, 0, 0, 143, 143, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 143, 143, 143, 143, 143, 0, 0, 0, - 0, 0, 0, 0, 143, 0, 0, 0, 0, 0, - 143, 143, 143, 143, 0, 0, 0, 143, 0, 143, - 0, 0, 0, 0, 0, 143, 143, 0, 0, 0, - 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, - 254, 0, 0, 0, 27, 61, 62, 0, 28, 0, - 143, 143, 143, 143, 64, 0, 0, 30, 0, 0, - 0, 0, 0, 0, 32, 0, 31, 0, 0, 33, - 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 36, 0, 37, 74, 31, - 0, 38, 0, 0, 76, 0, 78, 0, 80, 39, - 40, 255, 31, 41, 0, 0, 0, 31, 0, 0, - 0, 0, 31, 0, 31, 31, 31, 31, 0, 0, - 31, 0, 31, 0, 0, 0, 31, 0, 89, 90, - 91, 256, 342, 0, 0, 0, 0, 0, 31, 0, - 95, 31, 0, 31, 0, 0, 97, 98, 99, 100, - 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, - 0, 103, 104, 0, 0, 0, 0, 31, 0, 0, - 0, 0, 0, 31, 31, 0, 0, 0, 0, 0, - 0, 692, 0, 692, 0, 692, 105, 257, 692, 108, - 692, 692, 0, 692, 0, 692, 0, 692, 0, 692, - 692, 692, 0, 0, 0, 692, 692, 0, 0, 0, - 0, 692, 0, 692, 692, 0, 0, 0, 692, 0, - 0, 0, 692, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 692, 692, 0, 692, 0, 0, 0, - 692, 692, 0, 0, 0, 0, 0, 0, 692, 692, - 56, 24, 692, 25, 0, 692, 26, 254, 0, 0, - 692, 27, 61, 62, 0, 28, 0, 0, 0, 0, - 0, 64, 0, 0, 30, 0, 0, 0, 0, 0, - 0, 32, 692, 692, 0, 0, 33, 0, 71, 72, - 34, 0, 0, 0, 0, 692, 0, 0, 0, 0, - 0, 0, 36, 0, 37, 74, 0, 0, 38, 0, - 0, 76, 0, 78, 0, 80, 39, 40, 255, 0, - 41, 0, 0, 84, 0, 0, 0, 0, 0, 0, - 24, 0, 25, 0, 0, 26, 692, 1285, 0, 0, - 27, 0, 0, 0, 28, 89, 90, 91, 256, 0, - 0, 0, 0, 30, 691, 0, 691, 95, 0, 691, - 32, 691, 691, 0, 691, 33, 691, 1286, 691, 34, - 691, 691, 691, 0, 0, 0, 691, 691, 0, 0, - 0, 36, 691, 37, 691, 691, 0, 38, 1287, 691, - 0, 0, 0, 691, 0, 39, 40, 0, 0, 41, - 0, 0, 324, 105, 257, 691, 0, 691, 0, 0, - 0, 691, 691, 0, 0, 0, 0, 0, 0, 691, - 691, 0, 691, 691, 691, 0, 691, 691, 0, 691, - 691, 691, 691, 0, 691, 0, 691, 0, 691, 691, - 691, 0, 0, 0, 691, 691, 0, 0, 0, 0, - 691, 0, 691, 691, 0, 0, 0, 691, 0, 0, - 0, 691, 0, 0, 0, 0, 691, 0, 0, 0, - 0, 0, 0, 691, 0, 691, 0, 0, 0, 691, - 691, 0, 0, 368, 0, 0, 0, 691, 691, 0, - 0, 691, 0, 0, 691, 0, 24, 0, 25, 691, - 0, 26, 0, 0, 1348, 0, 27, 691, 725, 0, - 28, 0, 726, 1349, 1350, 0, 0, 0, 1351, 30, - 0, 0, 0, 0, 1352, 0, 32, 0, 24, 0, - 25, 33, 0, 26, 0, 34, 1348, 0, 27, 0, - 725, 0, 28, 0, 726, 1349, 1350, 36, 0, 37, - 1351, 30, 0, 38, 0, 0, 1352, 0, 32, 0, - 0, 39, 40, 33, 0, 41, 0, 34, 1353, 0, - 0, 0, 51, 1354, 51, 691, 0, 51, 0, 36, - 0, 37, 51, 0, 0, 38, 51, 0, 0, 0, - 0, 0, 0, 39, 40, 51, 0, 41, 0, 0, - 1353, 0, 51, 0, 51, 1354, 51, 51, 1355, 51, - 0, 51, 0, 51, 51, 51, 0, 0, 51, 0, - 51, 0, 0, 51, 0, 51, 0, 51, 0, 51, - 0, 0, 51, 0, 51, 0, 0, 51, 51, 51, - 0, 51, 0, 51, 51, 51, 0, 51, 24, 1356, - 25, 0, 51, 26, 0, 51, 0, 51, 27, 0, - 0, 51, 28, 0, 51, 0, 0, 0, 0, 51, - 51, 30, 0, 51, 0, 0, 51, 0, 32, 162, - 0, 1356, 0, 33, 0, 0, 0, 34, 0, 585, - 0, 0, 0, 0, 0, 0, 586, 0, 0, 36, - 0, 37, 0, 0, 0, 38, 0, 0, 587, 162, - 0, 0, 0, 39, 40, 0, 0, 41, 0, 52, - 588, 52, 0, 0, 52, 51, 0, 0, 0, 52, - 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, - 0, 0, 52, 0, 0, 0, 589, 0, 0, 52, - 0, 51, 0, 51, 52, 0, 51, 51, 52, 0, - 52, 51, 52, 0, 0, 51, 0, 52, 0, 0, - 52, 0, 52, 0, 51, 0, 52, 0, 0, 52, - 0, 51, 0, 0, 52, 52, 51, 0, 52, 0, - 51, 52, 51, 0, 51, 24, 0, 25, 0, 51, - 26, 590, 51, 0, 51, 27, 0, 0, 51, 28, - 0, 51, 0, 0, 0, 0, 51, 51, 30, 0, - 51, 0, 0, 51, 0, 32, 0, 0, 0, 0, - 33, 0, 0, 0, 34, 0, 0, 0, 0, 37, - 0, 0, 0, 0, 0, 0, 36, 0, 37, 0, - 37, 0, 38, 0, 0, 37, 0, 0, 0, 37, - 39, 40, 37, 0, 41, 0, 0, 324, 0, 0, - 0, 0, 52, 0, 37, 37, 0, 0, 0, 37, - 37, 0, 0, 0, 0, 37, 0, 37, 37, 37, - 37, 0, 0, 291, 0, 37, 0, 0, 0, 37, - 0, 37, 0, 0, 51, 0, 0, 0, 0, 0, - 0, 37, 0, 37, 37, 35, 37, 0, 0, 0, - 37, 0, 0, 0, 0, 0, 35, 0, 0, 0, - 0, 35, 0, 0, 0, 35, 0, 0, 35, 0, - 37, 0, 0, 0, 0, 0, 37, 37, 325, 0, - 35, 35, 0, 0, 0, 35, 35, 31, 0, 31, - 0, 35, 0, 35, 35, 35, 35, 0, 0, 0, - 0, 35, 0, 0, 0, 35, 0, 35, 0, 0, - 31, 0, 0, 0, 0, 0, 0, 35, 0, 0, - 35, 0, 35, 31, 0, 0, 35, 0, 31, 0, - 0, 0, 0, 31, 0, 31, 31, 31, 31, 0, - 0, 0, 0, 31, 0, 0, 35, 31, 0, 0, - 51, 0, 35, 35, 0, 0, 0, 0, 0, 31, - 0, 51, 31, 0, 31, 0, 51, 0, 0, 0, - 51, 0, 0, 51, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 51, 51, 0, 31, 0, - 51, 51, 0, 51, 31, 31, 51, 0, 51, 51, - 51, 51, 0, 0, 51, 0, 51, 0, 0, 51, - 51, 0, 51, 51, 0, 0, 51, 0, 0, 0, - 0, 0, 51, 0, 0, 51, 0, 51, 51, 51, - 0, 51, 0, 51, 51, 51, 0, 0, 0, 51, - 0, 51, 51, 51, 51, 0, 0, 0, 0, 51, - 0, 51, 0, 51, 0, 51, 0, 39, 51, 0, - 0, 0, 0, 0, 0, 51, 0, 0, 51, 0, - 51, 51, 0, 51, 51, 0, 51, 0, 0, 0, - 0, 51, 0, 51, 51, 51, 51, 0, 0, 0, - 0, 51, 0, 0, 51, 51, 51, 0, 0, 0, - 40, 0, 0, 0, 0, 0, 0, 51, 0, 51, - 51, 51, 51, 0, 51, 0, 0, 0, 0, 51, - 0, 51, 51, 51, 51, 0, 0, 0, 0, 51, - 0, 0, 0, 51, 51, 0, 51, 0, 51, 51, - 0, 0, 204, 0, 0, 51, 0, 51, 51, 51, - 51, 51, 51, 0, 0, 0, 0, 51, 0, 51, + 0, 41, 0, 0, 84, 0, 0, 0, 0, 0, + 0, 24, 0, 25, 0, 0, 26, 692, 1285, 0, + 0, 27, 0, 0, 0, 28, 89, 90, 91, 256, + 0, 0, 0, 0, 30, 691, 0, 691, 95, 0, + 691, 32, 691, 691, 0, 691, 33, 691, 1286, 691, + 34, 691, 691, 691, 0, 0, 0, 691, 691, 0, + 0, 0, 36, 691, 37, 691, 691, 0, 38, 1287, + 691, 0, 0, 0, 691, 0, 39, 40, 0, 0, + 41, 0, 0, 324, 105, 257, 691, 0, 691, 0, + 0, 0, 691, 691, 0, 0, 0, 0, 0, 0, + 691, 691, 0, 691, 691, 691, 0, 691, 691, 0, + 691, 691, 691, 691, 0, 691, 0, 691, 0, 691, + 691, 691, 0, 0, 0, 691, 691, 0, 0, 0, + 0, 691, 0, 691, 691, 0, 0, 0, 691, 0, + 0, 0, 691, 0, 0, 0, 0, 691, 0, 0, + 0, 0, 0, 0, 691, 0, 691, 0, 0, 0, + 691, 691, 0, 0, 368, 0, 0, 0, 691, 691, + 0, 0, 691, 0, 0, 691, 0, 24, 0, 25, + 691, 0, 26, 0, 0, 1348, 0, 27, 691, 725, + 0, 28, 0, 726, 1349, 1350, 0, 0, 0, 1351, + 30, 0, 0, 0, 0, 1352, 0, 32, 0, 24, + 0, 25, 33, 0, 26, 0, 34, 1348, 0, 27, + 0, 725, 0, 28, 0, 726, 1349, 1350, 36, 0, + 37, 1351, 30, 0, 38, 0, 0, 1352, 0, 32, + 0, 0, 39, 40, 33, 0, 41, 0, 34, 1353, + 0, 0, 0, 51, 1354, 51, 691, 0, 51, 0, + 36, 0, 37, 51, 0, 0, 38, 51, 0, 0, + 0, 0, 0, 0, 39, 40, 51, 0, 41, 0, + 0, 1353, 0, 51, 0, 51, 1354, 51, 51, 1355, + 51, 0, 51, 0, 51, 51, 51, 0, 0, 51, + 0, 51, 0, 0, 51, 0, 51, 0, 51, 0, + 51, 0, 0, 51, 0, 51, 0, 0, 51, 51, + 51, 0, 51, 0, 51, 51, 51, 0, 51, 24, + 1356, 25, 0, 51, 26, 0, 51, 0, 51, 27, + 0, 0, 51, 28, 0, 51, 0, 0, 0, 0, + 51, 51, 30, 0, 51, 0, 0, 51, 0, 32, + 162, 0, 1356, 0, 33, 0, 0, 0, 34, 0, + 585, 0, 0, 0, 0, 0, 0, 586, 0, 0, + 36, 0, 37, 0, 0, 0, 38, 0, 0, 587, + 162, 0, 0, 0, 39, 40, 0, 0, 41, 0, + 52, 588, 52, 0, 0, 52, 51, 0, 0, 0, + 52, 0, 0, 0, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 52, 0, 0, 0, 589, 0, 0, + 52, 0, 51, 0, 51, 52, 0, 51, 51, 52, + 0, 52, 51, 52, 0, 0, 51, 0, 52, 0, + 0, 52, 0, 52, 0, 51, 0, 52, 0, 0, + 52, 0, 51, 0, 0, 52, 52, 51, 0, 52, + 0, 51, 52, 51, 0, 51, 24, 0, 25, 0, + 51, 26, 590, 51, 0, 51, 27, 0, 0, 51, + 28, 0, 51, 0, 0, 0, 0, 51, 51, 30, + 0, 51, 0, 0, 51, 0, 32, 0, 0, 0, + 0, 33, 0, 0, 0, 34, 0, 0, 0, 0, + 37, 0, 0, 0, 0, 0, 0, 36, 0, 37, + 0, 37, 0, 38, 0, 0, 37, 0, 0, 0, + 37, 39, 40, 37, 0, 41, 0, 0, 324, 0, + 0, 0, 0, 52, 0, 37, 37, 0, 0, 0, + 37, 37, 0, 0, 0, 0, 37, 0, 37, 37, + 37, 37, 0, 0, 291, 0, 37, 0, 0, 0, + 37, 0, 37, 0, 0, 51, 0, 0, 0, 0, + 0, 0, 37, 0, 37, 37, 35, 37, 0, 0, + 0, 37, 0, 0, 0, 0, 0, 35, 0, 0, + 0, 0, 35, 0, 0, 0, 35, 0, 0, 35, + 0, 37, 0, 0, 0, 0, 0, 37, 37, 325, + 0, 35, 35, 0, 0, 0, 35, 35, 31, 0, + 31, 0, 35, 0, 35, 35, 35, 35, 0, 0, + 0, 0, 35, 0, 0, 0, 35, 0, 35, 0, + 0, 31, 0, 0, 0, 0, 0, 0, 35, 0, + 0, 35, 0, 35, 31, 0, 0, 35, 0, 31, + 0, 0, 0, 0, 31, 0, 31, 31, 31, 31, + 0, 0, 0, 0, 31, 0, 0, 35, 31, 0, + 0, 51, 0, 35, 35, 0, 0, 0, 0, 0, + 31, 0, 51, 31, 0, 31, 0, 51, 0, 0, + 0, 51, 0, 0, 51, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 51, 51, 0, 31, + 0, 51, 51, 0, 51, 31, 31, 51, 0, 51, 51, 51, 51, 0, 0, 51, 0, 51, 0, 0, - 0, 51, 51, 0, 51, 0, 51, 51, 0, 0, - 206, 0, 0, 51, 0, 51, 51, 51, 51, 0, - 51, 0, 0, 0, 0, 51, 0, 51, 51, 51, - 51, 0, 0, 0, 0, 51, 0, 0, 0, 51, - 51, 0, 51, 0, 0, 0, 0, 51, 308, 51, - 0, 51, 0, 51, 51, 0, 51, 0, 51, 0, - 0, 0, 0, 51, 0, 51, 51, 51, 51, 0, - 51, 0, 0, 51, 0, 0, 0, 51, 0, 0, - 51, 0, 0, 51, 0, 0, 309, 465, 51, 51, - 0, 0, 51, 51, 51, 51, 51, 51, 51, 0, - 0, 51, 0, 51, 0, 0, 0, 51, 0, 0, - 466, 0, 0, 0, 0, 0, 0, 465, 51, 51, - 51, 51, 51, 467, 51, 0, 0, 468, 469, 0, - 0, 0, 0, 470, 0, 471, 472, 473, 474, 0, - 466, 0, 0, 475, 0, 0, 0, 476, 51, 0, - 0, 0, 0, 467, 0, 0, 0, 0, 469, 477, - 0, 0, 478, 470, 479, 471, 472, 473, 474, 0, - 0, 0, 0, 475, 0, 0, 0, 476, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 480, 477, - 0, 0, 478, 0, 479, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 480, + 51, 51, 0, 51, 51, 0, 0, 51, 0, 0, + 0, 0, 0, 51, 0, 0, 51, 0, 51, 51, + 51, 0, 51, 0, 51, 51, 51, 0, 0, 0, + 51, 0, 51, 51, 51, 51, 0, 0, 0, 0, + 51, 0, 51, 0, 51, 0, 51, 0, 39, 51, + 0, 0, 0, 0, 0, 0, 51, 0, 0, 51, + 0, 51, 51, 0, 51, 51, 0, 51, 0, 0, + 0, 0, 51, 0, 51, 51, 51, 51, 0, 0, + 0, 0, 51, 0, 0, 51, 51, 51, 0, 0, + 0, 40, 0, 0, 0, 0, 0, 0, 51, 0, + 51, 51, 51, 51, 0, 51, 0, 0, 0, 0, + 51, 0, 51, 51, 51, 51, 0, 0, 0, 0, + 51, 0, 0, 0, 51, 51, 0, 51, 0, 51, + 51, 0, 0, 204, 0, 0, 51, 0, 51, 51, + 51, 51, 51, 51, 0, 0, 0, 0, 51, 0, + 51, 51, 51, 51, 0, 0, 51, 0, 51, 0, + 0, 0, 51, 51, 0, 51, 0, 51, 51, 0, + 0, 206, 0, 0, 51, 0, 51, 51, 51, 51, + 0, 51, 0, 0, 0, 0, 51, 0, 51, 51, + 51, 51, 0, 0, 0, 0, 51, 0, 0, 0, + 51, 51, 0, 51, 0, 0, 0, 0, 51, 308, + 51, 0, 51, 0, 51, 51, 0, 51, 0, 51, + 0, 0, 0, 0, 51, 0, 51, 51, 51, 51, + 0, 51, 0, 0, 51, 0, 0, 0, 51, 0, + 0, 51, 0, 0, 51, 0, 0, 309, 465, 51, + 51, 0, 0, 51, 51, 51, 51, 51, 51, 51, + 0, 0, 51, 0, 51, 0, 0, 0, 51, 0, + 0, 466, 0, 0, 0, 0, 0, 0, 465, 51, + 51, 51, 51, 51, 467, 51, 0, 0, 468, 469, + 0, 0, 0, 0, 470, 0, 471, 472, 473, 474, + 0, 466, 0, 0, 475, 0, 0, 0, 476, 51, + 0, 0, 0, 0, 467, 0, 0, 0, 0, 469, + 477, 0, 0, 478, 470, 479, 471, 472, 473, 474, + 0, 0, 0, 0, 475, 0, 0, 0, 476, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, + 477, 0, 0, 478, 0, 479, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, }; protected static readonly short [] yyCheck = { 17, 17, 4, 18, 300, 299, 529, 17, 87, 88, 51, @@ -12579,167 +12576,167 @@ void case_1034() 331, 289, 418, 286, 568, 1478, 294, 295, 418, 418, 824, 328, 592, 256, 364, 331, 333, 601, 358, 418, 452, 309, 157, 277, 1269, 374, 17, 368, 157, 317, - 157, 319, 1505, 381, 256, 323, 319, 318, 257, 256, + 157, 319, 1505, 381, 909, 323, 319, 318, 257, 256, 391, 257, 256, 256, 1517, 369, 1519, 335, 336, 325, - 400, 401, 1366, 256, 367, 487, 369, 344, 375, 294, + 400, 401, 1366, 256, 418, 487, 325, 344, 375, 294, 256, 378, 256, 414, 157, 382, 383, 358, 371, 1091, 945, 306, 344, 256, 256, 256, 256, 256, 428, 429, - 335, 422, 1472, 371, 424, 425, 426, 427, 256, 199, + 1275, 422, 1472, 371, 424, 425, 426, 427, 256, 199, 200, 157, 256, 157, 382, 383, 1044, 256, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 363, 286, 428, 429, 914, 989, 432, 991, 1362, 1538, 994, - 363, 257, 256, 1368, 704, 339, 325, 370, 256, 372, + 363, 257, 256, 1368, 704, 339, 1321, 370, 256, 372, 418, 374, 256, 256, 446, 305, 256, 446, 1351, 256, - 368, 705, 418, 319, 456, 725, 369, 256, 1568, 371, + 368, 705, 418, 319, 456, 725, 374, 256, 1568, 418, 1395, 256, 262, 367, 367, 372, 947, 371, 590, 373, 374, 375, 376, 376, 418, 419, 157, 381, 344, 266, 351, 367, 375, 605, 926, 418, 608, 609, 288, 453, 454, 375, 448, 418, 256, 459, 503, 496, 505, 368, - 300, 748, 375, 375, 374, 374, 462, 266, 308, 262, - 1275, 429, 391, 257, 372, 369, 1081, 256, 1083, 372, - 1085, 256, 529, 263, 701, 374, 497, 314, 272, 418, - 372, 504, 341, 277, 1172, 414, 765, 281, 372, 546, - 733, 363, 1180, 550, 957, 298, 370, 856, 363, 527, - 374, 529, 296, 531, 372, 314, 1321, 1038, 372, 372, - 369, 1409, 372, 740, 364, 372, 1204, 367, 1072, 839, - 369, 542, 543, 695, 369, 315, 429, 277, 556, 323, - 256, 281, 368, 561, 591, 839, 418, 429, 375, 294, - 546, 1439, 1440, 715, 1442, 429, 418, 574, 342, 570, - 400, 401, 341, 418, 339, 1453, 428, 369, 1456, 344, - 581, 346, 574, 428, 349, 350, 375, 352, 353, 1184, - 363, 1259, 272, 1471, 601, 378, 379, 277, 428, 429, - 369, 281, 368, 256, 376, 613, 614, 1141, 504, 601, - 305, 264, 342, 429, 914, 376, 296, 1495, 448, 1214, - 369, 1064, 357, 1066, 373, 1357, 911, 256, 363, 913, - 368, 368, 462, 256, 369, 1367, 376, 372, 373, 862, - 368, 1507, 1508, 323, 681, 418, 683, 1176, 363, 256, - 941, 386, 263, 363, 369, 692, 368, 429, 371, 256, - 775, 367, 342, 429, 429, 371, 1261, 373, 374, 367, - 376, 679, 325, 371, 423, 381, 684, 685, 574, 687, - 363, 343, 305, 418, 946, 1280, 421, 944, 343, 374, - 372, 429, 429, 371, 376, 982, 733, 256, 1564, 363, - 6, 429, 339, 418, 315, 601, 418, 420, 418, 415, - 339, 17, 363, 750, 256, 344, 546, 346, 369, 381, - 349, 350, 420, 352, 353, 733, 796, 1039, 765, 391, - 367, 416, 339, 1205, 256, 418, 391, 344, 568, 346, + 300, 748, 375, 375, 374, 374, 462, 256, 308, 262, + 367, 277, 335, 257, 372, 281, 1081, 371, 1083, 376, + 1085, 256, 529, 957, 701, 374, 497, 314, 272, 1507, + 1508, 504, 363, 277, 1172, 1275, 765, 281, 369, 546, + 733, 363, 1180, 550, 256, 298, 370, 856, 256, 527, + 374, 529, 296, 531, 372, 305, 372, 1038, 372, 372, + 269, 1409, 372, 740, 364, 372, 1204, 367, 1072, 839, + 369, 542, 543, 695, 369, 369, 342, 286, 556, 323, + 256, 1321, 294, 561, 591, 839, 1564, 418, 375, 294, + 546, 1439, 1440, 715, 1442, 266, 418, 574, 342, 570, + 400, 401, 343, 372, 339, 1453, 428, 369, 1456, 344, + 581, 346, 574, 429, 349, 350, 368, 352, 353, 1184, + 369, 1259, 368, 1471, 601, 378, 379, 363, 428, 429, + 1064, 363, 1066, 341, 256, 613, 614, 1141, 504, 601, + 381, 368, 264, 314, 914, 367, 368, 1495, 448, 1214, + 391, 343, 357, 372, 376, 1357, 911, 256, 363, 913, + 429, 369, 462, 363, 369, 1367, 418, 372, 373, 862, + 368, 368, 263, 414, 681, 1275, 683, 1176, 371, 256, + 941, 386, 418, 429, 367, 692, 418, 428, 371, 256, + 775, 367, 428, 363, 429, 371, 1261, 373, 374, 391, + 376, 679, 429, 325, 375, 381, 684, 685, 574, 687, + 429, 343, 376, 418, 946, 1280, 421, 944, 418, 368, + 1275, 1321, 414, 1039, 315, 982, 733, 256, 368, 21, + 6, 429, 429, 272, 376, 601, 428, 420, 277, 415, + 339, 17, 281, 750, 374, 344, 546, 346, 418, 381, + 349, 350, 1068, 352, 353, 733, 796, 296, 765, 391, + 52, 363, 339, 1205, 376, 429, 1321, 344, 568, 346, 748, 765, 349, 350, 256, 352, 353, 272, 726, 819, - 367, 802, 414, 59, 418, 763, 1068, 63, 343, 414, - 386, 769, 592, 305, 1041, 835, 428, 418, 805, 1054, - 367, 296, 294, 428, 371, 339, 373, 374, 1275, 376, - 339, 87, 88, 1006, 381, 344, 21, 346, 256, 1275, - 349, 350, 371, 352, 353, 1371, 381, 798, 323, 357, - 429, 838, 108, 367, 956, 363, 391, 1275, 816, 1385, - 818, 369, 376, 384, 372, 373, 374, 52, 272, 856, - 828, 822, 429, 824, 1321, 862, 389, 339, 386, 414, - 1134, 1407, 344, 357, 346, 1321, 385, 349, 350, 998, - 352, 353, 296, 428, 1275, 915, 400, 339, 856, 373, - 1275, 157, 1275, 1321, 862, 887, 864, 368, 866, 256, - 418, 401, 386, 1129, 760, 376, 762, 1275, 272, 323, - 429, 339, 1176, 413, 704, 367, 344, 1162, 346, 347, + 429, 802, 414, 59, 323, 763, 416, 63, 371, 429, + 263, 769, 592, 369, 1041, 835, 428, 373, 805, 1054, + 367, 296, 367, 342, 371, 256, 373, 374, 341, 376, + 339, 87, 88, 1006, 381, 344, 418, 346, 256, 363, + 349, 350, 386, 352, 353, 369, 256, 798, 323, 357, + 429, 838, 108, 256, 956, 363, 369, 420, 816, 269, + 818, 369, 315, 391, 372, 373, 374, 423, 272, 856, + 828, 822, 429, 824, 305, 862, 286, 339, 386, 1275, + 1134, 401, 344, 357, 346, 294, 414, 349, 350, 998, + 352, 353, 296, 413, 418, 915, 384, 306, 856, 373, + 1275, 157, 305, 369, 862, 887, 864, 370, 866, 256, + 418, 374, 386, 1129, 760, 381, 762, 1275, 272, 323, + 429, 339, 1176, 371, 704, 1321, 344, 1162, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 918, - 1321, 390, 296, 199, 200, 725, 1321, 369, 1321, 1165, - 368, 909, 370, 911, 372, 306, 374, 375, 376, 381, - 896, 1063, 313, 1321, 951, 811, 953, 429, 814, 323, - 928, 256, 959, 901, 325, 933, 357, 269, 936, 1385, - 381, 357, 1155, 294, 269, 369, 1202, 945, 1242, 947, - 391, 1011, 373, 369, 286, 306, 372, 373, 985, 1460, - 367, 286, 371, 256, 373, 386, 262, 1274, 1275, 376, - 386, 429, 418, 414, 367, 368, 796, 367, 368, 1006, + 306, 385, 296, 199, 200, 725, 1321, 313, 1275, 1165, + 368, 909, 370, 911, 372, 339, 374, 375, 376, 325, + 896, 1063, 367, 1321, 951, 811, 953, 429, 814, 323, + 928, 376, 959, 901, 339, 933, 1371, 339, 936, 1385, + 400, 357, 1155, 367, 357, 381, 1202, 945, 1242, 947, + 1385, 1011, 376, 369, 1321, 391, 372, 373, 985, 1460, + 373, 368, 367, 256, 389, 367, 262, 1274, 1275, 376, + 386, 429, 1407, 386, 367, 368, 796, 367, 414, 1006, 367, 368, 369, 376, 371, 372, 376, 374, 1295, 376, - 286, 989, 288, 991, 371, 1022, 994, 367, 367, 819, - 367, 1028, 415, 256, 300, 421, 376, 376, 1006, 376, - 418, 306, 308, 308, 1321, 835, 1323, 256, 313, 839, - 1331, 1522, 368, 319, 1221, 1217, 1282, 1003, 374, 1340, - 325, 418, 277, 420, 368, 1193, 423, 374, 372, 376, + 286, 989, 288, 991, 368, 1022, 994, 367, 1331, 819, + 374, 1028, 376, 256, 300, 421, 376, 1340, 1006, 394, + 395, 306, 308, 308, 1321, 835, 1323, 373, 313, 839, + 376, 1522, 306, 319, 1221, 1217, 1282, 1003, 370, 313, + 325, 418, 374, 420, 368, 1193, 423, 374, 372, 376, 1038, 1331, 376, 1041, 381, 1013, 339, 1015, 344, 1017, 1340, 344, 371, 346, 373, 368, 349, 350, 1559, 352, - 353, 374, 306, 376, 368, 382, 383, 376, 364, 313, - 374, 367, 1366, 372, 1351, 374, 896, 1581, 1582, 396, - 397, 1072, 372, 1081, 374, 1083, 339, 1085, 370, 371, - 1088, 344, 374, 346, 914, 915, 349, 350, 373, 352, - 353, 376, 368, 256, 400, 401, 372, 368, 374, 376, - 376, 372, 265, 374, 267, 376, 1099, 270, 394, 395, - 370, 371, 275, 373, 374, 375, 279, 370, 1155, 372, - 370, 1129, 428, 429, 374, 288, 429, 1134, 1157, 372, - 370, 374, 295, 376, 374, 1143, 1144, 300, 367, 370, - 1141, 304, 1134, 374, 374, 370, 376, 1155, 1044, 374, + 353, 374, 390, 370, 371, 382, 383, 374, 364, 370, + 369, 367, 1366, 374, 1351, 418, 896, 1581, 1582, 396, + 397, 1072, 371, 1081, 370, 1083, 339, 1085, 374, 369, + 1088, 344, 372, 346, 914, 915, 349, 350, 373, 352, + 353, 376, 368, 256, 400, 401, 372, 368, 374, 415, + 376, 372, 265, 374, 267, 376, 1099, 270, 354, 355, + 370, 371, 275, 373, 374, 375, 279, 371, 1155, 373, + 372, 1129, 428, 429, 376, 288, 429, 1134, 1157, 372, + 370, 374, 295, 376, 374, 1143, 1144, 300, 418, 372, + 1141, 304, 1134, 376, 367, 372, 369, 1155, 1044, 376, 1156, 256, 982, 316, 1162, 318, 370, 1165, 372, 322, 374, 1193, 373, 1195, 1193, 376, 1195, 330, 331, 1176, - 373, 334, 368, 1003, 337, 371, 1184, 373, 374, 370, - 294, 1011, 1190, 374, 1176, 1217, 372, 1472, 1217, 370, - 376, 372, 376, 374, 1202, 372, 392, 393, 504, 376, - 363, 370, 376, 1273, 1356, 374, 1214, 1215, 372, 294, - 369, 373, 376, 372, 376, 370, 412, 372, 370, 1251, - 372, 370, 1251, 372, 420, 367, 372, 423, 374, 371, - 1382, 373, 374, 343, 376, 1242, 368, 369, 1134, 381, - 546, 372, 1274, 1275, 414, 1274, 368, 1399, 376, 371, - 1242, 373, 374, 1261, 356, 418, 386, 387, 388, 381, - 1330, 418, 568, 1295, 418, 1417, 1295, 1419, 574, 369, - 392, 393, 1280, 415, 1282, 372, 1172, 374, 1348, 1349, - 1176, 370, 418, 372, 1180, 375, 592, 1324, 372, 1321, - 412, 1323, 372, 285, 1323, 601, 368, 370, 420, 372, - 374, 423, 376, 1373, 398, 399, 1376, 93, 1204, 354, + 277, 334, 368, 1003, 337, 371, 1184, 373, 374, 370, + 367, 1011, 1190, 374, 1176, 1217, 372, 1472, 1217, 370, + 376, 372, 376, 374, 1202, 256, 392, 393, 504, 372, + 363, 374, 294, 1273, 1356, 376, 1214, 1215, 406, 407, + 408, 409, 386, 387, 388, 372, 412, 374, 370, 1251, + 372, 374, 1251, 376, 420, 367, 370, 423, 372, 371, + 1382, 373, 374, 373, 376, 1242, 398, 399, 1134, 381, + 546, 376, 1274, 1275, 376, 1274, 368, 1399, 294, 371, + 1242, 373, 374, 1261, 370, 418, 372, 368, 369, 381, + 1330, 343, 568, 1295, 372, 1417, 1295, 1419, 574, 414, + 392, 393, 1280, 415, 1282, 370, 1172, 372, 1348, 1349, + 1176, 372, 376, 374, 1180, 418, 592, 1324, 356, 1321, + 412, 1323, 418, 285, 1323, 601, 369, 372, 420, 374, + 370, 423, 372, 1373, 368, 369, 1376, 93, 1204, 354, 355, 97, 98, 99, 100, 101, 102, 103, 104, 371, - 374, 373, 376, 61, 374, 376, 376, 65, 66, 67, - 374, 69, 70, 1334, 381, 327, 74, 75, 354, 355, - 392, 393, 374, 81, 376, 83, 1242, 85, 406, 407, - 408, 409, 90, 91, 368, 369, 294, 414, 415, 1366, - 412, 364, 365, 1259, 372, 373, 1196, 372, 420, 364, - 365, 423, 1160, 1161, 1366, 294, 114, 374, 0, 372, - 1409, 402, 403, 410, 411, 377, 378, 379, 380, 1390, - 382, 383, 384, 385, 386, 387, 388, 389, 704, 372, - 392, 393, 394, 395, 396, 397, 398, 399, 404, 405, - 1439, 1440, 374, 1442, 372, 256, 376, 428, 1450, 725, - 371, 428, 256, 1253, 1453, 294, 294, 1456, 381, 372, - 374, 373, 418, 373, 375, 1467, 381, 374, 372, 374, - 429, 374, 1471, 1273, 374, 374, 423, 0, 1480, 1481, - 372, 374, 1460, 374, 760, 367, 762, 1458, 421, 372, - 343, 294, 373, 372, 1472, 294, 1495, 374, 374, 418, - 1366, 370, 418, 371, 367, 1507, 1508, 256, 375, 256, - 374, 1489, 256, 256, 280, 381, 256, 367, 372, 368, - 796, 343, 370, 381, 371, 376, 423, 370, 374, 374, - 1330, 1331, 376, 347, 256, 811, 372, 372, 814, 372, - 1340, 367, 256, 819, 1522, 372, 302, 255, 1348, 1349, - 258, 1351, 381, 381, 372, 376, 368, 1357, 256, 835, - 347, 374, 1564, 839, 370, 375, 367, 1367, 370, 339, - 370, 1371, 348, 1373, 1581, 1582, 1376, 372, 334, 368, - 348, 1559, 374, 256, 418, 1385, 342, 381, 418, 372, - 298, 368, 367, 367, 1565, 1566, 367, 381, 376, 368, - 372, 1572, 1573, 1581, 1582, 356, 314, 1407, 402, 403, + 370, 373, 372, 61, 414, 415, 375, 65, 66, 67, + 418, 69, 70, 1334, 376, 327, 74, 75, 372, 373, + 392, 393, 374, 81, 376, 83, 1242, 85, 374, 374, + 376, 376, 90, 91, 374, 372, 376, 364, 365, 1366, + 412, 364, 365, 1259, 402, 403, 1196, 372, 420, 1160, + 1161, 423, 381, 368, 1366, 374, 114, 294, 0, 372, + 1409, 404, 405, 410, 411, 377, 378, 379, 380, 1390, + 382, 383, 384, 385, 386, 387, 388, 389, 704, 294, + 392, 393, 394, 395, 396, 397, 398, 399, 374, 372, + 1439, 1440, 372, 1442, 372, 374, 256, 428, 1450, 725, + 376, 371, 428, 1253, 1453, 256, 294, 1456, 294, 381, + 372, 374, 373, 418, 374, 1467, 375, 373, 372, 374, + 429, 374, 1471, 1273, 381, 374, 374, 0, 1480, 1481, + 423, 372, 1460, 367, 760, 374, 762, 1458, 374, 421, + 372, 343, 373, 372, 1472, 294, 1495, 374, 294, 374, + 1366, 418, 370, 418, 371, 1507, 1508, 367, 256, 375, + 256, 1489, 374, 256, 256, 280, 256, 381, 367, 372, + 796, 368, 343, 371, 370, 376, 376, 370, 372, 374, + 1330, 1331, 374, 372, 347, 811, 367, 372, 814, 256, + 1340, 381, 256, 819, 1522, 423, 302, 255, 1348, 1349, + 258, 1351, 381, 381, 372, 372, 376, 1357, 256, 835, + 368, 347, 1564, 839, 370, 374, 370, 1367, 375, 367, + 370, 1371, 339, 1373, 1581, 1582, 1376, 372, 334, 348, + 368, 1559, 374, 372, 418, 1385, 342, 381, 418, 348, + 298, 256, 368, 367, 1565, 1566, 367, 367, 381, 376, + 368, 1572, 1573, 1581, 1582, 356, 314, 1407, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 376, 371, - 374, 337, 368, 368, 305, 418, 368, 418, 418, 368, - 371, 369, 367, 418, 371, 367, 369, 371, 914, 915, + 374, 368, 372, 368, 368, 337, 305, 418, 418, 368, + 371, 369, 367, 418, 371, 367, 418, 371, 914, 915, 376, 397, 398, 399, 371, 373, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, - 416, 417, 381, 381, 371, 257, 371, 371, 374, 261, - 372, 372, 256, 373, 373, 367, 372, 374, 0, 374, - 272, 374, 376, 372, 370, 277, 376, 418, 418, 281, - 372, 376, 284, 418, 418, 372, 376, 381, 372, 368, - 370, 372, 381, 368, 296, 297, 982, 315, 263, 301, - 302, 371, 371, 368, 372, 307, 372, 309, 310, 311, - 312, 0, 0, 367, 376, 317, 368, 376, 0, 321, - 368, 323, 372, 256, 368, 1011, 372, 372, 261, 262, - 418, 333, 370, 335, 336, 372, 338, 368, 372, 367, - 342, 370, 418, 376, 418, 368, 376, 368, 372, 376, - 376, 284, 368, 367, 367, 372, 368, 372, 1044, 525, - 362, 368, 367, 373, 297, 298, 368, 369, 376, 302, - 376, 315, 305, 376, 307, 376, 309, 310, 311, 312, - 376, 499, 263, 376, 317, 376, 376, 376, 321, 50, - 12, 5, 325, 896, 1155, 0, 1003, 1155, 1323, 1295, - 333, 1512, 1475, 336, 1528, 338, 339, 1463, 1492, 1458, - 1371, 344, 918, 346, 347, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 542, 918, 918, 739, 1321, 362, - 363, 597, 913, 1573, 367, 368, 1391, 370, 371, 372, - 1567, 374, 375, 376, 1485, 378, 379, 1481, 1134, 382, - 383, 384, 385, 1480, 1566, 1251, 389, 390, 887, 1419, - 546, 394, 395, 396, 397, 398, 399, 400, 401, 941, - 936, 1253, 769, 862, 382, 614, 1054, 71, 337, 413, - 413, 733, 765, 416, 412, 418, 1172, 414, 417, 415, - 1176, 416, 839, 265, 1180, 267, 429, 568, 270, 1231, - 1330, 157, 1134, 275, 1040, 1144, 1120, 279, 1068, 1024, - 1196, 283, 1134, 1132, 1205, 961, 288, 437, 1204, 544, - 690, 293, 437, 295, 1326, 257, 893, 1215, 300, 261, - 892, -1, 304, 305, -1, -1, -1, -1, -1, -1, + 416, 417, 381, 381, 371, 257, 371, 369, 371, 261, + 374, 372, 372, 256, 373, 381, 373, 368, 0, 374, + 272, 374, 374, 372, 372, 277, 376, 418, 370, 281, + 376, 376, 284, 418, 418, 372, 418, 372, 376, 372, + 381, 370, 372, 367, 296, 297, 982, 368, 315, 301, + 302, 263, 371, 371, 368, 307, 372, 309, 310, 311, + 312, 372, 0, 0, 367, 317, 376, 368, 376, 321, + 372, 323, 0, 256, 368, 1011, 372, 372, 261, 262, + 370, 333, 418, 335, 336, 368, 338, 372, 368, 376, + 342, 372, 370, 367, 376, 418, 418, 368, 368, 376, + 372, 284, 368, 376, 367, 367, 367, 372, 1044, 525, + 362, 368, 372, 368, 297, 298, 368, 369, 376, 302, + 373, 315, 305, 263, 307, 376, 309, 310, 311, 312, + 376, 499, 376, 50, 317, 376, 376, 376, 321, 376, + 376, 12, 325, 5, 1003, 0, 896, 1155, 1155, 1323, + 333, 1295, 1475, 336, 1528, 338, 339, 1512, 1463, 1492, + 1458, 344, 913, 346, 347, 348, 349, 350, 351, 352, + 353, 354, 355, 356, 542, 918, 918, 739, 918, 362, + 363, 597, 1573, 1321, 367, 368, 1371, 370, 371, 372, + 1391, 374, 375, 376, 1567, 378, 379, 1485, 1134, 382, + 383, 384, 385, 1481, 1480, 1566, 389, 390, 1251, 1419, + 887, 394, 395, 396, 397, 398, 399, 400, 401, 546, + 936, 1253, 941, 382, 769, 614, 71, 1054, 862, 765, + 413, 337, 733, 416, 412, 418, 1172, 413, 415, 414, + 1176, 839, 416, 265, 1180, 267, 429, 417, 270, 1330, + 1231, 568, 157, 275, 1134, 1040, 1120, 279, 1144, 1068, + 1196, 283, 1134, 1024, 1132, 1205, 288, 690, 1204, 544, + 437, 293, 961, 295, 437, 257, 1326, 1215, 300, 261, + 893, 892, 304, 305, -1, -1, -1, -1, -1, -1, 272, -1, -1, -1, 316, 277, 318, -1, -1, 281, 322, -1, 284, -1, -1, -1, 1242, -1, 330, 331, -1, -1, 334, 0, 296, 297, -1, 1253, -1, 301, @@ -13575,36 +13572,91 @@ void case_1034() 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 316, -1, 318, 319, -1, -1, 322, -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, -1, - 334, -1, -1, -1, -1, -1, -1, -1, -1, 343, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 334, -1, -1, -1, -1, -1, -1, 341, -1, -1, + 344, 345, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, -1, 371, -1, -1, - -1, -1, -1, 377, 378, 379, 380, 381, -1, -1, - 384, -1, 386, 256, -1, -1, -1, -1, 392, 393, - -1, 264, 265, -1, 267, -1, -1, 270, 271, -1, - -1, -1, 275, 276, 277, -1, 279, -1, -1, -1, - -1, -1, 285, 417, 418, 288, 420, -1, -1, -1, - -1, -1, 295, -1, -1, -1, -1, 300, -1, 302, - 303, 304, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 316, -1, 318, 319, -1, -1, 322, - -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, - -1, 334, -1, -1, -1, -1, -1, -1, -1, -1, - 343, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, - 363, -1, -1, -1, -1, -1, -1, -1, 371, -1, - -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, - -1, 384, -1, 386, 256, -1, -1, -1, -1, 392, - 393, -1, 264, 265, -1, 267, -1, -1, 270, 271, - -1, -1, -1, 275, 276, 277, -1, 279, -1, -1, - -1, -1, -1, 285, 417, 418, 288, 420, -1, -1, - -1, -1, -1, 295, -1, -1, -1, -1, 300, -1, - 302, 303, 304, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 316, -1, 318, 319, -1, -1, - 322, -1, -1, 325, -1, 327, -1, 329, 330, 331, - 332, -1, 334, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, + 384, -1, 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, - 362, 363, -1, -1, -1, -1, -1, -1, -1, 371, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, + -1, -1, -1, 417, 418, 419, 420, 264, 265, -1, + 267, -1, -1, 270, 271, -1, -1, -1, 275, 276, + 277, -1, 279, -1, -1, -1, -1, -1, 285, -1, + -1, 288, -1, -1, -1, -1, -1, -1, 295, -1, + -1, -1, -1, 300, -1, 302, 303, 304, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 316, + -1, 318, 319, -1, -1, 322, -1, -1, 325, -1, + 327, -1, 329, 330, 331, 332, -1, 334, -1, -1, + -1, -1, -1, -1, -1, -1, 343, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 359, 360, 361, 362, 363, -1, -1, -1, + -1, -1, -1, -1, 371, -1, -1, -1, -1, -1, + 377, 378, 379, 380, 381, -1, -1, 384, -1, 386, + 256, -1, -1, -1, -1, 392, 393, -1, 264, 265, + -1, 267, -1, -1, 270, 271, -1, -1, -1, 275, + 276, 277, -1, 279, -1, -1, -1, -1, -1, 285, + 417, 418, 288, 420, -1, -1, -1, -1, -1, 295, + -1, -1, -1, -1, 300, -1, 302, 303, 304, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 316, -1, 318, 319, -1, -1, 322, -1, -1, 325, + -1, 327, -1, 329, 330, 331, 332, -1, 334, -1, + -1, -1, -1, -1, -1, -1, -1, 343, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, + -1, -1, -1, -1, -1, 371, -1, -1, -1, -1, + -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, + 386, 256, -1, -1, -1, -1, 392, 393, -1, 264, + 265, -1, 267, -1, -1, 270, 271, -1, -1, -1, + 275, 276, 277, -1, 279, -1, -1, -1, -1, -1, + 285, 417, 418, 288, 420, -1, -1, -1, -1, -1, + 295, -1, -1, -1, -1, 300, -1, 302, 303, 304, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 316, -1, 318, 319, -1, -1, 322, -1, -1, + 325, -1, 327, -1, 329, 330, 331, 332, -1, 334, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, + -1, -1, -1, -1, -1, -1, 371, -1, -1, -1, + -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, + -1, 386, 256, -1, -1, -1, -1, 392, 393, -1, + 264, 265, -1, 267, -1, -1, 270, 271, -1, -1, + -1, 275, 276, 277, -1, 279, -1, -1, -1, -1, + -1, 285, 417, 418, 288, 420, -1, -1, -1, -1, + -1, 295, -1, -1, -1, -1, 300, -1, 302, 303, + 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 316, -1, 318, 319, -1, -1, 322, -1, + -1, 325, -1, 327, -1, 329, 330, 331, 332, -1, + 334, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 359, 360, 361, 362, 363, + -1, -1, -1, -1, -1, -1, -1, 371, -1, -1, + -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, + 384, -1, 386, 256, -1, -1, -1, -1, 392, 393, + -1, 264, 265, -1, 267, -1, -1, 270, 271, -1, + -1, -1, 275, 276, 277, -1, 279, -1, -1, -1, + -1, -1, 285, 417, 418, 288, 420, -1, -1, -1, + -1, -1, 295, -1, -1, -1, -1, 300, -1, 302, + 303, 304, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 316, -1, 318, 319, -1, -1, 322, + -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, + -1, 334, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, + 363, -1, -1, -1, -1, -1, -1, -1, 371, -1, + -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, + -1, 384, -1, 386, 256, -1, -1, -1, -1, 392, + 393, -1, 264, 265, -1, 267, -1, -1, 270, 271, + -1, -1, -1, 275, 276, 277, -1, 279, -1, -1, + -1, -1, -1, 285, 417, 418, 288, 420, -1, -1, + -1, -1, -1, 295, -1, -1, -1, -1, 300, -1, + 302, 303, 304, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 316, -1, 318, 319, -1, -1, + 322, -1, -1, 325, -1, 327, -1, 329, 330, 331, + 332, -1, 334, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, + 362, 363, -1, -1, -1, -1, -1, -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, 386, 256, -1, -1, -1, -1, 392, 393, -1, 264, 265, -1, 267, -1, -1, 270, @@ -13921,428 +13973,375 @@ void case_1034() -1, 359, 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, 386, 256, - -1, -1, -1, -1, 392, 393, -1, 264, 265, -1, + -1, -1, -1, -1, 392, 393, 262, 264, 265, -1, 267, -1, -1, 270, 271, -1, -1, -1, 275, 276, 277, -1, 279, -1, -1, -1, -1, -1, 285, 417, 418, 288, 420, -1, -1, -1, -1, -1, 295, -1, - -1, -1, -1, 300, -1, 302, 303, 304, -1, -1, + -1, -1, 298, 300, -1, 302, 303, 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 316, -1, 318, 319, -1, -1, 322, -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, -1, 334, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, -1, - -1, -1, -1, -1, 371, -1, -1, -1, -1, -1, - 377, 378, 379, 380, -1, -1, -1, 384, -1, 386, - 256, -1, -1, -1, -1, 392, 393, -1, 264, 265, + -1, -1, -1, -1, 371, 371, 372, 373, 374, 375, + -1, -1, 378, 379, -1, -1, 382, 383, 384, 385, + 386, 387, 388, 389, 390, -1, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, -1, -1, + 417, 418, -1, -1, 420, -1, 261, 423, 263, -1, + 265, -1, 267, -1, -1, 270, -1, 272, 273, -1, + 275, -1, 277, -1, 279, -1, 281, 282, 283, 284, + -1, -1, 287, 288, -1, -1, -1, -1, 293, 294, + 295, 296, 297, -1, -1, 300, -1, 302, -1, 304, + -1, 306, 307, -1, 309, 310, 311, 312, -1, -1, + 315, 316, 317, 318, -1, -1, 321, 322, 323, -1, + -1, -1, -1, -1, -1, 330, 331, -1, 333, 334, + -1, 336, 337, 338, -1, -1, -1, 342, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 362, -1, 364, + 365, 261, -1, -1, -1, 265, -1, 267, -1, -1, + 270, -1, 272, 273, -1, 275, -1, 277, -1, 279, + -1, 281, 282, 283, 284, -1, -1, 287, 288, -1, + -1, -1, -1, 293, -1, 295, 296, 297, -1, -1, + 300, -1, 302, -1, 304, -1, -1, 307, -1, 309, + 310, 311, 312, 418, -1, -1, 316, 317, 318, -1, + -1, 321, 322, 323, -1, -1, -1, -1, -1, -1, + 330, 331, -1, 333, 334, -1, 336, 337, 338, -1, + -1, -1, 342, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 261, -1, 362, -1, 265, -1, 267, -1, 368, 270, + -1, 272, 273, -1, 275, -1, 277, 377, 279, -1, + 281, 282, 283, 284, -1, -1, 287, 288, -1, -1, + -1, -1, 293, -1, 295, 296, 297, -1, -1, 300, + -1, 302, -1, 304, -1, -1, 307, -1, 309, 310, + 311, 312, -1, -1, -1, 316, 317, 318, 418, -1, + 321, 322, 323, -1, -1, -1, -1, -1, -1, 330, + 331, -1, 333, 334, -1, 336, 337, 338, -1, -1, + -1, 342, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 261, + -1, 362, -1, 265, -1, 267, -1, 368, 270, -1, + 272, 273, -1, 275, -1, 277, 377, 279, -1, 281, + 282, 283, 284, -1, -1, 287, 288, -1, -1, -1, + -1, 293, -1, 295, 296, 297, -1, -1, 300, -1, + 302, -1, 304, -1, -1, 307, -1, 309, 310, 311, + 312, -1, -1, -1, 316, 317, 318, 418, -1, 321, + 322, 323, -1, -1, -1, -1, -1, -1, 330, 331, + -1, 333, 334, -1, 336, 337, 338, -1, -1, -1, + 342, -1, -1, -1, -1, 261, -1, -1, -1, 265, + -1, 267, -1, -1, 270, -1, 272, 273, -1, 275, + 362, 277, -1, 279, -1, 281, 282, 283, 284, -1, + -1, 287, 288, -1, -1, 377, -1, 293, -1, 295, + 296, 297, -1, -1, 300, -1, 302, -1, 304, -1, + -1, 307, -1, 309, 310, 311, 312, -1, -1, -1, + 316, 317, 318, -1, -1, 321, 322, 323, -1, -1, + -1, -1, -1, -1, 330, 331, 418, 333, 334, -1, + 336, 337, 338, -1, -1, -1, 342, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 261, + -1, -1, -1, 265, -1, 267, 362, -1, 270, -1, + 272, 273, 368, 275, -1, 277, -1, 279, -1, 281, + 282, 283, 284, -1, -1, 287, 288, -1, -1, -1, + -1, 293, -1, 295, 296, 297, -1, -1, 300, -1, + 302, 261, 304, -1, -1, 307, -1, 309, 310, 311, + 312, -1, -1, -1, 316, 317, 318, -1, -1, 321, + 322, 323, 418, -1, 284, -1, -1, -1, 330, 331, + -1, 333, 334, -1, 336, 337, 338, 297, -1, -1, + 342, -1, 302, -1, -1, 305, -1, 307, -1, 309, + 310, 311, 312, -1, -1, -1, -1, 317, -1, -1, + 362, 321, -1, -1, -1, 325, 368, -1, -1, -1, + -1, 261, -1, 333, -1, -1, 336, -1, 338, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 284, -1, -1, 357, -1, -1, + -1, -1, 362, -1, -1, -1, -1, 297, 368, 369, + -1, 371, 302, 373, -1, 305, 418, 307, -1, 309, + 310, 311, 312, -1, -1, -1, 386, 317, -1, -1, + -1, 321, -1, 261, -1, 325, -1, -1, -1, -1, + -1, -1, -1, 333, -1, -1, 336, -1, 338, -1, + -1, -1, -1, -1, -1, -1, 284, -1, 418, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, + -1, 261, 362, -1, 302, -1, -1, 305, 368, 307, + -1, 309, 310, 311, 312, -1, -1, -1, -1, 317, + -1, -1, -1, 321, 284, -1, -1, 325, -1, -1, + -1, -1, -1, -1, -1, 333, -1, 297, 336, 261, + 338, -1, 302, -1, -1, -1, -1, 307, -1, 309, + 310, 311, 312, -1, -1, -1, -1, 317, 418, -1, + -1, 321, 284, -1, 362, 325, -1, -1, -1, -1, + 368, -1, -1, 333, -1, 297, 336, 261, 338, -1, + 302, -1, -1, -1, -1, 307, -1, 309, 310, 311, + 312, -1, -1, -1, -1, 317, -1, -1, -1, 321, + 284, -1, 362, 325, -1, -1, -1, -1, 368, -1, + -1, 333, -1, 297, 336, -1, 338, -1, 302, -1, + 418, -1, -1, 307, -1, 309, 310, 311, 312, -1, + -1, -1, -1, 317, -1, -1, -1, 321, -1, -1, + 362, -1, -1, -1, -1, -1, -1, -1, -1, 333, + 264, 265, 336, 267, 338, -1, 270, 271, 418, -1, + -1, 275, 276, 277, -1, 279, -1, -1, -1, -1, + -1, 285, -1, -1, 288, -1, -1, -1, 362, -1, + -1, 295, -1, -1, -1, -1, 300, -1, 302, 303, + 304, -1, 306, -1, -1, -1, 418, -1, -1, 313, + -1, -1, 316, -1, 318, 319, -1, -1, 322, -1, + -1, 325, -1, 327, -1, 329, 330, 331, 332, -1, + 334, -1, -1, -1, -1, -1, -1, 341, -1, -1, + 344, 345, -1, -1, 418, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 359, 360, 361, 362, 363, + -1, -1, -1, -1, -1, -1, -1, 371, 372, -1, + 374, -1, -1, 377, 378, 379, 380, -1, -1, -1, + 384, -1, 386, -1, -1, -1, -1, -1, 392, 393, + -1, -1, -1, -1, -1, -1, 264, 265, -1, 267, + -1, -1, 270, 271, -1, -1, -1, 275, 276, 277, + -1, 279, -1, 417, 418, 419, 420, 285, -1, -1, + 288, -1, -1, -1, -1, -1, -1, 295, -1, -1, + -1, -1, 300, -1, 302, 303, 304, -1, 306, -1, + -1, -1, -1, -1, -1, 313, -1, -1, 316, -1, + 318, 319, -1, -1, 322, -1, -1, 325, -1, 327, + -1, 329, 330, 331, 332, -1, 334, -1, -1, -1, + -1, -1, -1, 341, -1, -1, 344, 345, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 359, 360, 361, 362, 363, -1, -1, -1, -1, + -1, -1, -1, 371, -1, -1, 374, -1, -1, 377, + 378, 379, 380, -1, -1, -1, 384, -1, 386, -1, + -1, -1, -1, -1, 392, 393, -1, -1, -1, -1, + -1, -1, 264, 265, -1, 267, -1, -1, 270, 271, + -1, -1, -1, 275, 276, 277, -1, 279, -1, 417, + 418, 419, 420, 285, -1, -1, 288, -1, -1, -1, + -1, -1, -1, 295, -1, -1, -1, -1, 300, -1, + 302, 303, 304, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 316, -1, 318, 319, -1, -1, + 322, -1, -1, 325, -1, 327, -1, 329, 330, 331, + 332, -1, 334, -1, -1, 337, -1, -1, -1, 341, + -1, -1, 344, 345, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, + 362, 363, -1, -1, -1, -1, -1, -1, -1, 371, + -1, -1, -1, -1, -1, 377, 378, 379, 380, -1, + -1, -1, 384, -1, 386, -1, -1, -1, -1, -1, + 392, 393, -1, -1, -1, -1, -1, -1, 264, 265, -1, 267, -1, -1, 270, 271, -1, -1, -1, 275, - 276, 277, -1, 279, -1, -1, -1, -1, -1, 285, - 417, 418, 288, 420, -1, -1, -1, -1, -1, 295, + 276, 277, -1, 279, -1, 417, 418, 419, 420, 285, + -1, -1, 288, -1, -1, -1, -1, -1, -1, 295, -1, -1, -1, -1, 300, -1, 302, 303, 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 316, -1, 318, 319, -1, -1, 322, -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, -1, 334, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 341, -1, -1, 344, 345, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, - -1, -1, -1, -1, -1, 371, -1, -1, -1, -1, + -1, 367, -1, -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, - 386, 256, -1, -1, -1, -1, 392, 393, -1, 264, - 265, -1, 267, -1, -1, 270, 271, -1, -1, -1, - 275, 276, 277, -1, 279, -1, -1, -1, -1, -1, - 285, 417, 418, 288, 420, -1, -1, -1, -1, -1, - 295, -1, -1, -1, -1, 300, -1, 302, 303, 304, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 316, -1, 318, 319, -1, -1, 322, -1, -1, - 325, -1, 327, -1, 329, 330, 331, 332, -1, 334, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, - -1, -1, -1, -1, -1, -1, 371, -1, -1, -1, - -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, - -1, 386, 256, -1, -1, -1, -1, 392, 393, 262, + 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, + -1, -1, -1, -1, 264, 265, -1, 267, -1, -1, + 270, 271, -1, -1, -1, 275, 276, 277, -1, 279, + -1, 417, 418, 419, 420, 285, -1, -1, 288, -1, + -1, -1, -1, -1, -1, 295, -1, -1, -1, -1, + 300, -1, 302, 303, 304, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 316, -1, 318, 319, + -1, -1, 322, -1, -1, 325, -1, 327, -1, 329, + 330, 331, 332, -1, 334, -1, -1, -1, -1, -1, + -1, 341, -1, -1, 344, 345, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, + 360, 361, 362, 363, -1, -1, -1, 367, -1, -1, + -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, + 380, -1, -1, -1, 384, -1, 386, -1, -1, -1, + -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, 264, 265, -1, 267, -1, -1, 270, 271, -1, -1, - -1, 275, 276, 277, -1, 279, -1, -1, -1, -1, - -1, 285, 417, 418, 288, 420, -1, -1, -1, -1, - -1, 295, -1, -1, -1, 298, 300, -1, 302, 303, + -1, 275, 276, 277, -1, 279, -1, 417, 418, 419, + 420, 285, -1, -1, 288, -1, -1, -1, -1, -1, + -1, 295, -1, -1, -1, -1, 300, -1, 302, 303, 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 316, -1, 318, 319, -1, -1, 322, -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, -1, - 334, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 334, -1, -1, -1, -1, -1, -1, 341, -1, -1, + 344, 345, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, 363, - -1, -1, -1, -1, -1, -1, -1, 371, 371, 372, - 373, 374, 375, -1, -1, 378, 379, -1, -1, 382, - 383, 384, 385, 386, 387, 388, 389, 390, -1, 392, - 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, - 413, -1, -1, 417, 418, -1, -1, 420, -1, 261, - 423, 263, -1, 265, -1, 267, -1, -1, 270, -1, - 272, 273, -1, 275, -1, 277, -1, 279, -1, 281, - 282, 283, 284, -1, -1, 287, 288, -1, -1, -1, - -1, 293, 294, 295, 296, 297, -1, -1, 300, -1, - 302, -1, 304, -1, 306, 307, -1, 309, 310, 311, - 312, -1, -1, 315, 316, 317, 318, -1, -1, 321, - 322, 323, -1, -1, -1, -1, -1, -1, 330, 331, - -1, 333, 334, -1, 336, 337, 338, -1, -1, -1, - 342, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 362, -1, 364, 365, 261, -1, -1, -1, 265, -1, - 267, -1, -1, 270, -1, 272, 273, -1, 275, -1, - 277, -1, 279, -1, 281, 282, 283, 284, -1, -1, - 287, 288, -1, -1, -1, -1, 293, -1, 295, 296, - 297, -1, -1, 300, -1, 302, -1, 304, -1, -1, - 307, -1, 309, 310, 311, 312, 418, -1, -1, 316, - 317, 318, -1, -1, 321, 322, 323, -1, -1, -1, - -1, -1, -1, 330, 331, -1, 333, 334, -1, 336, - 337, 338, -1, -1, -1, 342, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 371, -1, -1, + -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, + 384, -1, 386, -1, -1, -1, -1, -1, 392, 393, + -1, -1, -1, -1, -1, -1, 264, 265, -1, 267, + -1, -1, 270, 271, -1, -1, -1, 275, 276, 277, + -1, 279, -1, 417, 418, 419, 420, 285, -1, -1, + 288, -1, -1, -1, -1, -1, -1, 295, -1, -1, + -1, -1, 300, -1, 302, 303, 304, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 316, -1, + 318, 319, -1, -1, 322, -1, -1, 325, -1, 327, + -1, 329, 330, 331, 332, -1, 334, -1, -1, -1, + -1, -1, -1, 341, -1, -1, 344, 345, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 261, -1, 362, -1, 265, -1, 267, - -1, 368, 270, -1, 272, 273, -1, 275, -1, 277, - 377, 279, -1, 281, 282, 283, 284, -1, -1, 287, - 288, -1, -1, -1, -1, 293, -1, 295, 296, 297, - -1, -1, 300, -1, 302, -1, 304, -1, -1, 307, - -1, 309, 310, 311, 312, -1, -1, -1, 316, 317, - 318, 418, -1, 321, 322, 323, -1, -1, -1, -1, - -1, -1, 330, 331, -1, 333, 334, -1, 336, 337, - 338, -1, -1, -1, 342, -1, -1, -1, -1, -1, + -1, 359, 360, 361, 362, 363, -1, -1, -1, -1, + -1, -1, -1, 371, -1, -1, -1, -1, -1, 377, + 378, 379, 380, -1, -1, -1, 384, -1, 386, -1, + -1, -1, -1, -1, 392, 393, -1, -1, -1, -1, + -1, -1, 264, 265, -1, 267, -1, -1, 270, 271, + -1, -1, -1, 275, 276, 277, -1, 279, -1, 417, + 418, 419, 420, 285, -1, -1, 288, -1, -1, -1, + -1, -1, -1, 295, -1, -1, -1, -1, 300, -1, + 302, 303, 304, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 316, -1, 318, 319, -1, -1, + 322, -1, -1, 325, -1, 327, -1, 329, 330, 331, + 332, -1, 334, -1, -1, -1, -1, -1, -1, 341, + -1, -1, 344, 345, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, + 362, 363, -1, -1, -1, -1, -1, -1, -1, 371, + -1, -1, -1, -1, -1, 377, 378, 379, 380, -1, + -1, -1, 384, -1, 386, -1, -1, -1, -1, -1, + 392, 393, -1, -1, -1, -1, -1, -1, 264, 265, + -1, 267, -1, -1, 270, 271, -1, -1, -1, 275, + 276, 277, -1, 279, -1, 417, 418, 419, 420, 285, + -1, -1, 288, -1, -1, -1, -1, -1, -1, 295, + -1, -1, -1, -1, 300, -1, 302, 303, 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 261, -1, 362, -1, 265, -1, 267, -1, - 368, 270, -1, 272, 273, -1, 275, -1, 277, 377, - 279, -1, 281, 282, 283, 284, -1, -1, 287, 288, - -1, -1, -1, -1, 293, -1, 295, 296, 297, -1, - -1, 300, -1, 302, -1, 304, -1, -1, 307, -1, - 309, 310, 311, 312, -1, -1, -1, 316, 317, 318, - 418, -1, 321, 322, 323, -1, -1, -1, -1, -1, - -1, 330, 331, -1, 333, 334, -1, 336, 337, 338, - -1, -1, -1, 342, -1, -1, -1, -1, 261, -1, - -1, -1, 265, -1, 267, -1, -1, 270, -1, 272, - 273, -1, 275, 362, 277, -1, 279, -1, 281, 282, - 283, 284, -1, -1, 287, 288, -1, -1, 377, -1, - 293, -1, 295, 296, 297, -1, -1, 300, -1, 302, - -1, 304, -1, -1, 307, -1, 309, 310, 311, 312, - -1, -1, -1, 316, 317, 318, -1, -1, 321, 322, - 323, -1, -1, -1, -1, -1, -1, 330, 331, 418, - 333, 334, -1, 336, 337, 338, -1, -1, -1, 342, + 316, -1, 318, 319, -1, -1, 322, -1, -1, 325, + -1, 327, -1, 329, 330, 331, 332, -1, 334, -1, + -1, -1, -1, -1, -1, 341, -1, -1, 344, 345, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 261, -1, -1, -1, 265, -1, 267, 362, - -1, 270, -1, 272, 273, 368, 275, -1, 277, -1, - 279, -1, 281, 282, 283, 284, -1, -1, 287, 288, - -1, -1, -1, -1, 293, -1, 295, 296, 297, -1, - -1, 300, -1, 302, 261, 304, -1, -1, 307, -1, - 309, 310, 311, 312, -1, -1, -1, 316, 317, 318, - -1, -1, 321, 322, 323, 418, -1, 284, -1, -1, - -1, 330, 331, -1, 333, 334, -1, 336, 337, 338, - 297, -1, -1, 342, -1, 302, -1, -1, 305, -1, + -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, + -1, -1, -1, -1, -1, 371, -1, -1, -1, -1, + -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, + 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, + -1, -1, -1, -1, 264, 265, -1, 267, -1, -1, + 270, 271, -1, -1, -1, 275, 276, 277, -1, 279, + -1, 417, 418, 419, 420, 285, -1, -1, 288, -1, + -1, -1, -1, -1, -1, 295, -1, 261, -1, -1, + 300, -1, 302, 303, 304, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 316, -1, 318, 319, + 284, -1, 322, -1, -1, 325, -1, 327, -1, 329, + 330, 331, 332, 297, 334, -1, -1, -1, 302, -1, + -1, -1, -1, 307, -1, 309, 310, 311, 312, -1, + -1, 315, -1, 317, -1, -1, -1, 321, -1, 359, + 360, 361, 362, 363, -1, -1, -1, -1, -1, 333, + -1, 371, 336, -1, 338, -1, -1, 377, 378, 379, + 380, -1, -1, -1, 384, -1, 386, -1, -1, -1, + -1, -1, 392, 393, -1, -1, -1, -1, 362, -1, + -1, -1, -1, -1, 368, 369, -1, -1, -1, -1, + -1, -1, 263, -1, 265, -1, 267, 417, 418, 270, + 420, 272, 273, -1, 275, -1, 277, -1, 279, -1, + 281, 282, 283, -1, -1, -1, 287, 288, -1, -1, + -1, -1, 293, -1, 295, 296, -1, -1, -1, 300, + -1, -1, -1, 304, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 315, 316, -1, 318, -1, -1, + -1, 322, 323, -1, -1, -1, -1, -1, -1, 330, + 331, 264, 265, 334, 267, -1, 337, 270, 271, -1, + -1, 342, 275, 276, 277, -1, 279, -1, -1, -1, + -1, -1, 285, -1, -1, 288, -1, -1, -1, -1, + -1, -1, 295, 364, 365, -1, -1, 300, -1, 302, + 303, 304, -1, -1, -1, -1, 377, -1, -1, -1, + -1, -1, -1, 316, -1, 318, 319, -1, -1, 322, + -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, + -1, 334, -1, -1, 337, -1, -1, -1, -1, -1, + -1, 265, -1, 267, -1, -1, 270, 418, 272, -1, + -1, 275, -1, -1, -1, 279, 359, 360, 361, 362, + -1, -1, -1, -1, 288, 265, -1, 267, 371, -1, + 270, 295, 272, 273, -1, 275, 300, 277, 302, 279, + 304, 281, 282, 283, -1, -1, -1, 287, 288, -1, + -1, -1, 316, 293, 318, 295, 296, -1, 322, 323, + 300, -1, -1, -1, 304, -1, 330, 331, -1, -1, + 334, -1, -1, 337, 417, 418, 316, -1, 318, -1, + -1, -1, 322, 323, -1, -1, -1, -1, -1, -1, + 330, 331, -1, 265, 334, 267, -1, 337, 270, -1, + 272, 273, 342, 275, -1, 277, -1, 279, -1, 281, + 282, 283, -1, -1, -1, 287, 288, -1, -1, -1, + -1, 293, -1, 295, 296, -1, -1, -1, 300, -1, + -1, -1, 304, -1, -1, -1, -1, 377, -1, -1, + -1, -1, -1, -1, 316, -1, 318, -1, -1, -1, + 322, 323, -1, -1, 418, -1, -1, -1, 330, 331, + -1, -1, 334, -1, -1, 337, -1, 265, -1, 267, + 342, -1, 270, -1, -1, 273, -1, 275, 418, 277, + -1, 279, -1, 281, 282, 283, -1, -1, -1, 287, + 288, -1, -1, -1, -1, 293, -1, 295, -1, 265, + -1, 267, 300, -1, 270, -1, 304, 273, -1, 275, + -1, 277, -1, 279, -1, 281, 282, 283, 316, -1, + 318, 287, 288, -1, 322, -1, -1, 293, -1, 295, + -1, -1, 330, 331, 300, -1, 334, -1, 304, 337, + -1, -1, -1, 265, 342, 267, 418, -1, 270, -1, + 316, -1, 318, 275, -1, -1, 322, 279, -1, -1, + -1, -1, -1, -1, 330, 331, 288, -1, 334, -1, + -1, 337, -1, 295, -1, 265, 342, 267, 300, 377, + 270, -1, 304, -1, 306, 275, 308, -1, -1, 279, + -1, 313, -1, -1, 316, -1, 318, -1, 288, -1, + 322, -1, -1, 325, -1, 295, -1, -1, 330, 331, + 300, -1, 334, -1, 304, 337, 306, -1, 308, 265, + 418, 267, -1, 313, 270, -1, 316, -1, 318, 275, + -1, -1, 322, 279, -1, 325, -1, -1, -1, -1, + 330, 331, 288, -1, 334, -1, -1, 337, -1, 295, + 372, -1, 418, -1, 300, -1, -1, -1, 304, -1, + 306, -1, -1, -1, -1, -1, -1, 313, -1, -1, + 316, -1, 318, -1, -1, -1, 322, -1, -1, 325, + 370, -1, -1, -1, 330, 331, -1, -1, 334, -1, + 265, 337, 267, -1, -1, 270, 418, -1, -1, -1, + 275, -1, -1, -1, 279, -1, -1, -1, -1, -1, + -1, -1, -1, 288, -1, -1, -1, 363, -1, -1, + 295, -1, 265, -1, 267, 300, -1, 270, 418, 304, + -1, 306, 275, 308, -1, -1, 279, -1, 313, -1, + -1, 316, -1, 318, -1, 288, -1, 322, -1, -1, + 325, -1, 295, -1, -1, 330, 331, 300, -1, 334, + -1, 304, 337, 306, -1, 308, 265, -1, 267, -1, + 313, 270, 418, 316, -1, 318, 275, -1, -1, 322, + 279, -1, 325, -1, -1, -1, -1, 330, 331, 288, + -1, 334, -1, -1, 337, -1, 295, -1, -1, -1, + -1, 300, -1, -1, -1, 304, -1, -1, -1, -1, + 261, -1, -1, -1, -1, -1, -1, 316, -1, 318, + -1, 272, -1, 322, -1, -1, 277, -1, -1, -1, + 281, 330, 331, 284, -1, 334, -1, -1, 337, -1, + -1, -1, -1, 418, -1, 296, 297, -1, -1, -1, + 301, 302, -1, -1, -1, -1, 307, -1, 309, 310, + 311, 312, -1, -1, 363, -1, 317, -1, -1, -1, + 321, -1, 323, -1, -1, 418, -1, -1, -1, -1, + -1, -1, 333, -1, 335, 336, 261, 338, -1, -1, + -1, 342, -1, -1, -1, -1, -1, 272, -1, -1, + -1, -1, 277, -1, -1, -1, 281, -1, -1, 284, + -1, 362, -1, -1, -1, -1, -1, 368, 369, 418, + -1, 296, 297, -1, -1, -1, 301, 302, 261, -1, + 263, -1, 307, -1, 309, 310, 311, 312, -1, -1, + -1, -1, 317, -1, -1, -1, 321, -1, 323, -1, + -1, 284, -1, -1, -1, -1, -1, -1, 333, -1, + -1, 336, -1, 338, 297, -1, -1, 342, -1, 302, + -1, -1, -1, -1, 307, -1, 309, 310, 311, 312, + -1, -1, -1, -1, 317, -1, -1, 362, 321, -1, + -1, 261, -1, 368, 369, -1, -1, -1, -1, -1, + 333, -1, 272, 336, -1, 338, -1, 277, -1, -1, + -1, 281, -1, -1, 284, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 296, 297, -1, 362, + -1, 301, 302, -1, 261, 368, 369, 307, -1, 309, + 310, 311, 312, -1, -1, 272, -1, 317, -1, -1, + 277, 321, -1, 323, 281, -1, -1, 284, -1, -1, + -1, -1, -1, 333, -1, -1, 336, -1, 338, 296, + 297, -1, 342, -1, 301, 302, 261, -1, -1, -1, 307, -1, 309, 310, 311, 312, -1, -1, -1, -1, - 317, -1, -1, 362, 321, -1, -1, -1, 325, 368, - -1, -1, -1, -1, 261, -1, 333, -1, -1, 336, - -1, 338, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 284, -1, -1, - 357, -1, -1, -1, -1, 362, -1, -1, -1, -1, - 297, 368, 369, -1, 371, 302, 373, -1, 305, 418, - 307, -1, 309, 310, 311, 312, -1, -1, -1, 386, - 317, -1, -1, -1, 321, -1, 261, -1, 325, -1, + 317, -1, 362, -1, 321, -1, 323, -1, 368, 284, -1, -1, -1, -1, -1, -1, 333, -1, -1, 336, - -1, 338, -1, -1, -1, -1, -1, -1, -1, 284, - -1, 418, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 297, -1, 261, 362, -1, 302, -1, -1, - 305, 368, 307, -1, 309, 310, 311, 312, -1, -1, - -1, -1, 317, -1, -1, -1, 321, 284, -1, -1, - 325, -1, -1, -1, -1, -1, -1, -1, 333, -1, + -1, 338, 297, -1, 261, 342, -1, 302, -1, -1, + -1, -1, 307, -1, 309, 310, 311, 312, -1, -1, + -1, -1, 317, -1, -1, 362, 321, 284, -1, -1, + -1, 368, -1, -1, -1, -1, -1, -1, 333, -1, 297, 336, 261, 338, -1, 302, -1, -1, -1, -1, 307, -1, 309, 310, 311, 312, -1, -1, -1, -1, - 317, 418, -1, -1, 321, 284, -1, 362, 325, -1, - -1, -1, -1, 368, -1, -1, 333, -1, 297, 336, - 261, 338, -1, 302, -1, -1, -1, -1, 307, -1, - 309, 310, 311, 312, -1, -1, -1, -1, 317, -1, - -1, -1, 321, 284, -1, 362, 325, -1, -1, -1, - -1, 368, -1, -1, 333, -1, 297, 336, -1, 338, - -1, 302, -1, 418, -1, -1, 307, -1, 309, 310, + 317, -1, -1, -1, 321, 284, -1, 362, -1, 364, + 365, -1, -1, 368, -1, -1, 333, -1, 297, 336, + 261, 338, 263, 302, -1, -1, -1, -1, 307, -1, + 309, 310, 311, 312, -1, -1, 315, -1, 317, -1, + -1, -1, 321, 284, -1, 362, -1, 364, 365, -1, + -1, 368, -1, -1, 333, -1, 297, 336, 261, 338, + -1, 302, -1, -1, -1, -1, 307, -1, 309, 310, 311, 312, -1, -1, -1, -1, 317, -1, -1, -1, - 321, -1, -1, 362, -1, -1, -1, -1, -1, -1, - -1, -1, 333, 264, 265, 336, 267, 338, -1, 270, - 271, 418, -1, -1, 275, 276, 277, -1, 279, -1, - -1, -1, -1, -1, 285, -1, -1, 288, -1, -1, - -1, 362, -1, -1, 295, -1, -1, -1, -1, 300, - -1, 302, 303, 304, -1, 306, -1, -1, -1, 418, - -1, -1, 313, -1, -1, 316, -1, 318, 319, -1, - -1, 322, -1, -1, 325, -1, 327, -1, 329, 330, - 331, 332, -1, 334, -1, -1, -1, -1, -1, -1, - 341, -1, -1, 344, 345, -1, -1, 418, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, - 361, 362, 363, -1, -1, -1, -1, -1, -1, -1, - 371, 372, -1, 374, -1, -1, 377, 378, 379, 380, - -1, -1, -1, 384, -1, 386, -1, -1, -1, -1, - -1, 392, 393, -1, -1, -1, -1, -1, -1, 264, - 265, -1, 267, -1, -1, 270, 271, -1, -1, -1, - 275, 276, 277, -1, 279, -1, 417, 418, 419, 420, - 285, -1, -1, 288, -1, -1, -1, -1, -1, -1, - 295, -1, -1, -1, -1, 300, -1, 302, 303, 304, - -1, 306, -1, -1, -1, -1, -1, -1, 313, -1, - -1, 316, -1, 318, 319, -1, -1, 322, -1, -1, - 325, -1, 327, -1, 329, 330, 331, 332, -1, 334, - -1, -1, -1, -1, -1, -1, 341, -1, -1, 344, - 345, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, - -1, -1, -1, -1, -1, -1, 371, -1, -1, 374, - -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, - -1, 386, -1, -1, -1, -1, -1, 392, 393, -1, - -1, -1, -1, -1, -1, 264, 265, -1, 267, -1, - -1, 270, 271, -1, -1, -1, 275, 276, 277, -1, - 279, -1, 417, 418, 419, 420, 285, -1, -1, 288, - -1, -1, -1, -1, -1, -1, 295, -1, -1, -1, - -1, 300, -1, 302, 303, 304, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 316, -1, 318, - 319, -1, -1, 322, -1, -1, 325, -1, 327, -1, - 329, 330, 331, 332, -1, 334, -1, -1, 337, -1, - -1, -1, 341, -1, -1, 344, 345, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 359, 360, 361, 362, 363, -1, -1, -1, -1, -1, - -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, - 379, 380, -1, -1, -1, 384, -1, 386, -1, -1, - -1, -1, -1, 392, 393, -1, -1, -1, -1, -1, - -1, 264, 265, -1, 267, -1, -1, 270, 271, -1, - -1, -1, 275, 276, 277, -1, 279, -1, 417, 418, - 419, 420, 285, -1, -1, 288, -1, -1, -1, -1, - -1, -1, 295, -1, -1, -1, -1, 300, -1, 302, - 303, 304, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 316, -1, 318, 319, -1, -1, 322, - -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, - -1, 334, -1, -1, -1, -1, -1, -1, 341, -1, - -1, 344, 345, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, - 363, -1, -1, -1, 367, -1, -1, -1, 371, -1, - -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, - -1, 384, -1, 386, -1, -1, -1, -1, -1, 392, - 393, -1, -1, -1, -1, -1, -1, 264, 265, -1, - 267, -1, -1, 270, 271, -1, -1, -1, 275, 276, - 277, -1, 279, -1, 417, 418, 419, 420, 285, -1, - -1, 288, -1, -1, -1, -1, -1, -1, 295, -1, - -1, -1, -1, 300, -1, 302, 303, 304, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 316, - -1, 318, 319, -1, -1, 322, -1, -1, 325, -1, - 327, -1, 329, 330, 331, 332, -1, 334, -1, -1, - -1, -1, -1, -1, 341, -1, -1, 344, 345, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 359, 360, 361, 362, 363, -1, -1, -1, - 367, -1, -1, -1, 371, -1, -1, -1, -1, -1, - 377, 378, 379, 380, -1, -1, -1, 384, -1, 386, - -1, -1, -1, -1, -1, 392, 393, -1, -1, -1, - -1, -1, -1, 264, 265, -1, 267, -1, -1, 270, - 271, -1, -1, -1, 275, 276, 277, -1, 279, -1, - 417, 418, 419, 420, 285, -1, -1, 288, -1, -1, - -1, -1, -1, -1, 295, -1, -1, -1, -1, 300, - -1, 302, 303, 304, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 316, -1, 318, 319, -1, - -1, 322, -1, -1, 325, -1, 327, -1, 329, 330, - 331, 332, -1, 334, -1, -1, -1, -1, -1, -1, - 341, -1, -1, 344, 345, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, - 361, 362, 363, -1, -1, -1, -1, -1, -1, -1, - 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, - -1, -1, -1, 384, -1, 386, -1, -1, -1, -1, - -1, 392, 393, -1, -1, -1, -1, -1, -1, 264, - 265, -1, 267, -1, -1, 270, 271, -1, -1, -1, - 275, 276, 277, -1, 279, -1, 417, 418, 419, 420, - 285, -1, -1, 288, -1, -1, -1, -1, -1, -1, - 295, -1, -1, -1, -1, 300, -1, 302, 303, 304, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 316, -1, 318, 319, -1, -1, 322, -1, -1, - 325, -1, 327, -1, 329, 330, 331, 332, -1, 334, - -1, -1, -1, -1, -1, -1, 341, -1, -1, 344, - 345, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, - -1, -1, -1, -1, -1, -1, 371, -1, -1, -1, - -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, - -1, 386, -1, -1, -1, -1, -1, 392, 393, -1, - -1, -1, -1, -1, -1, 264, 265, -1, 267, -1, - -1, 270, 271, -1, -1, -1, 275, 276, 277, -1, - 279, -1, 417, 418, 419, 420, 285, -1, -1, 288, - -1, -1, -1, -1, -1, -1, 295, -1, -1, -1, - -1, 300, -1, 302, 303, 304, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 316, -1, 318, - 319, -1, -1, 322, -1, -1, 325, -1, 327, -1, - 329, 330, 331, 332, -1, 334, -1, -1, -1, -1, - -1, -1, 341, -1, -1, 344, 345, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 359, 360, 361, 362, 363, -1, -1, -1, -1, -1, - -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, - 379, 380, -1, -1, -1, 384, -1, 386, -1, -1, - -1, -1, -1, 392, 393, -1, -1, -1, -1, -1, - -1, 264, 265, -1, 267, -1, -1, 270, 271, -1, - -1, -1, 275, 276, 277, -1, 279, -1, 417, 418, - 419, 420, 285, -1, -1, 288, -1, -1, -1, -1, - -1, -1, 295, -1, -1, -1, -1, 300, -1, 302, - 303, 304, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 316, -1, 318, 319, -1, -1, 322, - -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, - -1, 334, -1, -1, -1, -1, -1, -1, 341, -1, - -1, 344, 345, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, - 363, -1, -1, -1, -1, -1, -1, -1, 371, -1, - -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, - -1, 384, -1, 386, -1, -1, -1, -1, -1, 392, - 393, -1, -1, -1, -1, -1, -1, 264, 265, -1, - 267, -1, -1, 270, 271, -1, -1, -1, 275, 276, - 277, -1, 279, -1, 417, 418, 419, 420, 285, -1, - -1, 288, -1, -1, -1, -1, -1, -1, 295, -1, - -1, -1, -1, 300, -1, 302, 303, 304, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 316, - -1, 318, 319, -1, -1, 322, -1, -1, 325, -1, - 327, -1, 329, 330, 331, 332, -1, 334, -1, -1, - -1, -1, -1, -1, 341, -1, -1, 344, 345, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 359, 360, 361, 362, 363, -1, -1, -1, - -1, -1, -1, -1, 371, -1, -1, -1, -1, -1, - 377, 378, 379, 380, -1, -1, -1, 384, -1, 386, - -1, -1, -1, -1, -1, 392, 393, -1, -1, -1, - -1, -1, -1, 264, 265, -1, 267, -1, -1, 270, - 271, -1, -1, -1, 275, 276, 277, -1, 279, -1, - 417, 418, 419, 420, 285, -1, -1, 288, -1, -1, - -1, -1, -1, -1, 295, -1, 261, -1, -1, 300, - -1, 302, 303, 304, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 316, -1, 318, 319, 284, - -1, 322, -1, -1, 325, -1, 327, -1, 329, 330, - 331, 332, 297, 334, -1, -1, -1, 302, -1, -1, - -1, -1, 307, -1, 309, 310, 311, 312, -1, -1, - 315, -1, 317, -1, -1, -1, 321, -1, 359, 360, - 361, 362, 363, -1, -1, -1, -1, -1, 333, -1, - 371, 336, -1, 338, -1, -1, 377, 378, 379, 380, - -1, -1, -1, 384, -1, 386, -1, -1, -1, -1, - -1, 392, 393, -1, -1, -1, -1, 362, -1, -1, - -1, -1, -1, 368, 369, -1, -1, -1, -1, -1, - -1, 263, -1, 265, -1, 267, 417, 418, 270, 420, - 272, 273, -1, 275, -1, 277, -1, 279, -1, 281, - 282, 283, -1, -1, -1, 287, 288, -1, -1, -1, - -1, 293, -1, 295, 296, -1, -1, -1, 300, -1, - -1, -1, 304, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 315, 316, -1, 318, -1, -1, -1, - 322, 323, -1, -1, -1, -1, -1, -1, 330, 331, - 264, 265, 334, 267, -1, 337, 270, 271, -1, -1, - 342, 275, 276, 277, -1, 279, -1, -1, -1, -1, - -1, 285, -1, -1, 288, -1, -1, -1, -1, -1, - -1, 295, 364, 365, -1, -1, 300, -1, 302, 303, - 304, -1, -1, -1, -1, 377, -1, -1, -1, -1, - -1, -1, 316, -1, 318, 319, -1, -1, 322, -1, - -1, 325, -1, 327, -1, 329, 330, 331, 332, -1, - 334, -1, -1, 337, -1, -1, -1, -1, -1, -1, - 265, -1, 267, -1, -1, 270, 418, 272, -1, -1, - 275, -1, -1, -1, 279, 359, 360, 361, 362, -1, - -1, -1, -1, 288, 265, -1, 267, 371, -1, 270, - 295, 272, 273, -1, 275, 300, 277, 302, 279, 304, - 281, 282, 283, -1, -1, -1, 287, 288, -1, -1, - -1, 316, 293, 318, 295, 296, -1, 322, 323, 300, - -1, -1, -1, 304, -1, 330, 331, -1, -1, 334, - -1, -1, 337, 417, 418, 316, -1, 318, -1, -1, - -1, 322, 323, -1, -1, -1, -1, -1, -1, 330, - 331, -1, 265, 334, 267, -1, 337, 270, -1, 272, - 273, 342, 275, -1, 277, -1, 279, -1, 281, 282, - 283, -1, -1, -1, 287, 288, -1, -1, -1, -1, - 293, -1, 295, 296, -1, -1, -1, 300, -1, -1, - -1, 304, -1, -1, -1, -1, 377, -1, -1, -1, - -1, -1, -1, 316, -1, 318, -1, -1, -1, 322, - 323, -1, -1, 418, -1, -1, -1, 330, 331, -1, - -1, 334, -1, -1, 337, -1, 265, -1, 267, 342, - -1, 270, -1, -1, 273, -1, 275, 418, 277, -1, - 279, -1, 281, 282, 283, -1, -1, -1, 287, 288, - -1, -1, -1, -1, 293, -1, 295, -1, 265, -1, - 267, 300, -1, 270, -1, 304, 273, -1, 275, -1, - 277, -1, 279, -1, 281, 282, 283, 316, -1, 318, - 287, 288, -1, 322, -1, -1, 293, -1, 295, -1, - -1, 330, 331, 300, -1, 334, -1, 304, 337, -1, - -1, -1, 265, 342, 267, 418, -1, 270, -1, 316, - -1, 318, 275, -1, -1, 322, 279, -1, -1, -1, - -1, -1, -1, 330, 331, 288, -1, 334, -1, -1, - 337, -1, 295, -1, 265, 342, 267, 300, 377, 270, - -1, 304, -1, 306, 275, 308, -1, -1, 279, -1, - 313, -1, -1, 316, -1, 318, -1, 288, -1, 322, - -1, -1, 325, -1, 295, -1, -1, 330, 331, 300, - -1, 334, -1, 304, 337, 306, -1, 308, 265, 418, - 267, -1, 313, 270, -1, 316, -1, 318, 275, -1, - -1, 322, 279, -1, 325, -1, -1, -1, -1, 330, - 331, 288, -1, 334, -1, -1, 337, -1, 295, 372, - -1, 418, -1, 300, -1, -1, -1, 304, -1, 306, - -1, -1, -1, -1, -1, -1, 313, -1, -1, 316, - -1, 318, -1, -1, -1, 322, -1, -1, 325, 370, - -1, -1, -1, 330, 331, -1, -1, 334, -1, 265, - 337, 267, -1, -1, 270, 418, -1, -1, -1, 275, - -1, -1, -1, 279, -1, -1, -1, -1, -1, -1, - -1, -1, 288, -1, -1, -1, 363, -1, -1, 295, - -1, 265, -1, 267, 300, -1, 270, 418, 304, -1, - 306, 275, 308, -1, -1, 279, -1, 313, -1, -1, - 316, -1, 318, -1, 288, -1, 322, -1, -1, 325, - -1, 295, -1, -1, 330, 331, 300, -1, 334, -1, - 304, 337, 306, -1, 308, 265, -1, 267, -1, 313, - 270, 418, 316, -1, 318, 275, -1, -1, 322, 279, - -1, 325, -1, -1, -1, -1, 330, 331, 288, -1, - 334, -1, -1, 337, -1, 295, -1, -1, -1, -1, - 300, -1, -1, -1, 304, -1, -1, -1, -1, 261, - -1, -1, -1, -1, -1, -1, 316, -1, 318, -1, - 272, -1, 322, -1, -1, 277, -1, -1, -1, 281, - 330, 331, 284, -1, 334, -1, -1, 337, -1, -1, - -1, -1, 418, -1, 296, 297, -1, -1, -1, 301, - 302, -1, -1, -1, -1, 307, -1, 309, 310, 311, - 312, -1, -1, 363, -1, 317, -1, -1, -1, 321, - -1, 323, -1, -1, 418, -1, -1, -1, -1, -1, - -1, 333, -1, 335, 336, 261, 338, -1, -1, -1, - 342, -1, -1, -1, -1, -1, 272, -1, -1, -1, - -1, 277, -1, -1, -1, 281, -1, -1, 284, -1, - 362, -1, -1, -1, -1, -1, 368, 369, 418, -1, - 296, 297, -1, -1, -1, 301, 302, 261, -1, 263, - -1, 307, -1, 309, 310, 311, 312, -1, -1, -1, - -1, 317, -1, -1, -1, 321, -1, 323, -1, -1, - 284, -1, -1, -1, -1, -1, -1, 333, -1, -1, - 336, -1, 338, 297, -1, -1, 342, -1, 302, -1, - -1, -1, -1, 307, -1, 309, 310, 311, 312, -1, - -1, -1, -1, 317, -1, -1, 362, 321, -1, -1, - 261, -1, 368, 369, -1, -1, -1, -1, -1, 333, - -1, 272, 336, -1, 338, -1, 277, -1, -1, -1, - 281, -1, -1, 284, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 296, 297, -1, 362, -1, - 301, 302, -1, 261, 368, 369, 307, -1, 309, 310, - 311, 312, -1, -1, 272, -1, 317, -1, -1, 277, - 321, -1, 323, 281, -1, -1, 284, -1, -1, -1, - -1, -1, 333, -1, -1, 336, -1, 338, 296, 297, - -1, 342, -1, 301, 302, 261, -1, -1, -1, 307, - -1, 309, 310, 311, 312, -1, -1, -1, -1, 317, - -1, 362, -1, 321, -1, 323, -1, 368, 284, -1, - -1, -1, -1, -1, -1, 333, -1, -1, 336, -1, - 338, 297, -1, 261, 342, -1, 302, -1, -1, -1, - -1, 307, -1, 309, 310, 311, 312, -1, -1, -1, - -1, 317, -1, -1, 362, 321, 284, -1, -1, -1, - 368, -1, -1, -1, -1, -1, -1, 333, -1, 297, - 336, 261, 338, -1, 302, -1, -1, -1, -1, 307, - -1, 309, 310, 311, 312, -1, -1, -1, -1, 317, - -1, -1, -1, 321, 284, -1, 362, -1, 364, 365, - -1, -1, 368, -1, -1, 333, -1, 297, 336, 261, - 338, 263, 302, -1, -1, -1, -1, 307, -1, 309, - 310, 311, 312, -1, -1, 315, -1, 317, -1, -1, - -1, 321, 284, -1, 362, -1, 364, 365, -1, -1, - 368, -1, -1, 333, -1, 297, 336, 261, 338, -1, - 302, -1, -1, -1, -1, 307, -1, 309, 310, 311, - 312, -1, -1, -1, -1, 317, -1, -1, -1, 321, - 284, -1, 362, -1, -1, -1, -1, 261, 368, 263, - -1, 333, -1, 297, 336, -1, 338, -1, 302, -1, - -1, -1, -1, 307, -1, 309, 310, 311, 312, -1, - 284, -1, -1, 317, -1, -1, -1, 321, -1, -1, - 362, -1, -1, 297, -1, -1, 368, 261, 302, 333, - -1, -1, 336, 307, 338, 309, 310, 311, 312, -1, - -1, 315, -1, 317, -1, -1, -1, 321, -1, -1, - 284, -1, -1, -1, -1, -1, -1, 261, 362, 333, - 364, 365, 336, 297, 338, -1, -1, 301, 302, -1, - -1, -1, -1, 307, -1, 309, 310, 311, 312, -1, - 284, -1, -1, 317, -1, -1, -1, 321, 362, -1, - -1, -1, -1, 297, -1, -1, -1, -1, 302, 333, - -1, -1, 336, 307, 338, 309, 310, 311, 312, -1, - -1, -1, -1, 317, -1, -1, -1, 321, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 362, 333, - -1, -1, 336, -1, 338, -1, -1, -1, -1, -1, + 321, 284, -1, 362, -1, -1, -1, -1, 261, 368, + 263, -1, 333, -1, 297, 336, -1, 338, -1, 302, + -1, -1, -1, -1, 307, -1, 309, 310, 311, 312, + -1, 284, -1, -1, 317, -1, -1, -1, 321, -1, + -1, 362, -1, -1, 297, -1, -1, 368, 261, 302, + 333, -1, -1, 336, 307, 338, 309, 310, 311, 312, + -1, -1, 315, -1, 317, -1, -1, -1, 321, -1, + -1, 284, -1, -1, -1, -1, -1, -1, 261, 362, + 333, 364, 365, 336, 297, 338, -1, -1, 301, 302, + -1, -1, -1, -1, 307, -1, 309, 310, 311, 312, + -1, 284, -1, -1, 317, -1, -1, -1, 321, 362, + -1, -1, -1, -1, 297, -1, -1, -1, -1, 302, + 333, -1, -1, 336, 307, 338, 309, 310, 311, 312, + -1, -1, -1, -1, 317, -1, -1, -1, 321, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 362, + 333, -1, -1, 336, -1, 338, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 362, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 362, }; -#line 7043 "cs-parser.jay" +#line 7038 "cs-parser.jay" // // A class used to hold info about an operator declarator @@ -14410,7 +14409,7 @@ object Error_AwaitAsIdentifier (object token) { if (async_block) { report.Error (4003, GetLocation (token), "`await' cannot be used as an identifier within an async method or lambda expression"); - return new Tokenizer.LocatedToken ("await", GetLocation (token)); + return new LocatedToken ("await", GetLocation (token)); } return token; @@ -14604,7 +14603,7 @@ void FeatureIsNotAvailable (Location loc, string feature) Location GetLocation (object obj) { - var lt = obj as Tokenizer.LocatedToken; + var lt = obj as LocatedToken; if (lt != null) return lt.Location; @@ -14682,7 +14681,7 @@ AnonymousMethodExpression end_anonymous (ParametersBlock anon_block) retval = current_anonymous_method; async_block = (bool) oob_stack.Pop (); - current_variable = (BlockVariableDeclaration) oob_stack.Pop (); + current_variable = (BlockVariable) oob_stack.Pop (); current_local_parameters = (ParametersCompiled) oob_stack.Pop (); current_anonymous_method = (AnonymousMethodExpression) oob_stack.Pop (); @@ -14791,7 +14790,7 @@ string GetSymbolName (int token) case Token.LITERAL: return ((Constant)lexer.Value).GetValue ().ToString (); case Token.IDENTIFIER: - return ((Tokenizer.LocatedToken)lexer.Value).Value; + return ((LocatedToken)lexer.Value).Value; case Token.BOOL: return "bool"; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay index a659f55c0d..58a268219b 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay @@ -54,7 +54,7 @@ namespace Mono.CSharp /// Block current_block; - BlockVariableDeclaration current_variable; + BlockVariable current_variable; Delegate current_delegate; @@ -426,7 +426,7 @@ extern_alias_directives extern_alias_directive : EXTERN_ALIAS IDENTIFIER IDENTIFIER SEMICOLON { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; string s = lt.Value; if (s != "alias") { syntax_error (lt.Location, "`alias' expected"); @@ -434,7 +434,7 @@ extern_alias_directive if (lang_version == LanguageVersion.ISO_1) FeatureIsNotAvailable (lt.Location, "external alias"); - lt = (Tokenizer.LocatedToken) $3; + lt = (LocatedToken) $3; if (lt.Value == QualifiedAliasMember.GlobalAlias) { RootNamespace.Error_GlobalNamespaceRedefined (report, lt.Location); } @@ -474,7 +474,7 @@ using_namespace } | USING IDENTIFIER ASSIGN namespace_or_type_expr SEMICOLON { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; if (lang_version != LanguageVersion.ISO_1 && lt.Value == "global") { report.Warning (440, 2, lt.Location, "An alias named `global' will not be used when resolving `global::'. The global namespace will be used instead"); @@ -563,15 +563,14 @@ opt_semicolon_error namespace_name : IDENTIFIER { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; $$ = new MemberName (lt.Value, lt.Location); } | namespace_name DOT IDENTIFIER { - var lt = (Tokenizer.LocatedToken) $3; - $$ = new MemberName ((MemberName) $1, lt.Value, lt.Location) { - DotLocation = GetLocation ($2) - }; + var lt = (LocatedToken) $3; + $$ = new MemberName ((MemberName) $1, lt.Value, lt.Location); + lbag.AddLocation ($$, GetLocation ($2)); } | error { @@ -747,7 +746,7 @@ attribute_section_cont { Error_SyntaxError (yyToken); - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; var tne = new SimpleName (lt.Value, null, lt.Location); $$ = new List () { @@ -764,7 +763,7 @@ attribute_section_cont attribute_target : IDENTIFIER { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; $$ = CheckAttributeTarget (lt.Value, lt.Location); savedCloseLocation = GetLocation ($1); } @@ -894,14 +893,14 @@ named_attribute_argument expression { --lexer.parsing_block; - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; $$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4); lbag.AddLocation ($$, GetLocation($2)); } ; named_argument - : identifier_inside_body COLON opt_named_modifier expression + : identifier_inside_body COLON opt_named_modifier expression_or_error { if (lang_version <= LanguageVersion.V_3) FeatureIsNotAvailable (GetLocation ($1), "named argument"); @@ -909,7 +908,7 @@ named_argument // Avoid boxing in common case (no modifier) var arg_mod = $3 == null ? Argument.AType.None : (Argument.AType) $3; - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; $$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4, arg_mod); lbag.AddLocation ($$, GetLocation($2)); } @@ -1023,7 +1022,7 @@ constant_declaration opt_modifiers CONST type IDENTIFIER { - var lt = (Tokenizer.LocatedToken) $5; + var lt = (LocatedToken) $5; var mod = (Modifiers) $2; current_field = new Const (current_type, (FullNamedExpression) $4, mod, new MemberName (lt.Value, lt.Location), (Attributes) $1); current_type.AddMember (current_field); @@ -1074,7 +1073,7 @@ constant_declarators constant_declarator : COMMA IDENTIFIER constant_initializer { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (ConstInitializer) $3); lbag.AddLocation ($$, GetLocation ($1)); } @@ -1114,7 +1113,7 @@ field_declaration if (type.Type != null && type.Type.Kind == MemberKind.Void) report.Error (670, GetLocation ($3), "Fields cannot have void type"); - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; current_field = new Field (current_type, type, (Modifiers) $2, new MemberName (lt.Value, lt.Location), (Attributes) $1); current_type.AddField (current_field); $$ = current_field; @@ -1139,7 +1138,7 @@ field_declaration if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation ($3), "fixed size buffers"); - var lt = (Tokenizer.LocatedToken) $5; + var lt = (LocatedToken) $5; current_field = new FixedField (current_type, (FullNamedExpression) $4, (Modifiers) $2, new MemberName (lt.Value, lt.Location), (Attributes) $1); @@ -1203,7 +1202,7 @@ field_declarators field_declarator : COMMA IDENTIFIER { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null); lbag.AddLocation ($$, GetLocation ($1)); } @@ -1214,7 +1213,7 @@ field_declarator variable_initializer { --lexer.parsing_block; - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) $5); lbag.AddLocation ($$, GetLocation ($1), GetLocation ($3)); } @@ -1239,7 +1238,7 @@ fixed_field_declarators fixed_field_declarator : COMMA IDENTIFIER fixed_field_size { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (ConstInitializer) $3); lbag.AddLocation ($$, GetLocation ($1)); } @@ -1383,8 +1382,10 @@ method_header current_type.AddMember (method); - if ($11 != null) - method.SetConstraints ((List) $11); + async_block = (method.ModFlags & Modifiers.ASYNC) != 0; + + if ($12 != null) + method.SetConstraints ((List) $12); if (doc_support) method.DocComment = Lexer.consume_doc_comment (); @@ -1561,7 +1562,7 @@ fixed_parameter parameter_type identifier_inside_body { - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; $$ = new Parameter ((FullNamedExpression) $3, lt.Value, (Parameter.Modifier) $2, (Attributes) $1, lt.Location); lbag.AddLocation ($$, parameterModifierLocation); } @@ -1570,7 +1571,7 @@ fixed_parameter parameter_type identifier_inside_body OPEN_BRACKET CLOSE_BRACKET { - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; report.Error (1552, lt.Location, "Array type specifier, [], must appear before parameter name"); $$ = new Parameter ((FullNamedExpression) $3, lt.Value, (Parameter.Modifier) $2, (Attributes) $1, lt.Location); lbag.AddLocation ($$, parameterModifierLocation); @@ -1629,7 +1630,7 @@ fixed_parameter if ((valid_param_mod & ParameterModifierType.DefaultValue) == 0) report.Error (1065, GetLocation ($5), "Optional parameter is not valid in this context"); - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; $$ = new Parameter ((FullNamedExpression) $3, lt.Value, mod, (Attributes) $1, lt.Location); lbag.AddLocation ($$, parameterModifierLocation, GetLocation ($5)); // parameterModifierLocation should be ignored when mod == NONE @@ -1701,7 +1702,7 @@ parameter_modifier parameter_array : opt_attributes params_modifier type IDENTIFIER { - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; $$ = new ParamsParameter ((FullNamedExpression) $3, lt.Value, (Attributes) $1, lt.Location); lbag.AddLocation ($$, savedLocation); } @@ -1709,7 +1710,7 @@ parameter_array { report.Error (1751, GetLocation ($2), "Cannot specify a default value for a parameter array"); - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; $$ = new ParamsParameter ((FullNamedExpression) $3, lt.Value, (Attributes) $1, lt.Location); lbag.AddLocation ($$, savedLocation); } @@ -2135,11 +2136,11 @@ operator_declarator Operator.GetName (op)); } } else { - if (p_count > 2) { + if (p_count == 1) { + report.Error (1019, loc, "Overloadable unary operator expected"); + } else if (p_count != 2) { report.Error (1534, loc, "Overloaded binary operator `{0}' takes two parameters", Operator.GetName (op)); - } else if (p_count != 2) { - report.Error (1019, loc, "Overloadable unary operator expected"); } } @@ -2276,7 +2277,7 @@ constructor_declarator valid_param_mod = 0; current_local_parameters = (ParametersCompiled) $6; - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; var mods = (Modifiers) $2; var c = new Constructor (current_type, lt.Value, mods, (Attributes) $1, current_local_parameters, lt.Location); @@ -2373,7 +2374,7 @@ destructor_declaration } IDENTIFIER OPEN_PARENS CLOSE_PARENS method_body { - var lt = (Tokenizer.LocatedToken) $5; + var lt = (LocatedToken) $5; if (lt.Value != current_container.MemberName.Name){ report.Error (574, lt.Location, "Name of destructor must match name of class"); } else if (current_container.Kind != MemberKind.Class){ @@ -2496,7 +2497,7 @@ event_declarators event_declarator : COMMA IDENTIFIER { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null); lbag.AddLocation ($$, GetLocation ($1)); } @@ -2507,7 +2508,7 @@ event_declarator event_variable_initializer { --lexer.parsing_block; - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) $5); lbag.AddLocation ($$, GetLocation ($1), GetLocation ($3)); } @@ -2729,7 +2730,7 @@ enum_member_declarations enum_member_declaration : opt_attributes IDENTIFIER { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) $1); ((Enum) current_type).AddEnumMember (em); @@ -2752,7 +2753,7 @@ enum_member_declaration { --lexer.parsing_block; - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) $1); em.Initializer = new ConstInitializer (em, (Expression) $5, GetLocation ($4)); ((Enum) current_type).AddEnumMember (em); @@ -2766,7 +2767,7 @@ enum_member_declaration { Error_SyntaxError (yyToken); - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) $1); ((Enum) current_type).AddEnumMember (em); @@ -2840,8 +2841,8 @@ namespace_or_type_expr : member_name | qualified_alias_member IDENTIFIER opt_type_argument_list { - var lt1 = (Tokenizer.LocatedToken) $1; - var lt2 = (Tokenizer.LocatedToken) $2; + var lt1 = (LocatedToken) $1; + var lt2 = (LocatedToken) $2; $$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) $3, lt1.Location); lbag.AddLocation ($$, savedLocation, GetLocation ($2)); @@ -2852,17 +2853,16 @@ member_name : simple_name_expr | namespace_or_type_expr DOT IDENTIFIER opt_type_argument_list { - var lt = (Tokenizer.LocatedToken) $3; - $$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location) { - DotLocation = GetLocation ($2) - }; + var lt = (LocatedToken) $3; + $$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location); + lbag.AddLocation ($$, GetLocation ($2)); } ; simple_name_expr : IDENTIFIER opt_type_argument_list { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; $$ = new SimpleName (lt.Value, (TypeArguments)$2, lt.Location); } ; @@ -2918,7 +2918,7 @@ type_declaration_name opt_type_parameter_list { lexer.parsing_generic_declaration = false; - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; $$ = new MemberName (lt.Value, (TypeParameters)$3, lt.Location); } ; @@ -2938,7 +2938,7 @@ method_declaration_name | explicit_interface IDENTIFIER opt_type_parameter_list { lexer.parsing_generic_declaration = false; - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new MemberName (lt.Value, (TypeParameters) $3, (ATypeNameExpression) $1, lt.Location); } ; @@ -2959,21 +2959,21 @@ indexer_declaration_name explicit_interface : IDENTIFIER opt_type_argument_list DOT { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; $$ = new SimpleName (lt.Value, (TypeArguments) $2, lt.Location); lbag.AddLocation ($$, GetLocation ($3)); } | qualified_alias_member IDENTIFIER opt_type_argument_list DOT { - var lt1 = (Tokenizer.LocatedToken) $1; - var lt2 = (Tokenizer.LocatedToken) $2; + var lt1 = (LocatedToken) $1; + var lt2 = (LocatedToken) $2; $$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) $3, lt1.Location); lbag.AddLocation ($$, savedLocation, GetLocation ($4)); } | explicit_interface IDENTIFIER opt_type_argument_list DOT { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new MemberAccess ((ATypeNameExpression) $1, lt.Value, (TypeArguments) $3, lt.Location); lbag.AddLocation ($$, GetLocation ($4)); } @@ -3014,7 +3014,7 @@ type_parameters type_parameter : opt_attributes opt_type_parameter_variance IDENTIFIER { - var lt = (Tokenizer.LocatedToken)$3; + var lt = (LocatedToken)$3; var variance = (Variance) $2; $$ = new TypeParameter (new MemberName (lt.Value, lt.Location), (Attributes)$1, variance); if (variance != Variance.None) @@ -3202,11 +3202,11 @@ primary_expression primary_expression_or_type : IDENTIFIER opt_type_argument_list { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; $$ = new SimpleName (lt.Value, (TypeArguments)$2, lt.Location); } | IDENTIFIER GENERATE_COMPLETION { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; $$ = new CompletionSimpleName (MemberName.MakeName (lt.Value, null), lt.Location); } | member_access @@ -3259,29 +3259,26 @@ parenthesized_expression member_access : primary_expression DOT identifier_inside_body opt_type_argument_list { - var lt = (Tokenizer.LocatedToken) $3; - $$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location) { - DotLocation = GetLocation ($2) - }; + var lt = (LocatedToken) $3; + $$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location); + lbag.AddLocation ($$, GetLocation ($2)); } | builtin_types DOT identifier_inside_body opt_type_argument_list { - var lt = (Tokenizer.LocatedToken) $3; - $$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location) { - DotLocation = GetLocation ($2) - }; + var lt = (LocatedToken) $3; + $$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location); + lbag.AddLocation ($$, GetLocation ($2)); } | BASE DOT identifier_inside_body opt_type_argument_list { - var lt = (Tokenizer.LocatedToken) $3; - $$ = new MemberAccess (new BaseThis (GetLocation ($1)), lt.Value, (TypeArguments) $4, lt.Location) { - DotLocation = GetLocation ($2) - }; + var lt = (LocatedToken) $3; + $$ = new MemberAccess (new BaseThis (GetLocation ($1)), lt.Value, (TypeArguments) $4, lt.Location); + lbag.AddLocation ($$, GetLocation ($2)); } | qualified_alias_member identifier_inside_body opt_type_argument_list { - var lt1 = (Tokenizer.LocatedToken) $1; - var lt2 = (Tokenizer.LocatedToken) $2; + var lt1 = (LocatedToken) $1; + var lt2 = (LocatedToken) $2; $$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) $3, lt1.Location); lbag.AddLocation ($$, savedLocation, GetLocation ($2)); @@ -3290,7 +3287,7 @@ member_access $$ = new CompletionMemberAccess ((Expression) $1, null,GetLocation ($3)); } | primary_expression DOT IDENTIFIER GENERATE_COMPLETION { - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; $$ = new CompletionMemberAccess ((Expression) $1, lt.Value, lt.Location); } | builtin_types DOT GENERATE_COMPLETION @@ -3298,7 +3295,7 @@ member_access $$ = new CompletionMemberAccess ((Expression) $1, null, lexer.Location); } | builtin_types DOT IDENTIFIER GENERATE_COMPLETION { - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; $$ = new CompletionMemberAccess ((Expression) $1, lt.Value, lt.Location); } ; @@ -3378,13 +3375,13 @@ member_initializer_list member_initializer : IDENTIFIER ASSIGN initializer_value { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; $$ = new ElementInitializer (lt.Value, (Expression)$3, lt.Location); lbag.AddLocation ($$, GetLocation ($2)); } | AWAIT ASSIGN initializer_value { - var lt = (Tokenizer.LocatedToken) Error_AwaitAsIdentifier ($1); + var lt = (LocatedToken) Error_AwaitAsIdentifier ($1); $$ = new ElementInitializer (lt.Value, (Expression)$3, lt.Location); lbag.AddLocation ($$, GetLocation ($2)); } @@ -3722,13 +3719,13 @@ anonymous_type_parameters anonymous_type_parameter : identifier_inside_body ASSIGN variable_initializer { - var lt = (Tokenizer.LocatedToken)$1; + var lt = (LocatedToken)$1; $$ = new AnonymousTypeParameter ((Expression)$3, lt.Value, lt.Location); lbag.AddLocation ($$, GetLocation ($2)); } | identifier_inside_body { - var lt = (Tokenizer.LocatedToken)$1; + var lt = (LocatedToken)$1; $$ = new AnonymousTypeParameter (new SimpleName (lt.Value, lt.Location), lt.Value, lt.Location); } @@ -3857,15 +3854,17 @@ typeof_type_expression unbound_type_name : identifier_inside_body generic_dimension { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; + var sn = new SimpleName (lt.Value, (int) $2, lt.Location); $$ = sn; lbag.AddLocation (sn.TypeArguments, Lexer.GetGenericDimensionLocations ()); } | qualified_alias_member identifier_inside_body generic_dimension { - var lt1 = (Tokenizer.LocatedToken) $1; - var lt2 = (Tokenizer.LocatedToken) $2; + var lt1 = (LocatedToken) $1; + var lt2 = (LocatedToken) $2; + var qam = new QualifiedAliasMember (lt1.Value, lt2.Value, (int) $3, lt1.Location); $$ = qam; lbag.AddLocation (qam.TypeArguments, Lexer.GetGenericDimensionLocations ()); @@ -3873,20 +3872,18 @@ unbound_type_name } | unbound_type_name DOT identifier_inside_body { - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; - $$ = new MemberAccess ((Expression) $1, lt.Value, lt.Location) { - DotLocation = GetLocation ($2) - }; + $$ = new MemberAccess ((Expression) $1, lt.Value, lt.Location); + lbag.AddLocation ($$, savedLocation, GetLocation ($2)); } | unbound_type_name DOT identifier_inside_body generic_dimension { - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; - var ma = new MemberAccess ((Expression) $1, lt.Value, (int) $4, lt.Location) { - DotLocation = GetLocation ($2) - }; + var ma = new MemberAccess ((Expression) $1, lt.Value, (int) $4, lt.Location); $$ = ma; + lbag.AddLocation ($$, savedLocation, GetLocation ($2)); lbag.AddLocation (ma.TypeArguments, Lexer.GetGenericDimensionLocations ()); } | namespace_or_type_expr DOT identifier_inside_body generic_dimension @@ -3895,10 +3892,8 @@ unbound_type_name if (tne.HasTypeArguments) Error_TypeExpected (GetLocation ($4)); - var lt = (Tokenizer.LocatedToken) $3; - var ma = new MemberAccess (tne, lt.Value, (int) $4, lt.Location) { - DotLocation = GetLocation ($2) - }; + var lt = (LocatedToken) $3; + var ma = new MemberAccess (tne, lt.Value, (int) $4, lt.Location); $$ = ma; lbag.AddLocation (ma.TypeArguments, Lexer.GetGenericDimensionLocations ()); } @@ -3917,7 +3912,7 @@ generic_dimension qualified_alias_member : IDENTIFIER DOUBLE_COLON { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; if (lang_version == LanguageVersion.ISO_1) FeatureIsNotAvailable (lt.Location, "namespace alias qualifier"); savedLocation = GetLocation ($2); @@ -3971,7 +3966,7 @@ unchecked_expression pointer_member_access : primary_expression OP_PTR IDENTIFIER opt_type_argument_list { - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; $$ = new MemberAccess (new Indirection ((Expression) $1, GetLocation ($2)), lt.Value, (TypeArguments) $4, lt.Location); } ; @@ -4570,24 +4565,24 @@ lambda_parameter_list lambda_parameter : parameter_modifier parameter_type identifier_inside_body { - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; $$ = new Parameter ((FullNamedExpression) $2, lt.Value, (Parameter.Modifier) $1, null, lt.Location); } | parameter_type identifier_inside_body { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new Parameter ((FullNamedExpression) $1, lt.Value, Parameter.Modifier.NONE, null, lt.Location); } | IDENTIFIER { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; $$ = new ImplicitLambdaParameter (lt.Value, lt.Location); } | AWAIT { - var lt = (Tokenizer.LocatedToken) Error_AwaitAsIdentifier ($1); + var lt = (LocatedToken) Error_AwaitAsIdentifier ($1); $$ = new ImplicitLambdaParameter (lt.Value, lt.Location); } ; @@ -4637,7 +4632,7 @@ expression_or_error lambda_expression : IDENTIFIER ARROW { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location); start_anonymous (true, new ParametersCompiled (p), false, lt.Location); } @@ -4648,7 +4643,7 @@ lambda_expression } | AWAIT ARROW { - var lt = (Tokenizer.LocatedToken) Error_AwaitAsIdentifier ($1); + var lt = (LocatedToken) Error_AwaitAsIdentifier ($1); Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location); start_anonymous (true, new ParametersCompiled (p), false, lt.Location); } @@ -4659,7 +4654,7 @@ lambda_expression } | ASYNC identifier_inside_body ARROW { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location); start_anonymous (true, new ParametersCompiled (p), true, lt.Location); } @@ -4923,14 +4918,14 @@ opt_class_base : /* empty */ | COLON type_list { - current_type.AddBasesForPart ((List) $2); + current_type.SetBaseTypes ((List) $2); lbag.AppendToMember (current_type, GetLocation ($1)); } | COLON type_list error { Error_SyntaxError (yyToken); - current_type.AddBasesForPart ((List) $2); + current_type.SetBaseTypes ((List) $2); } ; @@ -4970,7 +4965,7 @@ type_parameter_constraints_clauses type_parameter_constraints_clause : WHERE IDENTIFIER COLON type_parameter_constraints { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new Constraints (new SimpleMemberName (lt.Value, lt.Location), (List) $4, GetLocation ($1)); lbag.AddLocation ($$, GetLocation ($3)); } @@ -4978,7 +4973,7 @@ type_parameter_constraints_clause { Error_SyntaxError (yyToken); - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new Constraints (new SimpleMemberName (lt.Value, lt.Location), null, GetLocation ($1)); } ; @@ -5160,7 +5155,7 @@ statement | IDENTIFIER error { Error_SyntaxError (yyToken); - var lt =(Tokenizer.LocatedToken) $1; + var lt =(LocatedToken) $1; var sn = new SimpleName (lt.Value, lt.Location); current_block.AddStatement(new StatementErrorExpression (sn)); $$ = null; @@ -5258,7 +5253,7 @@ empty_statement labeled_statement : identifier_inside_body COLON { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; LabeledStatement labeled = new LabeledStatement (lt.Value, current_block, lt.Location); lbag.AddLocation (labeled, GetLocation ($2)); current_block.AddLabel (labeled); @@ -5375,10 +5370,10 @@ identifier_inside_body block_variable_declaration : variable_type identifier_inside_body { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var li = new LocalVariable (current_block, lt.Value, lt.Location); current_block.AddLocalName (li); - current_variable = new BlockVariableDeclaration ((FullNamedExpression) $1, li); + current_variable = new BlockVariable ((FullNamedExpression) $1, li); } opt_local_variable_initializer opt_variable_declarators semicolon_or_handle_error_close_brace { @@ -5391,10 +5386,10 @@ block_variable_declaration } | CONST variable_type identifier_inside_body { - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.Constant, lt.Location); current_block.AddLocalName (li); - current_variable = new BlockConstantDeclaration ((FullNamedExpression) $2, li); + current_variable = new BlockConstant ((FullNamedExpression) $2, li); } const_variable_initializer opt_const_declarators SEMICOLON { @@ -5461,18 +5456,18 @@ variable_declarators variable_declarator : COMMA identifier_inside_body { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var li = new LocalVariable (current_variable.Variable, lt.Value, lt.Location); - var d = new BlockVariableDeclaration.Declarator (li, null); + var d = new BlockVariableDeclarator (li, null); current_variable.AddDeclarator (d); current_block.AddLocalName (li); lbag.AddLocation (d, GetLocation ($1)); } | COMMA identifier_inside_body ASSIGN block_variable_initializer { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var li = new LocalVariable (current_variable.Variable, lt.Value, lt.Location); - var d = new BlockVariableDeclaration.Declarator (li, (Expression) $4); + var d = new BlockVariableDeclarator (li, (Expression) $4); current_variable.AddDeclarator (d); current_block.AddLocalName (li); lbag.AddLocation (d, GetLocation ($1), GetLocation ($3)); @@ -5504,9 +5499,9 @@ const_declarators const_declarator : COMMA identifier_inside_body ASSIGN constant_initializer_expr { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.Constant, lt.Location); - var d = new BlockVariableDeclaration.Declarator (li, (Expression) $4); + var d = new BlockVariableDeclarator (li, (Expression) $4); current_variable.AddDeclarator (d); current_block.AddLocalName (li); lbag.AddLocation (d, GetLocation ($1), GetLocation ($3)); @@ -5557,7 +5552,6 @@ statement_expression ExpressionStatement s = $1 as ExpressionStatement; if (s == null) { var expr = $1 as Expression; - expr.Error_InvalidExpressionStatement (report); $$ = new StatementErrorExpression (expr); } else { $$ = new StatementExpression (s); @@ -5822,10 +5816,10 @@ opt_for_initializer for_initializer : variable_type identifier_inside_body { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var li = new LocalVariable (current_block, lt.Value, lt.Location); current_block.AddLocalName (li); - current_variable = new BlockVariableDeclaration ((FullNamedExpression) $1, li); + current_variable = new BlockVariable ((FullNamedExpression) $1, li); } opt_local_variable_initializer opt_variable_declarators { @@ -5891,7 +5885,7 @@ foreach_statement start_block (GetLocation ($2)); current_block.IsCompilerGenerated = true; - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location); current_block.AddLocalName (li); @@ -5905,7 +5899,8 @@ foreach_statement { start_block (GetLocation ($2)); current_block.IsCompilerGenerated = true; - var lt = (Tokenizer.LocatedToken) $4; + + var lt = (LocatedToken) $4; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location); current_block.AddLocalName (li); $$ = li; @@ -5925,7 +5920,7 @@ foreach_statement { start_block (GetLocation ($2)); current_block.IsCompilerGenerated = true; - var lt = $4 as Tokenizer.LocatedToken; + var lt = $4 as LocatedToken; var li = lt != null ? new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location) : null; Foreach f = new Foreach ((Expression) $3, li, null, null, null, GetLocation ($1)); @@ -5977,7 +5972,7 @@ continue_statement goto_statement : GOTO identifier_inside_body SEMICOLON { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; $$ = new Goto (lt.Value, GetLocation ($1)); lbag.AddStatement ($$, GetLocation ($2), GetLocation ($3)); } @@ -6027,7 +6022,7 @@ throw_statement yield_statement : identifier_inside_body RETURN opt_expression SEMICOLON { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; string s = lt.Value; if (s != "yield"){ report.Error (1003, lt.Location, "; expected"); @@ -6045,7 +6040,7 @@ yield_statement { Error_SyntaxError (yyToken); - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; string s = lt.Value; if (s != "yield"){ report.Error (1003, lt.Location, "; expected"); @@ -6061,7 +6056,7 @@ yield_statement } | identifier_inside_body BREAK SEMICOLON { - var lt = (Tokenizer.LocatedToken) $1; + var lt = (LocatedToken) $1; string s = lt.Value; if (s != "yield"){ report.Error (1003, lt.Location, "; expected"); @@ -6069,7 +6064,7 @@ yield_statement FeatureIsNotAvailable (lt.Location, "iterators"); } - current_block.Explicit.RegisterIteratorYield (); + current_block.ParametersBlock.TopBlock.IsIterator = true; $$ = new YieldBreak (lt.Location); lbag.AddStatement ($$, GetLocation ($2), GetLocation ($3)); } @@ -6141,7 +6136,7 @@ catch_clause c.TypeExpression = (FullNamedExpression) $3; if ($4 != null) { - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; c.Variable = new LocalVariable (current_block, lt.Value, lt.Location); current_block.AddLocalName (c.Variable); } @@ -6174,12 +6169,12 @@ catch_clause c.TypeExpression = (FullNamedExpression) $3; if ($4 != null) { - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; c.Variable = new LocalVariable (current_block, lt.Value, lt.Location); } if ($4 != null) { - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; c.Variable = new LocalVariable (current_block, lt.Value, lt.Location); } @@ -6237,7 +6232,7 @@ fixed_statement start_block (GetLocation ($2)); current_block.IsCompilerGenerated = true; - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.FixedVariable | LocalVariable.Flags.Used, lt.Location); current_block.AddLocalName (li); current_variable = new Fixed.VariableDeclaration ((FullNamedExpression) $3, li); @@ -6265,7 +6260,7 @@ using_statement start_block (GetLocation ($2)); current_block.IsCompilerGenerated = true; - var lt = (Tokenizer.LocatedToken) $4; + var lt = (LocatedToken) $4; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.UsingVariable | LocalVariable.Flags.Used, lt.Location); current_block.AddLocalName (li); current_variable = new Using.VariableDeclaration ((FullNamedExpression) $3, li); @@ -6371,7 +6366,7 @@ first_from_clause { current_block = new Linq.QueryBlock (current_block, lexer.Location); - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var rv = new Linq.RangeVariable (lt.Value, lt.Location); var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$4, rv, GetLocation ($1)); lbag.AddLocation (start, GetLocation ($3)); @@ -6381,7 +6376,7 @@ first_from_clause { current_block = new Linq.QueryBlock (current_block, lexer.Location); - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; var rv = new Linq.RangeVariable (lt.Value, lt.Location); var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$5, rv, GetLocation ($1)) { IdentifierType = (FullNamedExpression)$2 @@ -6396,7 +6391,7 @@ nested_from_clause { current_block = new Linq.QueryBlock (current_block, lexer.Location); - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var rv = new Linq.RangeVariable (lt.Value, lt.Location); var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$4, rv, GetLocation ($1)); lbag.AddLocation (start, GetLocation ($3)); @@ -6406,7 +6401,7 @@ nested_from_clause { current_block = new Linq.QueryBlock (current_block, lexer.Location); - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; var rv = new Linq.RangeVariable (lt.Value, lt.Location); var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$5, rv, GetLocation ($1)) { IdentifierType = (FullNamedExpression)$2 @@ -6423,7 +6418,7 @@ from_clause } expression_or_error { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var sn = new Linq.RangeVariable (lt.Value, lt.Location); $$ = new Linq.SelectMany ((Linq.QueryBlock)current_block, sn, (Expression)$5, GetLocation ($1)); @@ -6439,7 +6434,7 @@ from_clause } expression_or_error { - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; var sn = new Linq.RangeVariable (lt.Value, lt.Location); $$ = new Linq.SelectMany ((Linq.QueryBlock)current_block, sn, (Expression)$6, GetLocation ($1)) { @@ -6571,7 +6566,7 @@ let_clause } expression_or_error { - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var sn = new Linq.RangeVariable (lt.Value, lt.Location); $$ = new Linq.Let ((Linq.QueryBlock) current_block, sn, (Expression)$5, GetLocation ($1)); lbag.AddLocation ($$, GetLocation ($3)); @@ -6630,7 +6625,7 @@ join_clause var outer_selector = linq_clause_blocks.Pop (); var block = linq_clause_blocks.Pop (); - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var sn = new Linq.RangeVariable (lt.Value, lt.Location); Linq.RangeVariable into; @@ -6650,7 +6645,7 @@ join_clause ((Linq.QueryBlock)current_block).AddRangeVariable (sn); - lt = (Tokenizer.LocatedToken) $12; + lt = (LocatedToken) $12; into = new Linq.RangeVariable (lt.Value, lt.Location); $$ = new Linq.GroupJoin (block, sn, (Expression)$5, outer_selector, (Linq.QueryBlock) current_block, into, GetLocation ($1)); @@ -6692,7 +6687,7 @@ join_clause var outer_selector = linq_clause_blocks.Pop (); var block = linq_clause_blocks.Pop (); - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; var sn = new Linq.RangeVariable (lt.Value, lt.Location); Linq.RangeVariable into; @@ -6714,7 +6709,7 @@ join_clause ((Linq.QueryBlock)current_block).AddRangeVariable (sn); - lt = (Tokenizer.LocatedToken) $13; + lt = (LocatedToken) $13; into = new Linq.RangeVariable (lt.Value, lt.Location); // TODO: $$ = new Linq.GroupJoin (block, sn, (Expression)$6, outer_selector, (Linq.QueryBlock) current_block, into, GetLocation ($1)) { @@ -6840,7 +6835,7 @@ opt_query_continuation query_body { var current_block = linq_clause_blocks.Pop (); - var lt = (Tokenizer.LocatedToken) $2; + var lt = (LocatedToken) $2; var rv = new Linq.RangeVariable (lt.Value, lt.Location); $$ = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, null, rv, GetLocation ($1)) { next = (Linq.AQueryClause)$4 @@ -6945,7 +6940,7 @@ doc_cref { module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)$1; module.DocumentationBuilder.ParsedParameters = (List)$4; - var lt = (Tokenizer.LocatedToken) $3; + var lt = (LocatedToken) $3; $$ = new MemberName (lt.Value); } | doc_type_declaration_name DOT THIS @@ -7107,7 +7102,7 @@ object Error_AwaitAsIdentifier (object token) { if (async_block) { report.Error (4003, GetLocation (token), "`await' cannot be used as an identifier within an async method or lambda expression"); - return new Tokenizer.LocatedToken ("await", GetLocation (token)); + return new LocatedToken ("await", GetLocation (token)); } return token; @@ -7301,7 +7296,7 @@ void FeatureIsNotAvailable (Location loc, string feature) Location GetLocation (object obj) { - var lt = obj as Tokenizer.LocatedToken; + var lt = obj as LocatedToken; if (lt != null) return lt.Location; @@ -7379,7 +7374,7 @@ AnonymousMethodExpression end_anonymous (ParametersBlock anon_block) retval = current_anonymous_method; async_block = (bool) oob_stack.Pop (); - current_variable = (BlockVariableDeclaration) oob_stack.Pop (); + current_variable = (BlockVariable) oob_stack.Pop (); current_local_parameters = (ParametersCompiled) oob_stack.Pop (); current_anonymous_method = (AnonymousMethodExpression) oob_stack.Pop (); @@ -7488,7 +7483,7 @@ string GetSymbolName (int token) case Token.LITERAL: return ((Constant)lexer.Value).GetValue ().ToString (); case Token.IDENTIFIER: - return ((Tokenizer.LocatedToken)lexer.Value).Value; + return ((LocatedToken)lexer.Value).Value; case Token.BOOL: return "bool"; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs index 3b3bce3839..a1f4b88510 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs @@ -20,6 +20,44 @@ using System.Collections; namespace Mono.CSharp { + // + // This class has to be used by parser only, it reuses token + // details once a file is parsed + // + public class LocatedToken + { + public int row, column; + public string value; + public SourceFile file; + + public LocatedToken () + { + } + + public LocatedToken (string value, Location loc) + { + this.value = value; + file = loc.SourceFile; + row = loc.Row; + column = loc.Column; + } + + public override string ToString () + { + return string.Format ("Token '{0}' at {1},{2}", Value, row, column); + } + + public Location Location + { + get { return new Location (file, row, column); } + } + + public string Value + { + get { return value; } + } + } + /// /// Tokenizer for C# source code. /// @@ -66,42 +104,6 @@ namespace Mono.CSharp } } - // - // This class has to be used by parser only, it reuses token - // details after each file parse completion - // - public class LocatedToken - { - public int row, column; - public string value; - public SourceFile file; - - public LocatedToken () - { - } - - public LocatedToken (string value, Location loc) - { - this.value = value; - file = loc.SourceFile; - row = loc.Row; - column = loc.Column; - } - - public override string ToString () - { - return string.Format ("Token '{0}' at {1},{2}", Value, row, column); - } - - public Location Location { - get { return new Location (file, row, column); } - } - - public string Value { - get { return value; } - } - } - public class LocatedTokenBuffer { readonly LocatedToken[] buffer; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs index a3c0c8c707..e7f27aa7d6 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs @@ -53,12 +53,6 @@ namespace Mono.CSharp { : this (name, Location.Null) { } -#if FULL_AST - public Location DotLocation { - get; - set; - } -#endif public MemberName (string name, Location loc) : this (null, name, loc) { } @@ -1281,6 +1275,11 @@ namespace Mono.CSharp { void SetIsUsed (); } + public interface IMethodDefinition : IMemberDefinition + { + MethodBase Metadata { get; } + } + public interface IParametersMember : IInterfaceMemberSpec { AParametersCollection Parameters { get; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/delegate.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/delegate.cs index 73121aaca3..f6018715e5 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/delegate.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/delegate.cs @@ -153,7 +153,7 @@ namespace Mono.CSharp { Report.SymbolRelatedToPreviousError (partype); Report.Error (59, Location, "Inconsistent accessibility: parameter type `{0}' is less accessible than delegate `{1}'", - TypeManager.CSharpName (partype), GetSignatureForError ()); + partype.GetSignatureForError (), GetSignatureForError ()); } } @@ -169,7 +169,7 @@ namespace Mono.CSharp { Report.SymbolRelatedToPreviousError (ret_type); Report.Error (58, Location, "Inconsistent accessibility: return type `" + - TypeManager.CSharpName (ret_type) + "' is less " + + ret_type.GetSignatureForError () + "' is less " + "accessible than delegate `" + GetSignatureForError () + "'"); return false; } @@ -297,6 +297,12 @@ namespace Mono.CSharp { if (!Parameters.IsEmpty) { parameters.ResolveDefaultValues (this); } + + InvokeBuilder.PrepareEmit (); + if (BeginInvokeBuilder != null) { + BeginInvokeBuilder.PrepareEmit (); + EndInvokeBuilder.PrepareEmit (); + } } public override void Emit () @@ -522,7 +528,7 @@ namespace Mono.CSharp { TypeSpec e_type = emg.ExtensionExpression.Type; if (TypeSpec.IsValueType (e_type)) { ec.Report.Error (1113, loc, "Extension method `{0}' of value type `{1}' cannot be used to create delegates", - delegate_method.GetSignatureForError (), TypeManager.CSharpName (e_type)); + delegate_method.GetSignatureForError (), e_type.GetSignatureForError ()); } } @@ -586,8 +592,8 @@ namespace Mono.CSharp { ec.Report.SymbolRelatedToPreviousError (method); if (ec.Module.Compiler.Settings.Version == LanguageVersion.ISO_1) { ec.Report.Error (410, loc, "A method or delegate `{0} {1}' parameters and return type must be same as delegate `{2} {3}' parameters and return type", - TypeManager.CSharpName (method.ReturnType), member_name, - TypeManager.CSharpName (invoke_method.ReturnType), Delegate.FullDelegateDesc (invoke_method)); + method.ReturnType.GetSignatureForError (), member_name, + invoke_method.ReturnType.GetSignatureForError (), Delegate.FullDelegateDesc (invoke_method)); return; } @@ -599,7 +605,7 @@ namespace Mono.CSharp { ec.Report.Error (407, loc, "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' return type", return_type.GetSignatureForError (), member_name, - TypeManager.CSharpName (invoke_method.ReturnType), Delegate.FullDelegateDesc (invoke_method)); + invoke_method.ReturnType.GetSignatureForError (), Delegate.FullDelegateDesc (invoke_method)); } public static bool ImplicitStandardConversionExists (ResolveContext ec, MethodGroupExpr mg, TypeSpec target_type) diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs index 9b7862560f..ddbc1f0ed7 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs @@ -80,7 +80,7 @@ namespace Mono.CSharp var session = new ParserSession () { UseJayGlobalArrays = true, - LocatedTokens = new Tokenizer.LocatedToken[15000] + LocatedTokens = new LocatedToken[15000] }; for (int i = 0; i < sources.Count; ++i) { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs index b9d6967dcc..0246c43a1b 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs @@ -447,6 +447,7 @@ namespace Mono.CSharp d.CreateContainer (); d.DefineContainer (); d.Define (); + d.PrepareEmit (); site.AddTypeContainer (d); del_type = new TypeExpression (d.CurrentType, loc); diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs index d9a5ac3e19..8f2c72898f 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs @@ -251,7 +251,7 @@ namespace Mono.CSharp { public void Error_ConstantCanBeInitializedWithNullOnly (ResolveContext rc, TypeSpec type, Location loc, string name) { rc.Report.Error (134, loc, "A constant `{0}' of reference type `{1}' can only be initialized with null", - name, TypeManager.CSharpName (type)); + name, type.GetSignatureForError ()); } protected virtual void Error_InvalidExpressionStatement (Report report, Location loc) @@ -282,7 +282,10 @@ namespace Mono.CSharp { protected void Error_ValueCannotBeConvertedCore (ResolveContext ec, Location loc, TypeSpec target, bool expl) { // The error was already reported as CS1660 - if (type == InternalType.AnonymousMethod || type == InternalType.ErrorType) + if (type == InternalType.AnonymousMethod) + return; + + if (type == InternalType.ErrorType || target == InternalType.ErrorType) return; string from_type = type.GetSignatureForError (); @@ -351,13 +354,15 @@ namespace Mono.CSharp { { ec.Report.SymbolRelatedToPreviousError (type); ec.Report.Error (117, loc, "`{0}' does not contain a definition for `{1}'", - TypeManager.CSharpName (type), name); + type.GetSignatureForError (), name); } public virtual void Error_ValueAssignment (ResolveContext rc, Expression rhs) { if (rhs == EmptyExpression.LValueMemberAccess || rhs == EmptyExpression.LValueMemberOutAccess) { // Already reported as CS1612 + } else if (rhs == EmptyExpression.OutAccess) { + rc.Report.Error (1510, loc, "A ref or out argument must be an assignable variable"); } else { rc.Report.Error (131, loc, "The left-hand side of an assignment must be a variable, a property or an indexer"); } @@ -492,10 +497,7 @@ namespace Mono.CSharp { if (e == null) { if (errors == ec.Report.Errors) { - if (out_access) - ec.Report.Error (1510, loc, "A ref or out argument must be an assignable variable"); - else - Error_ValueAssignment (ec, right_side); + Error_ValueAssignment (ec, right_side); } return null; } @@ -1475,7 +1477,7 @@ namespace Mono.CSharp { public override string GetSignatureForError() { - return TypeManager.CSharpName (Type); + return Type.GetSignatureForError (); } public override object GetValue () @@ -1534,7 +1536,7 @@ namespace Mono.CSharp { } } - public override Constant ConvertExplicitly(bool in_checked_context, TypeSpec target_type) + public override Constant ConvertExplicitly (bool in_checked_context, TypeSpec target_type) { if (Child.Type == target_type) return Child; @@ -2418,15 +2420,15 @@ namespace Mono.CSharp { } } - public override FullNamedExpression ResolveAsTypeOrNamespace (IMemberContext ec) + public override FullNamedExpression ResolveAsTypeOrNamespace (IMemberContext mc) { - FullNamedExpression fne = ec.LookupNamespaceOrType (Name, Arity, LookupMode.Normal, loc); + FullNamedExpression fne = mc.LookupNamespaceOrType (Name, Arity, LookupMode.Normal, loc); if (fne != null) { if (fne.Type != null && Arity > 0) { if (HasTypeArguments) { GenericTypeExpr ct = new GenericTypeExpr (fne.Type, targs, loc); - if (ct.ResolveAsType (ec) == null) + if (ct.ResolveAsType (mc) == null) return null; return ct; @@ -2442,21 +2444,21 @@ namespace Mono.CSharp { return fne; } - if (Arity == 0 && Name == "dynamic" && ec.Module.Compiler.Settings.Version > LanguageVersion.V_3) { - if (!ec.Module.PredefinedAttributes.Dynamic.IsDefined) { - ec.Module.Compiler.Report.Error (1980, Location, + if (Arity == 0 && Name == "dynamic" && mc.Module.Compiler.Settings.Version > LanguageVersion.V_3) { + if (!mc.Module.PredefinedAttributes.Dynamic.IsDefined) { + mc.Module.Compiler.Report.Error (1980, Location, "Dynamic keyword requires `{0}' to be defined. Are you missing System.Core.dll assembly reference?", - ec.Module.PredefinedAttributes.Dynamic.GetSignatureForError ()); + mc.Module.PredefinedAttributes.Dynamic.GetSignatureForError ()); } fne = new DynamicTypeExpr (loc); - fne.ResolveAsType (ec); + fne.ResolveAsType (mc); } if (fne != null) return fne; - Error_TypeOrNamespaceNotFound (ec); + Error_TypeOrNamespaceNotFound (mc); return null; } @@ -3297,8 +3299,12 @@ namespace Mono.CSharp { if (ExtensionExpression == null) return null; + var cand = candidates; arguments.Insert (0, new Argument (ExtensionExpression, Argument.AType.ExtensionType)); var res = base.OverloadResolve (ec, ref arguments, ehandler ?? this, restr); + + // Restore candidates in case we are running in probing mode + candidates = cand; // Store resolved argument and restore original arguments if (res == null) { @@ -3508,7 +3514,7 @@ namespace Mono.CSharp { public override void Error_ValueCannotBeConverted (ResolveContext ec, TypeSpec target, bool expl) { ec.Report.Error (428, loc, "Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using parentheses to invoke the method", - Name, TypeManager.CSharpName (target)); + Name, target.GetSignatureForError ()); } public static bool IsExtensionMethodArgument (Expression expr) @@ -5050,14 +5056,14 @@ namespace Mono.CSharp { string index = (idx + 1).ToString (); if (((mod & Parameter.Modifier.RefOutMask) ^ (a.Modifier & Parameter.Modifier.RefOutMask)) != 0) { if ((mod & Parameter.Modifier.RefOutMask) == 0) - ec.Report.Error (1615, loc, "Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' modifier", + ec.Report.Error (1615, a.Expr.Location, "Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' modifier", index, Parameter.GetModifierSignature (a.Modifier)); else - ec.Report.Error (1620, loc, "Argument `#{0}' is missing `{1}' modifier", + ec.Report.Error (1620, a.Expr.Location, "Argument `#{0}' is missing `{1}' modifier", index, Parameter.GetModifierSignature (mod)); } else { string p1 = a.GetSignatureForError (); - string p2 = TypeManager.CSharpName (paramType); + string p2 = paramType.GetSignatureForError (); if (p1 == p2) { p1 = a.Type.GetSignatureForErrorIncludingAssemblyName (); diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/enum.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/enum.cs index 126d2de867..87bbc7a94a 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/enum.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/enum.cs @@ -269,7 +269,7 @@ namespace Mono.CSharp { case BuiltinTypeSpec.Type.ULong: case BuiltinTypeSpec.Type.UShort: Report.Warning (3009, 1, Location, "`{0}': base type `{1}' is not CLS-compliant", - GetSignatureForError (), TypeManager.CSharpName (UnderlyingType)); + GetSignatureForError (), UnderlyingType.GetSignatureForError ()); break; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/eval.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/eval.cs index af8841f32e..cae7fe0610 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/eval.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/eval.cs @@ -652,7 +652,7 @@ namespace Mono.CSharp new TypeExpression (base_class_imported, host.Location) }; - host.AddBasesForPart (baseclass_list); + host.SetBaseTypes (baseclass_list); host.CreateContainer (); host.DefineContainer (); @@ -679,6 +679,7 @@ namespace Mono.CSharp } if (host != null){ + host.PrepareEmit (); host.EmitContainer (); } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs index 088fda532d..bda38a7383 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs @@ -1437,10 +1437,10 @@ namespace Mono.CSharp { if (result) ec.Report.Warning (183, 1, loc, "The given expression is always of the provided (`{0}') type", - TypeManager.CSharpName (probe_type_expr)); + probe_type_expr.GetSignatureForError ()); else ec.Report.Warning (184, 1, loc, "The given expression is never of the provided (`{0}') type", - TypeManager.CSharpName (probe_type_expr)); + probe_type_expr.GetSignatureForError ()); return ReducedExpression.Create (new BoolConstant (ec.BuiltinTypes, result, loc), this); } @@ -1630,7 +1630,7 @@ namespace Mono.CSharp } else { ec.Report.Error (77, loc, "The `as' operator cannot be used with a non-nullable value type `{0}'", - TypeManager.CSharpName (type)); + type.GetSignatureForError ()); } return null; } @@ -1663,7 +1663,7 @@ namespace Mono.CSharp } ec.Report.Error (39, loc, "Cannot convert type `{0}' to `{1}' via a built-in conversion", - TypeManager.CSharpName (etype), TypeManager.CSharpName (type)); + etype.GetSignatureForError (), type.GetSignatureForError ()); return null; } @@ -1702,7 +1702,7 @@ namespace Mono.CSharp return null; if (type.IsStatic) { - ec.Report.Error (716, loc, "Cannot convert to static type `{0}'", TypeManager.CSharpName (type)); + ec.Report.Error (716, loc, "Cannot convert to static type `{0}'", type.GetSignatureForError ()); return null; } @@ -2255,6 +2255,12 @@ namespace Mono.CSharp } } + public override Location StartLocation { + get { + return left.StartLocation; + } + } + #endregion /// @@ -2340,8 +2346,8 @@ namespace Mono.CSharp return; string l, r; - l = TypeManager.CSharpName (left.Type); - r = TypeManager.CSharpName (right.Type); + l = left.Type.GetSignatureForError (); + r = right.Type.GetSignatureForError (); ec.Report.Error (19, loc, "Operator `{0}' cannot be applied to operands of type `{1}' and `{2}'", oper, l, r); @@ -2716,9 +2722,10 @@ namespace Mono.CSharp // FIXME: consider constants + var ltype = lcast != null ? lcast.UnderlyingType : rcast.UnderlyingType; ec.Report.Warning (675, 3, loc, "The operator `|' used on the sign-extended type `{0}'. Consider casting to a smaller unsigned type first", - TypeManager.CSharpName (lcast != null ? lcast.UnderlyingType : rcast.UnderlyingType)); + ltype.GetSignatureForError ()); } public static PredefinedOperator[] CreatePointerOperatorsTable (BuiltinTypes types) @@ -2931,7 +2938,7 @@ namespace Mono.CSharp // FIXME: resolve right expression as unreachable // right.Resolve (ec); - ec.Report.Warning (429, 4, loc, "Unreachable expression code detected"); + ec.Report.Warning (429, 4, right.StartLocation, "Unreachable expression code detected"); return left; } @@ -3557,7 +3564,7 @@ namespace Mono.CSharp if (best_operator == null) { ec.Report.Error (34, loc, "Operator `{0}' is ambiguous on operands of type `{1}' and `{2}'", - OperName (oper), TypeManager.CSharpName (l), TypeManager.CSharpName (r)); + OperName (oper), l.GetSignatureForError (), r.GetSignatureForError ()); best_operator = po; break; @@ -3713,7 +3720,7 @@ namespace Mono.CSharp } catch (OverflowException) { ec.Report.Warning (652, 2, loc, "A comparison between a constant and a variable is useless. The constant is out of the range of the variable type `{0}'", - TypeManager.CSharpName (type)); + type.GetSignatureForError ()); } } } @@ -4273,7 +4280,7 @@ namespace Mono.CSharp if (op_true == null || op_false == null) { ec.Report.Error (218, loc, "The type `{0}' must have operator `true' and operator `false' defined when `{1}' is used as a short circuit operator", - TypeManager.CSharpName (type), oper.GetSignatureForError ()); + type.GetSignatureForError (), oper.GetSignatureForError ()); return null; } @@ -4684,7 +4691,7 @@ namespace Mono.CSharp } else { ec.Report.Error (173, true_expr.Location, "Type of conditional expression cannot be determined because there is no implicit conversion between `{0}' and `{1}'", - TypeManager.CSharpName (true_type), TypeManager.CSharpName (false_type)); + true_type.GetSignatureForError (), false_type.GetSignatureForError ()); return null; } } @@ -5194,6 +5201,9 @@ namespace Mono.CSharp void SetAssigned (ResolveContext ec) { + if (Parameter.HoistedVariant != null) + Parameter.HoistedVariant.IsAssigned = true; + if (HasOutModifier && ec.DoFlowAnalysis) ec.CurrentBranching.SetAssigned (VariableInfo); } @@ -5777,7 +5787,7 @@ namespace Mono.CSharp if (type.IsPointer) { ec.Report.Error (1919, loc, "Unsafe type `{0}' cannot be used in an object creation expression", - TypeManager.CSharpName (type)); + type.GetSignatureForError ()); return null; } @@ -5800,13 +5810,13 @@ namespace Mono.CSharp if ((tparam.SpecialConstraint & (SpecialConstraint.Struct | SpecialConstraint.Constructor)) == 0 && !TypeSpec.IsValueType (tparam)) { ec.Report.Error (304, loc, "Cannot create an instance of the variable type `{0}' because it does not have the new() constraint", - TypeManager.CSharpName (type)); + type.GetSignatureForError ()); } if ((arguments != null) && (arguments.Count != 0)) { ec.Report.Error (417, loc, "`{0}': cannot provide arguments when creating an instance of a variable type", - TypeManager.CSharpName (type)); + type.GetSignatureForError ()); } return this; @@ -5814,7 +5824,7 @@ namespace Mono.CSharp if (type.IsStatic) { ec.Report.SymbolRelatedToPreviousError (type); - ec.Report.Error (712, loc, "Cannot create an instance of the static class `{0}'", TypeManager.CSharpName (type)); + ec.Report.Error (712, loc, "Cannot create an instance of the static class `{0}'", type.GetSignatureForError ()); return null; } @@ -5826,7 +5836,7 @@ namespace Mono.CSharp } ec.Report.SymbolRelatedToPreviousError (type); - ec.Report.Error (144, loc, "Cannot create an instance of the abstract class or interface `{0}'", TypeManager.CSharpName (type)); + ec.Report.Error (144, loc, "Cannot create an instance of the abstract class or interface `{0}'", type.GetSignatureForError ()); return null; } @@ -6048,7 +6058,7 @@ namespace Mono.CSharp public class ArrayInitializer : Expression { List elements; - BlockVariableDeclaration variable; + BlockVariable variable; public ArrayInitializer (List init, Location loc) { @@ -6084,7 +6094,7 @@ namespace Mono.CSharp } } - public BlockVariableDeclaration VariableDeclaration { + public BlockVariable VariableDeclaration { get { return variable; } @@ -7823,7 +7833,7 @@ namespace Mono.CSharp if (!ec.IsUnsafe) { ec.Report.Error (233, loc, "`{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf)", - TypeManager.CSharpName (type_queried)); + type_queried.GetSignatureForError ()); } type = ec.BuiltinTypes.Int; @@ -7941,13 +7951,6 @@ namespace Mono.CSharp public class MemberAccess : ATypeNameExpression { protected Expression expr; - -#if FULL_AST - public Location DotLocation { - get; - set; - } -#endif public MemberAccess (Expression expr, string id) : base (id, expr.Location) @@ -10139,8 +10142,8 @@ namespace Mono.CSharp ec.Report.Error (1922, loc, "A field or property `{0}' cannot be initialized with a collection " + "object initializer because type `{1}' does not implement `{2}' interface", ec.CurrentInitializerVariable.GetSignatureForError (), - TypeManager.CSharpName (ec.CurrentInitializerVariable.Type), - TypeManager.CSharpName (ec.BuiltinTypes.IEnumerable)); + ec.CurrentInitializerVariable.Type.GetSignatureForError (), + ec.BuiltinTypes.IEnumerable.GetSignatureForError ()); return null; } is_collection_initialization = true; @@ -10174,7 +10177,7 @@ namespace Mono.CSharp if (is_collection_initialization) { if (TypeManager.HasElementType (type)) { ec.Report.Error (1925, loc, "Cannot initialize object of type `{0}' with a collection initializer", - TypeManager.CSharpName (type)); + type.GetSignatureForError ()); } } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/field.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/field.cs index e4dc35e151..3eb550117a 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/field.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/field.cs @@ -42,6 +42,11 @@ namespace Mono.CSharp public Expression Initializer { get; private set; } #endregion + + public virtual FullNamedExpression GetFieldTypeExpression (FieldBase field) + { + return new TypeExpression (field.MemberType, Name.Location); + } } // @@ -407,9 +412,8 @@ namespace Mono.CSharp "`{0}': Fixed size buffers type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double", GetSignatureForError ()); } else if (declarators != null) { - var t = new TypeExpression (MemberType, TypeExpression.Location); foreach (var d in declarators) { - var f = new FixedField (Parent, t, ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes); + var f = new FixedField (Parent, d.GetFieldTypeExpression (this), ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes); f.initializer = d.Initializer; ((ConstInitializer) f.initializer).Name = d.Name.Value; f.Define (); @@ -486,7 +490,7 @@ namespace Mono.CSharp if (buffer_size > int.MaxValue / type_size) { Report.Error (1664, Location, "Fixed size buffer `{0}' of length `{1}' and type `{2}' exceeded 2^31 limit", - GetSignatureForError (), buffer_size.ToString (), TypeManager.CSharpName (MemberType)); + GetSignatureForError (), buffer_size.ToString (), MemberType.GetSignatureForError ()); return; } @@ -645,8 +649,7 @@ namespace Mono.CSharp if (declarators != null) { foreach (var d in declarators) { - var t = new TypeExpression (MemberType, d.Name.Location); - var f = new Field (Parent, t, ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes); + var f = new Field (Parent, d.GetFieldTypeExpression (this), ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes); if (d.Initializer != null) f.initializer = d.Initializer; @@ -668,7 +671,7 @@ namespace Mono.CSharp if ((ModFlags & Modifiers.VOLATILE) != 0) { if (!CanBeVolatile ()) { Report.Error (677, Location, "`{0}': A volatile field cannot be of the type `{1}'", - GetSignatureForError (), TypeManager.CSharpName (MemberType)); + GetSignatureForError (), MemberType.GetSignatureForError ()); } if ((ModFlags & Modifiers.READONLY) != 0) { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs index ceed93d10c..8cd3bf3bf4 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs @@ -318,7 +318,7 @@ namespace Mono.CSharp { if (type.IsSealed || !type.IsClass) { context.Module.Compiler.Report.Error (701, loc, "`{0}' is not a valid constraint. A constraint must be an interface, a non-sealed class or a type parameter", - TypeManager.CSharpName (type)); + type.GetSignatureForError ()); continue; } @@ -495,7 +495,7 @@ namespace Mono.CSharp { // // If partial type parameters constraints are not null and we don't // already have constraints they become our constraints. If we already - // have constraints, we must check that they're the same. + // have constraints, we must check that they're same. // public bool AddPartialConstraints (TypeDefinition part, TypeParameter tp) { @@ -551,15 +551,19 @@ namespace Mono.CSharp { // with SRE (by calling `DefineGenericParameters()' on the TypeBuilder / // MethodBuilder). // - public void Define (GenericTypeParameterBuilder type, TypeSpec declaringType, TypeContainer parent) + public void Create (TypeSpec declaringType, TypeContainer parent) { if (builder != null) throw new InternalErrorException (); // Needed to get compiler reference this.Parent = parent; - this.builder = type; spec.DeclaringType = declaringType; + } + + public void Define (GenericTypeParameterBuilder type) + { + this.builder = type; spec.SetMetaInfo (type); } @@ -1382,6 +1386,9 @@ namespace Mono.CSharp { return ac; } + if (type.Kind == MemberKind.MissingType) + return type; + // // When inflating a nested type, inflate its parent first // in case it's using same type parameters (was inflated within the type) @@ -2185,13 +2192,13 @@ namespace Mono.CSharp { names.AddRange (tparams.names); } - public void Define (GenericTypeParameterBuilder[] buiders, TypeSpec declaringType, int parentOffset, TypeContainer parent) + public void Create (TypeSpec declaringType, int parentOffset, TypeContainer parent) { types = new TypeParameterSpec[Count]; for (int i = 0; i < types.Length; ++i) { var tp = names[i]; - tp.Define (buiders[i + parentOffset], declaringType, parent); + tp.Create (declaringType, parent); types[i] = tp.Type; types[i].DeclaredPosition = i + parentOffset; @@ -2201,6 +2208,14 @@ namespace Mono.CSharp { } } + public void Define (GenericTypeParameterBuilder[] builders) + { + for (int i = 0; i < types.Length; ++i) { + var tp = names[i]; + tp.Define (builders [types [i].DeclaredPosition]); + } + } + public TypeParameter this[int index] { get { return names [index]; @@ -2240,6 +2255,44 @@ namespace Mono.CSharp { return sb.ToString (); } + + public void CheckPartialConstraints (Method part) + { + var partTypeParameters = part.CurrentTypeParameters; + + for (int i = 0; i < Count; i++) { + var tp_a = names[i]; + var tp_b = partTypeParameters [i]; + if (tp_a.Constraints == null) { + if (tp_b.Constraints == null) + continue; + } else if (tp_b.Constraints != null && tp_a.Type.HasSameConstraintsDefinition (tp_b.Type)) { + continue; + } + + part.Compiler.Report.SymbolRelatedToPreviousError (this[i].CurrentMemberDefinition.Location, ""); + part.Compiler.Report.Error (761, part.Location, + "Partial method declarations of `{0}' have inconsistent constraints for type parameter `{1}'", + part.GetSignatureForError (), partTypeParameters[i].GetSignatureForError ()); + } + } + + public void UpdateConstraints (TypeDefinition part) + { + var partTypeParameters = part.MemberName.TypeParameters; + + for (int i = 0; i < Count; i++) { + var tp = names [i]; + if (tp.AddPartialConstraints (part, partTypeParameters [i])) + continue; + + part.Compiler.Report.SymbolRelatedToPreviousError (this[i].CurrentMemberDefinition); + part.Compiler.Report.Error (265, part.Location, + "Partial declarations of `{0}' have inconsistent constraints for type parameter `{1}'", + part.GetSignatureForError (), tp.GetSignatureForError ()); + } + } + public void VerifyClsCompliance () { foreach (var tp in names) { @@ -2270,7 +2323,7 @@ namespace Mono.CSharp { public override string GetSignatureForError () { - return TypeManager.CSharpName (type); + return type.GetSignatureForError (); } public override TypeSpec ResolveAsType (IMemberContext mc) @@ -2418,7 +2471,7 @@ namespace Mono.CSharp { if (mc != null) { mc.Module.Compiler.Report.Error (452, loc, "The type `{0}' must be a reference type in order to use it as type parameter `{1}' in the generic type or method `{2}'", - TypeManager.CSharpName (atype), tparam.GetSignatureForError (), context.GetSignatureForError ()); + atype.GetSignatureForError (), tparam.GetSignatureForError (), context.GetSignatureForError ()); } return false; @@ -2428,7 +2481,7 @@ namespace Mono.CSharp { if (mc != null) { mc.Module.Compiler.Report.Error (453, loc, "The type `{0}' must be a non-nullable value type in order to use it as type parameter `{1}' in the generic type or method `{2}'", - TypeManager.CSharpName (atype), tparam.GetSignatureForError (), context.GetSignatureForError ()); + atype.GetSignatureForError (), tparam.GetSignatureForError (), context.GetSignatureForError ()); } return false; @@ -2489,7 +2542,7 @@ namespace Mono.CSharp { mc.Module.Compiler.Report.SymbolRelatedToPreviousError (atype); mc.Module.Compiler.Report.Error (310, loc, "The type `{0}' must have a public parameterless constructor in order to use it as parameter `{1}' in the generic type or method `{2}'", - TypeManager.CSharpName (atype), tparam.GetSignatureForError (), context.GetSignatureForError ()); + atype.GetSignatureForError (), tparam.GetSignatureForError (), context.GetSignatureForError ()); } return false; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs index ce43902012..35d32c1d11 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs @@ -420,7 +420,7 @@ namespace Mono.CSharp } } - IMemberDefinition definition; + IMethodDefinition definition; if (tparams != null) { var gmd = new ImportedGenericMethodDefinition ((MethodInfo) mb, returnType, parameters, tparams, this); foreach (var tp in gmd.TypeParameters) { @@ -429,10 +429,10 @@ namespace Mono.CSharp definition = gmd; } else { - definition = new ImportedParameterMemberDefinition (mb, returnType, parameters, this); + definition = new ImportedMethodDefinition (mb, returnType, parameters, this); } - MethodSpec ms = new MethodSpec (kind, declaringType, definition, returnType, mb, parameters, mod); + MethodSpec ms = new MethodSpec (kind, declaringType, definition, returnType, parameters, mod); if (tparams != null) ms.IsGeneric = true; @@ -1683,7 +1683,7 @@ namespace Mono.CSharp { readonly AParametersCollection parameters; - public ImportedParameterMemberDefinition (MethodBase provider, TypeSpec type, AParametersCollection parameters, MetadataImporter importer) + protected ImportedParameterMemberDefinition (MethodBase provider, TypeSpec type, AParametersCollection parameters, MetadataImporter importer) : base (provider, type, importer) { this.parameters = parameters; @@ -1706,7 +1706,21 @@ namespace Mono.CSharp #endregion } - class ImportedGenericMethodDefinition : ImportedParameterMemberDefinition, IGenericMethodDefinition + class ImportedMethodDefinition : ImportedParameterMemberDefinition, IMethodDefinition + { + public ImportedMethodDefinition (MethodBase provider, TypeSpec type, AParametersCollection parameters, MetadataImporter importer) + : base (provider, type, parameters, importer) + { + } + + MethodBase IMethodDefinition.Metadata { + get { + return (MethodBase) provider; + } + } + } + + class ImportedGenericMethodDefinition : ImportedMethodDefinition, IGenericMethodDefinition { readonly TypeParameterSpec[] tparams; @@ -1877,33 +1891,36 @@ namespace Mono.CSharp // or referenced from the user core in which case compilation error has to // be reported because compiler cannot continue anyway // + + var report = ctx.Module.Compiler.Report; + for (int i = 0; i < types.Count; ++i) { var t = types [i]; // - // Report missing types only once per type + // Report missing types only once // - if (i > 0 && types.IndexOf (t) < i) + if (report.Printer.MissingTypeReported (t.MemberDefinition)) continue; string name = t.GetSignatureForError (); if (t.MemberDefinition.DeclaringAssembly == ctx.Module.DeclaringAssembly) { - ctx.Module.Compiler.Report.Error (1683, loc, + report.Error (1683, loc, "Reference to type `{0}' claims it is defined in this assembly, but it is not defined in source or any added modules", name); } else if (t.MemberDefinition.DeclaringAssembly.IsMissing) { if (t.MemberDefinition.IsTypeForwarder) { - ctx.Module.Compiler.Report.Error (1070, loc, + report.Error (1070, loc, "The type `{0}' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `{1}'", name, t.MemberDefinition.DeclaringAssembly.FullName); } else { - ctx.Module.Compiler.Report.Error (12, loc, + report.Error (12, loc, "The type `{0}' is defined in an assembly that is not referenced. Consider adding a reference to assembly `{1}'", name, t.MemberDefinition.DeclaringAssembly.FullName); } } else { - ctx.Module.Compiler.Report.Error (1684, loc, + report.Error (1684, loc, "Reference to type `{0}' claims it is defined assembly `{1}', but it could not be found", name, t.MemberDefinition.DeclaringAssembly.FullName); } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/iterators.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/iterators.cs index 4bd5f75600..6953f6c106 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/iterators.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/iterators.cs @@ -245,7 +245,7 @@ namespace Mono.CSharp for (int i = 0; i < host.hoisted_params.Count; ++i) { HoistedParameter hp = host.hoisted_params [i]; - HoistedParameter hp_cp = host.hoisted_params_copy [i]; + HoistedParameter hp_cp = host.hoisted_params_copy [i] ?? hp; FieldExpr from = new FieldExpr (hp_cp.Field, loc); from.InstanceExpression = new CompilerGeneratedThis (ec.CurrentType, loc); @@ -431,6 +431,13 @@ namespace Mono.CSharp get { return hoisted_params; } } + protected override Constructor DefineDefaultConstructor (bool is_static) + { + var ctor = base.DefineDefaultConstructor (is_static); + ctor.ModFlags |= Modifiers.DEBUGGER_HIDDEN; + return ctor; + } + protected override TypeSpec[] ResolveBaseTypes (out FullNamedExpression base_class) { var mtype = Iterator.OriginalIteratorType; @@ -469,17 +476,26 @@ namespace Mono.CSharp current_field = AddCompilerGeneratedField ("$current", iterator_type_expr); disposing_field = AddCompilerGeneratedField ("$disposing", new TypeExpression (Compiler.BuiltinTypes.Bool, Location)); - if (hoisted_params != null) { + if (Iterator.IsEnumerable && hoisted_params != null) { // // Iterators are independent, each GetEnumerator call has to // create same enumerator therefore we have to keep original values // around for re-initialization // - // TODO: Do it for assigned/modified parameters only - // hoisted_params_copy = new List (hoisted_params.Count); foreach (HoistedParameter hp in hoisted_params) { - hoisted_params_copy.Add (new HoistedParameter (hp, "<$>" + hp.Field.Name)); + + // + // Don't create field copy for unmodified captured parameters + // + HoistedParameter hp_copy; + if (hp.IsAssigned) { + hp_copy = new HoistedParameter (hp, "<$>" + hp.Field.Name); + } else { + hp_copy = null; + } + + hoisted_params_copy.Add (hp_copy); } } @@ -565,7 +581,8 @@ namespace Mono.CSharp protected override void EmitHoistedParameters (EmitContext ec, List hoisted) { base.EmitHoistedParameters (ec, hoisted); - base.EmitHoistedParameters (ec, hoisted_params_copy); + if (hoisted_params_copy != null) + base.EmitHoistedParameters (ec, hoisted_params_copy); } } @@ -1101,7 +1118,7 @@ namespace Mono.CSharp "The body of `{0}' cannot be an iterator block " + "because `{1}' is not an iterator interface type", method.GetSignatureForError (), - TypeManager.CSharpName (ret)); + ret.GetSignatureForError ()); return; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/linq.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/linq.cs index 1c93d6046f..b52d8a8419 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/linq.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/linq.cs @@ -135,7 +135,7 @@ namespace Mono.CSharp.Linq if (!Convert.ImplicitConversionExists (rc, a.Expr, source_type)) { rc.Report.Error (1936, loc, "An implementation of `{0}' query expression pattern for source type `{1}' could not be found", - best.Name, TypeManager.CSharpName (a.Type)); + best.Name, a.Type.GetSignatureForError ()); return true; } } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/literal.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/literal.cs index bdbd57a4f7..1af2d0c9e3 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/literal.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/literal.cs @@ -61,7 +61,7 @@ namespace Mono.CSharp if (TypeSpec.IsValueType (t)) { ec.Report.Error(37, loc, "Cannot convert null to `{0}' because it is a value type", - TypeManager.CSharpName(t)); + t.GetSignatureForError ()); return; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs index cad910e01b..5da68dc735 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs @@ -795,13 +795,14 @@ 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 | Modifiers.OVERRIDE)) != Modifiers.ABSTRACT) + if ((name_entry.Modifiers & Modifiers.ABSTRACT) == 0) continue; - if (name_entry.Kind != MemberKind.Method) + var ms = name_entry as MethodSpec; + if (ms == null) continue; - abstract_methods.Add ((MethodSpec) name_entry); + abstract_methods.Add (ms); } } @@ -1445,9 +1446,12 @@ namespace Mono.CSharp { "A partial method declaration and partial method implementation must be both `static' or neither"); } - Report.SymbolRelatedToPreviousError (ce); - Report.Error (764, member.Location, - "A partial method declaration and partial method implementation must be both `unsafe' or neither"); + if ((method_a.ModFlags & Modifiers.UNSAFE) != (method_b.ModFlags & Modifiers.UNSAFE)) { + Report.SymbolRelatedToPreviousError (ce); + Report.Error (764, member.Location, + "A partial method declaration and partial method implementation must be both `unsafe' or neither"); + } + return false; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs index 243bee2d49..0c91b2353d 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs @@ -188,7 +188,7 @@ namespace Mono.CSharp { } } - public interface IGenericMethodDefinition : IMemberDefinition + public interface IGenericMethodDefinition : IMethodDefinition { TypeParameterSpec[] TypeParameters { get; } int TypeParametersCount { get; } @@ -198,18 +198,17 @@ namespace Mono.CSharp { public sealed class MethodSpec : MemberSpec, IParametersMember { - MethodBase metaInfo, inflatedMetaInfo; + MethodBase inflatedMetaInfo; AParametersCollection parameters; TypeSpec returnType; TypeSpec[] targs; TypeParameterSpec[] constraints; - public MethodSpec (MemberKind kind, TypeSpec declaringType, IMemberDefinition details, TypeSpec returnType, - MethodBase info, AParametersCollection parameters, Modifiers modifiers) + public MethodSpec (MemberKind kind, TypeSpec declaringType, IMethodDefinition details, TypeSpec returnType, + AParametersCollection parameters, Modifiers modifiers) : base (kind, declaringType, details, modifiers) { - this.metaInfo = info; this.parameters = parameters; this.returnType = returnType; } @@ -237,6 +236,12 @@ namespace Mono.CSharp { } } + public new IMethodDefinition MemberDefinition { + get { + return (IMethodDefinition) definition; + } + } + public IGenericMethodDefinition GenericDefinition { get { return (IGenericMethodDefinition) definition; @@ -322,21 +327,21 @@ namespace Mono.CSharp { if (DeclaringType.IsTypeBuilder) { if (IsConstructor) - inflatedMetaInfo = TypeBuilder.GetConstructor (dt_meta, (ConstructorInfo) metaInfo); + inflatedMetaInfo = TypeBuilder.GetConstructor (dt_meta, (ConstructorInfo) MemberDefinition.Metadata); else - inflatedMetaInfo = TypeBuilder.GetMethod (dt_meta, (MethodInfo) metaInfo); + inflatedMetaInfo = TypeBuilder.GetMethod (dt_meta, (MethodInfo) MemberDefinition.Metadata); } else { #if STATIC // it should not be reached throw new NotImplementedException (); #else - inflatedMetaInfo = MethodInfo.GetMethodFromHandle (metaInfo.MethodHandle, dt_meta.TypeHandle); + inflatedMetaInfo = MethodInfo.GetMethodFromHandle (MemberDefinition.Metadata.MethodHandle, dt_meta.TypeHandle); #endif } state &= ~StateFlags.PendingMetaInflate; } else { - inflatedMetaInfo = metaInfo; + inflatedMetaInfo = MemberDefinition.Metadata; } } @@ -518,19 +523,10 @@ namespace Mono.CSharp { return missing; } - - public void SetMetaInfo (MethodInfo info) - { - if (this.metaInfo != null) - throw new InternalErrorException ("MetaInfo reset"); - - this.metaInfo = info; - } } - public abstract class MethodOrOperator : MethodCore, IMethodData + public abstract class MethodOrOperator : MethodCore, IMethodData, IMethodDefinition { - public MethodBuilder MethodBuilder; ReturnParameter return_attributes; SecurityType declarative_security; protected MethodData MethodData; @@ -583,6 +579,19 @@ namespace Mono.CSharp { } } + MethodBase IMethodDefinition.Metadata { + get { + return MethodData.MethodBuilder; + } + } + + // TODO: Remove and use MethodData abstraction + public MethodBuilder MethodBuilder { + get { + return MethodData.MethodBuilder; + } + } + protected override bool CheckForDuplications () { return Parent.MemberCache.CheckExistingMembersOverloads (this, parameters); @@ -609,41 +618,34 @@ namespace Mono.CSharp { else kind = MemberKind.Method; + string explicit_name; + if (IsPartialDefinition) { caching_flags &= ~Flags.Excluded_Undetected; caching_flags |= Flags.Excluded; // Add to member cache only when a partial method implementation has not been found yet - if ((caching_flags & Flags.PartialDefinitionExists) == 0) { -// MethodBase mb = new PartialMethodDefinitionInfo (this); + if ((caching_flags & Flags.PartialDefinitionExists) != 0) + return true; - spec = new MethodSpec (kind, Parent.Definition, this, ReturnType, null, parameters, ModFlags); - if (MemberName.Arity > 0) { - spec.IsGeneric = true; + if (IsExplicitImpl) + return true; - // TODO: Have to move DefineMethod after Define (ideally to Emit) - throw new NotImplementedException ("Generic partial methods"); - } + explicit_name = null; + } else { + MethodData = new MethodData (this, ModFlags, flags, this, base_method); - Parent.MemberCache.AddMember (spec); - } + if (!MethodData.Define (Parent.PartialContainer, GetFullName (MemberName))) + return false; - return true; + explicit_name = MethodData.MetadataName; } - MethodData = new MethodData ( - this, ModFlags, flags, this, MethodBuilder, base_method); - - if (!MethodData.Define (Parent.PartialContainer, GetFullName (MemberName))) - return false; - - MethodBuilder = MethodData.MethodBuilder; - - spec = new MethodSpec (kind, Parent.Definition, this, ReturnType, MethodBuilder, parameters, ModFlags); + spec = new MethodSpec (kind, Parent.Definition, this, ReturnType, parameters, ModFlags); if (MemberName.Arity > 0) spec.IsGeneric = true; - - Parent.MemberCache.AddMember (this, MethodBuilder.Name, spec); + + Parent.MemberCache.AddMember (this, explicit_name, spec); return true; } @@ -713,7 +715,8 @@ namespace Mono.CSharp { if (MethodData != null) MethodData.Emit (Parent); - Block = null; + if ((ModFlags & Modifiers.PARTIAL) == 0) + Block = null; } protected void Error_ConditionalAttributeIsNotValid () @@ -798,9 +801,36 @@ namespace Mono.CSharp { #endregion + public virtual void PrepareEmit () + { + var mb = MethodData.DefineMethodBuilder (Parent); + + if (CurrentTypeParameters != null) { + string[] gnames = new string[CurrentTypeParameters.Count]; + for (int i = 0; i < gnames.Length; ++i) { + gnames[i] = CurrentTypeParameters[i].Name; + } + + var gen_params = MethodBuilder.DefineGenericParameters (gnames); + + for (int i = 0; i < CurrentTypeParameters.Count; ++i) { + var tp = CurrentTypeParameters[i]; + + tp.Define (gen_params[i]); + } + } + + // + // Generic method has been already defined to resolve method parameters + // correctly when they use type parameters + // + mb.SetParameters (parameters.GetMetaInfo ()); + mb.SetReturnType (ReturnType.GetMetaInfo ()); + } + public override void WriteDebugSymbol (MonoSymbolFile file) { - if (MethodData != null) + if (MethodData != null && !IsPartialDefinition) MethodData.WriteDebugSymbol (file); } } @@ -844,7 +874,7 @@ namespace Mono.CSharp { } } -#endregion + #endregion public override void Accept (StructuralVisitor visitor) { @@ -972,10 +1002,9 @@ namespace Mono.CSharp { void CreateTypeParameters () { var tparams = MemberName.TypeParameters; - string[] snames = new string[MemberName.Arity]; var parent_tparams = Parent.TypeParametersAll; - for (int i = 0; i < snames.Length; i++) { + for (int i = 0; i < MemberName.Arity; i++) { string type_argument_name = tparams[i].MemberName.Name; if (block == null) { @@ -1000,12 +1029,9 @@ namespace Mono.CSharp { tparams[i].WarningParentNameConflict (tp); } } - - snames[i] = type_argument_name; } - GenericTypeParameterBuilder[] gen_params = MethodBuilder.DefineGenericParameters (snames); - tparams.Define (gen_params, null, 0, Parent); + tparams.Create (null, 0, Parent); } protected virtual void DefineTypeParameters () @@ -1171,9 +1197,6 @@ namespace Mono.CSharp { "Introducing `Finalize' method can interfere with destructor invocation. Did you intend to declare a destructor?"); } - if (partialMethodImplementation != null && IsPartialDefinition) - MethodBuilder = partialMethodImplementation.MethodBuilder; - if (Compiler.Settings.StdLib && ReturnType.IsSpecialRuntimeType) { Error1599 (Location, ReturnType, Report); return false; @@ -1208,7 +1231,7 @@ namespace Mono.CSharp { Report.Error (1983, Location, "The return type of an async method must be void, Task, or Task"); } - block = (ToplevelBlock) block.ConvertToAsyncTask (this, Parent.PartialContainer, parameters, ReturnType, Location); + block = (ToplevelBlock) block.ConvertToAsyncTask (this, Parent.PartialContainer, parameters, ReturnType, null, Location); ModFlags |= Modifiers.DEBUGGER_HIDDEN; } @@ -1272,6 +1295,22 @@ namespace Mono.CSharp { return true; } + public override void PrepareEmit () + { + if (IsPartialDefinition) { + // + // Use partial method implementation builder for partial method declaration attributes + // + if (partialMethodImplementation != null) { + MethodData = partialMethodImplementation.MethodData; + } + + return; + } + + base.PrepareEmit (); + } + // // Emits the code // @@ -1279,11 +1318,8 @@ namespace Mono.CSharp { { try { if (IsPartialDefinition) { - // - // Use partial method implementation builder for partial method declaration attributes - // - if (partialMethodImplementation != null) { - MethodBuilder = partialMethodImplementation.MethodBuilder; + if (partialMethodImplementation != null && CurrentTypeParameters != null) { + CurrentTypeParameters.CheckPartialConstraints (partialMethodImplementation); } return; @@ -1297,6 +1333,7 @@ namespace Mono.CSharp { if (CurrentTypeParameters != null) { for (int i = 0; i < CurrentTypeParameters.Count; ++i) { var tp = CurrentTypeParameters [i]; + tp.CheckGenericConstraints (false); tp.Emit (); } @@ -1312,10 +1349,8 @@ namespace Mono.CSharp { Module.PredefinedAttributes.Extension.EmitAttribute (MethodBuilder); base.Emit (); - } catch { - Console.WriteLine ("Internal compiler error at {0}: exception caught while emitting {1}", - Location, MethodBuilder); - throw; + } catch (Exception e) { + throw new InternalErrorException (this, e); } } @@ -1329,13 +1364,12 @@ namespace Mono.CSharp { public static void Error1599 (Location loc, TypeSpec t, Report Report) { - Report.Error (1599, loc, "Method or delegate cannot return type `{0}'", TypeManager.CSharpName (t)); + Report.Error (1599, loc, "Method or delegate cannot return type `{0}'", t.GetSignatureForError ()); } protected override bool ResolveMemberType () { if (CurrentTypeParameters != null) { - MethodBuilder = Parent.TypeBuilder.DefineMethod (GetFullName (MemberName), flags); CreateTypeParameters (); } @@ -1485,7 +1519,7 @@ namespace Mono.CSharp { } } - public class Constructor : MethodCore, IMethodData + public class Constructor : MethodCore, IMethodData, IMethodDefinition { public ConstructorBuilder ConstructorBuilder; public ConstructorInitializer Initializer; @@ -1533,6 +1567,13 @@ namespace Mono.CSharp { } } + + MethodBase IMethodDefinition.Metadata { + get { + return ConstructorBuilder; + } + } + // // Returns true if this is a default constructor // @@ -1620,7 +1661,7 @@ namespace Mono.CSharp { ca, CallingConventions, parameters.GetMetaInfo ()); - spec = new MethodSpec (MemberKind.Constructor, Parent.Definition, this, Compiler.BuiltinTypes.Void, ConstructorBuilder, parameters, ModFlags); + spec = new MethodSpec (MemberKind.Constructor, Parent.Definition, this, Compiler.BuiltinTypes.Void, parameters, ModFlags); Parent.MemberCache.AddMember (spec); @@ -1828,10 +1869,6 @@ namespace Mono.CSharp { // public class MethodData { -#if !STATIC - static FieldInfo methodbuilder_attrs_field; -#endif - public readonly IMethodData method; // @@ -1848,6 +1885,7 @@ namespace Mono.CSharp { protected TypeSpec declaring_type; protected MethodSpec parent_method; SourceMethodBuilder debug_builder; + string full_name; MethodBuilder builder; public MethodBuilder MethodBuilder { @@ -1862,6 +1900,12 @@ namespace Mono.CSharp { } } + public string MetadataName { + get { + return full_name; + } + } + public MethodData (InterfaceMemberBase member, Modifiers modifiers, MethodAttributes flags, IMethodData method) { @@ -1874,11 +1918,10 @@ namespace Mono.CSharp { public MethodData (InterfaceMemberBase member, Modifiers modifiers, MethodAttributes flags, - IMethodData method, MethodBuilder builder, + IMethodData method, MethodSpec parent_method) : this (member, modifiers, flags, method) { - this.builder = builder; this.parent_method = parent_method; } @@ -1896,13 +1939,13 @@ namespace Mono.CSharp { if (member is PropertyBase) { container.Compiler.Report.Error (550, method.Location, "`{0}' is an accessor not found in interface member `{1}{2}'", - method.GetSignatureForError (), TypeManager.CSharpName (member.InterfaceType), + method.GetSignatureForError (), member.InterfaceType.GetSignatureForError (), member.GetSignatureForError ().Substring (member.GetSignatureForError ().LastIndexOf ('.'))); } else { container.Compiler.Report.Error (539, method.Location, "`{0}.{1}' in explicit interface declaration is not a member of interface", - TypeManager.CSharpName (member.InterfaceType), member.ShortName); + member.InterfaceType.GetSignatureForError (), member.ShortName); } return false; } @@ -1910,7 +1953,7 @@ namespace Mono.CSharp { container.Compiler.Report.SymbolRelatedToPreviousError (implementing); container.Compiler.Report.Error (683, method.Location, "`{0}' explicit method implementation cannot implement `{1}' because it is an accessor", - member.GetSignatureForError (), TypeManager.CSharpSignature (implementing)); + member.GetSignatureForError (), implementing.GetSignatureForError ()); return false; } } else { @@ -2033,58 +2076,45 @@ namespace Mono.CSharp { method_full_name = implementing.MemberDefinition.Name; } - DefineMethodBuilder (container, method_full_name, method.ParameterInfo); + full_name = method_full_name; + declaring_type = container.Definition; - if (builder == null) - return false; + return true; + } -// if (container.CurrentType != null) -// declaring_type = container.CurrentType; -// else - declaring_type = container.Definition; + void DefineOverride (TypeDefinition container) + { + if (implementing == null) + return; - if (implementing != null && member.IsExplicitImpl) { - container.TypeBuilder.DefineMethodOverride (builder, (MethodInfo) implementing.GetMetaInfo ()); - } + if (!member.IsExplicitImpl) + return; - return true; + container.TypeBuilder.DefineMethodOverride (builder, (MethodInfo) implementing.GetMetaInfo ()); } - - /// - /// Create the MethodBuilder for the method - /// - void DefineMethodBuilder (TypeDefinition container, string method_name, ParametersCompiled param) + // + // Creates partial MethodBuilder for the method when has generic parameters used + // as arguments or return type + // + public MethodBuilder DefineMethodBuilder (TypeDefinition container) { - var return_type = method.ReturnType.GetMetaInfo (); - var p_types = param.GetMetaInfo (); + if (builder != null) + throw new InternalErrorException (); - if (builder == null) { - builder = container.TypeBuilder.DefineMethod ( - method_name, flags, method.CallingConventions, - return_type, p_types); - return; - } + builder = container.TypeBuilder.DefineMethod (full_name, flags, method.CallingConventions); + return builder; + } - // - // Generic method has been already defined to resolve method parameters - // correctly when they use type parameters - // - builder.SetParameters (p_types); - builder.SetReturnType (return_type); - if (builder.Attributes != flags) { -#if STATIC - builder.__SetAttributes (flags); -#else - try { - if (methodbuilder_attrs_field == null) - methodbuilder_attrs_field = typeof (MethodBuilder).GetField ("attrs", BindingFlags.NonPublic | BindingFlags.Instance); - methodbuilder_attrs_field.SetValue (builder, flags); - } catch { - container.Compiler.Report.RuntimeMissingSupport (method.Location, "Generic method MethodAttributes"); - } -#endif - } + // + // Creates full MethodBuilder for the method + // + public MethodBuilder DefineMethodBuilder (TypeDefinition container, ParametersCompiled param) + { + DefineMethodBuilder (container); + builder.SetReturnType (method.ReturnType.GetMetaInfo ()); + builder.SetParameters (param.GetMetaInfo ()); + return builder; } // @@ -2092,6 +2122,8 @@ namespace Mono.CSharp { // public void Emit (TypeDefinition parent) { + DefineOverride (parent); + var mc = (IMemberContext) method; method.ParameterInfo.ApplyAttributes (mc, MethodBuilder); @@ -2231,7 +2263,7 @@ namespace Mono.CSharp { // Ooouh Martin, templates are missing here. // When it will be possible move here a lot of child code and template method type. - public abstract class AbstractPropertyEventMethod : MemberCore, IMethodData { + public abstract class AbstractPropertyEventMethod : MemberCore, IMethodData, IMethodDefinition { protected MethodData method_data; protected ToplevelBlock block; protected SecurityType declarative_security; @@ -2297,6 +2329,12 @@ namespace Mono.CSharp { } } + MethodBase IMethodDefinition.Metadata { + get { + return method_data.MethodBuilder; + } + } + public abstract ParametersCompiled ParameterInfo { get ; } public abstract TypeSpec ReturnType { get; } @@ -2307,7 +2345,7 @@ namespace Mono.CSharp { if (a.Type == pa.CLSCompliant || a.Type == pa.Obsolete || a.Type == pa.Conditional) { Report.Error (1667, a.Location, "Attribute `{0}' is not valid on property or event accessors. It is valid on `{1}' declarations only", - TypeManager.CSharpName (a.Type), a.GetValidTargets ()); + a.Type.GetSignatureForError (), a.GetValidTargets ()); return; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/modifiers.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/modifiers.cs index 3edbed6ba8..f842410c7f 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/modifiers.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/modifiers.cs @@ -262,7 +262,7 @@ namespace Mono.CSharp return mod; } - for (i = 1; i <= (int) Modifiers.TOP; i <<= 1) { + for (i = 1; i < (int) Modifiers.TOP; i <<= 1) { if ((i & invalid_flags) == 0) continue; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs index f9a60fa93b..68a39acb2b 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs @@ -276,16 +276,7 @@ namespace Mono.CSharp { public Namespace AddNamespace (MemberName name) { - Namespace ns_parent; - if (name.Left != null) { - if (parent != null) - ns_parent = parent.AddNamespace (name.Left); - else - ns_parent = AddNamespace (name.Left); - } else { - ns_parent = this; - } - + var ns_parent = name.Left == null ? this : AddNamespace (name.Left); return ns_parent.TryAddNamespace (name.Basename); } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs index 788bbfbeb8..badf5e1a73 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs @@ -320,7 +320,7 @@ namespace Mono.CSharp.Nullable public static Constant CreateFromExpression (ResolveContext ec, Expression e) { ec.Report.Warning (458, 2, e.Location, "The result of the expression is always `null' of type `{0}'", - TypeManager.CSharpName (e.Type)); + e.Type.GetSignatureForError ()); return ReducedExpression.Create (Create (e.Type, e.Location), e); } @@ -592,10 +592,10 @@ namespace Mono.CSharp.Nullable if ((Oper & Operator.EqualityMask) != 0) { ec.Report.Warning (472, 2, loc, "The result of comparing value type `{0}' with null is always `{1}'", - TypeManager.CSharpName (expr.Type), c.GetValueAsLiteral ()); + expr.Type.GetSignatureForError (), c.GetValueAsLiteral ()); } else { ec.Report.Warning (464, 2, loc, "The result of comparing type `{0}' with null is always `{1}'", - TypeManager.CSharpName (expr.Type), c.GetValueAsLiteral ()); + expr.Type.GetSignatureForError (), c.GetValueAsLiteral ()); } return ReducedExpression.Create (c, this); diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/parameter.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/parameter.cs index 32053889fd..69ae1cf839 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/parameter.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/parameter.cs @@ -338,7 +338,7 @@ namespace Mono.CSharp { if (HasOptionalExpression) { a.Report.Error (1745, a.Location, "Cannot specify `{0}' attribute on optional parameter `{1}'", - TypeManager.CSharpName (a.Type).Replace ("Attribute", ""), Name); + a.Type.GetSignatureForError ().Replace ("Attribute", ""), Name); } if (a.Type == pa.DefaultParameterValue) @@ -406,7 +406,7 @@ namespace Mono.CSharp { if ((modFlags & Modifier.This) != 0 && (parameter_type.IsPointer || parameter_type.BuiltinType == BuiltinTypeSpec.Type.Dynamic)) { rc.Module.Compiler.Report.Error (1103, Location, "The extension method cannot be of type `{0}'", - TypeManager.CSharpName (parameter_type)); + parameter_type.GetSignatureForError ()); } return parameter_type; @@ -582,7 +582,7 @@ namespace Mono.CSharp { { string type_name; if (parameter_type != null) - type_name = TypeManager.CSharpName (parameter_type); + type_name = parameter_type.GetSignatureForError (); else type_name = texpr.GetSignatureForError (); @@ -989,7 +989,7 @@ namespace Mono.CSharp { if (types == null || types [pos] == null) return ((Parameter)FixedParameters [pos]).GetSignatureForError (); - string type = TypeManager.CSharpName (types [pos]); + string type = types [pos].GetSignatureForError (); if (FixedParameters [pos].HasExtensionMethodModifier) return "this " + type; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/pending.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/pending.cs index ab8650cd09..af15bf6e1c 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/pending.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/pending.cs @@ -534,10 +534,14 @@ namespace Mono.CSharp { // about mismatch at return type when the check bellow rejects them // var parameters = mi.Parameters; + MethodSpec close_match = null; + while (true) { var candidates = MemberCache.FindMembers (base_type, mi.Name, false); - if (candidates == null) + if (candidates == null) { + base_method = close_match; return false; + } MethodSpec similar_candidate = null; foreach (var candidate in candidates) { @@ -590,19 +594,29 @@ namespace Mono.CSharp { // From this point the candidate is used for detailed error reporting // because it's very close match to what we are looking for // - base_method = (MethodSpec) candidate; + var m = (MethodSpec) candidate; + + if (!m.IsPublic) { + if (close_match == null) + close_match = m; - if (!candidate.IsPublic) - return false; + continue; + } - if (!TypeSpecComparer.Override.IsEqual (mi.ReturnType, base_method.ReturnType)) - return false; + if (!TypeSpecComparer.Override.IsEqual (mi.ReturnType, m.ReturnType)) { + if (close_match == null) + close_match = m; - if (mi.IsGeneric && !Method.CheckImplementingMethodConstraints (container, base_method, mi)) { + continue; + } + + base_method = m; + + if (mi.IsGeneric && !Method.CheckImplementingMethodConstraints (container, m, mi)) { return true; } } - + if (base_method != null) { if (similar_candidate != null) { Report.SymbolRelatedToPreviousError (similar_candidate); @@ -617,8 +631,10 @@ namespace Mono.CSharp { } base_type = candidates[0].DeclaringType.BaseType; - if (base_type == null) + if (base_type == null) { + base_method = close_match; return false; + } } if (!base_method.IsVirtual) { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/property.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/property.cs index 067c0c5f2d..6172fa8c86 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/property.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/property.cs @@ -201,14 +201,14 @@ namespace Mono.CSharp { base.Define (parent); - Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, null, ParameterInfo, ModFlags); + Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, ParameterInfo, ModFlags); method_data = new MethodData (method, ModFlags, flags, this); if (!method_data.Define (parent.PartialContainer, method.GetFullName (MemberName))) return null; - Spec.SetMetaInfo (method_data.MethodBuilder); + method_data.DefineMethodBuilder (parent.PartialContainer, ParameterInfo); return method_data.MethodBuilder; } @@ -268,14 +268,14 @@ namespace Mono.CSharp base.Define (parent); - Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, null, ParameterInfo, ModFlags); + Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, ParameterInfo, ModFlags); method_data = new MethodData (method, ModFlags, flags, this); if (!method_data.Define (parent.PartialContainer, method.GetFullName (MemberName))) return null; - Spec.SetMetaInfo (method_data.MethodBuilder); + method_data.DefineMethodBuilder (parent.PartialContainer, ParameterInfo); return method_data.MethodBuilder; } @@ -1198,15 +1198,15 @@ namespace Mono.CSharp if (!method_data.Define (parent.PartialContainer, method.GetFullName (MemberName))) return null; + method_data.DefineMethodBuilder (parent.PartialContainer, ParameterInfo); + if (Compiler.Settings.WriteMetadataOnly) block = null; - MethodBuilder mb = method_data.MethodBuilder; - - Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, mb, ParameterInfo, method.ModFlags); + Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, ParameterInfo, method.ModFlags); Spec.IsAccessor = true; - return mb; + return method_data.MethodBuilder; } public override TypeSpec ReturnType { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/report.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/report.cs index bfb82fb9f3..f49a2980d7 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/report.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/report.cs @@ -550,6 +550,8 @@ namespace Mono.CSharp { // public abstract class ReportPrinter { + protected HashSet reported_missing_definitions; + #region Properties public int ErrorsCount { get; protected set; } @@ -605,6 +607,22 @@ namespace Mono.CSharp { } } + // + // Tracks reported missing types. It needs to be session specific + // because we can run in probing mode + // + public bool MissingTypeReported (ITypeDefinition typeDefinition) + { + if (reported_missing_definitions == null) + reported_missing_definitions = new HashSet (); + + if (reported_missing_definitions.Contains (typeDefinition)) + return true; + + reported_missing_definitions.Add (typeDefinition); + return false; + } + public void Reset () { // HACK: Temporary hack for broken repl flow @@ -735,6 +753,11 @@ namespace Mono.CSharp { error_msg |= !msg.IsWarning; } + if (reported_missing_definitions != null) { + foreach (var missing in reported_missing_definitions) + dest.MissingTypeReported (missing); + } + return error_msg; } } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/settings.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/settings.cs index af8512ae25..fa15cad9be 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/settings.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/settings.cs @@ -350,6 +350,17 @@ namespace Mono.CSharp { public CompilerSettings ParseArguments (string[] args) { CompilerSettings settings = new CompilerSettings (); + if (!ParseArguments (settings, args)) + return null; + + return settings; + } + + public bool ParseArguments (CompilerSettings settings, string[] args) + { + if (settings == null) + throw new ArgumentNullException ("settings"); + List response_file_list = null; bool parsing_options = true; stop_argument = false; @@ -369,7 +380,7 @@ namespace Mono.CSharp { if (response_file_list.Contains (response_file)) { report.Error (1515, "Response file `{0}' specified multiple times", response_file); - return null; + return false; } response_file_list.Add (response_file); @@ -377,7 +388,7 @@ namespace Mono.CSharp { extra_args = LoadArgs (response_file); if (extra_args == null) { report.Error (2011, "Unable to open response file: " + response_file); - return null; + return false; } args = AddArgs (args, extra_args); @@ -399,7 +410,7 @@ namespace Mono.CSharp { continue; case ParseResult.Stop: stop_argument = true; - return settings; + return true; case ParseResult.UnknownOption: if (UnknownOptionHandler != null) { var ret = UnknownOptionHandler (args, i); @@ -433,11 +444,11 @@ namespace Mono.CSharp { } Error_WrongOption (arg); - return null; + return false; case ParseResult.Stop: stop_argument = true; - return settings; + return true; } } } @@ -445,10 +456,7 @@ namespace Mono.CSharp { ProcessSourceFiles (arg, false, settings.SourceFiles); } - if (report.Errors > 0) - return null; - - return settings; + return report.Errors == 0; } void ProcessSourceFiles (string spec, bool recurse, List sourceFiles) diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs index e312ece3e1..92d596f854 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs @@ -706,6 +706,7 @@ namespace Mono.CSharp { public StatementErrorExpression (Expression expr) { this.expr = expr; + this.loc = expr.StartLocation; } public Expression Expr { @@ -714,6 +715,12 @@ namespace Mono.CSharp { } } + public override bool Resolve (BlockContext bc) + { + expr.Error_InvalidExpressionStatement (bc); + return true; + } + protected override void DoEmit (EmitContext ec) { throw new NotSupportedException (); @@ -903,9 +910,18 @@ namespace Mono.CSharp { if (this is ContextualReturn) return true; - ec.Report.Error (1997, loc, - "`{0}': A return keyword must not be followed by an expression when async method returns `Task'. Consider using `Task' return type", - ec.GetSignatureForError ()); + // Same error code as .NET but better error message + if (async_block.DelegateType != null) { + ec.Report.Error (1997, loc, + "`{0}': A return keyword must not be followed by an expression when async delegate returns `Task'. Consider using `Task' return type", + async_block.DelegateType.GetSignatureForError ()); + } else { + ec.Report.Error (1997, loc, + "`{0}': A return keyword must not be followed by an expression when async method returns `Task'. Consider using `Task' return type", + ec.GetSignatureForError ()); + + } + return false; } @@ -1252,7 +1268,7 @@ namespace Mono.CSharp { if (!Convert.ImplicitStandardConversionExists (c, type)) ec.Report.Warning (469, 2, loc, "The `goto case' value is not implicitly convertible to type `{0}'", - TypeManager.CSharpName (type)); + type.GetSignatureForError ()); } @@ -1420,69 +1436,72 @@ namespace Mono.CSharp { Location Location { get; } } - public class BlockVariableDeclaration : Statement + public class BlockVariableDeclarator { - public class Declarator + LocalVariable li; + Expression initializer; + + public BlockVariableDeclarator (LocalVariable li, Expression initializer) { - LocalVariable li; - Expression initializer; + if (li.Type != null) + throw new ArgumentException ("Expected null variable type"); - public Declarator (LocalVariable li, Expression initializer) - { - if (li.Type != null) - throw new ArgumentException ("Expected null variable type"); + this.li = li; + this.initializer = initializer; + } - this.li = li; - this.initializer = initializer; - } + #region Properties - public Declarator (Declarator clone, Expression initializer) - { - this.li = clone.li; - this.initializer = initializer; + public LocalVariable Variable { + get { + return li; } + } - #region Properties - - public LocalVariable Variable { - get { - return li; - } + public Expression Initializer { + get { + return initializer; } - - public Expression Initializer { - get { - return initializer; - } - set { - initializer = value; - } + set { + initializer = value; } + } - #endregion + #endregion + + public virtual BlockVariableDeclarator Clone (CloneContext cloneCtx) + { + var t = (BlockVariableDeclarator) MemberwiseClone (); + if (initializer != null) + t.initializer = initializer.Clone (cloneCtx); + + return t; } + } + public class BlockVariable : Statement + { Expression initializer; protected FullNamedExpression type_expr; protected LocalVariable li; - protected List declarators; + protected List declarators; TypeSpec type; - public BlockVariableDeclaration (FullNamedExpression type, LocalVariable li) + public BlockVariable (FullNamedExpression type, LocalVariable li) { this.type_expr = type; this.li = li; this.loc = type_expr.Location; } - protected BlockVariableDeclaration (LocalVariable li) + protected BlockVariable (LocalVariable li) { this.li = li; } #region Properties - public List Declarators { + public List Declarators { get { return declarators; } @@ -1511,10 +1530,10 @@ namespace Mono.CSharp { #endregion - public void AddDeclarator (Declarator decl) + public void AddDeclarator (BlockVariableDeclarator decl) { if (declarators == null) - declarators = new List (); + declarators = new List (); declarators.Add (decl); } @@ -1607,7 +1626,7 @@ namespace Mono.CSharp { bool eval_global = bc.Module.Compiler.Settings.StatementMode && bc.CurrentBlock is ToplevelBlock; if (eval_global) { CreateEvaluatorVariable (bc, li); - } else { + } else if (type != InternalType.ErrorType) { li.PrepareForFlowAnalysis (bc); } @@ -1621,7 +1640,7 @@ namespace Mono.CSharp { d.Variable.Type = li.Type; if (eval_global) { CreateEvaluatorVariable (bc, d.Variable); - } else { + } else if (type != InternalType.ErrorType) { d.Variable.PrepareForFlowAnalysis (bc); } @@ -1661,7 +1680,7 @@ namespace Mono.CSharp { protected override void CloneTo (CloneContext clonectx, Statement target) { - BlockVariableDeclaration t = (BlockVariableDeclaration) target; + BlockVariable t = (BlockVariable) target; if (type_expr != null) t.type_expr = (FullNamedExpression) type_expr.Clone (clonectx); @@ -1672,7 +1691,7 @@ namespace Mono.CSharp { if (declarators != null) { t.declarators = null; foreach (var d in declarators) - t.AddDeclarator (new Declarator (d, d.Initializer == null ? null : d.Initializer.Clone (clonectx))); + t.AddDeclarator (d.Clone (clonectx)); } } @@ -1682,9 +1701,9 @@ namespace Mono.CSharp { } } - public class BlockConstantDeclaration : BlockVariableDeclaration + public class BlockConstant : BlockVariable { - public BlockConstantDeclaration (FullNamedExpression type, LocalVariable li) + public BlockConstant (FullNamedExpression type, LocalVariable li) : base (type, li) { } @@ -2059,7 +2078,8 @@ namespace Mono.CSharp { HasAsyncModifier = 1 << 10, Resolved = 1 << 11, YieldBlock = 1 << 12, - AwaitBlock = 1 << 13 + AwaitBlock = 1 << 13, + Iterator = 1 << 14 } public Block Parent; @@ -2646,6 +2666,7 @@ namespace Mono.CSharp { } storey.Define (); + storey.PrepareEmit (); storey.Parent.PartialContainer.AddCompilerGeneratedClass (storey); } @@ -2664,6 +2685,8 @@ namespace Mono.CSharp { public void RegisterIteratorYield () { + ParametersBlock.TopBlock.IsIterator = true; + var block = this; while ((block.flags & Flags.YieldBlock) == 0) { block.flags |= Flags.YieldBlock; @@ -3112,7 +3135,7 @@ namespace Mono.CSharp { return tlb; } - public ParametersBlock ConvertToAsyncTask (IMemberContext context, TypeDefinition host, ParametersCompiled parameters, TypeSpec returnType, Location loc) + public ParametersBlock ConvertToAsyncTask (IMemberContext context, TypeDefinition host, ParametersCompiled parameters, TypeSpec returnType, TypeSpec delegateType, Location loc) { for (int i = 0; i < parameters.Count; i++) { Parameter p = parameters[i]; @@ -3144,6 +3167,7 @@ namespace Mono.CSharp { var block_type = host.Module.Compiler.BuiltinTypes.Void; var initializer = new AsyncInitializer (this, host, block_type); initializer.Type = block_type; + initializer.DelegateType = delegateType; var stateMachine = new AsyncTaskStorey (this, context, initializer, returnType); @@ -3207,7 +3231,10 @@ namespace Mono.CSharp { public bool IsIterator { get { - return HasYield; + return (flags & Flags.Iterator) != 0; + } + set { + flags = value ? flags | Flags.Iterator : flags & ~Flags.Iterator; } } @@ -4110,10 +4137,13 @@ namespace Mono.CSharp { new_expr = SwitchGoverningType (ec, unwrap); } - if (new_expr == null){ - ec.Report.Error (151, loc, - "A switch expression of type `{0}' cannot be converted to an integral type, bool, char, string, enum or nullable type", - TypeManager.CSharpName (Expr.Type)); + if (new_expr == null) { + if (Expr.Type != InternalType.ErrorType) { + ec.Report.Error (151, loc, + "A switch expression of type `{0}' cannot be converted to an integral type, bool, char, string, enum or nullable type", + Expr.Type.GetSignatureForError ()); + } + return false; } @@ -4512,6 +4542,7 @@ namespace Mono.CSharp { if (finally_host != null) { finally_host.Define (); + finally_host.PrepareEmit (); finally_host.Emit (); // Now it's safe to add, to close it properly and emit sequence points @@ -5049,8 +5080,7 @@ namespace Mono.CSharp { } } - - public class VariableDeclaration : BlockVariableDeclaration + public class VariableDeclaration : BlockVariable { public VariableDeclaration (FullNamedExpression type, LocalVariable li) : base (type, li) @@ -5175,7 +5205,7 @@ namespace Mono.CSharp { } } - public BlockVariableDeclaration Variables { + public BlockVariable Variables { get { return decl; } @@ -5557,7 +5587,7 @@ namespace Mono.CSharp { public class Using : TryFinallyBlock { - public class VariableDeclaration : BlockVariableDeclaration + public class VariableDeclaration : BlockVariable { Statement dispose_call; @@ -5734,7 +5764,7 @@ namespace Mono.CSharp { } } - public BlockVariableDeclaration Variables { + public BlockVariable Variables { get { return decl; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/typemanager.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/typemanager.cs index 4a674c4c46..6eb7648ce5 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/typemanager.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/typemanager.cs @@ -691,6 +691,7 @@ namespace Mono.CSharp readonly MemberKind kind; protected readonly ModuleContainer module; protected TypeSpec type; + bool defined; public PredefinedType (ModuleContainer module, MemberKind kind, string ns, string name, int arity) : this (module, kind, ns, name) @@ -753,7 +754,11 @@ namespace Mono.CSharp if (type != null) return true; - type = Resolve (module, kind, ns, name, arity, false, false); + if (!defined) { + defined = true; + type = Resolve (module, kind, ns, name, arity, false, false); + } + return type != null; } @@ -771,12 +776,13 @@ namespace Mono.CSharp // fake namespaces when type is optional and does not exist (e.g. System.Linq). // Namespace type_ns = module.GlobalRootNamespace.GetNamespace (ns, required); + IList found = null; if (type_ns != null) found = type_ns.GetAllTypes (name); if (found == null) { - if (reportErrors ) + if (reportErrors) module.Compiler.Report.Error (518, "The predefined type `{0}.{1}' is not defined or imported", ns, name); return null; @@ -984,15 +990,7 @@ namespace Mono.CSharp partial class TypeManager { - /// - /// Returns the C# name of a type if possible, or the full type name otherwise - /// - static public string CSharpName (TypeSpec t) - { - return t.GetSignatureForError (); - } - - static public string CSharpName (IList types) + static public string CSharpName(IList types) { if (types.Count == 0) return string.Empty; @@ -1002,7 +1000,7 @@ namespace Mono.CSharp if (i > 0) sb.Append (","); - sb.Append (CSharpName (types [i])); + sb.Append (types [i].GetSignatureForError ()); } return sb.ToString (); } @@ -1090,7 +1088,7 @@ namespace Mono.CSharp rc.Compiler.Report.SymbolRelatedToPreviousError (t); rc.Compiler.Report.Error (208, loc, "Cannot take the address of, get the size of, or declare a pointer to a managed type `{0}'", - CSharpName (t)); + t.GetSignatureForError ()); return false; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs index 2b21b98452..2411bf56e4 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs @@ -130,12 +130,12 @@ namespace Mono.CSharp return null; } - public virtual object Visit (BlockVariableDeclaration blockVariableDeclaration) + public virtual object Visit (BlockVariable blockVariableDeclaration) { return null; } - public virtual object Visit (BlockConstantDeclaration blockConstantDeclaration) + public virtual object Visit (BlockConstant blockConstantDeclaration) { return null; } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/IterateViaForeachTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/IterateViaForeachTests.cs index 4eaca5c3c9..3cf6a75b8d 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/IterateViaForeachTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/IterateViaForeachTests.cs @@ -147,7 +147,7 @@ class TestClass foreach (var c in s as IEnumerable) { } } -}", 0, true); +}", 0, false); } [Test] diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/InvalidStatementsTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/InvalidStatementsTests.cs index 7efd20479c..8ed44cf8b1 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/InvalidStatementsTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/InvalidStatementsTests.cs @@ -36,7 +36,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements [Test] public void AsExpressionStatementPositions() { - ExpressionStatement expr = ParseUtilCSharp.ParseStatement("\t\t\"\" as IEnumerable;", true); + ExpressionStatement expr = ParseUtilCSharp.ParseStatement("\t\t\"\" as IEnumerable;", false); Assert.AreEqual(new TextLocation(1, 3), expr.StartLocation); Assert.AreEqual(new TextLocation(1, 27), expr.EndLocation); } From 2326c366741b21a17d5b99c6981c4b6629565e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Sat, 11 May 2013 12:14:16 +0200 Subject: [PATCH 02/55] Fixed wrong token location. --- ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index 7797855db4..e4dd5755ec 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -213,7 +213,7 @@ namespace ICSharpCode.NRefactory.CSharp var memberType = new MemberType (); memberType.AddChild (ConvertToType (ma.LeftExpression), MemberType.TargetRole); - var loc = LocationsBag.GetLocations (memberType); + var loc = LocationsBag.GetLocations (ma); if (loc != null) memberType.AddChild (new CSharpTokenNode (Convert (loc[0]), Roles.Dot), Roles.Dot); From ae6b9e27cb895ebd9a4c122d128a7b5742466949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Sat, 11 May 2013 13:24:30 +0200 Subject: [PATCH 03/55] Fixed some preprocessor directive tests. --- .../Ast/GeneralScope/PreProcessorDirective.cs | 34 +++++++++++++++++++ .../Parser/CSharpParser.cs | 34 +++++++++++++++---- .../Parser/mcs/cs-tokenizer.cs | 5 +++ .../Parser/mcs/driver.cs | 2 +- .../Parser/mcs/location.cs | 30 +++++++++++++++- .../Parser/mcs/namespace.cs | 6 ++-- .../PreprocessorDirectiveTests.cs | 22 +++++------- 7 files changed, 106 insertions(+), 27 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/PreProcessorDirective.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/PreProcessorDirective.cs index b630087ab6..f35a172036 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/PreProcessorDirective.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/PreProcessorDirective.cs @@ -24,6 +24,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; +using System.Collections.Generic; namespace ICSharpCode.NRefactory.CSharp { @@ -45,6 +46,39 @@ namespace ICSharpCode.NRefactory.CSharp Pragma = 11, Line = 12 } + + public class PragmaWarningPreprocssorDirective : PreProcessorDirective + { + public bool Disable { + get; + set; + } + + List warningList = new List (); + public IList WarningList { + get { + return warningList; + } + } + + public PragmaWarningPreprocssorDirective(TextLocation startLocation, TextLocation endLocation) : base (PreProcessorDirectiveType.Pragma, startLocation, endLocation) + { + } + + public PragmaWarningPreprocssorDirective(string argument = null) : base (PreProcessorDirectiveType.Pragma, argument) + { + } + + public void AddWarnings(IEnumerable warningCodes) + { + warningList.AddRange(warningCodes); + } + + public void AddWarnings(params int[] warningCodes) + { + warningList.AddRange(warningCodes); + } + } public class PreProcessorDirective : AstNode { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index e4dd5755ec..e12f76c1dd 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -3650,13 +3650,22 @@ namespace ICSharpCode.NRefactory.CSharp }; role = Roles.Comment; } else if (!GenerateTypeSystemMode) { - var directive = special as SpecialsBag.PreProcessorDirective; - if (directive != null) { - newLeaf = new PreProcessorDirective ((ICSharpCode.NRefactory.CSharp.PreProcessorDirectiveType)((int)directive.Cmd & 0xF), new TextLocation (directive.Line, directive.Col), new TextLocation (directive.EndLine, directive.EndCol)) { - Argument = directive.Arg, - Take = directive.Take - }; + var pragmaDirective = special as SpecialsBag.PragmaPreProcessorDirective; + if (pragmaDirective != null) { + var pragma = new PragmaWarningPreprocssorDirective(new TextLocation(pragmaDirective.Line, pragmaDirective.Col), new TextLocation(pragmaDirective.EndLine, pragmaDirective.EndCol)); + pragma.Disable = pragmaDirective.Disalbe; + pragma.AddWarnings(pragmaDirective.Codes); + newLeaf = pragma; role = Roles.PreProcessorDirective; + } else { + var directive = special as SpecialsBag.PreProcessorDirective; + if (directive != null) { + newLeaf = new PreProcessorDirective ((ICSharpCode.NRefactory.CSharp.PreProcessorDirectiveType)((int)directive.Cmd & 0xF), new TextLocation (directive.Line, directive.Col), new TextLocation (directive.EndLine, directive.EndCol)) { + Argument = directive.Arg, + Take = directive.Take + }; + role = Roles.PreProcessorDirective; + } } } if (newLeaf != null) { @@ -3802,7 +3811,18 @@ namespace ICSharpCode.NRefactory.CSharp } conversionVisitor.Unit.FileName = fileName; - conversionVisitor.Unit.ConditionalSymbols = top.Conditionals.Concat (compilerSettings.ConditionalSymbols).ToArray (); + List conditionals = new List(); + foreach (var settings in compilerSettings.ConditionalSymbols) { + if (top.Conditionals.ContainsKey(settings) && !top.Conditionals [settings]) + continue; + conditionals.Add(settings); + } + foreach (var kv in top.Conditionals) { + if (!kv.Value || compilerSettings.ConditionalSymbols.Contains (kv.Key)) + continue; + conditionals.Add(kv.Key); + } + conversionVisitor.Unit.ConditionalSymbols = conditionals; return conversionVisitor.Unit; } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs index a1f4b88510..1e8b215730 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs @@ -2456,6 +2456,7 @@ namespace Mono.CSharp // if (length == pragma_warning_disable.Length) { bool disable = IsTokenIdentifierEqual (pragma_warning_disable); + sbag.SetPragmaDisable (disable); if (disable || IsTokenIdentifierEqual (pragma_warning_restore)) { // skip over white space while (c == ' ' || c == '\t') @@ -2483,6 +2484,7 @@ namespace Mono.CSharp do { code = TokenizePragmaNumber (ref c); if (code > 0) { + sbag.AddPragmaCode (code); if (disable) { Report.RegisterWarningRegion (loc).WarningDisable (loc, code, context.Report); } else { @@ -2821,6 +2823,7 @@ namespace Mono.CSharp } if ((state & TAKING) != 0) { + sbag.SkipIf (); ifstack.Push (0); return false; } @@ -2830,6 +2833,7 @@ namespace Mono.CSharp return true; } + sbag.SkipIf (); ifstack.Push (state); return false; } @@ -3609,6 +3613,7 @@ namespace Mono.CSharp if (c == '#') { if (ParsePreprocessingDirective (false)) break; + sbag.StartComment(SpecialsBag.CommentType.InactiveCode, false, line, 1); } sbag.PushCommentChar (c); directive_expected = false; diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs index ddbc1f0ed7..6d9f4c0464 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs @@ -419,7 +419,7 @@ namespace Mono.CSharp public ModuleContainer ModuleCompiled { get; set; } public LocationsBag LocationsBag { get; set; } public SpecialsBag SpecialsBag { get; set; } - public IEnumerable Conditionals { get; set; } + public IDictionary Conditionals { get; set; } public object LastYYValue { get; set; } } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs index ef62183b74..50eab8a78c 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs @@ -483,6 +483,16 @@ if (checkpoints.Length <= CheckpointIndex) throw new Exception (String.Format (" } } + public class PragmaPreProcessorDirective : PreProcessorDirective + { + public bool Disalbe { get; set; } + public List Codes = new List (); + + public PragmaPreProcessorDirective (int line, int col, int endLine, int endCol, Tokenizer.PreprocessorDirective cmd, string arg) : base (line, col, endLine, endCol, cmd, arg) + { + } + } + public class PreProcessorDirective : SpecialBase { public readonly int Line; @@ -562,7 +572,25 @@ if (checkpoints.Length <= CheckpointIndex) throw new Exception (String.Format (" { if (inComment) EndComment (startLine, startCol); - Specials.Add (new PreProcessorDirective (startLine, startCol, endLine, endColumn, cmd, arg)); + Specials.Add (cmd == Tokenizer.PreprocessorDirective.Pragma ? new PragmaPreProcessorDirective (startLine, startCol, endLine, endColumn, cmd, arg) : new PreProcessorDirective (startLine, startCol, endLine, endColumn, cmd, arg)); + } + + [Conditional ("FULL_AST")] + public void SetPragmaDisable(bool disable) + { + var pragmaDirective = Specials [Specials.Count - 1] as PragmaPreProcessorDirective; + if (pragmaDirective == null) + return; + pragmaDirective.Disalbe = disable; + } + + [Conditional ("FULL_AST")] + public void AddPragmaCode(int code) + { + var pragmaDirective = Specials [Specials.Count - 1] as PragmaPreProcessorDirective; + if (pragmaDirective == null) + return; + pragmaDirective.Codes.Add (code); } public enum NewLine { Unix, Windows } diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs index 68a39acb2b..7965e05ed1 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs @@ -674,11 +674,9 @@ namespace Mono.CSharp { } } - public IEnumerable Conditionals { + public IDictionary Conditionals { get { - if (conditionals == null) - return Enumerable.Empty (); - return conditionals.Where (kv => kv.Value).Select (kv => kv.Key); + return conditionals ?? new Dictionary (); } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs index 0df5bfb438..ca975251b0 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs @@ -66,7 +66,6 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope Assert.AreEqual(new TextLocation(4, 8), pp.Last().EndLocation); } - [Ignore("Fixme!")] [Test] public void NestedInactiveIf() { @@ -94,7 +93,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope Roles.Comment, Roles.PreProcessorDirective, Roles.RBrace - }, ns.Children.Select(c => c.Role).ToArray()); + }, ns.Children.Where (c => !(c is NewLineNode)).Select(c => c.Role).ToArray()); } [Ignore("Fixme!")] @@ -118,19 +117,19 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope Roles.Comment, Roles.PreProcessorDirective, Roles.RBrace - }, ns.Children.Select(c => c.Role).ToArray()); + }, ns.Children.Where (c => !(c is NewLineNode)).Select(c => c.Role).ToArray()); Assert.AreEqual(CommentType.SingleLine, ns.GetChildrenByRole(Roles.Comment).First().CommentType); Assert.AreEqual(CommentType.InactiveCode, ns.GetChildrenByRole(Roles.Comment).Last().CommentType); } - [Ignore("Fixme!")] [Test] public void PragmaWarning() { string program = "#pragma warning disable 809"; - var ppd = ParseUtilCSharp.ParseGlobal(program); + var ppd = ParseUtilCSharp.ParseGlobal(program); Assert.AreEqual(PreProcessorDirectiveType.Pragma, ppd.Type); - Assert.AreEqual("warning disable 809", ppd.Argument); + Assert.IsTrue(ppd.Disable); + Assert.IsTrue(ppd.WarningList.Contains (809)); } const string elifProgram = @" @@ -141,20 +140,18 @@ class B { } #endif"; [Test] - [Ignore("parser bug (missing comment node)")] public void ElifBothFalse() { CSharpParser parser = new CSharpParser(); var syntaxTree = parser.Parse(elifProgram, "elif.cs"); Assert.IsFalse(parser.HasErrors); - Assert.AreEqual(new Role[] { Roles.PreProcessorDirective, Roles.Comment, Roles.PreProcessorDirective, Roles.Comment, Roles.PreProcessorDirective - }, syntaxTree.Children.Select(c => c.Role).ToArray()); + }, syntaxTree.Children.Where (c => !(c is NewLineNode)).Select(c => c.Role).ToArray()); var aaa = syntaxTree.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(0); Assert.IsFalse(aaa.Take); Assert.AreEqual(PreProcessorDirectiveType.If, aaa.Type); @@ -167,7 +164,6 @@ class B { } } [Test] - [Ignore("parser bug (bbb.Take is true, should be false)")] public void ElifBothTrue() { CSharpParser parser = new CSharpParser(); @@ -181,7 +177,7 @@ class B { } Roles.PreProcessorDirective, Roles.Comment, Roles.PreProcessorDirective - }, syntaxTree.Children.Select(c => c.Role).ToArray()); + }, syntaxTree.Children.Where (c => !(c is NewLineNode)).Select(c => c.Role).ToArray()); var aaa = syntaxTree.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(0); Assert.IsTrue(aaa.Take); Assert.AreEqual(PreProcessorDirectiveType.If, aaa.Type); @@ -194,7 +190,6 @@ class B { } } [Test] - [Ignore("parser bug (bbb.Take is true, should be false)")] public void ElifFirstTaken() { CSharpParser parser = new CSharpParser(); @@ -208,7 +203,7 @@ class B { } Roles.PreProcessorDirective, Roles.Comment, Roles.PreProcessorDirective - }, syntaxTree.Children.Select(c => c.Role).ToArray()); + }, syntaxTree.Children.Where (c => !(c is NewLineNode)).Select(c => c.Role).ToArray()); var aaa = syntaxTree.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(0); Assert.IsTrue(aaa.Take); Assert.AreEqual(PreProcessorDirectiveType.If, aaa.Type); @@ -247,7 +242,6 @@ class B { } } [Test] - [Ignore("parser bug (BBB is missing)")] public void ConditionalSymbolTest() { const string program = @"// Test From 8e8aaf1ef6772134b968e89a9947c4cad751cdf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Sat, 11 May 2013 13:40:29 +0200 Subject: [PATCH 04/55] No longer add empty attribute sections. --- ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index e12f76c1dd..d147fa87e5 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -328,7 +328,6 @@ namespace ICSharpCode.NRefactory.CSharp AttributeSection ConvertAttributeSection (IEnumerable optAttributes) { - if (optAttributes == null) return null; AttributeSection result = new AttributeSection (); @@ -357,6 +356,8 @@ namespace ICSharpCode.NRefactory.CSharp attributeCount++; } + if (attributeCount == 0) + return null; // Left and right bracket + commas between the attributes int locCount = 2 + attributeCount - 1; // optional comma @@ -956,7 +957,9 @@ namespace ICSharpCode.NRefactory.CSharp if (attrs == null) return; foreach (var attr in attrs.Sections) { - parent.AddChild (ConvertAttributeSection (attr), role); + var section = ConvertAttributeSection(attr); + if (section != null) + parent.AddChild (section, role); } } From a1bdce98efacfc779073a5767fb9bb7444815fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Sat, 11 May 2013 13:54:55 +0200 Subject: [PATCH 05/55] Added work around for issue #73. But needs to be fixed on parser level. --- .../Parser/CSharpParser.cs | 9 ++++++--- .../Parser/TypeSystemConvertVisitorTests.cs | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index d147fa87e5..2e4c34f0d0 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -103,7 +103,9 @@ namespace ICSharpCode.NRefactory.CSharp first = false; if (mc.OptAttributes != null) { foreach (var attr in mc.OptAttributes.Sections) { - unit.AddChild (ConvertAttributeSection (attr), SyntaxTree.MemberRole); + var section = ConvertAttributeSection(attr); + if (section != null) + unit.AddChild (section, SyntaxTree.MemberRole); } } } @@ -958,8 +960,9 @@ namespace ICSharpCode.NRefactory.CSharp return; foreach (var attr in attrs.Sections) { var section = ConvertAttributeSection(attr); - if (section != null) - parent.AddChild (section, role); + if (section == null || section.AttributeTarget == "module" || section.AttributeTarget == "assembly") + continue; + parent.AddChild (section, role); } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs index cd339dc575..5306bf70b6 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs @@ -99,6 +99,22 @@ namespace ICSharpCode.NRefactory.CSharp.Parser Assert.IsTrue (field.IsConst); Assert.IsNull (field.ConstantValue); } + + [Test] + public void AssemblyAndModuleAttributesDoNotAppearOnTypes() + { + var parser = new CSharpParser(); + var cu = parser.Parse("[assembly: My1][module: My2][My3]class C {} public class My1Attribute : System.Attribute {} public class My2Attribute : System.Attribute {} public class My3Attribute : System.Attribute {}", "File.cs"); + + var ts = cu.ToTypeSystem(); + var compilation = new CSharpProjectContent() + .UpdateProjectContent(null, ts) + .AddAssemblyReferences(new[] { CecilLoaderTests.Mscorlib }) + .CreateCompilation(); + var type = ReflectionHelper.ParseReflectionName("C").Resolve(compilation).GetDefinition(); + Assert.That(type.Attributes.Select(a => a.AttributeType.FullName).ToList(), Is.EqualTo(new[] { "My3Attribute" })); + } + } [TestFixture] From 0783129bb7bf73e093e065cd53026a9446d62cc5 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 11 May 2013 14:47:45 +0200 Subject: [PATCH 06/55] Fix icsharpcode/NRefactory#183: Implicit conversion detected as explicit conversion --- .../Parser/CSharpParser.cs | 2 +- .../Resolver/OverloadResolution.cs | 2 +- .../CSharp/Resolver/ConversionsTest.cs | 23 +++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index 2e4c34f0d0..d7fd7f8fce 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -3700,7 +3700,7 @@ namespace ICSharpCode.NRefactory.CSharp void InsertComment(ref AstNode insertionPoint, AstNode newNode, Role role, bool isDocumentationComment, AstNode rootNode) { TextLocation insertAt = newNode.StartLocation; - // Advance insertionPoint to the first node that has a start location greater than insertAt + // Advance insertionPoint to the first node that has a start location >= insertAt while (insertionPoint != null && insertionPoint.StartLocation < insertAt) { // Enter the current node if insertAt is within while (insertAt < insertionPoint.EndLocation && insertionPoint.FirstChild != null) { diff --git a/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs b/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs index 53cbcae20b..f08c679e72 100644 --- a/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs @@ -887,7 +887,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver // Wrap argument in ConversionResolveResult IType parameterType = bestCandidate.ParameterTypes[parameterIndex]; if (parameterType.Kind != TypeKind.Unknown) { - if (arguments[i].IsCompileTimeConstant && conversions[i] != Conversion.None) { + if (arguments[i].IsCompileTimeConstant && conversions[i].IsValid && !conversions[i].IsUserDefined) { argument = new CSharpResolver(compilation).WithCheckForOverflow(CheckForOverflow).ResolveCast(parameterType, argument); } else { argument = new ConversionResolveResult(parameterType, argument, conversions[i], CheckForOverflow); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ConversionsTest.cs b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ConversionsTest.cs index 344f871a45..945b80a130 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ConversionsTest.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ConversionsTest.cs @@ -1348,5 +1348,28 @@ class Test { Assert.IsTrue(c.ConversionAfterUserDefinedOperator.IsNumericConversion); Assert.IsTrue(c.ConversionAfterUserDefinedOperator.IsValid); } + + [Test] + public void UserDefinedImplicitConversion_IsImplicit() + { + // Bug icsharpcode/NRefactory#183: conversions from constant expressions were incorrectly marked as explicit + string program = @"using System; + class Test { + void Hello(JsNumber3 x) { + Hello($7$); + } + } + public class JsNumber3 { + public static implicit operator JsNumber3(int d) { + return null; + } + }"; + var c = GetConversion(program); + Assert.IsTrue(c.IsValid); + Assert.IsTrue(c.IsImplicit); + Assert.IsFalse(c.IsExplicit); + Assert.AreEqual(Conversion.IdentityConversion, c.ConversionBeforeUserDefinedOperator); + Assert.AreEqual(Conversion.IdentityConversion, c.ConversionAfterUserDefinedOperator); + } } } From 552e132a7f46e438fac91c5d7126d63264959ef1 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 11 May 2013 15:02:45 +0200 Subject: [PATCH 07/55] Add failing unit tests for #pragma checksum and #line preprocessor directives. --- .../PreprocessorDirectiveTests.cs | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs index ca975251b0..517f6c0871 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs @@ -132,6 +132,49 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope Assert.IsTrue(ppd.WarningList.Contains (809)); } + [Test, Ignore("mcs crashes because it tries to compute the full path to file.cs")] + public void PragmaChecksum() + { + string program = "#pragma checksum \"file.cs\" \"{3673e4ca-6098-4ec1-890f-8fceb2a794a2}\" \"{012345678AB}\""; + var ppd = ParseUtilCSharp.ParseGlobal(program); + Assert.IsFalse(ppd is PragmaWarningPreprocssorDirective); + Assert.AreEqual(PreProcessorDirectiveType.Pragma, ppd.Type); + Assert.AreEqual("checksum \"file.cs\" \"{3673e4ca-6098-4ec1-890f-8fceb2a794a2}\" \"{012345678AB}\"", ppd.Argument); + } + + [Test, Ignore("mcs crashes because it tries to compute the full path to file.cs")] + public void LineWithFileName() + { + string program = "#line 200 \"otherfile.cs\"\nclass Test {}"; + CSharpParser parser = new CSharpParser(); + SyntaxTree syntaxTree = parser.Parse(program); + Assert.IsFalse(parser.HasErrors, string.Join(Environment.NewLine, parser.Errors.Select(e => e.Message))); + Assert.AreEqual(new Role[] { + Roles.PreProcessorDirective, + Roles.NewLine, + NamespaceDeclaration.MemberRole + }, syntaxTree.Children.Select(c => c.Role).ToArray()); + Assert.AreEqual(new TextLocation(2, 1), syntaxTree.Members.Single().StartLocation); + } + + [Test, Ignore("ppd.Argument is missing")] + public void Line() + { + string program = "#line 200\nclass Test {}"; + CSharpParser parser = new CSharpParser(); + SyntaxTree syntaxTree = parser.Parse(program); + Assert.IsFalse(parser.HasErrors, string.Join(Environment.NewLine, parser.Errors.Select(e => e.Message))); + Assert.AreEqual(new Role[] { + Roles.PreProcessorDirective, + Roles.NewLine, + NamespaceDeclaration.MemberRole + }, syntaxTree.Children.Select(c => c.Role).ToArray()); + Assert.AreEqual(new TextLocation(2, 1), syntaxTree.Members.Single().StartLocation); + var ppd = (PreProcessorDirective)syntaxTree.FirstChild; + Assert.AreEqual(PreProcessorDirectiveType.Line, ppd.Type); + Assert.AreEqual("200", ppd.Argument); + } + const string elifProgram = @" #if AAA class A { } From d46054aa0f564a5886405c63d826f26004042a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Sat, 11 May 2013 20:21:42 +0200 Subject: [PATCH 08/55] Added more friendly error message in simple compilation in case of wrong assembly references. --- .../TypeSystem/Implementation/SimpleCompilation.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleCompilation.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleCompilation.cs index 291bb20eea..a4da92dbff 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleCompilation.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleCompilation.cs @@ -66,7 +66,12 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation assemblies.Add(this.mainAssembly); List referencedAssemblies = new List(); foreach (var asmRef in assemblyReferences) { - IAssembly asm = asmRef.Resolve(context); + IAssembly asm; + try { + asm = asmRef.Resolve(context); + } catch (InvalidOperationException) { + throw new InvalidOperationException("Tried to initialize compilation with an invalid assembly reference. (Forgot to load the assembly reference ? - see CecilLoader)"); + } if (asm != null && !assemblies.Contains(asm)) assemblies.Add(asm); if (asm != null && !referencedAssemblies.Contains(asm)) From 5f67bc0933ae373b1c8bf247d4ba4eb1b8c7b5b1 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 11 May 2013 19:57:36 +0200 Subject: [PATCH 09/55] Remove constructors from CSharpUnresolvedFile - they could be mistaken to load the specified file name. --- .../Ast/SyntaxTree.cs | 4 +++ .../Resolver/ResolveVisitor.cs | 2 +- .../TypeSystem/CSharpUnresolvedFile.cs | 26 +++++-------------- .../TypeSystem/TypeSystemConvertVisitor.cs | 3 ++- .../GetCurrentParameterIndexTests.cs | 2 +- .../CSharp/CodeDomConvertVisitorTests.cs | 2 +- .../Parser/Expression/QueryExpressionTests.cs | 16 ++++++++++++ .../TypeSystem/TypeSystemHelper.cs | 2 +- 8 files changed, 32 insertions(+), 25 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs b/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs index 7e53f98e0f..6ac536159d 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs @@ -164,24 +164,28 @@ namespace ICSharpCode.NRefactory.CSharp public static SyntaxTree Parse (string program, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); var parser = new CSharpParser (settings); return parser.Parse (program, fileName); } public static SyntaxTree Parse (TextReader reader, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); var parser = new CSharpParser (settings); return parser.Parse (reader, fileName); } public static SyntaxTree Parse (Stream stream, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); var parser = new CSharpParser (settings); return parser.Parse (stream, fileName); } public static SyntaxTree Parse (ITextSource textSource, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); var parser = new CSharpParser (settings); return parser.Parse (textSource, fileName); } diff --git a/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs b/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs index b16b5200a2..97b568b23d 100644 --- a/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs @@ -589,7 +589,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver // Last using scope: usingScope = new UsingScope(resolver.CurrentUsingScope.UnresolvedUsingScope, identifiers.Last().Name); usingScope.Region = region; - var cv = new TypeSystemConvertVisitor(new CSharpUnresolvedFile(region.FileName ?? string.Empty), usingScope); + var cv = new TypeSystemConvertVisitor(new CSharpUnresolvedFile(), usingScope); ApplyVisitorToUsings(cv, namespaceDeclaration.Children); PushUsingScope(usingScope); } diff --git a/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpUnresolvedFile.cs b/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpUnresolvedFile.cs index a3d088b773..88f61f1c93 100644 --- a/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpUnresolvedFile.cs +++ b/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpUnresolvedFile.cs @@ -36,8 +36,8 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem // The 'FastSerializerVersion' attribute on CSharpUnresolvedFile must be incremented when fixing // bugs in the TypeSystemConvertVisitor - readonly string fileName; - readonly UsingScope rootUsingScope; + string fileName = string.Empty; + readonly UsingScope rootUsingScope = new UsingScope(); IList topLevelTypeDefinitions = new List(); IList assemblyAttributes = new List(); IList moduleAttributes = new List(); @@ -55,26 +55,12 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem usingScopes = FreezableHelper.FreezeListAndElements(usingScopes); } - public CSharpUnresolvedFile(string fileName) - { - if (fileName == null) - throw new ArgumentNullException("fileName"); - this.fileName = fileName; - this.rootUsingScope = new UsingScope(); - } - - public CSharpUnresolvedFile(string fileName, UsingScope rootUsingScope) - { - if (fileName == null) - throw new ArgumentNullException("fileName"); - if (rootUsingScope == null) - throw new ArgumentNullException("rootUsingScope"); - this.fileName = fileName; - this.rootUsingScope = rootUsingScope; - } - public string FileName { get { return fileName; } + set { + FreezableHelper.ThrowIfFrozen(this); + fileName = value ?? string.Empty; + } } DateTime? lastWriteTime; diff --git a/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs b/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs index 134ca8b051..55cdad7a0c 100644 --- a/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs @@ -75,7 +75,8 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem { if (fileName == null) throw new ArgumentNullException("fileName"); - this.unresolvedFile = new CSharpUnresolvedFile(fileName); + this.unresolvedFile = new CSharpUnresolvedFile(); + this.unresolvedFile.FileName = fileName; this.usingScope = unresolvedFile.RootUsingScope; } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/GetCurrentParameterIndexTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/GetCurrentParameterIndexTests.cs index 3d9b660cd8..fb6ac2baa3 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/GetCurrentParameterIndexTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/GetCurrentParameterIndexTests.cs @@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeCompletion var doc = new ReadOnlyDocument(editorText.ToString ()); var pctx = new CSharpProjectContent(); var rctx = new CSharpTypeResolveContext(pctx.CreateCompilation().MainAssembly); - var ctxProvider = new DefaultCompletionContextProvider(doc, new CSharpUnresolvedFile("a.cs")); + var ctxProvider = new DefaultCompletionContextProvider(doc, new CSharpUnresolvedFile()); var engine = new CSharpParameterCompletionEngine(doc, ctxProvider, new ParameterCompletionTests.TestFactory(pctx), pctx, rctx); return engine.GetCurrentParameterIndex(trigger, end); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeDomConvertVisitorTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeDomConvertVisitorTests.cs index ca003fae8f..4ca8b9c030 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeDomConvertVisitorTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeDomConvertVisitorTests.cs @@ -39,7 +39,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void SetUp() { base.SetUp(); - unresolvedFile = new CSharpUnresolvedFile("test.cs"); + unresolvedFile = new CSharpUnresolvedFile(); unresolvedFile.RootUsingScope.Usings.Add(MakeReference("System")); unresolvedFile.RootUsingScope.Usings.Add(MakeReference("System.Collections.Generic")); unresolvedFile.RootUsingScope.Usings.Add(MakeReference("System.Linq")); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/QueryExpressionTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/QueryExpressionTests.cs index 74482b1756..82afc6422c 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/QueryExpressionTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/QueryExpressionTests.cs @@ -302,6 +302,22 @@ select new { c.Name, o.OrderID, o.Total }", }}); } + [Test] + public void LocationOfWhere() + { + var expr = ParseUtilCSharp.ParseExpression("from c in customers where c.City == \"London\" select c"); + var where = expr.Clauses.ElementAt(1); + Assert.That(where.StartLocation, Is.EqualTo(new TextLocation(1, 21))); + } + + [Test] + public void LocationOfOrderBy() + { + var expr = ParseUtilCSharp.ParseExpression("from c in customers orderby c.City select c"); + var where = expr.Clauses.ElementAt(1); + Assert.That(where.StartLocation, Is.EqualTo(new TextLocation(1, 21))); + } + [Test] public void ExpressionWithOrderByAndLet() { diff --git a/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemHelper.cs b/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemHelper.cs index c004c23f3c..62e8b80efa 100644 --- a/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemHelper.cs +++ b/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemHelper.cs @@ -32,7 +32,7 @@ namespace ICSharpCode.NRefactory.TypeSystem public static ICompilation CreateCompilation(params IUnresolvedTypeDefinition[] unresolvedTypeDefinitions) { - var unresolvedFile = new CSharpUnresolvedFile("dummy.cs"); + var unresolvedFile = new CSharpUnresolvedFile(); foreach (var typeDef in unresolvedTypeDefinitions) unresolvedFile.TopLevelTypeDefinitions.Add(typeDef); return CreateCompilation(unresolvedFile); From 4984985673d884ea5608f9b5919012d375346b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Sun, 12 May 2013 10:46:40 +0200 Subject: [PATCH 10/55] Added line preprocessor directive support. --- .../Ast/GeneralScope/PreProcessorDirective.cs | 21 ++++++++++++ .../Parser/CSharpParser.cs | 33 +++++++++++++------ .../Parser/mcs/cs-tokenizer.cs | 9 +++++ .../Parser/mcs/location.cs | 27 ++++++++++++++- .../CSharp/AstStructureTests.cs | 2 ++ .../PreprocessorDirectiveTests.cs | 15 ++++++--- 6 files changed, 91 insertions(+), 16 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/PreProcessorDirective.cs b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/PreProcessorDirective.cs index f35a172036..60496f6c99 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/PreProcessorDirective.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/PreProcessorDirective.cs @@ -47,6 +47,27 @@ namespace ICSharpCode.NRefactory.CSharp Line = 12 } + public class LinePreprocssorDirective : PreProcessorDirective + { + public int LineNumber { + get; + set; + } + + public string FileName { + get; + set; + } + + public LinePreprocssorDirective(TextLocation startLocation, TextLocation endLocation) : base (PreProcessorDirectiveType.Line, startLocation, endLocation) + { + } + + public LinePreprocssorDirective(string argument = null) : base (PreProcessorDirectiveType.Line, argument) + { + } + } + public class PragmaWarningPreprocssorDirective : PreProcessorDirective { public bool Disable { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index d7fd7f8fce..5eff5f6c4f 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -960,7 +960,7 @@ namespace ICSharpCode.NRefactory.CSharp return; foreach (var attr in attrs.Sections) { var section = ConvertAttributeSection(attr); - if (section == null || section.AttributeTarget == "module" || section.AttributeTarget == "assembly") + if (section == null) continue; parent.AddChild (section, role); } @@ -3663,16 +3663,29 @@ namespace ICSharpCode.NRefactory.CSharp pragma.AddWarnings(pragmaDirective.Codes); newLeaf = pragma; role = Roles.PreProcessorDirective; - } else { - var directive = special as SpecialsBag.PreProcessorDirective; - if (directive != null) { - newLeaf = new PreProcessorDirective ((ICSharpCode.NRefactory.CSharp.PreProcessorDirectiveType)((int)directive.Cmd & 0xF), new TextLocation (directive.Line, directive.Col), new TextLocation (directive.EndLine, directive.EndCol)) { - Argument = directive.Arg, - Take = directive.Take - }; - role = Roles.PreProcessorDirective; - } + goto end; + } + + var lineDirective = special as SpecialsBag.LineProcessorDirective; + if (lineDirective != null) { + var pragma = new LinePreprocssorDirective(new TextLocation(lineDirective.Line, lineDirective.Col), new TextLocation(lineDirective.EndLine, lineDirective.EndCol)); + pragma.LineNumber = lineDirective.LineNumber; + pragma.FileName = lineDirective.FileName; + newLeaf = pragma; + role = Roles.PreProcessorDirective; + goto end; + } + + var directive = special as SpecialsBag.PreProcessorDirective; + if (directive != null) { + newLeaf = new PreProcessorDirective ((ICSharpCode.NRefactory.CSharp.PreProcessorDirectiveType)((int)directive.Cmd & 0xF), new TextLocation (directive.Line, directive.Col), new TextLocation (directive.EndLine, directive.EndCol)) { + Argument = directive.Arg, + Take = directive.Take + }; + role = Roles.PreProcessorDirective; } + end: + ; } if (newLeaf != null) { InsertComment(ref insertionPoint, newLeaf, role, isDocumentationComment, conversionVisitor.Unit); diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs index 1e8b215730..3e80b55671 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs @@ -2037,6 +2037,9 @@ namespace Mono.CSharp bool PreProcessLine () { Location loc = Location; + #if FULL_AST + var lineDirective = sbag.GetCurrentLineProcessorDirective(); + #endif int c; @@ -2087,6 +2090,9 @@ namespace Mono.CSharp return new_line != 0; } + #if FULL_AST + lineDirective.LineNumber = new_line; + #endif c = get_char (); if (c == ' ') { @@ -2113,6 +2119,9 @@ namespace Mono.CSharp string new_file_name = null; if (c == '"') { new_file_name = TokenizeFileName (ref c); + #if FULL_AST + lineDirective.FileName = new_file_name; + #endif // skip over white space while (c == ' ' || c == '\t') { diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs index 50eab8a78c..2d63c312cd 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs @@ -493,6 +493,16 @@ if (checkpoints.Length <= CheckpointIndex) throw new Exception (String.Format (" } } + public class LineProcessorDirective : PreProcessorDirective + { + public int LineNumber { get; set; } + public string FileName { get; set; } + + public LineProcessorDirective (int line, int col, int endLine, int endCol, Tokenizer.PreprocessorDirective cmd, string arg) : base (line, col, endLine, endCol, cmd, arg) + { + } + } + public class PreProcessorDirective : SpecialBase { public readonly int Line; @@ -572,7 +582,17 @@ if (checkpoints.Length <= CheckpointIndex) throw new Exception (String.Format (" { if (inComment) EndComment (startLine, startCol); - Specials.Add (cmd == Tokenizer.PreprocessorDirective.Pragma ? new PragmaPreProcessorDirective (startLine, startCol, endLine, endColumn, cmd, arg) : new PreProcessorDirective (startLine, startCol, endLine, endColumn, cmd, arg)); + switch (cmd) { + case Tokenizer.PreprocessorDirective.Pragma: + Specials.Add (new PragmaPreProcessorDirective (startLine, startCol, endLine, endColumn, cmd, arg)); + break; + case Tokenizer.PreprocessorDirective.Line: + Specials.Add (new LineProcessorDirective (startLine, startCol, endLine, endColumn, cmd, arg)); + break; + default: + Specials.Add (new PreProcessorDirective (startLine, startCol, endLine, endColumn, cmd, arg)); + break; + } } [Conditional ("FULL_AST")] @@ -593,6 +613,11 @@ if (checkpoints.Length <= CheckpointIndex) throw new Exception (String.Format (" pragmaDirective.Codes.Add (code); } + public LineProcessorDirective GetCurrentLineProcessorDirective() + { + return Specials [Specials.Count - 1] as LineProcessorDirective; + } + public enum NewLine { Unix, Windows } [Conditional ("FULL_AST")] diff --git a/ICSharpCode.NRefactory.Tests/CSharp/AstStructureTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/AstStructureTests.cs index 7734a1b9a2..5e4a7bc48c 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/AstStructureTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/AstStructureTests.cs @@ -53,6 +53,8 @@ namespace ICSharpCode.NRefactory.CSharp foreach (Type type in typeof(AstNode).Assembly.GetExportedTypes()) { if (type == typeof(CSharpModifierToken)) // CSharpModifierToken is the exception (though I'm not too happy about that) continue; + if (type == typeof(PreProcessorDirective)) // another exception - is it useful or not ? + continue; if (type.IsSubclassOf(typeof(AstNode))) { Assert.IsTrue(type.BaseType.IsAbstract, type.FullName); } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs index 517f6c0871..ed2b923226 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs @@ -147,17 +147,22 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope { string program = "#line 200 \"otherfile.cs\"\nclass Test {}"; CSharpParser parser = new CSharpParser(); - SyntaxTree syntaxTree = parser.Parse(program); + SyntaxTree syntaxTree = parser.Parse(program, "/a.cs"); Assert.IsFalse(parser.HasErrors, string.Join(Environment.NewLine, parser.Errors.Select(e => e.Message))); Assert.AreEqual(new Role[] { Roles.PreProcessorDirective, Roles.NewLine, - NamespaceDeclaration.MemberRole + SyntaxTree.MemberRole }, syntaxTree.Children.Select(c => c.Role).ToArray()); Assert.AreEqual(new TextLocation(2, 1), syntaxTree.Members.Single().StartLocation); + + var ppd = (LinePreprocssorDirective)syntaxTree.FirstChild; + Assert.AreEqual(PreProcessorDirectiveType.Line, ppd.Type); + Assert.AreEqual(200, ppd.LineNumber); + Assert.AreEqual("otherfile.cs", ppd.FileName); } - [Test, Ignore("ppd.Argument is missing")] + [Test] public void Line() { string program = "#line 200\nclass Test {}"; @@ -170,9 +175,9 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope NamespaceDeclaration.MemberRole }, syntaxTree.Children.Select(c => c.Role).ToArray()); Assert.AreEqual(new TextLocation(2, 1), syntaxTree.Members.Single().StartLocation); - var ppd = (PreProcessorDirective)syntaxTree.FirstChild; + var ppd = (LinePreprocssorDirective)syntaxTree.FirstChild; Assert.AreEqual(PreProcessorDirectiveType.Line, ppd.Type); - Assert.AreEqual("200", ppd.Argument); + Assert.AreEqual(200, ppd.LineNumber); } const string elifProgram = @" From ae993f0ca44526f2379306adc9f8581d4f676d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Tue, 14 May 2013 16:59:52 +0200 Subject: [PATCH 11/55] Fixed some formatting issues. --- .../Formatter/FormattingVisitor_Global.cs | 58 +-- .../TestTypeLevelIndentation.cs | 350 ++++++++++-------- 2 files changed, 228 insertions(+), 180 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs index 980f2fe565..ca3f552c2d 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs @@ -23,7 +23,6 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. - using System; using System.Linq; @@ -47,16 +46,16 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitSyntaxTree(SyntaxTree unit) { bool first = true; - VisitChildrenToFormat (unit, child => { + VisitChildrenToFormat(unit, child => { if (first && (child is UsingDeclaration || child is UsingAliasDeclaration)) { - EnsureBlankLinesBefore (child, policy.BlankLinesBeforeUsings); + EnsureBlankLinesBefore(child, policy.BlankLinesBeforeUsings); first = false; } if (NoWhitespacePredicate(child)) FixIndentation(child); child.AcceptVisitor(this); if (NoWhitespacePredicate(child)) - EnsureNewLinesAfter(child, GetGlobalNewLinesFor (child)); + EnsureNewLinesAfter(child, GetGlobalNewLinesFor(child)); }); } @@ -79,9 +78,10 @@ namespace ICSharpCode.NRefactory.CSharp curIndent.Push(IndentType.Block); bool first = true; - VisitChildrenToFormat (namespaceDeclaration, child => { + bool startFormat = false; + VisitChildrenToFormat(namespaceDeclaration, child => { if (child.Role == Roles.LBrace) { - var next = child.GetNextSibling (NoWhitespacePredicate); + var next = child.GetNextSibling(NoWhitespacePredicate); var blankLines = 1; if (next is UsingDeclaration || next is UsingAliasDeclaration) { blankLines += policy.BlankLinesBeforeUsings; @@ -89,9 +89,14 @@ namespace ICSharpCode.NRefactory.CSharp blankLines += policy.BlankLinesBeforeFirstDeclaration; } EnsureNewLinesAfter(child, blankLines); + startFormat = true; + return; + } + if (child.Role == Roles.RBrace) { + startFormat = false; return; } - if (child.Role != NamespaceDeclaration.MemberRole) + if (!startFormat || !NoWhitespacePredicate (child)) return; if (first && (child is UsingDeclaration || child is UsingAliasDeclaration)) { // TODO: policy.BlankLinesBeforeUsings @@ -101,11 +106,11 @@ namespace ICSharpCode.NRefactory.CSharp FixIndentationForceNewLine(child); child.AcceptVisitor(this); if (NoWhitespacePredicate(child)) - EnsureNewLinesAfter(child, GetGlobalNewLinesFor (child)); + EnsureNewLinesAfter(child, GetGlobalNewLinesFor(child)); }); if (policy.IndentNamespaceBody) - curIndent.Pop (); + curIndent.Pop(); FixClosingBrace(policy.NamespaceBraceStyle, namespaceDeclaration.RBraceToken); } @@ -113,16 +118,19 @@ namespace ICSharpCode.NRefactory.CSharp void FixAttributes(EntityDeclaration entity) { if (entity.Attributes.Count > 0) { - AstNode n = null;; + AstNode n = null; foreach (var attr in entity.Attributes.Skip (1)) { FixIndentation(attr); n = attr; } - if (n != null) - FixIndentation(n.GetNextNode (NoWhitespacePredicate)); + if (n != null) { + FixIndentation(n.GetNextNode(NoWhitespacePredicate)); + } else { + FixIndentation(entity.Attributes.First().GetNextNode(NoWhitespacePredicate)); + } } } - + public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration) { FixAttributes(typeDeclaration); @@ -153,15 +161,23 @@ namespace ICSharpCode.NRefactory.CSharp if (indentBody) curIndent.Push(IndentType.Block); - - VisitChildrenToFormat (typeDeclaration, child => { - if (child.Role != Roles.TypeMemberRole) + bool startFormat = false; + VisitChildrenToFormat(typeDeclaration, child => { + if (child.Role == Roles.LBrace) { + startFormat = true; + return; + } + if (child.Role == Roles.RBrace) { + startFormat = false; + return; + } + if (!startFormat || !NoWhitespacePredicate (child)) return; if (NoWhitespacePredicate(child)) FixIndentationForceNewLine(child); - child.AcceptVisitor (this); + child.AcceptVisitor(this); if (NoWhitespacePredicate(child)) - EnsureNewLinesAfter(child, GetTypeLevelNewLinesFor (child)); + EnsureNewLinesAfter(child, GetTypeLevelNewLinesFor(child)); }); if (indentBody) @@ -174,7 +190,8 @@ namespace ICSharpCode.NRefactory.CSharp { var blankLines = 1; var nextSibling = child.GetNextSibling(NoWhitespacePredicate); - + if (child is PreProcessorDirective || child is Comment) + return 1; if (child is EventDeclaration) { if (nextSibling is EventDeclaration) { blankLines += policy.BlankLinesBetweenEventFields; @@ -198,7 +215,6 @@ namespace ICSharpCode.NRefactory.CSharp if (nextSibling.Role == Roles.TypeMemberRole) blankLines += policy.BlankLinesBetweenMembers; - return blankLines; } @@ -216,7 +232,7 @@ namespace ICSharpCode.NRefactory.CSharp base.VisitDelegateDeclaration(delegateDeclaration); } - + public override void VisitComment(Comment comment) { if (comment.StartsLine && !HadErrors && (!policy.KeepCommentsAtFirstColumn || comment.StartLocation.Column > 1)) diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs index 1bc3b17318..db054020ee 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs @@ -23,7 +23,6 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. - using System; using System.IO; using NUnit.Framework; @@ -42,7 +41,6 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests Test(policy, @" using Foo;", @"using Foo;"); } - [Test] public void TestUsingDeclarationsWithHeader() { @@ -63,70 +61,106 @@ using Foo;"); } [Test] - public void TestClassIndentation () + public void TestPreProcessorIndenting() + { + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); + policy.ClassBraceStyle = BraceStyle.DoNotChange; + + Test(policy, + @" +class Test { + #region FooBar + #endregion +}", + @" +class Test { + #region FooBar + #endregion +}"); + } + + [Test] + public void TestTypeWithAttributeIndenging() + { + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); + policy.ClassBraceStyle = BraceStyle.DoNotChange; + + Test(policy, + @" + [Attr] + class Test { +}", + @" +[Attr] +class Test { +}"); + } + + [Test] + public void TestClassIndentation() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.ClassBraceStyle = BraceStyle.DoNotChange; - Test (policy, -@" class Test {}", -@"class Test {}"); + Test(policy, + @" class Test {}", + @"class Test {}"); } - + [Test] - public void TestAttributeIndentation () + public void TestAttributeIndentation() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.ClassBraceStyle = BraceStyle.DoNotChange; - Test (policy, -@" [Attribute1] + Test(policy, + @" [Attribute1] [Attribute2()] class Test {}", -@"[Attribute1] + @"[Attribute1] [Attribute2()] class Test {}"); } - + [Test] - public void TestClassIndentationInNamespaces () + public void TestClassIndentationInNamespaces() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.NamespaceBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.DoNotChange; - Test (policy, -@"namespace A { class Test {} }", -@"namespace A { + Test(policy, + @"namespace A { class Test {} }", + @"namespace A { class Test {} }"); } - + [Test] - public void TestNoIndentationInNamespaces () + public void TestNoIndentationInNamespaces() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.NamespaceBraceStyle = BraceStyle.EndOfLine; policy.ClassBraceStyle = BraceStyle.DoNotChange; policy.IndentNamespaceBody = false; - Test (policy, -@"namespace A { class Test {} }", -@"namespace A { + Test(policy, + @"namespace A { class Test {} }", + @"namespace A { class Test {} }"); } - + [Test] - public void TestClassIndentationInNamespacesCase2 () + public void TestClassIndentationInNamespacesCase2() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.NamespaceBraceStyle = BraceStyle.NextLine; policy.ClassBraceStyle = BraceStyle.NextLine; policy.ConstructorBraceStyle = BraceStyle.NextLine; - Test (policy, -@"using System; + Test(policy, + @"using System; namespace MonoDevelop.CSharp.Formatting { public class FormattingProfileService { @@ -134,7 +168,7 @@ namespace MonoDevelop.CSharp.Formatting { } } }", -@"using System; + @"using System; namespace MonoDevelop.CSharp.Formatting { @@ -146,14 +180,14 @@ namespace MonoDevelop.CSharp.Formatting } }"); } - + [Test] - public void TestIndentClassBody () + public void TestIndentClassBody() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.IndentClassBody = true; - Test (policy, -@"class Test + Test(policy, + @"class Test { Test a; }", @"class Test @@ -162,25 +196,25 @@ namespace MonoDevelop.CSharp.Formatting }"); policy.IndentClassBody = false; - Test (policy, -@"class Test + Test(policy, + @"class Test { Test a; }", -@"class Test + @"class Test { Test a; }"); } - + [Test] - public void TestIndentInterfaceBody () + public void TestIndentInterfaceBody() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.IndentInterfaceBody = true; - Test (policy, -@"interface Test + Test(policy, + @"interface Test { Test Foo (); }", @"interface Test @@ -188,8 +222,8 @@ Test a; Test Foo (); }"); policy.IndentInterfaceBody = false; - Test (policy, -@"interface Test + Test(policy, + @"interface Test { Test Foo (); }", @"interface Test @@ -197,15 +231,15 @@ Test a; Test Foo (); }"); } - + [Test] - public void TestIndentStructBody () + public void TestIndentStructBody() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.IndentStructBody = true; - Test (policy, -@"struct Test + Test(policy, + @"struct Test { Test Foo (); }", @"struct Test @@ -213,8 +247,8 @@ Test Foo (); Test Foo (); }"); policy.IndentStructBody = false; - Test (policy, -@"struct Test + Test(policy, + @"struct Test { Test Foo (); }", @"struct Test @@ -222,15 +256,15 @@ Test Foo (); Test Foo (); }"); } - + [Test] - public void TestIndentEnumBody () + public void TestIndentEnumBody() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.IndentEnumBody = true; - Test (policy, -@"enum Test + Test(policy, + @"enum Test { A }", @"enum Test @@ -238,8 +272,8 @@ Test Foo (); A }"); policy.IndentEnumBody = false; - Test (policy, -@"enum Test + Test(policy, + @"enum Test { A }", @"enum Test @@ -247,15 +281,15 @@ Test Foo (); A }"); } - + [Test] - public void TestIndentMethodBody () + public void TestIndentMethodBody() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.IndentMethodBody = true; - Test (policy, -@"class Test + Test(policy, + @"class Test { Test Foo () { @@ -263,7 +297,7 @@ A ; } }", -@"class Test + @"class Test { Test Foo () { @@ -272,8 +306,8 @@ A } }"); policy.IndentMethodBody = false; - Test (policy, -@"class Test + Test(policy, + @"class Test { Test Foo () { @@ -281,7 +315,7 @@ A ; } }", -@"class Test + @"class Test { Test Foo () { @@ -290,15 +324,15 @@ A } }"); } - + [Test] - public void TestIndentMethodBodyOperatorCase () + public void TestIndentMethodBodyOperatorCase() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.IndentMethodBody = true; - var adapter = Test (policy, -@"class Test + var adapter = Test(policy, + @"class Test { static Test operator+(Test left, Test right) { @@ -306,7 +340,7 @@ A ; } }", -@"class Test + @"class Test { static Test operator+ (Test left, Test right) { @@ -315,7 +349,7 @@ A } }"); policy.IndentMethodBody = false; - Continue (policy, adapter, @"class Test + Continue(policy, adapter, @"class Test { static Test operator+ (Test left, Test right) { @@ -324,22 +358,22 @@ A } }"); } - + [Test] - public void TestIndentPropertyBody () + public void TestIndentPropertyBody() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.IndentPropertyBody = true; - var adapter = Test (policy, -@"class Test + var adapter = Test(policy, + @"class Test { Test TestMe { get; set; } }", -@"class Test + @"class Test { Test TestMe { get; @@ -348,8 +382,8 @@ set; }"); policy.IndentPropertyBody = false; - Continue (policy, adapter, -@"class Test + Continue(policy, adapter, + @"class Test { Test TestMe { get; @@ -357,53 +391,53 @@ set; } }"); } - + [Test] - public void TestIndentPropertyOneLine () + public void TestIndentPropertyOneLine() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.PropertyFormatting = PropertyFormatting.AllowOneLine; policy.AllowPropertyGetBlockInline = true; policy.AllowPropertySetBlockInline = true; - Test (policy, -@"class Test + Test(policy, + @"class Test { Test TestMe { get;set; } }", -@"class Test + @"class Test { Test TestMe { get; set; } }"); } - + [Test] - public void TestIndentPropertyOneLineCase2 () + public void TestIndentPropertyOneLineCase2() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.PropertyFormatting = PropertyFormatting.AllowOneLine; policy.AllowPropertyGetBlockInline = true; policy.AllowPropertySetBlockInline = true; - Test (policy, -@"class Test + Test(policy, + @"class Test { Test TestMe { get { ; }set{;} } }", -@"class Test + @"class Test { Test TestMe { get { ; } set { ; } } }"); } - + [Test] - public void TestIndentPropertyBodyIndexerCase () + public void TestIndentPropertyBodyIndexerCase() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.IndentPropertyBody = true; - var adapter = Test (policy, -@"class Test + var adapter = Test(policy, + @"class Test { Test this[int a] { get { @@ -414,7 +448,7 @@ set { } } }", -@"class Test + @"class Test { Test this [int a] { get { @@ -426,8 +460,8 @@ set { } }"); policy.IndentPropertyBody = false; - Continue (policy, adapter, -@"class Test + Continue(policy, adapter, + @"class Test { Test this [int a] { get { @@ -439,24 +473,24 @@ set { } }"); } - + [Test] - public void TestPropertyAlignment () + public void TestPropertyAlignment() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.PropertyFormatting = PropertyFormatting.AllowOneLine; - var adapter = Test (policy, -@"class Test + var adapter = Test(policy, + @"class Test { Test TestMe { get; set; } }", -@"class Test + @"class Test { Test TestMe { get; set; } }"); policy.PropertyFormatting = PropertyFormatting.ForceNewLine; - Continue (policy, adapter, -@"class Test + Continue(policy, adapter, + @"class Test { Test TestMe { get; @@ -465,84 +499,82 @@ set { }"); policy.PropertyFormatting = PropertyFormatting.ForceOneLine; - Continue (policy, adapter, -@"class Test + Continue(policy, adapter, + @"class Test { Test TestMe { get; set; } }"); } - [Test] - public void TestIndentNamespaceBody () + public void TestIndentNamespaceBody() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.ClassBraceStyle = BraceStyle.DoNotChange; policy.NamespaceBraceStyle = BraceStyle.EndOfLine; policy.IndentNamespaceBody = true; - var adapter = Test (policy, -@" namespace Test { + var adapter = Test(policy, + @" namespace Test { class FooBar {} }", -@"namespace Test { + @"namespace Test { class FooBar {} }"); policy.IndentNamespaceBody = false; - Continue (policy, adapter, -@"namespace Test { + Continue(policy, adapter, + @"namespace Test { class FooBar {} }"); } - - + [Test] - public void TestMethodIndentation () + public void TestMethodIndentation() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.MethodBraceStyle = BraceStyle.DoNotChange; - Test (policy, -@"class Test + Test(policy, + @"class Test { MyType TestMethod () {} }", -@"class Test + @"class Test { MyType TestMethod () {} }"); } - + [Test] - public void TestPropertyIndentation () + public void TestPropertyIndentation() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.PropertyBraceStyle = BraceStyle.DoNotChange; - Test (policy, -@"class Test + Test(policy, + @"class Test { public int Prop { get; set; } -}",@"class Test +}", @"class Test { public int Prop { get; set; } }"); } - + [Test] - public void TestPropertyIndentationCase2 () + public void TestPropertyIndentationCase2() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); - Test (policy, -@"class Test + Test(policy, + @"class Test { public int Prop { get; set; } }", -@"class Test + @"class Test { public int Prop { get; @@ -552,31 +584,32 @@ set; } [Test] - public void TestPropertyIndentationClosingBracketCorrection () + public void TestPropertyIndentationClosingBracketCorrection() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); - Test (policy, -@"class Test + Test(policy, + @"class Test { public int Prop { get; } -}",@"class Test +}", @"class Test { public int Prop { get; } }"); } + [Test] - public void TestPropertyIndentationClosingBracketCorrection2 () + public void TestPropertyIndentationClosingBracketCorrection2() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); - Test (policy, -@"class Test + Test(policy, + @"class Test { public int Prop { get;} -}",@"class Test +}", @"class Test { public int Prop { get; @@ -603,13 +636,13 @@ set; } [Test] - public void TestIndentEventBody () + public void TestIndentEventBody() { - CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono (); + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.IndentEventBody = true; - var adapter = Test (policy, -@"class Test + var adapter = Test(policy, + @"class Test { public event EventHandler TestMe { add { @@ -620,7 +653,7 @@ remove { } } }", -@"class Test + @"class Test { public event EventHandler TestMe { add { @@ -632,8 +665,8 @@ remove { } }"); policy.IndentEventBody = false; - Continue (policy, adapter, -@"class Test + Continue(policy, adapter, + @"class Test { public event EventHandler TestMe { add { @@ -646,7 +679,6 @@ remove { }"); } - /// /// Bug 9990 - Formatting a document on save splits event into 'e vent' /// From 9521f329b31ad299158a853c1f29da6a25c108ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Wed, 15 May 2013 07:42:46 +0200 Subject: [PATCH 12/55] Fixed formatting bug. --- .../Ast/TypeMembers/EnumMemberDeclaration.cs | 6 ++- .../Formatter/FormattingVisitor_Global.cs | 7 +++- .../FormattingVisitor_TypeMembers.cs | 7 +++- .../TestTypeLevelIndentation.cs | 40 +++++++++++++++++++ 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs index 8f05e4e2ab..8aabb39f91 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EnumMemberDeclaration.cs @@ -36,7 +36,11 @@ namespace ICSharpCode.NRefactory.CSharp public override EntityType EntityType { get { return EntityType.Field; } } - + + public CSharpTokenNode AssignToken { + get { return GetChildByRole (Roles.Assign); } + } + public Expression Initializer { get { return GetChildByRole (InitializerRole); } set { SetChildByRole (InitializerRole, value); } diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs index ca3f552c2d..f0967cf779 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs @@ -173,10 +173,15 @@ namespace ICSharpCode.NRefactory.CSharp } if (!startFormat || !NoWhitespacePredicate (child)) return; + if (child.Role == Roles.Comma) { + ForceSpacesBeforeRemoveNewLines (child, false); + EnsureNewLinesAfter(child, 1); + return; + } if (NoWhitespacePredicate(child)) FixIndentationForceNewLine(child); child.AcceptVisitor(this); - if (NoWhitespacePredicate(child)) + if (NoWhitespacePredicate(child) && child.GetNextSibling (NoWhitespacePredicate).Role != Roles.Comma) EnsureNewLinesAfter(child, GetTypeLevelNewLinesFor(child)); }); diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs index 0a7671c72d..1f3a0ff7e2 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs @@ -316,8 +316,11 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration) { FixAttributes(enumMemberDeclaration); - - base.VisitEnumMemberDeclaration(enumMemberDeclaration); + var initializer = enumMemberDeclaration.Initializer; + if (!initializer.IsNull) { + ForceSpacesAround(enumMemberDeclaration.AssignToken, policy.SpaceAroundAssignment); + initializer.AcceptVisitor (this); + } } public override void VisitMethodDeclaration(MethodDeclaration methodDeclaration) diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs index db054020ee..c0e88c8fcf 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs @@ -282,6 +282,46 @@ A }"); } + [Test] + public void TestIndentEnumBodyCase2() + { + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); + policy.IndentEnumBody = true; + + Test(policy, + @"enum Test +{ + A , + B, +C +}", @"enum Test +{ + A, + B, + C +}"); + } + + [Test] + public void TestIndentEnumBodyCase3() + { + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); + policy.IndentEnumBody = true; + + Test(policy, + @"enum Test +{ + A = 3 + 5, + B=5 , +C=5 << 12 +}", @"enum Test +{ + A = 3 + 5, + B = 5, + C = 5 << 12 +}"); + } + [Test] public void TestIndentMethodBody() { From 7a5afe919f79288aa84c80e8c5ca047e00cc3383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Wed, 15 May 2013 08:33:53 +0200 Subject: [PATCH 13/55] Fixed some issues in event formatting. --- .../Ast/Statements/BreakStatement.cs | 2 +- .../Ast/TypeMembers/EntityDeclaration.cs | 6 +++++- .../Ast/TypeMembers/EventDeclaration.cs | 6 +++++- .../FormattingVisitor_TypeMembers.cs | 12 +++++++++++ .../TestTypeLevelIndentation.cs | 20 +++++++++++++++++++ 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Ast/Statements/BreakStatement.cs b/ICSharpCode.NRefactory.CSharp/Ast/Statements/BreakStatement.cs index 056cf55e46..4bb4e39ef7 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/Statements/BreakStatement.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Statements/BreakStatement.cs @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.CSharp public CSharpTokenNode SemicolonToken { get { return GetChildByRole (Roles.Semicolon); } } - + public override void AcceptVisitor (IAstVisitor visitor) { visitor.VisitBreakStatement (this); diff --git a/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EntityDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EntityDeclaration.cs index ed652fe3e3..8ba649f4de 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EntityDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EntityDeclaration.cs @@ -71,7 +71,11 @@ namespace ICSharpCode.NRefactory.CSharp get { return GetChildByRole (Roles.Type); } set { SetChildByRole(Roles.Type, value); } } - + + public CSharpTokenNode SemicolonToken { + get { return GetChildByRole (Roles.Semicolon); } + } + internal static Modifiers GetModifiers(AstNode node) { Modifiers m = 0; diff --git a/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EventDeclaration.cs b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EventDeclaration.cs index 7e338af2cc..9c9e900e3b 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EventDeclaration.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/EventDeclaration.cs @@ -39,7 +39,11 @@ namespace ICSharpCode.NRefactory.CSharp public override EntityType EntityType { get { return EntityType.Event; } } - + + public CSharpTokenNode EventToken { + get { return GetChildByRole (EventKeywordRole); } + } + public AstNodeCollection Variables { get { return GetChildrenByRole (Roles.Variable); } } diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs index 1f3a0ff7e2..dc82a935e5 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs @@ -261,6 +261,14 @@ namespace ICSharpCode.NRefactory.CSharp { FixAttributes(eventDeclaration); + foreach (var m in eventDeclaration.ModifierTokens) { + ForceSpacesAfter(m, true); + } + + ForceSpacesBeforeRemoveNewLines(eventDeclaration.EventToken.GetNextSibling (NoWhitespacePredicate), true); + eventDeclaration.ReturnType.AcceptVisitor(this); + ForceSpacesAfter(eventDeclaration.ReturnType, true); + /* var lastLoc = eventDeclaration.StartLocation; curIndent.Push(IndentType.Block); foreach (var initializer in eventDeclaration.Variables) { @@ -271,6 +279,8 @@ namespace ICSharpCode.NRefactory.CSharp initializer.AcceptVisitor(this); } curIndent.Pop (); + */ + FixSemicolon(eventDeclaration.SemicolonToken); } @@ -293,6 +303,7 @@ namespace ICSharpCode.NRefactory.CSharp } initializer.AcceptVisitor(this); } + FixSemicolon(fieldDeclaration.SemicolonToken); } public override void VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration) @@ -311,6 +322,7 @@ namespace ICSharpCode.NRefactory.CSharp initializer.AcceptVisitor(this); } curIndent.Pop (); + FixSemicolon(fixedFieldDeclaration.SemicolonToken); } public override void VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration) diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs index c0e88c8fcf..d984bf3aa0 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs @@ -675,6 +675,26 @@ set; }"); } + [Test] + public void TestEventField() + { + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); + + Test(policy, +@"class Test +{ + public event + + EventHandler TestMe ; +}", +@"class Test +{ + public event EventHandler TestMe; +}"); + + } + + [Test] public void TestIndentEventBody() { From a256898faae56a154a24c0d6fa6322c95b799923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Wed, 15 May 2013 08:43:43 +0200 Subject: [PATCH 14/55] Fixed formatting bug. --- .../Formatter/FormattingVisitor_Global.cs | 9 +++++-- .../FormattingVisitor_TypeMembers.cs | 26 +++++++++---------- .../TestTypeLevelIndentation.cs | 20 ++++++++++++++ 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs index f0967cf779..8a2a77c076 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs @@ -115,8 +115,13 @@ namespace ICSharpCode.NRefactory.CSharp FixClosingBrace(policy.NamespaceBraceStyle, namespaceDeclaration.RBraceToken); } - void FixAttributes(EntityDeclaration entity) + void FixAttributesAndDocComment(EntityDeclaration entity) { + var node =entity.FirstChild; + while (node != null && node.Role == Roles.Comment) { + FixIndentation(node); + node = node.GetNextSibling(NoWhitespacePredicate); + } if (entity.Attributes.Count > 0) { AstNode n = null; foreach (var attr in entity.Attributes.Skip (1)) { @@ -133,7 +138,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration) { - FixAttributes(typeDeclaration); + FixAttributesAndDocComment(typeDeclaration); BraceStyle braceStyle; bool indentBody = false; switch (typeDeclaration.ClassType) { diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs index dc82a935e5..d3abd82f9e 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs @@ -32,7 +32,7 @@ namespace ICSharpCode.NRefactory.CSharp { public override void VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration) { - FixAttributes(propertyDeclaration); + FixAttributesAndDocComment(propertyDeclaration); bool oneLine = false; bool fixClosingBrace = false; switch (policy.PropertyFormatting) { @@ -158,7 +158,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitAccessor(Accessor accessor) { - FixAttributes(accessor); + FixAttributesAndDocComment(accessor); base.VisitAccessor(accessor); } @@ -166,7 +166,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration) { - FixAttributes(indexerDeclaration); + FixAttributesAndDocComment(indexerDeclaration); ForceSpacesBefore(indexerDeclaration.LBracketToken, policy.SpaceBeforeIndexerDeclarationBracket); ForceSpacesAfter(indexerDeclaration.LBracketToken, policy.SpaceWithinIndexerDeclarationBracket); @@ -217,7 +217,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration) { - FixAttributes(eventDeclaration); + FixAttributesAndDocComment(eventDeclaration); FixOpenBrace(policy.EventBraceStyle, eventDeclaration.LBraceToken); if (policy.IndentEventBody) @@ -259,7 +259,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitEventDeclaration(EventDeclaration eventDeclaration) { - FixAttributes(eventDeclaration); + FixAttributesAndDocComment(eventDeclaration); foreach (var m in eventDeclaration.ModifierTokens) { ForceSpacesAfter(m, true); @@ -286,14 +286,14 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitFieldDeclaration(FieldDeclaration fieldDeclaration) { - FixAttributes(fieldDeclaration); + FixAttributesAndDocComment(fieldDeclaration); fieldDeclaration.ReturnType.AcceptVisitor(this); ForceSpacesAfter(fieldDeclaration.ReturnType, true); FormatCommas(fieldDeclaration, policy.SpaceBeforeFieldDeclarationComma, policy.SpaceAfterFieldDeclarationComma); - var lastLoc = fieldDeclaration.StartLocation; + var lastLoc = fieldDeclaration.ReturnType.StartLocation; foreach (var initializer in fieldDeclaration.Variables) { if (lastLoc.Line != initializer.StartLocation.Line) { curIndent.Push(IndentType.Block); @@ -308,7 +308,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration) { - FixAttributes(fixedFieldDeclaration); + FixAttributesAndDocComment(fixedFieldDeclaration); FormatCommas(fixedFieldDeclaration, policy.SpaceBeforeFieldDeclarationComma, policy.SpaceAfterFieldDeclarationComma); @@ -327,7 +327,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration) { - FixAttributes(enumMemberDeclaration); + FixAttributesAndDocComment(enumMemberDeclaration); var initializer = enumMemberDeclaration.Initializer; if (!initializer.IsNull) { ForceSpacesAround(enumMemberDeclaration.AssignToken, policy.SpaceAroundAssignment); @@ -337,7 +337,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitMethodDeclaration(MethodDeclaration methodDeclaration) { - FixAttributes(methodDeclaration); + FixAttributesAndDocComment(methodDeclaration); ForceSpacesBefore(methodDeclaration.LParToken, policy.SpaceBeforeMethodDeclarationParentheses); if (methodDeclaration.Parameters.Any()) { @@ -357,7 +357,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration) { - FixAttributes(operatorDeclaration); + FixAttributesAndDocComment(operatorDeclaration); ForceSpacesBefore(operatorDeclaration.LParToken, policy.SpaceBeforeMethodDeclarationParentheses); if (operatorDeclaration.Parameters.Any()) { @@ -377,7 +377,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration) { - FixAttributes(constructorDeclaration); + FixAttributesAndDocComment(constructorDeclaration); ForceSpacesBefore(constructorDeclaration.LParToken, policy.SpaceBeforeConstructorDeclarationParentheses); if (constructorDeclaration.Parameters.Any()) { @@ -397,7 +397,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration) { - FixAttributes(destructorDeclaration); + FixAttributesAndDocComment(destructorDeclaration); CSharpTokenNode lParen = destructorDeclaration.LParToken; ForceSpaceBefore(lParen, policy.SpaceBeforeConstructorDeclarationParentheses); diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs index d984bf3aa0..ca82ab0406 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs @@ -207,6 +207,26 @@ Test a; }"); } + [Test] + public void TestDocCommentIndenting() + { + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); + Test(policy, + @"class Test +{ + /// + /// Test + /// + Test a; +}", @"class Test +{ + /// + /// Test + /// + Test a; +}"); + } + [Test] public void TestIndentInterfaceBody() { From d8f68d6c0198f04dd5b9fd7a1ab30578f2f76430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 17 May 2013 10:57:25 +0200 Subject: [PATCH 15/55] The redundant assignment is now better at choosing the node which it grays out. --- .../CodeIssues/RedundantAssignmentIssue.cs | 171 +++++++++--------- 1 file changed, 90 insertions(+), 81 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAssignmentIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAssignmentIssue.cs index 2847f7915c..b8fb85d89b 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAssignmentIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAssignmentIssue.cs @@ -172,8 +172,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring private bool foundInvocations; private string _varName; - public bool ContainsRefOrOut(VariableInitializer variableInitializer) - { + public bool ContainsRefOrOut(VariableInitializer variableInitializer) + { var node = variableInitializer.Parent.Parent; foundInvocations = false; _varName = variableInitializer.Name; @@ -181,8 +181,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return foundInvocations; } - protected override void VisitChildren(AstNode node) - { + protected override void VisitChildren(AstNode node) + { AstNode next; for (var child = node.FirstChild; child != null && !foundInvocations; child = next) { next = child.NextSibling; @@ -213,36 +213,39 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring } } - class SearchAssignmentForVarVisitor : DepthFirstAstVisitor - { - bool _foundInvocations; - private VariableInitializer _variableInitializer; - - public bool ContainsLaterAssignments(VariableInitializer variableInitializer) { - _foundInvocations = false; - _variableInitializer = variableInitializer; - variableInitializer.Parent.Parent.AcceptVisitor(this); - return _foundInvocations; - } - - protected override void VisitChildren(AstNode node) { - AstNode next; - for (var child = node.FirstChild; child != null && !_foundInvocations; child = next) { - next = child.NextSibling; - child.AcceptVisitor(this); - } - } - public override void VisitAssignmentExpression(AssignmentExpression assignmentExpression) - { - if (_foundInvocations) - return; - base.VisitAssignmentExpression(assignmentExpression); - if (assignmentExpression.Left.ToString() == _variableInitializer.Name - && assignmentExpression.StartLocation > _variableInitializer.StartLocation) { - _foundInvocations = true; - } - } - } + class SearchAssignmentForVarVisitor : DepthFirstAstVisitor + { + bool _foundInvocations; + private VariableInitializer _variableInitializer; + + public bool ContainsLaterAssignments(VariableInitializer variableInitializer) + { + _foundInvocations = false; + _variableInitializer = variableInitializer; + variableInitializer.Parent.Parent.AcceptVisitor(this); + return _foundInvocations; + } + + protected override void VisitChildren(AstNode node) + { + AstNode next; + for (var child = node.FirstChild; child != null && !_foundInvocations; child = next) { + next = child.NextSibling; + child.AcceptVisitor(this); + } + } + + public override void VisitAssignmentExpression(AssignmentExpression assignmentExpression) + { + if (_foundInvocations) + return; + base.VisitAssignmentExpression(assignmentExpression); + if (assignmentExpression.Left.ToString() == _variableInitializer.Name + && assignmentExpression.StartLocation > _variableInitializer.StartLocation) { + _foundInvocations = true; + } + } + } void AddIssue(AstNode node) { @@ -253,52 +256,61 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring var containsInvocations = new SearchInvocationsVisitor().ContainsInvocations(variableInitializer.Initializer); - var varDecl = node.Parent as VariableDeclarationStatement; + var varDecl = node.Parent as VariableDeclarationStatement; - var isDeclareStatement = varDecl != null; - var isUsingVar = isDeclareStatement && varDecl.Type.IsVar(); + var isDeclareStatement = varDecl != null; + var isUsingVar = isDeclareStatement && varDecl.Type.IsVar(); - var expressionType = ctx.Resolve(node).Type; + var expressionType = ctx.Resolve(node).Type; - var containsLaterAssignments = false; - if (isDeclareStatement) { - //if it is used later, the redundant removal should remove the assignment - //but not the variable - containsLaterAssignments = - new SearchAssignmentForVarVisitor().ContainsLaterAssignments(variableInitializer); - } + var containsLaterAssignments = false; + if (isDeclareStatement) { + //if it is used later, the redundant removal should remove the assignment + //but not the variable + containsLaterAssignments = + new SearchAssignmentForVarVisitor().ContainsLaterAssignments(variableInitializer); + } - AddIssue(variableInitializer.Initializer, title, - script => { + AstNode grayOutNode; + var containsRefOrOut = new SearchRefOrOutVisitor().ContainsRefOrOut(variableInitializer); + if (containsInvocations && isDeclareStatement) { + grayOutNode = variableInitializer.AssignToken; + } else { + if (isDeclareStatement && !containsRefOrOut && !containsLaterAssignments) { + grayOutNode = variableInitializer.Parent; + } else { + grayOutNode = variableInitializer.Initializer; + } + } + + AddIssue(grayOutNode, title, script => { var variableNode = (VariableInitializer)node; if (containsInvocations && isDeclareStatement) { //add the column ';' that will be removed after the next line replacement var expression = (InvocationExpression)variableNode.Initializer.Clone(); var invocation = new ExpressionStatement(expression); - if(containsLaterAssignments && varDecl !=null) { - var clonedDefinition = (VariableDeclarationStatement)varDecl.Clone(); - - var shortExpressionType = CreateShortType(ctx, expressionType, node); - clonedDefinition.Type = shortExpressionType; - var variableNodeClone = clonedDefinition.GetVariable(variableNode.Name); - variableNodeClone.Initializer = null; - script.InsertBefore(node.Parent, clonedDefinition); - } - script.Replace(node.Parent, invocation); + if (containsLaterAssignments && varDecl != null) { + var clonedDefinition = (VariableDeclarationStatement)varDecl.Clone(); + + var shortExpressionType = CreateShortType(ctx, expressionType, node); + clonedDefinition.Type = shortExpressionType; + var variableNodeClone = clonedDefinition.GetVariable(variableNode.Name); + variableNodeClone.Initializer = null; + script.InsertBefore(node.Parent, clonedDefinition); + } + script.Replace(node.Parent, invocation); + return; + } + if (isDeclareStatement && !containsRefOrOut && !containsLaterAssignments) { + script.Remove(node.Parent); return; } - var containsRefOrOut = - new SearchRefOrOutVisitor().ContainsRefOrOut(variableInitializer); - if (isDeclareStatement && !containsRefOrOut && !containsLaterAssignments) { - script.Remove(node.Parent); - return; - } var replacement = (VariableInitializer)variableNode.Clone(); replacement.Initializer = Expression.Null; - if(isUsingVar) { - var shortExpressionType = CreateShortType(ctx, expressionType, node); - script.Replace(varDecl.Type, shortExpressionType); - } + if (isUsingVar) { + var shortExpressionType = CreateShortType(ctx, expressionType, node); + script.Replace(varDecl.Type, shortExpressionType); + } script.Replace(node, replacement); }); } @@ -314,14 +326,15 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring } } - private static AstType CreateShortType(BaseRefactoringContext refactoringContext, IType expressionType, AstNode node) { + private static AstType CreateShortType(BaseRefactoringContext refactoringContext, IType expressionType, AstNode node) + { - var csResolver = refactoringContext.Resolver.GetResolverStateBefore(node); - var builder = new TypeSystemAstBuilder(csResolver); - return builder.ConvertType(expressionType); - } + var csResolver = refactoringContext.Resolver.GetResolverStateBefore(node); + var builder = new TypeSystemAstBuilder(csResolver); + return builder.ConvertType(expressionType); + } - static bool IsAssignment(AstNode node) + static bool IsAssignment(AstNode node) { if (node is VariableInitializer) return true; @@ -347,14 +360,10 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring enum NodeState { - None -, - UsageReachable -, - UsageUnreachable -, - Processing -, + None, + UsageReachable, + UsageUnreachable, + Processing, } void ProcessNodes(VariableReferenceNode startNode) From 67770bcacc3f6f476e8a213922026ffaa5129c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 17 May 2013 11:29:33 +0200 Subject: [PATCH 16/55] Added constraint new () parens to the AST / fixed constraint formatting bug. --- .../Formatter/FormattingVisitor_Global.cs | 18 +++++++++++++ .../FormattingVisitor_TypeMembers.cs | 3 +++ .../Parser/CSharpParser.cs | 21 +++++++++++++-- .../FormattingTests/TestFormattingBugs.cs | 26 +++++++++++++++++++ 4 files changed, 66 insertions(+), 2 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs index 8a2a77c076..d84f49c224 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs @@ -161,6 +161,9 @@ namespace ICSharpCode.NRefactory.CSharp default: throw new InvalidOperationException("unsupported class type : " + typeDeclaration.ClassType); } + + foreach (var constraint in typeDeclaration.Constraints) + constraint.AcceptVisitor (this); FixOpenBrace(braceStyle, typeDeclaration.LBraceToken); @@ -248,5 +251,20 @@ namespace ICSharpCode.NRefactory.CSharp if (comment.StartsLine && !HadErrors && (!policy.KeepCommentsAtFirstColumn || comment.StartLocation.Column > 1)) FixIndentation(comment); } + + public override void VisitConstraint(Constraint constraint) + { + VisitChildrenToFormat (constraint, node => { + if (node is AstType) { + node.AcceptVisitor (this); + } else if (node.Role == Roles.LPar) { + ForceSpacesBefore (node, false); + ForceSpacesAfter (node, false); + } else if (node.Role ==Roles.Comma) { + ForceSpacesBefore (node, false); + ForceSpacesAfter (node, true); + } + }); + } } } \ No newline at end of file diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs index d3abd82f9e..415450457e 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs @@ -347,6 +347,9 @@ namespace ICSharpCode.NRefactory.CSharp ForceSpacesAfter(methodDeclaration.LParToken, policy.SpaceBetweenEmptyMethodDeclarationParentheses); ForceSpacesBefore(methodDeclaration.RParToken, policy.SpaceBetweenEmptyMethodDeclarationParentheses); } + + foreach (var constraint in methodDeclaration.Constraints) + constraint.AcceptVisitor (this); if (!methodDeclaration.Body.IsNull) { FixOpenBrace(policy.MethodBraceStyle, methodDeclaration.Body.LBraceToken); diff --git a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index 5eff5f6c4f..59b829a154 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -261,9 +261,9 @@ namespace ICSharpCode.NRefactory.CSharp switch (sce.Constraint) { case SpecialConstraint.Class: return new PrimitiveType ("class", Convert (sce.Location)); - case SpecialConstraint.Struct: + case SpecialConstraint.Struct: return new PrimitiveType ("struct", Convert (sce.Location)); - case SpecialConstraint.Constructor: + case SpecialConstraint.Constructor: return new PrimitiveType ("new", Convert (sce.Location)); } } @@ -2651,6 +2651,23 @@ namespace ICSharpCode.NRefactory.CSharp if (c.ConstraintExpressions != null) { foreach (var expr in c.ConstraintExpressions) { constraint.AddChild (ConvertToType (expr), Roles.BaseType); + if (expr is SpecialContraintExpr) { + var sce = (SpecialContraintExpr)expr; + switch (sce.Constraint) { + case SpecialConstraint.Class: + break; + case SpecialConstraint.Struct: + break; + case SpecialConstraint.Constructor: + var bl = LocationsBag.GetLocations (expr); + if (bl != null) { + constraint.AddChild (new CSharpTokenNode (Convert (bl[0]), Roles.LPar), Roles.LPar); + constraint.AddChild (new CSharpTokenNode (Convert (bl[1]), Roles.RPar), Roles.RPar); + } + break; + } + } + if (commaLocs != null && curComma < commaLocs.Count) constraint.AddChild (new CSharpTokenNode (Convert (commaLocs [curComma++]), Roles.Comma), Roles.Comma); } diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs index 5ff03ee8ba..1689f20a46 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs @@ -350,6 +350,32 @@ foo (); } }"); } + + + /// + /// Bug 12270 - Code formatter breaks new() constraints + /// + [Test] + public void TestBug12270() + { + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); + + Test(policy, +@"class C +{ + public void Test () where T : new () + { + } +}", +@"class C +{ + public void Test () where T : new() + { + } +}"); + } + + } } From 214d2ea27594a37de1d31173bfcd89e76baf4268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 17 May 2013 12:04:48 +0200 Subject: [PATCH 17/55] Fixed formatting bug. --- .../Formatter/FormattingVisitor_Global.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs index d84f49c224..633371605c 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs @@ -80,6 +80,9 @@ namespace ICSharpCode.NRefactory.CSharp bool first = true; bool startFormat = false; VisitChildrenToFormat(namespaceDeclaration, child => { + if (first) { + startFormat = child.StartLocation > namespaceDeclaration.LBraceToken.StartLocation; + } if (child.Role == Roles.LBrace) { var next = child.GetNextSibling(NoWhitespacePredicate); var blankLines = 1; @@ -169,8 +172,13 @@ namespace ICSharpCode.NRefactory.CSharp if (indentBody) curIndent.Push(IndentType.Block); - bool startFormat = false; + bool startFormat = true; + bool first = true; VisitChildrenToFormat(typeDeclaration, child => { + if (first) { + startFormat = child.StartLocation > typeDeclaration.LBraceToken.StartLocation; + first = false; + } if (child.Role == Roles.LBrace) { startFormat = true; return; From 87440682be31cead072a509541378f4f7965afca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 17 May 2013 12:29:07 +0200 Subject: [PATCH 18/55] Fixed some issues in redundant catch issue. --- .../CodeIssues/RedundantCatchIssue.cs | 29 ++++++-- .../CSharp/CodeIssues/RedundantCatchTests.cs | 73 +++++++++++++++++++ 2 files changed, 97 insertions(+), 5 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs index 9887a4642a..6a25508a5d 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System; using System.Collections.Generic; +using ICSharpCode.NRefactory.TypeSystem; namespace ICSharpCode.NRefactory.CSharp.Refactoring { @@ -122,17 +123,35 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring AddIssue(tryCatchStatement.TryBlock.EndLocation, lastCatch.EndLocation, removeTryCatchMessage, fixes); } - bool IsRedundant(CatchClause catchClause) + static bool IsThrowsClause (CatchClause catchClause) { var firstStatement = catchClause.Body.Statements.FirstOrNullObject(); - if (firstStatement.IsNull) { + if (firstStatement.IsNull) return false; - } var throwStatement = firstStatement as ThrowStatement; - if (throwStatement == null) { + if (throwStatement == null) return false; + return true; + } + + bool IsRedundant(CatchClause catchClause) + { + if (!IsThrowsClause (catchClause)) + return false; + + var type = ctx.Resolve (catchClause.Type).Type; + var n = catchClause.NextSibling; + while (n != null) { + var nextClause = n as CatchClause; + if (nextClause != null) { + if (nextClause.Type.IsNull && !IsThrowsClause(nextClause)) + return false; + if (!IsThrowsClause(nextClause) && type.GetDefinition ().IsDerivedFrom (ctx.Resolve (nextClause.Type).Type.GetDefinition ())) + return false; + } + n = n.NextSibling; } - return throwStatement.Expression.IsNull; + return true; } } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCatchTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCatchTests.cs index 7a67ccb6d7..afae8f7399 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCatchTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCatchTests.cs @@ -218,6 +218,79 @@ class A } }"); } + + /// + /// Bug 12273 - Incorrect redundant catch warning + /// + [Test] + public void TestBug12273() + { + var input = BaseInput + @" + try { + F (); + } catch (ArgumentOutOfRangeException) { + throw; + } catch (Exception e) { + Console.WriteLine (e); + } + } +}"; + TestRefactoringContext context; + var issues = GetIssues(new RedundantCatchIssue(), input, out context); + Assert.AreEqual(0, issues.Count); + + input = BaseInput + @" + try { + F (); + } catch (ArgumentOutOfRangeException) { + throw; + } catch (Exception e) { + throw; + } + } +}"; + issues = GetIssues(new RedundantCatchIssue(), input, out context); + Assert.AreEqual(1, issues.Count); + CheckFix(context, issues, BaseInput + @" + F (); + } +}"); + + } + + /// + /// Bug 12273 - Incorrect redundant catch warning + /// + [Test] + public void TestBug12273Case2() + { + var input = BaseInput + @" + try { + F (); + } catch (ArgumentOutOfRangeException) { + throw; + } catch { + Console.WriteLine (""hello world""); + } + } +}"; + TestRefactoringContext context; + var issues = GetIssues(new RedundantCatchIssue(), input, out context); + Assert.AreEqual(0, issues.Count); + + input = BaseInput + @" + try { + F (); + } catch (ArgumentOutOfRangeException) { + throw; + } catch { + throw; + } + } +}"; + issues = GetIssues(new RedundantCatchIssue(), input, out context); + Assert.AreEqual(1, issues.Count); + } } } From 6eba7eb7983464468473b7aec494e544fd0525eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Sat, 18 May 2013 06:03:28 +0200 Subject: [PATCH 19/55] Moved Severity/IssueMarker to NRefactory. This eliminates a NRefactory.C# dependency in IDE code using these two enums to create the markers & makes it easier to use these enums in other language refactoring plugins. --- .../ICSharpCode.NRefactory.CSharp.csproj | 2 -- .../CodeIssues/AssignmentMadeToSameVariableIssue.cs | 1 + .../CodeIssues/BitwiseOperationOnNonFlagsEnumIssue.cs | 1 + .../Refactoring/CodeIssues/CallToObjectEqualsViaBaseIssue.cs | 1 + .../CodeIssues/CallToVirtualFunctionFromConstructorIssue.cs | 1 + .../CodeIssues/CastExpressionOfIncompatibleTypeIssue.cs | 1 + .../CodeIssues/CompareBooleanWithTrueOrFalseIssue.cs | 1 + .../CodeIssues/CompareFloatWithEqualityOperatorIssue.cs | 1 + .../CS0127ReturnMustNotBeFollowedByAnyExpression.cs | 1 + .../CodeIssues/ConditionalToNullCoalescingIssue.cs | 1 + .../Refactoring/CodeIssues/ConstantConditionIssue.cs | 1 + .../ConstructorIssues/PublicConstructorInAbstractClass.cs | 1 + .../CodeIssues/ConstructorIssues/RedudantConstructorIssue.cs | 1 + .../StaticConstructorAccessModifierIssue.cs | 1 + .../ConstructorIssues/StaticConstructorParameterIssue.cs | 2 +- .../Refactoring/CodeIssues/DoubleNegationIssue.cs | 1 + .../CodeIssues/DuplicateExpressionsInConditionsIssue.cs | 1 + .../Refactoring/CodeIssues/DuplicateIfInIfChainIssue.cs | 1 + .../Refactoring/CodeIssues/ExceptionRethrowIssue.cs | 1 + .../CodeIssues/ExplicitConversionInForEachIssue.cs | 1 + .../CodeIssues/ExpressionIsAlwaysOfProvidedTypeIssue.cs | 1 + .../CodeIssues/ExpressionIsNeverOfProvidedTypeIssue.cs | 1 + .../CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs | 1 + .../CodeIssues/ForControlVariableNotModifiedIssue.cs | 1 + .../CodeIssues/FormatStringIssues/FormatStringIssue.cs | 1 + .../CodeIssues/IdenticalConditionalBranchIssue.cs | 1 + .../InconsistentNamingIssue/InconsistentNamingIssue.cs | 1 + .../CodeIssues/IncorrectCallToObjectGetHashCodeIssue.cs | 1 + .../CodeIssues/IncorrectExceptionParameterOrderingIssue.cs | 1 + .../Refactoring/CodeIssues/MethodNeverReturnsIssue.cs | 1 + .../CodeIssues/MethodOverloadHidesOptionalParameterIssue.cs | 1 + .../Refactoring/CodeIssues/MissingStringComparisonIssue.cs | 1 + .../Refactoring/CodeIssues/MultipleEnumerationIssue.cs | 1 + .../CodeIssues/NegativeRelationalExpressionIssue.cs | 1 + .../Refactoring/CodeIssues/NoDefaultConstructorIssue.cs | 1 + .../Refactoring/CodeIssues/NotImplementedExceptionIssue.cs | 1 + .../CodeIssues/OptionalParameterCouldBeSkippedIssue.cs | 1 + .../ParameterCanBeDemotedIssue/ParameterCanBeDemotedIssue.cs | 1 + .../CodeIssues/RedundantArrayInitializerCommaIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantAssignmentIssue.cs | 1 + .../CodeIssues/RedundantAttributeParenthesesIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantBaseConstructorIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantCaseLabelIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantCatchIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantElseIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantFieldInitializerIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantInternalIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantNamespaceUsageIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantNullCheckIssue.cs | 1 + .../CodeIssues/RedundantObjectCreationArgumentListIssue.cs | 1 + .../RedundantObjectOrCollectionInitializerIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantPrivateIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantThisIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantToStringIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantTypeCastIssue.cs | 1 + .../Refactoring/CodeIssues/RedundantUsingIssue.cs | 1 + .../CodeIssues/RedundantWhereWithPredicateIssue.cs | 1 + .../CodeIssues/ReferenceEqualsCalledWithValueTypeIssue.cs | 1 + .../CodeIssues/ReferenceToStaticMemberViaDerivedTypeIssue.cs | 1 + .../CodeIssues/ResultOfAsyncCallShouldNotBeIgnoredIssue.cs | 1 + .../CodeIssues/SimplifyAnonymousMethodToDelegateIssue.cs | 1 + .../Refactoring/CodeIssues/StaticFieldInGenericTypeIssue.cs | 5 ++--- .../Refactoring/CodeIssues/StringIsNullOrEmptyIssue.cs | 1 + .../CodeIssues/ThreadStaticOnInstanceFieldIssue.cs | 1 + .../Refactoring/CodeIssues/TypeParameterNotUsedIssue.cs | 1 + .../Refactoring/CodeIssues/UnreachableCodeIssue.cs | 1 + .../Refactoring/CodeIssues/UseBlockInsteadColonIssue.cs | 1 + .../Refactoring/CodeIssues/UseVarKeywordIssue.cs | 1 + .../Refactoring/CodeIssues/ValueParameterUnusedIssue.cs | 1 + .../CodeIssues/VariableDeclaredInWideScopeIssue.cs | 1 + .../LocalVariableHidesMemberIssue.cs | 1 + .../VariableHidesMemberIssue/ParameterHidesMemberIssue.cs | 1 + .../VariableNotUsedIssues/LocalVariableNotUsedIssue.cs | 1 + .../VariableNotUsedIssues/ParameterNotUsedIssue.cs | 1 + .../VariableOnlyAssignedIssues/ParameterOnlyAssignedIssue.cs | 1 + ICSharpCode.NRefactory.CSharp/Refactoring/IssueAttribute.cs | 1 + ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj | 3 +++ .../Refactoring/IssueMarker.cs | 2 +- .../Refactoring/Severity.cs | 2 +- 79 files changed, 81 insertions(+), 8 deletions(-) rename {ICSharpCode.NRefactory.CSharp => ICSharpCode.NRefactory}/Refactoring/IssueMarker.cs (97%) rename {ICSharpCode.NRefactory.CSharp => ICSharpCode.NRefactory}/Refactoring/Severity.cs (97%) diff --git a/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj b/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj index e00b9e12be..09f17620ae 100644 --- a/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj +++ b/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj @@ -401,8 +401,6 @@ - - diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/AssignmentMadeToSameVariableIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/AssignmentMadeToSameVariableIssue.cs index 64212157a5..552b836b98 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/AssignmentMadeToSameVariableIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/AssignmentMadeToSameVariableIssue.cs @@ -29,6 +29,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.PatternMatching; +using ICSharpCode.NRefactory.Refactoring; using System.Linq; namespace ICSharpCode.NRefactory.CSharp.Refactoring diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/BitwiseOperationOnNonFlagsEnumIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/BitwiseOperationOnNonFlagsEnumIssue.cs index 42c85a5cdb..aa587d6811 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/BitwiseOperationOnNonFlagsEnumIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/BitwiseOperationOnNonFlagsEnumIssue.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CallToObjectEqualsViaBaseIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CallToObjectEqualsViaBaseIssue.cs index dcfd5026ae..6447e9a9d8 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CallToObjectEqualsViaBaseIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CallToObjectEqualsViaBaseIssue.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.Semantics; using System.Linq; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CallToVirtualFunctionFromConstructorIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CallToVirtualFunctionFromConstructorIssue.cs index 8d196f8553..7decbce088 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CallToVirtualFunctionFromConstructorIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CallToVirtualFunctionFromConstructorIssue.cs @@ -26,6 +26,7 @@ using ICSharpCode.NRefactory.CSharp.Refactoring; using System.Collections.Generic; using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CastExpressionOfIncompatibleTypeIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CastExpressionOfIncompatibleTypeIssue.cs index 45a731f490..3ba8cbc8c4 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CastExpressionOfIncompatibleTypeIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CastExpressionOfIncompatibleTypeIssue.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompareBooleanWithTrueOrFalseIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompareBooleanWithTrueOrFalseIssue.cs index 6b68a4c1de..a791069926 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompareBooleanWithTrueOrFalseIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompareBooleanWithTrueOrFalseIssue.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.PatternMatching; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompareFloatWithEqualityOperatorIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompareFloatWithEqualityOperatorIssue.cs index c587b9fc0c..ce97fbabd8 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompareFloatWithEqualityOperatorIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompareFloatWithEqualityOperatorIssue.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompilerErrors/CS0127ReturnMustNotBeFollowedByAnyExpression.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompilerErrors/CS0127ReturnMustNotBeFollowedByAnyExpression.cs index 983abb5359..c90712157b 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompilerErrors/CS0127ReturnMustNotBeFollowedByAnyExpression.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompilerErrors/CS0127ReturnMustNotBeFollowedByAnyExpression.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.PatternMatching; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConditionalToNullCoalescingIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConditionalToNullCoalescingIssue.cs index 70b3d52918..ae26f10d96 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConditionalToNullCoalescingIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConditionalToNullCoalescingIssue.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.PatternMatching; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs index 3b4002a8f7..f3d639be49 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System.Collections.Generic; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/PublicConstructorInAbstractClass.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/PublicConstructorInAbstractClass.cs index 07a131afd0..995b94d195 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/PublicConstructorInAbstractClass.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/PublicConstructorInAbstractClass.cs @@ -28,6 +28,7 @@ using System.Linq; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/RedudantConstructorIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/RedudantConstructorIssue.cs index 1341dd05af..30004dddf5 100755 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/RedudantConstructorIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/RedudantConstructorIssue.cs @@ -29,6 +29,7 @@ using System.Linq; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/StaticConstructorAccessModifierIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/StaticConstructorAccessModifierIssue.cs index 63388a757f..195eafe335 100755 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/StaticConstructorAccessModifierIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/StaticConstructorAccessModifierIssue.cs @@ -29,6 +29,7 @@ using System.Linq; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/StaticConstructorParameterIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/StaticConstructorParameterIssue.cs index 5be5601f9d..d871ee8df8 100755 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/StaticConstructorParameterIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstructorIssues/StaticConstructorParameterIssue.cs @@ -29,7 +29,7 @@ using System.Linq; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; - +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { [IssueDescription("Static constructor should be parameterless", diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DoubleNegationIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DoubleNegationIssue.cs index 5c86c0bf14..5d3c996950 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DoubleNegationIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DoubleNegationIssue.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System.Collections.Generic; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateExpressionsInConditionsIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateExpressionsInConditionsIssue.cs index d858681b58..f63cf0e785 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateExpressionsInConditionsIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateExpressionsInConditionsIssue.cs @@ -26,6 +26,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.PatternMatching; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateIfInIfChainIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateIfInIfChainIssue.cs index bc14e00f07..34ffcd1d1a 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateIfInIfChainIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateIfInIfChainIssue.cs @@ -26,6 +26,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.PatternMatching; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExceptionRethrowIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExceptionRethrowIssue.cs index 48781ef3ab..4dc5a2492c 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExceptionRethrowIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExceptionRethrowIssue.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExplicitConversionInForEachIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExplicitConversionInForEachIssue.cs index fa8095cbe4..be01bf3ffd 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExplicitConversionInForEachIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExplicitConversionInForEachIssue.cs @@ -21,6 +21,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionIsAlwaysOfProvidedTypeIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionIsAlwaysOfProvidedTypeIssue.cs index e890d40b16..f826238e0d 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionIsAlwaysOfProvidedTypeIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionIsAlwaysOfProvidedTypeIssue.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionIsNeverOfProvidedTypeIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionIsNeverOfProvidedTypeIssue.cs index 428bfe0cb2..d2ecbe47f8 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionIsNeverOfProvidedTypeIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionIsNeverOfProvidedTypeIssue.cs @@ -29,6 +29,7 @@ using System.Linq; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs index 6f72bcf3a3..7dc47d7992 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ForControlVariableNotModifiedIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ForControlVariableNotModifiedIssue.cs index 8da0f5387c..efa8e13bfa 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ForControlVariableNotModifiedIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ForControlVariableNotModifiedIssue.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.PatternMatching; using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringIssue.cs index 60a2f1903d..19b94d6ca2 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringIssue.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.CSharp.Resolver; using System.Linq; using ICSharpCode.NRefactory.Utils; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IdenticalConditionalBranchIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IdenticalConditionalBranchIssue.cs index 4d14b7c497..87504a01dc 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IdenticalConditionalBranchIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IdenticalConditionalBranchIssue.cs @@ -26,6 +26,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.PatternMatching; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/InconsistentNamingIssue/InconsistentNamingIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/InconsistentNamingIssue/InconsistentNamingIssue.cs index fa16619927..b1ad183217 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/InconsistentNamingIssue/InconsistentNamingIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/InconsistentNamingIssue/InconsistentNamingIssue.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IncorrectCallToObjectGetHashCodeIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IncorrectCallToObjectGetHashCodeIssue.cs index 061c061704..efb83e1c22 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IncorrectCallToObjectGetHashCodeIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IncorrectCallToObjectGetHashCodeIssue.cs @@ -26,6 +26,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IncorrectExceptionParameterOrderingIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IncorrectExceptionParameterOrderingIssue.cs index 26ac41bb65..d86a788aad 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IncorrectExceptionParameterOrderingIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/IncorrectExceptionParameterOrderingIssue.cs @@ -27,6 +27,7 @@ using ICSharpCode.NRefactory.CSharp.Refactoring; using System.Collections.Generic; using ICSharpCode.NRefactory.Semantics; using System; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MethodNeverReturnsIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MethodNeverReturnsIssue.cs index 357276b05d..b115eab2f1 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MethodNeverReturnsIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MethodNeverReturnsIssue.cs @@ -26,6 +26,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.CSharp.Analysis; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MethodOverloadHidesOptionalParameterIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MethodOverloadHidesOptionalParameterIssue.cs index 120f85a378..2d1be22d0c 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MethodOverloadHidesOptionalParameterIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MethodOverloadHidesOptionalParameterIssue.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MissingStringComparisonIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MissingStringComparisonIssue.cs index d27a93ad6e..8e447b78e5 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MissingStringComparisonIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MissingStringComparisonIssue.cs @@ -30,6 +30,7 @@ using System.Linq; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem.Implementation; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MultipleEnumerationIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MultipleEnumerationIssue.cs index a866cc81bc..5b7654e2cf 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MultipleEnumerationIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/MultipleEnumerationIssue.cs @@ -30,6 +30,7 @@ using System.Linq; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NegativeRelationalExpressionIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NegativeRelationalExpressionIssue.cs index 5acfc609c5..20c4005e48 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NegativeRelationalExpressionIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NegativeRelationalExpressionIssue.cs @@ -26,6 +26,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NoDefaultConstructorIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NoDefaultConstructorIssue.cs index ed323496e9..2687348a69 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NoDefaultConstructorIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NoDefaultConstructorIssue.cs @@ -3,6 +3,7 @@ using System.Linq; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.CSharp.Resolver; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NotImplementedExceptionIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NotImplementedExceptionIssue.cs index fbcaa6fa3d..ebd1a52bc5 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NotImplementedExceptionIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NotImplementedExceptionIssue.cs @@ -27,6 +27,7 @@ using System; using ICSharpCode.NRefactory.PatternMatching; using System.Collections.Generic; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/OptionalParameterCouldBeSkippedIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/OptionalParameterCouldBeSkippedIssue.cs index ba171f5cf7..98a2c15bbf 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/OptionalParameterCouldBeSkippedIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/OptionalParameterCouldBeSkippedIssue.cs @@ -29,6 +29,7 @@ using System.Linq; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; using System; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ParameterCanBeDemotedIssue/ParameterCanBeDemotedIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ParameterCanBeDemotedIssue/ParameterCanBeDemotedIssue.cs index 9bc34b073c..ad83779a09 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ParameterCanBeDemotedIssue/ParameterCanBeDemotedIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ParameterCanBeDemotedIssue/ParameterCanBeDemotedIssue.cs @@ -31,6 +31,7 @@ using System; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.TypeSystem.Implementation; using System.Diagnostics; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantArrayInitializerCommaIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantArrayInitializerCommaIssue.cs index 47340bee7f..d6df754fec 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantArrayInitializerCommaIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantArrayInitializerCommaIssue.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System.Collections.Generic; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAssignmentIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAssignmentIssue.cs index b8fb85d89b..223471539b 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAssignmentIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAssignmentIssue.cs @@ -28,6 +28,7 @@ using System.Linq; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAttributeParenthesesIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAttributeParenthesesIssue.cs index b015a53762..f0a36afade 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAttributeParenthesesIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantAttributeParenthesesIssue.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System.Collections.Generic; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantBaseConstructorIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantBaseConstructorIssue.cs index 87ce5a15f6..83032f6133 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantBaseConstructorIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantBaseConstructorIssue.cs @@ -24,6 +24,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System.Collections.Generic; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCaseLabelIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCaseLabelIssue.cs index 28869d2794..12457e18d9 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCaseLabelIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCaseLabelIssue.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System.Collections.Generic; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs index 6a25508a5d..c7f9bbfb3e 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs @@ -26,6 +26,7 @@ using System; using System.Collections.Generic; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantElseIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantElseIssue.cs index ac1bf1f8e9..d7324f2c7a 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantElseIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantElseIssue.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System.Collections.Generic; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantFieldInitializerIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantFieldInitializerIssue.cs index 483d1f3877..da390f1720 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantFieldInitializerIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantFieldInitializerIssue.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.PatternMatching; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantInternalIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantInternalIssue.cs index 8094c21543..48292ded03 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantInternalIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantInternalIssue.cs @@ -28,6 +28,7 @@ using System; using ICSharpCode.NRefactory.PatternMatching; using System.Collections.Generic; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNamespaceUsageIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNamespaceUsageIssue.cs index 0618eba214..280faee50f 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNamespaceUsageIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNamespaceUsageIssue.cs @@ -30,6 +30,7 @@ using System.Linq; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNullCheckIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNullCheckIssue.cs index fbfc872baf..ad15a25423 100755 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNullCheckIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNullCheckIssue.cs @@ -30,6 +30,7 @@ using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using System.Linq; using ICSharpCode.NRefactory.TypeSystem.Implementation; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantObjectCreationArgumentListIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantObjectCreationArgumentListIssue.cs index c7f012a8d2..0a81d09592 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantObjectCreationArgumentListIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantObjectCreationArgumentListIssue.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System.Collections.Generic; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantObjectOrCollectionInitializerIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantObjectOrCollectionInitializerIssue.cs index 09cae58b68..06fff66b1c 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantObjectOrCollectionInitializerIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantObjectOrCollectionInitializerIssue.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System.Collections.Generic; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantPrivateIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantPrivateIssue.cs index 00d3efe28f..3d37c5b177 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantPrivateIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantPrivateIssue.cs @@ -28,6 +28,7 @@ using System; using ICSharpCode.NRefactory.PatternMatching; using System.Collections.Generic; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantThisIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantThisIssue.cs index 0855374c7e..2c47405186 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantThisIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantThisIssue.cs @@ -31,6 +31,7 @@ using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.CSharp.Resolver; using System.Linq; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantToStringIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantToStringIssue.cs index 4676824567..c0eb65ed33 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantToStringIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantToStringIssue.cs @@ -30,6 +30,7 @@ using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using System.Linq; using ICSharpCode.NRefactory.TypeSystem.Implementation; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantTypeCastIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantTypeCastIssue.cs index ff8c3c2194..60d583aa06 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantTypeCastIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantTypeCastIssue.cs @@ -29,6 +29,7 @@ using System.Linq; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.CSharp.Resolver; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantUsingIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantUsingIssue.cs index 8c9e843d03..fb9de2361b 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantUsingIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantUsingIssue.cs @@ -31,6 +31,7 @@ using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.CSharp.Resolver; using System.Linq; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantWhereWithPredicateIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantWhereWithPredicateIssue.cs index f6a825e808..c87bfb065d 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantWhereWithPredicateIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantWhereWithPredicateIssue.cs @@ -3,6 +3,7 @@ using System.Linq; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.PatternMatching; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ReferenceEqualsCalledWithValueTypeIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ReferenceEqualsCalledWithValueTypeIssue.cs index 9be2381eaf..2f1d1ea950 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ReferenceEqualsCalledWithValueTypeIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ReferenceEqualsCalledWithValueTypeIssue.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ReferenceToStaticMemberViaDerivedTypeIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ReferenceToStaticMemberViaDerivedTypeIssue.cs index 6e5670eea1..490b8007f2 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ReferenceToStaticMemberViaDerivedTypeIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ReferenceToStaticMemberViaDerivedTypeIssue.cs @@ -26,6 +26,7 @@ using System.Collections.Generic; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ResultOfAsyncCallShouldNotBeIgnoredIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ResultOfAsyncCallShouldNotBeIgnoredIssue.cs index 1d6f0f5621..68dd1676ec 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ResultOfAsyncCallShouldNotBeIgnoredIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ResultOfAsyncCallShouldNotBeIgnoredIssue.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/SimplifyAnonymousMethodToDelegateIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/SimplifyAnonymousMethodToDelegateIssue.cs index 64cd9b8334..8cf418cacb 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/SimplifyAnonymousMethodToDelegateIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/SimplifyAnonymousMethodToDelegateIssue.cs @@ -29,6 +29,7 @@ using System.Linq; using ICSharpCode.NRefactory.PatternMatching; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StaticFieldInGenericTypeIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StaticFieldInGenericTypeIssue.cs index dca93ef5e8..3299442ebf 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StaticFieldInGenericTypeIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StaticFieldInGenericTypeIssue.cs @@ -1,7 +1,4 @@ // -using System.Diagnostics.CodeAnalysis; - - // StaticFieldInGenericTypeIssue.cs // // Author: @@ -30,6 +27,8 @@ using System; using System.Collections.Generic; using ICSharpCode.NRefactory.TypeSystem; using System.Linq; +using ICSharpCode.NRefactory.Refactoring; +using System.Diagnostics.CodeAnalysis; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StringIsNullOrEmptyIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StringIsNullOrEmptyIssue.cs index a96a67c917..1ae791c1ec 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StringIsNullOrEmptyIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StringIsNullOrEmptyIssue.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.PatternMatching; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ThreadStaticOnInstanceFieldIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ThreadStaticOnInstanceFieldIssue.cs index eaa37b463c..63403a0fad 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ThreadStaticOnInstanceFieldIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ThreadStaticOnInstanceFieldIssue.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using System; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/TypeParameterNotUsedIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/TypeParameterNotUsedIssue.cs index 9531964f91..85e6e88a49 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/TypeParameterNotUsedIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/TypeParameterNotUsedIssue.cs @@ -29,6 +29,7 @@ using System.Linq; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UnreachableCodeIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UnreachableCodeIssue.cs index 7ae37fd0ef..c9e7bfc46b 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UnreachableCodeIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UnreachableCodeIssue.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using ICSharpCode.NRefactory.CSharp.Analysis; using System.Linq; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseBlockInsteadColonIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseBlockInsteadColonIssue.cs index da1fecb41d..1274d6b250 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseBlockInsteadColonIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseBlockInsteadColonIssue.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System.Collections.Generic; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseVarKeywordIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseVarKeywordIssue.cs index b633d2f8a6..718f805366 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseVarKeywordIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseVarKeywordIssue.cs @@ -28,6 +28,7 @@ using ICSharpCode.NRefactory.PatternMatching; using System.Collections.Generic; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.Refactoring; using System.Linq; namespace ICSharpCode.NRefactory.CSharp.Refactoring diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ValueParameterUnusedIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ValueParameterUnusedIssue.cs index 0958f3f0ca..e2f647f987 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ValueParameterUnusedIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ValueParameterUnusedIssue.cs @@ -29,6 +29,7 @@ using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.CSharp.Resolver; using System.Threading; using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableDeclaredInWideScopeIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableDeclaredInWideScopeIssue.cs index 62f38cc65d..d1ffc1c972 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableDeclaredInWideScopeIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableDeclaredInWideScopeIssue.cs @@ -28,6 +28,7 @@ using System.Linq; using System; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableHidesMemberIssue/LocalVariableHidesMemberIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableHidesMemberIssue/LocalVariableHidesMemberIssue.cs index ea5159e3ee..b43156b2c1 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableHidesMemberIssue/LocalVariableHidesMemberIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableHidesMemberIssue/LocalVariableHidesMemberIssue.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableHidesMemberIssue/ParameterHidesMemberIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableHidesMemberIssue/ParameterHidesMemberIssue.cs index 279aef8f5e..76560a2102 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableHidesMemberIssue/ParameterHidesMemberIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableHidesMemberIssue/ParameterHidesMemberIssue.cs @@ -23,6 +23,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableNotUsedIssues/LocalVariableNotUsedIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableNotUsedIssues/LocalVariableNotUsedIssue.cs index 7cfb86a125..cb9f07acf1 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableNotUsedIssues/LocalVariableNotUsedIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableNotUsedIssues/LocalVariableNotUsedIssue.cs @@ -27,6 +27,7 @@ using ICSharpCode.NRefactory.Semantics; using System.Linq; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableNotUsedIssues/ParameterNotUsedIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableNotUsedIssues/ParameterNotUsedIssue.cs index b6d9e743ef..c822bc19b7 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableNotUsedIssues/ParameterNotUsedIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableNotUsedIssues/ParameterNotUsedIssue.cs @@ -30,6 +30,7 @@ using ICSharpCode.NRefactory.TypeSystem; using System.Collections.Generic; using ICSharpCode.NRefactory.CSharp.Resolver; using System; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableOnlyAssignedIssues/ParameterOnlyAssignedIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableOnlyAssignedIssues/ParameterOnlyAssignedIssue.cs index 35823338ba..98579d1037 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableOnlyAssignedIssues/ParameterOnlyAssignedIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/VariableOnlyAssignedIssues/ParameterOnlyAssignedIssue.cs @@ -24,6 +24,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/IssueAttribute.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/IssueAttribute.cs index 26efd04e93..da157dd59e 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/IssueAttribute.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/IssueAttribute.cs @@ -27,6 +27,7 @@ using System.Diagnostics.CodeAnalysis; // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; +using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp { diff --git a/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj b/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj index 808268aecc..49ddbd6780 100644 --- a/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj +++ b/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj @@ -267,11 +267,14 @@ + + + diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/IssueMarker.cs b/ICSharpCode.NRefactory/Refactoring/IssueMarker.cs similarity index 97% rename from ICSharpCode.NRefactory.CSharp/Refactoring/IssueMarker.cs rename to ICSharpCode.NRefactory/Refactoring/IssueMarker.cs index 6e61ded71b..ea029c43cb 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/IssueMarker.cs +++ b/ICSharpCode.NRefactory/Refactoring/IssueMarker.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -namespace ICSharpCode.NRefactory.CSharp +namespace ICSharpCode.NRefactory.Refactoring { /// /// The issue marker is used to set how an issue should be marked inside the text editor. diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/Severity.cs b/ICSharpCode.NRefactory/Refactoring/Severity.cs similarity index 97% rename from ICSharpCode.NRefactory.CSharp/Refactoring/Severity.cs rename to ICSharpCode.NRefactory/Refactoring/Severity.cs index 33feda54c9..0085f9870f 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/Severity.cs +++ b/ICSharpCode.NRefactory/Refactoring/Severity.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -namespace ICSharpCode.NRefactory.CSharp +namespace ICSharpCode.NRefactory.Refactoring { /// /// The severity influences how the task bar reacts on found issues. From fca6a67c0ee63845322a08928a0f3e39dcc7a0d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Wed, 22 May 2013 08:35:31 +0200 Subject: [PATCH 20/55] Fixed failing test. --- ICSharpCode.NRefactory.Tests/CSharp/AstStructureTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ICSharpCode.NRefactory.Tests/CSharp/AstStructureTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/AstStructureTests.cs index 5e4a7bc48c..f22c9ac470 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/AstStructureTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/AstStructureTests.cs @@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.CSharp foreach (Type type in typeof(AstNode).Assembly.GetExportedTypes()) { if (type == typeof(CSharpModifierToken)) // CSharpModifierToken is the exception (though I'm not too happy about that) continue; - if (type == typeof(PreProcessorDirective)) // another exception - is it useful or not ? + if (typeof(PreProcessorDirective).IsAssignableFrom (type)) // another exception - is it useful or not ? continue; if (type.IsSubclassOf(typeof(AstNode))) { Assert.IsTrue(type.BaseType.IsAbstract, type.FullName); From 5dec9ee365331a93fbfaf8cf92a1549e8dd5bf15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Wed, 22 May 2013 08:36:12 +0200 Subject: [PATCH 21/55] Added DescendantNodes API. --- ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs | 71 ++++++++++++----- .../CSharp/AstTests.cs | 77 +++++++++++++++++++ .../ICSharpCode.NRefactory.Tests.csproj | 1 + .../TypeSystem/DomRegion.cs | 14 +++- 4 files changed, 143 insertions(+), 20 deletions(-) create mode 100644 ICSharpCode.NRefactory.Tests/CSharp/AstTests.cs diff --git a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs index 3fbfd6b25d..76d6d828a7 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs @@ -296,31 +296,64 @@ namespace ICSharpCode.NRefactory.CSharp /// Gets all descendants of this node (excluding this node itself). /// public IEnumerable Descendants { - get { return GetDescendants(false); } + get { return GetDescendantsImpl(false); } } /// /// Gets all descendants of this node (including this node itself). /// public IEnumerable DescendantsAndSelf { - get { return GetDescendants(true); } - } - - IEnumerable GetDescendants(bool includeSelf) - { - if (includeSelf) - yield return this; - Stack nextStack = new Stack(); - nextStack.Push(null); - AstNode pos = firstChild; - while (pos != null) { - if (pos.nextSibling != null) - nextStack.Push(pos.nextSibling); - yield return pos; - if (pos.firstChild != null) - pos = pos.firstChild; - else - pos = nextStack.Pop(); + get { return GetDescendantsImpl(true); } + } + + static bool IsInsideRegion(DomRegion region, AstNode pos) + { + if (region.IsEmpty) + return true; + var nodeRegion = pos.Region; + return region.IntersectsWith(nodeRegion) || region.OverlapsWith(nodeRegion); + } + + public IEnumerable DescendantNodes (Func descendIntoChildren = null) + { + return GetDescendantsImpl(false, new DomRegion (), descendIntoChildren); + } + + public IEnumerable DescendantNodes (DomRegion region, Func descendIntoChildren = null) + { + return GetDescendantsImpl(false, region, descendIntoChildren); + } + + public IEnumerable DescendantNodesAndSelf (Func descendIntoChildren = null) + { + return GetDescendantsImpl(true, new DomRegion (), descendIntoChildren); + } + + public IEnumerable DescendantNodesAndSelf (DomRegion region, Func descendIntoChildren = null) + { + return GetDescendantsImpl(true, region, descendIntoChildren); + } + + IEnumerable GetDescendantsImpl(bool includeSelf, DomRegion region = new DomRegion (), Func descendIntoChildren = null) + { + if (includeSelf) { + if (IsInsideRegion (region, this)) + yield return this; + if (descendIntoChildren != null && !descendIntoChildren(this)) + yield break; + } + + Stack descendStack = new Stack(); + descendStack.Push(firstChild); + while (descendStack.Count > 0) { + AstNode cur = descendStack.Pop (); + while (cur != null) { + if (IsInsideRegion(region, cur)) + yield return cur; + if (descendIntoChildren == null || descendIntoChildren(cur)) + descendStack.Push(cur.firstChild); + cur = cur.nextSibling; + } } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/AstTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/AstTests.cs new file mode 100644 index 0000000000..9cccc58b95 --- /dev/null +++ b/ICSharpCode.NRefactory.Tests/CSharp/AstTests.cs @@ -0,0 +1,77 @@ +// +// AstTests.cs +// +// Author: +// Mike Krüger +// +// Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using NUnit.Framework; +using System.Linq; + +namespace ICSharpCode.NRefactory.CSharp +{ + [TestFixture] + + public class AstTests + { + [Test] + public void TestDescendants () + { + var tree = SyntaxTree.Parse(@"class Test +{ + void Foo() + { + Call1(); + { + Call2(); + } + Call3(); + } +}"); + var method = tree.GetNodeAt(6, 1); + // Body, Call1, Block, Call2 and Call 3 + Assert.AreEqual(5, method.DescendantNodes().Count(n => n is Statement)); + } + + + [Test] + public void TestDescendantsWithPredicate () + { + var tree = SyntaxTree.Parse(@"class Test +{ + void Foo() + { + Call1(); + { + Call2(); + } + Call3(); + } +}"); + var method = tree.GetNodeAt(6, 1); + // Body, Call1, Block and Call 3 - NOT call2 + var childs = method.DescendantNodes(child => !(child is BlockStatement) || (((BlockStatement)child).Parent is MethodDeclaration)).Where(n => n is Statement).ToList(); + Assert.AreEqual(4, childs.Count); + } + } +} + diff --git a/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj b/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj index 5befaf55c6..dd4fae08b9 100644 --- a/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj +++ b/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj @@ -415,6 +415,7 @@ + diff --git a/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs b/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs index 7f48f4f152..62c106c6e1 100644 --- a/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs +++ b/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs @@ -156,7 +156,19 @@ namespace ICSharpCode.NRefactory.TypeSystem { return IsInside(location.Line, location.Column); } - + + public bool IntersectsWith (DomRegion region) + { + return region.Begin <= End && region.End >= Begin; + } + + public bool OverlapsWith (DomRegion region) + { + var maxBegin = Begin > region.Begin ? Begin : region.Begin; + var minEnd = End < region.End ? End : region.End; + return maxBegin < minEnd; + } + public override string ToString() { return string.Format( From 6c4d206dcdae1b15c0d52c5433c06860db1b4011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 24 May 2013 07:18:17 +0200 Subject: [PATCH 22/55] Added failing completion test case. --- .../CodeCompletion/CodeCompletionBugTests.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs index b41f00682a..031f7dc2da 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs @@ -6083,5 +6083,22 @@ public class Test Assert.IsTrue(provider == null || provider.Count == 0); } + [Ignore("Parser bug")] + [Test] + public void TestBugWithLambdaParameter() + { + CombinedProviderTest(@"using System.Collections.Generic; + + class C + { + public static void Main (string[] args) + { + List list; + $list.Find(l => l.Name == l.Name ? l$ + } + }", provider => { + Assert.IsNotNull(provider.Find("l")); + }); + } } } From 8826ae7f1c585b9bcea1f3a363a79205c078f98e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 24 May 2013 07:29:20 +0200 Subject: [PATCH 23/55] Added wrapping formatting bug. --- .../FormattingTests/TestWrapping.cs | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs index b935d4156a..1a348ece85 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs @@ -812,6 +812,56 @@ int foo) int foo) { } +}"); + } + [Ignore("FIXME")] + [Test] + public void TestWrappingBug() + { + var policy = FormattingOptionsFactory.CreateMono(); + Test(policy, @"class Test +{ + void TestMe () + { + VantageErrorLog.Throw(Title: ""DexterHelper: WriteToDexter (WebEx)"", + Method: ""WriteToDexter"", + Location: ""DX001"", + Code: ""DX001"", + Message: string.Format(""DexterHelper: WriteToDexter{0}{1}{0}{2}"", + VantageConstants.CRLF, + webex.Message, + responseString), + ex: new Exception(string.Format(""DexterHelper: WriteToDexter{0}{1}{0}{2}"", + VantageConstants.CRLF, + webex.Message, + responseString)), + TellUser: false, + WriteToDatabase: true, + TellVantageSupport: true, + Rethrow: false); + } +}", + @"class Test +{ + void TestMe () + { + VantageErrorLog.Throw (Title: ""DexterHelper: WriteToDexter (WebEx)"", + Method: ""WriteToDexter"", + Location: ""DX001"", + Code: ""DX001"", + Message: string.Format (""DexterHelper: WriteToDexter{0}{1}{0}{2}"", + VantageConstants.CRLF, + webex.Message, + responseString), + ex: new Exception (string.Format (""DexterHelper: WriteToDexter{0}{1}{0}{2}"", + VantageConstants.CRLF, + webex.Message, + responseString)), + TellUser: false, + WriteToDatabase: true, + TellVantageSupport: true, + Rethrow: false); + } }"); } } From 774e949bdbf9ffae804026f310fe393871c39ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 24 May 2013 07:39:58 +0200 Subject: [PATCH 24/55] Fixed formatting bug. --- .../Formatter/Indent.cs | 2 +- .../FormattingTests/TestWrapping.cs | 33 ++++++++++++++++++- .../FormattingTests/TextEditorTestAdapter.cs | 17 ++++++---- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/Indent.cs b/ICSharpCode.NRefactory.CSharp/Formatter/Indent.cs index 52bdf3f792..4b9bfa9f2b 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/Indent.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/Indent.cs @@ -126,7 +126,7 @@ namespace ICSharpCode.NRefactory.CSharp void Update() { if (options.TabsToSpaces) { - indentString = new string(' ', curIndent); + indentString = new string(' ', curIndent + ExtraSpaces); return; } indentString = new string('\t', curIndent / options.TabSize) + new string(' ', curIndent % options.TabSize) + new string(' ', ExtraSpaces); diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs index 1a348ece85..4d1d387f35 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.cs @@ -181,7 +181,7 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests Foo (1, 2, 3); } }", -@"class Test + @"class Test { void TestMe () { @@ -864,5 +864,36 @@ int foo) } }"); } + + + [Test] + public void TestWrappingWithSpaceIndent() + { + var policy = FormattingOptionsFactory.CreateMono(); + + TextEditorOptions options = new TextEditorOptions(); + options.IndentSize = options.TabSize = 2; + options.TabsToSpaces = true; + options.EolMarker = "\n"; + + Test(policy, @"class Test +{ + void TestMe () + { + Foo (1, + 2, + 3); + } +}", + @"class Test +{ + void TestMe () + { + Foo (1, + 2, + 3); + } +}", FormattingMode.Intrusive, options); + } } } diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs index ca8b95386a..577ff7d8e3 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs @@ -28,13 +28,17 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests return b.ToString(); }*/ - protected static IDocument GetResult(CSharpFormattingOptions policy, string input, FormattingMode mode = FormattingMode.Intrusive) + protected static IDocument GetResult(CSharpFormattingOptions policy, string input, FormattingMode mode = FormattingMode.Intrusive, TextEditorOptions options = null) { + if (options == null) { + options = new TextEditorOptions(); + options.EolMarker = "\n"; + options.WrapLineLength = 80; + } + + input = NormalizeNewlines(input); var document = new StringBuilderDocument(input); - var options = new TextEditorOptions(); - options.EolMarker = "\n"; - options.WrapLineLength = 80; var visitor = new CSharpFormatter (policy, options); visitor.FormattingMode = mode; var syntaxTree = new CSharpParser ().Parse (document, "test.cs"); @@ -43,10 +47,11 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests return document; } - protected static IDocument Test (CSharpFormattingOptions policy, string input, string expectedOutput, FormattingMode mode = FormattingMode.Intrusive) + protected static IDocument Test (CSharpFormattingOptions policy, string input, string expectedOutput, FormattingMode mode = FormattingMode.Intrusive, TextEditorOptions options = null) { expectedOutput = NormalizeNewlines(expectedOutput); - IDocument doc = GetResult(policy, input, mode); + + IDocument doc = GetResult(policy, input, mode, options); if (expectedOutput != doc.Text) { Console.WriteLine ("expected:"); Console.WriteLine (expectedOutput); From e3c40ba7f39a7741a8418db393bf6c1e2d2886c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 24 May 2013 08:12:31 +0200 Subject: [PATCH 25/55] Fixed xml doc formatting bug. --- .../Formatter/FormattingVisitor_Global.cs | 4 ++-- .../TestTypeLevelIndentation.cs | 23 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs index 633371605c..daedfd6e9e 100644 --- a/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs +++ b/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs @@ -120,10 +120,10 @@ namespace ICSharpCode.NRefactory.CSharp void FixAttributesAndDocComment(EntityDeclaration entity) { - var node =entity.FirstChild; + var node = entity.FirstChild; while (node != null && node.Role == Roles.Comment) { - FixIndentation(node); node = node.GetNextSibling(NoWhitespacePredicate); + FixIndentation(node); } if (entity.Attributes.Count > 0) { AstNode n = null; diff --git a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs index ca82ab0406..5325697972 100644 --- a/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs +++ b/ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs @@ -101,10 +101,27 @@ class Test { { CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); policy.ClassBraceStyle = BraceStyle.DoNotChange; - + + Test(policy, + @" class Test {}", + @"class Test {}"); + } + + [Test] + public void TestClassIndentationWithDocComment() + { + CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono(); + policy.ClassBraceStyle = BraceStyle.DoNotChange; + Test(policy, - @" class Test {}", - @"class Test {}"); + @"/// + /// olwcowcolwc + /// + class Test {}", + @"/// +/// olwcowcolwc +/// +class Test {}"); } [Test] From 6133647c68ef4142a4b353be6b161d6531244375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 24 May 2013 09:20:22 +0200 Subject: [PATCH 26/55] GetPotentiallyNestedClassTypeReference no longer returns null on resolve. --- .../GetPotentiallyNestedClassTypeReference.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.NRefactory/Documentation/GetPotentiallyNestedClassTypeReference.cs b/ICSharpCode.NRefactory/Documentation/GetPotentiallyNestedClassTypeReference.cs index 6f45237e70..1e5807d77c 100644 --- a/ICSharpCode.NRefactory/Documentation/GetPotentiallyNestedClassTypeReference.cs +++ b/ICSharpCode.NRefactory/Documentation/GetPotentiallyNestedClassTypeReference.cs @@ -19,6 +19,7 @@ using System; using System.Linq; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.TypeSystem.Implementation; namespace ICSharpCode.NRefactory.Documentation { @@ -60,7 +61,11 @@ namespace ICSharpCode.NRefactory.Documentation return typeDef; } } - return null; + int idx = typeName.LastIndexOf('.'); + if (idx < 0) + return new UnknownType("", typeName, typeParameterCount); + // give back a guessed namespace/type name + return new UnknownType(typeName.Substring(0, idx), typeName.Substring(idx + 1), typeParameterCount); } } } From 90c729419e824ac3e741178ae0154bdbc90c50c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 24 May 2013 10:46:59 +0200 Subject: [PATCH 27/55] Fixed bug in cecil loader. --- .../TypeSystem/TypeSystemTests.TestCase.cs | 6 ++-- .../TypeSystem/TypeSystemTests.cs | 13 +++++++++ .../TypeSystem/CecilLoader.cs | 29 ++++++++++++++++++- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs b/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs index c6b533fe58..cea7a115f1 100644 --- a/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs +++ b/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs @@ -87,9 +87,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.TestCase public int PropertyWithProtectedSetter { get; protected set; } public object PropertyWithPrivateSetter { get; private set; } - + public object PropertyWithoutSetter { get { return null; } } - + + public object PropertyWithPrivateGetter { private get; set; } + public string this[int index] { get { return "Test"; } set {} } } diff --git a/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs b/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs index f1b8c977bf..ae0c247b6c 100644 --- a/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs +++ b/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs @@ -336,6 +336,19 @@ namespace ICSharpCode.NRefactory.TypeSystem Assert.AreEqual(Accessibility.Private, p.Setter.Accessibility); Assert.IsTrue(p.Getter.HasBody); } + + [Test] + public void PropertyWithPrivateGetter() + { + var testClass = GetTypeDefinition(typeof(PropertyTest)); + IProperty p = testClass.Properties.Single(pr => pr.Name == "PropertyWithPrivateGetter"); + Assert.IsTrue(p.CanGet); + Assert.IsTrue(p.CanSet); + Assert.AreEqual(Accessibility.Public, p.Accessibility); + Assert.AreEqual(Accessibility.Private, p.Getter.Accessibility); + Assert.AreEqual(Accessibility.Public, p.Setter.Accessibility); + Assert.IsTrue(p.Getter.HasBody); + } [Test] public void PropertyWithoutSetter() diff --git a/ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs b/ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs index c53d269979..7b98deb240 100644 --- a/ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs +++ b/ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team +// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software @@ -2198,6 +2198,30 @@ namespace ICSharpCode.NRefactory.TypeSystem #region Read Property + Accessibility MergePropertyAccessibility (Accessibility left, Accessibility right) + { + if (left == Accessibility.Public || right == Accessibility.Public) + return Accessibility.Public; + + if (left == Accessibility.ProtectedOrInternal || right == Accessibility.ProtectedOrInternal) + return Accessibility.ProtectedOrInternal; + + if (left == Accessibility.Protected && right == Accessibility.Internal || + left == Accessibility.Internal && right == Accessibility.Protected) + return Accessibility.ProtectedOrInternal; + + if (left == Accessibility.Protected || right == Accessibility.Protected) + return Accessibility.Protected; + + if (left == Accessibility.Internal || right == Accessibility.Internal) + return Accessibility.Internal; + + if (left == Accessibility.ProtectedAndInternal || right == Accessibility.ProtectedAndInternal) + return Accessibility.ProtectedAndInternal; + + return left; + } + [CLSCompliant(false)] public IUnresolvedProperty ReadProperty(PropertyDefinition property, IUnresolvedTypeDefinition parentType, EntityType propertyType = EntityType.Property) { @@ -2208,6 +2232,9 @@ namespace ICSharpCode.NRefactory.TypeSystem DefaultUnresolvedProperty p = new DefaultUnresolvedProperty(parentType, property.Name); p.EntityType = propertyType; TranslateModifiers(property.GetMethod ?? property.SetMethod, p); + if (property.GetMethod != null && property.SetMethod != null) + p.Accessibility = MergePropertyAccessibility (GetAccessibility (property.GetMethod.Attributes), GetAccessibility (property.SetMethod.Attributes)); + p.ReturnType = ReadTypeReference(property.PropertyType, typeAttributes: property); p.Getter = ReadMethod(property.GetMethod, parentType, EntityType.Accessor, p); From b9e4d4841bfe6d113ba5d3b646fede1921474c35 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 29 May 2013 17:07:11 +0200 Subject: [PATCH 28/55] Fix false positive in ExpressionOfCompatibleTypeCastIssue --- .../ExpressionOfCompatibleTypeCastIssue.cs | 5 ++++- ...xpressionOfCompatibleTypeCastIssueTests.cs | 21 +++++++++++++++++++ .../Parser/TypeSystemConvertVisitorTests.cs | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs index 7dc47d7992..25f8356c04 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs @@ -43,7 +43,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return new GatherVisitor(context).GetIssues(); } - class GatherVisitor : GatherVisitorBase + class GatherVisitor : GatherVisitorBase { readonly CSharpConversions conversion; @@ -55,6 +55,9 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring public override void VisitAssignmentExpression(AssignmentExpression assignmentExpression) { + base.VisitAssignmentExpression(assignmentExpression); + if (assignmentExpression.Operator != AssignmentOperatorType.Assign) + return; var rightExpressionType = ctx.Resolve(assignmentExpression.Right).Type; var leftExpressionType = ctx.Resolve(assignmentExpression.Left).Type; VisitTypeCastExpression(assignmentExpression, rightExpressionType, leftExpressionType); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs index bc526fb258..4d129a2d7a 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs @@ -111,6 +111,27 @@ class TestClass int y = 1; $x = i; } +}"; + Test(input, 0); + } + + [Test] + public void TestUserDefinedAddition() + { + var input = @" +struct Vector { + public static explicit operator Point(Vector v) { return new Point(); } +} +struct Point { + public static Point operator +(Point p, Vector v) { return new Point(); } +} +class TestClass +{ + void TestMethod () + { + Point p = new Point(); + $p += new Vector(); + } }"; Test(input, 0); } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs index 5306bf70b6..9fc497ccdc 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs @@ -108,7 +108,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser var ts = cu.ToTypeSystem(); var compilation = new CSharpProjectContent() - .UpdateProjectContent(null, ts) + .AddOrUpdateFiles(ts) .AddAssemblyReferences(new[] { CecilLoaderTests.Mscorlib }) .CreateCompilation(); var type = ReflectionHelper.ParseReflectionName("C").Resolve(compilation).GetDefinition(); From 658752eace6756f67d0fb71b171f9201d0de84f0 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 29 May 2013 20:47:36 +0200 Subject: [PATCH 29/55] string.IsNullOrEmpty issue: detect 'str != null && str.Length > 0' pattern --- .../CodeIssues/StringIsNullOrEmptyIssue.cs | 26 ++++++------------- .../StringIsNullOrEmptyInspectorTests.cs | 10 ++----- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StringIsNullOrEmptyIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StringIsNullOrEmptyIssue.cs index 1ae791c1ec..9ae3453f0b 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StringIsNullOrEmptyIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/StringIsNullOrEmptyIssue.cs @@ -58,16 +58,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring } ), // str == "" || str == null - // str.Length == 0 || str == null new BinaryOperatorExpression ( - new Choice { - PatternHelper.CommutativeOperator (new AnyNode ("str"), BinaryOperatorType.Equality, new PrimitiveExpression ("")), - PatternHelper.CommutativeOperator ( - new MemberReferenceExpression (new AnyNode ("str"), "Length"), - BinaryOperatorType.Equality, - new PrimitiveExpression (0) - ) - }, + PatternHelper.CommutativeOperator (new AnyNode ("str"), BinaryOperatorType.Equality, new PrimitiveExpression ("")), BinaryOperatorType.ConditionalOr, PatternHelper.CommutativeOperator(new Backreference ("str"), BinaryOperatorType.Equality, new NullReferenceExpression ()) ) @@ -76,6 +68,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring static readonly Pattern negPattern = new Choice { // str != null && str != "" // str != null && str.Length != 0 + // str != null && str.Length > 0 new BinaryOperatorExpression ( PatternHelper.CommutativeOperator(new AnyNode ("str"), BinaryOperatorType.InEquality, new NullReferenceExpression ()), BinaryOperatorType.ConditionalAnd, @@ -85,20 +78,17 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring new MemberReferenceExpression (new Backreference ("str"), "Length"), BinaryOperatorType.InEquality, new PrimitiveExpression (0) + ), + new BinaryOperatorExpression ( + new MemberReferenceExpression (new Backreference ("str"), "Length"), + BinaryOperatorType.GreaterThan, + new PrimitiveExpression (0) ) } ), // str != "" && str != null - // str.Length != 0 && str != null new BinaryOperatorExpression ( - new Choice { - PatternHelper.CommutativeOperator (new AnyNode ("str"), BinaryOperatorType.InEquality, new PrimitiveExpression ("")), - PatternHelper.CommutativeOperator ( - new MemberReferenceExpression (new AnyNode ("str"), "Length"), - BinaryOperatorType.InEquality, - new PrimitiveExpression (0) - ) - }, + PatternHelper.CommutativeOperator (new AnyNode ("str"), BinaryOperatorType.InEquality, new PrimitiveExpression ("")), BinaryOperatorType.ConditionalAnd, PatternHelper.CommutativeOperator(new Backreference ("str"), BinaryOperatorType.InEquality, new NullReferenceExpression ()) ) diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/StringIsNullOrEmptyInspectorTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/StringIsNullOrEmptyInspectorTests.cs index 28f6431a58..ce2158685a 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/StringIsNullOrEmptyInspectorTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/StringIsNullOrEmptyInspectorTests.cs @@ -438,12 +438,8 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues [TestCase("str == null || str.Length == 0")] [TestCase("str == null || 0 == str.Length")] - [TestCase("str.Length == 0 || str == null")] - [TestCase("0 == str.Length || str == null")] [TestCase("null == str || str.Length == 0")] [TestCase("null == str || 0 == str.Length")] - [TestCase("str.Length == 0 || null == str")] - [TestCase("0 == str.Length || null == str")] public void TestInspectorCaseNL (string expression) { var input = @"class Foo @@ -470,12 +466,10 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues [TestCase("str != null && str.Length != 0")] [TestCase("str != null && 0 != str.Length")] - [TestCase("str.Length != 0 && str != null")] - [TestCase("0 != str.Length && str != null")] + [TestCase("str != null && str.Length > 0")] [TestCase("null != str && str.Length != 0")] [TestCase("null != str && 0 != str.Length")] - [TestCase("str.Length != 0 && null != str")] - [TestCase("0 != str.Length && null != str")] + [TestCase("null != str && str.Length > 0")] public void TestInspectorCaseLN (string expression) { var input = @"class Foo From f53526218d3d27b55fba1e546d50556ff35e7b58 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 29 May 2013 21:11:22 +0200 Subject: [PATCH 30/55] Fix false positives in FormatStringIssue when params-parameter is used in unexpanded form. --- .../FormatStringIssues/FormatStringHelper.cs | 16 ++++-- .../FormatStringIssues/FormatStringIssue.cs | 5 +- .../CodeIssues/RedundantToStringIssue.cs | 3 +- .../FormatStringIssues/FormatStringTests.cs | 51 +++++++++++++++++++ 4 files changed, 65 insertions(+), 10 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringHelper.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringHelper.cs index 9531dd1243..555582e605 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringHelper.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringHelper.cs @@ -36,14 +36,13 @@ namespace ICSharpCode.NRefactory.CSharp static string[] parameterNames = { "format", "frmt", "fmt" }; public static bool TryGetFormattingParameters(CSharpInvocationResolveResult invocationResolveResult, InvocationExpression invocationExpression, - out Expression formatArgument, out TextLocation formatStart, out IList arguments, + out Expression formatArgument, out IList arguments, Func argumentFilter) { if (argumentFilter == null) argumentFilter = (p, e) => true; formatArgument = null; - formatStart = default(TextLocation); arguments = new List(); var argumentToParameterMap = invocationResolveResult.GetArgumentToParameterMap(); var resolvedParameters = invocationResolveResult.Member.Parameters; @@ -51,15 +50,22 @@ namespace ICSharpCode.NRefactory.CSharp for (int i = 0; i < allArguments.Length; i++) { var parameterIndex = argumentToParameterMap[i]; if (parameterIndex < 0 || parameterIndex >= resolvedParameters.Count) { - // No valid mapping for this parameter, skip it + // No valid mapping for this argument, skip it continue; } var parameter = resolvedParameters[parameterIndex]; var argument = allArguments[i]; if (parameter.Type.IsKnownType(KnownTypeCode.String) && parameterNames.Contains(parameter.Name)) { formatArgument = argument; - formatStart = argument.StartLocation; - } else if ((formatArgument != null || parameter.IsParams) && argumentFilter(parameter, argument)) { + } else if (formatArgument != null && parameter.IsParams && !invocationResolveResult.IsExpandedForm) { + var ace = argument as ArrayCreateExpression; + if (ace == null || ace.Initializer.IsNull) + return false; + foreach (var element in ace.Initializer.Elements) { + if (argumentFilter(parameter, element)) + arguments.Add(argument); + } + } else if (formatArgument != null && argumentFilter(parameter, argument)) { arguments.Add(argument); } } diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringIssue.cs index 19b94d6ca2..7017b02d42 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/FormatStringIssues/FormatStringIssue.cs @@ -69,9 +69,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return; Expression formatArgument; IList formatArguments; - TextLocation formatStart; if (!FormatStringHelper.TryGetFormattingParameters(invocationResolveResult, invocationExpression, - out formatArgument, out formatStart, out formatArguments, null)) { + out formatArgument, out formatArguments, null)) { return; } var primitiveArgument = formatArgument as PrimitiveExpression; @@ -79,7 +78,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return; var format = (string)primitiveArgument.Value; var parsingResult = context.ParseFormatString(format); - CheckSegments(parsingResult.Segments, formatStart, formatArguments, invocationExpression); + CheckSegments(parsingResult.Segments, formatArgument.StartLocation, formatArguments, invocationExpression); } void CheckSegments(IList segments, TextLocation formatStart, IList formatArguments, AstNode anchor) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantToStringIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantToStringIssue.cs index c0eb65ed33..eee0a69387 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantToStringIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantToStringIssue.cs @@ -215,7 +215,6 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring { Expression formatArgument; IList formatArguments; - TextLocation formatStart; // Only check parameters that are of type object: String means it is neccessary, others // means that there is another problem (ie no matching overload of the method). Func predicate = (parameter, argument) => { @@ -229,7 +228,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return typeDefinition.IsKnownType(KnownTypeCode.Object); }; if (FormatStringHelper.TryGetFormattingParameters(invocationResolveResult, invocationExpression, - out formatArgument, out formatStart, out formatArguments, predicate)) { + out formatArgument, out formatArguments, predicate)) { foreach (var argument in formatArguments) { CheckExpressionInAutoCallContext(argument); } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/FormatStringIssues/FormatStringTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/FormatStringIssues/FormatStringTests.cs index ca1ca48751..ce0fb277f6 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/FormatStringIssues/FormatStringTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/FormatStringIssues/FormatStringTests.cs @@ -70,6 +70,23 @@ class TestClass Assert.AreEqual (0, issues.Count); } + [Test] + public void IgnoresCallWithUnknownNumberOfArguments() + { + var input = @" +class TestClass +{ + string Bar(params object[] args) + { + return string.Format(""{1}"", args); + } +}"; + + TestRefactoringContext context; + var issues = GetIssues (new FormatStringIssue (), input, out context); + Assert.AreEqual (0, issues.Count); + } + [Test] public void FormatItemIndexOutOfRangeOfArguments() { @@ -87,6 +104,23 @@ class TestClass Assert.AreEqual (1, issues.Count); } + [Test] + public void FormatItemIndexOutOfRangeOfArguments_ExplicitArrayCreation() + { + var input = @" +class TestClass +{ + void Foo() + { + string.Format(""{1}"", new object[] { 1 }); + } +}"; + + TestRefactoringContext context; + var issues = GetIssues (new FormatStringIssue (), input, out context); + Assert.AreEqual (1, issues.Count); + } + [Test] public void FormatItemMissingEndBrace() { @@ -138,6 +172,23 @@ class TestClass Assert.AreEqual (0, issues.Count); } + [Test] + public void IgnoresStringWithGoodArguments_ExplicitArrayCreation() + { + var input = @" +class TestClass +{ + void Foo() + { + string.Format(""{1}"", new object[] { ""arg0"", ""arg1"" }); + } +}"; + + TestRefactoringContext context; + var issues = GetIssues (new FormatStringIssue (), input, out context); + Assert.AreEqual (0, issues.Count); + } + [Test] public void IgnoresNonFormattingCall() { From 4a8a61ee2e77ed4c34d93c413280c9cf3b562dec Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 29 May 2013 22:06:49 +0200 Subject: [PATCH 31/55] Fix false positives in SimplifyAnonymousMethodToDelegateIssue: the simplification is not possible when the lambda involves non-reference conversions. --- .../CodeIssues/RedundantNullCheckIssue.cs | 68 +++---- .../SimplifyAnonymousMethodToDelegateIssue.cs | 33 ++-- .../Refactoring/PatternHelper.cs | 24 +++ .../CodeIssues/RedundantNullCheckTests.cs | 1 - ...lifyAnonymousMethodToDelegateIssueTests.cs | 173 +++++++++++++++--- 5 files changed, 228 insertions(+), 71 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNullCheckIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNullCheckIssue.cs index ad15a25423..2755bb075f 100755 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNullCheckIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantNullCheckIssue.cs @@ -35,42 +35,43 @@ using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { [IssueDescription("Redundant null check", - Description = "When 'is' keyword is used, which implicitly check null.", - Category = IssueCategories.Redundancies, - Severity = Severity.Suggestion, + Description = "When 'is' keyword is used, which implicitly check null.", + Category = IssueCategories.Redundancies, + Severity = Severity.Suggestion, ResharperDisableKeyword = "RedundantNullCheck", - IssueMarker = IssueMarker.GrayOut)] + IssueMarker = IssueMarker.GrayOut)] public class RedundantNullCheckIssue : ICodeIssueProvider { private static readonly Pattern pattern1 = new Choice { - // x is Record && x!= null + // a is Record && a != null new BinaryOperatorExpression( - new IsExpression - { + PatternHelper.OptionalParentheses( + new IsExpression { Expression = new AnyNode("a"), Type = new AnyNode("t") - }, BinaryOperatorType.ConditionalAnd, - PatternHelper.CommutativeOperator(new Backreference("a"), - BinaryOperatorType. - InEquality, - new NullReferenceExpression - ()) + }), + BinaryOperatorType.ConditionalAnd, + PatternHelper.OptionalParentheses( + PatternHelper.CommutativeOperator(new Backreference("a"), + BinaryOperatorType.InEquality, + new NullReferenceExpression()) ) - }; - private static readonly Pattern pattern2 - = new Choice { - // x != null && x is Record + ), + // a != null && a is Record new BinaryOperatorExpression ( - PatternHelper.CommutativeOperator (new AnyNode("a"), - BinaryOperatorType.InEquality, - new NullReferenceExpression()) - , BinaryOperatorType.ConditionalAnd, - new IsExpression { - Expression = new Backreference("a"), - Type = new AnyNode("t") - } - ) + PatternHelper.OptionalParentheses( + PatternHelper.CommutativeOperator(new AnyNode("a"), + BinaryOperatorType.InEquality, + new NullReferenceExpression()) + ), + BinaryOperatorType.ConditionalAnd, + PatternHelper.OptionalParentheses( + new IsExpression { + Expression = new Backreference("a"), + Type = new AnyNode("t") + }) + ) }; public IEnumerable GetIssues(BaseRefactoringContext context) @@ -91,18 +92,9 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring Match m1 = pattern1.Match(binaryOperatorExpression); if (m1.Success) { AddIssue(binaryOperatorExpression, ctx.TranslateString("Remove redundant IsNULL check"), script => { - Expression expr = binaryOperatorExpression.Left; - script.Replace(binaryOperatorExpression, expr); - }); - return; - } - - Match m2 = pattern2.Match(binaryOperatorExpression); - if (m2.Success) { - AddIssue(binaryOperatorExpression, ctx.TranslateString("Remove redundant IsNULL check"), script => { - Expression expr = binaryOperatorExpression.Right; - script.Replace(binaryOperatorExpression, expr); - }); + var isExpr = m1.Get("t").Single().Parent; + script.Replace(binaryOperatorExpression, isExpr); + }); return; } } diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/SimplifyAnonymousMethodToDelegateIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/SimplifyAnonymousMethodToDelegateIssue.cs index 8cf418cacb..65ab0ae22f 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/SimplifyAnonymousMethodToDelegateIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/SimplifyAnonymousMethodToDelegateIssue.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.PatternMatching; +using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.Refactoring; @@ -86,26 +87,28 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return; if (!IsSimpleTarget (invocation.Target)) return; + var rr = ctx.Resolve (invocation) as CSharpInvocationResolveResult; + if (rr == null) + return; var lambdaParameters = parameters.ToList(); - if (lambdaParameters.Count != invocation.Arguments.Count) + var arguments = rr.GetArgumentsForCall(); + if (lambdaParameters.Count != arguments.Count) return; - int i = 0; - foreach (var param in invocation.Arguments) { - var id = param as IdentifierExpression; - if (id == null) - return; - if (lambdaParameters[i].Name != id.Identifier) + for (int i = 0; i < arguments.Count; i++) { + var arg = UnpackImplicitIdentityOrReferenceConversion(arguments[i]) as LocalResolveResult; + if (arg == null || arg.Variable.Name != lambdaParameters[i].Name) return; - i++; } + var returnConv = ctx.GetConversion(invocation); + if (returnConv.IsExplicit || !(returnConv.IsIdentityConversion || returnConv.IsReferenceConversion)) + return; AddIssue(expression, ctx.TranslateString("Expression can be reduced to delegate"), script => { var validTypes = CreateFieldAction.GetValidTypes (ctx.Resolver, expression).ToList (); if (validTypes.Any (t => t.FullName == "System.Func" && t.TypeParameterCount == 1 + parameters.Count) && validTypes.Any (t => t.FullName == "System.Action")) { - var rr = ctx.Resolve (invocation) as CSharpInvocationResolveResult; - if (rr != null && rr.Member.ReturnType.Kind != ICSharpCode.NRefactory.TypeSystem.TypeKind.Void) { + if (rr != null && rr.Member.ReturnType.Kind != TypeKind.Void) { var builder = ctx.CreateTypeSytemAstBuilder (expression); var type = builder.ConvertType(new TopLevelTypeName("System", "Func", 1)); - var args = type is SimpleType ? ((SimpleType)type).TypeArguments : ((MemberType)type).TypeArguments; + var args = type.GetChildrenByRole(Roles.TypeArgument); args.Clear (); foreach (var pde in parameters) { args.Add (builder.ConvertType (ctx.Resolve (pde).Type)); @@ -118,6 +121,14 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring script.Replace(expression, invocation.Target.Clone()); }); } + + static ResolveResult UnpackImplicitIdentityOrReferenceConversion(ResolveResult rr) + { + var crr = rr as ConversionResolveResult; + if (crr != null && crr.Conversion.IsImplicit && (crr.Conversion.IsIdentityConversion || crr.Conversion.IsReferenceConversion)) + return crr.Input; + return rr; + } public override void VisitLambdaExpression(LambdaExpression lambdaExpression) { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/PatternHelper.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/PatternHelper.cs index a85c59f207..ac11889f21 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/PatternHelper.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/PatternHelper.cs @@ -36,5 +36,29 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring new BinaryOperatorExpression(expr2.Clone(), op, expr1.Clone()) }; } + + /// + /// Optionally allows parentheses around the given expression. + /// + public static Expression OptionalParentheses(Expression expr) + { + return new OptionalParenthesesPattern(expr); + } + + sealed class OptionalParenthesesPattern : Pattern + { + readonly INode child; + + public OptionalParenthesesPattern(INode child) + { + this.child = child; + } + + public override bool DoMatch(INode other, Match match) + { + INode unpacked = ParenthesizedExpression.UnpackParenthesizedExpression(other as Expression); + return child.DoMatch(unpacked, match); + } + } } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantNullCheckTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantNullCheckTests.cs index b45fddf8f2..418657ac4a 100755 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantNullCheckTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantNullCheckTests.cs @@ -82,7 +82,6 @@ class Test { }}}"); } - [Ignore("Missing")] [Test] public void TestCaseWithFullParens() { diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/SimplifyAnonymousMethodToDelegateIssueTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/SimplifyAnonymousMethodToDelegateIssueTests.cs index dbc1b8b7f2..1f8f117308 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/SimplifyAnonymousMethodToDelegateIssueTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/SimplifyAnonymousMethodToDelegateIssueTests.cs @@ -34,60 +34,97 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues public class SimplifyAnonymousMethodToDelegateIssueTests : InspectionActionTestBase { [Test] - public void TestSimpleLambda () + public void TestSimpleVoidLambda () { - var input = @"class Foo + var input = @"using System; +class Foo +{ + void Bar (string str) + { + Action action = $(foo, bar) => MyMethod (foo, bar); + } + void MyMethod(int foo, int bar) {} +}"; + + TestRefactoringContext context; + var issues = GetIssues (new SimplifyAnonymousMethodToDelegateIssue (), input, out context); + Assert.AreEqual (1, issues.Count); + CheckFix (context, issues, @"using System; +class Foo +{ + void Bar (string str) + { + Action action = MyMethod; + } + void MyMethod(int foo, int bar) {} +}"); + } + + [Test] + public void TestSimpleBoolLambda () + { + var input = @"using System; +class Foo { void Bar (string str) { - var action = $(foo, bar) => MyMethod (foo, bar); + Func action = $(foo, bar) => MyMethod (foo, bar); } + bool MyMethod(int foo, int bar) {} }"; TestRefactoringContext context; var issues = GetIssues (new SimplifyAnonymousMethodToDelegateIssue (), input, out context); Assert.AreEqual (1, issues.Count); - CheckFix (context, issues, @"class Foo + CheckFix (context, issues, @"using System; +class Foo { void Bar (string str) { - var action = MyMethod; + Func action = MyMethod; } + bool MyMethod(int foo, int bar) {} }"); } [Test] public void TestLambdaWithBody () { - var input = @"class Foo + var input = @"using System; +class Foo { void Bar (string str) { - var action = $(foo, bar) => { return MyMethod (foo, bar); }; + Action action = $(foo, bar) => { return MyMethod (foo, bar); }; } + void MyMethod(int foo, int bar) {} }"; TestRefactoringContext context; var issues = GetIssues (new SimplifyAnonymousMethodToDelegateIssue (), input, out context); Assert.AreEqual (1, issues.Count); - CheckFix (context, issues, @"class Foo + CheckFix (context, issues, @"using System; +class Foo { void Bar (string str) { - var action = MyMethod; + Action action = MyMethod; } + void MyMethod(int foo, int bar) {} }"); } [Test] - public void TestSimpleInvalidLambda () + public void Lambda_SwapParameterOrder () { - var input = @"class Foo + var input = @"using System; +class Foo { void Bar (string str) { - var action = $(foo, bar) => MyMethod (bar, foo); + Action action = $(foo, bar) => MyMethod (bar, foo); } + void MyMethod(int foo, int bar) {} }"; TestRefactoringContext context; @@ -98,26 +135,28 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues [Test] public void TestSimpleAnonymousMethod () { - var input = @"class Foo + var input = @"using System; +class Foo { int MyMethod (int x, int y) { return x * y; } void Bar (string str) { - var action = $delegate(int foo, int bar) { return MyMethod (foo, bar); }; + Func action = $delegate(int foo, int bar) { return MyMethod (foo, bar); }; } }"; TestRefactoringContext context; var issues = GetIssues (new SimplifyAnonymousMethodToDelegateIssue (), input, out context); Assert.AreEqual (1, issues.Count); - CheckFix (context, issues, @"class Foo + CheckFix (context, issues, @"using System; +class Foo { int MyMethod (int x, int y) { return x * y; } void Bar (string str) { - var action = MyMethod; + Func action = MyMethod; } }"); } @@ -134,7 +173,7 @@ class Foo void Bar (string str) { - var action = $() => str.Where (c => c != 'a').ToArray (); + Func action = $() => str.Where (c => c != 'a').ToArray (); } }"; @@ -144,15 +183,35 @@ class Foo } [Test] - public void TestComplexCase () + public void CallInvolvesOptionalParameter () { - var input = @"class Foo + var input = @"using System; +class Foo { - int MyMethod (int x, int y) { return x * y; } + int MyMethod (int x, int y = 1) { return x * y; } void Bar (string str) { - var action = $delegate(int foo, int bar) { return MyMethod (bar, foo); }; + Func action = $foo => MyMethod (foo); + } +}"; + + TestRefactoringContext context; + var issues = GetIssues (new SimplifyAnonymousMethodToDelegateIssue (), input, out context); + Assert.AreEqual (0, issues.Count); + } + + [Test] + public void CallExpandsParams () + { + var input = @"using System; +class Foo +{ + int MyMethod (params object[] args) { return 0; } + + void Bar (string str) + { + Func action = $foo => MyMethod (foo); } }"; @@ -197,6 +256,78 @@ class C }"); } + + [Test] + public void Return_ReferenceConversion () + { + var input = @"using System; +class Foo +{ + void Bar (string str) + { + Func action = $foo => MyMethod(foo); + } + string MyMethod(int foo) {} +}"; + + TestRefactoringContext context; + var issues = GetIssues (new SimplifyAnonymousMethodToDelegateIssue (), input, out context); + Assert.AreEqual (1, issues.Count); + } + + [Test] + public void Return_BoxingConversion () + { + var input = @"using System; +class Foo +{ + void Bar (string str) + { + Func action = $foo => MyMethod(foo); + } + bool MyMethod(int foo) {} +}"; + + TestRefactoringContext context; + var issues = GetIssues (new SimplifyAnonymousMethodToDelegateIssue (), input, out context); + Assert.AreEqual (0, issues.Count); + } + + [Test] + public void Parameter_ReferenceConversion () + { + var input = @"using System; +class Foo +{ + void Bar (string str) + { + Action action = $foo => MyMethod(foo); + } + void MyMethod(object foo) {} +}"; + + TestRefactoringContext context; + var issues = GetIssues (new SimplifyAnonymousMethodToDelegateIssue (), input, out context); + Assert.AreEqual (1, issues.Count); + } + + [Test] + public void Parameter_BoxingConversion () + { + var input = @"using System; +class Foo +{ + void Bar (string str) + { + Action action = $foo => MyMethod(foo); + } + void MyMethod(object foo) {} +}"; + + TestRefactoringContext context; + var issues = GetIssues (new SimplifyAnonymousMethodToDelegateIssue (), input, out context); + Assert.AreEqual (0, issues.Count); + } } } From 44f40d755f8eab4d4bd0aeaa50418e943925d47c Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 29 May 2013 22:11:54 +0200 Subject: [PATCH 32/55] Fix bug in AstNode.GetDescendantsImpl() that caused several unit tests to fail. --- ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs | 23 ++++++++++---------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs index 76d6d828a7..434129aac6 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs @@ -343,17 +343,18 @@ namespace ICSharpCode.NRefactory.CSharp yield break; } - Stack descendStack = new Stack(); - descendStack.Push(firstChild); - while (descendStack.Count > 0) { - AstNode cur = descendStack.Pop (); - while (cur != null) { - if (IsInsideRegion(region, cur)) - yield return cur; - if (descendIntoChildren == null || descendIntoChildren(cur)) - descendStack.Push(cur.firstChild); - cur = cur.nextSibling; - } + Stack nextStack = new Stack(); + nextStack.Push(null); + AstNode pos = firstChild; + while (pos != null) { + if (pos.nextSibling != null) + nextStack.Push(pos.nextSibling); + if (IsInsideRegion(region, pos)) + yield return pos; + if (pos.firstChild != null && (descendIntoChildren == null || descendIntoChildren(pos))) + pos = pos.firstChild; + else + pos = nextStack.Pop(); } } From 81c06bd86896870fdd556f9b99638239e6c8be5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 31 May 2013 07:39:17 +0200 Subject: [PATCH 33/55] Fixed potential bug in 'NoDefaultConstructorIssue'. --- .../Refactoring/CodeIssues/NoDefaultConstructorIssue.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NoDefaultConstructorIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NoDefaultConstructorIssue.cs index 2687348a69..fe84183830 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NoDefaultConstructorIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/NoDefaultConstructorIssue.cs @@ -31,11 +31,13 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring public override void VisitTypeDeclaration(TypeDeclaration declaration) { + base.VisitTypeDeclaration(declaration); var result = ctx.Resolve(declaration) as TypeResolveResult; + if (result == null || result.IsError) + return; var baseType = result.Type.DirectBaseTypes.FirstOrDefault(t => !t.IsKnownType(KnownTypeCode.Object) && t.Kind != TypeKind.Interface); - if (baseType != null) - { + if (baseType != null) { var baseConstructor = baseType.GetConstructors(c => c.Parameters.Count == 0).FirstOrDefault(); var memberLookup = new MemberLookup(result.Type.GetDefinition(), ctx.Compilation.MainAssembly, false); @@ -48,8 +50,6 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring } } } - - base.VisitTypeDeclaration(declaration); } public override void VisitConstructorDeclaration(ConstructorDeclaration declaration) From 5b30dbb1e2a51391e0b5c9b84d89e98ab6ac9a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 31 May 2013 11:55:33 +0200 Subject: [PATCH 34/55] ExpressionOfCompatibleTypeCastIssue no longer warns on implicit conversions. --- .../ExpressionOfCompatibleTypeCastIssue.cs | 3 +++ ...xpressionOfCompatibleTypeCastIssueTests.cs | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs index 25f8356c04..e828ebbb9a 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs @@ -78,6 +78,9 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return; if (!foundConversion.IsExplicit) return; + var implicitConversion = conversion.ImplicitConversion(exprType, castToType); + if (implicitConversion != Conversion.None) + return; AddIssue(expression, string.Format(ctx.TranslateString("Cast to '{0}'"), castToType.Name), script => { diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs index 4d129a2d7a..6af34c8099 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs @@ -132,6 +132,29 @@ class TestClass Point p = new Point(); $p += new Vector(); } +}"; + Test(input, 0); + } + + [Test] + public void TestImplicitOperator() + { + var input = @" +struct Vector { + public static implicit operator Point(Vector v) { return new Point(); } +} + +struct Point { + +} + +class TestClass +{ + void TestMethod () + { + Point p; + p = new Vector (); + } }"; Test(input, 0); } From 1cec2e62f802b678b6d9ac5a0b0cc42ca4350b91 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 29 May 2013 22:37:11 +0200 Subject: [PATCH 35/55] Ensure we pass the correct type argument to GatherVisitorBase<>. --- ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs | 10 +++- .../Ast/AstNodeCollection.cs | 11 ++-- .../DuplicateExpressionsInConditionsIssue.cs | 2 +- .../CodeIssues/DuplicateIfInIfChainIssue.cs | 2 +- .../ParameterCanBeIEnumerableIssue.cs | 2 +- .../RedundantBaseConstructorIssue.cs | 2 +- .../CodeIssues/UseBlockInsteadColonIssue.cs | 2 +- .../Refactoring/RefactoringStructureTests.cs | 51 +++++++++++++++++++ .../ICSharpCode.NRefactory.Tests.csproj | 1 + ICSharpCode.NRefactory/Role.cs | 2 +- 10 files changed, 73 insertions(+), 12 deletions(-) create mode 100644 ICSharpCode.NRefactory.Tests/CSharp/Refactoring/RefactoringStructureTests.cs diff --git a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs index 434129aac6..7066f6300e 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs @@ -230,6 +230,10 @@ namespace ICSharpCode.NRefactory.CSharp } } + internal uint RoleIndex { + get { return flags & roleIndexMask; } + } + void SetRole(Role role) { flags = (flags & ~roleIndexMask) | role.Index; @@ -293,14 +297,14 @@ namespace ICSharpCode.NRefactory.CSharp } /// - /// Gets all descendants of this node (excluding this node itself). + /// Gets all descendants of this node (excluding this node itself) in pre-order. /// public IEnumerable Descendants { get { return GetDescendantsImpl(false); } } /// - /// Gets all descendants of this node (including this node itself). + /// Gets all descendants of this node (including this node itself) in pre-order. /// public IEnumerable DescendantsAndSelf { get { return GetDescendantsImpl(true); } @@ -347,6 +351,8 @@ namespace ICSharpCode.NRefactory.CSharp nextStack.Push(null); AstNode pos = firstChild; while (pos != null) { + // Remember next before yielding pos. + // This allows removing/replacing nodes while iterating through the list. if (pos.nextSibling != null) nextStack.Push(pos.nextSibling); if (IsInsideRegion(region, pos)) diff --git a/ICSharpCode.NRefactory.CSharp/Ast/AstNodeCollection.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstNodeCollection.cs index 1a074d392c..32d08b2e4c 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/AstNodeCollection.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/AstNodeCollection.cs @@ -50,8 +50,9 @@ namespace ICSharpCode.NRefactory.CSharp public int Count { get { int count = 0; + uint roleIndex = role.Index; for (AstNode cur = node.FirstChild; cur != null; cur = cur.NextSibling) { - if (cur.Role == role) + if (cur.RoleIndex == roleIndex) count++; } return count; @@ -107,7 +108,7 @@ namespace ICSharpCode.NRefactory.CSharp public bool Contains(T element) { - return element != null && element.Parent == node && element.Role == role; + return element != null && element.Parent == node && element.RoleIndex == role.Index; } public bool Remove(T element) @@ -163,13 +164,14 @@ namespace ICSharpCode.NRefactory.CSharp public IEnumerator GetEnumerator() { + uint roleIndex = role.Index; AstNode next; for (AstNode cur = node.FirstChild; cur != null; cur = next) { Debug.Assert(cur.Parent == node); // Remember next before yielding cur. // This allows removing/replacing nodes while iterating through the list. next = cur.NextSibling; - if (cur.Role == role) + if (cur.RoleIndex == roleIndex) yield return (T)cur; } } @@ -214,13 +216,14 @@ namespace ICSharpCode.NRefactory.CSharp /// public void AcceptVisitor(IAstVisitor visitor) { + uint roleIndex = role.Index; AstNode next; for (AstNode cur = node.FirstChild; cur != null; cur = next) { Debug.Assert(cur.Parent == node); // Remember next before yielding cur. // This allows removing/replacing nodes while iterating through the list. next = cur.NextSibling; - if (cur.Role == role) + if (cur.RoleIndex == roleIndex) cur.AcceptVisitor(visitor); } } diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateExpressionsInConditionsIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateExpressionsInConditionsIssue.cs index f63cf0e785..f568adb198 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateExpressionsInConditionsIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateExpressionsInConditionsIssue.cs @@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring SupportedOperators.Add(BinaryOperatorType.ConditionalOr); } - class GatherVisitor : GatherVisitorBase + class GatherVisitor : GatherVisitorBase { public GatherVisitor (BaseRefactoringContext ctx) : base (ctx) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateIfInIfChainIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateIfInIfChainIssue.cs index 34ffcd1d1a..f87281f73d 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateIfInIfChainIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/DuplicateIfInIfChainIssue.cs @@ -43,7 +43,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return new GatherVisitor (context).GetIssues (); } - class GatherVisitor : GatherVisitorBase + class GatherVisitor : GatherVisitorBase { public GatherVisitor (BaseRefactoringContext ctx) : base (ctx) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ParameterCanBeDemotedIssue/ParameterCanBeIEnumerableIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ParameterCanBeDemotedIssue/ParameterCanBeIEnumerableIssue.cs index ee576faf27..3539a5f01f 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ParameterCanBeDemotedIssue/ParameterCanBeIEnumerableIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ParameterCanBeDemotedIssue/ParameterCanBeIEnumerableIssue.cs @@ -59,7 +59,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring } #endregion - class GatherVisitor : GatherVisitorBase + class GatherVisitor : GatherVisitorBase { bool tryResolve; diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantBaseConstructorIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantBaseConstructorIssue.cs index 83032f6133..0e013c1c08 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantBaseConstructorIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantBaseConstructorIssue.cs @@ -41,7 +41,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return new GatherVisitor(context).GetIssues(); } - class GatherVisitor : GatherVisitorBase + class GatherVisitor : GatherVisitorBase { public GatherVisitor(BaseRefactoringContext ctx) : base (ctx) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseBlockInsteadColonIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseBlockInsteadColonIssue.cs index 1274d6b250..7a03474c48 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseBlockInsteadColonIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/UseBlockInsteadColonIssue.cs @@ -42,7 +42,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return new GatherVisitor (context).GetIssues (); } - class GatherVisitor : GatherVisitorBase + class GatherVisitor : GatherVisitorBase { private readonly string _commandTitle; diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Refactoring/RefactoringStructureTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Refactoring/RefactoringStructureTests.cs new file mode 100644 index 0000000000..9d9df79bae --- /dev/null +++ b/ICSharpCode.NRefactory.Tests/CSharp/Refactoring/RefactoringStructureTests.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; +using System.Reflection; +using NUnit.Framework; + +namespace ICSharpCode.NRefactory.CSharp.Refactoring +{ + [TestFixture] + public class RefactoringStructureTests + { + [Test] + public void GatherVisitorBaseClass() + { + Assembly NR_CSharp = typeof(ICodeIssueProvider).Assembly; + bool foundGatherVisitor = false; + foreach (var topLevelType in NR_CSharp.GetTypes()) { + foreach (var nestedType in topLevelType.GetNestedTypes(BindingFlags.NonPublic | BindingFlags.Public)) { + if (nestedType.Name != "GatherVisitor") + continue; + foundGatherVisitor = true; + bool foundGatherVisitorBase = false; + for (Type baseType = nestedType.BaseType; baseType != null; baseType = baseType.BaseType) { + if (baseType.Name == "GatherVisitorBase`1") { + foundGatherVisitorBase = true; + Assert.AreEqual(new[] { topLevelType }, baseType.GetGenericArguments(), "Invalid base type of " + nestedType.FullName); + } + } + Assert.IsTrue(foundGatherVisitorBase, nestedType.FullName + " should derive from GatherVisitorBase"); + } + } + Assert.IsTrue(foundGatherVisitor, "where are the gather visitors?"); + } + } +} diff --git a/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj b/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj index dd4fae08b9..e07ffd06aa 100644 --- a/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj +++ b/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj @@ -226,6 +226,7 @@ + diff --git a/ICSharpCode.NRefactory/Role.cs b/ICSharpCode.NRefactory/Role.cs index 515eb97795..2a84b464eb 100644 --- a/ICSharpCode.NRefactory/Role.cs +++ b/ICSharpCode.NRefactory/Role.cs @@ -43,7 +43,7 @@ namespace ICSharpCode.NRefactory { this.index = (uint)Interlocked.Increment(ref nextRoleIndex); if (this.index >= roles.Length) - throw new InvalidOperationException(""); + throw new InvalidOperationException("Too many roles"); roles[this.index] = this; } From fb493193e3b58c572267a39cca47d2f83cdf7162 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Fri, 31 May 2013 18:27:45 +0200 Subject: [PATCH 36/55] AddAnotherAccessorAction: don't try to assign to readonly fields --- .../OutputVisitor/CodeDomConvertVisitor.cs | 2 +- .../CodeActions/AddAnotherAccessorAction.cs | 2 +- .../CodeActions/RemoveBackingStoreAction.cs | 2 +- .../CodeIssues/ConstantConditionIssue.cs | 2 +- .../CodeActions/AddAnotherAccessorTests.cs | 31 +++++++++++++++++++ 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs b/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs index 513496c699..f22091776a 100644 --- a/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs @@ -1356,7 +1356,7 @@ namespace ICSharpCode.NRefactory.CSharp CodeObject IAstVisitor.VisitPreProcessorDirective (PreProcessorDirective preProcessorDirective) { - return new CodeComment ("#" + preProcessorDirective.Type.ToString ().ToLower ()); + return new CodeComment ("#" + preProcessorDirective.Type.ToString ().ToLowerInvariant ()); } CodeObject IAstVisitor.VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/AddAnotherAccessorAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/AddAnotherAccessorAction.cs index b093880e66..69384a1278 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/AddAnotherAccessorAction.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/AddAnotherAccessorAction.cs @@ -73,7 +73,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring { if (pdecl.Setter.IsNull && !pdecl.Getter.IsNull) { var field = RemoveBackingStoreAction.ScanGetter (context, pdecl); - if (field != null) + if (field != null && !field.IsReadOnly && !field.IsConst) return new ExpressionStatement (new AssignmentExpression (new IdentifierExpression (field.Name), AssignmentOperatorType.Assign, new IdentifierExpression ("value"))); } diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/RemoveBackingStoreAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/RemoveBackingStoreAction.cs index 6267e0c558..4e1add9b5f 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/RemoveBackingStoreAction.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/RemoveBackingStoreAction.cs @@ -89,7 +89,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring var setterField = ScanSetter (context, propertyDeclaration); if (setterField == null) return null; - if (getterField.Region != setterField.Region) + if (!getterField.Equals(setterField)) return null; return getterField; } diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs index f3d639be49..aac9409f8b 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs @@ -95,7 +95,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring var value = (bool)resolveResult.ConstantValue; var conditionalExpr = condition.Parent as ConditionalExpression; var ifElseStatement = condition.Parent as IfElseStatement; - var valueStr = value.ToString ().ToLower (); + var valueStr = value.ToString ().ToLowerInvariant (); CodeAction action; if (conditionalExpr != null) { diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/AddAnotherAccessorTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/AddAnotherAccessorTests.cs index 5f0369cbce..5e0bd1ae9d 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/AddAnotherAccessorTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/AddAnotherAccessorTests.cs @@ -64,6 +64,37 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions "}", result); } + [Test] + public void TestAddSet_ReadOnlyField () + { + string result = RunContextAction ( + new AddAnotherAccessorAction (), + "class TestClass" + Environment.NewLine + + "{" + Environment.NewLine + + " readonly int field;" + Environment.NewLine + + " public int $Field {" + Environment.NewLine + + " get {" + Environment.NewLine + + " return field;" + Environment.NewLine + + " }" + Environment.NewLine + + " }" + Environment.NewLine + + "}" + ); + + Assert.AreEqual ( + "class TestClass" + Environment.NewLine + + "{" + Environment.NewLine + + " readonly int field;" + Environment.NewLine + + " public int Field {" + Environment.NewLine + + " get {" + Environment.NewLine + + " return field;" + Environment.NewLine + + " }" + Environment.NewLine + + " set {" + Environment.NewLine + + " throw new System.NotImplementedException ();" + Environment.NewLine + + " }" + Environment.NewLine + + " }" + Environment.NewLine + + "}", result); + } + [Test] public void TestAddGet () { From 5f98837c3ce6f4bfd5d931d8750a235a160344bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Mon, 3 Jun 2013 14:12:05 +0200 Subject: [PATCH 37/55] Added first implementation of an ikvm assembly loader (no cecil loader replacement yet). --- .../ICSharpCode.NRefactory.csproj | 1 + .../TypeSystem/IkvmLoader.cs | 2021 +++++++++++++++++ 2 files changed, 2022 insertions(+) create mode 100644 ICSharpCode.NRefactory/TypeSystem/IkvmLoader.cs diff --git a/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj b/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj index 49ddbd6780..615b92631b 100644 --- a/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj +++ b/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj @@ -283,6 +283,7 @@ Documentation\XML Documentation.html + diff --git a/ICSharpCode.NRefactory/TypeSystem/IkvmLoader.cs b/ICSharpCode.NRefactory/TypeSystem/IkvmLoader.cs new file mode 100644 index 0000000000..29ad2b6ff0 --- /dev/null +++ b/ICSharpCode.NRefactory/TypeSystem/IkvmLoader.cs @@ -0,0 +1,2021 @@ +// +// IkvmLoader.cs +// +// Author: +// Daniel Grunwald +// Mike Krüger +// +// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team +// Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Threading; +using ICSharpCode.NRefactory.Documentation; +using ICSharpCode.NRefactory.Semantics; +using ICSharpCode.NRefactory.TypeSystem.Implementation; +using ICSharpCode.NRefactory.Utils; +using IKVM.Reflection; + +namespace ICSharpCode.NRefactory.TypeSystem +{ + /// + /// Allows loading an IProjectContent from an already compiled assembly. + /// + /// Instance methods are not thread-safe; you need to create multiple instances of CecilLoader + /// if you want to load multiple project contents in parallel. + public class IkvmLoader + { + /// + /// Version number of the ikvm loader. + /// Should be incremented when fixing bugs in the ikvm loader so that project contents cached on disk + /// (which might be incorrect due to the bug) are re-created. + /// + const int ikvmLoaderVersion = 1; + + #region Options + /// + /// Specifies whether to include internal members. The default is false. + /// + public bool IncludeInternalMembers { get; set; } + + /// + /// Gets/Sets the documentation provider that is used to retrieve the XML documentation for all members. + /// + public IDocumentationProvider DocumentationProvider { get; set; } + + InterningProvider interningProvider; + + /// + /// Gets/Sets the interning provider. + /// + public InterningProvider InterningProvider { + get { return interningProvider; } + set { + if (value == null) + throw new ArgumentNullException(); + interningProvider = value; + } + } + + /// + /// Gets/Sets the cancellation token used by the cecil loader. + /// + public CancellationToken CancellationToken { get; set; } + + /// + /// This delegate gets executed whenever an entity was loaded. + /// + /// + /// This callback may be to build a dictionary that maps between + /// entities and cecil objects. + /// Warning: if delay-loading is used and the type system is accessed by multiple threads, + /// the callback may be invoked concurrently on multiple threads. + /// + public Action OnEntityLoaded { get; set; } + #endregion + + /// + /// Initializes a new instance of the class. + /// + public IkvmLoader() + { + // Enable interning by default. + this.InterningProvider = new SimpleInterningProvider(); + } + + #region Load Assembly From Disk + + public IUnresolvedAssembly LoadAssemblyFile(string fileName) + { + if (fileName == null) + throw new ArgumentNullException("fileName"); + + var universe = new IKVM.Reflection.Universe (); + return LoadAssembly (universe.LoadFile (fileName)); + } + + #endregion + + IkvmUnresolvedAssembly currentAssembly; + Assembly currentAssemblyDefinition; + + /// + /// Loads the assembly definition into a project content. + /// + /// Unresolved type system representing the assembly + + [CLSCompliant(false)] + public IUnresolvedAssembly LoadAssembly(Assembly assembly) + { + if (assembly == null) + throw new ArgumentNullException ("assembly"); + + // Read assembly and module attributes + IList assemblyAttributes = new List(); + IList moduleAttributes = new List(); + AddAttributes(assembly, assemblyAttributes); + AddAttributes(assembly.ManifestModule, moduleAttributes); + + assemblyAttributes = interningProvider.InternList(assemblyAttributes); + moduleAttributes = interningProvider.InternList(moduleAttributes); + + currentAssemblyDefinition = assembly; + currentAssembly = new IkvmUnresolvedAssembly (assembly.FullName, this.DocumentationProvider); + currentAssembly.Location = assembly.Location; + currentAssembly.AssemblyAttributes.AddRange(assemblyAttributes); + currentAssembly.ModuleAttributes.AddRange(moduleAttributes); + + // Create and register all types: + List ikvmTypeDefs = new List(); + List typeDefs = new List(); + + foreach (var td in assembly.GetTypes ()) { + if (td.DeclaringType != null) + continue; + this.CancellationToken.ThrowIfCancellationRequested(); + + if (this.IncludeInternalMembers || td.IsPublic) { + string name = td.Name; + if (name.Length == 0) + continue; + + var t = CreateTopLevelTypeDefinition(td); + ikvmTypeDefs.Add(td); + typeDefs.Add(t); + currentAssembly.AddTypeDefinition(t); + // The registration will happen after the members are initialized + } + } + + // Initialize the type's members: + for (int i = 0; i < typeDefs.Count; i++) { + InitTypeDefinition(ikvmTypeDefs[i], typeDefs[i]); + } + + // Freezing the assembly here is important: + // otherwise it will be frozen when a compilation is first created + // from it. But freezing has the effect of changing some collection instances + // (to ReadOnlyCollection). This hidden mutation was causing a crash + // when the FastSerializer was saving the assembly at the same time as + // the first compilation was created from it. + // By freezing the assembly now, we ensure it is usable on multiple + // threads without issues. + currentAssembly.Freeze(); + + var result = this.currentAssembly; + this.currentAssembly = null; + return result; + } + + #region IUnresolvedAssembly implementation + [Serializable, FastSerializerVersion(ikvmLoaderVersion)] + sealed class IkvmUnresolvedAssembly : DefaultUnresolvedAssembly, IDocumentationProvider + { + readonly IDocumentationProvider documentationProvider; + + public IkvmUnresolvedAssembly(string fullAssemblyName, IDocumentationProvider documentationProvider) + : base(fullAssemblyName) + { + this.documentationProvider = documentationProvider; + } + + DocumentationComment IDocumentationProvider.GetDocumentation(IEntity entity) + { + if (documentationProvider != null) + return documentationProvider.GetDocumentation(entity); + else + return null; + } + } + #endregion + + #region Read Type Reference + /// + /// Reads a type reference. + /// + /// The Cecil type reference that should be converted into + /// a type system type reference. + /// Attributes associated with the Cecil type reference. + /// This is used to support the 'dynamic' type. + [CLSCompliant(false)] + public ITypeReference ReadTypeReference(IKVM.Reflection.Type type, ICustomAttributeProvider typeAttributes = null) + { + int typeIndex = 0; + return CreateTypeReference(type, typeAttributes, ref typeIndex); + } + + ITypeReference CreateTypeReference(IKVM.Reflection.Type type, ICustomAttributeProvider typeAttributes, ref int typeIndex) + { + // TODO: +// while (type is OptionalModifierType || type is RequiredModifierType) { +// type = ((TypeSpecification)type).ElementType; +// } + if (type == null) { + return SpecialType.UnknownType; + } + + if (type.IsByRef) { + typeIndex++; + return interningProvider.Intern( + new ByReferenceTypeReference( + CreateTypeReference( + type.GetElementType (), + typeAttributes, ref typeIndex))); + } else if (type.IsPointer) { + typeIndex++; + return interningProvider.Intern( + new PointerTypeReference( + CreateTypeReference( + type.GetElementType (), + typeAttributes, ref typeIndex))); + } else if (type.IsArray) { + typeIndex++; + return interningProvider.Intern( + new ArrayTypeReference( + CreateTypeReference( + type.GetElementType (), + typeAttributes, ref typeIndex), + type.GetArrayRank ())); + } else if (type.IsGenericType) { + // GenericInstanceType gType = (GenericInstanceType)type; + ITypeReference baseType = CreateTypeReference(type.GetElementType (), typeAttributes, ref typeIndex); + ITypeReference[] para = new ITypeReference[type.GenericTypeArguments.Length]; + for (int i = 0; i < para.Length; ++i) { + typeIndex++; + para[i] = CreateTypeReference(type.GenericTypeArguments[i], typeAttributes, ref typeIndex); + } + return interningProvider.Intern(new ParameterizedTypeReference(baseType, para)); + } else if (type.IsGenericParameter) { + return TypeParameterReference.Create(type.DeclaringMethod != null ? EntityType.Method : EntityType.TypeDefinition, type.GenericParameterPosition); + } else if (type.IsNested) { + ITypeReference typeRef = CreateTypeReference(type.DeclaringType, typeAttributes, ref typeIndex); + int partTypeParameterCount; + string namepart = ReflectionHelper.SplitTypeParameterCountFromReflectionName(type.Name, out partTypeParameterCount); + namepart = interningProvider.Intern(namepart); + return interningProvider.Intern(new NestedTypeReference(typeRef, namepart, partTypeParameterCount)); + } else { + string ns = interningProvider.Intern(type.Namespace ?? string.Empty); + string name = type.Name; + if (name == null) + throw new InvalidOperationException("type.Name returned null. Type: " + type.ToString()); + + if (name == "Object" && ns == "System" && HasDynamicAttribute(typeAttributes, typeIndex)) { + return SpecialType.Dynamic; + } else { + int typeParameterCount; + name = ReflectionHelper.SplitTypeParameterCountFromReflectionName(name, out typeParameterCount); + name = interningProvider.Intern(name); + if (currentAssembly != null) { + IUnresolvedTypeDefinition c = currentAssembly.GetTypeDefinition(ns, name, typeParameterCount); + if (c != null) + return c; + } + return interningProvider.Intern(new GetClassTypeReference(GetAssemblyReference(type.Assembly), ns, name, typeParameterCount)); + } + } + } + + IAssemblyReference GetAssemblyReference(Assembly scope) + { + if (scope == null || scope == currentAssemblyDefinition) + return DefaultAssemblyReference.CurrentAssembly; + else + return interningProvider.Intern(new DefaultAssemblyReference(scope.FullName)); + } + + static bool HasDynamicAttribute(ICustomAttributeProvider attributeProvider, int typeIndex) + { + //TODO: +// foreach (var a in attributeProvider.__GetCustomAttributes (null ,false)) { +// var type = a.AttributeType; +// if (type.Name == "DynamicAttribute" && type.Namespace == "System.Runtime.CompilerServices") { +// if (a.ConstructorArguments.Count == 1) { +// var values = a.ConstructorArguments[0].Value as CustomAttributeTypedArgument[]; +// if (values != null && typeIndex < values.Length && values[typeIndex].Value is bool) +// return (bool)values[typeIndex].Value; +// } +// return true; +// } +// } + return false; + } + #endregion + + #region Read Attributes + #region Assembly Attributes + static readonly ITypeReference assemblyVersionAttributeTypeRef = typeof(System.Reflection.AssemblyVersionAttribute).ToTypeReference(); + + void AddAttributes(Assembly assembly, IList outputList) + { + AddCustomAttributes(assembly.CustomAttributes, outputList); + + // TODO: +// if (assembly.HasSecurityDeclarations) { +// AddSecurityAttributes(assembly.SecurityDeclarations, outputList); +// } + + // AssemblyVersionAttribute + if (assembly.GetName ().Version != null) { + var assemblyVersion = new DefaultUnresolvedAttribute(assemblyVersionAttributeTypeRef, new[] { KnownTypeReference.String }); + assemblyVersion.PositionalArguments.Add(CreateSimpleConstantValue(KnownTypeReference.String, assembly.GetName ().Version.ToString())); + outputList.Add(interningProvider.Intern(assemblyVersion)); + } + } + + IConstantValue CreateSimpleConstantValue(ITypeReference type, object value) + { + return interningProvider.Intern(new SimpleConstantValue(type, interningProvider.InternValue(value))); + } + #endregion + + #region Module Attributes + void AddAttributes(Module module, IList outputList) + { + AddCustomAttributes(module.CustomAttributes, outputList); + } + #endregion + + #region Parameter Attributes + static readonly IUnresolvedAttribute inAttribute = new DefaultUnresolvedAttribute(typeof(InAttribute).ToTypeReference()); + static readonly IUnresolvedAttribute outAttribute = new DefaultUnresolvedAttribute(typeof(OutAttribute).ToTypeReference()); + + void AddAttributes(ParameterInfo parameter, DefaultUnresolvedParameter targetParameter) + { + if (!targetParameter.IsOut) { + if (parameter.IsIn) + targetParameter.Attributes.Add(inAttribute); + if (parameter.IsOut) + targetParameter.Attributes.Add(outAttribute); + } + AddCustomAttributes(parameter.CustomAttributes, targetParameter.Attributes); + + // TODO: +// if (parameter.HasMarshalInfo) { +// targetParameter.Attributes.Add(ConvertMarshalInfo(parameter.MarshalInfo)); +// } + } + #endregion + + #region Method Attributes + static readonly ITypeReference dllImportAttributeTypeRef = typeof(DllImportAttribute).ToTypeReference(); + static readonly SimpleConstantValue trueValue = new SimpleConstantValue(KnownTypeReference.Boolean, true); + static readonly SimpleConstantValue falseValue = new SimpleConstantValue(KnownTypeReference.Boolean, false); + static readonly ITypeReference callingConventionTypeRef = typeof(CallingConvention).ToTypeReference(); + static readonly IUnresolvedAttribute preserveSigAttribute = new DefaultUnresolvedAttribute(typeof(PreserveSigAttribute).ToTypeReference()); + static readonly ITypeReference methodImplAttributeTypeRef = typeof(MethodImplAttribute).ToTypeReference(); + static readonly ITypeReference methodImplOptionsTypeRef = typeof(MethodImplOptions).ToTypeReference(); + + static bool HasAnyAttributes(MethodInfo methodDefinition) + { + if (methodDefinition.Attributes.HasFlag (MethodAttributes.PinvokeImpl)) + return true; + // TODO: +// if ((methodDefinition.ImplAttributes & ~MethodImplAttributes.CodeTypeMask) != 0) +// return true; +// if (methodDefinition.MethodReturnType.HasFieldMarshal) +// return true; + return methodDefinition.CustomAttributes.Any (); + } + + void AddAttributes(MethodInfo methodDefinition, IList attributes, IList returnTypeAttributes) + { + var implAttributes = methodDefinition.MethodImplementationFlags; + + #region DllImportAttribute +// TODO: +// if (methodDefinition.HasPInvokeInfo && methodDefinition.PInvokeInfo != null) { +// PInvokeInfo info = methodDefinition.PInvokeInfo; +// var dllImport = new DefaultUnresolvedAttribute(dllImportAttributeTypeRef, new[] { KnownTypeReference.String }); +// dllImport.PositionalArguments.Add(CreateSimpleConstantValue(KnownTypeReference.String, info.Module.Name)); +// +// if (info.IsBestFitDisabled) +// dllImport.AddNamedFieldArgument("BestFitMapping", falseValue); +// if (info.IsBestFitEnabled) +// dllImport.AddNamedFieldArgument("BestFitMapping", trueValue); +// +// CallingConvention callingConvention; +// switch (info.Attributes & PInvokeAttributes.CallConvMask) { +// case (PInvokeAttributes)0: +// Debug.WriteLine ("P/Invoke calling convention not set on:" + methodDefinition.FullName); +// callingConvention = CallingConvention.StdCall; +// break; +// case PInvokeAttributes.CallConvCdecl: +// callingConvention = CallingConvention.Cdecl; +// break; +// case PInvokeAttributes.CallConvFastcall: +// callingConvention = CallingConvention.FastCall; +// break; +// case PInvokeAttributes.CallConvStdCall: +// callingConvention = CallingConvention.StdCall; +// break; +// case PInvokeAttributes.CallConvThiscall: +// callingConvention = CallingConvention.ThisCall; +// break; +// case PInvokeAttributes.CallConvWinapi: +// callingConvention = CallingConvention.Winapi; +// break; +// default: +// throw new NotSupportedException("unknown calling convention"); +// } +// if (callingConvention != CallingConvention.Winapi) +// dllImport.AddNamedFieldArgument("CallingConvention", CreateSimpleConstantValue(callingConventionTypeRef, (int)callingConvention)); +// +// CharSet charSet = CharSet.None; +// switch (info.Attributes & PInvokeAttributes.CharSetMask) { +// case PInvokeAttributes.CharSetAnsi: +// charSet = CharSet.Ansi; +// break; +// case PInvokeAttributes.CharSetAuto: +// charSet = CharSet.Auto; +// break; +// case PInvokeAttributes.CharSetUnicode: +// charSet = CharSet.Unicode; +// break; +// } +// if (charSet != CharSet.None) +// dllImport.AddNamedFieldArgument("CharSet", CreateSimpleConstantValue(charSetTypeRef, (int)charSet)); +// +// if (!string.IsNullOrEmpty(info.EntryPoint) && info.EntryPoint != methodDefinition.Name) +// dllImport.AddNamedFieldArgument("EntryPoint", CreateSimpleConstantValue(KnownTypeReference.String, info.EntryPoint)); +// +// if (info.IsNoMangle) +// dllImport.AddNamedFieldArgument("ExactSpelling", trueValue); +// +// if ((implAttributes & MethodImplAttributes.PreserveSig) == MethodImplAttributes.PreserveSig) +// implAttributes &= ~MethodImplAttributes.PreserveSig; +// else +// dllImport.AddNamedFieldArgument("PreserveSig", falseValue); +// +// if (info.SupportsLastError) +// dllImport.AddNamedFieldArgument("SetLastError", trueValue); +// +// if (info.IsThrowOnUnmappableCharDisabled) +// dllImport.AddNamedFieldArgument("ThrowOnUnmappableChar", falseValue); +// if (info.IsThrowOnUnmappableCharEnabled) +// dllImport.AddNamedFieldArgument("ThrowOnUnmappableChar", trueValue); +// +// attributes.Add(interningProvider.Intern(dllImport)); +// } + #endregion + + #region PreserveSigAttribute + if (implAttributes == MethodImplAttributes.PreserveSig) { + attributes.Add(preserveSigAttribute); + implAttributes = 0; + } + #endregion + + #region MethodImplAttribute + if (implAttributes != MethodImplAttributes.IL) { + var methodImpl = new DefaultUnresolvedAttribute(methodImplAttributeTypeRef, new[] { methodImplOptionsTypeRef }); + methodImpl.PositionalArguments.Add(CreateSimpleConstantValue(methodImplOptionsTypeRef, (int)implAttributes)); + attributes.Add(interningProvider.Intern(methodImpl)); + } + #endregion + + AddCustomAttributes(methodDefinition.CustomAttributes, attributes); + // TODO: +// if (methodDefinition.HasSecurityDeclarations) { +// AddSecurityAttributes(methodDefinition.SecurityDeclarations, attributes); +// } +// returnTypeAttributes.Add(ConvertMarshalInfo(methodDefinition.MethodReturnType.MarshalInfo)); + AddCustomAttributes(methodDefinition.ReturnType.CustomAttributes, returnTypeAttributes); + } + #endregion + + #region Type Attributes + static readonly DefaultUnresolvedAttribute serializableAttribute = new DefaultUnresolvedAttribute(typeof(SerializableAttribute).ToTypeReference()); + static readonly DefaultUnresolvedAttribute comImportAttribute = new DefaultUnresolvedAttribute(typeof(ComImportAttribute).ToTypeReference()); + static readonly ITypeReference structLayoutAttributeTypeRef = typeof(StructLayoutAttribute).ToTypeReference(); + static readonly ITypeReference layoutKindTypeRef = typeof(LayoutKind).ToTypeReference(); + static readonly ITypeReference charSetTypeRef = typeof(CharSet).ToTypeReference(); + + void AddAttributes(IKVM.Reflection.Type typeDefinition, IUnresolvedTypeDefinition targetEntity) + { + // SerializableAttribute + if (typeDefinition.IsSerializable) + targetEntity.Attributes.Add(serializableAttribute); + + // ComImportAttribute + if (typeDefinition.IsImport) + targetEntity.Attributes.Add(comImportAttribute); + + #region StructLayoutAttribute + LayoutKind layoutKind = LayoutKind.Auto; + switch (typeDefinition.Attributes & TypeAttributes.LayoutMask) { + case TypeAttributes.SequentialLayout: + layoutKind = LayoutKind.Sequential; + break; + case TypeAttributes.ExplicitLayout: + layoutKind = LayoutKind.Explicit; + break; + } + CharSet charSet = CharSet.None; + switch (typeDefinition.Attributes & TypeAttributes.StringFormatMask) { + case TypeAttributes.AnsiClass: + charSet = CharSet.Ansi; + break; + case TypeAttributes.AutoClass: + charSet = CharSet.Auto; + break; + case TypeAttributes.UnicodeClass: + charSet = CharSet.Unicode; + break; + } + // TODO: +// LayoutKind defaultLayoutKind = (typeDefinition.IsValueType && !typeDefinition.IsEnum) ? LayoutKind.Sequential: LayoutKind.Auto; +// if (layoutKind != defaultLayoutKind || charSet != CharSet.Ansi || typeDefinition.PackingSize > 0 || typeDefinition.ClassSize > 0) { +// DefaultUnresolvedAttribute structLayout = new DefaultUnresolvedAttribute(structLayoutAttributeTypeRef, new[] { layoutKindTypeRef }); +// structLayout.PositionalArguments.Add(CreateSimpleConstantValue(layoutKindTypeRef, (int)layoutKind)); +// if (charSet != CharSet.Ansi) { +// structLayout.AddNamedFieldArgument("CharSet", CreateSimpleConstantValue(charSetTypeRef, (int)charSet)); +// } +// if (typeDefinition.PackingSize > 0) { +// structLayout.AddNamedFieldArgument("Pack", CreateSimpleConstantValue(KnownTypeReference.Int32, (int)typeDefinition.PackingSize)); +// } +// if (typeDefinition.ClassSize > 0) { +// structLayout.AddNamedFieldArgument("Size", CreateSimpleConstantValue(KnownTypeReference.Int32, (int)typeDefinition.ClassSize)); +// } +// targetEntity.Attributes.Add(interningProvider.Intern(structLayout)); +// } + #endregion + + AddCustomAttributes(typeDefinition.CustomAttributes, targetEntity.Attributes); + + // TODO: +// if (typeDefinition.HasSecurityDeclarations) { +// AddSecurityAttributes(typeDefinition.SecurityDeclarations, targetEntity.Attributes); +// } + } + #endregion + + #region Field Attributes + static readonly ITypeReference fieldOffsetAttributeTypeRef = typeof(FieldOffsetAttribute).ToTypeReference(); + static readonly IUnresolvedAttribute nonSerializedAttribute = new DefaultUnresolvedAttribute(typeof(NonSerializedAttribute).ToTypeReference()); + + void AddAttributes(FieldInfo fieldDefinition, IUnresolvedEntity targetEntity) + { + // FieldOffsetAttribute + + // TODO: +// if (fieldDefinition.HasLayoutInfo) { +// DefaultUnresolvedAttribute fieldOffset = new DefaultUnresolvedAttribute(fieldOffsetAttributeTypeRef, new[] { KnownTypeReference.Int32 }); +// fieldOffset.PositionalArguments.Add(CreateSimpleConstantValue(KnownTypeReference.Int32, fieldDefinition.Offset)); +// targetEntity.Attributes.Add(interningProvider.Intern(fieldOffset)); +// } + + // NonSerializedAttribute + if (fieldDefinition.IsNotSerialized) { + targetEntity.Attributes.Add(nonSerializedAttribute); + } + FieldMarshal marshal; + if (fieldDefinition.__TryGetFieldMarshal (out marshal)) + targetEntity.Attributes.Add(ConvertMarshalInfo(marshal)); + + AddCustomAttributes(fieldDefinition.CustomAttributes, targetEntity.Attributes); + } + #endregion + + #region Event Attributes + void AddAttributes(EventInfo eventDefinition, IUnresolvedEntity targetEntity) + { + AddCustomAttributes(eventDefinition.CustomAttributes, targetEntity.Attributes); + } + #endregion + + #region Property Attributes + void AddAttributes(PropertyInfo propertyDefinition, IUnresolvedEntity targetEntity) + { + AddCustomAttributes(propertyDefinition.CustomAttributes, targetEntity.Attributes); + } + #endregion + + #region MarshalAsAttribute (ConvertMarshalInfo) + static readonly ITypeReference marshalAsAttributeTypeRef = typeof(MarshalAsAttribute).ToTypeReference(); + static readonly ITypeReference unmanagedTypeTypeRef = typeof(UnmanagedType).ToTypeReference(); + + + IUnresolvedAttribute ConvertMarshalInfo(FieldMarshal marshalInfo) + { + DefaultUnresolvedAttribute attr = new DefaultUnresolvedAttribute(marshalAsAttributeTypeRef, new[] { unmanagedTypeTypeRef }); + attr.PositionalArguments.Add(CreateSimpleConstantValue(unmanagedTypeTypeRef, (int)marshalInfo.UnmanagedType)); + + + if (marshalInfo.UnmanagedType ==UnmanagedType.ByValArray) { + attr.AddNamedFieldArgument("SizeConst", CreateSimpleConstantValue(KnownTypeReference.Int32, (int)marshalInfo.SizeConst)); + if (marshalInfo.ArraySubType.HasValue) + attr.AddNamedFieldArgument("ArraySubType", CreateSimpleConstantValue(unmanagedTypeTypeRef, (int)marshalInfo.ArraySubType.Value)); + } + + if (marshalInfo.UnmanagedType ==UnmanagedType.SafeArray) { + attr.AddNamedFieldArgument("SafeArraySubType", CreateSimpleConstantValue(typeof(VarEnum).ToTypeReference(), (int)marshalInfo.SafeArraySubType)); + } + + if (marshalInfo.UnmanagedType == UnmanagedType.LPArray) { + attr.AddNamedFieldArgument("ArraySubType", CreateSimpleConstantValue(unmanagedTypeTypeRef, (int)marshalInfo.ArraySubType)); + if (marshalInfo.SizeConst >= 0) + attr.AddNamedFieldArgument("SizeConst", CreateSimpleConstantValue(KnownTypeReference.Int32, (int)marshalInfo.SizeConst)); + if (marshalInfo.SizeParamIndex >= 0) + attr.AddNamedFieldArgument("SizeParamIndex", CreateSimpleConstantValue(KnownTypeReference.Int16, (short)marshalInfo.SizeParamIndex)); + } + + if (marshalInfo.UnmanagedType == UnmanagedType.CustomMarshaler) { + attr.AddNamedFieldArgument("MarshalType", CreateSimpleConstantValue(KnownTypeReference.String, marshalInfo.MarshalTypeRef.FullName)); + if (!string.IsNullOrEmpty(marshalInfo.MarshalCookie)) + attr.AddNamedFieldArgument("MarshalCookie", CreateSimpleConstantValue(KnownTypeReference.String, marshalInfo.MarshalCookie)); + } + + if (marshalInfo.UnmanagedType == UnmanagedType.ByValTStr) { + attr.AddNamedFieldArgument("SizeConst", CreateSimpleConstantValue(KnownTypeReference.Int32, (int)marshalInfo.SizeConst)); + } + + return InterningProvider.Intern(attr); + } + #endregion + + #region Custom Attributes (ReadAttribute) + void AddCustomAttributes(IEnumerable attributes, IList targetCollection) + { + foreach (var cecilAttribute in attributes) { + var type = cecilAttribute.AttributeType; + if (type.Namespace == "System.Runtime.CompilerServices") { + if (type.Name == "DynamicAttribute" || type.Name == "ExtensionAttribute" || type.Name == "DecimalConstantAttribute") + continue; + } else if (type.Name == "ParamArrayAttribute" && type.Namespace == "System") { + continue; + } + targetCollection.Add(ReadAttribute(cecilAttribute)); + } + } + + [CLSCompliant(false)] + public IUnresolvedAttribute ReadAttribute(CustomAttributeData attribute) + { + if (attribute == null) + throw new ArgumentNullException("attribute"); + var ctor = attribute.Constructor; + ITypeReference attributeType = ReadTypeReference(attribute.AttributeType); + IList ctorParameterTypes = EmptyList.Instance; + var parameters = ctor.GetParameters (); + if (parameters.Length > 0) { + ctorParameterTypes = new ITypeReference[parameters.Length]; + for (int i = 0; i < ctorParameterTypes.Count; i++) { + ctorParameterTypes[i] = ReadTypeReference(parameters[i].ParameterType); + } + ctorParameterTypes = interningProvider.InternList(ctorParameterTypes); + } + return interningProvider.Intern(new CecilUnresolvedAttribute(attributeType, ctorParameterTypes, attribute.__GetBlob ())); + } + #endregion + + #region CecilUnresolvedAttribute + static int GetBlobHashCode(byte[] blob) + { + unchecked { + int hash = 0; + foreach (byte b in blob) { + hash *= 257; + hash += b; + } + return hash; + } + } + + static bool BlobEquals(byte[] a, byte[] b) + { + if (a.Length != b.Length) + return false; + for (int i = 0; i < a.Length; i++) { + if (a[i] != b[i]) + return false; + } + return true; + } + + [Serializable, FastSerializerVersion(ikvmLoaderVersion)] + sealed class CecilUnresolvedAttribute : IUnresolvedAttribute, ISupportsInterning + { + internal readonly ITypeReference attributeType; + internal readonly IList ctorParameterTypes; + internal readonly byte[] blob; + + public CecilUnresolvedAttribute(ITypeReference attributeType, IList ctorParameterTypes, byte[] blob) + { + Debug.Assert(attributeType != null); + Debug.Assert(ctorParameterTypes != null); + Debug.Assert(blob != null); + this.attributeType = attributeType; + this.ctorParameterTypes = ctorParameterTypes; + this.blob = blob; + } + + DomRegion IUnresolvedAttribute.Region { + get { return DomRegion.Empty; } + } + + IAttribute IUnresolvedAttribute.CreateResolvedAttribute(ITypeResolveContext context) + { + if (context.CurrentAssembly == null) + throw new InvalidOperationException("Cannot resolve CecilUnresolvedAttribute without a parent assembly"); + return new CecilResolvedAttribute(context, this); + } + + int ISupportsInterning.GetHashCodeForInterning() + { + return attributeType.GetHashCode() ^ ctorParameterTypes.GetHashCode() ^ GetBlobHashCode(blob); + } + + bool ISupportsInterning.EqualsForInterning(ISupportsInterning other) + { + CecilUnresolvedAttribute o = other as CecilUnresolvedAttribute; + return o != null && attributeType == o.attributeType && ctorParameterTypes == o.ctorParameterTypes + && BlobEquals(blob, o.blob); + } + } + #endregion + + #region CecilResolvedAttribute + sealed class CecilResolvedAttribute : IAttribute + { + readonly ITypeResolveContext context; + readonly byte[] blob; + readonly IList ctorParameterTypes; + readonly IType attributeType; + + IMethod constructor; + volatile bool constructorResolved; + + IList positionalArguments; + IList> namedArguments; + + public CecilResolvedAttribute(ITypeResolveContext context, CecilUnresolvedAttribute unresolved) + { + this.context = context; + this.blob = unresolved.blob; + this.ctorParameterTypes = unresolved.ctorParameterTypes; + this.attributeType = unresolved.attributeType.Resolve(context); + } + + public CecilResolvedAttribute(ITypeResolveContext context, IType attributeType) + { + this.context = context; + this.attributeType = attributeType; + this.ctorParameterTypes = EmptyList.Instance; + } + + public DomRegion Region { + get { return DomRegion.Empty; } + } + + public IType AttributeType { + get { return attributeType; } + } + + public IMethod Constructor { + get { + if (!constructorResolved) { + constructor = ResolveConstructor(); + constructorResolved = true; + } + return constructor; + } + } + + IMethod ResolveConstructor() + { + var parameterTypes = ctorParameterTypes.Resolve(context); + foreach (var ctor in attributeType.GetConstructors(m => m.Parameters.Count == parameterTypes.Count)) { + bool ok = true; + for (int i = 0; i < parameterTypes.Count; i++) { + if (!ctor.Parameters[i].Type.Equals(parameterTypes[i])) { + ok = false; + break; + } + } + if (ok) + return ctor; + } + return null; + } + + public IList PositionalArguments { + get { + var result = LazyInit.VolatileRead(ref this.positionalArguments); + if (result != null) { + return result; + } + DecodeBlob(); + return positionalArguments; + } + } + + public IList> NamedArguments { + get { + var result = LazyInit.VolatileRead(ref this.namedArguments); + if (result != null) { + return result; + } + DecodeBlob(); + return namedArguments; + } + } + + public override string ToString() + { + return "[" + attributeType.ToString() + "(...)]"; + } + + void DecodeBlob() + { + var positionalArguments = new List(); + var namedArguments = new List>(); + DecodeBlob(positionalArguments, namedArguments); + Interlocked.CompareExchange(ref this.positionalArguments, positionalArguments, null); + Interlocked.CompareExchange(ref this.namedArguments, namedArguments, null); + } + + void DecodeBlob(List positionalArguments, List> namedArguments) + { + if (blob == null) + return; + BlobReader reader = new BlobReader(blob, context.CurrentAssembly); + if (reader.ReadUInt16() != 0x0001) { + Debug.WriteLine("Unknown blob prolog"); + return; + } + foreach (var ctorParameter in ctorParameterTypes.Resolve(context)) { + ResolveResult arg = reader.ReadFixedArg(ctorParameter); + positionalArguments.Add(arg); + if (arg.IsError) { + // After a decoding error, we must stop decoding the blob because + // we might have read too few bytes due to the error. + // Just fill up the remaining arguments with ErrorResolveResult: + while (positionalArguments.Count < ctorParameterTypes.Count) + positionalArguments.Add(ErrorResolveResult.UnknownError); + return; + } + } + ushort numNamed = reader.ReadUInt16(); + for (int i = 0; i < numNamed; i++) { + var namedArg = reader.ReadNamedArg(attributeType); + if (namedArg.Key != null) + namedArguments.Add(namedArg); + } + } + } + #endregion + + #region class BlobReader + class BlobReader + { + byte[] buffer; + int position; + readonly IAssembly currentResolvedAssembly; + + public BlobReader(byte[] buffer, IAssembly currentResolvedAssembly) + { + if (buffer == null) + throw new ArgumentNullException("buffer"); + this.buffer = buffer; + this.currentResolvedAssembly = currentResolvedAssembly; + } + + public byte ReadByte() + { + return buffer[position++]; + } + + public sbyte ReadSByte() + { + unchecked { + return(sbyte) ReadByte(); + } + } + + public byte[] ReadBytes(int length) + { + var bytes = new byte[length]; + Buffer.BlockCopy(buffer, position, bytes, 0, length); + position += length; + return bytes; + } + + public ushort ReadUInt16() + { + unchecked { + ushort value =(ushort)(buffer[position] + |(buffer[position + 1] << 8)); + position += 2; + return value; + } + } + + public short ReadInt16() + { + unchecked { + return(short) ReadUInt16(); + } + } + + public uint ReadUInt32() + { + unchecked { + uint value =(uint)(buffer[position] + |(buffer[position + 1] << 8) + |(buffer[position + 2] << 16) + |(buffer[position + 3] << 24)); + position += 4; + return value; + } + } + + public int ReadInt32() + { + unchecked { + return(int) ReadUInt32(); + } + } + + public ulong ReadUInt64() + { + unchecked { + uint low = ReadUInt32(); + uint high = ReadUInt32(); + + return(((ulong) high) << 32) | low; + } + } + + public long ReadInt64() + { + unchecked { + return(long) ReadUInt64(); + } + } + + public uint ReadCompressedUInt32() + { + unchecked { + byte first = ReadByte(); + if((first & 0x80) == 0) + return first; + + if((first & 0x40) == 0) + return((uint)(first & ~0x80) << 8) + | ReadByte(); + + return((uint)(first & ~0xc0) << 24) + |(uint) ReadByte() << 16 + |(uint) ReadByte() << 8 + | ReadByte(); + } + } + + public float ReadSingle() + { + unchecked { + if(!BitConverter.IsLittleEndian) { + var bytes = ReadBytes(4); + Array.Reverse(bytes); + return BitConverter.ToSingle(bytes, 0); + } + + float value = BitConverter.ToSingle(buffer, position); + position += 4; + return value; + } + } + + public double ReadDouble() + { + unchecked { + if(!BitConverter.IsLittleEndian) { + var bytes = ReadBytes(8); + Array.Reverse(bytes); + return BitConverter.ToDouble(bytes, 0); + } + + double value = BitConverter.ToDouble(buffer, position); + position += 8; + return value; + } + } + + public ResolveResult ReadFixedArg(IType argType) + { + if (argType.Kind == TypeKind.Array) { + if (((ArrayType)argType).Dimensions != 1) { + // Only single-dimensional arrays are supported + return ErrorResolveResult.UnknownError; + } + IType elementType = ((ArrayType)argType).ElementType; + uint numElem = ReadUInt32(); + if (numElem == 0xffffffff) { + // null reference + return new ConstantResolveResult(argType, null); + } else { + ResolveResult[] elements = new ResolveResult[numElem]; + for (int i = 0; i < elements.Length; i++) { + elements[i] = ReadElem(elementType); + // Stop decoding when encountering an error: + if (elements[i].IsError) + return ErrorResolveResult.UnknownError; + } + IType int32 = currentResolvedAssembly.Compilation.FindType(KnownTypeCode.Int32); + ResolveResult[] sizeArgs = { new ConstantResolveResult(int32, elements.Length) }; + return new ArrayCreateResolveResult(argType, sizeArgs, elements); + } + } else { + return ReadElem(argType); + } + } + + public ResolveResult ReadElem(IType elementType) + { + ITypeDefinition underlyingType; + if (elementType.Kind == TypeKind.Enum) { + underlyingType = elementType.GetDefinition().EnumUnderlyingType.GetDefinition(); + } else { + underlyingType = elementType.GetDefinition(); + } + if (underlyingType == null) + return ErrorResolveResult.UnknownError; + KnownTypeCode typeCode = underlyingType.KnownTypeCode; + if (typeCode == KnownTypeCode.Object) { + // boxed value type + IType boxedTyped = ReadCustomAttributeFieldOrPropType(); + ResolveResult elem = ReadElem(boxedTyped); + if (elem.IsCompileTimeConstant && elem.ConstantValue == null) + return new ConstantResolveResult(elementType, null); + else + return new ConversionResolveResult(elementType, elem, Conversion.BoxingConversion); + } else if (typeCode == KnownTypeCode.Type) { + return new TypeOfResolveResult(underlyingType, ReadType()); + } else { + return new ConstantResolveResult(elementType, ReadElemValue(typeCode)); + } + } + + object ReadElemValue(KnownTypeCode typeCode) + { + switch (typeCode) { + case KnownTypeCode.Boolean: + return ReadByte() != 0; + case KnownTypeCode.Char: + return (char)ReadUInt16(); + case KnownTypeCode.SByte: + return ReadSByte(); + case KnownTypeCode.Byte: + return ReadByte(); + case KnownTypeCode.Int16: + return ReadInt16(); + case KnownTypeCode.UInt16: + return ReadUInt16(); + case KnownTypeCode.Int32: + return ReadInt32(); + case KnownTypeCode.UInt32: + return ReadUInt32(); + case KnownTypeCode.Int64: + return ReadInt64(); + case KnownTypeCode.UInt64: + return ReadUInt64(); + case KnownTypeCode.Single: + return ReadSingle(); + case KnownTypeCode.Double: + return ReadDouble(); + case KnownTypeCode.String: + return ReadSerString(); + default: + throw new NotSupportedException(); + } + } + + public string ReadSerString () + { + if (buffer [position] == 0xff) { + position++; + return null; + } + + int length = (int) ReadCompressedUInt32(); + if (length == 0) + return string.Empty; + + string @string = System.Text.Encoding.UTF8.GetString( + buffer, position, + buffer [position + length - 1] == 0 ? length - 1 : length); + + position += length; + return @string; + } + + public KeyValuePair ReadNamedArg(IType attributeType) + { + EntityType memberType; + var b = ReadByte(); + switch (b) { + case 0x53: + memberType = EntityType.Field; + break; + case 0x54: + memberType = EntityType.Property; + break; + default: + throw new NotSupportedException(string.Format("Custom member type 0x{0:x} is not supported.", b)); + } + IType type = ReadCustomAttributeFieldOrPropType(); + string name = ReadSerString(); + ResolveResult val = ReadFixedArg(type); + IMember member = null; + // Use last matching member, as GetMembers() returns members from base types first. + foreach (IMember m in attributeType.GetMembers(m => m.EntityType == memberType && m.Name == name)) { + if (m.ReturnType.Equals(type)) + member = m; + } + return new KeyValuePair(member, val); + } + + IType ReadCustomAttributeFieldOrPropType() + { + ICompilation compilation = currentResolvedAssembly.Compilation; + var b = ReadByte(); + switch (b) { + case 0x02: + return compilation.FindType(KnownTypeCode.Boolean); + case 0x03: + return compilation.FindType(KnownTypeCode.Char); + case 0x04: + return compilation.FindType(KnownTypeCode.SByte); + case 0x05: + return compilation.FindType(KnownTypeCode.Byte); + case 0x06: + return compilation.FindType(KnownTypeCode.Int16); + case 0x07: + return compilation.FindType(KnownTypeCode.UInt16); + case 0x08: + return compilation.FindType(KnownTypeCode.Int32); + case 0x09: + return compilation.FindType(KnownTypeCode.UInt32); + case 0x0a: + return compilation.FindType(KnownTypeCode.Int64); + case 0x0b: + return compilation.FindType(KnownTypeCode.UInt64); + case 0x0c: + return compilation.FindType(KnownTypeCode.Single); + case 0x0d: + return compilation.FindType(KnownTypeCode.Double); + case 0x0e: + return compilation.FindType(KnownTypeCode.String); + case 0x1d: + return new ArrayType(compilation, ReadCustomAttributeFieldOrPropType()); + case 0x50: + return compilation.FindType(KnownTypeCode.Type); + case 0x51: // boxed value type + return compilation.FindType(KnownTypeCode.Object); + case 0x55: // enum + return ReadType(); + default: + throw new NotSupportedException(string.Format("Custom attribute type 0x{0:x} is not supported.", b)); + } + } + + IType ReadType() + { + string typeName = ReadSerString(); + ITypeReference typeReference = ReflectionHelper.ParseReflectionName(typeName); + IType typeInCurrentAssembly = typeReference.Resolve(new SimpleTypeResolveContext(currentResolvedAssembly)); + if (typeInCurrentAssembly.Kind != TypeKind.Unknown) + return typeInCurrentAssembly; + + // look for the type in mscorlib + ITypeDefinition systemObject = currentResolvedAssembly.Compilation.FindType(KnownTypeCode.Object).GetDefinition(); + if (systemObject != null) { + return typeReference.Resolve(new SimpleTypeResolveContext(systemObject.ParentAssembly)); + } else { + // couldn't find corlib - return the unknown IType for the current assembly + return typeInCurrentAssembly; + } + } + } + #endregion + + #region Security Attributes + static readonly ITypeReference securityActionTypeReference = typeof(System.Security.Permissions.SecurityAction).ToTypeReference(); + static readonly ITypeReference permissionSetAttributeTypeReference = typeof(System.Security.Permissions.PermissionSetAttribute).ToTypeReference(); + + /// + /// Reads a security declaration. + /// +// [CLSCompliant(false)] +// public IList ReadSecurityDeclaration(SecurityDeclaration secDecl) +// { +// if (secDecl == null) +// throw new ArgumentNullException("secDecl"); +// var result = new List(); +// AddSecurityAttributes(secDecl, result); +// return result; +// } +// +// void AddSecurityAttributes(Mono.Collections.Generic.Collection securityDeclarations, IList targetCollection) +// { +// foreach (var secDecl in securityDeclarations) { +// AddSecurityAttributes(secDecl, targetCollection); +// } +// } +// +// void AddSecurityAttributes(SecurityDeclaration secDecl, IList targetCollection) +// { +// byte[] blob = secDecl.GetBlob(); +// BlobReader reader = new BlobReader(blob, null); +// var securityAction = new SimpleConstantValue(securityActionTypeReference, (int)secDecl.Action); +// if (reader.ReadByte() == '.') { +// // binary attribute +// uint attributeCount = reader.ReadCompressedUInt32(); +// UnresolvedSecurityDeclaration unresolvedSecDecl = new UnresolvedSecurityDeclaration(securityAction, blob); +// unresolvedSecDecl = interningProvider.Intern(unresolvedSecDecl); +// for (uint i = 0; i < attributeCount; i++) { +// targetCollection.Add(interningProvider.Intern(new UnresolvedSecurityAttribute(unresolvedSecDecl, (int)i))); +// } +// } else { +// // for backward compatibility with .NET 1.0: XML-encoded attribute +// var attr = new DefaultUnresolvedAttribute(permissionSetAttributeTypeReference); +// attr.ConstructorParameterTypes.Add(securityActionTypeReference); +// attr.PositionalArguments.Add(securityAction); +// string xml = System.Text.Encoding.Unicode.GetString(blob); +// attr.AddNamedPropertyArgument("XML", CreateSimpleConstantValue(KnownTypeReference.String, xml)); +// targetCollection.Add(interningProvider.Intern(attr)); +// } +// } + + [Serializable, FastSerializerVersion(ikvmLoaderVersion)] + sealed class UnresolvedSecurityDeclaration : ISupportsInterning + { + readonly IConstantValue securityAction; + readonly byte[] blob; + + public UnresolvedSecurityDeclaration(IConstantValue securityAction, byte[] blob) + { + Debug.Assert(securityAction != null); + Debug.Assert(blob != null); + this.securityAction = securityAction; + this.blob = blob; + } + + public IList Resolve(IAssembly currentAssembly) + { + // TODO: make this a per-assembly cache +// CacheManager cache = currentAssembly.Compilation.CacheManager; +// IList result = (IList)cache.GetShared(this); +// if (result != null) +// return result; + + ITypeResolveContext context = new SimpleTypeResolveContext(currentAssembly); + BlobReader reader = new BlobReader(blob, currentAssembly); + if (reader.ReadByte() != '.') { + // should not use UnresolvedSecurityDeclaration for XML secdecls + throw new InvalidOperationException(); + } + ResolveResult securityActionRR = securityAction.Resolve(context); + uint attributeCount = reader.ReadCompressedUInt32(); + IAttribute[] attributes = new IAttribute[attributeCount]; + try { + ReadSecurityBlob(reader, attributes, context, securityActionRR); + } catch (NotSupportedException ex) { + // ignore invalid blobs + Debug.WriteLine(ex.ToString()); + } + for (int i = 0; i < attributes.Length; i++) { + if (attributes[i] == null) + attributes[i] = new CecilResolvedAttribute(context, SpecialType.UnknownType); + } + return attributes; +// return (IList)cache.GetOrAddShared(this, attributes); + } + + void ReadSecurityBlob(BlobReader reader, IAttribute[] attributes, ITypeResolveContext context, ResolveResult securityActionRR) + { + for (int i = 0; i < attributes.Length; i++) { + string attributeTypeName = reader.ReadSerString(); + ITypeReference attributeTypeRef = ReflectionHelper.ParseReflectionName(attributeTypeName); + IType attributeType = attributeTypeRef.Resolve(context); + + reader.ReadCompressedUInt32(); // ?? + // The specification seems to be incorrect here, so I'm using the logic from Cecil instead. + uint numNamed = reader.ReadCompressedUInt32(); + + var namedArgs = new List>((int)numNamed); + for (uint j = 0; j < numNamed; j++) { + var namedArg = reader.ReadNamedArg(attributeType); + if (namedArg.Key != null) + namedArgs.Add(namedArg); + + } + attributes[i] = new DefaultAttribute( + attributeType, + positionalArguments: new ResolveResult[] { securityActionRR }, + namedArguments: namedArgs); + } + } + + int ISupportsInterning.GetHashCodeForInterning() + { + return securityAction.GetHashCode() ^ GetBlobHashCode(blob); + } + + bool ISupportsInterning.EqualsForInterning(ISupportsInterning other) + { + UnresolvedSecurityDeclaration o = other as UnresolvedSecurityDeclaration; + return o != null && securityAction == o.securityAction && BlobEquals(blob, o.blob); + } + } + + [Serializable, FastSerializerVersion(ikvmLoaderVersion)] + sealed class UnresolvedSecurityAttribute : IUnresolvedAttribute, ISupportsInterning + { + readonly UnresolvedSecurityDeclaration secDecl; + readonly int index; + + public UnresolvedSecurityAttribute(UnresolvedSecurityDeclaration secDecl, int index) + { + Debug.Assert(secDecl != null); + this.secDecl = secDecl; + this.index = index; + } + + DomRegion IUnresolvedAttribute.Region { + get { return DomRegion.Empty; } + } + + IAttribute IUnresolvedAttribute.CreateResolvedAttribute(ITypeResolveContext context) + { + return secDecl.Resolve(context.CurrentAssembly)[index]; + } + + int ISupportsInterning.GetHashCodeForInterning() + { + return index ^ secDecl.GetHashCode(); + } + + bool ISupportsInterning.EqualsForInterning(ISupportsInterning other) + { + UnresolvedSecurityAttribute attr = other as UnresolvedSecurityAttribute; + return attr != null && index == attr.index && secDecl == attr.secDecl; + } + } + #endregion + #endregion + + #region Read Type Definition + DefaultUnresolvedTypeDefinition CreateTopLevelTypeDefinition(IKVM.Reflection.Type typeDefinition) + { + var td = new DefaultUnresolvedTypeDefinition(typeDefinition.Namespace ?? "", typeDefinition.Name); + if (typeDefinition.IsGenericTypeDefinition) + InitTypeParameters(typeDefinition, td.TypeParameters); + return td; + } + + static void InitTypeParameters(IKVM.Reflection.Type typeDefinition, IList typeParameters) + { + // Type parameters are initialized within the constructor so that the class can be put into the type storage + // before the rest of the initialization runs - this allows it to be available for early binding as soon as possible. + var genericArguments = typeDefinition.GenericTypeArguments; + for (int i = 0; i < genericArguments.Length; i++) { + if (genericArguments[i].GenericParameterPosition != i) + throw new InvalidOperationException("g.GenericParameterPosition != i"); + typeParameters.Add(new DefaultUnresolvedTypeParameter( + EntityType.TypeDefinition, i, genericArguments [i].Name)); + } + } + + void InitTypeParameterConstraints(IKVM.Reflection.Type typeDefinition, IList typeParameters) + { + for (int i = 0; i < typeParameters.Count; i++) { + var tp = (DefaultUnresolvedTypeParameter)typeParameters[i]; + // AddConstraints(tp, typeDefinition.GenericTypeArguments[i]); + tp.ApplyInterningProvider(interningProvider); + } + } + + void InitTypeDefinition(IKVM.Reflection.Type typeDefinition, DefaultUnresolvedTypeDefinition td) + { + td.Kind = GetTypeKind(typeDefinition); + InitTypeModifiers(typeDefinition, td); + InitTypeParameterConstraints(typeDefinition, td.TypeParameters); + + // nested types can be initialized only after generic parameters were created + InitNestedTypes(typeDefinition, td, td.NestedTypes); + AddAttributes(typeDefinition, td); + td.HasExtensionMethods = HasExtensionAttribute(typeDefinition); + + InitBaseTypes(typeDefinition, td.BaseTypes); + + td.AddDefaultConstructorIfRequired = (td.Kind == TypeKind.Struct || td.Kind == TypeKind.Enum); + InitMembers(typeDefinition, td, td.Members); + td.ApplyInterningProvider(interningProvider); + td.Freeze(); + RegisterCecilObject(td, typeDefinition); + } + + void InitBaseTypes(IKVM.Reflection.Type typeDefinition, IList baseTypes) + { + // set base classes + if (typeDefinition.IsEnum) { + foreach (var enumField in typeDefinition.GetFields ()) { + if (!enumField.IsStatic) { + baseTypes.Add(ReadTypeReference(enumField.FieldType)); + break; + } + } + } else { + if (typeDefinition.BaseType != null) { + baseTypes.Add(ReadTypeReference(typeDefinition.BaseType)); + } + foreach (var iface in typeDefinition.GetInterfaces ()) { + baseTypes.Add(ReadTypeReference(iface)); + } + } + } + + void InitNestedTypes(IKVM.Reflection.Type typeDefinition, IUnresolvedTypeDefinition declaringTypeDefinition, IList nestedTypes) + { + foreach (var nestedTypeDef in typeDefinition.GetNestedTypes ()) { + if (this.IncludeInternalMembers + || nestedTypeDef.IsNestedPublic + || nestedTypeDef.IsNestedFamily + || nestedTypeDef.IsNestedFamORAssem) + { + string name = nestedTypeDef.Name; + int pos = name.LastIndexOf('/'); + if (pos > 0) + name = name.Substring(pos + 1); + name = ReflectionHelper.SplitTypeParameterCountFromReflectionName(name); + var nestedType = new DefaultUnresolvedTypeDefinition(declaringTypeDefinition, name); + InitTypeParameters(nestedTypeDef, nestedType.TypeParameters); + nestedTypes.Add(nestedType); + InitTypeDefinition(nestedTypeDef, nestedType); + } + } + } + + static TypeKind GetTypeKind(IKVM.Reflection.Type typeDefinition) + { + // set classtype + if (typeDefinition.IsInterface) { + return TypeKind.Interface; + } else if (typeDefinition.IsEnum) { + return TypeKind.Enum; + } else if (typeDefinition.IsValueType) { + return TypeKind.Struct; + } else if (IsDelegate(typeDefinition)) { + return TypeKind.Delegate; + } else if (IsModule(typeDefinition)) { + return TypeKind.Module; + } else { + return TypeKind.Class; + } + } + + static void InitTypeModifiers(IKVM.Reflection.Type typeDefinition, AbstractUnresolvedEntity td) + { + td.IsSealed = typeDefinition.IsSealed; + td.IsAbstract = typeDefinition.IsAbstract; + switch (typeDefinition.Attributes & TypeAttributes.VisibilityMask) { + case TypeAttributes.NotPublic: + case TypeAttributes.NestedAssembly: + td.Accessibility = Accessibility.Internal; + break; + case TypeAttributes.Public: + case TypeAttributes.NestedPublic: + td.Accessibility = Accessibility.Public; + break; + case TypeAttributes.NestedPrivate: + td.Accessibility = Accessibility.Private; + break; + case TypeAttributes.NestedFamily: + td.Accessibility = Accessibility.Protected; + break; + case TypeAttributes.NestedFamANDAssem: + td.Accessibility = Accessibility.ProtectedAndInternal; + break; + case TypeAttributes.NestedFamORAssem: + td.Accessibility = Accessibility.ProtectedOrInternal; + break; + } + } + + static bool IsDelegate(IKVM.Reflection.Type type) + { + if (type.BaseType != null && type.BaseType.Namespace == "System") { + if (type.BaseType.Name == "MulticastDelegate") + return true; + if (type.BaseType.Name == "Delegate" && type.Name != "MulticastDelegate") + return true; + } + return false; + } + + static bool IsModule(IKVM.Reflection.Type type) + { + foreach (var att in type.CustomAttributes) { + if (att.AttributeType.FullName == "Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute" + || att.AttributeType.FullName == "System.Runtime.CompilerServices.CompilerGlobalScopeAttribute") + { + return true; + } + } + return false; + } + + void InitMembers(IKVM.Reflection.Type typeDefinition, IUnresolvedTypeDefinition td, IList members) + { + foreach (var method in typeDefinition.GetMethods ()) { + if (IsVisible(method.Attributes) && !IsAccessor(method)) { + EntityType type = EntityType.Method; + if (method.IsSpecialName) { + if (method.IsConstructor) + type = EntityType.Constructor; + else if (method.Name.StartsWith("op_", StringComparison.Ordinal)) + type = EntityType.Operator; + } + members.Add(ReadMethod(method, td, type)); + } + } + + foreach (var field in typeDefinition.GetFields ()) { + if (IsVisible(field.Attributes) && !field.IsSpecialName) { + members.Add(ReadField(field, td)); + } + } + + string defaultMemberName = null; + var defaultMemberAttribute = typeDefinition.CustomAttributes.FirstOrDefault( + a => a.AttributeType.FullName == typeof(System.Reflection.DefaultMemberAttribute).FullName); + if (defaultMemberAttribute != null && defaultMemberAttribute.ConstructorArguments.Count == 1) { + defaultMemberName = defaultMemberAttribute.ConstructorArguments[0].Value as string; + } + foreach (var property in typeDefinition.GetProperties ()) { + bool getterVisible = property.GetMethod != null && IsVisible(property.GetMethod.Attributes); + bool setterVisible = property.SetMethod != null && IsVisible(property.SetMethod.Attributes); + if (getterVisible || setterVisible) { + EntityType type = EntityType.Property; + if (property.GetIndexParameters () != null) { + // Try to detect indexer: + if (property.Name == defaultMemberName) { + type = EntityType.Indexer; // normal indexer + } + + // TODO: HasOverrides ? +// else if (property.Name.EndsWith(".Item", StringComparison.Ordinal) && (property.GetMethod ?? property.SetMethod).HasOverrides) { +// // explicit interface implementation of indexer +// type = EntityType.Indexer; +// // We can't really tell parameterized properties and indexers apart in this case without +// // resolving the interface, so we rely on the "Item" naming convention instead. +// } + } + members.Add(ReadProperty(property, td, type)); + } + } + + foreach (var ev in typeDefinition.GetEvents ()) { + if (ev.AddMethod != null && IsVisible(ev.AddMethod.Attributes)) { + members.Add(ReadEvent(ev, td)); + } + } + } + + static bool IsAccessor(MethodInfo methodInfo) + { + if (!methodInfo.IsSpecialName) + return false; + + var name = methodInfo.Name; + return + name.StartsWith("get_", StringComparison.Ordinal) || + name.StartsWith("set_", StringComparison.Ordinal) || + name.StartsWith("add_", StringComparison.Ordinal) || + name.StartsWith("remove_", StringComparison.Ordinal) || + name.StartsWith("raise_", StringComparison.Ordinal); + } + #endregion + + #region Read Method + [CLSCompliant(false)] + public IUnresolvedMethod ReadMethod(MethodInfo method, IUnresolvedTypeDefinition parentType, EntityType methodType = EntityType.Method) + { + return ReadMethod(method, parentType, methodType, null); + } + + IUnresolvedMethod ReadMethod(MethodInfo method, IUnresolvedTypeDefinition parentType, EntityType methodType, IUnresolvedMember accessorOwner) + { + if (method == null) + return null; + DefaultUnresolvedMethod m = new DefaultUnresolvedMethod(parentType, method.Name); + m.EntityType = methodType; + m.AccessorOwner = accessorOwner; + m.HasBody = method.GetMethodBody () != null; + var genericArguments = method.GetGenericArguments (); + if (genericArguments != null) { + for (int i = 0; i < genericArguments.Length; i++) { + if (genericArguments[i].GenericParameterPosition != i) + throw new InvalidOperationException("g.Position != i"); + m.TypeParameters.Add(new DefaultUnresolvedTypeParameter( + EntityType.Method, i, genericArguments[i].Name)); + } + for (int i = 0; i < genericArguments.Length; i++) { + var tp = (DefaultUnresolvedTypeParameter)m.TypeParameters[i]; + AddConstraints(tp, genericArguments[i]); + tp.ApplyInterningProvider(interningProvider); + } + } + + m.ReturnType = ReadTypeReference(method.ReturnType, typeAttributes: method.ReturnType); + + if (HasAnyAttributes(method)) + AddAttributes(method, m.Attributes, m.ReturnTypeAttributes); + TranslateModifiers(method, m); + + foreach (var p in method.GetParameters ()) { + m.Parameters.Add(ReadParameter(p)); + } + + // mark as extension method if the attribute is set + if (method.IsStatic && HasExtensionAttribute(method)) { + m.IsExtensionMethod = true; + } + + // TODO +// int lastDot = method.Name.LastIndexOf('.'); +// if (lastDot >= 0 && method.HasOverrides) { +// // To be consistent with the parser-initialized type system, shorten the method name: +// m.Name = method.Name.Substring(lastDot + 1); +// m.IsExplicitInterfaceImplementation = true; +// foreach (var or in method.Overrides) { +// m.ExplicitInterfaceImplementations.Add(new DefaultMemberReference( +// accessorOwner != null ? EntityType.Accessor : EntityType.Method, +// ReadTypeReference(or.DeclaringType), +// or.Name, or.GenericParameters.Count, m.Parameters.Select(p => p.Type).ToList())); +// } +// } + + FinishReadMember(m, method); + return m; + } + + static bool HasExtensionAttribute(MemberInfo provider) + { + foreach (var attr in provider.CustomAttributes) { + if (attr.AttributeType.Name == "ExtensionAttribute" && attr.AttributeType.Namespace == "System.Runtime.CompilerServices") + return true; + } + return false; + } + + bool IsVisible(MethodAttributes att) + { + att &= MethodAttributes.MemberAccessMask; + return IncludeInternalMembers + || att == MethodAttributes.Public + || att == MethodAttributes.Family + || att == MethodAttributes.FamORAssem; + } + + static Accessibility GetAccessibility(MethodAttributes attr) + { + switch (attr & MethodAttributes.MemberAccessMask) { + case MethodAttributes.Public: + return Accessibility.Public; + case MethodAttributes.FamANDAssem: + return Accessibility.ProtectedAndInternal; + case MethodAttributes.Assembly: + return Accessibility.Internal; + case MethodAttributes.Family: + return Accessibility.Protected; + case MethodAttributes.FamORAssem: + return Accessibility.ProtectedOrInternal; + default: + return Accessibility.Private; + } + } + + void TranslateModifiers(MethodInfo method, AbstractUnresolvedMember m) + { + if (m.DeclaringTypeDefinition.Kind == TypeKind.Interface) { + // interface members don't have modifiers, but we want to handle them as "public abstract" + m.Accessibility = Accessibility.Public; + m.IsAbstract = true; + } else { + m.Accessibility = GetAccessibility(method.Attributes); + if (method.IsAbstract) { + m.IsAbstract = true; + m.IsOverride = !method.Attributes.HasFlag (MethodAttributes.NewSlot); + } else if (method.IsFinal) { + if (!method.Attributes.HasFlag (MethodAttributes.NewSlot)) { + m.IsSealed = true; + m.IsOverride = true; + } + } else if (method.IsVirtual) { + if (method.Attributes.HasFlag (MethodAttributes.NewSlot)) + m.IsVirtual = true; + else + m.IsOverride = true; + } + m.IsStatic = method.IsStatic; + } + } + #endregion + + #region Read Parameter + [CLSCompliant(false)] + public IUnresolvedParameter ReadParameter(ParameterInfo parameter) + { + if (parameter == null) + throw new ArgumentNullException("parameter"); + var type = ReadTypeReference(parameter.ParameterType, typeAttributes: parameter); + var p = new DefaultUnresolvedParameter(type, interningProvider.Intern(parameter.Name)); + + if (parameter.ParameterType.IsByRef) { + if (!parameter.IsIn && parameter.IsOut) + p.IsOut = true; + else + p.IsRef = true; + } + AddAttributes(parameter, p); + + if (parameter.IsOptional) { + p.DefaultValue = CreateSimpleConstantValue(type, parameter.RawDefaultValue); + } + + if (parameter.ParameterType.IsArray) { + foreach (var att in parameter.CustomAttributes) { + if (att.AttributeType.FullName == typeof(ParamArrayAttribute).FullName) { + p.IsParams = true; + break; + } + } + } + + return interningProvider.Intern(p); + } + #endregion + + #region Read Field + bool IsVisible(FieldAttributes att) + { + att &= FieldAttributes.FieldAccessMask; + return IncludeInternalMembers + || att == FieldAttributes.Public + || att == FieldAttributes.Family + || att == FieldAttributes.FamORAssem; + } + + decimal? TryDecodeDecimalConstantAttribute(CustomAttributeData attribute) + { + if (attribute.ConstructorArguments.Count != 5) + return null; + + BlobReader reader = new BlobReader(attribute.__GetBlob(), null); + if (reader.ReadUInt16() != 0x0001) { + Debug.WriteLine("Unknown blob prolog"); + return null; + } + + // DecimalConstantAttribute has the arguments (byte scale, byte sign, uint hi, uint mid, uint low) or (byte scale, byte sign, int hi, int mid, int low) + // Both of these invoke the Decimal constructor (int lo, int mid, int hi, bool isNegative, byte scale) with explicit argument conversions if required. + var ctorArgs = new object[attribute.ConstructorArguments.Count]; + for (int i = 0; i < ctorArgs.Length; i++) { + switch (attribute.ConstructorArguments[i].ArgumentType.FullName) { + case "System.Byte": + ctorArgs[i] = reader.ReadByte(); + break; + case "System.Int32": + ctorArgs[i] = reader.ReadInt32(); + break; + case "System.UInt32": + ctorArgs[i] = unchecked((int)reader.ReadUInt32()); + break; + default: + return null; + } + } + + if (!ctorArgs.Select(a => a.GetType()).SequenceEqual(new[] { typeof(byte), typeof(byte), typeof(int), typeof(int), typeof(int) })) + return null; + + return new decimal((int)ctorArgs[4], (int)ctorArgs[3], (int)ctorArgs[2], (byte)ctorArgs[1] != 0, (byte)ctorArgs[0]); + } + + [CLSCompliant(false)] + public IUnresolvedField ReadField(FieldInfo field, IUnresolvedTypeDefinition parentType) + { + if (field == null) + throw new ArgumentNullException("field"); + if (parentType == null) + throw new ArgumentNullException("parentType"); + + DefaultUnresolvedField f = new DefaultUnresolvedField(parentType, field.Name); + f.Accessibility = GetAccessibility(field.Attributes); + f.IsReadOnly = field.IsInitOnly; + f.IsStatic = field.IsStatic; + f.ReturnType = ReadTypeReference(field.FieldType, typeAttributes: field); + if (field.GetRawConstantValue () != null) { + f.ConstantValue = CreateSimpleConstantValue(f.ReturnType, field.GetRawConstantValue ()); + } + else { + var decConstant = field.CustomAttributes.FirstOrDefault(a => a.AttributeType.FullName == "System.Runtime.CompilerServices.DecimalConstantAttribute"); + if (decConstant != null) { + var constValue = TryDecodeDecimalConstantAttribute(decConstant); + if (constValue != null) + f.ConstantValue = CreateSimpleConstantValue(f.ReturnType, constValue); + } + } + AddAttributes(field, f); + + if (field.GetRequiredCustomModifiers ().Any (mt => mt.FullName == typeof(IsVolatile).FullName)) { + f.IsVolatile = true; + } + + FinishReadMember(f, field); + return f; + } + + static Accessibility GetAccessibility(FieldAttributes attr) + { + switch (attr & FieldAttributes.FieldAccessMask) { + case FieldAttributes.Public: + return Accessibility.Public; + case FieldAttributes.FamANDAssem: + return Accessibility.ProtectedAndInternal; + case FieldAttributes.Assembly: + return Accessibility.Internal; + case FieldAttributes.Family: + return Accessibility.Protected; + case FieldAttributes.FamORAssem: + return Accessibility.ProtectedOrInternal; + default: + return Accessibility.Private; + } + } + #endregion + + #region Type Parameter Constraints + void AddConstraints(DefaultUnresolvedTypeParameter tp, IKVM.Reflection.Type g) + { +// TODO: +// switch (g.Attributes & GenericParameterAttributes.VarianceMask) { +// case GenericParameterAttributes.Contravariant: +// tp.Variance = VarianceModifier.Contravariant; +// break; +// case GenericParameterAttributes.Covariant: +// tp.Variance = VarianceModifier.Covariant; +// break; +// } +// +// tp.HasReferenceTypeConstraint = g.HasReferenceTypeConstraint; +// tp.HasValueTypeConstraint = g.HasNotNullableValueTypeConstraint; +// tp.HasDefaultConstructorConstraint = g.HasDefaultConstructorConstraint; + + foreach (var constraint in g.GetGenericParameterConstraints ()) { + tp.Constraints.Add(ReadTypeReference(constraint)); + } + } + #endregion + + #region Read Property + + Accessibility MergePropertyAccessibility (Accessibility left, Accessibility right) + { + if (left == Accessibility.Public || right == Accessibility.Public) + return Accessibility.Public; + + if (left == Accessibility.ProtectedOrInternal || right == Accessibility.ProtectedOrInternal) + return Accessibility.ProtectedOrInternal; + + if (left == Accessibility.Protected && right == Accessibility.Internal || + left == Accessibility.Internal && right == Accessibility.Protected) + return Accessibility.ProtectedOrInternal; + + if (left == Accessibility.Protected || right == Accessibility.Protected) + return Accessibility.Protected; + + if (left == Accessibility.Internal || right == Accessibility.Internal) + return Accessibility.Internal; + + if (left == Accessibility.ProtectedAndInternal || right == Accessibility.ProtectedAndInternal) + return Accessibility.ProtectedAndInternal; + + return left; + } + + [CLSCompliant(false)] + public IUnresolvedProperty ReadProperty(PropertyInfo property, IUnresolvedTypeDefinition parentType, EntityType propertyType = EntityType.Property) + { + if (property == null) + throw new ArgumentNullException("property"); + if (parentType == null) + throw new ArgumentNullException("parentType"); + DefaultUnresolvedProperty p = new DefaultUnresolvedProperty(parentType, property.Name); + p.EntityType = propertyType; + TranslateModifiers(property.GetMethod ?? property.SetMethod, p); + if (property.GetMethod != null && property.SetMethod != null) + p.Accessibility = MergePropertyAccessibility (GetAccessibility (property.GetMethod.Attributes), GetAccessibility (property.SetMethod.Attributes)); + + p.ReturnType = ReadTypeReference(property.PropertyType, typeAttributes: property); + + p.Getter = ReadMethod(property.GetMethod, parentType, EntityType.Accessor, p); + p.Setter = ReadMethod(property.SetMethod, parentType, EntityType.Accessor, p); + + foreach (var par in property.GetIndexParameters ()) { + p.Parameters.Add(ReadParameter(par)); + } + + AddAttributes(property, p); + + var accessor = p.Getter ?? p.Setter; + if (accessor != null && accessor.IsExplicitInterfaceImplementation) { + p.Name = property.Name.Substring(property.Name.LastIndexOf('.') + 1); + p.IsExplicitInterfaceImplementation = true; + foreach (var mr in accessor.ExplicitInterfaceImplementations) { + // p.ExplicitInterfaceImplementations.Add(new AccessorOwnerMemberReference(mr)); + } + } + + FinishReadMember(p, property); + return p; + } + #endregion + + #region Read Event + [CLSCompliant(false)] + public IUnresolvedEvent ReadEvent(EventInfo ev, IUnresolvedTypeDefinition parentType) + { + if (ev == null) + throw new ArgumentNullException("ev"); + if (parentType == null) + throw new ArgumentNullException("parentType"); + + DefaultUnresolvedEvent e = new DefaultUnresolvedEvent(parentType, ev.Name); + TranslateModifiers(ev.AddMethod, e); + e.ReturnType = ReadTypeReference(ev.EventHandlerType, typeAttributes: ev); + + e.AddAccessor = ReadMethod(ev.AddMethod, parentType, EntityType.Accessor, e); + e.RemoveAccessor = ReadMethod(ev.RemoveMethod, parentType, EntityType.Accessor, e); + e.InvokeAccessor = ReadMethod(ev.RaiseMethod, parentType, EntityType.Accessor, e); + + AddAttributes(ev, e); + + var accessor = e.AddAccessor ?? e.RemoveAccessor ?? e.InvokeAccessor; + if (accessor != null && accessor.IsExplicitInterfaceImplementation) { + e.Name = ev.Name.Substring(ev.Name.LastIndexOf('.') + 1); + e.IsExplicitInterfaceImplementation = true; + foreach (var mr in accessor.ExplicitInterfaceImplementations) { + // e.ExplicitInterfaceImplementations.Add(new AccessorOwnerMemberReference(mr)); + } + } + + FinishReadMember(e, ev); + + return e; + } + #endregion + + #region FinishReadMember / Interning + void FinishReadMember(AbstractUnresolvedMember member, MemberInfo ikvmDefinition) + { + member.ApplyInterningProvider(interningProvider); + member.Freeze(); + RegisterCecilObject(member, ikvmDefinition); + } + #endregion + + #region Type system translation table + void RegisterCecilObject(IUnresolvedEntity typeSystemObject, MemberInfo cecilObject) + { + if (OnEntityLoaded != null) + OnEntityLoaded(typeSystemObject, cecilObject); + } + #endregion + } +} From fabbe8bc90bcd2e42482d31f9b1efea7decd1c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Wed, 5 Jun 2013 12:03:48 +0200 Subject: [PATCH 38/55] Improved the Ikvm loader. It's still not a 100% replacement - 6 tests are failing. --- .../TypeSystem/IkvmLoader.cs | 615 +++++++++++------- 1 file changed, 362 insertions(+), 253 deletions(-) diff --git a/ICSharpCode.NRefactory/TypeSystem/IkvmLoader.cs b/ICSharpCode.NRefactory/TypeSystem/IkvmLoader.cs index 29ad2b6ff0..e5c85f107f 100644 --- a/ICSharpCode.NRefactory/TypeSystem/IkvmLoader.cs +++ b/ICSharpCode.NRefactory/TypeSystem/IkvmLoader.cs @@ -113,8 +113,9 @@ namespace ICSharpCode.NRefactory.TypeSystem if (fileName == null) throw new ArgumentNullException("fileName"); - var universe = new IKVM.Reflection.Universe (); - return LoadAssembly (universe.LoadFile (fileName)); + using (var universe = new IKVM.Reflection.Universe (UniverseOptions.DisablePseudoCustomAttributeRetrieval)) { + return LoadAssembly (universe.LoadFile (fileName)); + } } #endregion @@ -221,13 +222,13 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Attributes associated with the Cecil type reference. /// This is used to support the 'dynamic' type. [CLSCompliant(false)] - public ITypeReference ReadTypeReference(IKVM.Reflection.Type type, ICustomAttributeProvider typeAttributes = null) + public ITypeReference ReadTypeReference(IKVM.Reflection.Type type, IEnumerable typeAttributes = null) { int typeIndex = 0; return CreateTypeReference(type, typeAttributes, ref typeIndex); } - ITypeReference CreateTypeReference(IKVM.Reflection.Type type, ICustomAttributeProvider typeAttributes, ref int typeIndex) + ITypeReference CreateTypeReference(IKVM.Reflection.Type type, IEnumerable typeAttributes, ref int typeIndex) { // TODO: // while (type is OptionalModifierType || type is RequiredModifierType) { @@ -241,34 +242,57 @@ namespace ICSharpCode.NRefactory.TypeSystem typeIndex++; return interningProvider.Intern( new ByReferenceTypeReference( - CreateTypeReference( - type.GetElementType (), - typeAttributes, ref typeIndex))); + CreateTypeReference( + type.GetElementType (), + typeAttributes, ref typeIndex))); } else if (type.IsPointer) { typeIndex++; return interningProvider.Intern( new PointerTypeReference( - CreateTypeReference( - type.GetElementType (), - typeAttributes, ref typeIndex))); + CreateTypeReference( + type.GetElementType (), + typeAttributes, ref typeIndex))); } else if (type.IsArray) { typeIndex++; return interningProvider.Intern( new ArrayTypeReference( - CreateTypeReference( - type.GetElementType (), - typeAttributes, ref typeIndex), - type.GetArrayRank ())); - } else if (type.IsGenericType) { - // GenericInstanceType gType = (GenericInstanceType)type; - ITypeReference baseType = CreateTypeReference(type.GetElementType (), typeAttributes, ref typeIndex); - ITypeReference[] para = new ITypeReference[type.GenericTypeArguments.Length]; + CreateTypeReference( + type.GetElementType (), + typeAttributes, ref typeIndex), + type.GetArrayRank ())); + } else if (type.IsGenericType && !type.IsGenericTypeDefinition) { + ITypeReference baseType = CreateTypeReference(type.GetGenericTypeDefinition(), typeAttributes, ref typeIndex); + var args = type.GetGenericArguments (); + ITypeReference[] para = new ITypeReference[args.Length]; + for (int i = 0; i < para.Length; ++i) { + typeIndex++; + para[i] = CreateTypeReference(args [i], typeAttributes, ref typeIndex); + } + return interningProvider.Intern(new ParameterizedTypeReference(baseType, para)); + } /*else if (type.IsGenericTypeDefinition) { + string ns = interningProvider.Intern(type.Namespace ?? string.Empty); + string name = type.Name; + + ITypeReference baseType = null; + int typeParameterCount; + name = ReflectionHelper.SplitTypeParameterCountFromReflectionName(name, out typeParameterCount); + name = interningProvider.Intern(name); + if (currentAssembly != null) { + IUnresolvedTypeDefinition c = currentAssembly.GetTypeDefinition(ns, name, typeParameterCount); + if (c != null) + baseType = c; + } + if (baseType == null) + baseType = interningProvider.Intern(new GetClassTypeReference(GetAssemblyReference(type.Assembly), ns, name, typeParameterCount)); + + var args = type.GetGenericArguments (); + ITypeReference[] para = new ITypeReference[args.Length]; for (int i = 0; i < para.Length; ++i) { typeIndex++; - para[i] = CreateTypeReference(type.GenericTypeArguments[i], typeAttributes, ref typeIndex); + para[i] = CreateTypeReference(args [i], typeAttributes, ref typeIndex); } return interningProvider.Intern(new ParameterizedTypeReference(baseType, para)); - } else if (type.IsGenericParameter) { + }*/ else if (type.IsGenericParameter) { return TypeParameterReference.Create(type.DeclaringMethod != null ? EntityType.Method : EntityType.TypeDefinition, type.GenericParameterPosition); } else if (type.IsNested) { ITypeReference typeRef = CreateTypeReference(type.DeclaringType, typeAttributes, ref typeIndex); @@ -302,24 +326,24 @@ namespace ICSharpCode.NRefactory.TypeSystem { if (scope == null || scope == currentAssemblyDefinition) return DefaultAssemblyReference.CurrentAssembly; - else - return interningProvider.Intern(new DefaultAssemblyReference(scope.FullName)); + return interningProvider.Intern (new DefaultAssemblyReference (scope.FullName)); } - static bool HasDynamicAttribute(ICustomAttributeProvider attributeProvider, int typeIndex) + static bool HasDynamicAttribute(IEnumerable attributeProvider, int typeIndex) { - //TODO: -// foreach (var a in attributeProvider.__GetCustomAttributes (null ,false)) { -// var type = a.AttributeType; -// if (type.Name == "DynamicAttribute" && type.Namespace == "System.Runtime.CompilerServices") { -// if (a.ConstructorArguments.Count == 1) { -// var values = a.ConstructorArguments[0].Value as CustomAttributeTypedArgument[]; -// if (values != null && typeIndex < values.Length && values[typeIndex].Value is bool) -// return (bool)values[typeIndex].Value; -// } -// return true; -// } -// } + if (attributeProvider == null) + return false; + foreach (var a in attributeProvider) { + var type = a.AttributeType; + if (type.Name == "DynamicAttribute" && type.Namespace == "System.Runtime.CompilerServices") { + if (a.ConstructorArguments.Count == 1) { + var values = a.ConstructorArguments[0].Value as CustomAttributeTypedArgument[]; + if (values != null && typeIndex < values.Length && values[typeIndex].Value is bool) + return (bool)values[typeIndex].Value; + } + return true; + } + } return false; } #endregion @@ -330,12 +354,13 @@ namespace ICSharpCode.NRefactory.TypeSystem void AddAttributes(Assembly assembly, IList outputList) { + if (assembly.FullName.Contains ("ICSharpCode.NRefactory.Tests")) { + Console.WriteLine ("attrs:" + assembly.GetCustomAttributesData ().Count ()); + foreach (var a in assembly.GetCustomAttributesData ()) + Console.WriteLine (a); + } AddCustomAttributes(assembly.CustomAttributes, outputList); - - // TODO: -// if (assembly.HasSecurityDeclarations) { -// AddSecurityAttributes(assembly.SecurityDeclarations, outputList); -// } + AddSecurityAttributes(CustomAttributeData.__GetDeclarativeSecurity (assembly), outputList); // AssemblyVersionAttribute if (assembly.GetName ().Version != null) { @@ -372,10 +397,10 @@ namespace ICSharpCode.NRefactory.TypeSystem } AddCustomAttributes(parameter.CustomAttributes, targetParameter.Attributes); - // TODO: -// if (parameter.HasMarshalInfo) { -// targetParameter.Attributes.Add(ConvertMarshalInfo(parameter.MarshalInfo)); -// } + FieldMarshal marshalInfo; + if (parameter.__TryGetFieldMarshal (out marshalInfo)) { + targetParameter.Attributes.Add(ConvertMarshalInfo(marshalInfo)); + } } #endregion @@ -392,11 +417,21 @@ namespace ICSharpCode.NRefactory.TypeSystem { if (methodDefinition.Attributes.HasFlag (MethodAttributes.PinvokeImpl)) return true; - // TODO: -// if ((methodDefinition.ImplAttributes & ~MethodImplAttributes.CodeTypeMask) != 0) -// return true; -// if (methodDefinition.MethodReturnType.HasFieldMarshal) -// return true; + + if (methodDefinition.MethodImplementationFlags.HasFlag (MethodImplAttributes.CodeTypeMask)) + return true; + if (methodDefinition.ReturnParameter.Attributes.HasFlag (ParameterAttributes.HasFieldMarshal)) + return true; + return methodDefinition.CustomAttributes.Any (); + } + + static bool HasAnyAttributes(ConstructorInfo methodDefinition) + { + if (methodDefinition.Attributes.HasFlag (MethodAttributes.PinvokeImpl)) + return true; + + if (methodDefinition.MethodImplementationFlags.HasFlag (MethodImplAttributes.CodeTypeMask)) + return true; return methodDefinition.CustomAttributes.Any (); } @@ -405,82 +440,121 @@ namespace ICSharpCode.NRefactory.TypeSystem var implAttributes = methodDefinition.MethodImplementationFlags; #region DllImportAttribute + if (methodDefinition.Attributes.HasFlag (MethodAttributes.PinvokeImpl)) { + + ImplMapFlags flags; + string importName; + string importScope; + if (methodDefinition.__TryGetImplMap(out flags, out importName, out importScope)) { + var dllImport = new DefaultUnresolvedAttribute(dllImportAttributeTypeRef, new[] { KnownTypeReference.String }); + dllImport.PositionalArguments.Add(CreateSimpleConstantValue(KnownTypeReference.String, importScope)); + + + if (flags.HasFlag (ImplMapFlags.BestFitOff)) + dllImport.AddNamedFieldArgument("BestFitMapping", falseValue); + if (flags.HasFlag (ImplMapFlags.BestFitOn)) + dllImport.AddNamedFieldArgument("BestFitMapping", trueValue); + + CallingConvention callingConvention; + switch (flags & ImplMapFlags.CallConvMask) { + case (ImplMapFlags)0: + Debug.WriteLine ("P/Invoke calling convention not set on:" + methodDefinition.Name); + callingConvention = CallingConvention.StdCall; + break; + case ImplMapFlags.CallConvCdecl: + callingConvention = CallingConvention.Cdecl; + break; + case ImplMapFlags.CallConvFastcall: + callingConvention = CallingConvention.FastCall; + break; + case ImplMapFlags.CallConvStdcall: + callingConvention = CallingConvention.StdCall; + break; + case ImplMapFlags.CallConvThiscall: + callingConvention = CallingConvention.ThisCall; + break; + case ImplMapFlags.CallConvWinapi: + callingConvention = CallingConvention.Winapi; + break; + default: + throw new NotSupportedException("unknown calling convention"); + } + if (!flags.HasFlag (ImplMapFlags.CallConvWinapi)) + dllImport.AddNamedFieldArgument("CallingConvention", CreateSimpleConstantValue(callingConventionTypeRef, (int)callingConvention)); + + CharSet charSet = CharSet.None; + switch (flags & ImplMapFlags.CharSetMask) { + case ImplMapFlags.CharSetAnsi: + charSet = CharSet.Ansi; + break; + case ImplMapFlags.CharSetAuto: + charSet = CharSet.Auto; + break; + case ImplMapFlags.CharSetUnicode: + charSet = CharSet.Unicode; + break; + } + if (charSet != CharSet.None) + dllImport.AddNamedFieldArgument("CharSet", CreateSimpleConstantValue(charSetTypeRef, (int)charSet)); // TODO: -// if (methodDefinition.HasPInvokeInfo && methodDefinition.PInvokeInfo != null) { -// PInvokeInfo info = methodDefinition.PInvokeInfo; -// var dllImport = new DefaultUnresolvedAttribute(dllImportAttributeTypeRef, new[] { KnownTypeReference.String }); -// dllImport.PositionalArguments.Add(CreateSimpleConstantValue(KnownTypeReference.String, info.Module.Name)); -// -// if (info.IsBestFitDisabled) -// dllImport.AddNamedFieldArgument("BestFitMapping", falseValue); -// if (info.IsBestFitEnabled) -// dllImport.AddNamedFieldArgument("BestFitMapping", trueValue); -// -// CallingConvention callingConvention; -// switch (info.Attributes & PInvokeAttributes.CallConvMask) { -// case (PInvokeAttributes)0: -// Debug.WriteLine ("P/Invoke calling convention not set on:" + methodDefinition.FullName); -// callingConvention = CallingConvention.StdCall; -// break; -// case PInvokeAttributes.CallConvCdecl: -// callingConvention = CallingConvention.Cdecl; -// break; -// case PInvokeAttributes.CallConvFastcall: -// callingConvention = CallingConvention.FastCall; -// break; -// case PInvokeAttributes.CallConvStdCall: -// callingConvention = CallingConvention.StdCall; -// break; -// case PInvokeAttributes.CallConvThiscall: -// callingConvention = CallingConvention.ThisCall; -// break; -// case PInvokeAttributes.CallConvWinapi: -// callingConvention = CallingConvention.Winapi; -// break; -// default: -// throw new NotSupportedException("unknown calling convention"); -// } -// if (callingConvention != CallingConvention.Winapi) -// dllImport.AddNamedFieldArgument("CallingConvention", CreateSimpleConstantValue(callingConventionTypeRef, (int)callingConvention)); -// -// CharSet charSet = CharSet.None; -// switch (info.Attributes & PInvokeAttributes.CharSetMask) { -// case PInvokeAttributes.CharSetAnsi: -// charSet = CharSet.Ansi; -// break; -// case PInvokeAttributes.CharSetAuto: -// charSet = CharSet.Auto; -// break; -// case PInvokeAttributes.CharSetUnicode: -// charSet = CharSet.Unicode; -// break; -// } -// if (charSet != CharSet.None) -// dllImport.AddNamedFieldArgument("CharSet", CreateSimpleConstantValue(charSetTypeRef, (int)charSet)); -// -// if (!string.IsNullOrEmpty(info.EntryPoint) && info.EntryPoint != methodDefinition.Name) -// dllImport.AddNamedFieldArgument("EntryPoint", CreateSimpleConstantValue(KnownTypeReference.String, info.EntryPoint)); -// -// if (info.IsNoMangle) -// dllImport.AddNamedFieldArgument("ExactSpelling", trueValue); -// -// if ((implAttributes & MethodImplAttributes.PreserveSig) == MethodImplAttributes.PreserveSig) -// implAttributes &= ~MethodImplAttributes.PreserveSig; -// else -// dllImport.AddNamedFieldArgument("PreserveSig", falseValue); -// -// if (info.SupportsLastError) -// dllImport.AddNamedFieldArgument("SetLastError", trueValue); -// -// if (info.IsThrowOnUnmappableCharDisabled) -// dllImport.AddNamedFieldArgument("ThrowOnUnmappableChar", falseValue); -// if (info.IsThrowOnUnmappableCharEnabled) -// dllImport.AddNamedFieldArgument("ThrowOnUnmappableChar", trueValue); -// -// attributes.Add(interningProvider.Intern(dllImport)); -// } +// if (!string.IsNullOrEmpty(info.EntryPoint) && info.EntryPoint != methodDefinition.Name) +// dllImport.AddNamedFieldArgument("EntryPoint", CreateSimpleConstantValue(KnownTypeReference.String, info.EntryPoint)); + + if (flags.HasFlag (ImplMapFlags.NoMangle)) + dllImport.AddNamedFieldArgument("ExactSpelling", trueValue); + + if ((implAttributes & MethodImplAttributes.PreserveSig) == MethodImplAttributes.PreserveSig) + implAttributes &= ~MethodImplAttributes.PreserveSig; + else + dllImport.AddNamedFieldArgument("PreserveSig", falseValue); + + if (flags.HasFlag (ImplMapFlags.SupportsLastError)) + dllImport.AddNamedFieldArgument("SetLastError", trueValue); +// TODO: +// if (info.IsThrowOnUnmappableCharDisabled) +// dllImport.AddNamedFieldArgument("ThrowOnUnmappableChar", falseValue); +// if (info.IsThrowOnUnmappableCharEnabled) +// dllImport.AddNamedFieldArgument("ThrowOnUnmappableChar", trueValue); + + attributes.Add(interningProvider.Intern(dllImport)); + } + } + #endregion + + #region PreserveSigAttribute + if (implAttributes == MethodImplAttributes.PreserveSig) { + attributes.Add(preserveSigAttribute); + implAttributes = 0; + } #endregion + #region MethodImplAttribute + if (implAttributes != MethodImplAttributes.IL) { + var methodImpl = new DefaultUnresolvedAttribute(methodImplAttributeTypeRef, new[] { methodImplOptionsTypeRef }); + methodImpl.PositionalArguments.Add(CreateSimpleConstantValue(methodImplOptionsTypeRef, (int)implAttributes)); + attributes.Add(interningProvider.Intern(methodImpl)); + } + #endregion + + var customAttributes = methodDefinition.CustomAttributes; + AddCustomAttributes (customAttributes, attributes); + + if (methodDefinition.Attributes.HasFlag (MethodAttributes.HasSecurity)) { + AddSecurityAttributes(CustomAttributeData.__GetDeclarativeSecurity (methodDefinition), attributes); + } + + FieldMarshal marshalInfo; + if (methodDefinition.ReturnParameter.__TryGetFieldMarshal (out marshalInfo)) { + returnTypeAttributes.Add(ConvertMarshalInfo(marshalInfo)); + } +// TODO: Not needed in ikvm - maybe a work around for a cecil bug ? +// AddCustomAttributes(methodDefinition.ReturnType.CustomAttributes, returnTypeAttributes); + } + + void AddAttributes(ConstructorInfo methodDefinition, IList attributes, IList returnTypeAttributes) + { + var implAttributes = methodDefinition.MethodImplementationFlags; + #region PreserveSigAttribute if (implAttributes == MethodImplAttributes.PreserveSig) { attributes.Add(preserveSigAttribute); @@ -497,12 +571,10 @@ namespace ICSharpCode.NRefactory.TypeSystem #endregion AddCustomAttributes(methodDefinition.CustomAttributes, attributes); - // TODO: -// if (methodDefinition.HasSecurityDeclarations) { -// AddSecurityAttributes(methodDefinition.SecurityDeclarations, attributes); -// } -// returnTypeAttributes.Add(ConvertMarshalInfo(methodDefinition.MethodReturnType.MarshalInfo)); - AddCustomAttributes(methodDefinition.ReturnType.CustomAttributes, returnTypeAttributes); + + if (methodDefinition.Attributes.HasFlag (MethodAttributes.HasSecurity)) { + AddSecurityAttributes(CustomAttributeData.__GetDeclarativeSecurity (methodDefinition), attributes); + } } #endregion @@ -545,30 +617,34 @@ namespace ICSharpCode.NRefactory.TypeSystem charSet = CharSet.Unicode; break; } - // TODO: -// LayoutKind defaultLayoutKind = (typeDefinition.IsValueType && !typeDefinition.IsEnum) ? LayoutKind.Sequential: LayoutKind.Auto; -// if (layoutKind != defaultLayoutKind || charSet != CharSet.Ansi || typeDefinition.PackingSize > 0 || typeDefinition.ClassSize > 0) { -// DefaultUnresolvedAttribute structLayout = new DefaultUnresolvedAttribute(structLayoutAttributeTypeRef, new[] { layoutKindTypeRef }); -// structLayout.PositionalArguments.Add(CreateSimpleConstantValue(layoutKindTypeRef, (int)layoutKind)); -// if (charSet != CharSet.Ansi) { -// structLayout.AddNamedFieldArgument("CharSet", CreateSimpleConstantValue(charSetTypeRef, (int)charSet)); -// } -// if (typeDefinition.PackingSize > 0) { -// structLayout.AddNamedFieldArgument("Pack", CreateSimpleConstantValue(KnownTypeReference.Int32, (int)typeDefinition.PackingSize)); -// } -// if (typeDefinition.ClassSize > 0) { -// structLayout.AddNamedFieldArgument("Size", CreateSimpleConstantValue(KnownTypeReference.Int32, (int)typeDefinition.ClassSize)); -// } -// targetEntity.Attributes.Add(interningProvider.Intern(structLayout)); -// } + + + int packingSize; + int typeSize; + if (typeDefinition.__GetLayout (out packingSize, out typeSize)) { + LayoutKind defaultLayoutKind = (typeDefinition.IsValueType && !typeDefinition.IsEnum) ? LayoutKind.Sequential: LayoutKind.Auto; + if (layoutKind != defaultLayoutKind || charSet != CharSet.Ansi || packingSize > 0 || typeSize > 0) { + DefaultUnresolvedAttribute structLayout = new DefaultUnresolvedAttribute(structLayoutAttributeTypeRef, new[] { layoutKindTypeRef }); + structLayout.PositionalArguments.Add(CreateSimpleConstantValue(layoutKindTypeRef, (int)layoutKind)); + if (charSet != CharSet.Ansi) { + structLayout.AddNamedFieldArgument("CharSet", CreateSimpleConstantValue(charSetTypeRef, (int)charSet)); + } + if (packingSize > 0) { + structLayout.AddNamedFieldArgument("Pack", CreateSimpleConstantValue(KnownTypeReference.Int32, packingSize)); + } + if (typeSize > 0) { + structLayout.AddNamedFieldArgument("Size", CreateSimpleConstantValue(KnownTypeReference.Int32, typeSize)); + } + targetEntity.Attributes.Add(interningProvider.Intern(structLayout)); + } + } #endregion AddCustomAttributes(typeDefinition.CustomAttributes, targetEntity.Attributes); - // TODO: -// if (typeDefinition.HasSecurityDeclarations) { -// AddSecurityAttributes(typeDefinition.SecurityDeclarations, targetEntity.Attributes); -// } + if (typeDefinition.Attributes.HasFlag (TypeAttributes.HasSecurity)) { + AddSecurityAttributes(CustomAttributeData.__GetDeclarativeSecurity(typeDefinition), targetEntity.Attributes); + } } #endregion @@ -579,13 +655,12 @@ namespace ICSharpCode.NRefactory.TypeSystem void AddAttributes(FieldInfo fieldDefinition, IUnresolvedEntity targetEntity) { // FieldOffsetAttribute - - // TODO: -// if (fieldDefinition.HasLayoutInfo) { -// DefaultUnresolvedAttribute fieldOffset = new DefaultUnresolvedAttribute(fieldOffsetAttributeTypeRef, new[] { KnownTypeReference.Int32 }); -// fieldOffset.PositionalArguments.Add(CreateSimpleConstantValue(KnownTypeReference.Int32, fieldDefinition.Offset)); -// targetEntity.Attributes.Add(interningProvider.Intern(fieldOffset)); -// } + int fOffset; + if (fieldDefinition.__TryGetFieldOffset(out fOffset)) { + DefaultUnresolvedAttribute fieldOffset = new DefaultUnresolvedAttribute(fieldOffsetAttributeTypeRef, new[] { KnownTypeReference.Int32 }); + fieldOffset.PositionalArguments.Add(CreateSimpleConstantValue(KnownTypeReference.Int32, fOffset)); + targetEntity.Attributes.Add(interningProvider.Intern(fieldOffset)); + } // NonSerializedAttribute if (fieldDefinition.IsNotSerialized) { @@ -635,7 +710,8 @@ namespace ICSharpCode.NRefactory.TypeSystem } if (marshalInfo.UnmanagedType == UnmanagedType.LPArray) { - attr.AddNamedFieldArgument("ArraySubType", CreateSimpleConstantValue(unmanagedTypeTypeRef, (int)marshalInfo.ArraySubType)); + if (marshalInfo.ArraySubType != null) + attr.AddNamedFieldArgument("ArraySubType", CreateSimpleConstantValue(unmanagedTypeTypeRef, (int)marshalInfo.ArraySubType)); if (marshalInfo.SizeConst >= 0) attr.AddNamedFieldArgument("SizeConst", CreateSimpleConstantValue(KnownTypeReference.Int32, (int)marshalInfo.SizeConst)); if (marshalInfo.SizeParamIndex >= 0) @@ -1226,9 +1302,9 @@ namespace ICSharpCode.NRefactory.TypeSystem static readonly ITypeReference securityActionTypeReference = typeof(System.Security.Permissions.SecurityAction).ToTypeReference(); static readonly ITypeReference permissionSetAttributeTypeReference = typeof(System.Security.Permissions.PermissionSetAttribute).ToTypeReference(); - /// - /// Reads a security declaration. - /// +// /// +// /// Reads a security declaration. +// /// // [CLSCompliant(false)] // public IList ReadSecurityDeclaration(SecurityDeclaration secDecl) // { @@ -1245,30 +1321,11 @@ namespace ICSharpCode.NRefactory.TypeSystem // AddSecurityAttributes(secDecl, targetCollection); // } // } -// -// void AddSecurityAttributes(SecurityDeclaration secDecl, IList targetCollection) -// { -// byte[] blob = secDecl.GetBlob(); -// BlobReader reader = new BlobReader(blob, null); -// var securityAction = new SimpleConstantValue(securityActionTypeReference, (int)secDecl.Action); -// if (reader.ReadByte() == '.') { -// // binary attribute -// uint attributeCount = reader.ReadCompressedUInt32(); -// UnresolvedSecurityDeclaration unresolvedSecDecl = new UnresolvedSecurityDeclaration(securityAction, blob); -// unresolvedSecDecl = interningProvider.Intern(unresolvedSecDecl); -// for (uint i = 0; i < attributeCount; i++) { -// targetCollection.Add(interningProvider.Intern(new UnresolvedSecurityAttribute(unresolvedSecDecl, (int)i))); -// } -// } else { -// // for backward compatibility with .NET 1.0: XML-encoded attribute -// var attr = new DefaultUnresolvedAttribute(permissionSetAttributeTypeReference); -// attr.ConstructorParameterTypes.Add(securityActionTypeReference); -// attr.PositionalArguments.Add(securityAction); -// string xml = System.Text.Encoding.Unicode.GetString(blob); -// attr.AddNamedPropertyArgument("XML", CreateSimpleConstantValue(KnownTypeReference.String, xml)); -// targetCollection.Add(interningProvider.Intern(attr)); -// } -// } + + void AddSecurityAttributes(IEnumerable securityAttributes, IList targetCollection) + { + AddCustomAttributes (securityAttributes, targetCollection); + } [Serializable, FastSerializerVersion(ikvmLoaderVersion)] sealed class UnresolvedSecurityDeclaration : ISupportsInterning @@ -1391,7 +1448,7 @@ namespace ICSharpCode.NRefactory.TypeSystem #region Read Type Definition DefaultUnresolvedTypeDefinition CreateTopLevelTypeDefinition(IKVM.Reflection.Type typeDefinition) { - var td = new DefaultUnresolvedTypeDefinition(typeDefinition.Namespace ?? "", typeDefinition.Name); + var td = new DefaultUnresolvedTypeDefinition(typeDefinition.Namespace ?? "", ReflectionHelper.SplitTypeParameterCountFromReflectionName (typeDefinition.Name)); if (typeDefinition.IsGenericTypeDefinition) InitTypeParameters(typeDefinition, td.TypeParameters); return td; @@ -1401,7 +1458,7 @@ namespace ICSharpCode.NRefactory.TypeSystem { // Type parameters are initialized within the constructor so that the class can be put into the type storage // before the rest of the initialization runs - this allows it to be available for early binding as soon as possible. - var genericArguments = typeDefinition.GenericTypeArguments; + var genericArguments = typeDefinition.GetGenericArguments (); for (int i = 0; i < genericArguments.Length; i++) { if (genericArguments[i].GenericParameterPosition != i) throw new InvalidOperationException("g.GenericParameterPosition != i"); @@ -1412,9 +1469,10 @@ namespace ICSharpCode.NRefactory.TypeSystem void InitTypeParameterConstraints(IKVM.Reflection.Type typeDefinition, IList typeParameters) { + var args = typeDefinition.GetGenericArguments (); for (int i = 0; i < typeParameters.Count; i++) { var tp = (DefaultUnresolvedTypeParameter)typeParameters[i]; - // AddConstraints(tp, typeDefinition.GenericTypeArguments[i]); + AddConstraints(tp, args[i]); tp.ApplyInterningProvider(interningProvider); } } @@ -1461,7 +1519,7 @@ namespace ICSharpCode.NRefactory.TypeSystem void InitNestedTypes(IKVM.Reflection.Type typeDefinition, IUnresolvedTypeDefinition declaringTypeDefinition, IList nestedTypes) { - foreach (var nestedTypeDef in typeDefinition.GetNestedTypes ()) { + foreach (var nestedTypeDef in typeDefinition.GetNestedTypes (bindingFlags)) { if (this.IncludeInternalMembers || nestedTypeDef.IsNestedPublic || nestedTypeDef.IsNestedFamily @@ -1505,24 +1563,24 @@ namespace ICSharpCode.NRefactory.TypeSystem switch (typeDefinition.Attributes & TypeAttributes.VisibilityMask) { case TypeAttributes.NotPublic: case TypeAttributes.NestedAssembly: - td.Accessibility = Accessibility.Internal; - break; + td.Accessibility = Accessibility.Internal; + break; case TypeAttributes.Public: case TypeAttributes.NestedPublic: - td.Accessibility = Accessibility.Public; - break; + td.Accessibility = Accessibility.Public; + break; case TypeAttributes.NestedPrivate: - td.Accessibility = Accessibility.Private; - break; + td.Accessibility = Accessibility.Private; + break; case TypeAttributes.NestedFamily: - td.Accessibility = Accessibility.Protected; - break; + td.Accessibility = Accessibility.Protected; + break; case TypeAttributes.NestedFamANDAssem: - td.Accessibility = Accessibility.ProtectedAndInternal; - break; + td.Accessibility = Accessibility.ProtectedAndInternal; + break; case TypeAttributes.NestedFamORAssem: - td.Accessibility = Accessibility.ProtectedOrInternal; - break; + td.Accessibility = Accessibility.ProtectedOrInternal; + break; } } @@ -1549,22 +1607,30 @@ namespace ICSharpCode.NRefactory.TypeSystem return false; } + static readonly BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly; + void InitMembers(IKVM.Reflection.Type typeDefinition, IUnresolvedTypeDefinition td, IList members) { - foreach (var method in typeDefinition.GetMethods ()) { + foreach (var method in typeDefinition.GetMethods (bindingFlags)) { if (IsVisible(method.Attributes) && !IsAccessor(method)) { EntityType type = EntityType.Method; if (method.IsSpecialName) { - if (method.IsConstructor) - type = EntityType.Constructor; - else if (method.Name.StartsWith("op_", StringComparison.Ordinal)) + if (method.Name.StartsWith("op_", StringComparison.Ordinal)) type = EntityType.Operator; } members.Add(ReadMethod(method, td, type)); } } - foreach (var field in typeDefinition.GetFields ()) { + foreach (var method in typeDefinition.GetConstructors (bindingFlags)) { + if (IsVisible(method.Attributes)) { + EntityType type = EntityType.Constructor; + members.Add(ReadConstructor(method, td, type)); + } + } + + + foreach (var field in typeDefinition.GetFields (bindingFlags)) { if (IsVisible(field.Attributes) && !field.IsSpecialName) { members.Add(ReadField(field, td)); } @@ -1576,7 +1642,8 @@ namespace ICSharpCode.NRefactory.TypeSystem if (defaultMemberAttribute != null && defaultMemberAttribute.ConstructorArguments.Count == 1) { defaultMemberName = defaultMemberAttribute.ConstructorArguments[0].Value as string; } - foreach (var property in typeDefinition.GetProperties ()) { + + foreach (var property in typeDefinition.GetProperties (bindingFlags)) { bool getterVisible = property.GetMethod != null && IsVisible(property.GetMethod.Attributes); bool setterVisible = property.SetMethod != null && IsVisible(property.SetMethod.Attributes); if (getterVisible || setterVisible) { @@ -1585,21 +1652,20 @@ namespace ICSharpCode.NRefactory.TypeSystem // Try to detect indexer: if (property.Name == defaultMemberName) { type = EntityType.Indexer; // normal indexer - } - + } // TODO: HasOverrides ? -// else if (property.Name.EndsWith(".Item", StringComparison.Ordinal) && (property.GetMethod ?? property.SetMethod).HasOverrides) { -// // explicit interface implementation of indexer -// type = EntityType.Indexer; -// // We can't really tell parameterized properties and indexers apart in this case without -// // resolving the interface, so we rely on the "Item" naming convention instead. -// } + else if (property.Name.EndsWith(".Item", StringComparison.Ordinal) /*&& (property.GetMethod ?? property.SetMethod).HasOverrides*/) { + // explicit interface implementation of indexer + type = EntityType.Indexer; + // We can't really tell parameterized properties and indexers apart in this case without + // resolving the interface, so we rely on the "Item" naming convention instead. + } } members.Add(ReadProperty(property, td, type)); } } - foreach (var ev in typeDefinition.GetEvents ()) { + foreach (var ev in typeDefinition.GetEvents (bindingFlags)) { if (ev.AddMethod != null && IsVisible(ev.AddMethod.Attributes)) { members.Add(ReadEvent(ev, td)); } @@ -1651,7 +1717,7 @@ namespace ICSharpCode.NRefactory.TypeSystem } } - m.ReturnType = ReadTypeReference(method.ReturnType, typeAttributes: method.ReturnType); + m.ReturnType = ReadTypeReference(method.ReturnType, typeAttributes: method.ReturnType.CustomAttributes); if (HasAnyAttributes(method)) AddAttributes(method, m.Attributes, m.ReturnTypeAttributes); @@ -1666,19 +1732,19 @@ namespace ICSharpCode.NRefactory.TypeSystem m.IsExtensionMethod = true; } - // TODO -// int lastDot = method.Name.LastIndexOf('.'); -// if (lastDot >= 0 && method.HasOverrides) { -// // To be consistent with the parser-initialized type system, shorten the method name: -// m.Name = method.Name.Substring(lastDot + 1); -// m.IsExplicitInterfaceImplementation = true; -// foreach (var or in method.Overrides) { -// m.ExplicitInterfaceImplementations.Add(new DefaultMemberReference( -// accessorOwner != null ? EntityType.Accessor : EntityType.Method, -// ReadTypeReference(or.DeclaringType), -// or.Name, or.GenericParameters.Count, m.Parameters.Select(p => p.Type).ToList())); -// } -// } + int lastDot = method.Name.LastIndexOf('.'); + if (lastDot >= 0 /*&& method.HasOverrides*/) { + // To be consistent with the parser-initialized type system, shorten the method name: + m.Name = method.Name.Substring(lastDot + 1); + m.IsExplicitInterfaceImplementation = true; + + foreach (var or in method.__GetMethodImpls ()) { + m.ExplicitInterfaceImplementations.Add(new DefaultMemberReference( + accessorOwner != null ? EntityType.Accessor : EntityType.Method, + ReadTypeReference(or.DeclaringType), + or.Name, or.GetGenericArguments ().Length, m.Parameters.Select(p => p.Type).ToList())); + } + } FinishReadMember(m, method); return m; @@ -1698,8 +1764,8 @@ namespace ICSharpCode.NRefactory.TypeSystem att &= MethodAttributes.MemberAccessMask; return IncludeInternalMembers || att == MethodAttributes.Public - || att == MethodAttributes.Family - || att == MethodAttributes.FamORAssem; + || att == MethodAttributes.Family + || att == MethodAttributes.FamORAssem; } static Accessibility GetAccessibility(MethodAttributes attr) @@ -1720,7 +1786,7 @@ namespace ICSharpCode.NRefactory.TypeSystem } } - void TranslateModifiers(MethodInfo method, AbstractUnresolvedMember m) + void TranslateModifiers(MethodBase method, AbstractUnresolvedMember m) { if (m.DeclaringTypeDefinition.Kind == TypeKind.Interface) { // interface members don't have modifiers, but we want to handle them as "public abstract" @@ -1747,14 +1813,60 @@ namespace ICSharpCode.NRefactory.TypeSystem } #endregion + #region Read Constructor + [CLSCompliant(false)] + public IUnresolvedMethod ReadConstructor(ConstructorInfo method, IUnresolvedTypeDefinition parentType, EntityType methodType = EntityType.Method) + { + return ReadConstructor(method, parentType, methodType, null); + } + + IUnresolvedMethod ReadConstructor(ConstructorInfo method, IUnresolvedTypeDefinition parentType, EntityType methodType, IUnresolvedMember accessorOwner) + { + if (method == null) + return null; + DefaultUnresolvedMethod m = new DefaultUnresolvedMethod(parentType, method.Name); + m.EntityType = methodType; + m.AccessorOwner = accessorOwner; + m.HasBody = method.GetMethodBody () != null; + var genericArguments = method.GetGenericArguments (); + if (genericArguments != null) { + for (int i = 0; i < genericArguments.Length; i++) { + if (genericArguments[i].GenericParameterPosition != i) + throw new InvalidOperationException("g.Position != i"); + m.TypeParameters.Add(new DefaultUnresolvedTypeParameter( + EntityType.Method, i, genericArguments[i].Name)); + } + for (int i = 0; i < genericArguments.Length; i++) { + var tp = (DefaultUnresolvedTypeParameter)m.TypeParameters[i]; + AddConstraints(tp, genericArguments[i]); + tp.ApplyInterningProvider(interningProvider); + } + } + m.ReturnType = KnownTypeReference.Void; + + + if (HasAnyAttributes(method)) + AddAttributes(method, m.Attributes, m.ReturnTypeAttributes); + TranslateModifiers(method, m); + + foreach (var p in method.GetParameters ()) { + m.Parameters.Add(ReadParameter(p)); + } + + FinishReadMember(m, method); + return m; + } + + #endregion + #region Read Parameter [CLSCompliant(false)] public IUnresolvedParameter ReadParameter(ParameterInfo parameter) { if (parameter == null) throw new ArgumentNullException("parameter"); - var type = ReadTypeReference(parameter.ParameterType, typeAttributes: parameter); - var p = new DefaultUnresolvedParameter(type, interningProvider.Intern(parameter.Name)); + var type = ReadTypeReference(parameter.ParameterType, typeAttributes: parameter.CustomAttributes); + var p = new DefaultUnresolvedParameter(type, interningProvider.Intern(parameter.Name ?? "index")); if (parameter.ParameterType.IsByRef) { if (!parameter.IsIn && parameter.IsOut) @@ -1834,13 +1946,13 @@ namespace ICSharpCode.NRefactory.TypeSystem throw new ArgumentNullException("field"); if (parentType == null) throw new ArgumentNullException("parentType"); - DefaultUnresolvedField f = new DefaultUnresolvedField(parentType, field.Name); f.Accessibility = GetAccessibility(field.Attributes); f.IsReadOnly = field.IsInitOnly; f.IsStatic = field.IsStatic; - f.ReturnType = ReadTypeReference(field.FieldType, typeAttributes: field); - if (field.GetRawConstantValue () != null) { + f.ReturnType = ReadTypeReference(field.FieldType, typeAttributes: field.CustomAttributes); + + if (field.Attributes.HasFlag (FieldAttributes.HasDefault)) { f.ConstantValue = CreateSimpleConstantValue(f.ReturnType, field.GetRawConstantValue ()); } else { @@ -1883,19 +1995,15 @@ namespace ICSharpCode.NRefactory.TypeSystem #region Type Parameter Constraints void AddConstraints(DefaultUnresolvedTypeParameter tp, IKVM.Reflection.Type g) { -// TODO: -// switch (g.Attributes & GenericParameterAttributes.VarianceMask) { -// case GenericParameterAttributes.Contravariant: -// tp.Variance = VarianceModifier.Contravariant; -// break; -// case GenericParameterAttributes.Covariant: -// tp.Variance = VarianceModifier.Covariant; -// break; -// } -// -// tp.HasReferenceTypeConstraint = g.HasReferenceTypeConstraint; -// tp.HasValueTypeConstraint = g.HasNotNullableValueTypeConstraint; -// tp.HasDefaultConstructorConstraint = g.HasDefaultConstructorConstraint; + if (g.GenericParameterAttributes.HasFlag (GenericParameterAttributes.Contravariant)) { + tp.Variance = VarianceModifier.Contravariant; + } else if (g.GenericParameterAttributes.HasFlag (GenericParameterAttributes.Covariant)) { + tp.Variance = VarianceModifier.Covariant; + } + + tp.HasReferenceTypeConstraint = g.GenericParameterAttributes.HasFlag (GenericParameterAttributes.ReferenceTypeConstraint); + tp.HasValueTypeConstraint = g.GenericParameterAttributes.HasFlag (GenericParameterAttributes.NotNullableValueTypeConstraint); + tp.HasDefaultConstructorConstraint = g.GenericParameterAttributes.HasFlag (GenericParameterAttributes.DefaultConstructorConstraint); foreach (var constraint in g.GetGenericParameterConstraints ()) { tp.Constraints.Add(ReadTypeReference(constraint)); @@ -1936,13 +2044,14 @@ namespace ICSharpCode.NRefactory.TypeSystem throw new ArgumentNullException("property"); if (parentType == null) throw new ArgumentNullException("parentType"); + DefaultUnresolvedProperty p = new DefaultUnresolvedProperty(parentType, property.Name); p.EntityType = propertyType; TranslateModifiers(property.GetMethod ?? property.SetMethod, p); if (property.GetMethod != null && property.SetMethod != null) p.Accessibility = MergePropertyAccessibility (GetAccessibility (property.GetMethod.Attributes), GetAccessibility (property.SetMethod.Attributes)); - p.ReturnType = ReadTypeReference(property.PropertyType, typeAttributes: property); + p.ReturnType = ReadTypeReference(property.PropertyType, typeAttributes: property.CustomAttributes); p.Getter = ReadMethod(property.GetMethod, parentType, EntityType.Accessor, p); p.Setter = ReadMethod(property.SetMethod, parentType, EntityType.Accessor, p); @@ -1958,7 +2067,7 @@ namespace ICSharpCode.NRefactory.TypeSystem p.Name = property.Name.Substring(property.Name.LastIndexOf('.') + 1); p.IsExplicitInterfaceImplementation = true; foreach (var mr in accessor.ExplicitInterfaceImplementations) { - // p.ExplicitInterfaceImplementations.Add(new AccessorOwnerMemberReference(mr)); + p.ExplicitInterfaceImplementations.Add(new AccessorOwnerMemberReference(mr)); } } @@ -1978,7 +2087,7 @@ namespace ICSharpCode.NRefactory.TypeSystem DefaultUnresolvedEvent e = new DefaultUnresolvedEvent(parentType, ev.Name); TranslateModifiers(ev.AddMethod, e); - e.ReturnType = ReadTypeReference(ev.EventHandlerType, typeAttributes: ev); + e.ReturnType = ReadTypeReference(ev.EventHandlerType, typeAttributes: ev.CustomAttributes); e.AddAccessor = ReadMethod(ev.AddMethod, parentType, EntityType.Accessor, e); e.RemoveAccessor = ReadMethod(ev.RemoveMethod, parentType, EntityType.Accessor, e); @@ -1991,7 +2100,7 @@ namespace ICSharpCode.NRefactory.TypeSystem e.Name = ev.Name.Substring(ev.Name.LastIndexOf('.') + 1); e.IsExplicitInterfaceImplementation = true; foreach (var mr in accessor.ExplicitInterfaceImplementations) { - // e.ExplicitInterfaceImplementations.Add(new AccessorOwnerMemberReference(mr)); + e.ExplicitInterfaceImplementations.Add(new AccessorOwnerMemberReference(mr)); } } From e22be6ea28e67b4ca07052cf863151522cd4b979 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 1 Jun 2013 19:33:49 +0200 Subject: [PATCH 39/55] Fix crash in ConvertIfToSwitchAction when there are nested if statements. --- .../CodeActions/ConvertIfToSwitchAction.cs | 24 +++++------- .../CodeActions/ConvertIfToSwtichTests.cs | 37 ++++++++++++++++++- 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ConvertIfToSwitchAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ConvertIfToSwitchAction.cs index a7ac1bb7c4..a7410fcd02 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ConvertIfToSwitchAction.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ConvertIfToSwitchAction.cs @@ -174,22 +174,16 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring static void CollectSwitchSectionStatements (AstNodeCollection result, RefactoringContext context, Statement statement) { - BlockStatement blockStatement; - if (statement is BlockStatement) - blockStatement = (BlockStatement)statement.Clone (); + BlockStatement blockStatement = statement as BlockStatement; + if (blockStatement != null) + result.AddRange(blockStatement.Statements.Select(s => s.Clone())); else - blockStatement = new BlockStatement { statement.Clone () }; - - var breackStatement = new BreakStatement (); - blockStatement.Add (breackStatement); - // check if break is needed - var reachabilityAnalysis = context.CreateReachabilityAnalysis (blockStatement); - if (!reachabilityAnalysis.IsReachable (breackStatement)) - blockStatement.Statements.Remove (breackStatement); - - var statements = blockStatement.Statements.ToArray (); - blockStatement.Statements.Clear (); - result.AddRange (statements); + result.Add(statement.Clone()); + + // add 'break;' at end if necessary + var reachabilityAnalysis = context.CreateReachabilityAnalysis (statement); + if (reachabilityAnalysis.IsEndpointReachable(statement)) + result.Add(new BreakStatement()); } } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertIfToSwtichTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertIfToSwtichTests.cs index 34167d4600..f2b32ed13c 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertIfToSwtichTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertIfToSwtichTests.cs @@ -30,7 +30,7 @@ using NUnit.Framework; namespace ICSharpCode.NRefactory.CSharp.CodeActions { [TestFixture] - public class ConvertIfToSwtichTests : ContextActionTestBase + public class ConvertIfToSwitchTests : ContextActionTestBase { [Test] @@ -467,5 +467,40 @@ class TestClass }"); } + [Test] + public void TestNestedIf () + { + Test (@" +class TestClass +{ + void TestMethod (int a) + { + int b; + $if (a == 0) { + if (b == 0) + return; + } else if (a == 2 || a == 3) { + b = 2; + } + } +}", @" +class TestClass +{ + void TestMethod (int a) + { + int b; + switch (a) { + case 0: + if (b == 0) + return; + break; + case 2: + case 3: + b = 2; + break; + } + } +}"); + } } } From c1aa0acd09ac101026dfc254aeb1f43ff6134aa4 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 1 Jun 2013 21:18:46 +0200 Subject: [PATCH 40/55] Remove unreachable code --- ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs index 3e80b55671..d0891b121a 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs @@ -3043,7 +3043,6 @@ namespace Mono.CSharp value_builder[pos++] = (char) c; } - recordNewLine = true; } private int consume_identifier (int s) From 1e1ed360aa1656f0ba063e946df541eafb144171 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 1 Jun 2013 21:34:26 +0200 Subject: [PATCH 41/55] Fix ExpressionOfCompatibleTypeCastIssue: assigning a literal 0 to an enum-type variable is valid --- .../Analysis/ControlFlow.cs | 4 +- .../ExpressionOfCompatibleTypeCastIssue.cs | 49 +++++++++++-------- ...xpressionOfCompatibleTypeCastIssueTests.cs | 40 +++++++++++++++ 3 files changed, 71 insertions(+), 22 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Analysis/ControlFlow.cs b/ICSharpCode.NRefactory.CSharp/Analysis/ControlFlow.cs index d52f6964da..2d3895b1e9 100644 --- a/ICSharpCode.NRefactory.CSharp/Analysis/ControlFlow.cs +++ b/ICSharpCode.NRefactory.CSharp/Analysis/ControlFlow.cs @@ -361,8 +361,8 @@ namespace ICSharpCode.NRefactory.CSharp.Analysis protected override ControlFlowNode VisitChildren(AstNode node, ControlFlowNode data) { - // We have overrides for all possible expressions and should visit expressions only. - throw new NotImplementedException(); + // We have overrides for all possible statements and should visit statements only. + throw new NotSupportedException(); } public override ControlFlowNode VisitBlockStatement(BlockStatement blockStatement, ControlFlowNode data) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs index e828ebbb9a..7173be843a 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs @@ -58,35 +58,44 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring base.VisitAssignmentExpression(assignmentExpression); if (assignmentExpression.Operator != AssignmentOperatorType.Assign) return; - var rightExpressionType = ctx.Resolve(assignmentExpression.Right).Type; - var leftExpressionType = ctx.Resolve(assignmentExpression.Left).Type; - VisitTypeCastExpression(assignmentExpression, rightExpressionType, leftExpressionType); + var variableType = ctx.Resolve(assignmentExpression.Left).Type; + VisitTypeCastExpression(variableType, assignmentExpression.Right); } - + + public override void VisitVariableInitializer(VariableInitializer variableInitializer) + { + base.VisitVariableInitializer(variableInitializer); + if (!variableInitializer.Initializer.IsNull) { + var variableType = ctx.Resolve(variableInitializer).Type; + VisitTypeCastExpression(variableType, variableInitializer.Initializer); + } + } + private AstType CreateShortType(AstNode node, IType fullType) { var builder = ctx.CreateTypeSytemAstBuilder(node); return builder.ConvertType(fullType); } - void VisitTypeCastExpression(AssignmentExpression expression, IType exprType, IType castToType) + void VisitTypeCastExpression(IType variableType, Expression expression) { - if (exprType.Kind == TypeKind.Unknown || castToType.Kind == TypeKind.Unknown) - return; - var foundConversion = conversion.ExplicitConversion(exprType, castToType); - if (foundConversion == Conversion.None) - return; - if (!foundConversion.IsExplicit) - return; - var implicitConversion = conversion.ImplicitConversion(exprType, castToType); - if (implicitConversion != Conversion.None) - return; - - AddIssue(expression, string.Format(ctx.TranslateString("Cast to '{0}'"), castToType.Name), + if (variableType.Kind == TypeKind.Unknown) + return; // ignore error if the variable type is unknown + if (ctx.GetConversion(expression).IsValid) + return; // don't complain if the code is valid + + var rr = ctx.Resolve(expression); + if (rr.Type.Kind == TypeKind.Unknown) + return; // ignore error if expression type is unknown + var foundConversion = conversion.ExplicitConversion(rr, variableType); + if (!foundConversion.IsValid) + return; // there's an error, but we can't fix it by introducing a cast + + AddIssue(expression, string.Format(ctx.TranslateString("Cast to '{0}'"), variableType.Name), script => { - var right = expression.Right.Clone(); - var castRight = right.CastTo(CreateShortType(expression, castToType)); - script.Replace(expression.Right, castRight); + var right = expression.Clone(); + var castRight = right.CastTo(CreateShortType(expression, variableType)); + script.Replace(expression, castRight); }); } } diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs index 6af34c8099..b5c248f6bf 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/ExpressionOfCompatibleTypeCastIssueTests.cs @@ -31,6 +31,31 @@ enum Enum{ }; }"; Test(input, output); } + + [Test] + public void TestConversionInInitializer() + { + var input = @" +class TestClass +{ +enum Enum{ }; + void TestMethod (Enum i) + { + int x = i; + } +}"; + var output = @" +class TestClass +{ +enum Enum{ }; + void TestMethod (Enum i) + { + int x = (int)i; + } +}"; + Test(input, output); + } + [Test] public void TestClassConversion() { @@ -155,6 +180,21 @@ class TestClass Point p; p = new Vector (); } +}"; + Test(input, 0); + } + + [Test] + public void TestAssignZeroToEnum() + { + var input = @"using System; +class TestClass +{ + void TestMethod () + { + StringComparison c = 0; + c = 0; + } }"; Test(input, 0); } From e1f13aaedff5e57b8e96f0ad03eacbbba7a86843 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 1 Jun 2013 21:56:40 +0200 Subject: [PATCH 42/55] Replace ExpressionOfCompatibleTypeCastIssue with CS0029InvalidConversionIssue. --- .../ICSharpCode.NRefactory.CSharp.csproj | 2 +- .../CS0029InvalidConversionIssue.cs} | 62 ++++++++++++------- ...s => CS0029InvalidConversionIssueTests.cs} | 39 +++++++++--- .../ICSharpCode.NRefactory.Tests.csproj | 2 +- 4 files changed, 70 insertions(+), 35 deletions(-) rename ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/{ExpressionOfCompatibleTypeCastIssue.cs => CompilerErrors/CS0029InvalidConversionIssue.cs} (58%) rename ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/{ExpressionOfCompatibleTypeCastIssueTests.cs => CS0029InvalidConversionIssueTests.cs} (71%) diff --git a/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj b/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj index 09f17620ae..5d4746e2e0 100644 --- a/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj +++ b/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj @@ -296,11 +296,11 @@ + - diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompilerErrors/CS0029InvalidConversionIssue.cs similarity index 58% rename from ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs rename to ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompilerErrors/CS0029InvalidConversionIssue.cs index 7173be843a..c43ee6dd20 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ExpressionOfCompatibleTypeCastIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/CompilerErrors/CS0029InvalidConversionIssue.cs @@ -23,6 +23,8 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + +using System; using System.Collections.Generic; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Semantics; @@ -31,19 +33,24 @@ using ICSharpCode.NRefactory.Refactoring; namespace ICSharpCode.NRefactory.CSharp.Refactoring { - [IssueDescription("Type cast expression of compatible type", - Description = "Type cast expression of compatible type", - Category = IssueCategories.CodeQualityIssues, - Severity = Severity.Warning, + [IssueDescription("CS0029: Cannot implicitly convert type 'A' to 'B'.", + Description = "This error occurs when trying to assign a value of an incompatible type.", + Category = IssueCategories.CompilerErrors, + Severity = Severity.Error, IssueMarker = IssueMarker.Underline)] - public class ExpressionOfCompatibleTypeCastIssue : ICodeIssueProvider + public class CS0029InvalidConversionIssue : ICodeIssueProvider { + // This class handles both + // CS0029: Cannot implicitly convert type 'type' to 'type' + // and + // CS0266: Cannot implicitly convert type 'type1' to 'type2'. An explicit conversion exists (are you missing a cast?) + public IEnumerable GetIssues(BaseRefactoringContext context) { return new GatherVisitor(context).GetIssues(); } - class GatherVisitor : GatherVisitorBase + class GatherVisitor : GatherVisitorBase { readonly CSharpConversions conversion; @@ -53,13 +60,14 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring conversion = new CSharpConversions(ctx.Compilation); } + // Currently, we only checks assignments public override void VisitAssignmentExpression(AssignmentExpression assignmentExpression) { base.VisitAssignmentExpression(assignmentExpression); if (assignmentExpression.Operator != AssignmentOperatorType.Assign) return; var variableType = ctx.Resolve(assignmentExpression.Left).Type; - VisitTypeCastExpression(variableType, assignmentExpression.Right); + VisitAssignment(variableType, assignmentExpression.Right); } public override void VisitVariableInitializer(VariableInitializer variableInitializer) @@ -67,17 +75,11 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring base.VisitVariableInitializer(variableInitializer); if (!variableInitializer.Initializer.IsNull) { var variableType = ctx.Resolve(variableInitializer).Type; - VisitTypeCastExpression(variableType, variableInitializer.Initializer); + VisitAssignment(variableType, variableInitializer.Initializer); } } - private AstType CreateShortType(AstNode node, IType fullType) - { - var builder = ctx.CreateTypeSytemAstBuilder(node); - return builder.ConvertType(fullType); - } - - void VisitTypeCastExpression(IType variableType, Expression expression) + void VisitAssignment(IType variableType, Expression expression) { if (variableType.Kind == TypeKind.Unknown) return; // ignore error if the variable type is unknown @@ -87,16 +89,30 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring var rr = ctx.Resolve(expression); if (rr.Type.Kind == TypeKind.Unknown) return; // ignore error if expression type is unknown + var foundConversion = conversion.ExplicitConversion(rr, variableType); - if (!foundConversion.IsValid) - return; // there's an error, but we can't fix it by introducing a cast - AddIssue(expression, string.Format(ctx.TranslateString("Cast to '{0}'"), variableType.Name), - script => { - var right = expression.Clone(); - var castRight = right.CastTo(CreateShortType(expression, variableType)); - script.Replace(expression, castRight); - }); + var builder = ctx.CreateTypeSytemAstBuilder(expression); + AstType variableTypeNode = builder.ConvertType(variableType); + AstType expressionTypeNode = builder.ConvertType(rr.Type); + + if (foundConversion.IsValid) { + // CS0266: An explicit conversion exists -> suggested fix is to insert the cast + string title = string.Format(ctx.TranslateString("Cannot implicitly convert type `{0}' to `{1}'. An explicit conversion exists (are you missing a cast?)"), + expressionTypeNode, variableTypeNode); + string fixTitle = string.Format(ctx.TranslateString("Cast to '{0}'"), variableTypeNode); + Action