diff --git a/AddIns/ICSharpCode.SharpDevelop.addin b/AddIns/ICSharpCode.SharpDevelop.addin index abed0959b5..f536eb4d42 100644 --- a/AddIns/ICSharpCode.SharpDevelop.addin +++ b/AddIns/ICSharpCode.SharpDevelop.addin @@ -537,10 +537,10 @@ - + + label = "${res:ProjectComponent.ContextMenu.AddWebReference}" + class = "ICSharpCode.SharpDevelop.Project.Commands.AddWebReferenceToProject"/> - + + class = "ICSharpCode.SharpDevelop.Project.Commands.RefreshWebReference"/> + icon = "Icons.16x16.PropertiesIcon" + label = "${res:XML.MainMenu.FormatMenu.ShowProperties}" + class = "ICSharpCode.SharpDevelop.Project.Commands.ShowPropertiesForNode"/> @@ -933,9 +933,9 @@ class = "ICSharpCode.SharpDevelop.Commands.TabStrip.SaveFileAsTab"/> + icon = "Icons.16x16.SaveAllIcon" + label = "${res:XML.MainMenu.FileMenu.SaveAll.Description}" + class = "ICSharpCode.SharpDevelop.Commands.SaveAllFiles"/> @@ -1010,15 +1010,15 @@ + label = "${res:SideBarComponent.ContextMenu.RenameTab}" + class = "ICSharpCode.SharpDevelop.Commands.SideBarRenameTabHeader"/> - + - + + label = "${res:SideBarComponent.ContextMenu.DeleteTabItem}" + class = "ICSharpCode.SharpDevelop.Commands.SideBarDeleteTabItem"/> + label = "${res:SideBarComponent.ContextMenu.RenameTabItem}" + class = "ICSharpCode.SharpDevelop.Commands.SideBarRenameTabItem" /> + label = "${res:SideBarComponent.ContextMenu.MoveTabItemUp}" + class = "ICSharpCode.SharpDevelop.Commands.SideBarMoveActiveItemUp"/> + label = "${res:SideBarComponent.ContextMenu.MoveTabItemDown}" + class = "ICSharpCode.SharpDevelop.Commands.SideBarMoveActiveItemDown"/> @@ -1279,8 +1279,8 @@ label = "${res:ProjectComponent.ContextMenu.AddReference}" class = "ICSharpCode.SharpDevelop.Project.Commands.AddReferenceToProject"/> + label = "${res:ProjectComponent.ContextMenu.AddWebReference}" + class = "ICSharpCode.SharpDevelop.Project.Commands.AddWebReferenceToProject"/> @@ -1579,7 +1579,7 @@ - + @@ -1612,7 +1612,7 @@ class = "ICSharpCode.SharpDevelop.Refactoring.RenameLocalVariableCommand"/> + class = "ICSharpCode.SharpDevelop.Refactoring.FindLocalVariableReferencesCommand"/> @@ -1654,10 +1654,6 @@ icon = "Icons.16x16.CommentRegion" label = "${res:XML.TextAreaContextMenu.CommentUncommentSelection}" class= "ICSharpCode.SharpDevelop.DefaultEditor.Commands.CommentRegion"/> - + + + @@ -1933,7 +1938,6 @@ - diff --git a/data/resources/StringResources.cz.resources b/data/resources/StringResources.cz.resources index 17d2916137..8b1cb2b8e9 100644 Binary files a/data/resources/StringResources.cz.resources and b/data/resources/StringResources.cz.resources differ diff --git a/data/resources/StringResources.de.resources b/data/resources/StringResources.de.resources index 3203f98ca1..b33053639e 100644 Binary files a/data/resources/StringResources.de.resources and b/data/resources/StringResources.de.resources differ diff --git a/data/resources/StringResources.hu.resources b/data/resources/StringResources.hu.resources index c3243ba54d..7c6486ecb8 100644 Binary files a/data/resources/StringResources.hu.resources and b/data/resources/StringResources.hu.resources differ diff --git a/data/resources/StringResources.nl.resources b/data/resources/StringResources.nl.resources index bab078f00a..745db51b2a 100644 Binary files a/data/resources/StringResources.nl.resources and b/data/resources/StringResources.nl.resources differ diff --git a/data/resources/StringResources.pt-br.resources b/data/resources/StringResources.pt-br.resources index 22d09fec8b..603ef2ddf3 100644 Binary files a/data/resources/StringResources.pt-br.resources and b/data/resources/StringResources.pt-br.resources differ diff --git a/data/resources/StringResources.tr.resources b/data/resources/StringResources.tr.resources index e256edcd62..a3b53f95c8 100644 Binary files a/data/resources/StringResources.tr.resources and b/data/resources/StringResources.tr.resources differ diff --git a/data/templates/file/CSharp/CSharp.Web.WebControl.xft b/data/templates/file/CSharp/CSharp.Web.WebControl.xft index b79171d9a7..7cdbd35d1c 100644 --- a/data/templates/file/CSharp/CSharp.Web.WebControl.xft +++ b/data/templates/file/CSharp/CSharp.Web.WebControl.xft @@ -6,7 +6,7 @@ icon = "C#.File.NewClass" category = "C#" subcategory = "ASP.NET" - defaultname = "WebControl" + defaultname = "WebControl${Number}" language = "C#" /> diff --git a/data/templates/file/CSharp/CSharp.Web.WebService.xft b/data/templates/file/CSharp/CSharp.Web.WebService.xft index b1e39f51cb..c6dd1e03f8 100644 --- a/data/templates/file/CSharp/CSharp.Web.WebService.xft +++ b/data/templates/file/CSharp/CSharp.Web.WebService.xft @@ -6,7 +6,7 @@ icon = "C#.File.NewClass" category = "C#" subcategory = "ASP.NET" - defaultname = "WebService.asmx" + defaultname = "WebService${Number}.asmx" language = "C#" /> diff --git a/doc/AssemblyBaseAddresses.txt b/doc/AssemblyBaseAddresses.txt new file mode 100644 index 0000000000..8e96fe48fe --- /dev/null +++ b/doc/AssemblyBaseAddresses.txt @@ -0,0 +1,61 @@ +To be on the safe side and leave enough space for the future, +the in-memory size of an assembly used here should be 8 times the disk image size. + +Sysinternals Processexplorer can show relocated assemblies in yellow in the DLL View. + +adr = 0x5000000 +def AddModule(kbsize as int): + print "0x${adr.ToString('x')} - 0x${(adr + 3 * kbsize * 1024).ToString('x')}" + adr += 8 * kbsize * 1024 + adr = 0x80000 * System.Math.Ceiling(cast(double,adr) / 0x80000) + +def AddModules(*names as (string)): + for name in names: + System.Console.Write("${name}:\t") + AddModule(System.IO.FileInfo("d:\\corsavy\\sharpdevelop\\bin\\" + name + ".dll").Length / 1024) + +AssemblyName: startaddress - endaddress +ICSharpCode.Core: 0x5000000 - 0x504e000 +ICSharpCode.SharpDevelop: 0x5100000 - 0x5472000 +ICSharpCode.NRefactory: 0x5a80000 - 0x5b9a000 +ICSharpCode.TextEditor: 0x5d80000 - 0x5e67000 +MonoReflectionLoader: 0x6000000 - 0x600c000 +WeifenLuo.WinFormsUI.Docking: 0x6080000 - 0x6107000 +ICSharpCode.Build.Tasks: 0x6200000 - 0x621b000 + +CSharpBinding: 0x6280000 - 0x62bc000 +ILAsmBinding: 0x6380000 - 0x639b000 +VBNetBinding: 0x6400000 - 0x643f000 +NRefactoryToBooConverter: 0x6500000 - 0x6536000 +BooBinding: 0x6600000 - 0x664e000 + +FormsDesigner: 0x6700000 - 0x676f000 +ResourceEditor: 0x6880000 - 0x689e000 +XmlEditor: 0x6900000 - 0x6948000 + +ICSharpCode.AddInMananger: 0x6a00000 - 0x6a24000 +AddInScout: 0x6a80000 - 0x6a8b400 +CodeCoverage: 0x6b00000 - 0x6b30000 +TreeListView (debugger): 0x6b80000 - 0x6be6000 +Debugger.Code: 0x6d00000 - 0x6ddb000 +Debugger.AddIn: 0x6f80000 - 0x6faa000 +FileTypeRegisterer: 0x7000000 - 0x7009000 +HighlightingEditor: 0x7080000 - 0x70ec000 +HtmlHelp2: 0x7200000 - 0x723f000 +HtmlHelp2JScriptGlobals: 0x7300000 - 0x7306c00 +MonoAddIn: 0x7380000 - 0x7395000 +NAntAddIn: 0x7400000 - 0x7427000 +PInvokeAddIn: 0x7480000 - 0x749b000 +RegExpTk: 0x7500000 - 0x7524000 +SharpQuery: 0x7580000 - 0x75b0000 +SharpReportCore: 0x7600000 - 0x7654000 +SharpReport: 0x7700000 - 0x773c000 +SharpReportAddIn: 0x7800000 - 0x781e000 +ReportGenerator: 0x7880000 - 0x78a1000 +StartPage: 0x7900000 - 0x791e000 +UnitTesting: 0x7980000 - 0x799b000 + +Next free address: 0x7a00000 + + + diff --git a/src/AddIns/BackendBindings/Boo/BooBinding.sln b/src/AddIns/BackendBindings/Boo/BooBinding.sln index aafaa2a3d8..02bc32ff2a 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding.sln +++ b/src/AddIns/BackendBindings/Boo/BooBinding.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.0.0.1199 +# SharpDevelop 2.1.0.1333 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryToBooConverter", "NRefactoryToBooConverter\Project\NRefactoryToBooConverter.csproj", "{DBCF20A1-BA13-4582-BFA9-74DE4D987B73}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryToBooConverter.Tests", "NRefactoryToBooConverter\Test\NRefactoryToBooConverter.Tests.csproj", "{C9DE556D-325C-4544-B29F-16A9EB7C9830}" @@ -8,8 +8,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StandaloneConverter", "Stan EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BooBinding", "BooBinding\Project\BooBinding.csproj", "{4AC2D5F1-F671-480C-A075-6BF62B3721B2}" EndProject -Project("{A33008B1-5DAC-44D5-9060-242E3B6E38F2}") = "Boo.InterpreterAddIn", "Boo.InterpreterAddIn\Project\Boo.InterpreterAddIn.booproj", "{928E34B2-5E46-4A4D-8E4D-2CA2CCDB905A}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "..\..\..\Libraries\NRefactory\Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TextEditor", "..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj", "{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}" @@ -22,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "..\..\..\Libr EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormsDesigner", "..\..\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj", "{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BooBinding.Tests", "BooBinding\Test\BooBinding.Tests.csproj", "{6FA16499-896F-4C02-BB43-1AF5C6C7C713}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -80,5 +80,9 @@ Global {83DD7E12-A705-4DBA-9D71-09C8973D9382}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {83DD7E12-A705-4DBA-9D71-09C8973D9382}.Release|Any CPU.Build.0 = Release|Any CPU {83DD7E12-A705-4DBA-9D71-09C8973D9382}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6FA16499-896F-4C02-BB43-1AF5C6C7C713}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6FA16499-896F-4C02-BB43-1AF5C6C7C713}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6FA16499-896F-4C02-BB43-1AF5C6C7C713}.Release|Any CPU.Build.0 = Release|Any CPU + {6FA16499-896F-4C02-BB43-1AF5C6C7C713}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.csproj b/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.csproj index c5cfc2cc1e..3146967f52 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.csproj +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.csproj @@ -10,7 +10,7 @@ False False Auto - 4194304 + 106954752 AnyCPU 4096 4 diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooAmbience.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooAmbience.cs index 24836c6af2..f23191f5c2 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooAmbience.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooAmbience.cs @@ -323,6 +323,14 @@ namespace Grunwald.BooBinding } if (property.IsIndexer) { + if (property.DeclaringType != null) { + if (UseFullyQualifiedMemberNames) { + builder.Append(property.DeclaringType.FullyQualifiedName); + } else { + builder.Append(property.DeclaringType.Name); + } + builder.Append('.'); + } builder.Append("self"); } else { if (IncludeHTMLMarkup) { diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs index 28ac275bf2..af840ac44a 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs @@ -101,5 +101,21 @@ namespace Grunwald.BooBinding return BooAmbience.Instance; } } + + [Browsable(false)] + public bool Ducky { + get { + return GetProperty("Ducky", false); + } + } + + public override void SetProperty(string configurationName, string platform, string property, T value, PropertyStorageLocations location) + { + bool oldDucky = Ducky; + base.SetProperty(configurationName, platform, property, value, location); + if (Ducky != oldDucky) { + ParserService.Reparse(this); + } + } } } diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs index ac706d6028..d38209faa0 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs @@ -63,6 +63,19 @@ namespace Grunwald.BooBinding.CodeCompletion return cu; } } + + /// + /// Gets if duck typing is enabled for the Boo project. + /// + public bool IsDucky { + get { + BooProject p = pc.Project as BooProject; + if (p != null) + return p.Ducky; + else + return false; + } + } #endregion #region Initialization @@ -184,6 +197,9 @@ namespace Grunwald.BooBinding.CodeCompletion return new NamespaceResolveResult(callingClass, callingMember, ""); } + ResolveResult rr = NRResolver.GetResultFromDeclarationLine(callingClass, callingMember as IMethodOrProperty, caretLine, caretColumn, expressionResult.Expression); + if (rr != null) return rr; + AST.Expression expr; try { expr = Boo.Lang.Parser.BooParser.ParseExpression("expression", expressionResult.Expression); @@ -273,18 +289,18 @@ namespace Grunwald.BooBinding.CodeCompletion public ArrayList CtrlSpace(int caretLine, int caretColumn, string fileName, string fileContent, ExpressionContext context) { - ArrayList result; + ArrayList result = new ArrayList(); if (!Initialize(fileName, caretLine, caretColumn)) return null; if (context == ExpressionContext.Importable) { - result = new ArrayList(); pc.AddNamespaceContents(result, "", pc.Language, true); NRResolver.AddUsing(result, pc.DefaultImports, pc); return result; } - result = GetImportedNamespaceContents(); + NRResolver.AddContentsFromCalling(result, callingClass, callingMember); + AddImportedNamespaceContents(result); if (BooProject.BooCompilerPC != null) { if (context == ExpressionFinder.BooAttributeContext.Instance) { @@ -304,8 +320,6 @@ namespace Grunwald.BooBinding.CodeCompletion } } - NRResolver.AddContentsFromCalling(result, callingClass, callingMember); - List knownVariableNames = new List(); foreach (object o in result) { IMember m = o as IMember; @@ -325,14 +339,58 @@ namespace Grunwald.BooBinding.CodeCompletion // used by ctrl+space and resolve visitor (resolve identifier) public ArrayList GetImportedNamespaceContents() { - ArrayList list = new ArrayList(); + ArrayList result = new ArrayList(); + AddImportedNamespaceContents(result); + return result; + } + + void AddImportedNamespaceContents(ArrayList list) + { IClass c; - foreach (KeyValuePair pair in BooAmbience.TypeConversionTable) { - c = GetPrimitiveClass(pc, pair.Key, pair.Value); + foreach (KeyValuePair pair in BooAmbience.ReverseTypeConversionTable) { + c = GetPrimitiveClass(pc, pair.Value, pair.Key); if (c != null) list.Add(c); } + list.Add(new DuckClass(cu)); NRResolver.AddImportedNamespaceContents(list, cu, callingClass); - return list; + } + + internal class DuckClass : DefaultClass + { + public DuckClass(ICompilationUnit cu) : base(cu, "duck") + { + Documentation = "Use late-binding to access members of this type.
\n'If it walks like a duck and quacks like a duck, it must be a duck.'"; + Modifiers = ModifierEnum.Public; + } + + protected override IReturnType CreateDefaultReturnType() + { + return new DuckReturnType(this); + } + } + + internal class DuckReturnType : AbstractReturnType + { + IClass c; + public DuckReturnType(IClass c) { + this.c = c; + FullyQualifiedName = c.FullyQualifiedName; + } + public override IClass GetUnderlyingClass() { + return c; + } + public override List GetMethods() { + return new List(); + } + public override List GetProperties() { + return new List(); + } + public override List GetFields() { + return new List(); + } + public override List GetEvents() { + return new List(); + } } #endregion } diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/CompletionBinding.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/CompletionBinding.cs index b7a994fc30..dda759faba 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/CompletionBinding.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/CompletionBinding.cs @@ -52,7 +52,7 @@ namespace Grunwald.BooBinding.CodeCompletion public override bool HandleKeyword(SharpDevelopTextAreaControl editor, string word) { - switch (word.ToLower(CultureInfo.InvariantCulture)) { + switch (word.ToLowerInvariant()) { case "import": editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(ExpressionContext.Importable), ' '); return true; diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ConvertVisitor.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ConvertVisitor.cs index a81fdd665d..7c1dc69b91 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ConvertVisitor.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ConvertVisitor.cs @@ -177,7 +177,7 @@ namespace Grunwald.BooBinding.CodeCompletion if (parameters == null || parameters.Count == 0) { m.Parameters = DefaultParameter.EmptyParameterList; } else { - AddParameters(parameters, m.Parameters); + AddParameters(parameters, m.Parameters, m, m.DeclaringType); } } void ConvertParameters(AST.ParameterDeclarationCollection parameters, DefaultProperty p) @@ -185,14 +185,17 @@ namespace Grunwald.BooBinding.CodeCompletion if (parameters == null || parameters.Count == 0) { p.Parameters = DefaultParameter.EmptyParameterList; } else { - AddParameters(parameters, p.Parameters); + AddParameters(parameters, p.Parameters, p, p.DeclaringType); } } - void AddParameters(AST.ParameterDeclarationCollection parameters, IList output) + internal static void AddParameters(AST.ParameterDeclarationCollection parameters, IList output, IMethodOrProperty method, IClass c) { + if (c == null) throw new ArgumentNullException("c"); DefaultParameter p = null; foreach (AST.ParameterDeclaration par in parameters) { - p = new DefaultParameter(par.Name, CreateReturnType(par.Type), GetRegion(par)); + p = new DefaultParameter(par.Name, + CreateReturnType(par.Type, c, method as IMethod, c.Region.BeginLine + 1, 1, c.ProjectContent), + new DomRegion(par.LexicalInfo.Line, par.LexicalInfo.Column)); if (par.IsByRef) p.Modifiers |= ParameterModifiers.Ref; output.Add(p); } @@ -210,13 +213,23 @@ namespace Grunwald.BooBinding.CodeCompletion return CreateReturnType(reference, c, method, c.Region.BeginLine + 1, 1, _cu.ProjectContent); } } + + internal static IReturnType GetDefaultReturnType(IProjectContent projectContent) + { + BooProject project = projectContent.Project as BooProject; + if (project != null && project.Ducky) + return new BooResolver.DuckClass(new DefaultCompilationUnit(projectContent)).DefaultReturnType; + else + return ReflectionReturnType.Object; + } + public static IReturnType CreateReturnType(AST.TypeReference reference, IClass callingClass, - IMember callingMember, int caretLine, int caretColumn, + IMethodOrProperty callingMember, int caretLine, int caretColumn, IProjectContent projectContent) { + System.Diagnostics.Debug.Assert(projectContent != null); if (reference == null) { - LoggingService.Warn("inferred return type!"); - return ReflectionReturnType.Object; + return GetDefaultReturnType(projectContent); } if (reference is AST.ArrayTypeReference) { AST.ArrayTypeReference arr = (AST.ArrayTypeReference)reference; @@ -227,7 +240,9 @@ namespace Grunwald.BooBinding.CodeCompletion string name = ((AST.SimpleTypeReference)reference).Name; IReturnType rt; int typeParameterCount = (reference is AST.GenericTypeReference) ? ((AST.GenericTypeReference)reference).GenericArguments.Count : 0; - if (BooAmbience.ReverseTypeConversionTable.ContainsKey(name)) + if (name == "duck") + rt = new BooResolver.DuckClass(new DefaultCompilationUnit(projectContent)).DefaultReturnType; + else if (BooAmbience.ReverseTypeConversionTable.ContainsKey(name)) rt = new GetClassReturnType(projectContent, BooAmbience.ReverseTypeConversionTable[name], typeParameterCount); else rt = new SearchClassReturnType(projectContent, callingClass, caretLine, caretColumn, @@ -244,7 +259,13 @@ namespace Grunwald.BooBinding.CodeCompletion } return rt; } else if (reference is AST.CallableTypeReference) { - return new AnonymousMethodReturnType(); + AST.CallableTypeReference ctr = (AST.CallableTypeReference)reference; + AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(new DefaultCompilationUnit(projectContent)); + if (ctr.ReturnType != null) { + amrt.MethodReturnType = CreateReturnType(ctr.ReturnType, callingClass, callingMember, caretLine, caretColumn, projectContent); + } + AddParameters(ctr.Parameters, amrt.MethodParameters, callingMember, callingClass ?? new DefaultClass(new DefaultCompilationUnit(projectContent), "__Dummy")); + return amrt; } else { throw new NotSupportedException("unknown reference type: " + reference.ToString()); } @@ -263,7 +284,7 @@ namespace Grunwald.BooBinding.CodeCompletion if (field.Initializer != null) return new InferredReturnType(field.Initializer, OuterClass); else - return ReflectionReturnType.Object; + return GetDefaultReturnType(_cu.ProjectContent); } else { return CreateReturnType(field.Type); } @@ -271,13 +292,13 @@ namespace Grunwald.BooBinding.CodeCompletion IReturnType CreateReturnType(AST.Method node, IMethod method) { if (node.ReturnType == null) - return new InferredReturnType(node.Body, OuterClass); + return new InferredReturnType(node.Body, OuterClass, false); return CreateReturnType(node.ReturnType, method); } IReturnType CreateReturnType(AST.Property property) { if (property.Type == null && property.Getter != null && property.Getter.Body != null) - return new InferredReturnType(property.Getter.Body, OuterClass); + return new InferredReturnType(property.Getter.Body, OuterClass, false); return CreateReturnType(property.Type); } @@ -392,6 +413,18 @@ namespace Grunwald.BooBinding.CodeCompletion private void LeaveTypeDefinition(AST.TypeDefinition node) { DefaultClass c = _currentClass.Pop(); + foreach (AST.Attribute att in node.Attributes) { + if (att.Name == "System.Reflection.DefaultMemberAttribute" && att.Arguments.Count == 1) { + AST.StringLiteralExpression sle = att.Arguments[0] as AST.StringLiteralExpression; + if (sle != null) { + foreach (DefaultProperty p in c.Properties) { + if (p.Name == sle.Value) { + p.IsIndexer = true; + } + } + } + } + } //LoggingService.Debug("Leave "+node.GetType().Name+" "+node.FullName+" (Class = "+c.FullyQualifiedName+")"); } diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/InferredReturnType.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/InferredReturnType.cs index b22907b257..a7a70a2298 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/InferredReturnType.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/InferredReturnType.cs @@ -29,9 +29,12 @@ namespace Grunwald.BooBinding.CodeCompletion this.expression = expression; } - public InferredReturnType(Block block, IClass context) + bool useLastStatementIfNoReturnStatement; + + public InferredReturnType(Block block, IClass context, bool useLastStatementIfNoReturnStatement) { if (block == null) throw new ArgumentNullException("block"); + this.useLastStatementIfNoReturnStatement = useLastStatementIfNoReturnStatement; this.block = block; this.context = context; } @@ -44,12 +47,17 @@ namespace Grunwald.BooBinding.CodeCompletion Block b = block; block = null; // reset block before calling Visit to prevent StackOverflow v.Visit(b); - if (v.noReturnStatement) - cachedType = ReflectionReturnType.Void; - else if (v.result is NullReturnType) + if (v.noReturnStatement) { + if (useLastStatementIfNoReturnStatement && v.lastExpressionStatement != null) { + cachedType = new BooResolver().GetTypeOfExpression(v.lastExpressionStatement.Expression, context); + } else { + cachedType = ReflectionReturnType.Void; + } + } else if (v.result is NullReturnType) { cachedType = ReflectionReturnType.Object; - else + } else { cachedType = v.result; + } } else if (expression != null) { Expression expr = expression; expression = null; @@ -66,8 +74,10 @@ namespace Grunwald.BooBinding.CodeCompletion { this.context = context; } + public IReturnType result; public bool noReturnStatement = true; + public ExpressionStatement lastExpressionStatement; public override void OnReturnStatement(ReturnStatement node) { @@ -79,10 +89,22 @@ namespace Grunwald.BooBinding.CodeCompletion } } + public override void OnExpressionStatement(ExpressionStatement node) + { + base.OnExpressionStatement(node); + lastExpressionStatement = node; + } + public override void OnYieldStatement(YieldStatement node) { noReturnStatement = false; - result = ReflectionReturnType.CreatePrimitive(typeof(System.Collections.IEnumerable)); + IClass enumerable = ProjectContentRegistry.Mscorlib.GetClass("System.Collections.Generic.IEnumerable", 1); + result = new ConstructedReturnType(enumerable.DefaultReturnType, new IReturnType[] { new InferredReturnType(node.Expression, context) }); + } + + public override void OnCallableBlockExpression(CallableBlockExpression node) + { + // ignore return statements in callable blocks } public override bool Visit(Node node) diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs index db124e05e3..446326d53c 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs @@ -168,9 +168,14 @@ namespace Grunwald.BooBinding.CodeCompletion } } } - if (callingClass != null) { - if (ResolveMember(callingClass.DefaultReturnType, identifier)) - return true; + + { // Find members of this class or enclosing classes + IClass tmp = callingClass; + while (tmp != null) { + if (ResolveMember(tmp.DefaultReturnType, identifier)) + return true; + tmp = tmp.DeclaringType; + } } string namespaceName = projectContent.SearchNamespace(identifier, callingClass, cu, resolver.CaretLine, resolver.CaretColumn); @@ -291,6 +296,19 @@ namespace Grunwald.BooBinding.CodeCompletion } } else { if (resolveResult != null) { + if (resolveResult is TypeResolveResult) { + IClass rClass = (resolveResult as TypeResolveResult).ResolvedClass; + if (rClass != null) { + foreach (IClass baseClass in rClass.ClassInheritanceTree) { + foreach (IClass innerClass in baseClass.InnerClasses) { + if (IsSameName(innerClass.Name, node.Name)) { + MakeTypeResult(innerClass); + return; + } + } + } + } + } ResolveMember(resolveResult.ResolvedType, node.Name); } } @@ -350,19 +368,28 @@ namespace Grunwald.BooBinding.CodeCompletion { ClearResult(); node.Target.Accept(this); + if (resolveResult is MixedResolveResult) { + MixedResolveResult mixed = (MixedResolveResult)resolveResult; + resolveResult = mixed.TypeResult; + foreach (ResolveResult rr in mixed.Results) { + if (rr is MethodResolveResult) { + resolveResult = rr; + break; + } + } + } if (resolveResult == null) return; + if (resolveResult is MethodResolveResult) { // normal method call string methodName = ((MethodResolveResult)resolveResult).Name; IReturnType containingType = ((MethodResolveResult)resolveResult).ContainingType; ResolveMethodInType(containingType, methodName, node.Arguments); - } else if (resolveResult is TypeResolveResult || resolveResult is MixedResolveResult) { - TypeResolveResult trr = resolveResult as TypeResolveResult; - if (trr == null) - trr = (resolveResult as MixedResolveResult).TypeResult; - if (trr != null && trr.ResolvedClass != null) { + } else if (resolveResult is TypeResolveResult) { + TypeResolveResult trr = (TypeResolveResult)resolveResult; + if (trr.ResolvedClass != null) { if (trr.ResolvedClass.FullyQualifiedName == "array") { ResolveArrayCreation(node.Arguments); return; @@ -524,6 +551,7 @@ namespace Grunwald.BooBinding.CodeCompletion switch (node.Operator) { case BinaryOperatorType.GreaterThan: case BinaryOperatorType.GreaterThanOrEqual: + case BinaryOperatorType.Equality: case BinaryOperatorType.Inequality: case BinaryOperatorType.LessThan: case BinaryOperatorType.LessThanOrEqual: @@ -531,8 +559,6 @@ namespace Grunwald.BooBinding.CodeCompletion case BinaryOperatorType.Member: case BinaryOperatorType.NotMatch: case BinaryOperatorType.NotMember: - case BinaryOperatorType.Or: - case BinaryOperatorType.And: case BinaryOperatorType.ReferenceEquality: case BinaryOperatorType.ReferenceInequality: case BinaryOperatorType.TypeTest: @@ -566,7 +592,15 @@ namespace Grunwald.BooBinding.CodeCompletion public override void OnCallableBlockExpression(CallableBlockExpression node) { - MakeResult(new AnonymousMethodReturnType()); + AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(cu); + if (node.ReturnType != null) { + amrt.MethodReturnType = ConvertType(node.ReturnType); + } else { + amrt.MethodReturnType = new InferredReturnType(node.Body, resolver.CallingClass, + node.ContainsAnnotation("inline")); + } + ConvertVisitor.AddParameters(node.Parameters, amrt.MethodParameters, resolver.CallingMember, resolver.CallingClass ?? new DefaultClass(resolver.CompilationUnit, "__Dummy")); + MakeResult(amrt); } public override void OnCallableTypeReference(CallableTypeReference node) diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/VariableLookupVisitor.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/VariableLookupVisitor.cs index a300b118d6..ac78889419 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/VariableLookupVisitor.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/VariableLookupVisitor.cs @@ -26,9 +26,32 @@ namespace Grunwald.BooBinding.CodeCompletion DeclarationFound(node.Declaration.Name, node.Declaration.Type, node.Initializer, node.LexicalInfo); } - public override void OnParameterDeclaration(ParameterDeclaration node) + SourceLocation GetEndSourceLocation(Node node) + { + if (node.EndSourceLocation.IsValid) return node.EndSourceLocation; + if (node is CallableBlockExpression) { + return GetEndSourceLocation((node as CallableBlockExpression).Body); + } else if (node is ForStatement) { + return GetEndSourceLocation((node as ForStatement).Block); + } else if (node is ExceptionHandler) { + return GetEndSourceLocation((node as ExceptionHandler).Block); + } else if (node is Block) { + StatementCollection st = (node as Block).Statements; + if (st.Count > 0) { + return GetEndSourceLocation(st[st.Count - 1]); + } + } + return node.EndSourceLocation; + } + + public override void OnCallableBlockExpression(CallableBlockExpression node) { - DeclarationFound(node.Name, node.Type, null, node.LexicalInfo); + if (node.LexicalInfo.Line <= resolver.CaretLine && GetEndSourceLocation(node).Line >= resolver.CaretLine - 1) { + foreach (ParameterDeclaration param in node.Parameters) { + DeclarationFound(param.Name, param.Type ?? (resolver.IsDucky ? new SimpleTypeReference("duck") : new SimpleTypeReference("object")), null, param.LexicalInfo); + } + base.OnCallableBlockExpression(node); + } } protected override void OnError(Node node, Exception error) @@ -51,7 +74,7 @@ namespace Grunwald.BooBinding.CodeCompletion public override void OnForStatement(ForStatement node) { - if (node.LexicalInfo.Line <= resolver.CaretLine && node.Block.EndSourceLocation.Line >= resolver.CaretLine - 1) { + if (node.LexicalInfo.Line <= resolver.CaretLine && GetEndSourceLocation(node).Line >= resolver.CaretLine - 1) { foreach (Declaration decl in node.Declarations) { IterationDeclarationFound(decl.Name, decl.Type, node.Iterator, node.LexicalInfo); } @@ -82,6 +105,14 @@ namespace Grunwald.BooBinding.CodeCompletion } } } + + public override void OnExceptionHandler(ExceptionHandler node) + { + if (node.LexicalInfo.Line <= resolver.CaretLine && GetEndSourceLocation(node).Line >= resolver.CaretLine) { + DeclarationFound(node.Declaration.Name, node.Declaration.Type ?? new SimpleTypeReference("System.Exception"), null, node.Declaration.LexicalInfo); + } + base.OnExceptionHandler(node); + } } /// @@ -142,7 +173,14 @@ namespace Grunwald.BooBinding.CodeCompletion { if (expr == null) return; - IReturnType returnType = new InferredReturnType(expr, resolver.CallingClass); + // Prevent creating an infinite number of InferredReturnTypes in inferring cycles + IReturnType returnType; + if (expr.ContainsAnnotation("DomReturnType")) { + returnType = (IReturnType)expr["DomReturnType"]; + } else { + returnType = new InferredReturnType(expr, resolver.CallingClass); + expr.Annotate("DomReturnType", returnType); + } if (useElementType) returnType = new ElementReturnType(returnType); result = new DefaultField.LocalVariableField(returnType, name, @@ -199,7 +237,9 @@ namespace Grunwald.BooBinding.CodeCompletion if (declarationType != null) { Add(declarationName, declarationType); } else if (initializer != null) { - Add(declarationName, initializer, false); + if (!knownVariableNames.Contains(declarationName)) { + Add(declarationName, initializer, false); + } } } diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/Designer/BooDesignerGenerator.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/Designer/BooDesignerGenerator.cs index 80a6609f70..126b1f1bac 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/Designer/BooDesignerGenerator.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/Designer/BooDesignerGenerator.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using System.Collections.Generic; using System.Text; using System.Reflection; using System.CodeDom; @@ -30,6 +31,77 @@ namespace Grunwald.BooBinding.Designer return new Boo.Lang.CodeDom.BooCodeProvider(); } + protected override void FixGeneratedCode(IClass formClass, CodeMemberMethod code) + { + base.FixGeneratedCode(formClass, code); + Dictionary variables = new Dictionary(); + foreach (IField f in formClass.DefaultReturnType.GetFields()) { + variables[f.Name] = f.ReturnType; + } + variables[""] = formClass.DefaultReturnType; + foreach (CodeStatement statement in code.Statements) { + CodeExpressionStatement ces = statement as CodeExpressionStatement; + if (ces != null) { + CodeMethodInvokeExpression cmie = ces.Expression as CodeMethodInvokeExpression; + if (cmie != null && cmie.Parameters.Count == 1) { + CodeArrayCreateExpression cace = cmie.Parameters[0] as CodeArrayCreateExpression; + if (cace != null) { + IReturnType rt = ResolveType(cmie.Method.TargetObject, variables); + if (rt != null) { + foreach (IMethod m in rt.GetMethods()) { + if (m.Name == cmie.Method.MethodName + && m.Parameters.Count == 1 + && m.Parameters[0].IsParams + && m.Parameters[0].ReturnType.ArrayDimensions == 1 + && m.Parameters[0].ReturnType.ArrayElementType.FullyQualifiedName == cace.CreateType.BaseType) + { + cace.UserData["Explode"] = true; + } + } + } + } + } + } + CodeVariableDeclarationStatement cvds = statement as CodeVariableDeclarationStatement; + if (cvds != null) { + variables[cvds.Name] = new SearchClassReturnType(formClass.ProjectContent, formClass, formClass.Region.BeginLine + 1, 0, cvds.Type.BaseType, cvds.Type.TypeArguments.Count); + } + } + } + + IReturnType ResolveType(CodeExpression expr, Dictionary variables) + { + IReturnType rt; + if (expr is CodeThisReferenceExpression) { + return variables[""]; + } else if (expr is CodeVariableReferenceExpression) { + string name = (expr as CodeVariableReferenceExpression).VariableName; + if (variables.TryGetValue(name, out rt)) + return rt; + } else if (expr is CodeFieldReferenceExpression) { + string name = (expr as CodeFieldReferenceExpression).FieldName; + rt = ResolveType((expr as CodeFieldReferenceExpression).TargetObject, variables); + if (rt != null) { + foreach (IField f in rt.GetFields()) { + if (f.Name == name) { + return f.ReturnType; + } + } + } + } else if (expr is CodePropertyReferenceExpression) { + string name = (expr as CodePropertyReferenceExpression).PropertyName; + rt = ResolveType((expr as CodePropertyReferenceExpression).TargetObject, variables); + if (rt != null) { + foreach (IProperty p in rt.GetProperties()) { + if (p.Name == name) { + return p.ReturnType; + } + } + } + } + return null; + } + protected override string CreateEventHandler(EventDescriptor edesc, string eventMethodName, string body, string indentation) { if (string.IsNullOrEmpty(body)) body = "pass"; diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/Designer/BooDesignerLoader.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/Designer/BooDesignerLoader.cs index 9e1bc951f6..ea0427a36a 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/Designer/BooDesignerLoader.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/Designer/BooDesignerLoader.cs @@ -198,7 +198,11 @@ namespace Grunwald.BooBinding.Designer protected override void Write(CodeCompileUnit unit) { LoggingService.Info("BooDesignerLoader.Write called"); - generator.MergeFormChanges(unit); + try { + generator.MergeFormChanges(unit); + } catch (Exception ex) { + MessageService.ShowError(ex); + } } } } diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Test/BooBinding.Tests.csproj b/src/AddIns/BackendBindings/Boo/BooBinding/Test/BooBinding.Tests.csproj new file mode 100644 index 0000000000..69233d6392 --- /dev/null +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Test/BooBinding.Tests.csproj @@ -0,0 +1,77 @@ + + + Library + Grunwald.BooBinding.Tests + BooBinding.Tests + Debug + AnyCPU + {6FA16499-896F-4C02-BB43-1AF5C6C7C713} + ..\..\..\..\..\..\bin\UnitTests\ + False + False + False + Auto + 4194304 + AnyCPU + 4096 + 4 + false + + + obj\ + obj\Debug\ + False + DEBUG;TRACE + true + Full + True + + + obj\ + obj\Release\ + True + TRACE + False + None + False + + + + + + + ..\..\..\..\..\Tools\NUnit\nunit.framework.dll + False + + + + + + + + {2748AD25-9C63-4E12-877B-4DCE96FBED54} + ICSharpCode.SharpDevelop + + + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} + ICSharpCode.Core + + + {4AC2D5F1-F671-480C-A075-6BF62B3721B2} + BooBinding + + + log4net.dll + Always + + + ICSharpCode.Core.dll + Always + + + ICSharpCode.SharpDevelop.dll + Always + + + + \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Test/ResolverTests.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Test/ResolverTests.cs new file mode 100644 index 0000000000..81d0f57ab4 --- /dev/null +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Test/ResolverTests.cs @@ -0,0 +1,417 @@ +/* + * Created by SharpDevelop. + * User: Daniel Grunwald + * Date: 23.04.2006 + * Time: 11:33 + */ + +using System; +using System.Reflection; +using NUnit.Framework; +using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Dom; +using ICSharpCode.SharpDevelop.Project; +using Grunwald.BooBinding.CodeCompletion; + +namespace Grunwald.BooBinding.Tests +{ + [TestFixture] + public class ResolverTests + { + #region Helper + T Resolve(string code) where T : ResolveResult + { + return Resolve(code, "/*1*/"); + } + + T Resolve(string code, string marker) where T : ResolveResult + { + return Resolve(normalProg, code, marker); + } + + T Resolve(string prog, string code, string marker) where T : ResolveResult + { + ResolveResult rr = Resolve(prog, new ExpressionResult(code), marker); + Assert.IsNotNull(rr, "Resolve must not return null"); + Assert.IsInstanceOfType(typeof(T), rr, "Resolve must return instance of type " + typeof(T).Name); + return (T)rr; + } + + IProjectContent booLangPC; + + public ResolverTests() { + booLangPC = new ReflectionProjectContent(Assembly.Load("Boo.Lang"), "Boo.Lang.dll"); + booLangPC.ReferencedContents.Add(ProjectContentRegistry.Mscorlib); + } + + const string fileName = "tempFile.boo"; + DefaultProjectContent lastPC; + + void Register(string prog) + { + DefaultProjectContent pc = new DefaultProjectContent(); + lastPC = pc; + ParserService.ForceProjectContent(pc); + pc.ReferencedContents.Add(ProjectContentRegistry.Mscorlib); + pc.ReferencedContents.Add(ProjectContentRegistry.WinForms); + pc.ReferencedContents.Add(booLangPC); + ICompilationUnit cu = new BooParser().Parse(pc, fileName, prog); + ParserService.UpdateParseInformation(cu, fileName, false, false); + cu.Classes.ForEach(pc.AddClassToNamespaceList); + } + + void GetPos(string prog, string marker, out int line, out int column) + { + int index = prog.IndexOf(marker); + line = 1; + column = 0; + for (int i = 0; i < index; i++) { + column++; + if (prog[i]=='\n') { + line++; + column = 0; + } + } + } + + ResolveResult Resolve(string prog, ExpressionResult er, string marker) + { + Register(prog); + int line, column; + GetPos(prog, marker, out line, out column); + + BooResolver r = new BooResolver(); + return r.Resolve(er, line, column, fileName, prog); + } + #endregion + + #region Basic tests + const string normalProg = + "import System\n" + + "def MyMethod(arg as string):\n" + + "\tlocalVar = arg\n" + + "\t/*1*/\n" + + "\tclosure = { e as string | arg.IndexOf(e) /*inClosure*/ }\n" + + "\tindex = closure('.')\n" + + "\t/*2*/\n" + + "\tclosure2 = def(e as DateTime):\n" + + "\t\treturn e.Year\n" + + "\trecursiveClosure = def(myObject):/*inRecursiveClosure*/\n" + + "\t\treturn recursiveClosure(myObject)\n" + + "\t/*3*/\n"; + + [Test] + public void MethodParameter() + { + LocalResolveResult rr = Resolve("arg"); + Assert.IsTrue(rr.IsParameter); + Assert.AreEqual("System.String", rr.ResolvedType.FullyQualifiedName); + } + + [Test] + public void LocalVariable() + { + LocalResolveResult rr = Resolve("localVar"); + Assert.IsFalse(rr.IsParameter); + Assert.AreEqual("System.String", rr.ResolvedType.FullyQualifiedName); + } + + [Test] + public void NullCoalescing() + { + ResolveResult rr = Resolve("localVar or arg"); + Assert.AreEqual("System.String", rr.ResolvedType.FullyQualifiedName); + } + + [Test] + public void InnerClassEnum() + { + TypeResolveResult trr = Resolve("Environment.SpecialFolder"); + Assert.AreEqual("System.Environment.SpecialFolder", trr.ResolvedClass.FullyQualifiedName); + + MemberResolveResult mrr = Resolve("Environment.SpecialFolder.Desktop"); + Assert.AreEqual("System.Environment.SpecialFolder.Desktop", mrr.ResolvedMember.FullyQualifiedName); + } + + [Test] + public void ClosureParameter() + { + LocalResolveResult rr = Resolve("e", "/*inClosure*/"); + Assert.AreEqual("System.String", rr.ResolvedType.FullyQualifiedName); + + Assert.IsNull(Resolve(normalProg, new ExpressionResult("e"), "/*1*/")); + } + + [Test] + public void ClosureCall() + { + LocalResolveResult rr = Resolve("closure('.')", "/*2*/"); + Assert.IsFalse(rr.IsParameter); + Assert.AreEqual("closure", rr.Field.Name); + Assert.AreEqual("System.Int32", rr.ResolvedType.FullyQualifiedName); + } + + [Test] + public void ClosureCall2() + { + LocalResolveResult rr = Resolve("closure2(DateTime.Now)", "/*3*/"); + Assert.IsFalse(rr.IsParameter); + Assert.AreEqual("closure2", rr.Field.Name); + Assert.AreEqual("System.Int32", rr.ResolvedType.FullyQualifiedName); + } + + [Test] + public void RecursiveClosure() + { + // Code-completion cannot work here, test if SharpDevelop is correctly + // preventing the StackOverflow. + LocalResolveResult rr = Resolve("recursiveClosure", "/*3*/"); + Assert.IsFalse(rr.IsParameter); + Assert.AreEqual("delegate(myObject:Object):?", rr.ResolvedType.FullyQualifiedName); + } + + [Test] + public void ClosureTypelessArgument() + { + LocalResolveResult rr = Resolve("myObject", "/*inRecursiveClosure*/"); + Assert.AreEqual("System.Object", rr.ResolvedType.FullyQualifiedName); + } + + [Test] + public void EqualityOperator() + { + ResolveResult rr = Resolve("0 == 0"); + Assert.AreEqual("System.Boolean", rr.ResolvedType.FullyQualifiedName); + rr = Resolve("0 != 1"); + Assert.AreEqual("System.Boolean", rr.ResolvedType.FullyQualifiedName); + rr = Resolve("null is null"); + Assert.AreEqual("System.Boolean", rr.ResolvedType.FullyQualifiedName); + rr = Resolve("object() is not null"); + Assert.AreEqual("System.Boolean", rr.ResolvedType.FullyQualifiedName); + } + + [Test] + public void ClassMethodAmbiguity() + { + string prog = + "class Test:\n" + + "\tdef constructor():\n" + + "\t\tpass\n" + + "class OtherClass:\n" + + "\tdef Test():\n" + + "\t\t/*mark*/\n" + + "\t\tpass\n"; + MemberResolveResult rr = Resolve(prog, "Test()", "/*mark*/"); + Assert.AreEqual("OtherClass.Test", rr.ResolvedMember.FullyQualifiedName); + } + #endregion + + #region Regression + const string regressionProg = + "import System\n" + + "import System.Reflection\n" + + "def MyMethod(arg as string):\n" + + "\tif true:\n" + + "\t\tboo629 = 'hello'\n" + + "\tfor boo640a in [1, 2, 3]:\n" + + "\t\tif boo640b = boo640a as FieldInfo: /*640*/\n" + + "\t\t\tprint boo640b\n" + + "\t\n" + + "\t/*1*/\n"; + + [Test] + public void Boo629VariableScope() + { + LocalResolveResult rr = Resolve(regressionProg, "boo629", "/*1*/"); + Assert.AreEqual("System.String", rr.ResolvedType.FullyQualifiedName); + } + + [Test] + public void Boo640ConditionalAssignment() + { + LocalResolveResult rr = Resolve(regressionProg, "boo640b", "/*1*/"); + Assert.AreEqual("System.Reflection.FieldInfo", rr.ResolvedType.FullyQualifiedName); + rr = Resolve(regressionProg, "boo640a", "/*640*/"); + Assert.AreEqual("System.Object", rr.ResolvedType.FullyQualifiedName); + Assert.IsNull(Resolve(regressionProg, new ExpressionResult("boo640a"), "/*1*/")); + } + + [Test] + public void IndexerRecognition() + { + string prog = + "class Foo:\n" + + "\tself[index as int]:\n" + + "\t\tget:\n" + + "\t\t\treturn true\n" + + "def example():\n" + + "\tfoo = Foo()\n" + + "\tmybool = foo[1] /*mark*/\n" + + "\tprint mybool\n"; + MemberResolveResult rr = Resolve(prog, "foo[1]", "/*mark*/"); + Assert.IsTrue(((IProperty)rr.ResolvedMember).IsIndexer); + Assert.AreEqual("System.Boolean", rr.ResolvedType.FullyQualifiedName); + LocalResolveResult rr2 = Resolve(prog, "mybool", "/*mark*/"); + Assert.AreEqual("System.Boolean", rr2.ResolvedType.FullyQualifiedName); + } + #endregion + + #region Nested Classes + const string nestedClassProg = + "class Outer:\n" + + "\tpublic static outerField = 1\n" + + "\tpublic class Inner:\n/*inner*/" + + "\t\tpublic innerField = 2\n" + + "class Derived(Outer):\n/*derived*/" + + "\tpublic static derivedField = 3\n" + + "def Method():\n" + + "\ti as Outer.Inner\n" + + "\ti2 as Derived.Inner\n" + + "\t/*1*/"; + + [Test] + public void NestedClassTypeResolution() + { + TypeResolveResult trr; + trr = Resolve(nestedClassProg, "Outer.Inner", "/*1*/"); + Assert.AreEqual("Outer.Inner", trr.ResolvedClass.FullyQualifiedName); + trr = Resolve(nestedClassProg, "Inner", "/*inner*/"); + Assert.AreEqual("Outer.Inner", trr.ResolvedClass.FullyQualifiedName); + trr = Resolve(nestedClassProg, "Inner", "/*derived*/"); + Assert.AreEqual("Outer.Inner", trr.ResolvedClass.FullyQualifiedName); + trr = Resolve(nestedClassProg, "Derived.Inner", "/*1*/"); + Assert.AreEqual("Outer.Inner", trr.ResolvedClass.FullyQualifiedName); + } + + [Test] + public void NestedClassCtrlSpace() + { + CtrlSpace(nestedClassProg.Replace("/*inner*/", "/*mark*/"), "outerField", "innerField", "Inner", "Outer", "Derived"); + CtrlSpace(nestedClassProg.Replace("/*derived*/", "/*mark*/"), "outerField", "derivedField", "Inner", "Outer", "Derived"); + } + + [Test] + public void NestedClassParentStaticField() + { + MemberResolveResult mrr = Resolve(nestedClassProg, "outerField", "/*inner*/"); + Assert.AreEqual("Outer.outerField", mrr.ResolvedMember.FullyQualifiedName); + } + + [Test] + public void NestedClassCC() + { + LocalResolveResult rr = Resolve(nestedClassProg, "i", "/*1*/"); + Assert.AreEqual("Outer.Inner", rr.ResolvedType.FullyQualifiedName); + bool ok = false; + foreach (object o in rr.GetCompletionData(lastPC)) { + IMember m = o as IMember; + if (m != null && m.Name == "innerField") + ok = true; + } + Assert.IsTrue(ok); + MemberResolveResult mrr = Resolve(nestedClassProg, "i.innerField", "/*1*/"); + Assert.AreEqual("Outer.Inner.innerField", mrr.ResolvedMember.FullyQualifiedName); + } + + [Test] + public void NestedClassCC2() + { + LocalResolveResult rr = Resolve(nestedClassProg, "i2", "/*1*/"); + Assert.AreEqual("Outer.Inner", rr.ResolvedType.FullyQualifiedName); + bool ok = false; + foreach (object o in rr.GetCompletionData(lastPC)) { + IMember m = o as IMember; + if (m != null && m.Name == "innerField") + ok = true; + } + Assert.IsTrue(ok); + MemberResolveResult mrr = Resolve(nestedClassProg, "i2.innerField", "/*1*/"); + Assert.AreEqual("Outer.Inner.innerField", mrr.ResolvedMember.FullyQualifiedName); + } + #endregion + + #region CtrlSpace + void CtrlSpace(string prog, params string[] expected) + { + CtrlSpace(new string[0], prog, expected); + } + + void CtrlSpace(string[] unExpected, string prog, params string[] expected) + { + Register(prog); + int line, column; + GetPos(prog, "/*mark*/", out line, out column); + BooResolver r = new BooResolver(); + System.Collections.ArrayList ar; + ar = r.CtrlSpace(line, column, fileName, prog, ExpressionContext.Default); + foreach (string e in unExpected) { + foreach (object o in ar) { + if (e.Equals(o)) + Assert.Fail("Didn't expect " + e); + if (o is IMember && (o as IMember).Name == e) { + Assert.Fail("Didn't expect " + e); + } + if (o is IClass && (o as IClass).Name == e) { + Assert.Fail("Didn't expect " + e); + } + } + } + foreach (string e in expected) { + bool ok = false; + foreach (object o in ar) { + if (e.Equals(o)) { + if (ok) Assert.Fail("double entry " + e); + ok = true; + } + if (o is IMember && (o as IMember).Name == e) { + if (ok) Assert.Fail("double entry " + e); + ok = true; + } + if (o is IClass && (o as IClass).Name == e) { + if (ok) Assert.Fail("double entry " + e); + ok = true; + } + } + if (!ok) + Assert.Fail("Expected " + e); + } + } + + [Test] + public void CtrlSpaceScopeExtension() + { + string prog = + "def Foo():\n" + + "\tbar = def():\n" + + "\t\tx = 0\n" + + "\t\t/*mark*/\n"; + CtrlSpace(prog, "bar", "x"); + } + + [Test] + public void DoubleEntryTest() + { + string prog = + "class MyClass:\n" + + "\t_myInt = 0\n" + + "\tdef Foo():\n" + + "\t\t_myInt = 5\n" + + "\t\t/*mark*/\n"; + CtrlSpace(prog, "_myInt"); + } + + [Test] + public void LoopInClosureTest() + { + string prog = + "def Foo():\n" + + "\tfor i in range(5):\n" + + "\t\tbar = def():\n" + + "\t\t\tx = 0\n" + + "\t\t\t/*mark*/\n" + + "\t\t\tprint x"; + CtrlSpace(prog, "x", "bar", "i"); + } + #endregion + } +} diff --git a/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitorExpressions.cs b/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitorExpressions.cs index 2d72123800..5a3f73f267 100644 --- a/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitorExpressions.cs +++ b/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitorExpressions.cs @@ -117,6 +117,10 @@ namespace NRefactoryToBooConverter if (val is double) { return new B.DoubleLiteralExpression(GetLexicalInfo(pe), (double)val, false); } + if (val is decimal) { + AddWarning(pe, "Converting decimal literal to double literal"); + return new B.DoubleLiteralExpression(GetLexicalInfo(pe), (double)(decimal)val); + } AddError(pe, "Unknown primitive literal of type " + val.GetType().FullName); return null; } @@ -520,14 +524,14 @@ namespace NRefactoryToBooConverter { AddError(checkedExpression, "Using 'checked' inside an expression is not supported by boo, " + "use the checked {} block instead."); - return null; + return MakeMethodCall("checked", ConvertExpression(checkedExpression.Expression)); } public object Visit(UncheckedExpression uncheckedExpression, object data) { AddError(uncheckedExpression, "Using 'unchecked' inside an expression is not supported by boo, " + "use the unchecked {} block instead."); - return null; + return MakeMethodCall("unchecked", ConvertExpression(uncheckedExpression.Expression)); } } } diff --git a/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/NRefactoryToBooConverter.csproj b/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/NRefactoryToBooConverter.csproj index 53ae278e3c..615b80d515 100644 --- a/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/NRefactoryToBooConverter.csproj +++ b/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/NRefactoryToBooConverter.csproj @@ -6,6 +6,16 @@ Debug AnyCPU {DBCF20A1-BA13-4582-BFA9-74DE4D987B73} + False + False + False + False + Auto + 105906176 + AnyCPU + 4096 + 4 + false bin\Debug\ @@ -17,6 +27,14 @@ true TRACE + + Full + true + + + None + false + diff --git a/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/MemberTests.cs b/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/MemberTests.cs index 3d1106486c..30d8e0834e 100644 --- a/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/MemberTests.cs +++ b/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/MemberTests.cs @@ -134,6 +134,18 @@ namespace NRefactoryToBooConverter.Tests TestInClass("public static void Run() {}", "public static def Run() as System.Void:\n\tpass"); } + [Test] + public void AbstractMethod() + { + TestInClass("public abstract void Run();", "public abstract def Run() as System.Void:\n\tpass"); + } + + [Test] + public void AbstractMethodInInterface() + { + TestInInterface("void Run();", "def Run() as System.Void"); + } + [Test] public void StaticMethodInStaticClass() { @@ -214,6 +226,18 @@ namespace NRefactoryToBooConverter.Tests "[AA]\npublic Text as System.String:\n\t[BB]\n\tget:\n\t\tpass\n\t[CC]\n\tset:\n\t\tpass"); } + [Test] + public void AbstractProperty() + { + TestInClass("public abstract string Prop { get; }", "public abstract Prop as System.String:\n\tget:\n\t\tpass"); + } + + [Test] + public void AbstractPropertyInInterface() + { + TestInInterface("string Prop { get; }", "Prop as System.String:\n\tget"); + } + [Test] public void ReadOnlyIndexer() { @@ -251,6 +275,12 @@ namespace NRefactoryToBooConverter.Tests TestInClass("[LookHere] event EventHandler Closed;", "[LookHere]\nprivate event Closed as EventHandler"); } + [Test] + public void EventInInterface() + { + TestInInterface("event EventHandler Closed;", "event Closed as EventHandler"); + } + [Test] public void PInvoke() { diff --git a/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/TestHelper.cs b/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/TestHelper.cs index 652bd915ab..3835c0c4a3 100644 --- a/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/TestHelper.cs +++ b/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/TestHelper.cs @@ -65,6 +65,11 @@ namespace NRefactoryToBooConverter.Tests Assert.AreEqual(output.Replace("??", ConverterSettings.DefaultNameGenerationPrefix), ConvertVB(input)); } + protected void TestInInterface(string input, string output) + { + Test("public interface ClassName {\n" + input + "\n}", "public interface ClassName:\n\t" + output.Replace("\n", "\n\t")); + } + protected void TestInClass(string input, string output) { Test("public class ClassName {\n" + input + "\n}", "public class ClassName:\n\t" + output.Replace("\n", "\n\t")); diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj index dad8c8d753..7a31a85521 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj @@ -12,9 +12,17 @@ OnSuccessfulBuild Library File + False + False + Auto + 103284736 + AnyCPU + 4096 + 4 + false - True + true Full False True diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpAmbience.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpAmbience.cs index 01f78e2b27..8de64ec886 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpAmbience.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpAmbience.cs @@ -303,6 +303,14 @@ namespace ICSharpCode.Core } if (property.IsIndexer) { + if (property.DeclaringType != null) { + if (UseFullyQualifiedMemberNames) { + builder.Append(property.DeclaringType.FullyQualifiedName); + } else { + builder.Append(property.DeclaringType.Name); + } + builder.Append('.'); + } builder.Append("this"); } else { if (IncludeHTMLMarkup) { diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs index 704865e096..c2ecc02e16 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs @@ -231,71 +231,63 @@ namespace CSharpBinding.FormattingStrategy return false; } - - - bool IsBeforeRegion(TextArea textArea, DomRegion region, int lineNr) - { - if (region.IsEmpty) { - return false; - } - return region.BeginLine - 2 <= lineNr && lineNr <= region.BeginLine; - } - - object GetClassMember(TextArea textArea, int lineNr, IClass c) - { - if (IsBeforeRegion(textArea, c.Region, lineNr)) { - return c; - } - - foreach (IClass inner in c.InnerClasses) { - object o = GetClassMember(textArea, lineNr, inner); - if (o != null) { - return o; - } - } - - foreach (IField f in c.Fields) { - if (IsBeforeRegion(textArea, f.Region, lineNr)) { - return f; - } - } - foreach (IProperty p in c.Properties) { - if (IsBeforeRegion(textArea, p.Region, lineNr)) { - return p; - } - } - foreach (IEvent e in c.Events) { - if (IsBeforeRegion(textArea, e.Region, lineNr)) { - return e; - } - } - foreach (IMethod m in c.Methods) { - if (IsBeforeRegion(textArea, m.Region, lineNr)) { - return m; - } - } - return null; - } - - object GetMember(TextArea textArea, int lineNr) + /// + /// Gets the next member after the specified caret position. + /// + object GetMemberAfter(TextArea textArea, int caretLine) { string fileName = textArea.MotherTextEditorControl.FileName; + object nextElement = null; if (fileName != null && fileName.Length > 0 ) { - string fullPath = Path.GetFullPath(fileName); - ParseInformation parseInfo = ParserService.GetParseInformation(fullPath); + ParseInformation parseInfo = ParserService.ParseFile(fileName, textArea.Document.TextContent); if (parseInfo != null) { - ICompilationUnit currentCompilationUnit = (ICompilationUnit)parseInfo.BestCompilationUnit; + ICompilationUnit currentCompilationUnit = parseInfo.BestCompilationUnit; if (currentCompilationUnit != null) { - foreach (IClass c in currentCompilationUnit.Classes) { - object o = GetClassMember(textArea, lineNr, c); - if (o != null) { - return o; + IClass currentClass = currentCompilationUnit.GetInnermostClass(caretLine, 0); + int nextElementLine = int.MaxValue; + if (currentClass == null) { + foreach (IClass c in currentCompilationUnit.Classes) { + if (c.Region.BeginLine < nextElementLine && c.Region.BeginLine > caretLine) { + nextElementLine = c.Region.BeginLine; + nextElement = c; + } + } + } else { + foreach (IClass c in currentClass.InnerClasses) { + if (c.Region.BeginLine < nextElementLine && c.Region.BeginLine > caretLine) { + nextElementLine = c.Region.BeginLine; + nextElement = c; + } + } + foreach (IMember m in currentClass.Methods) { + if (m.Region.BeginLine < nextElementLine && m.Region.BeginLine > caretLine) { + nextElementLine = m.Region.BeginLine; + nextElement = m; + } + } + foreach (IMember m in currentClass.Properties) { + if (m.Region.BeginLine < nextElementLine && m.Region.BeginLine > caretLine) { + nextElementLine = m.Region.BeginLine; + nextElement = m; + } + } + foreach (IMember m in currentClass.Fields) { + if (m.Region.BeginLine < nextElementLine && m.Region.BeginLine > caretLine) { + nextElementLine = m.Region.BeginLine; + nextElement = m; + } + } + foreach (IMember m in currentClass.Events) { + if (m.Region.BeginLine < nextElementLine && m.Region.BeginLine > caretLine) { + nextElementLine = m.Region.BeginLine; + nextElement = m; + } } } } } } - return null; + return nextElement; } #endregion @@ -327,7 +319,7 @@ namespace CSharpBinding.FormattingStrategy string lineAboveText = lineAbove == null ? "" : textArea.Document.GetText(lineAbove); if (curLineText != null && curLineText.EndsWith("///") && (lineAboveText == null || !lineAboveText.Trim().StartsWith("///"))) { string indentation = base.GetIndentation(textArea, lineNr); - object member = GetMember(textArea, lineNr); + object member = GetMemberAfter(textArea, lineNr); if (member != null) { StringBuilder sb = new StringBuilder(); sb.Append(" \n"); diff --git a/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmBinding.csproj b/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmBinding.csproj index 49678f73b0..10d8c18999 100644 --- a/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmBinding.csproj +++ b/src/AddIns/BackendBindings/ILAsmBinding/Project/ILAsmBinding.csproj @@ -13,13 +13,20 @@ False OnSuccessfulBuild Library + False + False + Auto + 104333312 + AnyCPU + 4096 + false - True + true False True ..\..\..\..\..\AddIns\AddIns\BackendBindings\ILAsmBinding\ - full + Full False diff --git a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs index 0b62113a8d..7e91d273ca 100644 --- a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs +++ b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs @@ -269,7 +269,7 @@ namespace VBNetBinding.FormattingStrategy if (curLineText != null && curLineText.EndsWith("'''") && (lineAboveText == null || !lineAboveText.Trim().StartsWith("'''"))) { string indentation = base.GetIndentation(textArea, lineNr); - object member = GetMember(textArea, lineNr); + object member = GetMemberAfter(textArea, lineNr); if (member != null) { StringBuilder sb = new StringBuilder(); sb.Append(" \n"); @@ -446,69 +446,63 @@ namespace VBNetBinding.FormattingStrategy return false; } - object GetMember(TextArea textArea, int lineNr) + /// + /// Gets the next member after the specified caret position. + /// + object GetMemberAfter(TextArea textArea, int caretLine) { string fileName = textArea.MotherTextEditorControl.FileName; + object nextElement = null; if (fileName != null && fileName.Length > 0 ) { - string fullPath = Path.GetFullPath(fileName); - ParseInformation parseInfo = ParserService.GetParseInformation(fullPath); + ParseInformation parseInfo = ParserService.ParseFile(fileName, textArea.Document.TextContent); if (parseInfo != null) { - ICompilationUnit currentCompilationUnit = (ICompilationUnit)parseInfo.BestCompilationUnit; + ICompilationUnit currentCompilationUnit = parseInfo.BestCompilationUnit; if (currentCompilationUnit != null) { - foreach (IClass c in currentCompilationUnit.Classes) { - object o = GetClassMember(textArea, lineNr, c); - if (o != null) { - return o; + IClass currentClass = currentCompilationUnit.GetInnermostClass(caretLine, 0); + int nextElementLine = int.MaxValue; + if (currentClass == null) { + foreach (IClass c in currentCompilationUnit.Classes) { + if (c.Region.BeginLine < nextElementLine && c.Region.BeginLine > caretLine) { + nextElementLine = c.Region.BeginLine; + nextElement = c; + } + } + } else { + foreach (IClass c in currentClass.InnerClasses) { + if (c.Region.BeginLine < nextElementLine && c.Region.BeginLine > caretLine) { + nextElementLine = c.Region.BeginLine; + nextElement = c; + } + } + foreach (IMember m in currentClass.Methods) { + if (m.Region.BeginLine < nextElementLine && m.Region.BeginLine > caretLine) { + nextElementLine = m.Region.BeginLine; + nextElement = m; + } + } + foreach (IMember m in currentClass.Properties) { + if (m.Region.BeginLine < nextElementLine && m.Region.BeginLine > caretLine) { + nextElementLine = m.Region.BeginLine; + nextElement = m; + } + } + foreach (IMember m in currentClass.Fields) { + if (m.Region.BeginLine < nextElementLine && m.Region.BeginLine > caretLine) { + nextElementLine = m.Region.BeginLine; + nextElement = m; + } + } + foreach (IMember m in currentClass.Events) { + if (m.Region.BeginLine < nextElementLine && m.Region.BeginLine > caretLine) { + nextElementLine = m.Region.BeginLine; + nextElement = m; + } } } } } } - return null; - } - - object GetClassMember(TextArea textArea, int lineNr, IClass c) - { - if (IsBeforeRegion(textArea, c.Region, lineNr)) { - return c; - } - - foreach (IClass inner in c.InnerClasses) { - object o = GetClassMember(textArea, lineNr, inner); - if (o != null) { - return o; - } - } - - foreach (IField f in c.Fields) { - if (IsBeforeRegion(textArea, f.Region, lineNr)) { - return f; - } - } - foreach (IProperty p in c.Properties) { - if (IsBeforeRegion(textArea, p.Region, lineNr)) { - return p; - } - } - foreach (IEvent e in c.Events) { - if (IsBeforeRegion(textArea, e.Region, lineNr)) { - return e; - } - } - foreach (IMethod m in c.Methods) { - if (IsBeforeRegion(textArea, m.Region, lineNr)) { - return m; - } - } - return null; - } - - bool IsBeforeRegion(TextArea textArea, DomRegion region, int lineNr) - { - if (region.IsEmpty) { - return false; - } - return region.BeginLine - 2 <= lineNr && lineNr <= region.BeginLine; + return nextElement; } bool IsInString(string start) diff --git a/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj b/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj index bbb5f81429..a51f65561a 100644 --- a/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj +++ b/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj @@ -13,13 +13,20 @@ OnSuccessfulBuild Library File + False + False + Auto + 104857600 + AnyCPU + 4096 - True + true False True ..\..\..\..\..\AddIns\AddIns\BackendBindings\VBNetBinding\ - False + false + Full False diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.csproj b/src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.csproj index c477ffd491..bb0fb67899 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.csproj +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.csproj @@ -21,7 +21,7 @@ False ..\..\..\..\..\AddIns\AddIns\DisplayBindings\FormsDesigner\ true - 4194304 + 108003328 4096 diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs index 20adfd29d6..a75009f4a5 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs @@ -136,6 +136,10 @@ namespace ICSharpCode.FormsDesigner protected abstract DomRegion GetReplaceRegion(ICSharpCode.TextEditor.Document.IDocument document, IMethod method); + protected virtual void FixGeneratedCode(IClass formClass, CodeMemberMethod code) + { + } + public virtual void MergeFormChanges(CodeCompileUnit unit) { Reparse(); @@ -158,6 +162,10 @@ namespace ICSharpCode.FormsDesigner if (formClass == null || initializeComponent == null) { throw new InvalidOperationException("InitializeComponent method not found in framework-generated CodeDom."); } + if (this.formClass == null) { + MessageService.ShowMessage("Cannot save form: InitializeComponent method does not exist anymore. You should not modify the Designer.cs file while editing a form."); + return; + } if (formClass.Name != this.formClass.Name) { LoggingService.Info("Renaming form to " + formClass.Name); @@ -165,6 +173,8 @@ namespace ICSharpCode.FormsDesigner Reparse(); } + FixGeneratedCode(this.formClass, initializeComponent); + // generate file and get initialize components string StringWriter writer = new StringWriter(); CodeDOMGenerator domGenerator = new CodeDOMGenerator(this.CodeDomProvider, tabs + '\t'); diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/NRefactoryDesignerLoader.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/NRefactoryDesignerLoader.cs index 715e5c1771..fc267c122a 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/NRefactoryDesignerLoader.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/NRefactoryDesignerLoader.cs @@ -329,7 +329,11 @@ namespace ICSharpCode.FormsDesigner this.CodeDomProvider.GenerateCodeFromCompileUnit(unit, Console.Out, null); } #endif - generator.MergeFormChanges(unit); + try { + generator.MergeFormChanges(unit); + } catch (Exception ex) { + MessageService.ShowError(ex); + } } // public void Reload() diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs index a15504addc..fada2cbcce 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs @@ -17,6 +17,7 @@ using ICSharpCode.SharpDevelop.Project; using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.Core; using System.Diagnostics; +using Microsoft.Win32; namespace ICSharpCode.FormsDesigner.Services { @@ -130,6 +131,11 @@ namespace ICSharpCode.FormsDesigner.Services } } + static string GetHash(string fileName) + { + return Path.GetFileName(fileName).ToLowerInvariant() + File.GetLastWriteTimeUtc(fileName).Ticks.ToString(); + } + /// /// Loads the file in none-locking mode. Returns null on failure. /// @@ -137,7 +143,16 @@ namespace ICSharpCode.FormsDesigner.Services { if (!File.Exists(fileName)) return null; - string hash = Path.GetFileName(fileName) + File.GetLastWriteTimeUtc(fileName).Ticks.ToString(); + + // FIX for SD2-716, remove when designer gets its own AppDomain + foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) { + if (string.Equals(asm.Location, fileName, StringComparison.InvariantCultureIgnoreCase)) { + RegisterAssembly(asm); + return asm; + } + } + + string hash = GetHash(fileName); lock (assemblyDict) { Assembly asm; if (assemblyDict.TryGetValue(hash, out asm)) @@ -213,6 +228,20 @@ namespace ICSharpCode.FormsDesigner.Services } } + public static void RegisterAssembly(Assembly asm) + { + string file = asm.Location; + if (file.Length > 0) { + lock (assemblyDict) { + assemblyDict[GetHash(file)] = asm; + } + } + lock (designerAssemblies) { + if (!designerAssemblies.Contains(asm)) + designerAssemblies.Insert(0, asm); + } + } + public Assembly GetAssembly(AssemblyName name) { return LoadAssembly(name, false); @@ -227,10 +256,7 @@ namespace ICSharpCode.FormsDesigner.Services { try { Assembly asm = Assembly.Load(name); - lock (designerAssemblies) { - if (!designerAssemblies.Contains(asm)) - designerAssemblies.Insert(0, asm); - } + RegisterAssembly(asm); return asm; } catch (System.IO.FileLoadException) { if (throwOnError) @@ -266,6 +292,11 @@ namespace ICSharpCode.FormsDesigner.Services if (IgnoreType(name)) { return null; } + #if DEBUG + if (!name.StartsWith("System.")) { + LoggingService.Debug("TypeResolutionService: Looking for " + name); + } + #endif try { Type type = Type.GetType(name, false, ignoreCase); @@ -334,6 +365,7 @@ namespace ICSharpCode.FormsDesigner.Services ICSharpCode.Core.LoggingService.Warn("TODO: Add Assembly reference : " + name); } + #region VSDesigner workarounds /// /// HACK - Ignore any requests for types from the Microsoft.VSDesigner /// assembly. There are smart tag problems if data adapter @@ -352,8 +384,38 @@ namespace ICSharpCode.FormsDesigner.Services return false; } + static string vsDesignerIdeDir; + + static void RegisterVSDesignerWorkaround() + { + if (vsDesignerIdeDir == null) { + vsDesignerIdeDir = ""; + RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS"); + if (key != null) { + vsDesignerIdeDir = key.GetValue("VS7CommonDir") as string ?? ""; + if (vsDesignerIdeDir.Length > 0) { + vsDesignerIdeDir = Path.Combine(vsDesignerIdeDir, "IDE"); + AppDomain.CurrentDomain.AssemblyResolve += delegate(object sender, ResolveEventArgs args) { + string shortName = args.Name; + if (shortName.IndexOf(',') >= 0) { + shortName = shortName.Substring(0, shortName.IndexOf(',')); + } + if (shortName.StartsWith("Microsoft.") + && File.Exists(Path.Combine(vsDesignerIdeDir, shortName + ".dll"))) + { + return Assembly.LoadFrom(Path.Combine(vsDesignerIdeDir, shortName + ".dll")); + } + return null; + }; + } + } + } + } + #endregion + public static void AddAssemblyResolver() { + RegisterVSDesignerWorkaround(); AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolveEventHandler; } diff --git a/src/AddIns/DisplayBindings/ResourceEditor/Project/ResourceEditor.csproj b/src/AddIns/DisplayBindings/ResourceEditor/Project/ResourceEditor.csproj index 6503c9ce63..5a32b7de98 100644 --- a/src/AddIns/DisplayBindings/ResourceEditor/Project/ResourceEditor.csproj +++ b/src/AddIns/DisplayBindings/ResourceEditor/Project/ResourceEditor.csproj @@ -12,13 +12,22 @@ Library File ResourceEditor + False + False + Auto + 109576192 + AnyCPU + 4096 + 4 + false - True + true False True ..\..\..\..\..\AddIns\AddIns\DisplayBindings\ResourceEditor\ DEBUG + Full False diff --git a/src/AddIns/DisplayBindings/ResourceEditor/Project/Src/ResourceEdit/ResourceList.cs b/src/AddIns/DisplayBindings/ResourceEditor/Project/Src/ResourceEdit/ResourceList.cs index 05d3df2320..3b2152d020 100644 --- a/src/AddIns/DisplayBindings/ResourceEditor/Project/Src/ResourceEdit/ResourceList.cs +++ b/src/AddIns/DisplayBindings/ResourceEditor/Project/Src/ResourceEdit/ResourceList.cs @@ -120,10 +120,10 @@ namespace ResourceEditor public void LoadFile(string filename) { - Stream s = File.OpenRead(filename); switch (Path.GetExtension(filename).ToLowerInvariant()) { case ".resx": - ResXResourceReader rx = new ResXResourceReader(s); + ResXResourceReader rx = new ResXResourceReader(filename); + rx.BasePath = Path.GetDirectoryName(filename); IDictionaryEnumerator n = rx.GetEnumerator(); while (n.MoveNext()) if (!resources.ContainsKey(n.Key.ToString())) @@ -135,7 +135,7 @@ namespace ResourceEditor //// new file will fail here - so we have to ignore exception(s) ResourceReader rr=null; try { - rr = new ResourceReader(s); + rr = new ResourceReader(filename); foreach (DictionaryEntry entry in rr) { if (!resources.ContainsKey(entry.Key.ToString())) resources.Add(entry.Key.ToString(), new ResourceItem(entry.Key.ToString(), entry.Value)); @@ -149,7 +149,6 @@ namespace ResourceEditor } break; } - s.Close(); InitializeListView(); } diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs index 125dc3b814..38e37bb182 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs @@ -794,8 +794,9 @@ namespace ICSharpCode.XmlEditor XmlSchemaSequence sequence = complexType.Particle as XmlSchemaSequence; XmlSchemaChoice choice = complexType.Particle as XmlSchemaChoice; XmlSchemaGroupRef groupRef = complexType.Particle as XmlSchemaGroupRef; + XmlSchemaAll all = complexType.Particle as XmlSchemaAll; XmlSchemaComplexContent complexContent = complexType.ContentModel as XmlSchemaComplexContent; - + if (sequence != null) { matchedElement = FindElement(sequence.Items, name); } else if (choice != null) { @@ -810,6 +811,8 @@ namespace ICSharpCode.XmlEditor } } else if (groupRef != null) { matchedElement = FindElement(groupRef, name); + } else if (all != null) { + matchedElement = FindElement(all.Items, name); } return matchedElement; diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj b/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj index 2bf8777760..233edbaaf0 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj @@ -16,7 +16,7 @@ ..\..\..\..\..\bin\SharpDevelop.exe False Auto - 4194304 + 110100480 AnyCPU 4096 0618 diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/AllElementTestFixture.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/AllElementTestFixture.cs index 4daecf18ea..0fb2ec2593 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/AllElementTestFixture.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/AllElementTestFixture.cs @@ -21,13 +21,18 @@ namespace XmlEditor.Tests.Schema public class AllElementTestFixture : SchemaTestFixtureBase { ICompletionData[] personElementChildren; + ICompletionData[] firstNameAttributes; + ICompletionData[] firstNameElementChildren; public override void FixtureInit() { XmlElementPath path = new XmlElementPath(); path.Elements.Add(new QualifiedName("person", "http://foo")); - personElementChildren = SchemaCompletionData.GetChildElementCompletionData(path); + + path.Elements.Add(new QualifiedName("firstname", "http://foo")); + firstNameAttributes = SchemaCompletionData.GetAttributeCompletionData(path); + firstNameElementChildren = SchemaCompletionData.GetChildElementCompletionData(path); } [Test] @@ -37,13 +42,34 @@ namespace XmlEditor.Tests.Schema "Should be 2 child elements."); } + [Test] + public void FirstNameElementHasAttribute() + { + Assert.AreEqual(1, firstNameAttributes.Length, "Should have one attribute."); + } + + [Test] + public void FirstNameElementHasChildren() + { + Assert.AreEqual(2, firstNameElementChildren.Length, + "Should be 2 child elements."); + } + protected override string GetSchema() { return "\r\n" + " \r\n" + " \r\n" + " \r\n" + - " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + " \r\n" + " \r\n" + " \r\n" + diff --git a/src/AddIns/Misc/AddInManager/Project/AddInManager.csproj b/src/AddIns/Misc/AddInManager/Project/AddInManager.csproj index 2ee55ae9aa..e0b21df5d6 100644 --- a/src/AddIns/Misc/AddInManager/Project/AddInManager.csproj +++ b/src/AddIns/Misc/AddInManager/Project/AddInManager.csproj @@ -10,7 +10,7 @@ False False Auto - 4194304 + 111149056 AnyCPU 4096 4 diff --git a/src/AddIns/Misc/AddinScout/Project/AddinScout.csproj b/src/AddIns/Misc/AddinScout/Project/AddinScout.csproj index 70f0774e83..4db814a53a 100644 --- a/src/AddIns/Misc/AddinScout/Project/AddinScout.csproj +++ b/src/AddIns/Misc/AddinScout/Project/AddinScout.csproj @@ -13,12 +13,21 @@ False OnSuccessfulBuild Library + False + False + False + Auto + 111673344 + AnyCPU + 4096 + false - True + true False DEBUG ..\..\..\..\..\AddIns\AddIns\Misc\AddinScout\ + Full False diff --git a/src/AddIns/Misc/CodeCoverage/Project/CodeCoverage.csproj b/src/AddIns/Misc/CodeCoverage/Project/CodeCoverage.csproj index 2137ab03c8..7bd48d9445 100644 --- a/src/AddIns/Misc/CodeCoverage/Project/CodeCoverage.csproj +++ b/src/AddIns/Misc/CodeCoverage/Project/CodeCoverage.csproj @@ -10,7 +10,7 @@ False False Auto - 4194304 + 112197632 AnyCPU 4096 4 diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj index 03a5799278..492ef5dd6a 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj @@ -9,10 +9,19 @@ Debugger.AddIn Debugger.AddIn 4 + False + False + False + False + Auto + 116916224 + AnyCPU + 4096 + false true - full + Full false ..\..\..\..\..\..\AddIns\AddIns\Misc\Debugger\ DEBUG;TRACE diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs index 7b656faf94..d8153b1548 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs @@ -217,6 +217,7 @@ namespace ICSharpCode.SharpDevelop.Services DynamicTreeRow MakeSubMenu(string name, params IEnumerable[] elements) { DynamicTreeRow rootRow = new DynamicTreeRow(); + rootRow.ShowMinusWhileExpanded = true; DebuggerGridControl.AddColumns(rootRow.ChildColumns); rootRow[2].Text = name; foreach(IEnumerable rows in elements) { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj index 3c1b14aafe..2251cf2463 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj @@ -13,7 +13,7 @@ False False Auto - 4194304 + 114294784 AnyCPU 4096 4 @@ -21,11 +21,12 @@ true - full + Full 108 ..\..\..\..\..\..\AddIns\AddIns\Misc\Debugger\ DEBUG;TRACE True + False PdbOnly diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs index 59da4b3a09..258ac93ff5 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs @@ -42,7 +42,7 @@ namespace Debugger public string Name { get { - return methodProps.Name; + return methodProps.Name; // + "(" + chainIndex.ToString() + ", " + frameIndex.ToString() + ")"; } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs index 1d6aaf26cc..b27dc2ca2c 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs @@ -158,7 +158,7 @@ namespace Debugger function = null; ilOffset = 0; - Module module = null; + Module module = null; ISymUnmanagedReader symReader = null; ISymUnmanagedDocument symDoc = null; @@ -206,7 +206,11 @@ namespace Debugger } ISymUnmanagedMethod symMethod; - symMethod = symReader.GetMethodFromDocumentPosition(symDoc, validLine, (uint)StartColumn); + try { + symMethod = symReader.GetMethodFromDocumentPosition(symDoc, (uint)StartLine, (uint)StartColumn); + } catch { + return false; //Not found + } function = module.CorModule.GetFunctionFromToken(symMethod.Token); diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs index 460a89cef1..efe77284a2 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs @@ -249,8 +249,11 @@ namespace Debugger return corFrameEnum.Next(); } + // NOTE: During evlulation some chains may be temporaly removed internal void CheckExpirationOfFunctions() { + if (debugger.Evaluating) return; + ICorDebugChainEnum corChainEnum = corThread.EnumerateChains(); uint maxChainIndex = corChainEnum.Count - 1; diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ClassVariable.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ClassVariable.cs index 80498f04c9..8a9e248ec4 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ClassVariable.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ClassVariable.cs @@ -11,8 +11,8 @@ namespace Debugger { public class ClassVariable: Variable { - bool isStatic; - bool isPublic; + internal bool isStatic; + internal bool isPublic; public bool IsStatic { get { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectValue.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectValue.cs index 71c8d0daa2..b16044cdf3 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectValue.cs @@ -155,7 +155,7 @@ namespace Debugger { foreach(MethodProps m in Methods) { MethodProps method = m; // One per scope/delegate - if (method.Name.StartsWith("get_") && method.HasSpecialName) { + if (method.HasSpecialName && method.Name.StartsWith("get_") && method.Name != "get_Item") { yield return new PropertyVariable(debugger, method.Name.Remove(0, 4), method.IsStatic, @@ -182,7 +182,7 @@ namespace Debugger ICorDebugValue[] GetArgsForEval(MethodProps method, ValueGetter getter) { - ObjectValue updatedVal = (ObjectValue)getter(); + ObjectValue updatedVal = getter() as ObjectValue; if (this.IsEquivalentValue(updatedVal)) { if (method.IsStatic) { return new ICorDebugValue[] {}; diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs index d643f57dc8..69e44af273 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs @@ -19,7 +19,8 @@ namespace Debugger ICorDebugValue corValue; // ICorDebugHandleValue can be used to get corValue back after Continue() protected ICorDebugHandleValue corHandleValue; - object pauseSessionAtCreation; + PauseSession pauseSessionAtCreation; + DebugeeState debugeeStateAtCreation; public event EventHandler ValueChanged; @@ -31,6 +32,8 @@ namespace Debugger internal ICorDebugValue CorValue { get { + if (this.IsExpired) throw new DebuggerException("CorValue has expired"); + if (pauseSessionAtCreation == debugger.PauseSession) { return corValue; } else { @@ -47,6 +50,8 @@ namespace Debugger protected ICorDebugHandleValue SoftReference { get { + if (this.IsExpired) throw new DebuggerException("CorValue has expired"); + if (corHandleValue != null) return corHandleValue; ICorDebugHeapValue2 heapValue = this.CorValue.As(); @@ -66,7 +71,7 @@ namespace Debugger if (corHandleValue == null) { return pauseSessionAtCreation != debugger.PauseSession; } else { - return false; + return debugeeStateAtCreation != debugger.DebugeeState; } } } @@ -139,6 +144,7 @@ namespace Debugger this.corValue = DereferenceUnbox(corValue); } this.pauseSessionAtCreation = debugger.PauseSession; + this.debugeeStateAtCreation = debugger.DebugeeState; } public override string ToString() diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs index 76a1428912..f8a30f20b7 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs @@ -23,8 +23,8 @@ namespace Debugger string name; VariableCollection subVariables; - protected ValueGetter valueGetter; - Value cachedValue; + internal protected ValueGetter valueGetter; + internal Value cachedValue; event EventHandler valueChanged; public event EventHandler ValueRemovedFromCollection; @@ -89,7 +89,7 @@ namespace Debugger } } - protected virtual void OnValueChanged() + protected internal virtual void OnValueChanged() { cachedValue = null; if (valueChanged != null) { @@ -120,6 +120,13 @@ namespace Debugger this.valueGetter = valueGetter; this.subVariables = new VariableCollection(debugger); this.subVariables.Updating += OnSubVariablesUpdating; + + if (name.StartsWith("<") && name.Contains(">") && name != "") { + string middle = name.TrimStart('<').Split('>')[0]; // Get text between '<' and '>' + if (middle != "") { + this.name = middle; + } + } } void OnSubVariablesUpdating(object sender, VariableCollectionEventArgs e) diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs index 07f1b6694f..bdd917577c 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs @@ -144,6 +144,17 @@ namespace Debugger foreach(Variable newVariable in newVariables) { if (this.Contains(newVariable.Name)) { + Variable oldVariable = this[newVariable.Name]; + // HACK: Realy bad object-oriented design!!! + // Trasfer the new variable into the old one + if (oldVariable != newVariable) { + oldVariable.valueGetter = newVariable.valueGetter; + oldVariable.cachedValue = null; + if (newVariable is ClassVariable && oldVariable is ClassVariable) { + ((ClassVariable)oldVariable).isPublic = ((ClassVariable)oldVariable).isPublic; + ((ClassVariable)oldVariable).isStatic = ((ClassVariable)oldVariable).isStatic; + } + } // Keep the variable in the list toBeRemoved.Remove(this[newVariable.Name]); } else { diff --git a/src/AddIns/Misc/Debugger/TreeListView/Project/TreeListView.csproj b/src/AddIns/Misc/Debugger/TreeListView/Project/TreeListView.csproj index ca573e9888..dd05ded1b2 100644 --- a/src/AddIns/Misc/Debugger/TreeListView/Project/TreeListView.csproj +++ b/src/AddIns/Misc/Debugger/TreeListView/Project/TreeListView.csproj @@ -9,10 +9,18 @@ TreeListView TreeListView 4 + False + False + False + Auto + 112721920 + AnyCPU + 4096 + false true - full + Full false ..\..\..\..\..\..\AddIns\AddIns\Misc\Debugger\ DEBUG;TRACE diff --git a/src/AddIns/Misc/FiletypeRegisterer/Project/FiletypeRegisterer.csproj b/src/AddIns/Misc/FiletypeRegisterer/Project/FiletypeRegisterer.csproj index 9938deb508..8aa8eed4ef 100644 --- a/src/AddIns/Misc/FiletypeRegisterer/Project/FiletypeRegisterer.csproj +++ b/src/AddIns/Misc/FiletypeRegisterer/Project/FiletypeRegisterer.csproj @@ -13,12 +13,21 @@ OnSuccessfulBuild Library ICSharpCode.FiletypeRegisterer + False + False + False + Auto + 117440512 + AnyCPU + 4096 + false - True + true False ..\..\..\..\..\AddIns\AddIns\Misc\FiletypeRegisterer\ DEBUG + Full False diff --git a/src/AddIns/Misc/HighlightingEditor/Project/HighlightingEditor.csproj b/src/AddIns/Misc/HighlightingEditor/Project/HighlightingEditor.csproj index 6101704ac0..edd01f4d9a 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/HighlightingEditor.csproj +++ b/src/AddIns/Misc/HighlightingEditor/Project/HighlightingEditor.csproj @@ -12,15 +12,21 @@ False OnSuccessfulBuild Library + False + Auto + 117964800 + AnyCPU + 4096 - True + true False False True ..\..\..\..\..\AddIns\AddIns\Misc\HighlightingEditor\ - False + false DEBUG + Full False diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingPanel.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingPanel.cs index 025a9a3f2f..98cc83ff9c 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingPanel.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingPanel.cs @@ -190,8 +190,13 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels DialogResult res = dlg.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm); if (res == DialogResult.OK) { - using (StreamWriter sw = new StreamWriter(item.FileName, false)) { - sw.WriteLine(item.Node.ToXml().Replace("\n", "\r\n")); + using (XmlTextWriter writer = new XmlTextWriter(item.FileName, Encoding.UTF8)) { + writer.Formatting = Formatting.Indented; + writer.IndentChar = '\t'; + writer.Indentation = 1; + writer.WriteStartDocument(); + item.Node.WriteXml(writer); + writer.WriteEndDocument(); } // refresh item text userList.Items.RemoveAt(userList.SelectedIndex); diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/EditorHighlightColor.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/EditorHighlightColor.cs index 7221675bde..239ff26417 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/EditorHighlightColor.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/EditorHighlightColor.cs @@ -22,7 +22,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes { bool hasForeColor = false; bool hasBackColor = false; - + Color foreColor; bool sysForeColor = false; string sysForeColorName = ""; @@ -105,7 +105,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes el.Attributes["color"] == null && el.Attributes["bgcolor"] == null) { - noColor = true; + noColor = true; return; } @@ -146,6 +146,11 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes } } + public static EditorHighlightColor FromTextEditor(ICSharpCode.TextEditor.Document.HighlightColor color) + { + return new EditorHighlightColor(color.HasForgeground, color.Color, color.HasBackground, color.BackgroundColor, color.Bold, color.Italic); + } + public EditorHighlightColor(bool hascolor, Color Color, bool hasbackcolor, Color BackColor, bool bold, bool italic) { hasForeColor = hascolor; @@ -209,38 +214,30 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes return Color.FromArgb(a, r, g, b); } - public string ToXml() + public void WriteXmlAttributes(XmlWriter writer) { - string str = ""; - str += "bold=\"" + bold.ToString().ToLowerInvariant() + "\" "; - str += "italic=\"" + italic.ToString().ToLowerInvariant() + "\" "; + writer.WriteAttributeString("bold", bold.ToString().ToLowerInvariant()); + writer.WriteAttributeString("italic", italic.ToString().ToLowerInvariant()); if (hasForeColor) { - str += "color=\""; if (sysForeColor) { - str += "SystemColors." + sysForeColorName; + writer.WriteAttributeString("color", "SystemColors." + sysForeColorName); } else { - str += ReplaceColorName("#" + (foreColor.A != 255 ? foreColor.A.ToString("X2") : "") + - foreColor.R.ToString("X2") + - foreColor.G.ToString("X2") + - foreColor.B.ToString("X2")); + writer.WriteAttributeString("color", ReplaceColorName("#" + (foreColor.A != 255 ? foreColor.A.ToString("X2") : "") + + foreColor.R.ToString("X2") + + foreColor.G.ToString("X2") + + foreColor.B.ToString("X2"))); } - - str += "\" "; } if (hasBackColor) { - str += "bgcolor=\""; if (sysBackColor) { - str += "SystemColors." + sysBackColorName; + writer.WriteAttributeString("bgcolor", "SystemColors." + sysBackColorName); } else { - str += ReplaceColorName("#" + (backColor.A != 255 ? backColor.A.ToString("X2") : "") + - backColor.R.ToString("X2") + - backColor.G.ToString("X2") + - backColor.B.ToString("X2")); + writer.WriteAttributeString("bgcolor", ReplaceColorName("#" + (backColor.A != 255 ? backColor.A.ToString("X2") : "") + + backColor.R.ToString("X2") + + backColor.G.ToString("X2") + + backColor.B.ToString("X2"))); } - - str += "\" "; } - return str; } Color ParseSysColor(string colorName) diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/AbstractNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/AbstractNode.cs index 6ad7a8f25f..a6e0e8c443 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/AbstractNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/AbstractNode.cs @@ -36,11 +36,6 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes public abstract void UpdateNodeText(); // should be made abstract when implementing ToXml() - public virtual string ToXml() { return ""; } - - public static string ReplaceXmlChars(string str) - { - return str.Replace("&", "&").Replace("<", "<").Replace(">", ">"); - } + public abstract void WriteXml(XmlWriter writer); } } diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/DigitsNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/DigitsNode.cs index 6adc8452ee..d2eeae3d96 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/DigitsNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/DigitsNode.cs @@ -45,9 +45,12 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes { } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - return "\t\n\n"; + writer.WriteStartElement("Digits"); + writer.WriteAttributeString("name", "Digits"); + color.WriteXmlAttributes(writer); + writer.WriteEndElement(); } } diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/EnvironmentNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/EnvironmentNode.cs index bd91669436..6b1f1e600c 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/EnvironmentNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/EnvironmentNode.cs @@ -7,6 +7,7 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Windows.Forms; using System.Drawing; using System.Xml; @@ -26,8 +27,6 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes public EnvironmentNode(XmlElement el) { - - ArrayList envColors = new ArrayList(); ArrayList envColorNames = new ArrayList(); ArrayList envColorDescriptions = new ArrayList(); @@ -40,13 +39,22 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes } } } + + foreach (KeyValuePair pair in new DefaultHighlightingStrategy().EnvironmentColors) { + if (!envColorNames.Contains(pair.Key)) { + envColorNames.Add(pair.Key); + envColorDescriptions.Add("${res:Dialog.HighlightingEditor.EnvColors." + pair.Key + "}"); + envColors.Add(EditorHighlightColor.FromTextEditor(pair.Value)); + } + } + EnvironmentNode.ColorNames = (string[])envColorNames.ToArray(typeof(string)); this.ColorDescs = (string[])envColorDescriptions.ToArray(typeof(string)); this.Colors = (EditorHighlightColor[])envColors.ToArray(typeof(EditorHighlightColor)); StringParser.Parse(ColorDescs); Text = ResNodeName("EnvironmentColors"); - + panel = new EnvironmentOptionPanel(this); } @@ -54,14 +62,15 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes { } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - string str = "\t\n"; - for (int i = 0; i <= ColorNames.GetUpperBound(0); ++i) { - str += "\t\t<" + ColorNames[i] + " " + Colors[i].ToXml() + "/>\n"; + writer.WriteStartElement("Environment"); + for (int i = 0; i < ColorNames.Length; i++) { + writer.WriteStartElement(ColorNames[i]); + Colors[i].WriteXmlAttributes(writer); + writer.WriteEndElement(); } - str += "\t\n\n"; - return str; + writer.WriteEndElement(); } } diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListNode.cs index 4fd34fb144..4fea82c578 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListNode.cs @@ -57,7 +57,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes { Text = ResNodeName("KeywordList"); panel = new KeywordListOptionPanel(this); - + if (el == null) return; color = new EditorHighlightColor(el); @@ -88,23 +88,17 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes if (name != "") Text = name; } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - StringBuilder ret = new StringBuilder("\t\t\t\n"; - ret.Append(color.ToXml()); - ret.Append(">\n"); + writer.WriteStartElement("KeyWords"); + writer.WriteAttributeString("name", name); + color.WriteXmlAttributes(writer); foreach(string str in words) { - ////ret += "\t\t\t\t\n"; - ret.Append("\t\t\t\t\n"); + writer.WriteStartElement("Key"); + writer.WriteAttributeString("word", str); + writer.WriteEndElement(); } - ////ret += "\t\t\t\n\n"; - ret.Append("\t\t\t\n\n"); - return ret.ToString(); + writer.WriteEndElement(); } } diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListsNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListsNode.cs index ad07218879..6fe0fbe4d3 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListsNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/KeywordListsNode.cs @@ -37,13 +37,11 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes { } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - string ret = ""; foreach (KeywordListNode node in Nodes) { - ret += node.ToXml(); + node.WriteXml(writer); } - return ret; } } diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkerNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkerNode.cs index c724b23ffa..431cb84ce0 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkerNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkerNode.cs @@ -54,13 +54,13 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes Text = what; } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - string ret = "\t\t\t\n\n"; - return ret; + writer.WriteStartElement("Mark" + (previous ? "Previous" : "Following")); + color.WriteXmlAttributes(writer); + if (markMarker) writer.WriteAttributeString("markmarker", "true"); + writer.WriteString(what); + writer.WriteEndElement(); } public string What { diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkersNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkersNode.cs index c2fd039309..9a9a19306f 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkersNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/MarkersNode.cs @@ -36,13 +36,11 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes { } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - string ret = ""; foreach (MarkerNode node in Nodes) { - ret += node.ToXml(); + node.WriteXml(writer); } - return ret; } } diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/PropertiesNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/PropertiesNode.cs index 2bebf70ac1..0cd1559b3f 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/PropertiesNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/PropertiesNode.cs @@ -33,20 +33,21 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes } } - + public override void UpdateNodeText() { } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - string ret = "\t\n"; + writer.WriteStartElement("Properties"); foreach (DictionaryEntry de in Properties) { - ret += "\t\t\n"; + writer.WriteStartElement("Property"); + writer.WriteAttributeString("name", (string)de.Key); + writer.WriteAttributeString("value", (string)de.Value); + writer.WriteEndElement(); } - ret += "\t\n\n"; - return ret; + writer.WriteEndElement(); } } @@ -55,7 +56,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes private System.Windows.Forms.Button addBtn; private System.Windows.Forms.Button editBtn; private System.Windows.Forms.Button removeBtn; - private System.Windows.Forms.ListView listView; + private System.Windows.Forms.ListView listView; public PropertiesOptionPanel(PropertiesNode parent) : base(parent) { @@ -70,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes listView = (ListView)ControlDictionary["listView"]; } - + public override void StoreSettings() { PropertiesNode node = (PropertiesNode)parent; diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/RuleSetNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/RuleSetNode.cs index 05f211b785..b81729b349 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/RuleSetNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/RuleSetNode.cs @@ -69,8 +69,8 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes Nodes.Add(keywordNode); Nodes.Add(spansNode); Nodes.Add(prevMarkerNode); - Nodes.Add(nextMarkerNode); - + Nodes.Add(nextMarkerNode); + } public RuleSetNode(string Name, string Delim, string Ref, bool noEsc, bool noCase) @@ -89,7 +89,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes Nodes.Add(keywordNode); Nodes.Add(spansNode); Nodes.Add(prevMarkerNode); - Nodes.Add(nextMarkerNode); + Nodes.Add(nextMarkerNode); panel = new RuleSetOptionPanel(this); } @@ -101,25 +101,25 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes } } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - if (reference != "") return "\t\t\n\n"; - - string ret = "\t\t\n\n"; - - ret += spansNode.ToXml(); - ret += prevMarkerNode.ToXml(); - ret += nextMarkerNode.ToXml(); - ret += keywordNode.ToXml(); - - ret += "\t\t\n\n"; - - return ret; + writer.WriteStartElement("RuleSet"); + if (!isRoot) + writer.WriteAttributeString("name", name); + if (reference != "") { + writer.WriteAttributeString("reference", reference); + } else { + writer.WriteAttributeString("ignorecase", ignoreCase.ToString().ToLowerInvariant()); + if (noEscapeSequences) + writer.WriteAttributeString("noescapesequences", "true"); + if (delimiters != "") + writer.WriteElementString("Delimiters", delimiters); + spansNode.WriteXml(writer); + prevMarkerNode.WriteXml(writer); + nextMarkerNode.WriteXml(writer); + keywordNode.WriteXml(writer); + } + writer.WriteEndElement(); } public string Delimiters { diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/RuleSetsNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/RuleSetsNode.cs index 70778f6941..8530c34a30 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/RuleSetsNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/RuleSetsNode.cs @@ -35,14 +35,13 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes { } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - string ret = "\t\n"; + writer.WriteStartElement("RuleSets"); foreach (RuleSetNode node in Nodes) { - ret += node.ToXml(); + node.WriteXml(writer); } - ret += "\t\n\n"; - return ret; + writer.WriteEndElement(); } } diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SchemeNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SchemeNode.cs index 31b8c8169c..4755c30986 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SchemeNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SchemeNode.cs @@ -18,11 +18,21 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes { string name; string[] extensions; + string extends; + + public string Extends { + get { + return extends; + } + set { + extends = value; + } + } public string[] Extensions { get { return extensions; - } + } set { extensions = value; } @@ -60,6 +70,8 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes extensions = el.Attributes["extensions"].InnerText.Split('|'); } + extends = el.GetAttribute("extends"); + UpdateNodeText(); panel = new SchemeOptionPanel(this); @@ -82,23 +94,23 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes Text = name; } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - string str = - "\n" + - "\n\n" + - "\n\n"; + writer.WriteComment("This file was autogenerated by the #Develop highlighting editor."); + writer.WriteStartElement("SyntaxDefinition"); - str += envNode.ToXml(); - str += propNode.ToXml(); - str += digitsNode.ToXml(); - str += rulesetsNode.ToXml(); - - str += - "\n"; + writer.WriteAttributeString("name", name); + writer.WriteAttributeString("extensions", String.Join(";", extensions)); + if (extends != "") { + writer.WriteAttributeString("extends", extends); + } - return str; - + envNode.WriteXml(writer); + propNode.WriteXml(writer); + digitsNode.WriteXml(writer); + rulesetsNode.WriteXml(writer); + + writer.WriteEndElement(); } } diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SpanNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SpanNode.cs index d701af5ad4..50a338f793 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SpanNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SpanNode.cs @@ -59,27 +59,32 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - string ret = ""; - ret = "\t\t\t\n"; + writer.WriteStartElement("Begin"); + if (beginColor != null && !beginColor.NoColor) + beginColor.WriteXmlAttributes(writer); + writer.WriteString(begin); + writer.WriteEndElement(); if (end != "") { - ret += "\t\t\t\t\n"; + writer.WriteStartElement("End"); + if (endColor != null && !endColor.NoColor) + endColor.WriteXmlAttributes(writer); + writer.WriteString(end); + writer.WriteEndElement(); } - ret += "\t\t\t\n\n"; - return ret; + + writer.WriteEndElement(); } public SpanNode(string Name) @@ -91,6 +96,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes panel = new SpanOptionPanel(this); } + public override void UpdateNodeText() { if (name != "") { Text = name; return; } @@ -121,7 +127,7 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes } public EditorHighlightColor BeginColor { - get { + get { return beginColor; } set { diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SpansNode.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SpansNode.cs index 0bdc0b816e..c167ae1a5b 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SpansNode.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/Nodes/SpansNode.cs @@ -35,13 +35,11 @@ namespace ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes { } - public override string ToXml() + public override void WriteXml(XmlWriter writer) { - string ret = ""; foreach (SpanNode node in Nodes) { - ret += node.ToXml(); + node.WriteXml(writer); } - return ret; } } diff --git a/src/AddIns/Misc/HtmlHelp2/JScriptGlobals/HtmlHelp2JScriptGlobals.vbproj b/src/AddIns/Misc/HtmlHelp2/JScriptGlobals/HtmlHelp2JScriptGlobals.vbproj index 98b49f8519..8ceb27523b 100644 --- a/src/AddIns/Misc/HtmlHelp2/JScriptGlobals/HtmlHelp2JScriptGlobals.vbproj +++ b/src/AddIns/Misc/HtmlHelp2/JScriptGlobals/HtmlHelp2JScriptGlobals.vbproj @@ -7,12 +7,22 @@ AnyCPU Windows {E54A5AD2-418D-4A85-BA5E-CD803DE38715} + False + On + Off + Binary + False + Auto + 120586240 + AnyCPU + 4 + false bin\Debug\ False DEBUG,TRACE - True + true Full diff --git a/src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.csproj b/src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.csproj index 81d618ebb2..6cb71c0688 100644 --- a/src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.csproj +++ b/src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.csproj @@ -9,10 +9,23 @@ 8.0.50215 2.0 Resources\dynamichelp.res + False + False + False + None + False + Auto + 119537664 + AnyCPU + 4096 + 4 + false + false ..\..\..\..\..\AddIns\AddIns\Misc\HtmlHelp2\ DEBUG;TRACE + False ..\..\..\..\..\AddIns\AddIns\Misc\HtmlHelp2\ @@ -36,11 +49,6 @@ False - - ..\..\..\..\..\bin\ICSharpCode.TextEditor.dll - False - False - @@ -111,6 +119,11 @@ {E54A5AD2-418D-4A85-BA5E-CD803DE38715} HtmlHelp2JScriptGlobals + + {2D18BE89-D210-49EB-A9DD-2246FBB3DF6D} + ICSharpCode.TextEditor + False + \ No newline at end of file diff --git a/src/AddIns/Misc/HtmlHelp2/Project/src/Service/Help2RegistryWalker.cs b/src/AddIns/Misc/HtmlHelp2/Project/src/Service/Help2RegistryWalker.cs index 4ac8e42c21..ddfc832141 100644 --- a/src/AddIns/Misc/HtmlHelp2/Project/src/Service/Help2RegistryWalker.cs +++ b/src/AddIns/Misc/HtmlHelp2/Project/src/Service/Help2RegistryWalker.cs @@ -55,9 +55,9 @@ namespace HtmlHelp2.RegistryWalker else help2Collections.SelectedIndex = 0; } - catch + catch(Exception ex) { - LoggingService.Error("Help 2.0: cannot build namespaces list for Options dialog"); + LoggingService.Error("Help 2.0: cannot build namespaces list for Options dialog", ex); } help2Collections.EndUpdate(); diff --git a/src/AddIns/Misc/MonoAddIn/Project/MonoAddIn.csproj b/src/AddIns/Misc/MonoAddIn/Project/MonoAddIn.csproj index c2a7087feb..2a9d574d65 100644 --- a/src/AddIns/Misc/MonoAddIn/Project/MonoAddIn.csproj +++ b/src/AddIns/Misc/MonoAddIn/Project/MonoAddIn.csproj @@ -10,7 +10,7 @@ False False Auto - 4194304 + 121110528 AnyCPU 4096 4 diff --git a/src/AddIns/Misc/MonoReflectionLoader/Project/MonoReflectionLoader.csproj b/src/AddIns/Misc/MonoReflectionLoader/Project/MonoReflectionLoader.csproj index 98ddf5757d..3211302713 100644 --- a/src/AddIns/Misc/MonoReflectionLoader/Project/MonoReflectionLoader.csproj +++ b/src/AddIns/Misc/MonoReflectionLoader/Project/MonoReflectionLoader.csproj @@ -10,7 +10,7 @@ False False Auto - 92274688 + 100663296 AnyCPU 4096 4 diff --git a/src/AddIns/Misc/NAntAddIn/Project/NAntAddIn.csproj b/src/AddIns/Misc/NAntAddIn/Project/NAntAddIn.csproj index 4c194a4f73..a46c55ae38 100644 --- a/src/AddIns/Misc/NAntAddIn/Project/NAntAddIn.csproj +++ b/src/AddIns/Misc/NAntAddIn/Project/NAntAddIn.csproj @@ -13,12 +13,12 @@ Full False Auto - 4194304 + 121634816 AnyCPU 4096 + true - true False False True @@ -26,7 +26,6 @@ false - False True False False diff --git a/src/AddIns/Misc/PInvokeAddIn/Project/PInvokeAddIn.csproj b/src/AddIns/Misc/PInvokeAddIn/Project/PInvokeAddIn.csproj index 324bf2d41f..735c8774e5 100644 --- a/src/AddIns/Misc/PInvokeAddIn/Project/PInvokeAddIn.csproj +++ b/src/AddIns/Misc/PInvokeAddIn/Project/PInvokeAddIn.csproj @@ -10,14 +10,20 @@ 4 False False + False + Auto + 122159104 + AnyCPU + 4096 - True + true False False True ..\..\..\..\..\AddIns\AddIns\Misc\PInvokeAddIn\ - False + false + Full False diff --git a/src/AddIns/Misc/RegExpTk/Project/RegExpTk.csproj b/src/AddIns/Misc/RegExpTk/Project/RegExpTk.csproj index b2f9257a5e..c8a89fefce 100644 --- a/src/AddIns/Misc/RegExpTk/Project/RegExpTk.csproj +++ b/src/AddIns/Misc/RegExpTk/Project/RegExpTk.csproj @@ -12,15 +12,21 @@ False OnSuccessfulBuild Library + False + Auto + 122683392 + AnyCPU + 4096 - True + true False False True ..\..\..\..\..\AddIns\AddIns\Misc\RegExpTk\ - False + false DEBUG + Full False diff --git a/src/AddIns/Misc/SharpQuery/SharpQuery.csproj b/src/AddIns/Misc/SharpQuery/SharpQuery.csproj index 2e5701b8f7..24c8c1f42d 100644 --- a/src/AddIns/Misc/SharpQuery/SharpQuery.csproj +++ b/src/AddIns/Misc/SharpQuery/SharpQuery.csproj @@ -13,7 +13,7 @@ OnSuccessfulBuild False Auto - 4194304 + 123207680 AnyCPU 4096 Program @@ -80,14 +80,6 @@ - - {2206CEB0-19C1-11D1-89E0-00C04FD7A829} - 1 - 0 - 0 - tlbimp - False - {2748AD25-9C63-4E12-877B-4DCE96FBED54} ICSharpCode.SharpDevelop @@ -99,6 +91,14 @@ False + + {2206CEB0-19C1-11D1-89E0-00C04FD7A829} + 1 + 0 + 0 + tlbimp + False + diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs index 901971dcbb..9ddf27fb44 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSection.cs @@ -248,7 +248,7 @@ namespace SharpReport{ } private void OnItemAddeded(object sender, CollectionItemEventArgs e){ - + SharpReport.Designer.IDesignable iDesignable = e.Item as SharpReport.Designer.IDesignable; if (iDesignable != null) { @@ -259,7 +259,7 @@ namespace SharpReport{ iDesignable.VisualControl.Focus(); iDesignable.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler (OnPropertyChanged); } - } + } } private void OnRemoveTopLevelItem(object sender, CollectionItemEventArgs e){ diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs index 72e3ac78f0..60a11f051b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs @@ -15,7 +15,7 @@ namespace SharpReport.Designer /// /// Description of ControlHelper. /// - internal class ControlHelper{ + public class ControlHelper{ Control control; public ControlHelper(Control control){ diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs index 71a1ea8781..94a5240d2b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs @@ -129,6 +129,10 @@ namespace SharpReport.Designer{ this.Invalidate(); } + protected Rectangle FocusRectangle { + get {return this.controlHelper.BuildFocusRectangle;} + } + #region Windows Forms Designer generated code /// /// This method is required for Windows Forms designer support. diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportLineControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportLineControl.cs index 42b4ffa126..0f78bb8df6 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportLineControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportLineControl.cs @@ -39,7 +39,7 @@ namespace SharpReport.Designer{ protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea) { base.OnPaint(pea); base.DrawEdges (pea); - base.DrawDecorations(pea); +// base.DrawDecorations(pea); shape.DrawShape(pea.Graphics, new BaseLine (this.ForeColor,base.DashStyle,base.Thickness), diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs index 0b0763aa45..8209227905 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs @@ -41,15 +41,15 @@ namespace SharpReport.Designer { protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea) { base.OnPaint(pea); - base.DrawEdges (pea); base.DrawDecorations(pea); + shape.FillShape(pea.Graphics, new SolidFillPattern(this.BackColor), - (RectangleF)this.ClientRectangle); + (RectangleF)base.FocusRectangle); shape.DrawShape (pea.Graphics, new BaseLine (this.ForeColor,base.DashStyle,base.Thickness), - (RectangleF)this.ClientRectangle); + (RectangleF)base.FocusRectangle); } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs index 0ffed654de..498f7b6e5e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs @@ -21,7 +21,8 @@ namespace SharpReport.Designer{ /// internal class ReportRowControl:ReportControlBase{ - + private RectangleShape shape = new RectangleShape(); + private bool drawBorder; public ReportRowControl():base(){ InitializeComponent(); this.SetStyle(ControlStyles.DoubleBuffer | @@ -39,10 +40,15 @@ namespace SharpReport.Designer{ #region overrides protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea){ base.OnPaint(pea); - - Rectangle r = new Rectangle(0,5,this.ClientSize.Width - 1,this.ClientSize.Height - 6); - base.DrawEdges (pea,r); + base.DrawEdges (pea, + new Rectangle(0,5,this.ClientSize.Width - 1,this.ClientSize.Height - 6) ); base.DrawDecorations(pea); + + if (this.drawBorder) { + shape.DrawShape (pea.Graphics, + new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1), + base.FocusRectangle); + } StringFormat fmt = GlobalValues.StandartStringFormat(); fmt.LineAlignment = StringAlignment.Near; @@ -54,11 +60,18 @@ namespace SharpReport.Designer{ } public override string ToString() { - return this.Name; + return this.GetType().Name; } #endregion + public bool DrawBorder { + set { + drawBorder = value; + this.Invalidate(); + } + } + #region Windows Forms Designer generated code /// /// This method is required for Windows Forms designer support. diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs index af19ca0363..82f2464afc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs @@ -18,7 +18,13 @@ namespace SharpReport.Designer{ /// Description of ReportTextItem. /// internal class ReportTextControl : ReportControlBase{ - StringFormat stringFormat; + + private StringTrimming stringTrimming; + private ContentAlignment contentAlignment; + private bool drawBorder; + + private TextDrawer textDrawer = new TextDrawer(); + private RectangleShape shape = new RectangleShape(); public ReportTextControl():base(){ InitializeComponent(); @@ -32,36 +38,42 @@ namespace SharpReport.Designer{ this.Size = GlobalValues.PreferedSize; } + public bool DrawBorder { + set { + drawBorder = value; + this.Invalidate(); + } + } public override string Text{ get { return base.Text; } - set { - base.Text = value; - } + set { base.Text = value;} } - public StringFormat StringFormat{ + + public StringTrimming StringTrimming { set { - if (this.stringFormat != value) { - this.stringFormat = value; - this.Invalidate(); - } + stringTrimming = value; + this.Invalidate(); } } + + public System.Drawing.ContentAlignment ContentAlignment { + set { + this.contentAlignment = value; + this.Invalidate(); + } + } + protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea){ - + base.OnPaint(pea); base.DrawEdges (pea); base.DrawDecorations(pea); - - if (this.stringFormat == null) { - this.stringFormat = GlobalValues.StandartStringFormat(); - this.stringFormat.LineAlignment = StringAlignment.Center; - } - + string str; if (String.IsNullOrEmpty(this.Text)) { @@ -70,10 +82,16 @@ namespace SharpReport.Designer{ str = this.Text; } - pea.Graphics.DrawString(str,this.Font, - new SolidBrush(this.ForeColor), - (RectangleF)this.ClientRectangle, - this.stringFormat); + if (this.drawBorder) { + shape.DrawShape (pea.Graphics, + new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1), + base.FocusRectangle); + } + + this.textDrawer.DrawString (pea.Graphics,this.Text,this.Font, + new SolidBrush(this.ForeColor),(RectangleF)this.ClientRectangle, + this.stringTrimming,this.contentAlignment); + } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs index b5e4aceaef..85e3bc396f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs @@ -20,10 +20,10 @@ namespace SharpReport { /// created by - Forstmeier Peter /// created on - 31.08.2005 13:49:47 /// - public class ItemsHelper : object { + internal class ItemsHelper : object { - public static void UpdateBaseFromTextControl (ReportObjectControlBase control, + internal static void UpdateBaseFromTextControl (ReportObjectControlBase control, BaseReportItem item) { item.Size = control.Size; @@ -32,9 +32,10 @@ namespace SharpReport { item.BackColor = control.BackColor; item.ForeColor = control.ForeColor; item.Font = control.Font; + } - public static void UpdateBaseFromGraphicControl (AbstractGraphicControl control, + internal static void UpdateBaseFromGraphicControl (AbstractGraphicControl control, BaseGraphicItem item) { ItemsHelper.UpdateBaseFromTextControl (control,item); @@ -43,7 +44,7 @@ namespace SharpReport { } - public static void UpdateControlFromTextBase (ReportObjectControlBase control, + internal static void UpdateControlFromTextBase (ReportObjectControlBase control, BaseReportItem item) { control.BackColor = item.BackColor; @@ -52,14 +53,10 @@ namespace SharpReport { control.Size = item.Size; control.Font = item.Font; control.Name = item.Name; - BaseTextItem b = item as BaseTextItem; -// if (b != null) { -// control. = b.StringAlignment; -// } } - public static void UpdateControlFromGraphicBase (AbstractGraphicControl control, + internal static void UpdateControlFromGraphicBase (AbstractGraphicControl control, BaseGraphicItem item) { ItemsHelper.UpdateControlFromTextBase(control,item); control.Location = item.Location; diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs index 7a0ef28e1c..e7256275dc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportDataItem.cs @@ -38,9 +38,12 @@ namespace SharpReport.ReportItems{ visualControl = new ReportDbTextControl(); this.visualControl.Text = base.ColumnName; - visualControl.StringFormat = base.StringFormat; + this.Text = base.ColumnName; + visualControl.ContentAlignment = base.ContentAlignment; + visualControl.StringTrimming = base.StringTrimming; + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); this.visualControl.Click += new EventHandler(OnControlSelect); @@ -65,7 +68,10 @@ namespace SharpReport.ReportItems{ private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ ItemsHelper.UpdateControlFromTextBase(this.visualControl,this); - this.visualControl.StringFormat = base.StringFormat; + + this.visualControl.ContentAlignment = base.ContentAlignment; + this.visualControl.StringTrimming = base.StringTrimming; + this.HandlePropertyChanged(e.PropertyName); } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs index 45ff2ff93e..bbd7b10a09 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs @@ -108,6 +108,7 @@ namespace SharpReport.ReportItems private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ ItemsHelper.UpdateControlFromTextBase (this.visualControl,this); + this.visualControl.DrawBorder = base.DrawBorder; this.HandlePropertyChanged(e.PropertyName); } @@ -115,6 +116,7 @@ namespace SharpReport.ReportItems private void OnControlChanged (object sender, EventArgs e) { this.SuspendLayout(); ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.ResumeLayout(); this.HandlePropertyChanged("OnControlChanged"); @@ -206,7 +208,7 @@ namespace SharpReport.ReportItems } public override string ToString(){ - return this.Name; + return this.GetType().Name; } #endregion diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs index 414b6bca24..a1739baa4f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs @@ -32,16 +32,17 @@ namespace SharpReport.ReportItems { visualControl = new ReportTextControl(); this.Text = visualControl.Name; - visualControl.StringFormat = base.StringFormat; - ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + visualControl.ContentAlignment = base.ContentAlignment; + visualControl.StringTrimming = base.StringTrimming; + ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.visualControl.Click += new EventHandler(OnControlSelect); this.visualControl.VisualControlChanged += new EventHandler (OnControlChanged); this.visualControl.BackColorChanged += new EventHandler (OnControlChanged); this.visualControl.FontChanged += new EventHandler (OnControlChanged); this.visualControl.ForeColorChanged += new EventHandler (OnControlChanged); - base.PropertyChanged += new PropertyChangedEventHandler (BasePropertyChange); } @@ -49,11 +50,15 @@ namespace SharpReport.ReportItems { #endregion - #region events + private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ ItemsHelper.UpdateControlFromTextBase(this.visualControl,this); - this.visualControl.StringFormat = base.StringFormat; + + this.visualControl.ContentAlignment = base.ContentAlignment; + this.visualControl.StringTrimming = base.StringTrimming; + this.visualControl.DrawBorder = base.DrawBorder; + this.HandlePropertyChanged(e.PropertyName); } @@ -86,20 +91,7 @@ namespace SharpReport.ReportItems { } #endregion - - public override Size Size { - get { - return base.Size; - } - set { - base.Size = value; - if (this.visualControl != null) { - this.visualControl.Size = value; - } - this.HandlePropertyChanged("Size"); - } - } - + public override Point Location { get { return base.Location; @@ -142,7 +134,7 @@ namespace SharpReport.ReportItems { this.HandlePropertyChanged("Text"); } } - + #region IDesignable [System.Xml.Serialization.XmlIgnoreAttribute] diff --git a/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj b/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj index 7855744c9b..edb3df3a68 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReport/SharpReport.csproj @@ -10,7 +10,7 @@ False False Auto - 4194304 + 124780544 AnyCPU 4096 4 diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs index a78dba8a06..05d19a65e7 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs @@ -115,7 +115,10 @@ namespace SharpReport.Visitors { itemRenderer = designableFactory.Create(ctrlElem.GetAttribute("type")); baseReportItem = (BaseReportItem)itemRenderer; - + + baseReportItem.SuspendLayout(); + XmlHelper.SetReportItemValues (base.XmlFormReader,ctrlElem,baseReportItem); + if (parentContainer == null) { baseReportItem.Parent = baseSection; baseSection.Items.Add (baseReportItem); @@ -124,9 +127,7 @@ namespace SharpReport.Visitors { parentContainer.Items.Add(baseReportItem); } - - XmlHelper.SetReportItemValues (base.XmlFormReader,ctrlElem,baseReportItem); - + baseReportItem.ResumeLayout(); IContainerItem iContainer = baseReportItem as IContainerItem; if (iContainer != null) { diff --git a/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportAddin.csproj b/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportAddin.csproj index 8da946f780..af8d7de16a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportAddin.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportAddin.csproj @@ -10,7 +10,7 @@ False False Auto - 4194304 + 125829120 AnyCPU 4096 4 diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs index 75f44f3372..c38f2a0983 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseDataItem.cs @@ -66,11 +66,10 @@ namespace SharpReportCore { // this.DbValue is formatted in the BeforePrintEvent catched in AbstractRenderer string toPrint = CheckForNullValue(); - string formattedString = base.FireFormatOutput(toPrint,this.FormatString,""); - - RectangleF rect = base.PrepareRectangle (rpea,formattedString); - base.PrintTheStuff (rpea,formattedString,rect); - base.NotiyfyAfterPrint (rpea.LocationAfterDraw); + + base.Text = base.FireFormatOutput(toPrint,this.FormatString,""); + base.Render (rpea); + } public override string ToString() { diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs index e342b97d8a..fd9992fc38 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseReportItem.cs @@ -60,14 +60,17 @@ namespace SharpReportCore { #endregion #region EventHandling + protected void NotiyfyAfterPrint (PointF afterPrintLocation) { +// System.Console.WriteLine("\tNotiyfyAfterPrint"); if (this.ItemPrinted != null) { AfterPrintEventArgs rea = new AfterPrintEventArgs (afterPrintLocation); ItemPrinted(this, rea); } } - protected void NotifyBeforePrint () { + private void NotifyBeforePrint () { +// System.Console.WriteLine("\tNotifyBeforePrint"); if (this.ItemPrinting != null) { BeforePrintEventArgs ea = new BeforePrintEventArgs (); ItemPrinting (this,ea); @@ -75,6 +78,15 @@ namespace SharpReportCore { } #endregion + + #region overrides + public override void Render(ReportPageEventArgs rpea){ + base.Render(rpea); + this.NotifyBeforePrint(); + } + + #endregion + #region virtual method's protected RectangleF DrawingRectangle (ReportPageEventArgs e,SizeF measureSize) { @@ -145,7 +157,7 @@ namespace SharpReportCore { NotifyPropertyChanged ("Font"); } } - + #endregion #region IDisposeable diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs index 0ff7465971..bfaf0c8399 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs @@ -30,8 +30,10 @@ namespace SharpReportCore { private StringTrimming stringTrimming; private TextDrawer textDrawer = new TextDrawer(); private ContentAlignment contentAlignment; + private RectangleShape shape = new RectangleShape(); #region Constructor + public BaseTextItem():base() { this.stringFormat = StringFormat.GenericTypographic; this.contentAlignment = ContentAlignment.MiddleLeft; @@ -40,85 +42,19 @@ namespace SharpReportCore { #endregion - private StringFormat BuildStringFormat(){ - StringFormat format = StringFormat.GenericTypographic; - format.Trimming = this.stringTrimming; - format.FormatFlags = StringFormatFlags.LineLimit; - -// if (base.RightToLeft) -// { -// format1.FormatFlags |= StringFormatFlags.DirectionRightToLeft; -// } - - ContentAlignment alignment = this.contentAlignment; - if (alignment <= ContentAlignment.MiddleCenter){ - switch (alignment){ - case ContentAlignment.TopLeft:{ - format.Alignment = StringAlignment.Near; - format.LineAlignment = StringAlignment.Near; - return format; - } - case ContentAlignment.TopCenter:{ - format.Alignment = StringAlignment.Center; - format.LineAlignment = StringAlignment.Near; - return format; - } - case (ContentAlignment.TopCenter | ContentAlignment.TopLeft):{ - return format; - } - case ContentAlignment.TopRight:{ - format.Alignment = StringAlignment.Far; - format.LineAlignment = StringAlignment.Near; - return format; - } - case ContentAlignment.MiddleLeft:{ - format.Alignment = StringAlignment.Near; - format.LineAlignment = StringAlignment.Center; - return format; - } - case ContentAlignment.MiddleCenter:{ - format.Alignment = StringAlignment.Center; - format.LineAlignment = StringAlignment.Center; - return format; - } - } - return format; - } - if (alignment <= ContentAlignment.BottomLeft){ - if (alignment == ContentAlignment.MiddleRight){ - format.Alignment = StringAlignment.Far; - format.LineAlignment = StringAlignment.Center; - return format; - } - if (alignment != ContentAlignment.BottomLeft){ - return format; - } - } - else{ - if (alignment != ContentAlignment.BottomCenter){ - if (alignment == ContentAlignment.BottomRight) - { - format.Alignment = StringAlignment.Far; - format.LineAlignment = StringAlignment.Far; - } - return format; - } - format.Alignment = StringAlignment.Center; - format.LineAlignment = StringAlignment.Far; - return format; - } - format.Alignment = StringAlignment.Near; - format.LineAlignment = StringAlignment.Far; - return format; - } - public override void Render(ReportPageEventArgs rpea) { + if (rpea == null) { throw new ArgumentNullException("rpea"); } + base.Render(rpea); RectangleF rect = PrepareRectangle (rpea,this.Text); + FillBackGround (rpea.PrintPageEventArgs.Graphics, + rect); + DrawFrame (rpea.PrintPageEventArgs.Graphics, + Rectangle.Ceiling (rect)); PrintTheStuff (rpea,this.Text,rect); base.NotiyfyAfterPrint (rpea.LocationAfterDraw); } @@ -127,22 +63,23 @@ namespace SharpReportCore { return "BaseTextItem"; } - private void Decorate (ReportPageEventArgs rpea,Rectangle border) { - using (SolidBrush brush = new SolidBrush(base.BackColor)) { - rpea.PrintPageEventArgs.Graphics.FillRectangle(brush,border); - } + protected void FillBackGround (Graphics graphics,RectangleF rectangle) { + shape.FillShape(graphics, + new SolidFillPattern(this.BackColor), + rectangle); + } + + protected void DrawFrame (Graphics graphics,Rectangle rectangle) { if (base.DrawBorder == true) { - using (Pen pen = new Pen(Color.Black, 1)) { - rpea.PrintPageEventArgs.Graphics.DrawRectangle (pen,border); - } + shape.DrawShape (graphics, + new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1), + rectangle); } } - protected RectangleF PrepareRectangle (ReportPageEventArgs e,string text) { - SizeF measureSize = new SizeF (); - measureSize = MeasureReportItem (e,text); - RectangleF rect = base.DrawingRectangle (e,measureSize); - Decorate (e,System.Drawing.Rectangle.Ceiling (rect)); + protected RectangleF PrepareRectangle (ReportPageEventArgs rpea,string text) { + SizeF measureSize = MeasureReportItem (rpea,text); + RectangleF rect = base.DrawingRectangle (rpea,measureSize); return rect; } @@ -172,20 +109,31 @@ namespace SharpReportCore { RectangleF rectangle ) { if (rpea == null) { - throw new ArgumentException (this.Name); + throw new ArgumentNullException("rpea"); } - StringFormat fmt = this.stringFormat; + textDrawer.DrawString(rpea.PrintPageEventArgs.Graphics, - toPrint, - this.Font, + toPrint,this.Font, new SolidBrush(this.ForeColor), rectangle, - fmt); - - rpea.LocationAfterDraw = new PointF (this.Location.X + this.Size.Width, + this.stringTrimming,this.contentAlignment); + + + rpea.LocationAfterDraw = new PointF (this.Location.X + this.Size.Width, this.Location.Y + this.Size.Height); } + + public virtual string Text { + get { + return text; + } + set { + text = value; + base.NotifyPropertyChanged("Text"); + } + } + /// /// Formatstring like in MSDN /// @@ -204,20 +152,8 @@ namespace SharpReportCore { } - public virtual string Text { - get { - return text; - } - set { - text = value; - base.NotifyPropertyChanged("Text"); - } - } - - - [Category("Appearance")] - public StringTrimming StringTrimming { + public StringTrimming StringTrimming { get { return stringTrimming; } @@ -237,12 +173,13 @@ namespace SharpReportCore { base.NotifyPropertyChanged("ContentAlignment"); } } - + [Browsable(false)] [XmlIgnoreAttribute] - public StringFormat StringFormat { + public virtual StringFormat StringFormat { get { - return this.BuildStringFormat(); + return this.textDrawer.BuildStringFormat (this.StringTrimming, + this.ContentAlignment); } } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs index 36cb6ca0d5..7c1afbcce6 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs @@ -25,11 +25,9 @@ using System.Drawing; namespace SharpReportCore { public class BaseRectangleItem : SharpReportCore.BaseGraphicItem { - private ArrayList arrayList; RectangleShape shape = new RectangleShape(); public BaseRectangleItem() { - arrayList = new ArrayList(); } public override void Render(ReportPageEventArgs rpea) { @@ -39,7 +37,7 @@ namespace SharpReportCore { shape.FillShape(rpea.PrintPageEventArgs.Graphics, new SolidFillPattern(this.BackColor), rect); - + shape.DrawShape (rpea.PrintPageEventArgs.Graphics, new BaseLine (this.ForeColor,base.DashStyle,base.Thickness), rect); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs index 7239901b55..91e9570ebc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs @@ -9,6 +9,7 @@ using System; using System.Drawing; +using System.Drawing.Drawing2D; using System.ComponentModel; using System.Collections.Generic; using System.Windows.Forms; @@ -23,8 +24,10 @@ namespace SharpReportCore{ private ReportItemCollection items; private Padding padding; - private Color secondaryBackColor; + private Color alternateBackColor; private int changeBackColorEveryNRow; + private RectangleShape shape = new RectangleShape(); + public RowItem():this (String.Empty){ } @@ -41,16 +44,7 @@ namespace SharpReportCore{ } #region overrides - private void Decorate (ReportPageEventArgs rpea,Rectangle border) { - using (SolidBrush brush = new SolidBrush(base.BackColor)) { - rpea.PrintPageEventArgs.Graphics.FillRectangle(brush,border); - } - if (base.DrawBorder == true) { - using (Pen pen = new Pen(Color.Black, 1)) { - rpea.PrintPageEventArgs.Graphics.DrawRectangle (pen,border); - } - } - } + protected RectangleF PrepareRectangle (ReportPageEventArgs e) { SizeF measureSize = new SizeF ((SizeF)this.Size); @@ -64,11 +58,21 @@ namespace SharpReportCore{ if (rpea == null) { throw new ArgumentNullException("rpea"); } - + System.Console.WriteLine(""); + System.Console.WriteLine("--Start of {0}",this.ToString()); base.Render(rpea); RectangleF rect = PrepareRectangle (rpea); - Decorate (rpea,System.Drawing.Rectangle.Ceiling (rect)); + shape.FillShape(rpea.PrintPageEventArgs.Graphics, + new SolidFillPattern(this.BackColor), + rect); + + if (base.DrawBorder == true) { + shape.DrawShape (rpea.PrintPageEventArgs.Graphics, + new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1), + rect); + } + foreach (BaseReportItem childItem in this.items) { Point loc = new Point (childItem.Location.X,childItem.Location.Y); @@ -79,12 +83,13 @@ namespace SharpReportCore{ childItem.Render (rpea); childItem.Location = new Point(loc.X,loc.Y); } - + System.Console.WriteLine("--End of RowItem"); + System.Console.WriteLine(""); base.NotiyfyAfterPrint (rpea.LocationAfterDraw); } public override string ToString(){ - return "RowItem"; + return this.GetType().Name; } #endregion @@ -96,12 +101,12 @@ namespace SharpReportCore{ [Category("Appearance"), Description("Change the Backcolor on every 'N' Row")] - public Color SecondaryBackColor { + public Color AlternateBackColor { get { - return this.secondaryBackColor; + return this.alternateBackColor; } set { - this.secondaryBackColor = value; + this.alternateBackColor = value; base.NotifyPropertyChanged("SecondaryBackColor"); } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseLine.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseLine.cs index 08d0cdc01e..bafc149c61 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseLine.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseLine.cs @@ -31,7 +31,7 @@ using System.Drawing.Drawing2D; /// created by - Forstmeier Peter /// created on - 09.10.2005 18:37:51 /// -namespace SharpReportCore { +namespace SharpReportCore { public class BaseLine : object { DashStyle dashStyle; @@ -45,10 +45,51 @@ namespace SharpReportCore { this.thickness = thickness; } - public void CreatePen () { - throw new NotImplementedException("BaseLine:CreatePen"); - } + public Pen CreatePen(){ + return this.CreatePen(72f); + } + + + public Pen CreatePen(float resolution) + { + Pen pen; + + if (this.thickness == 0f) + { + pen = new Pen(this.color, resolution / 72f); + } + else + { + pen = new Pen(this.color, (this.thickness * resolution) / 72f); + } + + switch (this.dashStyle){ + case DashStyle.Dot: + { + pen.DashStyle = DashStyle.Dot; + return pen; + } + case DashStyle.Dash: + { + pen.DashStyle = DashStyle.Dash; + return pen; + } + case DashStyle.DashDot: + { + pen.DashStyle = DashStyle.DashDot; + return pen; + } + case DashStyle.DashDotDot: + { + pen.DashStyle = DashStyle.DashDotDot; + return pen; + } + } + return pen; + } + + public Color Color { get { return color; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs index d4df64c061..e4ed6a94a5 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs @@ -31,33 +31,47 @@ using System.Drawing.Drawing2D; /// namespace SharpReportCore { - public class BaseShape : object { + public abstract class BaseShape : object { public BaseShape() { } - public virtual void DrawShape (Graphics graphics,BaseLine baseLine,RectangleF rectangle) { + public void FillShape (Graphics graphics, Brush brush,RectangleF rectangle) { - } + GraphicsPath path1 = this.CreatePath(rectangle); + graphics.FillPath(brush, path1); - - public virtual void DrawShape (Graphics graphics,Pen pen,RectangleF rectangle) { + } + public void FillShape (Graphics graphics,AbstractFillPattern fillPattern,RectangleF rectangle) { + if (fillPattern != null){ + using (Brush brush = fillPattern.CreateBrush(rectangle)){ + if (brush != null){ + this.FillShape(graphics, brush, rectangle); + } + } + } } + public abstract GraphicsPath CreatePath (RectangleF rectangle) ; - public virtual void FillShape (Graphics graphics, Brush brush,RectangleF rectangle) { - - } - public virtual void FillShape (Graphics graphics,AbstractFillPattern fillPattern,RectangleF rectangle) { - - } - public virtual GraphicsPath CreatePath (RectangleF rectangleF) { - return null; + public void DrawShape(Graphics g, BaseLine line, RectangleF rectangle){ + using (Pen pen = line.CreatePen()){ + if (pen != null){ + this.new_DrawShape(g, pen, rectangle); + } + } + } + + public void new_DrawShape(Graphics g, Pen pen, RectangleF rectangle){ + GraphicsPath path1 = this.CreatePath(rectangle); + g.DrawPath(pen, path1); } + + } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/EllipseShape.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/EllipseShape.cs index 0d03939d91..4f31ce9fed 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/EllipseShape.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/EllipseShape.cs @@ -20,6 +20,8 @@ // Peter Forstmeier (Peter.Forstmeier@t-online.de) using System; using System.Drawing; +using System.Drawing.Drawing2D; + /// /// This class draws a Ellipse/Ellipse /// @@ -37,19 +39,10 @@ namespace SharpReportCore { } - public override void DrawShape(Graphics graphics, BaseLine baseLine, RectangleF rectangle) { - base.DrawShape(graphics,baseLine,rectangle); - using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) { - p.DashStyle = baseLine.DashStyle; - graphics.DrawEllipse(p, - rectangle); - } - } - - - public override void FillShape(Graphics graphics, AbstractFillPattern fillPattern, RectangleF rectangle) { - graphics.FillEllipse(fillPattern.Brush, - rectangle); + public override GraphicsPath CreatePath(RectangleF rectangle){ + GraphicsPath path = new GraphicsPath(); + path.AddEllipse(rectangle); + return path; } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs index 11a61702e3..f0550d4b02 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs @@ -39,7 +39,8 @@ namespace SharpReportCore { } - + public abstract Brush CreateBrush(RectangleF rect); + protected Color Color { get { return color; @@ -64,7 +65,12 @@ namespace SharpReportCore { /// public class SolidFillPattern : AbstractFillPattern { public SolidFillPattern (Color color) :base(color){ - base.Brush = new SolidBrush(color); +// base.Brush = new SolidBrush(color); } + + public override Brush CreateBrush(RectangleF rect){ + return new SolidBrush(this.Color); + } + } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/LineShape.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/LineShape.cs index bbdd5b744b..fe8579a3fc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/LineShape.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/LineShape.cs @@ -20,7 +20,7 @@ // Peter Forstmeier (Peter.Forstmeier@t-online.de) using System; using System.Drawing; - +using System.Drawing.Drawing2D; /// /// Draw a Line, used by DesingerControls and printing stuff @@ -37,21 +37,13 @@ namespace SharpReportCore { /// public LineShape() { } + + public override GraphicsPath CreatePath(RectangleF rectangle){ + GraphicsPath path = new GraphicsPath(); + float halfRect = rectangle.Top + (rectangle.Height /2); + path.AddLine(rectangle.Left, halfRect, rectangle.Right, halfRect); + return path; - public override void DrawShape(Graphics graphics, BaseLine baseLine, RectangleF rectangle) { - base.DrawShape(graphics,baseLine,rectangle); - using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) { - p.DashStyle = baseLine.DashStyle; - float halfRect = rectangle.Top + (rectangle.Height / 2); - - graphics.DrawLine (p, - rectangle.X, - halfRect, - rectangle.X + rectangle.Width, - halfRect); - } } - - } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs index d8cace4837..7f79fc5f84 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs @@ -20,6 +20,7 @@ // Peter Forstmeier (Peter.Forstmeier@t-online.de) using System; using System.Drawing; +using System.Drawing.Drawing2D; /// /// Draw a Rectangle, used by DesingerControls and printing stuff @@ -34,27 +35,13 @@ namespace SharpReportCore { public RectangleShape() { } - - public override void DrawShape(Graphics graphics, BaseLine baseLine, RectangleF rectangle) { - base.DrawShape(graphics,baseLine,rectangle); - using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) { - p.DashStyle = baseLine.DashStyle; - graphics.DrawRectangle (p,rectangle.Left, - rectangle.Top, - rectangle.Width, - rectangle.Height); - } - } - - public override void FillShape(Graphics graphics, AbstractFillPattern fillPattern, RectangleF rectangle) { - graphics.FillRectangle(fillPattern.Brush, - rectangle); - } - public override void FillShape(Graphics graphics, Brush brush, RectangleF rectangle) { - graphics.FillRectangle(brush, rectangle); - + public override GraphicsPath CreatePath(RectangleF rect){ + GraphicsPath path1 = new GraphicsPath(); + path1.AddRectangle(rect); + return path1; } - + + } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs index 56eab54358..11cfa921b4 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Text/TextDrawer.cs @@ -38,12 +38,102 @@ namespace SharpReportCore { } - public void DrawString(Graphics graphics,string text,Font font,Brush brush,RectangleF rectangle,StringFormat stringFormat) { + public void DrawString(Graphics graphics,string text, + Font font,Brush brush, + RectangleF rectangle, + StringFormat stringFormat) { + graphics.DrawString(text, font, brush, rectangle, stringFormat); } + + + public void DrawString(Graphics graphics,string text, + Font font,Brush brush, + RectangleF rectangle, + StringTrimming stringTrimming, + ContentAlignment alignment) { + + StringFormat s = BuildStringFormat(stringTrimming,alignment); + this.DrawString(graphics,text, + font,brush, + rectangle, + s); + } + + + public StringFormat BuildStringFormat(StringTrimming stringTrimming,ContentAlignment alignment){ + StringFormat format = StringFormat.GenericTypographic; + format.Trimming = stringTrimming; + format.FormatFlags = StringFormatFlags.LineLimit; + +// if (base.RightToLeft) +// { +// format1.FormatFlags |= StringFormatFlags.DirectionRightToLeft; +// } + + if (alignment <= ContentAlignment.MiddleCenter){ + switch (alignment){ + case ContentAlignment.TopLeft:{ + format.Alignment = StringAlignment.Near; + format.LineAlignment = StringAlignment.Near; + return format; + } + case ContentAlignment.TopCenter:{ + format.Alignment = StringAlignment.Center; + format.LineAlignment = StringAlignment.Near; + return format; + } + case (ContentAlignment.TopCenter | ContentAlignment.TopLeft):{ + return format; + } + case ContentAlignment.TopRight:{ + format.Alignment = StringAlignment.Far; + format.LineAlignment = StringAlignment.Near; + return format; + } + case ContentAlignment.MiddleLeft:{ + format.Alignment = StringAlignment.Near; + format.LineAlignment = StringAlignment.Center; + return format; + } + case ContentAlignment.MiddleCenter:{ + format.Alignment = StringAlignment.Center; + format.LineAlignment = StringAlignment.Center; + return format; + } + } + return format; + } + if (alignment <= ContentAlignment.BottomLeft){ + if (alignment == ContentAlignment.MiddleRight){ + format.Alignment = StringAlignment.Far; + format.LineAlignment = StringAlignment.Center; + return format; + } + if (alignment != ContentAlignment.BottomLeft){ + return format; + } + } + else{ + if (alignment != ContentAlignment.BottomCenter){ + if (alignment == ContentAlignment.BottomRight) + { + format.Alignment = StringAlignment.Far; + format.LineAlignment = StringAlignment.Far; + } + return format; + } + format.Alignment = StringAlignment.Center; + format.LineAlignment = StringAlignment.Far; + return format; + } + format.Alignment = StringAlignment.Near; + format.LineAlignment = StringAlignment.Far; + return format; + } } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs index 676762d638..4d35219e5a 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/ReportSettings.cs @@ -48,7 +48,7 @@ namespace SharpReportCore{ private System.Data.CommandType commandType; private Font defaultFont = new Font("Microsoft Sans Serif", - 16, + 10, FontStyle.Regular, GraphicsUnit.Point); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj index 1035d4d71a..784104e2f2 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj @@ -10,7 +10,7 @@ False False Auto - 4194304 + 123731968 AnyCPU 4096 4 diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlHelper.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlHelper.cs index 751fbfa4e0..a1634f9aa2 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlHelper.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Xml/XmlHelper.cs @@ -121,6 +121,7 @@ namespace SharpReportCore { XmlElement ctrlElem, BaseReportItem item) { + item.SuspendLayout(); try { XmlNodeList nodeList = ctrlElem.ChildNodes; foreach (XmlNode node in nodeList) { @@ -130,7 +131,6 @@ namespace SharpReportCore { if (elem.Name == "Font") { item.Font = XmlFormReader.MakeFont (elem.GetAttribute("value")); } - reader.SetValue (item, elem.Name,elem.GetAttribute("value")); } @@ -138,6 +138,8 @@ namespace SharpReportCore { } } catch (Exception) { throw; + } finally { + item.ResumeLayout(); } } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.csproj b/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.csproj index dced015dd0..cc6b8c2efc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.csproj +++ b/src/AddIns/Misc/SharpReport/SharpReportWizard/ReportGenerator.csproj @@ -10,7 +10,7 @@ False False Auto - 4194304 + 126353408 AnyCPU 4096 4 diff --git a/src/AddIns/Misc/StartPage/Project/StartPage.csproj b/src/AddIns/Misc/StartPage/Project/StartPage.csproj index 4e42094d7d..53d566d134 100644 --- a/src/AddIns/Misc/StartPage/Project/StartPage.csproj +++ b/src/AddIns/Misc/StartPage/Project/StartPage.csproj @@ -13,15 +13,21 @@ OnSuccessfulBuild Library ICSharpCode.StartPage + False + Auto + 126877696 + AnyCPU + 4096 - True + true False False True ..\..\..\..\..\AddIns\AddIns\Misc\StartPage\ - True + true DEBUG + Full False diff --git a/src/AddIns/Misc/UnitTesting/UnitTesting.csproj b/src/AddIns/Misc/UnitTesting/UnitTesting.csproj index 9c56519d06..4585ae549c 100644 --- a/src/AddIns/Misc/UnitTesting/UnitTesting.csproj +++ b/src/AddIns/Misc/UnitTesting/UnitTesting.csproj @@ -11,7 +11,7 @@ False False Auto - 4194304 + 127401984 AnyCPU 4096 4 diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/WinFormsUI.csproj b/src/Libraries/DockPanel_Src/WinFormsUI/WinFormsUI.csproj index 679c73f462..c0f95f0a8d 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/WinFormsUI.csproj +++ b/src/Libraries/DockPanel_Src/WinFormsUI/WinFormsUI.csproj @@ -16,11 +16,12 @@ WeifenLuo.WinFormsUI OnBuildSuccess true + Auto + AnyCPU bin\Debug\ - false - 285212672 + 101187584 false @@ -38,11 +39,16 @@ false 4 -Microsoft.Design#CA1012;-Microsoft.Design#CA2210;-Microsoft.Design#CA1040;-Microsoft.Design#CA1005;-Microsoft.Design#CA1020;-Microsoft.Design#CA1021;-Microsoft.Design#CA1010;-Microsoft.Design#CA1011;-Microsoft.Design#CA1009;-Microsoft.Design#CA1050;-Microsoft.Design#CA1026;-Microsoft.Design#CA1019;-Microsoft.Design#CA1031;-Microsoft.Design#CA1047;-Microsoft.Design#CA1000;-Microsoft.Design#CA1048;-Microsoft.Design#CA1051;-Microsoft.Design#CA1002;-Microsoft.Design#CA1061;-Microsoft.Design#CA1006;-Microsoft.Design#CA1046;-Microsoft.Design#CA1045;-Microsoft.Design#CA1038;-Microsoft.Design#CA1008;-Microsoft.Design#CA1028;-Microsoft.Design#CA1004;-Microsoft.Design#CA1035;-Microsoft.Design#CA1063;-Microsoft.Design#CA1032;-Microsoft.Design#CA1023;-Microsoft.Design#CA1033;-Microsoft.Design#CA1039;-Microsoft.Design#CA1016;-Microsoft.Design#CA1014;-Microsoft.Design#CA1017;-Microsoft.Design#CA1018;-Microsoft.Design#CA1027;-Microsoft.Design#CA1059;-Microsoft.Design#CA1060;-Microsoft.Design#CA1034;-Microsoft.Design#CA1013;-Microsoft.Design#CA1036;-Microsoft.Design#CA1044;-Microsoft.Design#CA1041;-Microsoft.Design#CA1025;-Microsoft.Design#CA1052;-Microsoft.Design#CA1053;-Microsoft.Design#CA1057;-Microsoft.Design#CA1058;-Microsoft.Design#CA1001;-Microsoft.Design#CA1049;-Microsoft.Design#CA1054;-Microsoft.Design#CA1056;-Microsoft.Design#CA1055;-Microsoft.Design#CA1030;-Microsoft.Design#CA1003;-Microsoft.Design#CA1007;-Microsoft.Design#CA1043;-Microsoft.Design#CA1024;-Microsoft.Design#CA1062;-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302;-Microsoft.Globalization#CA1303;-Microsoft.Globalization#CA1306;-Microsoft.Globalization#CA1304;-Microsoft.Globalization#CA1305;-Microsoft.Globalization#CA1300;-Microsoft.Maintainability#CA1502;-Microsoft.Maintainability#CA1501;-Microsoft.Maintainability#CA1500;-Microsoft.Naming#CA1718;-Microsoft.Naming#CA1720;-Microsoft.Naming#CA1700;-Microsoft.Naming#CA1712;-Microsoft.Naming#CA1713;-Microsoft.Naming#CA1709;-Microsoft.Naming#CA1708;-Microsoft.Naming#CA1715;-Microsoft.Naming#CA1710;-Microsoft.Naming#CA1707;-Microsoft.Naming#CA1722;-Microsoft.Naming#CA1711;-Microsoft.Naming#CA1716;-Microsoft.Naming#CA1705;-Microsoft.Naming#CA1725;-Microsoft.Naming#CA1719;-Microsoft.Naming#CA1721;-Microsoft.Naming#CA1706;-Microsoft.Naming#CA1724;-Microsoft.Naming#CA1726;-Microsoft.Performance#CA1809;-Microsoft.Performance#CA1811;-Microsoft.Performance#CA1812;-Microsoft.Performance#CA1807;-Microsoft.Performance#CA1813;-Microsoft.Performance#CA1823;-Microsoft.Performance#CA1816;-Microsoft.Performance#CA1817;-Microsoft.Performance#CA1800;-Microsoft.Performance#CA1818;-Microsoft.Performance#CA1805;-Microsoft.Performance#CA1810;-Microsoft.Performance#CA1822;-Microsoft.Performance#CA1815;-Microsoft.Performance#CA1814;-Microsoft.Performance#CA1819;-Microsoft.Performance#CA1804;-Microsoft.Performance#CA1820;-Microsoft.Performance#CA1802;-Microsoft.Security#CA2116;-Microsoft.Security#CA2117;-Microsoft.Security#CA2105;-Microsoft.Security#CA2115;-Microsoft.Security#CA2104;-Microsoft.Security#CA2122;-Microsoft.Security#CA2114;-Microsoft.Security#CA2123;-Microsoft.Security#CA2111;-Microsoft.Security#CA2108;-Microsoft.Security#CA2107;-Microsoft.Security#CA2103;-Microsoft.Security#CA2100;-Microsoft.Security#CA2118;-Microsoft.Security#CA2109;-Microsoft.Security#CA2119;-Microsoft.Security#CA2106;-Microsoft.Security#CA2112;-Microsoft.Security#CA2110;-Microsoft.Security#CA2120;-Microsoft.Security#CA2101;-Microsoft.Security#CA2121;-Microsoft.Security#CA2126;-Microsoft.Security#CA2124;-Microsoft.Usage#CA2209;-Microsoft.Usage#CA2236;-Microsoft.Usage#CA2227;-Microsoft.Usage#CA2213;-Microsoft.Usage#CA2216;-Microsoft.Usage#CA2215;-Microsoft.Usage#CA2214;-Microsoft.Usage#CA2222;-Microsoft.Usage#CA2202;-Microsoft.Usage#CA1806;-Microsoft.Usage#CA2217;-Microsoft.Usage#CA2212;-Microsoft.Usage#CA2219;-Microsoft.Usage#CA2201;-Microsoft.Usage#CA2228;-Microsoft.Usage#CA2221;-Microsoft.Usage#CA2220;-Microsoft.Usage#CA2240;-Microsoft.Usage#CA2229;-Microsoft.Usage#CA2238;-Microsoft.Usage#CA2207;-Microsoft.Usage#CA2208;-Microsoft.Usage#CA2235;-Microsoft.Usage#CA2237;-Microsoft.Usage#CA2232;-Microsoft.Usage#CA2223;-Microsoft.Usage#CA2211;-Microsoft.Usage#CA2233;-Microsoft.Usage#CA2225;-Microsoft.Usage#CA2226;-Microsoft.Usage#CA2231;-Microsoft.Usage#CA2224;-Microsoft.Usage#CA2218;-Microsoft.Usage#CA2234;-Microsoft.Usage#CA2241;-Microsoft.Usage#CA2239;-Microsoft.Usage#CA2200;-Microsoft.Usage#CA1801;-Microsoft.Usage#CA2205;-Microsoft.Usage#CA2230 + Full + False + False + False + false bin\Release\ false - 285212672 + 101187584 false @@ -59,6 +65,7 @@ false false 4 + None diff --git a/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj b/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj index 0767967c80..7dd19b6c80 100644 --- a/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj +++ b/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj @@ -11,7 +11,7 @@ False False Auto - 92405760 + 102760448 AnyCPU 4096 4 diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj b/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj index ef8d09bda8..a0d9f863b2 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj +++ b/src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj @@ -17,7 +17,7 @@ ICSharpCode.TextEditor False Auto - 90177536 + 98041856 AnyCPU 4096 ..\src\Tools\UpdateAssemblyInfo\bin\Debug\UpdateAssemblyInfo.exe @@ -204,4 +204,4 @@ - + \ No newline at end of file diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Boo.xshd b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Boo.xshd index 2e093d2cf0..ee793c29ba 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Boo.xshd +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Boo.xshd @@ -173,6 +173,7 @@ + diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs index f2e31b4614..7833b6662f 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs @@ -24,6 +24,14 @@ namespace ICSharpCode.TextEditor.Document List rules = new List(); Dictionary environmentColors = new Dictionary(); + + public IEnumerable> EnvironmentColors { + get { + return environmentColors; + } + } + + Dictionary properties = new Dictionary(); string[] extensions; diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/AbstractCompletionWindow.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/AbstractCompletionWindow.cs index b20b72ec3e..94ae8d670b 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/AbstractCompletionWindow.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/AbstractCompletionWindow.cs @@ -41,6 +41,7 @@ namespace ICSharpCode.TextEditor.Gui.CompletionWindow StartPosition = FormStartPosition.Manual; FormBorderStyle = FormBorderStyle.None; ShowInTaskbar = false; + MinimumSize = new Size(1, 1); Size = new Size(1, 1); } diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/Ime.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/Ime.cs index 8334f73a76..bf5b3012ca 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/Ime.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/Ime.cs @@ -8,6 +8,7 @@ using System; using System.Runtime.InteropServices; using System.Drawing; +using System.Windows.Forms; namespace ICSharpCode.TextEditor { @@ -31,15 +32,11 @@ namespace ICSharpCode.TextEditor return font; } set { - if (font == null) { + if (!value.Equals(font)) { font = value; lf = null; + SetIMEWindowFont(value); } - else if (font.Equals(value) == false) { - font = value; - lf = null; - } - SetIMEWindowFont(value); } } @@ -113,25 +110,33 @@ namespace ICSharpCode.TextEditor } private const int IMC_SETCOMPOSITIONFONT = 0x000a; LOGFONT lf = null; + static bool disableIME; private void SetIMEWindowFont(Font f) { + if (disableIME || hIMEWnd == IntPtr.Zero) return; + if (lf == null) { lf = new LOGFONT(); f.ToLogFont(lf); lf.lfFaceName = f.Name; // This is very important! "Font.ToLogFont" Method sets invalid value to LOGFONT.lfFaceName } - SendMessage( - hIMEWnd, - WM_IME_CONTROL, - new IntPtr(IMC_SETCOMPOSITIONFONT), - lf - ); + try { + SendMessage( + hIMEWnd, + WM_IME_CONTROL, + new IntPtr(IMC_SETCOMPOSITIONFONT), + lf + ); + } catch (AccessViolationException ex) { + Handle(ex); + } } public void SetIMEWindowLocation(int x, int y) { + if (disableIME || hIMEWnd == IntPtr.Zero) return; POINT p = new POINT(); p.x = x; @@ -142,12 +147,25 @@ namespace ICSharpCode.TextEditor lParam.ptCurrentPos = p; lParam.rcArea = new RECT(); - SendMessage( - hIMEWnd, - WM_IME_CONTROL, - new IntPtr(IMC_SETCOMPOSITIONWINDOW), - lParam - ); + try { + SendMessage( + hIMEWnd, + WM_IME_CONTROL, + new IntPtr(IMC_SETCOMPOSITIONWINDOW), + lParam + ); + } catch (AccessViolationException ex) { + Handle(ex); + } + } + + void Handle(Exception ex) + { + Console.WriteLine(ex); + if (!disableIME) { + disableIME = true; + MessageBox.Show("Error calling IME: " + ex.Message + "\nIME is disabled.", "IME error"); + } } } } diff --git a/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/GlobalLevel.cs b/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/GlobalLevel.cs index 1386a08155..3760f26e91 100644 --- a/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/GlobalLevel.cs +++ b/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/GlobalLevel.cs @@ -55,6 +55,7 @@ namespace NRefactoryASTGenerator.AST ClassType type; List baseTypes; List templates; + Point bodyStartLocation; public TypeDeclaration(Modifier modifier, List attributes) : base(modifier, attributes) {} } diff --git a/src/Libraries/NRefactory/Project/NRefactory.csproj b/src/Libraries/NRefactory/Project/NRefactory.csproj index 8f6e9ff08d..4f9d9a434a 100644 --- a/src/Libraries/NRefactory/Project/NRefactory.csproj +++ b/src/Libraries/NRefactory/Project/NRefactory.csproj @@ -18,7 +18,7 @@ False False Auto - 88080384 + 94896128 AnyCPU 4096 ..\src\Tools\UpdateAssemblyInfo\bin\Debug\UpdateAssemblyInfo.exe diff --git a/src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs b/src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs index ba3f1381d8..5eb7883cdc 100644 --- a/src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs +++ b/src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs @@ -22,6 +22,14 @@ namespace ICSharpCode.NRefactory.Parser.CSharp { } + void ReadPreProcessingDirective() + { + Point start = new Point(Col - 1, Line); + string directive = ReadIdent('#'); + string argument = ReadToEOL(); + this.specialTracker.AddPreProcessingDirective(directive, argument.Trim(), start, new Point(start.X + directive.Length + argument.Length, start.Y)); + } + protected override Token Next() { int nextChar; @@ -47,10 +55,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp } break; case '#': - Point start = new Point(Col - 1, Line); - string directive = ReadIdent('#'); - string argument = ReadToEOL(); - this.specialTracker.AddPreProcessingDirective(directive, argument.Trim(), start, new Point(start.X + directive.Length + argument.Length, start.Y)); + ReadPreProcessingDirective(); continue; case '"': token = ReadString(); @@ -817,7 +822,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp } break; case '#': - SkipToEOL(); + ReadPreProcessingDirective(); break; case '"': ReadString(); diff --git a/src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMOutputVisitor.cs b/src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMOutputVisitor.cs index c5b52a8798..d377b36a39 100644 --- a/src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMOutputVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMOutputVisitor.cs @@ -1,7 +1,7 @@ // // // -// +// // $Revision$ // @@ -896,6 +896,9 @@ namespace ICSharpCode.NRefactory.Parser IdentifierExpression identifier = fieldReferenceExpression.TargetObject as IdentifierExpression; if (identifier != null) return !IsField(identifier.Identifier) && !IsLocalVariable(identifier.Identifier); + TypeReferenceExpression tre = fieldReferenceExpression.TargetObject as TypeReferenceExpression; + if (tre != null) + return true; return false; } @@ -959,6 +962,9 @@ namespace ICSharpCode.NRefactory.Parser type = new StringBuilder(oldType); } return new CodeTypeReferenceExpression(type.ToString()); + } else if (fieldReferenceExpression.TargetObject is TypeReferenceExpression) { + type.Insert(0, ((TypeReferenceExpression)fieldReferenceExpression.TargetObject).TypeReference.SystemType); + return new CodeTypeReferenceExpression(type.ToString()); } else { return null; } diff --git a/src/Libraries/NRefactory/Project/Src/Parser/AST/General/CompilationUnit.cs b/src/Libraries/NRefactory/Project/Src/Parser/AST/General/CompilationUnit.cs index b8c98a30ac..d5958235bc 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/AST/General/CompilationUnit.cs +++ b/src/Libraries/NRefactory/Project/Src/Parser/AST/General/CompilationUnit.cs @@ -34,6 +34,12 @@ namespace ICSharpCode.NRefactory.Parser.AST blockStack.Pop(); } + public INode CurrentBock { + get { + return blockStack.Count > 0 ? (INode)blockStack.Peek() : null; + } + } + public override void AddChild(INode childNode) { if (childNode != null) { diff --git a/src/Libraries/NRefactory/Project/Src/Parser/AST/Generated.cs b/src/Libraries/NRefactory/Project/Src/Parser/AST/Generated.cs index e4bf8c6883..f9098a57ff 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/AST/Generated.cs +++ b/src/Libraries/NRefactory/Project/Src/Parser/AST/Generated.cs @@ -3806,6 +3806,8 @@ namespace ICSharpCode.NRefactory.Parser.AST { List templates; + Point bodyStartLocation; + public string Name { get { return name; @@ -3842,12 +3844,22 @@ namespace ICSharpCode.NRefactory.Parser.AST { } } + public Point BodyStartLocation { + get { + return bodyStartLocation; + } + set { + bodyStartLocation = value; + } + } + public TypeDeclaration(Modifier modifier, List attributes) : base(attributes) { Modifier = modifier; name = ""; baseTypes = new List(); templates = new List(); + bodyStartLocation = new Point(-1, -1); } public override object AcceptVisitor(IAstVisitor visitor, object data) { @@ -3855,8 +3867,8 @@ namespace ICSharpCode.NRefactory.Parser.AST { } public override string ToString() { - return string.Format("[TypeDeclaration Name={0} Type={1} BaseTypes={2} Templates={3} Attributes={4} Mod" + - "ifier={5}]", Name, Type, GetCollectionString(BaseTypes), GetCollectionString(Templates), GetCollectionString(Attributes), Modifier); + return string.Format("[TypeDeclaration Name={0} Type={1} BaseTypes={2} Templates={3} BodyStartLocation=" + + "{4} Attributes={5} Modifier={6}]", Name, Type, GetCollectionString(BaseTypes), GetCollectionString(Templates), BodyStartLocation, GetCollectionString(Attributes), Modifier); } } diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs index 19ada8eef1..6ca859f3cc 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs +++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs @@ -694,70 +694,70 @@ m, attributes); } void Qualident( -#line 931 "cs.ATG" +#line 935 "cs.ATG" out string qualident) { Expect(1); -#line 933 "cs.ATG" +#line 937 "cs.ATG" qualidentBuilder.Length = 0; qualidentBuilder.Append(t.val); while ( -#line 934 "cs.ATG" +#line 938 "cs.ATG" DotAndIdent()) { Expect(15); Expect(1); -#line 934 "cs.ATG" +#line 938 "cs.ATG" qualidentBuilder.Append('.'); qualidentBuilder.Append(t.val); } -#line 937 "cs.ATG" +#line 941 "cs.ATG" qualident = qualidentBuilder.ToString(); } void NonArrayType( -#line 1041 "cs.ATG" +#line 1050 "cs.ATG" out TypeReference type) { -#line 1043 "cs.ATG" +#line 1052 "cs.ATG" string name; int pointer = 0; type = null; if (la.kind == 1 || la.kind == 90 || la.kind == 107) { ClassType( -#line 1048 "cs.ATG" +#line 1057 "cs.ATG" out type, false); } else if (StartOf(4)) { SimpleType( -#line 1049 "cs.ATG" +#line 1058 "cs.ATG" out name); -#line 1049 "cs.ATG" +#line 1058 "cs.ATG" type = new TypeReference(name); } else if (la.kind == 122) { lexer.NextToken(); Expect(6); -#line 1050 "cs.ATG" +#line 1059 "cs.ATG" pointer = 1; type = new TypeReference("void"); } else SynErr(127); if (la.kind == 12) { NullableQuestionMark( -#line 1053 "cs.ATG" +#line 1062 "cs.ATG" ref type); } while ( -#line 1055 "cs.ATG" +#line 1064 "cs.ATG" IsPointer()) { Expect(6); -#line 1056 "cs.ATG" +#line 1065 "cs.ATG" ++pointer; } -#line 1058 "cs.ATG" +#line 1067 "cs.ATG" if (type != null) { type.PointerNestingLevel = pointer; } } @@ -862,60 +862,60 @@ out expr); } void Expr( -#line 2077 "cs.ATG" +#line 2086 "cs.ATG" out Expression expr) { -#line 2078 "cs.ATG" +#line 2087 "cs.ATG" expr = null; Expression expr1 = null, expr2 = null; AssignmentOperatorType op; UnaryExpr( -#line 2080 "cs.ATG" +#line 2089 "cs.ATG" out expr); if (StartOf(6)) { AssignmentOperator( -#line 2083 "cs.ATG" +#line 2092 "cs.ATG" out op); Expr( -#line 2083 "cs.ATG" +#line 2092 "cs.ATG" out expr1); -#line 2083 "cs.ATG" +#line 2092 "cs.ATG" expr = new AssignmentExpression(expr, op, expr1); } else if ( -#line 2084 "cs.ATG" +#line 2093 "cs.ATG" la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) { AssignmentOperator( -#line 2085 "cs.ATG" +#line 2094 "cs.ATG" out op); Expr( -#line 2085 "cs.ATG" +#line 2094 "cs.ATG" out expr1); -#line 2085 "cs.ATG" +#line 2094 "cs.ATG" expr = new AssignmentExpression(expr, op, expr1); } else if (StartOf(7)) { ConditionalOrExpr( -#line 2087 "cs.ATG" +#line 2096 "cs.ATG" ref expr); if (la.kind == 13) { lexer.NextToken(); Expr( -#line 2088 "cs.ATG" +#line 2097 "cs.ATG" out expr1); -#line 2088 "cs.ATG" +#line 2097 "cs.ATG" expr = new BinaryOperatorExpression(expr, BinaryOperatorType.NullCoalescing, expr1); } if (la.kind == 12) { lexer.NextToken(); Expr( -#line 2089 "cs.ATG" +#line 2098 "cs.ATG" out expr1); Expect(9); Expr( -#line 2089 "cs.ATG" +#line 2098 "cs.ATG" out expr2); -#line 2089 "cs.ATG" +#line 2098 "cs.ATG" expr = new ConditionalExpression(expr, expr1, expr2); } } else SynErr(129); @@ -992,76 +992,76 @@ out attribute); } void TypeModifier( -#line 1128 "cs.ATG" +#line 1137 "cs.ATG" Modifiers m) { switch (la.kind) { case 88: { lexer.NextToken(); -#line 1130 "cs.ATG" +#line 1139 "cs.ATG" m.Add(Modifier.New, t.Location); break; } case 97: { lexer.NextToken(); -#line 1131 "cs.ATG" +#line 1140 "cs.ATG" m.Add(Modifier.Public, t.Location); break; } case 96: { lexer.NextToken(); -#line 1132 "cs.ATG" +#line 1141 "cs.ATG" m.Add(Modifier.Protected, t.Location); break; } case 83: { lexer.NextToken(); -#line 1133 "cs.ATG" +#line 1142 "cs.ATG" m.Add(Modifier.Internal, t.Location); break; } case 95: { lexer.NextToken(); -#line 1134 "cs.ATG" +#line 1143 "cs.ATG" m.Add(Modifier.Private, t.Location); break; } case 118: { lexer.NextToken(); -#line 1135 "cs.ATG" +#line 1144 "cs.ATG" m.Add(Modifier.Unsafe, t.Location); break; } case 48: { lexer.NextToken(); -#line 1136 "cs.ATG" +#line 1145 "cs.ATG" m.Add(Modifier.Abstract, t.Location); break; } case 102: { lexer.NextToken(); -#line 1137 "cs.ATG" +#line 1146 "cs.ATG" m.Add(Modifier.Sealed, t.Location); break; } case 106: { lexer.NextToken(); -#line 1138 "cs.ATG" +#line 1147 "cs.ATG" m.Add(Modifier.Static, t.Location); break; } case 1: { lexer.NextToken(); -#line 1139 "cs.ATG" +#line 1148 "cs.ATG" if (t.val == "partial") { m.Add(Modifier.Partial, t.Location); } else { Error("Unexpected identifier"); } break; } @@ -1119,23 +1119,26 @@ IdentIsWhere()) { #line 841 "cs.ATG" templates); } + +#line 843 "cs.ATG" + newType.BodyStartLocation = t.EndLocation; ClassBody(); if (la.kind == 11) { lexer.NextToken(); } -#line 844 "cs.ATG" +#line 845 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else if (StartOf(8)) { -#line 847 "cs.ATG" +#line 848 "cs.ATG" m.Check(Modifier.StructsInterfacesEnumsDelegates); if (la.kind == 108) { lexer.NextToken(); -#line 848 "cs.ATG" +#line 849 "cs.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); templates = newType.Templates; newType.StartLocation = m.GetDeclarationLocation(t.Location); @@ -1145,41 +1148,44 @@ templates); Expect(1); -#line 855 "cs.ATG" +#line 856 "cs.ATG" newType.Name = t.val; if (la.kind == 23) { TypeParameterList( -#line 858 "cs.ATG" +#line 859 "cs.ATG" templates); } if (la.kind == 9) { StructInterfaces( -#line 860 "cs.ATG" +#line 861 "cs.ATG" out names); -#line 860 "cs.ATG" +#line 861 "cs.ATG" newType.BaseTypes = names; } while ( -#line 863 "cs.ATG" +#line 864 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 863 "cs.ATG" +#line 864 "cs.ATG" templates); } + +#line 867 "cs.ATG" + newType.BodyStartLocation = t.EndLocation; StructBody(); if (la.kind == 11) { lexer.NextToken(); } -#line 867 "cs.ATG" +#line 869 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else if (la.kind == 82) { lexer.NextToken(); -#line 871 "cs.ATG" +#line 873 "cs.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); templates = newType.Templates; compilationUnit.AddChild(newType); @@ -1189,41 +1195,44 @@ templates); Expect(1); -#line 878 "cs.ATG" +#line 880 "cs.ATG" newType.Name = t.val; if (la.kind == 23) { TypeParameterList( -#line 881 "cs.ATG" +#line 883 "cs.ATG" templates); } if (la.kind == 9) { InterfaceBase( -#line 883 "cs.ATG" +#line 885 "cs.ATG" out names); -#line 883 "cs.ATG" +#line 885 "cs.ATG" newType.BaseTypes = names; } while ( -#line 886 "cs.ATG" +#line 888 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 886 "cs.ATG" +#line 888 "cs.ATG" templates); } + +#line 890 "cs.ATG" + newType.BodyStartLocation = t.EndLocation; InterfaceBody(); if (la.kind == 11) { lexer.NextToken(); } -#line 889 "cs.ATG" +#line 892 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else if (la.kind == 67) { lexer.NextToken(); -#line 893 "cs.ATG" +#line 896 "cs.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); @@ -1232,78 +1241,81 @@ templates); Expect(1); -#line 899 "cs.ATG" +#line 902 "cs.ATG" newType.Name = t.val; if (la.kind == 9) { lexer.NextToken(); IntegralType( -#line 900 "cs.ATG" +#line 903 "cs.ATG" out name); -#line 900 "cs.ATG" +#line 903 "cs.ATG" newType.BaseTypes.Add(new TypeReference(name)); } + +#line 905 "cs.ATG" + newType.BodyStartLocation = t.EndLocation; EnumBody(); if (la.kind == 11) { lexer.NextToken(); } -#line 903 "cs.ATG" +#line 907 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else { lexer.NextToken(); -#line 907 "cs.ATG" +#line 911 "cs.ATG" DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes); templates = delegateDeclr.Templates; delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location); if ( -#line 911 "cs.ATG" +#line 915 "cs.ATG" NotVoidPointer()) { Expect(122); -#line 911 "cs.ATG" +#line 915 "cs.ATG" delegateDeclr.ReturnType = new TypeReference("void", 0, null); } else if (StartOf(9)) { Type( -#line 912 "cs.ATG" +#line 916 "cs.ATG" out type); -#line 912 "cs.ATG" +#line 916 "cs.ATG" delegateDeclr.ReturnType = type; } else SynErr(131); Expect(1); -#line 914 "cs.ATG" +#line 918 "cs.ATG" delegateDeclr.Name = t.val; if (la.kind == 23) { TypeParameterList( -#line 917 "cs.ATG" +#line 921 "cs.ATG" templates); } Expect(20); if (StartOf(10)) { FormalParameterList( -#line 919 "cs.ATG" +#line 923 "cs.ATG" p); -#line 919 "cs.ATG" +#line 923 "cs.ATG" delegateDeclr.Parameters = p; } Expect(21); while ( -#line 923 "cs.ATG" +#line 927 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 923 "cs.ATG" +#line 927 "cs.ATG" templates); } Expect(11); -#line 925 "cs.ATG" +#line 929 "cs.ATG" delegateDeclr.EndLocation = t.Location; compilationUnit.AddChild(delegateDeclr); @@ -1312,90 +1324,90 @@ templates); } void TypeParameterList( -#line 2480 "cs.ATG" +#line 2489 "cs.ATG" List templates) { -#line 2482 "cs.ATG" +#line 2491 "cs.ATG" AttributeSection section; List attributes = new List(); Expect(23); while (la.kind == 18) { AttributeSection( -#line 2486 "cs.ATG" +#line 2495 "cs.ATG" out section); -#line 2486 "cs.ATG" +#line 2495 "cs.ATG" attributes.Add(section); } Expect(1); -#line 2487 "cs.ATG" +#line 2496 "cs.ATG" templates.Add(new TemplateDefinition(t.val, attributes)); while (la.kind == 14) { lexer.NextToken(); while (la.kind == 18) { AttributeSection( -#line 2488 "cs.ATG" +#line 2497 "cs.ATG" out section); -#line 2488 "cs.ATG" +#line 2497 "cs.ATG" attributes.Add(section); } Expect(1); -#line 2489 "cs.ATG" +#line 2498 "cs.ATG" templates.Add(new TemplateDefinition(t.val, attributes)); } Expect(22); } void ClassBase( -#line 940 "cs.ATG" +#line 944 "cs.ATG" out List names) { -#line 942 "cs.ATG" +#line 946 "cs.ATG" TypeReference typeRef; names = new List(); Expect(9); ClassType( -#line 946 "cs.ATG" +#line 950 "cs.ATG" out typeRef, false); -#line 946 "cs.ATG" +#line 950 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } while (la.kind == 14) { lexer.NextToken(); TypeName( -#line 947 "cs.ATG" +#line 951 "cs.ATG" out typeRef, false); -#line 947 "cs.ATG" +#line 951 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } } } void TypeParameterConstraintsClause( -#line 2493 "cs.ATG" +#line 2502 "cs.ATG" List templates) { -#line 2494 "cs.ATG" +#line 2503 "cs.ATG" string name = ""; TypeReference type; Expect(1); -#line 2496 "cs.ATG" +#line 2505 "cs.ATG" if (t.val != "where") Error("where expected"); Expect(1); -#line 2497 "cs.ATG" +#line 2506 "cs.ATG" name = t.val; Expect(9); TypeParameterConstraintsClauseBase( -#line 2499 "cs.ATG" +#line 2508 "cs.ATG" out type); -#line 2500 "cs.ATG" +#line 2509 "cs.ATG" TemplateDefinition td = null; foreach (TemplateDefinition d in templates) { if (d.Name == name) { @@ -1408,10 +1420,10 @@ out type); while (la.kind == 14) { lexer.NextToken(); TypeParameterConstraintsClauseBase( -#line 2509 "cs.ATG" +#line 2518 "cs.ATG" out type); -#line 2510 "cs.ATG" +#line 2519 "cs.ATG" td = null; foreach (TemplateDefinition d in templates) { if (d.Name == name) { @@ -1426,110 +1438,110 @@ out type); void ClassBody() { -#line 951 "cs.ATG" +#line 955 "cs.ATG" AttributeSection section; Expect(16); while (StartOf(11)) { -#line 954 "cs.ATG" +#line 958 "cs.ATG" List attributes = new List(); Modifiers m = new Modifiers(); while (la.kind == 18) { AttributeSection( -#line 957 "cs.ATG" +#line 961 "cs.ATG" out section); -#line 957 "cs.ATG" +#line 961 "cs.ATG" attributes.Add(section); } MemberModifiers( -#line 958 "cs.ATG" +#line 962 "cs.ATG" m); ClassMemberDecl( -#line 959 "cs.ATG" +#line 963 "cs.ATG" m, attributes); } Expect(17); } void StructInterfaces( -#line 964 "cs.ATG" +#line 968 "cs.ATG" out List names) { -#line 966 "cs.ATG" +#line 970 "cs.ATG" TypeReference typeRef; names = new List(); Expect(9); TypeName( -#line 970 "cs.ATG" +#line 974 "cs.ATG" out typeRef, false); -#line 970 "cs.ATG" +#line 974 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } while (la.kind == 14) { lexer.NextToken(); TypeName( -#line 971 "cs.ATG" +#line 975 "cs.ATG" out typeRef, false); -#line 971 "cs.ATG" +#line 975 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } } } void StructBody() { -#line 975 "cs.ATG" +#line 979 "cs.ATG" AttributeSection section; Expect(16); while (StartOf(12)) { -#line 978 "cs.ATG" +#line 982 "cs.ATG" List attributes = new List(); Modifiers m = new Modifiers(); while (la.kind == 18) { AttributeSection( -#line 981 "cs.ATG" +#line 985 "cs.ATG" out section); -#line 981 "cs.ATG" +#line 985 "cs.ATG" attributes.Add(section); } MemberModifiers( -#line 982 "cs.ATG" +#line 986 "cs.ATG" m); StructMemberDecl( -#line 983 "cs.ATG" +#line 987 "cs.ATG" m, attributes); } Expect(17); } void InterfaceBase( -#line 988 "cs.ATG" +#line 992 "cs.ATG" out List names) { -#line 990 "cs.ATG" +#line 994 "cs.ATG" TypeReference typeRef; names = new List(); Expect(9); TypeName( -#line 994 "cs.ATG" +#line 998 "cs.ATG" out typeRef, false); -#line 994 "cs.ATG" +#line 998 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } while (la.kind == 14) { lexer.NextToken(); TypeName( -#line 995 "cs.ATG" +#line 999 "cs.ATG" out typeRef, false); -#line 995 "cs.ATG" +#line 999 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } } } @@ -1543,72 +1555,72 @@ out typeRef, false); } void IntegralType( -#line 1150 "cs.ATG" +#line 1159 "cs.ATG" out string name) { -#line 1150 "cs.ATG" +#line 1159 "cs.ATG" name = ""; switch (la.kind) { case 101: { lexer.NextToken(); -#line 1152 "cs.ATG" +#line 1161 "cs.ATG" name = "sbyte"; break; } case 53: { lexer.NextToken(); -#line 1153 "cs.ATG" +#line 1162 "cs.ATG" name = "byte"; break; } case 103: { lexer.NextToken(); -#line 1154 "cs.ATG" +#line 1163 "cs.ATG" name = "short"; break; } case 119: { lexer.NextToken(); -#line 1155 "cs.ATG" +#line 1164 "cs.ATG" name = "ushort"; break; } case 81: { lexer.NextToken(); -#line 1156 "cs.ATG" +#line 1165 "cs.ATG" name = "int"; break; } case 115: { lexer.NextToken(); -#line 1157 "cs.ATG" +#line 1166 "cs.ATG" name = "uint"; break; } case 86: { lexer.NextToken(); -#line 1158 "cs.ATG" +#line 1167 "cs.ATG" name = "long"; break; } case 116: { lexer.NextToken(); -#line 1159 "cs.ATG" +#line 1168 "cs.ATG" name = "ulong"; break; } case 56: { lexer.NextToken(); -#line 1160 "cs.ATG" +#line 1169 "cs.ATG" name = "char"; break; } @@ -1618,25 +1630,25 @@ out string name) { void EnumBody() { -#line 1001 "cs.ATG" +#line 1008 "cs.ATG" FieldDeclaration f; Expect(16); if (la.kind == 1 || la.kind == 18) { EnumMemberDecl( -#line 1003 "cs.ATG" +#line 1011 "cs.ATG" out f); -#line 1003 "cs.ATG" +#line 1011 "cs.ATG" compilationUnit.AddChild(f); while ( -#line 1004 "cs.ATG" +#line 1012 "cs.ATG" NotFinalComma()) { Expect(14); EnumMemberDecl( -#line 1004 "cs.ATG" +#line 1013 "cs.ATG" out f); -#line 1004 "cs.ATG" +#line 1013 "cs.ATG" compilationUnit.AddChild(f); } if (la.kind == 14) { @@ -1647,36 +1659,36 @@ out f); } void Type( -#line 1009 "cs.ATG" +#line 1018 "cs.ATG" out TypeReference type) { TypeWithRestriction( -#line 1011 "cs.ATG" +#line 1020 "cs.ATG" out type, true, false); } void FormalParameterList( -#line 1072 "cs.ATG" +#line 1081 "cs.ATG" List parameter) { -#line 1075 "cs.ATG" +#line 1084 "cs.ATG" ParameterDeclarationExpression p; AttributeSection section; List attributes = new List(); while (la.kind == 18) { AttributeSection( -#line 1080 "cs.ATG" +#line 1089 "cs.ATG" out section); -#line 1080 "cs.ATG" +#line 1089 "cs.ATG" attributes.Add(section); } if (StartOf(14)) { FixedParameter( -#line 1082 "cs.ATG" +#line 1091 "cs.ATG" out p); -#line 1082 "cs.ATG" +#line 1091 "cs.ATG" bool paramsFound = false; p.Attributes = attributes; parameter.Add(p); @@ -1684,96 +1696,96 @@ out p); while (la.kind == 14) { lexer.NextToken(); -#line 1087 "cs.ATG" +#line 1096 "cs.ATG" attributes = new List(); if (paramsFound) Error("params array must be at end of parameter list"); while (la.kind == 18) { AttributeSection( -#line 1088 "cs.ATG" +#line 1097 "cs.ATG" out section); -#line 1088 "cs.ATG" +#line 1097 "cs.ATG" attributes.Add(section); } if (StartOf(14)) { FixedParameter( -#line 1090 "cs.ATG" +#line 1099 "cs.ATG" out p); -#line 1090 "cs.ATG" +#line 1099 "cs.ATG" p.Attributes = attributes; parameter.Add(p); } else if (la.kind == 94) { ParameterArray( -#line 1091 "cs.ATG" +#line 1100 "cs.ATG" out p); -#line 1091 "cs.ATG" +#line 1100 "cs.ATG" paramsFound = true; p.Attributes = attributes; parameter.Add(p); } else SynErr(134); } } else if (la.kind == 94) { ParameterArray( -#line 1094 "cs.ATG" +#line 1103 "cs.ATG" out p); -#line 1094 "cs.ATG" +#line 1103 "cs.ATG" p.Attributes = attributes; parameter.Add(p); } else SynErr(135); } void ClassType( -#line 1142 "cs.ATG" +#line 1151 "cs.ATG" out TypeReference typeRef, bool canBeUnbound) { -#line 1143 "cs.ATG" +#line 1152 "cs.ATG" TypeReference r; typeRef = null; if (la.kind == 1) { TypeName( -#line 1145 "cs.ATG" +#line 1154 "cs.ATG" out r, canBeUnbound); -#line 1145 "cs.ATG" +#line 1154 "cs.ATG" typeRef = r; } else if (la.kind == 90) { lexer.NextToken(); -#line 1146 "cs.ATG" +#line 1155 "cs.ATG" typeRef = new TypeReference("object"); } else if (la.kind == 107) { lexer.NextToken(); -#line 1147 "cs.ATG" +#line 1156 "cs.ATG" typeRef = new TypeReference("string"); } else SynErr(136); } void TypeName( -#line 2423 "cs.ATG" +#line 2432 "cs.ATG" out TypeReference typeRef, bool canBeUnbound) { -#line 2424 "cs.ATG" +#line 2433 "cs.ATG" List typeArguments = null; string alias = null; string qualident; if ( -#line 2429 "cs.ATG" +#line 2438 "cs.ATG" la.kind == Tokens.Identifier && Peek(1).kind == Tokens.DoubleColon) { lexer.NextToken(); -#line 2430 "cs.ATG" +#line 2439 "cs.ATG" alias = t.val; Expect(10); } Qualident( -#line 2433 "cs.ATG" +#line 2442 "cs.ATG" out qualident); if (la.kind == 23) { TypeArgumentList( -#line 2434 "cs.ATG" +#line 2443 "cs.ATG" out typeArguments, canBeUnbound); } -#line 2436 "cs.ATG" +#line 2445 "cs.ATG" if (alias == null) { typeRef = new TypeReference(qualident, typeArguments); } else if (alias == "global") { @@ -1784,129 +1796,129 @@ out typeArguments, canBeUnbound); } while ( -#line 2445 "cs.ATG" +#line 2454 "cs.ATG" DotAndIdent()) { Expect(15); -#line 2446 "cs.ATG" +#line 2455 "cs.ATG" typeArguments = null; Qualident( -#line 2447 "cs.ATG" +#line 2456 "cs.ATG" out qualident); if (la.kind == 23) { TypeArgumentList( -#line 2448 "cs.ATG" +#line 2457 "cs.ATG" out typeArguments, canBeUnbound); } -#line 2449 "cs.ATG" +#line 2458 "cs.ATG" typeRef = new InnerClassTypeReference(typeRef, qualident, typeArguments); } } void MemberModifiers( -#line 1163 "cs.ATG" +#line 1172 "cs.ATG" Modifiers m) { while (StartOf(15) || -#line 1180 "cs.ATG" +#line 1189 "cs.ATG" la.kind == Tokens.Identifier && la.val == "partial") { if (la.kind == 48) { lexer.NextToken(); -#line 1166 "cs.ATG" +#line 1175 "cs.ATG" m.Add(Modifier.Abstract, t.Location); } else if (la.kind == 70) { lexer.NextToken(); -#line 1167 "cs.ATG" +#line 1176 "cs.ATG" m.Add(Modifier.Extern, t.Location); } else if (la.kind == 83) { lexer.NextToken(); -#line 1168 "cs.ATG" +#line 1177 "cs.ATG" m.Add(Modifier.Internal, t.Location); } else if (la.kind == 88) { lexer.NextToken(); -#line 1169 "cs.ATG" +#line 1178 "cs.ATG" m.Add(Modifier.New, t.Location); } else if (la.kind == 93) { lexer.NextToken(); -#line 1170 "cs.ATG" +#line 1179 "cs.ATG" m.Add(Modifier.Override, t.Location); } else if (la.kind == 95) { lexer.NextToken(); -#line 1171 "cs.ATG" +#line 1180 "cs.ATG" m.Add(Modifier.Private, t.Location); } else if (la.kind == 96) { lexer.NextToken(); -#line 1172 "cs.ATG" +#line 1181 "cs.ATG" m.Add(Modifier.Protected, t.Location); } else if (la.kind == 97) { lexer.NextToken(); -#line 1173 "cs.ATG" +#line 1182 "cs.ATG" m.Add(Modifier.Public, t.Location); } else if (la.kind == 98) { lexer.NextToken(); -#line 1174 "cs.ATG" +#line 1183 "cs.ATG" m.Add(Modifier.ReadOnly, t.Location); } else if (la.kind == 102) { lexer.NextToken(); -#line 1175 "cs.ATG" +#line 1184 "cs.ATG" m.Add(Modifier.Sealed, t.Location); } else if (la.kind == 106) { lexer.NextToken(); -#line 1176 "cs.ATG" +#line 1185 "cs.ATG" m.Add(Modifier.Static, t.Location); } else if (la.kind == 118) { lexer.NextToken(); -#line 1177 "cs.ATG" +#line 1186 "cs.ATG" m.Add(Modifier.Unsafe, t.Location); } else if (la.kind == 121) { lexer.NextToken(); -#line 1178 "cs.ATG" +#line 1187 "cs.ATG" m.Add(Modifier.Virtual, t.Location); } else if (la.kind == 123) { lexer.NextToken(); -#line 1179 "cs.ATG" +#line 1188 "cs.ATG" m.Add(Modifier.Volatile, t.Location); } else { Expect(1); -#line 1181 "cs.ATG" +#line 1190 "cs.ATG" m.Add(Modifier.Partial, t.Location); } } } void ClassMemberDecl( -#line 1456 "cs.ATG" +#line 1465 "cs.ATG" Modifiers m, List attributes) { -#line 1457 "cs.ATG" +#line 1466 "cs.ATG" Statement stmt = null; if (StartOf(16)) { StructMemberDecl( -#line 1459 "cs.ATG" +#line 1468 "cs.ATG" m, attributes); } else if (la.kind == 27) { -#line 1460 "cs.ATG" +#line 1469 "cs.ATG" m.Check(Modifier.Destructors); Point startPos = t.Location; lexer.NextToken(); Expect(1); -#line 1461 "cs.ATG" +#line 1470 "cs.ATG" DestructorDeclaration d = new DestructorDeclaration(t.val, m.Modifier, attributes); d.Modifier = m.Modifier; d.StartLocation = m.GetDeclarationLocation(startPos); @@ -1914,17 +1926,17 @@ m, attributes); Expect(20); Expect(21); -#line 1465 "cs.ATG" +#line 1474 "cs.ATG" d.EndLocation = t.EndLocation; if (la.kind == 16) { Block( -#line 1465 "cs.ATG" +#line 1474 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(137); -#line 1466 "cs.ATG" +#line 1475 "cs.ATG" d.Body = (BlockStatement)stmt; compilationUnit.AddChild(d); @@ -1932,10 +1944,10 @@ out stmt); } void StructMemberDecl( -#line 1186 "cs.ATG" +#line 1195 "cs.ATG" Modifiers m, List attributes) { -#line 1188 "cs.ATG" +#line 1197 "cs.ATG" string qualident = null; TypeReference type; Expression expr; @@ -1947,18 +1959,18 @@ Modifiers m, List attributes) { if (la.kind == 59) { -#line 1198 "cs.ATG" +#line 1207 "cs.ATG" m.Check(Modifier.Constants); lexer.NextToken(); -#line 1199 "cs.ATG" +#line 1208 "cs.ATG" Point startPos = t.Location; Type( -#line 1200 "cs.ATG" +#line 1209 "cs.ATG" out type); Expect(1); -#line 1200 "cs.ATG" +#line 1209 "cs.ATG" FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier | Modifier.Const); fd.StartLocation = m.GetDeclarationLocation(startPos); VariableDeclaration f = new VariableDeclaration(t.val); @@ -1966,72 +1978,72 @@ out type); Expect(3); Expr( -#line 1205 "cs.ATG" +#line 1214 "cs.ATG" out expr); -#line 1205 "cs.ATG" +#line 1214 "cs.ATG" f.Initializer = expr; while (la.kind == 14) { lexer.NextToken(); Expect(1); -#line 1206 "cs.ATG" +#line 1215 "cs.ATG" f = new VariableDeclaration(t.val); fd.Fields.Add(f); Expect(3); Expr( -#line 1209 "cs.ATG" +#line 1218 "cs.ATG" out expr); -#line 1209 "cs.ATG" +#line 1218 "cs.ATG" f.Initializer = expr; } Expect(11); -#line 1210 "cs.ATG" +#line 1219 "cs.ATG" fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd); } else if ( -#line 1214 "cs.ATG" +#line 1223 "cs.ATG" NotVoidPointer()) { -#line 1214 "cs.ATG" +#line 1223 "cs.ATG" m.Check(Modifier.PropertysEventsMethods); Expect(122); -#line 1215 "cs.ATG" +#line 1224 "cs.ATG" Point startPos = t.Location; if ( -#line 1216 "cs.ATG" +#line 1225 "cs.ATG" IsExplicitInterfaceImplementation()) { TypeName( -#line 1217 "cs.ATG" +#line 1226 "cs.ATG" out explicitInterface, false); -#line 1218 "cs.ATG" +#line 1227 "cs.ATG" if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) { qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface); } } else if (la.kind == 1) { lexer.NextToken(); -#line 1221 "cs.ATG" +#line 1230 "cs.ATG" qualident = t.val; } else SynErr(139); if (la.kind == 23) { TypeParameterList( -#line 1224 "cs.ATG" +#line 1233 "cs.ATG" templates); } Expect(20); if (StartOf(10)) { FormalParameterList( -#line 1227 "cs.ATG" +#line 1236 "cs.ATG" p); } Expect(21); -#line 1228 "cs.ATG" +#line 1237 "cs.ATG" MethodDeclaration methodDeclaration = new MethodDeclaration(qualident, m.Modifier, new TypeReference("void"), @@ -2046,31 +2058,31 @@ p); compilationUnit.BlockStart(methodDeclaration); while ( -#line 1243 "cs.ATG" +#line 1252 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 1243 "cs.ATG" +#line 1252 "cs.ATG" templates); } if (la.kind == 16) { Block( -#line 1245 "cs.ATG" +#line 1254 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(140); -#line 1245 "cs.ATG" +#line 1254 "cs.ATG" compilationUnit.BlockEnd(); methodDeclaration.Body = (BlockStatement)stmt; } else if (la.kind == 68) { -#line 1249 "cs.ATG" +#line 1258 "cs.ATG" m.Check(Modifier.PropertysEventsMethods); lexer.NextToken(); -#line 1250 "cs.ATG" +#line 1259 "cs.ATG" EventDeclaration eventDecl = new EventDeclaration(null, null, m.Modifier, attributes, null); eventDecl.StartLocation = t.Location; compilationUnit.AddChild(eventDecl); @@ -2079,104 +2091,104 @@ out stmt); EventRemoveRegion removeBlock = null; Type( -#line 1257 "cs.ATG" +#line 1266 "cs.ATG" out type); -#line 1257 "cs.ATG" +#line 1266 "cs.ATG" eventDecl.TypeReference = type; if ( -#line 1258 "cs.ATG" +#line 1267 "cs.ATG" IsExplicitInterfaceImplementation()) { TypeName( -#line 1259 "cs.ATG" +#line 1268 "cs.ATG" out explicitInterface, false); -#line 1260 "cs.ATG" +#line 1269 "cs.ATG" qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface); -#line 1261 "cs.ATG" +#line 1270 "cs.ATG" eventDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident)); } else if (la.kind == 1) { lexer.NextToken(); -#line 1263 "cs.ATG" +#line 1272 "cs.ATG" qualident = t.val; } else SynErr(141); -#line 1265 "cs.ATG" +#line 1274 "cs.ATG" eventDecl.Name = qualident; eventDecl.EndLocation = t.EndLocation; if (la.kind == 16) { lexer.NextToken(); -#line 1266 "cs.ATG" +#line 1275 "cs.ATG" eventDecl.BodyStart = t.Location; EventAccessorDecls( -#line 1267 "cs.ATG" +#line 1276 "cs.ATG" out addBlock, out removeBlock); Expect(17); -#line 1268 "cs.ATG" +#line 1277 "cs.ATG" eventDecl.BodyEnd = t.EndLocation; } if (la.kind == 11) { lexer.NextToken(); } -#line 1271 "cs.ATG" +#line 1280 "cs.ATG" compilationUnit.BlockEnd(); eventDecl.AddRegion = addBlock; eventDecl.RemoveRegion = removeBlock; } else if ( -#line 1277 "cs.ATG" +#line 1286 "cs.ATG" IdentAndLPar()) { -#line 1277 "cs.ATG" +#line 1286 "cs.ATG" m.Check(Modifier.Constructors | Modifier.StaticConstructors); Expect(1); -#line 1278 "cs.ATG" +#line 1287 "cs.ATG" string name = t.val; Point startPos = t.Location; Expect(20); if (StartOf(10)) { -#line 1278 "cs.ATG" +#line 1287 "cs.ATG" m.Check(Modifier.Constructors); FormalParameterList( -#line 1279 "cs.ATG" +#line 1288 "cs.ATG" p); } Expect(21); -#line 1281 "cs.ATG" +#line 1290 "cs.ATG" ConstructorInitializer init = null; if (la.kind == 9) { -#line 1282 "cs.ATG" +#line 1291 "cs.ATG" m.Check(Modifier.Constructors); ConstructorInitializer( -#line 1283 "cs.ATG" +#line 1292 "cs.ATG" out init); } -#line 1285 "cs.ATG" +#line 1294 "cs.ATG" ConstructorDeclaration cd = new ConstructorDeclaration(name, m.Modifier, p, init, attributes); cd.StartLocation = startPos; cd.EndLocation = t.EndLocation; if (la.kind == 16) { Block( -#line 1290 "cs.ATG" +#line 1299 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(142); -#line 1290 "cs.ATG" +#line 1299 "cs.ATG" cd.Body = (BlockStatement)stmt; compilationUnit.AddChild(cd); } else if (la.kind == 69 || la.kind == 79) { -#line 1293 "cs.ATG" +#line 1302 "cs.ATG" m.Check(Modifier.Operators); if (m.isNone) Error("at least one modifier must be set"); bool isImplicit = true; @@ -2185,45 +2197,45 @@ out stmt); if (la.kind == 79) { lexer.NextToken(); -#line 1298 "cs.ATG" +#line 1307 "cs.ATG" startPos = t.Location; } else { lexer.NextToken(); -#line 1298 "cs.ATG" +#line 1307 "cs.ATG" isImplicit = false; startPos = t.Location; } Expect(91); Type( -#line 1299 "cs.ATG" +#line 1308 "cs.ATG" out type); -#line 1299 "cs.ATG" +#line 1308 "cs.ATG" TypeReference operatorType = type; Expect(20); Type( -#line 1300 "cs.ATG" +#line 1309 "cs.ATG" out type); Expect(1); -#line 1300 "cs.ATG" +#line 1309 "cs.ATG" string varName = t.val; Expect(21); -#line 1301 "cs.ATG" +#line 1310 "cs.ATG" Point endPos = t.Location; if (la.kind == 16) { Block( -#line 1302 "cs.ATG" +#line 1311 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); -#line 1302 "cs.ATG" +#line 1311 "cs.ATG" stmt = null; } else SynErr(143); -#line 1305 "cs.ATG" +#line 1314 "cs.ATG" List parameters = new List(); parameters.Add(new ParameterDeclarationExpression(type, varName)); OperatorDeclaration operatorDeclaration = new OperatorDeclaration(m.Modifier, @@ -2239,61 +2251,61 @@ out stmt); } else if (StartOf(17)) { TypeDecl( -#line 1321 "cs.ATG" +#line 1330 "cs.ATG" m, attributes); } else if (StartOf(9)) { Type( -#line 1323 "cs.ATG" +#line 1332 "cs.ATG" out type); -#line 1323 "cs.ATG" +#line 1332 "cs.ATG" Point startPos = t.Location; if (la.kind == 91) { -#line 1325 "cs.ATG" +#line 1334 "cs.ATG" OverloadableOperatorType op; m.Check(Modifier.Operators); if (m.isNone) Error("at least one modifier must be set"); lexer.NextToken(); OverloadableOperator( -#line 1329 "cs.ATG" +#line 1338 "cs.ATG" out op); -#line 1329 "cs.ATG" +#line 1338 "cs.ATG" TypeReference firstType, secondType = null; string secondName = null; Expect(20); Type( -#line 1330 "cs.ATG" +#line 1339 "cs.ATG" out firstType); Expect(1); -#line 1330 "cs.ATG" +#line 1339 "cs.ATG" string firstName = t.val; if (la.kind == 14) { lexer.NextToken(); Type( -#line 1331 "cs.ATG" +#line 1340 "cs.ATG" out secondType); Expect(1); -#line 1331 "cs.ATG" +#line 1340 "cs.ATG" secondName = t.val; } else if (la.kind == 21) { } else SynErr(144); -#line 1339 "cs.ATG" +#line 1348 "cs.ATG" Point endPos = t.Location; Expect(21); if (la.kind == 16) { Block( -#line 1340 "cs.ATG" +#line 1349 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(145); -#line 1342 "cs.ATG" +#line 1351 "cs.ATG" List parameters = new List(); parameters.Add(new ParameterDeclarationExpression(firstType, firstName)); if (secondType != null) { @@ -2310,43 +2322,43 @@ out stmt); compilationUnit.AddChild(operatorDeclaration); } else if ( -#line 1359 "cs.ATG" +#line 1368 "cs.ATG" IsVarDecl()) { -#line 1359 "cs.ATG" +#line 1368 "cs.ATG" m.Check(Modifier.Fields); FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier); fd.StartLocation = m.GetDeclarationLocation(startPos); VariableDeclarator( -#line 1363 "cs.ATG" +#line 1372 "cs.ATG" variableDeclarators); while (la.kind == 14) { lexer.NextToken(); VariableDeclarator( -#line 1364 "cs.ATG" +#line 1373 "cs.ATG" variableDeclarators); } Expect(11); -#line 1365 "cs.ATG" +#line 1374 "cs.ATG" fd.EndLocation = t.EndLocation; fd.Fields = variableDeclarators; compilationUnit.AddChild(fd); } else if (la.kind == 110) { -#line 1368 "cs.ATG" +#line 1377 "cs.ATG" m.Check(Modifier.Indexers); lexer.NextToken(); Expect(18); FormalParameterList( -#line 1369 "cs.ATG" +#line 1378 "cs.ATG" p); Expect(19); -#line 1369 "cs.ATG" +#line 1378 "cs.ATG" Point endLocation = t.EndLocation; Expect(16); -#line 1370 "cs.ATG" +#line 1379 "cs.ATG" IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes); indexer.StartLocation = startPos; indexer.EndLocation = endLocation; @@ -2355,58 +2367,58 @@ p); PropertySetRegion setRegion; AccessorDecls( -#line 1377 "cs.ATG" +#line 1386 "cs.ATG" out getRegion, out setRegion); Expect(17); -#line 1378 "cs.ATG" +#line 1387 "cs.ATG" indexer.BodyEnd = t.EndLocation; indexer.GetRegion = getRegion; indexer.SetRegion = setRegion; compilationUnit.AddChild(indexer); } else if ( -#line 1383 "cs.ATG" +#line 1392 "cs.ATG" la.kind == Tokens.Identifier) { if ( -#line 1384 "cs.ATG" +#line 1393 "cs.ATG" IsExplicitInterfaceImplementation()) { TypeName( -#line 1385 "cs.ATG" +#line 1394 "cs.ATG" out explicitInterface, false); -#line 1386 "cs.ATG" +#line 1395 "cs.ATG" if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) { qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface); } } else if (la.kind == 1) { lexer.NextToken(); -#line 1389 "cs.ATG" +#line 1398 "cs.ATG" qualident = t.val; } else SynErr(146); -#line 1391 "cs.ATG" +#line 1400 "cs.ATG" Point qualIdentEndLocation = t.EndLocation; if (la.kind == 16 || la.kind == 20 || la.kind == 23) { if (la.kind == 20 || la.kind == 23) { -#line 1395 "cs.ATG" +#line 1404 "cs.ATG" m.Check(Modifier.PropertysEventsMethods); if (la.kind == 23) { TypeParameterList( -#line 1397 "cs.ATG" +#line 1406 "cs.ATG" templates); } Expect(20); if (StartOf(10)) { FormalParameterList( -#line 1398 "cs.ATG" +#line 1407 "cs.ATG" p); } Expect(21); -#line 1399 "cs.ATG" +#line 1408 "cs.ATG" MethodDeclaration methodDeclaration = new MethodDeclaration(qualident, m.Modifier, type, @@ -2420,26 +2432,26 @@ p); compilationUnit.AddChild(methodDeclaration); while ( -#line 1411 "cs.ATG" +#line 1420 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 1411 "cs.ATG" +#line 1420 "cs.ATG" templates); } if (la.kind == 16) { Block( -#line 1412 "cs.ATG" +#line 1421 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(147); -#line 1412 "cs.ATG" +#line 1421 "cs.ATG" methodDeclaration.Body = (BlockStatement)stmt; } else { lexer.NextToken(); -#line 1415 "cs.ATG" +#line 1424 "cs.ATG" PropertyDeclaration pDecl = new PropertyDeclaration(qualident, type, m.Modifier, attributes); if (explicitInterface != null) pDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident)); @@ -2450,11 +2462,11 @@ out stmt); PropertySetRegion setRegion; AccessorDecls( -#line 1424 "cs.ATG" +#line 1433 "cs.ATG" out getRegion, out setRegion); Expect(17); -#line 1426 "cs.ATG" +#line 1435 "cs.ATG" pDecl.GetRegion = getRegion; pDecl.SetRegion = setRegion; pDecl.BodyEnd = t.EndLocation; @@ -2463,17 +2475,17 @@ out getRegion, out setRegion); } } else if (la.kind == 15) { -#line 1434 "cs.ATG" +#line 1443 "cs.ATG" m.Check(Modifier.Indexers); lexer.NextToken(); Expect(110); Expect(18); FormalParameterList( -#line 1435 "cs.ATG" +#line 1444 "cs.ATG" p); Expect(19); -#line 1436 "cs.ATG" +#line 1445 "cs.ATG" IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes); indexer.StartLocation = m.GetDeclarationLocation(startPos); indexer.EndLocation = t.EndLocation; @@ -2484,14 +2496,14 @@ p); Expect(16); -#line 1444 "cs.ATG" +#line 1453 "cs.ATG" Point bodyStart = t.Location; AccessorDecls( -#line 1445 "cs.ATG" +#line 1454 "cs.ATG" out getRegion, out setRegion); Expect(17); -#line 1446 "cs.ATG" +#line 1455 "cs.ATG" indexer.BodyStart = bodyStart; indexer.BodyEnd = t.EndLocation; indexer.GetRegion = getRegion; @@ -2505,7 +2517,7 @@ out getRegion, out setRegion); void InterfaceMemberDecl() { -#line 1473 "cs.ATG" +#line 1482 "cs.ATG" TypeReference type; AttributeSection section; @@ -2520,51 +2532,51 @@ out getRegion, out setRegion); while (la.kind == 18) { AttributeSection( -#line 1486 "cs.ATG" +#line 1495 "cs.ATG" out section); -#line 1486 "cs.ATG" +#line 1495 "cs.ATG" attributes.Add(section); } if (la.kind == 88) { lexer.NextToken(); -#line 1487 "cs.ATG" +#line 1496 "cs.ATG" mod = Modifier.New; startLocation = t.Location; } if ( -#line 1490 "cs.ATG" +#line 1499 "cs.ATG" NotVoidPointer()) { Expect(122); -#line 1490 "cs.ATG" +#line 1499 "cs.ATG" if (startLocation.X == -1) startLocation = t.Location; Expect(1); -#line 1490 "cs.ATG" +#line 1499 "cs.ATG" name = t.val; if (la.kind == 23) { TypeParameterList( -#line 1491 "cs.ATG" +#line 1500 "cs.ATG" templates); } Expect(20); if (StartOf(10)) { FormalParameterList( -#line 1492 "cs.ATG" +#line 1501 "cs.ATG" parameters); } Expect(21); while ( -#line 1493 "cs.ATG" +#line 1502 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 1493 "cs.ATG" +#line 1502 "cs.ATG" templates); } Expect(11); -#line 1495 "cs.ATG" +#line 1504 "cs.ATG" MethodDeclaration md = new MethodDeclaration(name, mod, new TypeReference("void"), parameters, attributes); md.StartLocation = startLocation; md.EndLocation = t.EndLocation; @@ -2574,39 +2586,39 @@ templates); } else if (StartOf(18)) { if (StartOf(9)) { Type( -#line 1502 "cs.ATG" +#line 1511 "cs.ATG" out type); -#line 1502 "cs.ATG" +#line 1511 "cs.ATG" if (startLocation.X == -1) startLocation = t.Location; if (la.kind == 1) { lexer.NextToken(); -#line 1504 "cs.ATG" +#line 1513 "cs.ATG" name = t.val; Point qualIdentEndLocation = t.EndLocation; if (la.kind == 20 || la.kind == 23) { if (la.kind == 23) { TypeParameterList( -#line 1508 "cs.ATG" +#line 1517 "cs.ATG" templates); } Expect(20); if (StartOf(10)) { FormalParameterList( -#line 1509 "cs.ATG" +#line 1518 "cs.ATG" parameters); } Expect(21); while ( -#line 1511 "cs.ATG" +#line 1520 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 1511 "cs.ATG" +#line 1520 "cs.ATG" templates); } Expect(11); -#line 1512 "cs.ATG" +#line 1521 "cs.ATG" MethodDeclaration md = new MethodDeclaration(name, mod, type, parameters, attributes); md.StartLocation = startLocation; md.EndLocation = t.EndLocation; @@ -2615,72 +2627,72 @@ templates); } else if (la.kind == 16) { -#line 1519 "cs.ATG" +#line 1528 "cs.ATG" PropertyDeclaration pd = new PropertyDeclaration(name, type, mod, attributes); compilationUnit.AddChild(pd); lexer.NextToken(); -#line 1520 "cs.ATG" +#line 1529 "cs.ATG" Point bodyStart = t.Location; InterfaceAccessors( -#line 1520 "cs.ATG" +#line 1529 "cs.ATG" out getBlock, out setBlock); Expect(17); -#line 1520 "cs.ATG" +#line 1529 "cs.ATG" pd.GetRegion = getBlock; pd.SetRegion = setBlock; pd.StartLocation = startLocation; pd.EndLocation = qualIdentEndLocation; pd.BodyStart = bodyStart; pd.BodyEnd = t.EndLocation; } else SynErr(151); } else if (la.kind == 110) { lexer.NextToken(); Expect(18); FormalParameterList( -#line 1523 "cs.ATG" +#line 1532 "cs.ATG" parameters); Expect(19); -#line 1523 "cs.ATG" +#line 1532 "cs.ATG" Point bracketEndLocation = t.EndLocation; -#line 1523 "cs.ATG" +#line 1532 "cs.ATG" IndexerDeclaration id = new IndexerDeclaration(type, parameters, mod, attributes); compilationUnit.AddChild(id); Expect(16); -#line 1524 "cs.ATG" +#line 1533 "cs.ATG" Point bodyStart = t.Location; InterfaceAccessors( -#line 1524 "cs.ATG" +#line 1533 "cs.ATG" out getBlock, out setBlock); Expect(17); -#line 1524 "cs.ATG" +#line 1533 "cs.ATG" id.GetRegion = getBlock; id.SetRegion = setBlock; id.StartLocation = startLocation; id.EndLocation = bracketEndLocation; id.BodyStart = bodyStart; id.BodyEnd = t.EndLocation; } else SynErr(152); } else { lexer.NextToken(); -#line 1527 "cs.ATG" +#line 1536 "cs.ATG" if (startLocation.X == -1) startLocation = t.Location; Type( -#line 1527 "cs.ATG" +#line 1536 "cs.ATG" out type); Expect(1); -#line 1527 "cs.ATG" +#line 1536 "cs.ATG" EventDeclaration ed = new EventDeclaration(type, t.val, mod, attributes, null); compilationUnit.AddChild(ed); Expect(11); -#line 1530 "cs.ATG" +#line 1539 "cs.ATG" ed.StartLocation = startLocation; ed.EndLocation = t.EndLocation; } } else SynErr(153); } void EnumMemberDecl( -#line 1535 "cs.ATG" +#line 1544 "cs.ATG" out FieldDeclaration f) { -#line 1537 "cs.ATG" +#line 1546 "cs.ATG" Expression expr = null; List attributes = new List(); AttributeSection section = null; @@ -2688,15 +2700,15 @@ out FieldDeclaration f) { while (la.kind == 18) { AttributeSection( -#line 1543 "cs.ATG" +#line 1552 "cs.ATG" out section); -#line 1543 "cs.ATG" +#line 1552 "cs.ATG" attributes.Add(section); } Expect(1); -#line 1544 "cs.ATG" +#line 1553 "cs.ATG" f = new FieldDeclaration(attributes); varDecl = new VariableDeclaration(t.val); f.Fields.Add(varDecl); @@ -2705,78 +2717,78 @@ out section); if (la.kind == 3) { lexer.NextToken(); Expr( -#line 1549 "cs.ATG" +#line 1558 "cs.ATG" out expr); -#line 1549 "cs.ATG" +#line 1558 "cs.ATG" varDecl.Initializer = expr; } } void TypeWithRestriction( -#line 1014 "cs.ATG" +#line 1023 "cs.ATG" out TypeReference type, bool allowNullable, bool canBeUnbound) { -#line 1016 "cs.ATG" +#line 1025 "cs.ATG" string name; int pointer = 0; type = null; if (la.kind == 1 || la.kind == 90 || la.kind == 107) { ClassType( -#line 1021 "cs.ATG" +#line 1030 "cs.ATG" out type, canBeUnbound); } else if (StartOf(4)) { SimpleType( -#line 1022 "cs.ATG" +#line 1031 "cs.ATG" out name); -#line 1022 "cs.ATG" +#line 1031 "cs.ATG" type = new TypeReference(name); } else if (la.kind == 122) { lexer.NextToken(); Expect(6); -#line 1023 "cs.ATG" +#line 1032 "cs.ATG" pointer = 1; type = new TypeReference("void"); } else SynErr(154); -#line 1024 "cs.ATG" +#line 1033 "cs.ATG" List r = new List(); if ( -#line 1026 "cs.ATG" +#line 1035 "cs.ATG" allowNullable && la.kind == Tokens.Question) { NullableQuestionMark( -#line 1026 "cs.ATG" +#line 1035 "cs.ATG" ref type); } while ( -#line 1028 "cs.ATG" +#line 1037 "cs.ATG" IsPointerOrDims()) { -#line 1028 "cs.ATG" +#line 1037 "cs.ATG" int i = 0; if (la.kind == 6) { lexer.NextToken(); -#line 1029 "cs.ATG" +#line 1038 "cs.ATG" ++pointer; } else if (la.kind == 18) { lexer.NextToken(); while (la.kind == 14) { lexer.NextToken(); -#line 1030 "cs.ATG" +#line 1039 "cs.ATG" ++i; } Expect(19); -#line 1030 "cs.ATG" +#line 1039 "cs.ATG" r.Add(i); } else SynErr(155); } -#line 1033 "cs.ATG" +#line 1042 "cs.ATG" if (type != null) { type.RankSpecifier = r.ToArray(); type.PointerNestingLevel = pointer; @@ -2785,57 +2797,57 @@ IsPointerOrDims()) { } void SimpleType( -#line 1061 "cs.ATG" +#line 1070 "cs.ATG" out string name) { -#line 1062 "cs.ATG" +#line 1071 "cs.ATG" name = String.Empty; if (StartOf(19)) { IntegralType( -#line 1064 "cs.ATG" +#line 1073 "cs.ATG" out name); } else if (la.kind == 74) { lexer.NextToken(); -#line 1065 "cs.ATG" +#line 1074 "cs.ATG" name = "float"; } else if (la.kind == 65) { lexer.NextToken(); -#line 1066 "cs.ATG" +#line 1075 "cs.ATG" name = "double"; } else if (la.kind == 61) { lexer.NextToken(); -#line 1067 "cs.ATG" +#line 1076 "cs.ATG" name = "decimal"; } else if (la.kind == 51) { lexer.NextToken(); -#line 1068 "cs.ATG" +#line 1077 "cs.ATG" name = "bool"; } else SynErr(156); } void NullableQuestionMark( -#line 2454 "cs.ATG" +#line 2463 "cs.ATG" ref TypeReference typeRef) { -#line 2455 "cs.ATG" +#line 2464 "cs.ATG" List typeArguments = new List(1); Expect(12); -#line 2459 "cs.ATG" +#line 2468 "cs.ATG" if (typeRef != null) typeArguments.Add(typeRef); typeRef = new TypeReference("System.Nullable", typeArguments); } void FixedParameter( -#line 1098 "cs.ATG" +#line 1107 "cs.ATG" out ParameterDeclarationExpression p) { -#line 1100 "cs.ATG" +#line 1109 "cs.ATG" TypeReference type; ParamModifier mod = ParamModifier.In; System.Drawing.Point start = t.Location; @@ -2844,82 +2856,82 @@ out ParameterDeclarationExpression p) { if (la.kind == 99) { lexer.NextToken(); -#line 1106 "cs.ATG" +#line 1115 "cs.ATG" mod = ParamModifier.Ref; } else { lexer.NextToken(); -#line 1107 "cs.ATG" +#line 1116 "cs.ATG" mod = ParamModifier.Out; } } Type( -#line 1109 "cs.ATG" +#line 1118 "cs.ATG" out type); Expect(1); -#line 1109 "cs.ATG" +#line 1118 "cs.ATG" p = new ParameterDeclarationExpression(type, t.val, mod); p.StartLocation = start; p.EndLocation = t.Location; } void ParameterArray( -#line 1112 "cs.ATG" +#line 1121 "cs.ATG" out ParameterDeclarationExpression p) { -#line 1113 "cs.ATG" +#line 1122 "cs.ATG" TypeReference type; Expect(94); Type( -#line 1115 "cs.ATG" +#line 1124 "cs.ATG" out type); Expect(1); -#line 1115 "cs.ATG" +#line 1124 "cs.ATG" p = new ParameterDeclarationExpression(type, t.val, ParamModifier.Params); } void AccessorModifiers( -#line 1118 "cs.ATG" +#line 1127 "cs.ATG" out Modifiers m) { -#line 1119 "cs.ATG" +#line 1128 "cs.ATG" m = new Modifiers(); if (la.kind == 95) { lexer.NextToken(); -#line 1121 "cs.ATG" +#line 1130 "cs.ATG" m.Add(Modifier.Private, t.Location); } else if (la.kind == 96) { lexer.NextToken(); -#line 1122 "cs.ATG" +#line 1131 "cs.ATG" m.Add(Modifier.Protected, t.Location); if (la.kind == 83) { lexer.NextToken(); -#line 1123 "cs.ATG" +#line 1132 "cs.ATG" m.Add(Modifier.Internal, t.Location); } } else if (la.kind == 83) { lexer.NextToken(); -#line 1124 "cs.ATG" +#line 1133 "cs.ATG" m.Add(Modifier.Internal, t.Location); if (la.kind == 96) { lexer.NextToken(); -#line 1125 "cs.ATG" +#line 1134 "cs.ATG" m.Add(Modifier.Protected, t.Location); } } else SynErr(157); } void Block( -#line 1674 "cs.ATG" +#line 1683 "cs.ATG" out Statement stmt) { Expect(16); -#line 1676 "cs.ATG" +#line 1685 "cs.ATG" BlockStatement blockStmt = new BlockStatement(); blockStmt.StartLocation = t.EndLocation; compilationUnit.BlockStart(blockStmt); @@ -2930,7 +2942,7 @@ out Statement stmt) { } Expect(17); -#line 1683 "cs.ATG" +#line 1692 "cs.ATG" stmt = blockStmt; blockStmt.EndLocation = t.EndLocation; compilationUnit.BlockEnd(); @@ -2938,10 +2950,10 @@ out Statement stmt) { } void EventAccessorDecls( -#line 1609 "cs.ATG" +#line 1618 "cs.ATG" out EventAddRegion addBlock, out EventRemoveRegion removeBlock) { -#line 1610 "cs.ATG" +#line 1619 "cs.ATG" AttributeSection section; List attributes = new List(); Statement stmt; @@ -2950,102 +2962,102 @@ out EventAddRegion addBlock, out EventRemoveRegion removeBlock) { while (la.kind == 18) { AttributeSection( -#line 1617 "cs.ATG" +#line 1626 "cs.ATG" out section); -#line 1617 "cs.ATG" +#line 1626 "cs.ATG" attributes.Add(section); } if ( -#line 1619 "cs.ATG" +#line 1628 "cs.ATG" IdentIsAdd()) { -#line 1619 "cs.ATG" +#line 1628 "cs.ATG" addBlock = new EventAddRegion(attributes); AddAccessorDecl( -#line 1620 "cs.ATG" +#line 1629 "cs.ATG" out stmt); -#line 1620 "cs.ATG" +#line 1629 "cs.ATG" attributes = new List(); addBlock.Block = (BlockStatement)stmt; while (la.kind == 18) { AttributeSection( -#line 1621 "cs.ATG" +#line 1630 "cs.ATG" out section); -#line 1621 "cs.ATG" +#line 1630 "cs.ATG" attributes.Add(section); } RemoveAccessorDecl( -#line 1622 "cs.ATG" +#line 1631 "cs.ATG" out stmt); -#line 1622 "cs.ATG" +#line 1631 "cs.ATG" removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt; } else if ( -#line 1623 "cs.ATG" +#line 1632 "cs.ATG" IdentIsRemove()) { RemoveAccessorDecl( -#line 1624 "cs.ATG" +#line 1633 "cs.ATG" out stmt); -#line 1624 "cs.ATG" +#line 1633 "cs.ATG" removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt; attributes = new List(); while (la.kind == 18) { AttributeSection( -#line 1625 "cs.ATG" +#line 1634 "cs.ATG" out section); -#line 1625 "cs.ATG" +#line 1634 "cs.ATG" attributes.Add(section); } AddAccessorDecl( -#line 1626 "cs.ATG" +#line 1635 "cs.ATG" out stmt); -#line 1626 "cs.ATG" +#line 1635 "cs.ATG" addBlock = new EventAddRegion(attributes); addBlock.Block = (BlockStatement)stmt; } else if (la.kind == 1) { lexer.NextToken(); -#line 1627 "cs.ATG" +#line 1636 "cs.ATG" Error("add or remove accessor declaration expected"); } else SynErr(158); } void ConstructorInitializer( -#line 1705 "cs.ATG" +#line 1714 "cs.ATG" out ConstructorInitializer ci) { -#line 1706 "cs.ATG" +#line 1715 "cs.ATG" Expression expr; ci = new ConstructorInitializer(); Expect(9); if (la.kind == 50) { lexer.NextToken(); -#line 1710 "cs.ATG" +#line 1719 "cs.ATG" ci.ConstructorInitializerType = ConstructorInitializerType.Base; } else if (la.kind == 110) { lexer.NextToken(); -#line 1711 "cs.ATG" +#line 1720 "cs.ATG" ci.ConstructorInitializerType = ConstructorInitializerType.This; } else SynErr(159); Expect(20); if (StartOf(21)) { Argument( -#line 1714 "cs.ATG" +#line 1723 "cs.ATG" out expr); -#line 1714 "cs.ATG" +#line 1723 "cs.ATG" if (expr != null) { ci.Arguments.Add(expr); } while (la.kind == 14) { lexer.NextToken(); Argument( -#line 1714 "cs.ATG" +#line 1723 "cs.ATG" out expr); -#line 1714 "cs.ATG" +#line 1723 "cs.ATG" if (expr != null) { ci.Arguments.Add(expr); } } } @@ -3053,161 +3065,161 @@ out expr); } void OverloadableOperator( -#line 1728 "cs.ATG" +#line 1737 "cs.ATG" out OverloadableOperatorType op) { -#line 1729 "cs.ATG" +#line 1738 "cs.ATG" op = OverloadableOperatorType.None; switch (la.kind) { case 4: { lexer.NextToken(); -#line 1731 "cs.ATG" +#line 1740 "cs.ATG" op = OverloadableOperatorType.Add; break; } case 5: { lexer.NextToken(); -#line 1732 "cs.ATG" +#line 1741 "cs.ATG" op = OverloadableOperatorType.Subtract; break; } case 24: { lexer.NextToken(); -#line 1734 "cs.ATG" +#line 1743 "cs.ATG" op = OverloadableOperatorType.Not; break; } case 27: { lexer.NextToken(); -#line 1735 "cs.ATG" +#line 1744 "cs.ATG" op = OverloadableOperatorType.BitNot; break; } case 31: { lexer.NextToken(); -#line 1737 "cs.ATG" +#line 1746 "cs.ATG" op = OverloadableOperatorType.Increment; break; } case 32: { lexer.NextToken(); -#line 1738 "cs.ATG" +#line 1747 "cs.ATG" op = OverloadableOperatorType.Decrement; break; } case 112: { lexer.NextToken(); -#line 1740 "cs.ATG" +#line 1749 "cs.ATG" op = OverloadableOperatorType.True; break; } case 71: { lexer.NextToken(); -#line 1741 "cs.ATG" +#line 1750 "cs.ATG" op = OverloadableOperatorType.False; break; } case 6: { lexer.NextToken(); -#line 1743 "cs.ATG" +#line 1752 "cs.ATG" op = OverloadableOperatorType.Multiply; break; } case 7: { lexer.NextToken(); -#line 1744 "cs.ATG" +#line 1753 "cs.ATG" op = OverloadableOperatorType.Divide; break; } case 8: { lexer.NextToken(); -#line 1745 "cs.ATG" +#line 1754 "cs.ATG" op = OverloadableOperatorType.Modulus; break; } case 28: { lexer.NextToken(); -#line 1747 "cs.ATG" +#line 1756 "cs.ATG" op = OverloadableOperatorType.BitwiseAnd; break; } case 29: { lexer.NextToken(); -#line 1748 "cs.ATG" +#line 1757 "cs.ATG" op = OverloadableOperatorType.BitwiseOr; break; } case 30: { lexer.NextToken(); -#line 1749 "cs.ATG" +#line 1758 "cs.ATG" op = OverloadableOperatorType.ExclusiveOr; break; } case 37: { lexer.NextToken(); -#line 1751 "cs.ATG" +#line 1760 "cs.ATG" op = OverloadableOperatorType.ShiftLeft; break; } case 33: { lexer.NextToken(); -#line 1752 "cs.ATG" +#line 1761 "cs.ATG" op = OverloadableOperatorType.Equality; break; } case 34: { lexer.NextToken(); -#line 1753 "cs.ATG" +#line 1762 "cs.ATG" op = OverloadableOperatorType.InEquality; break; } case 23: { lexer.NextToken(); -#line 1754 "cs.ATG" +#line 1763 "cs.ATG" op = OverloadableOperatorType.LessThan; break; } case 35: { lexer.NextToken(); -#line 1755 "cs.ATG" +#line 1764 "cs.ATG" op = OverloadableOperatorType.GreaterThanOrEqual; break; } case 36: { lexer.NextToken(); -#line 1756 "cs.ATG" +#line 1765 "cs.ATG" op = OverloadableOperatorType.LessThanOrEqual; break; } case 22: { lexer.NextToken(); -#line 1757 "cs.ATG" +#line 1766 "cs.ATG" op = OverloadableOperatorType.GreaterThan; if (la.kind == 22) { lexer.NextToken(); -#line 1757 "cs.ATG" +#line 1766 "cs.ATG" op = OverloadableOperatorType.ShiftRight; } break; @@ -3217,34 +3229,34 @@ out OverloadableOperatorType op) { } void VariableDeclarator( -#line 1667 "cs.ATG" +#line 1676 "cs.ATG" List fieldDeclaration) { -#line 1668 "cs.ATG" +#line 1677 "cs.ATG" Expression expr = null; Expect(1); -#line 1670 "cs.ATG" +#line 1679 "cs.ATG" VariableDeclaration f = new VariableDeclaration(t.val); if (la.kind == 3) { lexer.NextToken(); VariableInitializer( -#line 1671 "cs.ATG" +#line 1680 "cs.ATG" out expr); -#line 1671 "cs.ATG" +#line 1680 "cs.ATG" f.Initializer = expr; } -#line 1671 "cs.ATG" +#line 1680 "cs.ATG" fieldDeclaration.Add(f); } void AccessorDecls( -#line 1553 "cs.ATG" +#line 1562 "cs.ATG" out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { -#line 1555 "cs.ATG" +#line 1564 "cs.ATG" List attributes = new List(); AttributeSection section; getBlock = null; @@ -3253,96 +3265,96 @@ out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { while (la.kind == 18) { AttributeSection( -#line 1562 "cs.ATG" +#line 1571 "cs.ATG" out section); -#line 1562 "cs.ATG" +#line 1571 "cs.ATG" attributes.Add(section); } if (la.kind == 83 || la.kind == 95 || la.kind == 96) { AccessorModifiers( -#line 1563 "cs.ATG" +#line 1572 "cs.ATG" out modifiers); } if ( -#line 1565 "cs.ATG" +#line 1574 "cs.ATG" IdentIsGet()) { GetAccessorDecl( -#line 1566 "cs.ATG" +#line 1575 "cs.ATG" out getBlock, attributes); -#line 1567 "cs.ATG" +#line 1576 "cs.ATG" if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; } if (StartOf(22)) { -#line 1568 "cs.ATG" +#line 1577 "cs.ATG" attributes = new List(); modifiers = null; while (la.kind == 18) { AttributeSection( -#line 1569 "cs.ATG" +#line 1578 "cs.ATG" out section); -#line 1569 "cs.ATG" +#line 1578 "cs.ATG" attributes.Add(section); } if (la.kind == 83 || la.kind == 95 || la.kind == 96) { AccessorModifiers( -#line 1570 "cs.ATG" +#line 1579 "cs.ATG" out modifiers); } SetAccessorDecl( -#line 1571 "cs.ATG" +#line 1580 "cs.ATG" out setBlock, attributes); -#line 1572 "cs.ATG" +#line 1581 "cs.ATG" if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; } } } else if ( -#line 1574 "cs.ATG" +#line 1583 "cs.ATG" IdentIsSet()) { SetAccessorDecl( -#line 1575 "cs.ATG" +#line 1584 "cs.ATG" out setBlock, attributes); -#line 1576 "cs.ATG" +#line 1585 "cs.ATG" if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; } if (StartOf(22)) { -#line 1577 "cs.ATG" +#line 1586 "cs.ATG" attributes = new List(); modifiers = null; while (la.kind == 18) { AttributeSection( -#line 1578 "cs.ATG" +#line 1587 "cs.ATG" out section); -#line 1578 "cs.ATG" +#line 1587 "cs.ATG" attributes.Add(section); } if (la.kind == 83 || la.kind == 95 || la.kind == 96) { AccessorModifiers( -#line 1579 "cs.ATG" +#line 1588 "cs.ATG" out modifiers); } GetAccessorDecl( -#line 1580 "cs.ATG" +#line 1589 "cs.ATG" out getBlock, attributes); -#line 1581 "cs.ATG" +#line 1590 "cs.ATG" if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; } } } else if (la.kind == 1) { lexer.NextToken(); -#line 1583 "cs.ATG" +#line 1592 "cs.ATG" Error("get or set accessor declaration expected"); } else SynErr(161); } void InterfaceAccessors( -#line 1631 "cs.ATG" +#line 1640 "cs.ATG" out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { -#line 1633 "cs.ATG" +#line 1642 "cs.ATG" AttributeSection section; List attributes = new List(); getBlock = null; setBlock = null; @@ -3350,284 +3362,284 @@ out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { while (la.kind == 18) { AttributeSection( -#line 1639 "cs.ATG" +#line 1648 "cs.ATG" out section); -#line 1639 "cs.ATG" +#line 1648 "cs.ATG" attributes.Add(section); } -#line 1640 "cs.ATG" +#line 1649 "cs.ATG" Point startLocation = la.Location; if ( -#line 1642 "cs.ATG" +#line 1651 "cs.ATG" IdentIsGet()) { Expect(1); -#line 1642 "cs.ATG" +#line 1651 "cs.ATG" getBlock = new PropertyGetRegion(null, attributes); } else if ( -#line 1643 "cs.ATG" +#line 1652 "cs.ATG" IdentIsSet()) { Expect(1); -#line 1643 "cs.ATG" +#line 1652 "cs.ATG" setBlock = new PropertySetRegion(null, attributes); } else if (la.kind == 1) { lexer.NextToken(); -#line 1644 "cs.ATG" +#line 1653 "cs.ATG" Error("set or get expected"); } else SynErr(162); Expect(11); -#line 1647 "cs.ATG" +#line 1656 "cs.ATG" if (getBlock != null) { getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; } if (setBlock != null) { setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; } attributes = new List(); if (la.kind == 1 || la.kind == 18) { while (la.kind == 18) { AttributeSection( -#line 1651 "cs.ATG" +#line 1660 "cs.ATG" out section); -#line 1651 "cs.ATG" +#line 1660 "cs.ATG" attributes.Add(section); } -#line 1652 "cs.ATG" +#line 1661 "cs.ATG" startLocation = la.Location; if ( -#line 1654 "cs.ATG" +#line 1663 "cs.ATG" IdentIsGet()) { Expect(1); -#line 1654 "cs.ATG" +#line 1663 "cs.ATG" if (getBlock != null) Error("get already declared"); else { getBlock = new PropertyGetRegion(null, attributes); lastBlock = getBlock; } } else if ( -#line 1657 "cs.ATG" +#line 1666 "cs.ATG" IdentIsSet()) { Expect(1); -#line 1657 "cs.ATG" +#line 1666 "cs.ATG" if (setBlock != null) Error("set already declared"); else { setBlock = new PropertySetRegion(null, attributes); lastBlock = setBlock; } } else if (la.kind == 1) { lexer.NextToken(); -#line 1660 "cs.ATG" +#line 1669 "cs.ATG" Error("set or get expected"); } else SynErr(163); Expect(11); -#line 1663 "cs.ATG" +#line 1672 "cs.ATG" if (lastBlock != null) { lastBlock.StartLocation = startLocation; lastBlock.EndLocation = t.EndLocation; } } } void GetAccessorDecl( -#line 1587 "cs.ATG" +#line 1596 "cs.ATG" out PropertyGetRegion getBlock, List attributes) { -#line 1588 "cs.ATG" +#line 1597 "cs.ATG" Statement stmt = null; Expect(1); -#line 1591 "cs.ATG" +#line 1600 "cs.ATG" if (t.val != "get") Error("get expected"); -#line 1592 "cs.ATG" +#line 1601 "cs.ATG" Point startLocation = t.Location; if (la.kind == 16) { Block( -#line 1593 "cs.ATG" +#line 1602 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(164); -#line 1594 "cs.ATG" +#line 1603 "cs.ATG" getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes); -#line 1595 "cs.ATG" +#line 1604 "cs.ATG" getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; } void SetAccessorDecl( -#line 1598 "cs.ATG" +#line 1607 "cs.ATG" out PropertySetRegion setBlock, List attributes) { -#line 1599 "cs.ATG" +#line 1608 "cs.ATG" Statement stmt = null; Expect(1); -#line 1602 "cs.ATG" +#line 1611 "cs.ATG" if (t.val != "set") Error("set expected"); -#line 1603 "cs.ATG" +#line 1612 "cs.ATG" Point startLocation = t.Location; if (la.kind == 16) { Block( -#line 1604 "cs.ATG" +#line 1613 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(165); -#line 1605 "cs.ATG" +#line 1614 "cs.ATG" setBlock = new PropertySetRegion((BlockStatement)stmt, attributes); -#line 1606 "cs.ATG" +#line 1615 "cs.ATG" setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; } void AddAccessorDecl( -#line 1689 "cs.ATG" +#line 1698 "cs.ATG" out Statement stmt) { -#line 1690 "cs.ATG" +#line 1699 "cs.ATG" stmt = null; Expect(1); -#line 1693 "cs.ATG" +#line 1702 "cs.ATG" if (t.val != "add") Error("add expected"); Block( -#line 1694 "cs.ATG" +#line 1703 "cs.ATG" out stmt); } void RemoveAccessorDecl( -#line 1697 "cs.ATG" +#line 1706 "cs.ATG" out Statement stmt) { -#line 1698 "cs.ATG" +#line 1707 "cs.ATG" stmt = null; Expect(1); -#line 1701 "cs.ATG" +#line 1710 "cs.ATG" if (t.val != "remove") Error("remove expected"); Block( -#line 1702 "cs.ATG" +#line 1711 "cs.ATG" out stmt); } void VariableInitializer( -#line 1718 "cs.ATG" +#line 1727 "cs.ATG" out Expression initializerExpression) { -#line 1719 "cs.ATG" +#line 1728 "cs.ATG" TypeReference type = null; Expression expr = null; initializerExpression = null; if (StartOf(5)) { Expr( -#line 1721 "cs.ATG" +#line 1730 "cs.ATG" out initializerExpression); } else if (la.kind == 16) { ArrayInitializer( -#line 1722 "cs.ATG" +#line 1731 "cs.ATG" out initializerExpression); } else if (la.kind == 105) { lexer.NextToken(); Type( -#line 1723 "cs.ATG" +#line 1732 "cs.ATG" out type); Expect(18); Expr( -#line 1723 "cs.ATG" +#line 1732 "cs.ATG" out expr); Expect(19); -#line 1723 "cs.ATG" +#line 1732 "cs.ATG" initializerExpression = new StackAllocExpression(type, expr); } else if (la.kind == 62) { lexer.NextToken(); Expect(20); Type( -#line 1725 "cs.ATG" +#line 1734 "cs.ATG" out type); Expect(21); -#line 1725 "cs.ATG" +#line 1734 "cs.ATG" initializerExpression = new DefaultValueExpression(type); } else SynErr(166); } void Statement() { -#line 1837 "cs.ATG" +#line 1846 "cs.ATG" TypeReference type; Expression expr; Statement stmt = null; Point startPos = la.Location; if ( -#line 1845 "cs.ATG" +#line 1854 "cs.ATG" IsLabel()) { Expect(1); -#line 1845 "cs.ATG" +#line 1854 "cs.ATG" compilationUnit.AddChild(new LabelStatement(t.val)); Expect(9); Statement(); } else if (la.kind == 59) { lexer.NextToken(); Type( -#line 1848 "cs.ATG" +#line 1857 "cs.ATG" out type); -#line 1848 "cs.ATG" +#line 1857 "cs.ATG" LocalVariableDeclaration var = new LocalVariableDeclaration(type, Modifier.Const); string ident = null; var.StartLocation = t.Location; Expect(1); -#line 1849 "cs.ATG" +#line 1858 "cs.ATG" ident = t.val; Expect(3); Expr( -#line 1850 "cs.ATG" +#line 1859 "cs.ATG" out expr); -#line 1850 "cs.ATG" +#line 1859 "cs.ATG" var.Variables.Add(new VariableDeclaration(ident, expr)); while (la.kind == 14) { lexer.NextToken(); Expect(1); -#line 1851 "cs.ATG" +#line 1860 "cs.ATG" ident = t.val; Expect(3); Expr( -#line 1851 "cs.ATG" +#line 1860 "cs.ATG" out expr); -#line 1851 "cs.ATG" +#line 1860 "cs.ATG" var.Variables.Add(new VariableDeclaration(ident, expr)); } Expect(11); -#line 1852 "cs.ATG" +#line 1861 "cs.ATG" compilationUnit.AddChild(var); } else if ( -#line 1854 "cs.ATG" +#line 1863 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 1854 "cs.ATG" +#line 1863 "cs.ATG" out stmt); Expect(11); -#line 1854 "cs.ATG" +#line 1863 "cs.ATG" compilationUnit.AddChild(stmt); } else if (StartOf(23)) { EmbeddedStatement( -#line 1855 "cs.ATG" +#line 1864 "cs.ATG" out stmt); -#line 1855 "cs.ATG" +#line 1864 "cs.ATG" compilationUnit.AddChild(stmt); } else SynErr(167); -#line 1861 "cs.ATG" +#line 1870 "cs.ATG" if (stmt != null) { stmt.StartLocation = startPos; stmt.EndLocation = t.EndLocation; @@ -3636,10 +3648,10 @@ out stmt); } void Argument( -#line 1760 "cs.ATG" +#line 1769 "cs.ATG" out Expression argumentexpr) { -#line 1762 "cs.ATG" +#line 1771 "cs.ATG" Expression expr; FieldDirection fd = FieldDirection.None; @@ -3647,48 +3659,48 @@ out Expression argumentexpr) { if (la.kind == 99) { lexer.NextToken(); -#line 1767 "cs.ATG" +#line 1776 "cs.ATG" fd = FieldDirection.Ref; } else { lexer.NextToken(); -#line 1768 "cs.ATG" +#line 1777 "cs.ATG" fd = FieldDirection.Out; } } Expr( -#line 1770 "cs.ATG" +#line 1779 "cs.ATG" out expr); -#line 1770 "cs.ATG" +#line 1779 "cs.ATG" argumentexpr = fd != FieldDirection.None ? argumentexpr = new DirectionExpression(fd, expr) : expr; } void ArrayInitializer( -#line 1790 "cs.ATG" +#line 1799 "cs.ATG" out Expression outExpr) { -#line 1792 "cs.ATG" +#line 1801 "cs.ATG" Expression expr = null; ArrayInitializerExpression initializer = new ArrayInitializerExpression(); Expect(16); if (StartOf(24)) { VariableInitializer( -#line 1797 "cs.ATG" +#line 1806 "cs.ATG" out expr); -#line 1798 "cs.ATG" +#line 1807 "cs.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } while ( -#line 1799 "cs.ATG" +#line 1808 "cs.ATG" NotFinalComma()) { Expect(14); VariableInitializer( -#line 1800 "cs.ATG" +#line 1809 "cs.ATG" out expr); -#line 1801 "cs.ATG" +#line 1810 "cs.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } } if (la.kind == 14) { @@ -3697,138 +3709,138 @@ out expr); } Expect(17); -#line 1805 "cs.ATG" +#line 1814 "cs.ATG" outExpr = initializer; } void AssignmentOperator( -#line 1773 "cs.ATG" +#line 1782 "cs.ATG" out AssignmentOperatorType op) { -#line 1774 "cs.ATG" +#line 1783 "cs.ATG" op = AssignmentOperatorType.None; if (la.kind == 3) { lexer.NextToken(); -#line 1776 "cs.ATG" +#line 1785 "cs.ATG" op = AssignmentOperatorType.Assign; } else if (la.kind == 38) { lexer.NextToken(); -#line 1777 "cs.ATG" +#line 1786 "cs.ATG" op = AssignmentOperatorType.Add; } else if (la.kind == 39) { lexer.NextToken(); -#line 1778 "cs.ATG" +#line 1787 "cs.ATG" op = AssignmentOperatorType.Subtract; } else if (la.kind == 40) { lexer.NextToken(); -#line 1779 "cs.ATG" +#line 1788 "cs.ATG" op = AssignmentOperatorType.Multiply; } else if (la.kind == 41) { lexer.NextToken(); -#line 1780 "cs.ATG" +#line 1789 "cs.ATG" op = AssignmentOperatorType.Divide; } else if (la.kind == 42) { lexer.NextToken(); -#line 1781 "cs.ATG" +#line 1790 "cs.ATG" op = AssignmentOperatorType.Modulus; } else if (la.kind == 43) { lexer.NextToken(); -#line 1782 "cs.ATG" +#line 1791 "cs.ATG" op = AssignmentOperatorType.BitwiseAnd; } else if (la.kind == 44) { lexer.NextToken(); -#line 1783 "cs.ATG" +#line 1792 "cs.ATG" op = AssignmentOperatorType.BitwiseOr; } else if (la.kind == 45) { lexer.NextToken(); -#line 1784 "cs.ATG" +#line 1793 "cs.ATG" op = AssignmentOperatorType.ExclusiveOr; } else if (la.kind == 46) { lexer.NextToken(); -#line 1785 "cs.ATG" +#line 1794 "cs.ATG" op = AssignmentOperatorType.ShiftLeft; } else if ( -#line 1786 "cs.ATG" +#line 1795 "cs.ATG" la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) { Expect(22); Expect(35); -#line 1787 "cs.ATG" +#line 1796 "cs.ATG" op = AssignmentOperatorType.ShiftRight; } else SynErr(168); } void LocalVariableDecl( -#line 1808 "cs.ATG" +#line 1817 "cs.ATG" out Statement stmt) { -#line 1810 "cs.ATG" +#line 1819 "cs.ATG" TypeReference type; VariableDeclaration var = null; LocalVariableDeclaration localVariableDeclaration; Type( -#line 1815 "cs.ATG" +#line 1824 "cs.ATG" out type); -#line 1815 "cs.ATG" +#line 1824 "cs.ATG" localVariableDeclaration = new LocalVariableDeclaration(type); localVariableDeclaration.StartLocation = t.Location; LocalVariableDeclarator( -#line 1816 "cs.ATG" +#line 1825 "cs.ATG" out var); -#line 1816 "cs.ATG" +#line 1825 "cs.ATG" localVariableDeclaration.Variables.Add(var); while (la.kind == 14) { lexer.NextToken(); LocalVariableDeclarator( -#line 1817 "cs.ATG" +#line 1826 "cs.ATG" out var); -#line 1817 "cs.ATG" +#line 1826 "cs.ATG" localVariableDeclaration.Variables.Add(var); } -#line 1818 "cs.ATG" +#line 1827 "cs.ATG" stmt = localVariableDeclaration; } void LocalVariableDeclarator( -#line 1821 "cs.ATG" +#line 1830 "cs.ATG" out VariableDeclaration var) { -#line 1822 "cs.ATG" +#line 1831 "cs.ATG" Expression expr = null; Expect(1); -#line 1825 "cs.ATG" +#line 1834 "cs.ATG" var = new VariableDeclaration(t.val); if (la.kind == 3) { lexer.NextToken(); VariableInitializer( -#line 1825 "cs.ATG" +#line 1834 "cs.ATG" out expr); -#line 1825 "cs.ATG" +#line 1834 "cs.ATG" var.Initializer = expr; } } void EmbeddedStatement( -#line 1868 "cs.ATG" +#line 1877 "cs.ATG" out Statement statement) { -#line 1870 "cs.ATG" +#line 1879 "cs.ATG" TypeReference type = null; Expression expr = null; Statement embeddedStatement = null; @@ -3836,57 +3848,57 @@ out Statement statement) { if (la.kind == 16) { Block( -#line 1876 "cs.ATG" +#line 1885 "cs.ATG" out statement); } else if (la.kind == 11) { lexer.NextToken(); -#line 1878 "cs.ATG" +#line 1887 "cs.ATG" statement = new EmptyStatement(); } else if ( -#line 1880 "cs.ATG" +#line 1889 "cs.ATG" UnCheckedAndLBrace()) { -#line 1880 "cs.ATG" +#line 1889 "cs.ATG" Statement block; bool isChecked = true; if (la.kind == 57) { lexer.NextToken(); } else if (la.kind == 117) { lexer.NextToken(); -#line 1881 "cs.ATG" +#line 1890 "cs.ATG" isChecked = false; } else SynErr(169); Block( -#line 1882 "cs.ATG" +#line 1891 "cs.ATG" out block); -#line 1882 "cs.ATG" +#line 1891 "cs.ATG" statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); } else if (la.kind == 78) { lexer.NextToken(); -#line 1884 "cs.ATG" +#line 1893 "cs.ATG" Statement elseStatement = null; Expect(20); Expr( -#line 1885 "cs.ATG" +#line 1894 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1886 "cs.ATG" +#line 1895 "cs.ATG" out embeddedStatement); if (la.kind == 66) { lexer.NextToken(); EmbeddedStatement( -#line 1887 "cs.ATG" +#line 1896 "cs.ATG" out elseStatement); } -#line 1888 "cs.ATG" +#line 1897 "cs.ATG" statement = elseStatement != null ? new IfElseStatement(expr, embeddedStatement, elseStatement) : new IfElseStatement(expr, embeddedStatement); -#line 1889 "cs.ATG" +#line 1898 "cs.ATG" if (elseStatement is IfElseStatement && (elseStatement as IfElseStatement).TrueStatement.Count == 1) { /* else if-section (otherwise we would have a BlockStatment) */ (statement as IfElseStatement).ElseIfSections.Add( @@ -3898,104 +3910,104 @@ out elseStatement); } else if (la.kind == 109) { lexer.NextToken(); -#line 1897 "cs.ATG" +#line 1906 "cs.ATG" List switchSections = new List(); SwitchSection switchSection; Expect(20); Expr( -#line 1898 "cs.ATG" +#line 1907 "cs.ATG" out expr); Expect(21); Expect(16); while (la.kind == 54 || la.kind == 62) { SwitchSection( -#line 1899 "cs.ATG" +#line 1908 "cs.ATG" out switchSection); -#line 1899 "cs.ATG" +#line 1908 "cs.ATG" switchSections.Add(switchSection); } Expect(17); -#line 1900 "cs.ATG" +#line 1909 "cs.ATG" statement = new SwitchStatement(expr, switchSections); } else if (la.kind == 124) { lexer.NextToken(); Expect(20); Expr( -#line 1902 "cs.ATG" +#line 1911 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1904 "cs.ATG" +#line 1913 "cs.ATG" out embeddedStatement); -#line 1904 "cs.ATG" +#line 1913 "cs.ATG" statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start); } else if (la.kind == 64) { lexer.NextToken(); EmbeddedStatement( -#line 1905 "cs.ATG" +#line 1914 "cs.ATG" out embeddedStatement); Expect(124); Expect(20); Expr( -#line 1906 "cs.ATG" +#line 1915 "cs.ATG" out expr); Expect(21); Expect(11); -#line 1906 "cs.ATG" +#line 1915 "cs.ATG" statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End); } else if (la.kind == 75) { lexer.NextToken(); -#line 1907 "cs.ATG" +#line 1916 "cs.ATG" List initializer = null; List iterator = null; Expect(20); if (StartOf(5)) { ForInitializer( -#line 1908 "cs.ATG" +#line 1917 "cs.ATG" out initializer); } Expect(11); if (StartOf(5)) { Expr( -#line 1909 "cs.ATG" +#line 1918 "cs.ATG" out expr); } Expect(11); if (StartOf(5)) { ForIterator( -#line 1910 "cs.ATG" +#line 1919 "cs.ATG" out iterator); } Expect(21); EmbeddedStatement( -#line 1911 "cs.ATG" +#line 1920 "cs.ATG" out embeddedStatement); -#line 1911 "cs.ATG" +#line 1920 "cs.ATG" statement = new ForStatement(initializer, expr, iterator, embeddedStatement); } else if (la.kind == 76) { lexer.NextToken(); Expect(20); Type( -#line 1912 "cs.ATG" +#line 1921 "cs.ATG" out type); Expect(1); -#line 1912 "cs.ATG" +#line 1921 "cs.ATG" string varName = t.val; Point start = t.Location; Expect(80); Expr( -#line 1913 "cs.ATG" +#line 1922 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1914 "cs.ATG" +#line 1923 "cs.ATG" out embeddedStatement); -#line 1914 "cs.ATG" +#line 1923 "cs.ATG" statement = new ForeachStatement(type, varName , expr, embeddedStatement); statement.EndLocation = t.EndLocation; @@ -4003,34 +4015,34 @@ out embeddedStatement); lexer.NextToken(); Expect(11); -#line 1918 "cs.ATG" +#line 1927 "cs.ATG" statement = new BreakStatement(); } else if (la.kind == 60) { lexer.NextToken(); Expect(11); -#line 1919 "cs.ATG" +#line 1928 "cs.ATG" statement = new ContinueStatement(); } else if (la.kind == 77) { GotoStatement( -#line 1920 "cs.ATG" +#line 1929 "cs.ATG" out statement); } else if ( -#line 1921 "cs.ATG" +#line 1930 "cs.ATG" IsYieldStatement()) { Expect(1); if (la.kind == 100) { lexer.NextToken(); Expr( -#line 1921 "cs.ATG" +#line 1930 "cs.ATG" out expr); -#line 1921 "cs.ATG" +#line 1930 "cs.ATG" statement = new YieldStatement(new ReturnStatement(expr)); } else if (la.kind == 52) { lexer.NextToken(); -#line 1922 "cs.ATG" +#line 1931 "cs.ATG" statement = new YieldStatement(new BreakStatement()); } else SynErr(170); Expect(11); @@ -4038,488 +4050,488 @@ out expr); lexer.NextToken(); if (StartOf(5)) { Expr( -#line 1923 "cs.ATG" +#line 1932 "cs.ATG" out expr); } Expect(11); -#line 1923 "cs.ATG" +#line 1932 "cs.ATG" statement = new ReturnStatement(expr); } else if (la.kind == 111) { lexer.NextToken(); if (StartOf(5)) { Expr( -#line 1924 "cs.ATG" +#line 1933 "cs.ATG" out expr); } Expect(11); -#line 1924 "cs.ATG" +#line 1933 "cs.ATG" statement = new ThrowStatement(expr); } else if (StartOf(5)) { StatementExpr( -#line 1927 "cs.ATG" +#line 1936 "cs.ATG" out statement); Expect(11); } else if (la.kind == 113) { TryStatement( -#line 1929 "cs.ATG" +#line 1938 "cs.ATG" out statement); } else if (la.kind == 85) { lexer.NextToken(); Expect(20); Expr( -#line 1931 "cs.ATG" +#line 1940 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1932 "cs.ATG" +#line 1941 "cs.ATG" out embeddedStatement); -#line 1932 "cs.ATG" +#line 1941 "cs.ATG" statement = new LockStatement(expr, embeddedStatement); } else if (la.kind == 120) { -#line 1934 "cs.ATG" +#line 1943 "cs.ATG" Statement resourceAcquisitionStmt = null; lexer.NextToken(); Expect(20); ResourceAcquisition( -#line 1936 "cs.ATG" +#line 1945 "cs.ATG" out resourceAcquisitionStmt); Expect(21); EmbeddedStatement( -#line 1937 "cs.ATG" +#line 1946 "cs.ATG" out embeddedStatement); -#line 1937 "cs.ATG" +#line 1946 "cs.ATG" statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement); } else if (la.kind == 118) { lexer.NextToken(); Block( -#line 1939 "cs.ATG" +#line 1948 "cs.ATG" out embeddedStatement); -#line 1939 "cs.ATG" +#line 1948 "cs.ATG" statement = new UnsafeStatement(embeddedStatement); } else if (la.kind == 73) { lexer.NextToken(); Expect(20); Type( -#line 1942 "cs.ATG" +#line 1951 "cs.ATG" out type); -#line 1942 "cs.ATG" +#line 1951 "cs.ATG" if (type.PointerNestingLevel == 0) Error("can only fix pointer types"); List pointerDeclarators = new List(1); Expect(1); -#line 1945 "cs.ATG" +#line 1954 "cs.ATG" string identifier = t.val; Expect(3); Expr( -#line 1946 "cs.ATG" +#line 1955 "cs.ATG" out expr); -#line 1946 "cs.ATG" +#line 1955 "cs.ATG" pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); while (la.kind == 14) { lexer.NextToken(); Expect(1); -#line 1948 "cs.ATG" +#line 1957 "cs.ATG" identifier = t.val; Expect(3); Expr( -#line 1949 "cs.ATG" +#line 1958 "cs.ATG" out expr); -#line 1949 "cs.ATG" +#line 1958 "cs.ATG" pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); } Expect(21); EmbeddedStatement( -#line 1951 "cs.ATG" +#line 1960 "cs.ATG" out embeddedStatement); -#line 1951 "cs.ATG" +#line 1960 "cs.ATG" statement = new FixedStatement(type, pointerDeclarators, embeddedStatement); } else SynErr(171); } void SwitchSection( -#line 1973 "cs.ATG" +#line 1982 "cs.ATG" out SwitchSection stmt) { -#line 1975 "cs.ATG" +#line 1984 "cs.ATG" SwitchSection switchSection = new SwitchSection(); CaseLabel label; SwitchLabel( -#line 1979 "cs.ATG" +#line 1988 "cs.ATG" out label); -#line 1979 "cs.ATG" +#line 1988 "cs.ATG" if (label != null) { switchSection.SwitchLabels.Add(label); } while (la.kind == 54 || la.kind == 62) { SwitchLabel( -#line 1981 "cs.ATG" +#line 1990 "cs.ATG" out label); -#line 1981 "cs.ATG" +#line 1990 "cs.ATG" if (label != null) { switchSection.SwitchLabels.Add(label); } } -#line 1983 "cs.ATG" +#line 1992 "cs.ATG" compilationUnit.BlockStart(switchSection); Statement(); while (StartOf(20)) { Statement(); } -#line 1986 "cs.ATG" +#line 1995 "cs.ATG" compilationUnit.BlockEnd(); stmt = switchSection; } void ForInitializer( -#line 1954 "cs.ATG" +#line 1963 "cs.ATG" out List initializer) { -#line 1956 "cs.ATG" +#line 1965 "cs.ATG" Statement stmt; initializer = new List(); if ( -#line 1960 "cs.ATG" +#line 1969 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 1960 "cs.ATG" +#line 1969 "cs.ATG" out stmt); -#line 1960 "cs.ATG" +#line 1969 "cs.ATG" initializer.Add(stmt); } else if (StartOf(5)) { StatementExpr( -#line 1961 "cs.ATG" +#line 1970 "cs.ATG" out stmt); -#line 1961 "cs.ATG" +#line 1970 "cs.ATG" initializer.Add(stmt); while (la.kind == 14) { lexer.NextToken(); StatementExpr( -#line 1961 "cs.ATG" +#line 1970 "cs.ATG" out stmt); -#line 1961 "cs.ATG" +#line 1970 "cs.ATG" initializer.Add(stmt); } } else SynErr(172); } void ForIterator( -#line 1964 "cs.ATG" +#line 1973 "cs.ATG" out List iterator) { -#line 1966 "cs.ATG" +#line 1975 "cs.ATG" Statement stmt; iterator = new List(); StatementExpr( -#line 1970 "cs.ATG" +#line 1979 "cs.ATG" out stmt); -#line 1970 "cs.ATG" +#line 1979 "cs.ATG" iterator.Add(stmt); while (la.kind == 14) { lexer.NextToken(); StatementExpr( -#line 1970 "cs.ATG" +#line 1979 "cs.ATG" out stmt); -#line 1970 "cs.ATG" +#line 1979 "cs.ATG" iterator.Add(stmt); } } void GotoStatement( -#line 2041 "cs.ATG" +#line 2050 "cs.ATG" out Statement stmt) { -#line 2042 "cs.ATG" +#line 2051 "cs.ATG" Expression expr; stmt = null; Expect(77); if (la.kind == 1) { lexer.NextToken(); -#line 2046 "cs.ATG" +#line 2055 "cs.ATG" stmt = new GotoStatement(t.val); Expect(11); } else if (la.kind == 54) { lexer.NextToken(); Expr( -#line 2047 "cs.ATG" +#line 2056 "cs.ATG" out expr); Expect(11); -#line 2047 "cs.ATG" +#line 2056 "cs.ATG" stmt = new GotoCaseStatement(expr); } else if (la.kind == 62) { lexer.NextToken(); Expect(11); -#line 2048 "cs.ATG" +#line 2057 "cs.ATG" stmt = new GotoCaseStatement(null); } else SynErr(173); } void StatementExpr( -#line 2068 "cs.ATG" +#line 2077 "cs.ATG" out Statement stmt) { -#line 2069 "cs.ATG" +#line 2078 "cs.ATG" Expression expr; Expr( -#line 2071 "cs.ATG" +#line 2080 "cs.ATG" out expr); -#line 2074 "cs.ATG" +#line 2083 "cs.ATG" stmt = new StatementExpression(expr); } void TryStatement( -#line 1998 "cs.ATG" +#line 2007 "cs.ATG" out Statement tryStatement) { -#line 2000 "cs.ATG" +#line 2009 "cs.ATG" Statement blockStmt = null, finallyStmt = null; List catchClauses = null; Expect(113); Block( -#line 2004 "cs.ATG" +#line 2013 "cs.ATG" out blockStmt); if (la.kind == 55) { CatchClauses( -#line 2006 "cs.ATG" +#line 2015 "cs.ATG" out catchClauses); if (la.kind == 72) { lexer.NextToken(); Block( -#line 2006 "cs.ATG" +#line 2015 "cs.ATG" out finallyStmt); } } else if (la.kind == 72) { lexer.NextToken(); Block( -#line 2007 "cs.ATG" +#line 2016 "cs.ATG" out finallyStmt); } else SynErr(174); -#line 2010 "cs.ATG" +#line 2019 "cs.ATG" tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt); } void ResourceAcquisition( -#line 2052 "cs.ATG" +#line 2061 "cs.ATG" out Statement stmt) { -#line 2054 "cs.ATG" +#line 2063 "cs.ATG" stmt = null; Expression expr; if ( -#line 2059 "cs.ATG" +#line 2068 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 2059 "cs.ATG" +#line 2068 "cs.ATG" out stmt); } else if (StartOf(5)) { Expr( -#line 2060 "cs.ATG" +#line 2069 "cs.ATG" out expr); -#line 2064 "cs.ATG" +#line 2073 "cs.ATG" stmt = new StatementExpression(expr); } else SynErr(175); } void SwitchLabel( -#line 1991 "cs.ATG" +#line 2000 "cs.ATG" out CaseLabel label) { -#line 1992 "cs.ATG" +#line 2001 "cs.ATG" Expression expr = null; label = null; if (la.kind == 54) { lexer.NextToken(); Expr( -#line 1994 "cs.ATG" +#line 2003 "cs.ATG" out expr); Expect(9); -#line 1994 "cs.ATG" +#line 2003 "cs.ATG" label = new CaseLabel(expr); } else if (la.kind == 62) { lexer.NextToken(); Expect(9); -#line 1995 "cs.ATG" +#line 2004 "cs.ATG" label = new CaseLabel(); } else SynErr(176); } void CatchClauses( -#line 2015 "cs.ATG" +#line 2024 "cs.ATG" out List catchClauses) { -#line 2017 "cs.ATG" +#line 2026 "cs.ATG" catchClauses = new List(); Expect(55); -#line 2020 "cs.ATG" +#line 2029 "cs.ATG" string identifier; Statement stmt; TypeReference typeRef; if (la.kind == 16) { Block( -#line 2026 "cs.ATG" +#line 2035 "cs.ATG" out stmt); -#line 2026 "cs.ATG" +#line 2035 "cs.ATG" catchClauses.Add(new CatchClause(stmt)); } else if (la.kind == 20) { lexer.NextToken(); ClassType( -#line 2028 "cs.ATG" +#line 2037 "cs.ATG" out typeRef, false); -#line 2028 "cs.ATG" +#line 2037 "cs.ATG" identifier = null; if (la.kind == 1) { lexer.NextToken(); -#line 2029 "cs.ATG" +#line 2038 "cs.ATG" identifier = t.val; } Expect(21); Block( -#line 2030 "cs.ATG" +#line 2039 "cs.ATG" out stmt); -#line 2031 "cs.ATG" +#line 2040 "cs.ATG" catchClauses.Add(new CatchClause(typeRef, identifier, stmt)); while ( -#line 2032 "cs.ATG" +#line 2041 "cs.ATG" IsTypedCatch()) { Expect(55); Expect(20); ClassType( -#line 2032 "cs.ATG" +#line 2041 "cs.ATG" out typeRef, false); -#line 2032 "cs.ATG" +#line 2041 "cs.ATG" identifier = null; if (la.kind == 1) { lexer.NextToken(); -#line 2033 "cs.ATG" +#line 2042 "cs.ATG" identifier = t.val; } Expect(21); Block( -#line 2034 "cs.ATG" +#line 2043 "cs.ATG" out stmt); -#line 2035 "cs.ATG" +#line 2044 "cs.ATG" catchClauses.Add(new CatchClause(typeRef, identifier, stmt)); } if (la.kind == 55) { lexer.NextToken(); Block( -#line 2037 "cs.ATG" +#line 2046 "cs.ATG" out stmt); -#line 2037 "cs.ATG" +#line 2046 "cs.ATG" catchClauses.Add(new CatchClause(stmt)); } } else SynErr(177); } void UnaryExpr( -#line 2095 "cs.ATG" +#line 2104 "cs.ATG" out Expression uExpr) { -#line 2097 "cs.ATG" +#line 2106 "cs.ATG" TypeReference type = null; Expression expr; ArrayList expressions = new ArrayList(); uExpr = null; while (StartOf(25) || -#line 2119 "cs.ATG" +#line 2128 "cs.ATG" IsTypeCast()) { if (la.kind == 4) { lexer.NextToken(); -#line 2106 "cs.ATG" +#line 2115 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Plus)); } else if (la.kind == 5) { lexer.NextToken(); -#line 2107 "cs.ATG" +#line 2116 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Minus)); } else if (la.kind == 24) { lexer.NextToken(); -#line 2108 "cs.ATG" +#line 2117 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Not)); } else if (la.kind == 27) { lexer.NextToken(); -#line 2109 "cs.ATG" +#line 2118 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.BitNot)); } else if (la.kind == 6) { lexer.NextToken(); -#line 2110 "cs.ATG" +#line 2119 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Star)); } else if (la.kind == 31) { lexer.NextToken(); -#line 2111 "cs.ATG" +#line 2120 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Increment)); } else if (la.kind == 32) { lexer.NextToken(); -#line 2112 "cs.ATG" +#line 2121 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Decrement)); } else if (la.kind == 28) { lexer.NextToken(); -#line 2113 "cs.ATG" +#line 2122 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.BitWiseAnd)); } else { Expect(20); Type( -#line 2119 "cs.ATG" +#line 2128 "cs.ATG" out type); Expect(21); -#line 2119 "cs.ATG" +#line 2128 "cs.ATG" expressions.Add(new CastExpression(type)); } } PrimaryExpr( -#line 2123 "cs.ATG" +#line 2132 "cs.ATG" out expr); -#line 2123 "cs.ATG" +#line 2132 "cs.ATG" for (int i = 0; i < expressions.Count; ++i) { Expression nextExpression = i + 1 < expressions.Count ? (Expression)expressions[i + 1] : expr; if (expressions[i] is CastExpression) { @@ -4537,33 +4549,33 @@ out expr); } void ConditionalOrExpr( -#line 2294 "cs.ATG" +#line 2303 "cs.ATG" ref Expression outExpr) { -#line 2295 "cs.ATG" +#line 2304 "cs.ATG" Expression expr; ConditionalAndExpr( -#line 2297 "cs.ATG" +#line 2306 "cs.ATG" ref outExpr); while (la.kind == 26) { lexer.NextToken(); UnaryExpr( -#line 2297 "cs.ATG" +#line 2306 "cs.ATG" out expr); ConditionalAndExpr( -#line 2297 "cs.ATG" +#line 2306 "cs.ATG" ref expr); -#line 2297 "cs.ATG" +#line 2306 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalOr, expr); } } void PrimaryExpr( -#line 2140 "cs.ATG" +#line 2149 "cs.ATG" out Expression pexpr) { -#line 2142 "cs.ATG" +#line 2151 "cs.ATG" TypeReference type = null; List typeList = null; bool isArrayCreation = false; @@ -4573,332 +4585,332 @@ out Expression pexpr) { if (la.kind == 112) { lexer.NextToken(); -#line 2150 "cs.ATG" +#line 2159 "cs.ATG" pexpr = new PrimitiveExpression(true, "true"); } else if (la.kind == 71) { lexer.NextToken(); -#line 2151 "cs.ATG" +#line 2160 "cs.ATG" pexpr = new PrimitiveExpression(false, "false"); } else if (la.kind == 89) { lexer.NextToken(); -#line 2152 "cs.ATG" +#line 2161 "cs.ATG" pexpr = new PrimitiveExpression(null, "null"); } else if (la.kind == 2) { lexer.NextToken(); -#line 2153 "cs.ATG" +#line 2162 "cs.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); } else if ( -#line 2154 "cs.ATG" +#line 2163 "cs.ATG" la.kind == Tokens.Identifier && Peek(1).kind == Tokens.DoubleColon) { Expect(1); -#line 2155 "cs.ATG" +#line 2164 "cs.ATG" type = new TypeReference(t.val); Expect(10); -#line 2156 "cs.ATG" +#line 2165 "cs.ATG" pexpr = new TypeReferenceExpression(type); Expect(1); -#line 2157 "cs.ATG" +#line 2166 "cs.ATG" if (type.Type == "global") { type.IsGlobal = true; type.Type = (t.val ?? "?"); } else type.Type += "." + (t.val ?? "?"); } else if (la.kind == 1) { lexer.NextToken(); -#line 2159 "cs.ATG" +#line 2168 "cs.ATG" pexpr = new IdentifierExpression(t.val); } else if (la.kind == 20) { lexer.NextToken(); Expr( -#line 2161 "cs.ATG" +#line 2170 "cs.ATG" out expr); Expect(21); -#line 2161 "cs.ATG" +#line 2170 "cs.ATG" pexpr = new ParenthesizedExpression(expr); } else if (StartOf(26)) { -#line 2163 "cs.ATG" +#line 2172 "cs.ATG" string val = null; switch (la.kind) { case 51: { lexer.NextToken(); -#line 2165 "cs.ATG" +#line 2174 "cs.ATG" val = "bool"; break; } case 53: { lexer.NextToken(); -#line 2166 "cs.ATG" +#line 2175 "cs.ATG" val = "byte"; break; } case 56: { lexer.NextToken(); -#line 2167 "cs.ATG" +#line 2176 "cs.ATG" val = "char"; break; } case 61: { lexer.NextToken(); -#line 2168 "cs.ATG" +#line 2177 "cs.ATG" val = "decimal"; break; } case 65: { lexer.NextToken(); -#line 2169 "cs.ATG" +#line 2178 "cs.ATG" val = "double"; break; } case 74: { lexer.NextToken(); -#line 2170 "cs.ATG" +#line 2179 "cs.ATG" val = "float"; break; } case 81: { lexer.NextToken(); -#line 2171 "cs.ATG" +#line 2180 "cs.ATG" val = "int"; break; } case 86: { lexer.NextToken(); -#line 2172 "cs.ATG" +#line 2181 "cs.ATG" val = "long"; break; } case 90: { lexer.NextToken(); -#line 2173 "cs.ATG" +#line 2182 "cs.ATG" val = "object"; break; } case 101: { lexer.NextToken(); -#line 2174 "cs.ATG" +#line 2183 "cs.ATG" val = "sbyte"; break; } case 103: { lexer.NextToken(); -#line 2175 "cs.ATG" +#line 2184 "cs.ATG" val = "short"; break; } case 107: { lexer.NextToken(); -#line 2176 "cs.ATG" +#line 2185 "cs.ATG" val = "string"; break; } case 115: { lexer.NextToken(); -#line 2177 "cs.ATG" +#line 2186 "cs.ATG" val = "uint"; break; } case 116: { lexer.NextToken(); -#line 2178 "cs.ATG" +#line 2187 "cs.ATG" val = "ulong"; break; } case 119: { lexer.NextToken(); -#line 2179 "cs.ATG" +#line 2188 "cs.ATG" val = "ushort"; break; } } -#line 2180 "cs.ATG" +#line 2189 "cs.ATG" t.val = ""; Expect(15); Expect(1); -#line 2180 "cs.ATG" +#line 2189 "cs.ATG" pexpr = new FieldReferenceExpression(new TypeReferenceExpression(val), t.val); } else if (la.kind == 110) { lexer.NextToken(); -#line 2182 "cs.ATG" +#line 2191 "cs.ATG" pexpr = new ThisReferenceExpression(); } else if (la.kind == 50) { lexer.NextToken(); -#line 2184 "cs.ATG" +#line 2193 "cs.ATG" Expression retExpr = new BaseReferenceExpression(); if (la.kind == 15) { lexer.NextToken(); Expect(1); -#line 2186 "cs.ATG" +#line 2195 "cs.ATG" retExpr = new FieldReferenceExpression(retExpr, t.val); } else if (la.kind == 18) { lexer.NextToken(); Expr( -#line 2187 "cs.ATG" +#line 2196 "cs.ATG" out expr); -#line 2187 "cs.ATG" +#line 2196 "cs.ATG" List indices = new List(); if (expr != null) { indices.Add(expr); } while (la.kind == 14) { lexer.NextToken(); Expr( -#line 2188 "cs.ATG" +#line 2197 "cs.ATG" out expr); -#line 2188 "cs.ATG" +#line 2197 "cs.ATG" if (expr != null) { indices.Add(expr); } } Expect(19); -#line 2189 "cs.ATG" +#line 2198 "cs.ATG" retExpr = new IndexerExpression(retExpr, indices); } else SynErr(178); -#line 2190 "cs.ATG" +#line 2199 "cs.ATG" pexpr = retExpr; } else if (la.kind == 88) { lexer.NextToken(); NonArrayType( -#line 2191 "cs.ATG" +#line 2200 "cs.ATG" out type); -#line 2192 "cs.ATG" +#line 2201 "cs.ATG" List parameters = new List(); if (la.kind == 20) { lexer.NextToken(); -#line 2197 "cs.ATG" +#line 2206 "cs.ATG" ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); if (StartOf(21)) { Argument( -#line 2198 "cs.ATG" +#line 2207 "cs.ATG" out expr); -#line 2198 "cs.ATG" +#line 2207 "cs.ATG" if (expr != null) { parameters.Add(expr); } while (la.kind == 14) { lexer.NextToken(); Argument( -#line 2199 "cs.ATG" +#line 2208 "cs.ATG" out expr); -#line 2199 "cs.ATG" +#line 2208 "cs.ATG" if (expr != null) { parameters.Add(expr); } } } Expect(21); -#line 2201 "cs.ATG" +#line 2210 "cs.ATG" pexpr = oce; } else if (la.kind == 18) { lexer.NextToken(); -#line 2203 "cs.ATG" +#line 2212 "cs.ATG" isArrayCreation = true; ArrayCreateExpression ace = new ArrayCreateExpression(type); pexpr = ace; -#line 2204 "cs.ATG" +#line 2213 "cs.ATG" int dims = 0; List ranks = new List(); if (la.kind == 14 || la.kind == 19) { while (la.kind == 14) { lexer.NextToken(); -#line 2206 "cs.ATG" +#line 2215 "cs.ATG" dims += 1; } Expect(19); -#line 2207 "cs.ATG" +#line 2216 "cs.ATG" ranks.Add(dims); dims = 0; while (la.kind == 18) { lexer.NextToken(); while (la.kind == 14) { lexer.NextToken(); -#line 2208 "cs.ATG" +#line 2217 "cs.ATG" ++dims; } Expect(19); -#line 2208 "cs.ATG" +#line 2217 "cs.ATG" ranks.Add(dims); dims = 0; } -#line 2209 "cs.ATG" +#line 2218 "cs.ATG" ace.CreateType.RankSpecifier = ranks.ToArray(); ArrayInitializer( -#line 2210 "cs.ATG" +#line 2219 "cs.ATG" out expr); -#line 2210 "cs.ATG" +#line 2219 "cs.ATG" ace.ArrayInitializer = (ArrayInitializerExpression)expr; } else if (StartOf(5)) { Expr( -#line 2211 "cs.ATG" +#line 2220 "cs.ATG" out expr); -#line 2211 "cs.ATG" +#line 2220 "cs.ATG" if (expr != null) parameters.Add(expr); while (la.kind == 14) { lexer.NextToken(); -#line 2212 "cs.ATG" +#line 2221 "cs.ATG" dims += 1; Expr( -#line 2213 "cs.ATG" +#line 2222 "cs.ATG" out expr); -#line 2213 "cs.ATG" +#line 2222 "cs.ATG" if (expr != null) parameters.Add(expr); } Expect(19); -#line 2215 "cs.ATG" +#line 2224 "cs.ATG" ranks.Add(dims); ace.Arguments = parameters; dims = 0; while (la.kind == 18) { lexer.NextToken(); while (la.kind == 14) { lexer.NextToken(); -#line 2216 "cs.ATG" +#line 2225 "cs.ATG" ++dims; } Expect(19); -#line 2216 "cs.ATG" +#line 2225 "cs.ATG" ranks.Add(dims); dims = 0; } -#line 2217 "cs.ATG" +#line 2226 "cs.ATG" ace.CreateType.RankSpecifier = ranks.ToArray(); if (la.kind == 16) { ArrayInitializer( -#line 2218 "cs.ATG" +#line 2227 "cs.ATG" out expr); -#line 2218 "cs.ATG" +#line 2227 "cs.ATG" ace.ArrayInitializer = (ArrayInitializerExpression)expr; } } else SynErr(179); @@ -4907,204 +4919,204 @@ out expr); lexer.NextToken(); Expect(20); if ( -#line 2223 "cs.ATG" +#line 2232 "cs.ATG" NotVoidPointer()) { Expect(122); -#line 2223 "cs.ATG" +#line 2232 "cs.ATG" type = new TypeReference("void"); } else if (StartOf(9)) { TypeWithRestriction( -#line 2224 "cs.ATG" +#line 2233 "cs.ATG" out type, true, true); } else SynErr(181); Expect(21); -#line 2225 "cs.ATG" +#line 2234 "cs.ATG" pexpr = new TypeOfExpression(type); } else if ( -#line 2227 "cs.ATG" +#line 2236 "cs.ATG" la.kind == Tokens.Default && Peek(1).kind == Tokens.OpenParenthesis) { Expect(62); Expect(20); Type( -#line 2229 "cs.ATG" +#line 2238 "cs.ATG" out type); Expect(21); -#line 2229 "cs.ATG" +#line 2238 "cs.ATG" pexpr = new DefaultValueExpression(type); } else if (la.kind == 104) { lexer.NextToken(); Expect(20); Type( -#line 2230 "cs.ATG" +#line 2239 "cs.ATG" out type); Expect(21); -#line 2230 "cs.ATG" +#line 2239 "cs.ATG" pexpr = new SizeOfExpression(type); } else if (la.kind == 57) { lexer.NextToken(); Expect(20); Expr( -#line 2231 "cs.ATG" +#line 2240 "cs.ATG" out expr); Expect(21); -#line 2231 "cs.ATG" +#line 2240 "cs.ATG" pexpr = new CheckedExpression(expr); } else if (la.kind == 117) { lexer.NextToken(); Expect(20); Expr( -#line 2232 "cs.ATG" +#line 2241 "cs.ATG" out expr); Expect(21); -#line 2232 "cs.ATG" +#line 2241 "cs.ATG" pexpr = new UncheckedExpression(expr); } else if (la.kind == 63) { lexer.NextToken(); AnonymousMethodExpr( -#line 2233 "cs.ATG" +#line 2242 "cs.ATG" out expr); -#line 2233 "cs.ATG" +#line 2242 "cs.ATG" pexpr = expr; } else SynErr(182); while (StartOf(27) || -#line 2244 "cs.ATG" -IsGenericFollowedBy(Tokens.Dot) && IsTypeReferenceExpression(pexpr) || #line 2253 "cs.ATG" +IsGenericFollowedBy(Tokens.Dot) && IsTypeReferenceExpression(pexpr) || +#line 2262 "cs.ATG" IsGenericFollowedBy(Tokens.OpenParenthesis)) { if (la.kind == 31 || la.kind == 32) { if (la.kind == 31) { lexer.NextToken(); -#line 2237 "cs.ATG" +#line 2246 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); } else if (la.kind == 32) { lexer.NextToken(); -#line 2238 "cs.ATG" +#line 2247 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); } else SynErr(183); } else if (la.kind == 47) { lexer.NextToken(); Expect(1); -#line 2241 "cs.ATG" +#line 2250 "cs.ATG" pexpr = new PointerReferenceExpression(pexpr, t.val); } else if (la.kind == 15) { lexer.NextToken(); Expect(1); -#line 2242 "cs.ATG" +#line 2251 "cs.ATG" pexpr = new FieldReferenceExpression(pexpr, t.val); } else if ( -#line 2244 "cs.ATG" +#line 2253 "cs.ATG" IsGenericFollowedBy(Tokens.Dot) && IsTypeReferenceExpression(pexpr)) { TypeArgumentList( -#line 2245 "cs.ATG" +#line 2254 "cs.ATG" out typeList, false); Expect(15); Expect(1); -#line 2247 "cs.ATG" +#line 2256 "cs.ATG" pexpr = new FieldReferenceExpression(GetTypeReferenceExpression(pexpr, typeList), t.val); } else if (la.kind == 20) { lexer.NextToken(); -#line 2249 "cs.ATG" +#line 2258 "cs.ATG" List parameters = new List(); if (StartOf(21)) { Argument( -#line 2250 "cs.ATG" +#line 2259 "cs.ATG" out expr); -#line 2250 "cs.ATG" +#line 2259 "cs.ATG" if (expr != null) {parameters.Add(expr);} while (la.kind == 14) { lexer.NextToken(); Argument( -#line 2251 "cs.ATG" +#line 2260 "cs.ATG" out expr); -#line 2251 "cs.ATG" +#line 2260 "cs.ATG" if (expr != null) {parameters.Add(expr);} } } Expect(21); -#line 2252 "cs.ATG" +#line 2261 "cs.ATG" pexpr = new InvocationExpression(pexpr, parameters); } else if ( -#line 2253 "cs.ATG" +#line 2262 "cs.ATG" IsGenericFollowedBy(Tokens.OpenParenthesis)) { TypeArgumentList( -#line 2253 "cs.ATG" +#line 2262 "cs.ATG" out typeList, false); Expect(20); -#line 2254 "cs.ATG" +#line 2263 "cs.ATG" List parameters = new List(); if (StartOf(21)) { Argument( -#line 2255 "cs.ATG" +#line 2264 "cs.ATG" out expr); -#line 2255 "cs.ATG" +#line 2264 "cs.ATG" if (expr != null) {parameters.Add(expr);} while (la.kind == 14) { lexer.NextToken(); Argument( -#line 2256 "cs.ATG" +#line 2265 "cs.ATG" out expr); -#line 2256 "cs.ATG" +#line 2265 "cs.ATG" if (expr != null) {parameters.Add(expr);} } } Expect(21); -#line 2257 "cs.ATG" +#line 2266 "cs.ATG" pexpr = new InvocationExpression(pexpr, parameters, typeList); } else { -#line 2259 "cs.ATG" +#line 2268 "cs.ATG" if (isArrayCreation) Error("element access not allow on array creation"); List indices = new List(); lexer.NextToken(); Expr( -#line 2262 "cs.ATG" +#line 2271 "cs.ATG" out expr); -#line 2262 "cs.ATG" +#line 2271 "cs.ATG" if (expr != null) { indices.Add(expr); } while (la.kind == 14) { lexer.NextToken(); Expr( -#line 2263 "cs.ATG" +#line 2272 "cs.ATG" out expr); -#line 2263 "cs.ATG" +#line 2272 "cs.ATG" if (expr != null) { indices.Add(expr); } } Expect(19); -#line 2264 "cs.ATG" +#line 2273 "cs.ATG" pexpr = new IndexerExpression(pexpr, indices); } } } void AnonymousMethodExpr( -#line 2268 "cs.ATG" +#line 2277 "cs.ATG" out Expression outExpr) { -#line 2270 "cs.ATG" +#line 2279 "cs.ATG" AnonymousMethodExpression expr = new AnonymousMethodExpression(); expr.StartLocation = t.Location; Statement stmt; @@ -5115,74 +5127,74 @@ out Expression outExpr) { lexer.NextToken(); if (StartOf(10)) { FormalParameterList( -#line 2279 "cs.ATG" +#line 2288 "cs.ATG" p); -#line 2279 "cs.ATG" +#line 2288 "cs.ATG" expr.Parameters = p; } Expect(21); } -#line 2284 "cs.ATG" +#line 2293 "cs.ATG" if (compilationUnit != null) { Block( -#line 2285 "cs.ATG" +#line 2294 "cs.ATG" out stmt); -#line 2285 "cs.ATG" +#line 2294 "cs.ATG" expr.Body = (BlockStatement)stmt; -#line 2286 "cs.ATG" +#line 2295 "cs.ATG" } else { Expect(16); -#line 2288 "cs.ATG" +#line 2297 "cs.ATG" lexer.SkipCurrentBlock(); Expect(17); -#line 2290 "cs.ATG" +#line 2299 "cs.ATG" } -#line 2291 "cs.ATG" +#line 2300 "cs.ATG" expr.EndLocation = t.Location; } void TypeArgumentList( -#line 2464 "cs.ATG" +#line 2473 "cs.ATG" out List types, bool canBeUnbound) { -#line 2466 "cs.ATG" +#line 2475 "cs.ATG" types = new List(); TypeReference type = null; Expect(23); if ( -#line 2471 "cs.ATG" +#line 2480 "cs.ATG" canBeUnbound && (la.kind == Tokens.GreaterThan || la.kind == Tokens.Comma)) { -#line 2472 "cs.ATG" +#line 2481 "cs.ATG" types.Add(TypeReference.Null); while (la.kind == 14) { lexer.NextToken(); -#line 2473 "cs.ATG" +#line 2482 "cs.ATG" types.Add(TypeReference.Null); } } else if (StartOf(9)) { Type( -#line 2474 "cs.ATG" +#line 2483 "cs.ATG" out type); -#line 2474 "cs.ATG" +#line 2483 "cs.ATG" types.Add(type); while (la.kind == 14) { lexer.NextToken(); Type( -#line 2475 "cs.ATG" +#line 2484 "cs.ATG" out type); -#line 2475 "cs.ATG" +#line 2484 "cs.ATG" types.Add(type); } } else SynErr(184); @@ -5190,206 +5202,206 @@ out type); } void ConditionalAndExpr( -#line 2300 "cs.ATG" +#line 2309 "cs.ATG" ref Expression outExpr) { -#line 2301 "cs.ATG" +#line 2310 "cs.ATG" Expression expr; InclusiveOrExpr( -#line 2303 "cs.ATG" +#line 2312 "cs.ATG" ref outExpr); while (la.kind == 25) { lexer.NextToken(); UnaryExpr( -#line 2303 "cs.ATG" +#line 2312 "cs.ATG" out expr); InclusiveOrExpr( -#line 2303 "cs.ATG" +#line 2312 "cs.ATG" ref expr); -#line 2303 "cs.ATG" +#line 2312 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalAnd, expr); } } void InclusiveOrExpr( -#line 2306 "cs.ATG" +#line 2315 "cs.ATG" ref Expression outExpr) { -#line 2307 "cs.ATG" +#line 2316 "cs.ATG" Expression expr; ExclusiveOrExpr( -#line 2309 "cs.ATG" +#line 2318 "cs.ATG" ref outExpr); while (la.kind == 29) { lexer.NextToken(); UnaryExpr( -#line 2309 "cs.ATG" +#line 2318 "cs.ATG" out expr); ExclusiveOrExpr( -#line 2309 "cs.ATG" +#line 2318 "cs.ATG" ref expr); -#line 2309 "cs.ATG" +#line 2318 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseOr, expr); } } void ExclusiveOrExpr( -#line 2312 "cs.ATG" +#line 2321 "cs.ATG" ref Expression outExpr) { -#line 2313 "cs.ATG" +#line 2322 "cs.ATG" Expression expr; AndExpr( -#line 2315 "cs.ATG" +#line 2324 "cs.ATG" ref outExpr); while (la.kind == 30) { lexer.NextToken(); UnaryExpr( -#line 2315 "cs.ATG" +#line 2324 "cs.ATG" out expr); AndExpr( -#line 2315 "cs.ATG" +#line 2324 "cs.ATG" ref expr); -#line 2315 "cs.ATG" +#line 2324 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.ExclusiveOr, expr); } } void AndExpr( -#line 2318 "cs.ATG" +#line 2327 "cs.ATG" ref Expression outExpr) { -#line 2319 "cs.ATG" +#line 2328 "cs.ATG" Expression expr; EqualityExpr( -#line 2321 "cs.ATG" +#line 2330 "cs.ATG" ref outExpr); while (la.kind == 28) { lexer.NextToken(); UnaryExpr( -#line 2321 "cs.ATG" +#line 2330 "cs.ATG" out expr); EqualityExpr( -#line 2321 "cs.ATG" +#line 2330 "cs.ATG" ref expr); -#line 2321 "cs.ATG" +#line 2330 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseAnd, expr); } } void EqualityExpr( -#line 2324 "cs.ATG" +#line 2333 "cs.ATG" ref Expression outExpr) { -#line 2326 "cs.ATG" +#line 2335 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; RelationalExpr( -#line 2330 "cs.ATG" +#line 2339 "cs.ATG" ref outExpr); while (la.kind == 33 || la.kind == 34) { if (la.kind == 34) { lexer.NextToken(); -#line 2333 "cs.ATG" +#line 2342 "cs.ATG" op = BinaryOperatorType.InEquality; } else { lexer.NextToken(); -#line 2334 "cs.ATG" +#line 2343 "cs.ATG" op = BinaryOperatorType.Equality; } UnaryExpr( -#line 2336 "cs.ATG" +#line 2345 "cs.ATG" out expr); RelationalExpr( -#line 2336 "cs.ATG" +#line 2345 "cs.ATG" ref expr); -#line 2336 "cs.ATG" +#line 2345 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void RelationalExpr( -#line 2340 "cs.ATG" +#line 2349 "cs.ATG" ref Expression outExpr) { -#line 2342 "cs.ATG" +#line 2351 "cs.ATG" TypeReference type; Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( -#line 2347 "cs.ATG" +#line 2356 "cs.ATG" ref outExpr); while (StartOf(28)) { if (StartOf(29)) { if (la.kind == 23) { lexer.NextToken(); -#line 2349 "cs.ATG" +#line 2358 "cs.ATG" op = BinaryOperatorType.LessThan; } else if (la.kind == 22) { lexer.NextToken(); -#line 2350 "cs.ATG" +#line 2359 "cs.ATG" op = BinaryOperatorType.GreaterThan; } else if (la.kind == 36) { lexer.NextToken(); -#line 2351 "cs.ATG" +#line 2360 "cs.ATG" op = BinaryOperatorType.LessThanOrEqual; } else if (la.kind == 35) { lexer.NextToken(); -#line 2352 "cs.ATG" +#line 2361 "cs.ATG" op = BinaryOperatorType.GreaterThanOrEqual; } else SynErr(185); UnaryExpr( -#line 2354 "cs.ATG" +#line 2363 "cs.ATG" out expr); ShiftExpr( -#line 2355 "cs.ATG" +#line 2364 "cs.ATG" ref expr); -#line 2356 "cs.ATG" +#line 2365 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } else { if (la.kind == 84) { lexer.NextToken(); TypeWithRestriction( -#line 2359 "cs.ATG" +#line 2368 "cs.ATG" out type, false, false); if ( -#line 2360 "cs.ATG" +#line 2369 "cs.ATG" la.kind == Tokens.Question && Tokens.CastFollower[Peek(1).kind] == false) { NullableQuestionMark( -#line 2361 "cs.ATG" +#line 2370 "cs.ATG" ref type); } -#line 2362 "cs.ATG" +#line 2371 "cs.ATG" outExpr = new TypeOfIsExpression(outExpr, type); } else if (la.kind == 49) { lexer.NextToken(); TypeWithRestriction( -#line 2364 "cs.ATG" +#line 2373 "cs.ATG" out type, false, false); if ( -#line 2365 "cs.ATG" +#line 2374 "cs.ATG" la.kind == Tokens.Question && Tokens.CastFollower[Peek(1).kind] == false) { NullableQuestionMark( -#line 2366 "cs.ATG" +#line 2375 "cs.ATG" ref type); } -#line 2367 "cs.ATG" +#line 2376 "cs.ATG" outExpr = new CastExpression(type, outExpr, CastType.TryCast); } else SynErr(186); } @@ -5397,83 +5409,83 @@ ref type); } void ShiftExpr( -#line 2372 "cs.ATG" +#line 2381 "cs.ATG" ref Expression outExpr) { -#line 2374 "cs.ATG" +#line 2383 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; AdditiveExpr( -#line 2378 "cs.ATG" +#line 2387 "cs.ATG" ref outExpr); while (la.kind == 37 || -#line 2381 "cs.ATG" +#line 2390 "cs.ATG" IsShiftRight()) { if (la.kind == 37) { lexer.NextToken(); -#line 2380 "cs.ATG" +#line 2389 "cs.ATG" op = BinaryOperatorType.ShiftLeft; } else { Expect(22); Expect(22); -#line 2382 "cs.ATG" +#line 2391 "cs.ATG" op = BinaryOperatorType.ShiftRight; } UnaryExpr( -#line 2385 "cs.ATG" +#line 2394 "cs.ATG" out expr); AdditiveExpr( -#line 2385 "cs.ATG" +#line 2394 "cs.ATG" ref expr); -#line 2385 "cs.ATG" +#line 2394 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void AdditiveExpr( -#line 2389 "cs.ATG" +#line 2398 "cs.ATG" ref Expression outExpr) { -#line 2391 "cs.ATG" +#line 2400 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; MultiplicativeExpr( -#line 2395 "cs.ATG" +#line 2404 "cs.ATG" ref outExpr); while (la.kind == 4 || la.kind == 5) { if (la.kind == 4) { lexer.NextToken(); -#line 2398 "cs.ATG" +#line 2407 "cs.ATG" op = BinaryOperatorType.Add; } else { lexer.NextToken(); -#line 2399 "cs.ATG" +#line 2408 "cs.ATG" op = BinaryOperatorType.Subtract; } UnaryExpr( -#line 2401 "cs.ATG" +#line 2410 "cs.ATG" out expr); MultiplicativeExpr( -#line 2401 "cs.ATG" +#line 2410 "cs.ATG" ref expr); -#line 2401 "cs.ATG" +#line 2410 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void MultiplicativeExpr( -#line 2405 "cs.ATG" +#line 2414 "cs.ATG" ref Expression outExpr) { -#line 2407 "cs.ATG" +#line 2416 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; @@ -5481,57 +5493,57 @@ ref Expression outExpr) { if (la.kind == 6) { lexer.NextToken(); -#line 2413 "cs.ATG" +#line 2422 "cs.ATG" op = BinaryOperatorType.Multiply; } else if (la.kind == 7) { lexer.NextToken(); -#line 2414 "cs.ATG" +#line 2423 "cs.ATG" op = BinaryOperatorType.Divide; } else { lexer.NextToken(); -#line 2415 "cs.ATG" +#line 2424 "cs.ATG" op = BinaryOperatorType.Modulus; } UnaryExpr( -#line 2417 "cs.ATG" +#line 2426 "cs.ATG" out expr); -#line 2417 "cs.ATG" +#line 2426 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void TypeParameterConstraintsClauseBase( -#line 2521 "cs.ATG" +#line 2530 "cs.ATG" out TypeReference type) { -#line 2522 "cs.ATG" +#line 2531 "cs.ATG" TypeReference t; type = null; if (la.kind == 108) { lexer.NextToken(); -#line 2524 "cs.ATG" +#line 2533 "cs.ATG" type = new TypeReference("struct"); } else if (la.kind == 58) { lexer.NextToken(); -#line 2525 "cs.ATG" +#line 2534 "cs.ATG" type = new TypeReference("struct"); } else if (la.kind == 88) { lexer.NextToken(); Expect(20); Expect(21); -#line 2526 "cs.ATG" +#line 2535 "cs.ATG" type = new TypeReference("struct"); } else if (StartOf(9)) { Type( -#line 2527 "cs.ATG" +#line 2536 "cs.ATG" out t); -#line 2527 "cs.ATG" +#line 2536 "cs.ATG" type = t; } else SynErr(187); } diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG index c75e5d7666..3965a9f8f3 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG +++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG @@ -840,6 +840,7 @@ TypeDecl attributes> /* .NET 2.0 */ { IF (IdentIsWhere()) TypeParameterConstraintsClause } + (. newType.BodyStartLocation = t.EndLocation; .) ClassBody [ ";" ] (. newType.EndLocation = t.Location; compilationUnit.BlockEnd(); @@ -863,6 +864,7 @@ TypeDecl attributes> { IF (IdentIsWhere()) TypeParameterConstraintsClause } + (. newType.BodyStartLocation = t.EndLocation; .) StructBody [ ";" ] (. newType.EndLocation = t.Location; compilationUnit.BlockEnd(); @@ -885,6 +887,7 @@ TypeDecl attributes> /* .NET 2.0 */ { IF (IdentIsWhere()) TypeParameterConstraintsClause } + (. newType.BodyStartLocation = t.EndLocation; .) InterfaceBody [ ";" ] (. newType.EndLocation = t.Location; compilationUnit.BlockEnd(); @@ -899,6 +902,7 @@ TypeDecl attributes> ident (. newType.Name = t.val; .) [ ":" IntegralType (. newType.BaseTypes.Add(new TypeReference(name)); .) ] + (. newType.BodyStartLocation = t.EndLocation; .) EnumBody [ ";" ] (. newType.EndLocation = t.Location; compilationUnit.BlockEnd(); @@ -974,7 +978,7 @@ StructInterfaces names> StructBody (. AttributeSection section; .) = - "{" + "{" { (.List attributes = new List(); Modifiers m = new Modifiers(); .) @@ -996,12 +1000,17 @@ InterfaceBase names> . InterfaceBody -= "{" { InterfaceMemberDecl } "}" . += "{" + { InterfaceMemberDecl } + "}" +. EnumBody (. FieldDeclaration f; .) = - "{" [ EnumMemberDecl (. compilationUnit.AddChild(f); .) - { IF (NotFinalComma()) "," EnumMemberDecl (. compilationUnit.AddChild(f); .) + "{" + [ EnumMemberDecl (. compilationUnit.AddChild(f); .) + { IF (NotFinalComma()) "," + EnumMemberDecl (. compilationUnit.AddChild(f); .) } [","] ] "}" . diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs index a7c61f333b..ebab3c07a7 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs @@ -379,7 +379,7 @@ ref val); out u); #line 537 "VBNET.ATG" - usings.Add(u); + if (u != null) { usings.Add(u); } while (la.kind == 12) { lexer.NextToken(); ImportClause( @@ -387,7 +387,7 @@ out u); out u); #line 539 "VBNET.ATG" - usings.Add(u); + if (u != null) { usings.Add(u); } } EndOfStmt(); @@ -401,7 +401,7 @@ out u); void GlobalAttributeSection() { -#line 2170 "VBNET.ATG" +#line 2177 "VBNET.ATG" Point startPos = t.Location; Expect(27); if (la.kind == 49) { @@ -410,20 +410,20 @@ out u); lexer.NextToken(); } else SynErr(208); -#line 2172 "VBNET.ATG" +#line 2179 "VBNET.ATG" string attributeTarget = t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture); List attributes = new List(); ASTAttribute attribute; Expect(13); Attribute( -#line 2176 "VBNET.ATG" +#line 2183 "VBNET.ATG" out attribute); -#line 2176 "VBNET.ATG" +#line 2183 "VBNET.ATG" attributes.Add(attribute); while ( -#line 2177 "VBNET.ATG" +#line 2184 "VBNET.ATG" NotFinalComma()) { if (la.kind == 12) { lexer.NextToken(); @@ -435,10 +435,10 @@ NotFinalComma()) { Expect(13); } Attribute( -#line 2177 "VBNET.ATG" +#line 2184 "VBNET.ATG" out attribute); -#line 2177 "VBNET.ATG" +#line 2184 "VBNET.ATG" attributes.Add(attribute); } if (la.kind == 12) { @@ -447,7 +447,7 @@ out attribute); Expect(26); EndOfStmt(); -#line 2182 "VBNET.ATG" +#line 2189 "VBNET.ATG" AttributeSection section = new AttributeSection(attributeTarget, attributes); section.StartLocation = startPos; section.EndLocation = t.EndLocation; @@ -564,47 +564,47 @@ out aliasedType); } void Qualident( -#line 2898 "VBNET.ATG" +#line 2905 "VBNET.ATG" out string qualident) { -#line 2900 "VBNET.ATG" +#line 2907 "VBNET.ATG" string name; qualidentBuilder.Length = 0; Identifier(); -#line 2904 "VBNET.ATG" +#line 2911 "VBNET.ATG" qualidentBuilder.Append(t.val); while ( -#line 2905 "VBNET.ATG" +#line 2912 "VBNET.ATG" DotAndIdentOrKw()) { Expect(10); IdentifierOrKeyword( -#line 2905 "VBNET.ATG" +#line 2912 "VBNET.ATG" out name); -#line 2905 "VBNET.ATG" +#line 2912 "VBNET.ATG" qualidentBuilder.Append('.'); qualidentBuilder.Append(name); } -#line 2907 "VBNET.ATG" +#line 2914 "VBNET.ATG" qualident = qualidentBuilder.ToString(); } void TypeName( -#line 2063 "VBNET.ATG" +#line 2070 "VBNET.ATG" out TypeReference typeref) { -#line 2064 "VBNET.ATG" +#line 2071 "VBNET.ATG" ArrayList rank = null; NonArrayTypeName( -#line 2066 "VBNET.ATG" +#line 2073 "VBNET.ATG" out typeref, false); ArrayTypeModifiers( -#line 2067 "VBNET.ATG" +#line 2074 "VBNET.ATG" out rank); -#line 2068 "VBNET.ATG" +#line 2075 "VBNET.ATG" if (rank != null && typeref != null) { typeref.RankSpecifier = (int[])rank.ToArray(typeof(int)); } @@ -621,35 +621,35 @@ out rank); } void AttributeSection( -#line 2239 "VBNET.ATG" +#line 2246 "VBNET.ATG" out AttributeSection section) { -#line 2241 "VBNET.ATG" +#line 2248 "VBNET.ATG" string attributeTarget = "";List attributes = new List(); ASTAttribute attribute; Expect(27); -#line 2245 "VBNET.ATG" +#line 2252 "VBNET.ATG" Point startPos = t.Location; if ( -#line 2246 "VBNET.ATG" +#line 2253 "VBNET.ATG" IsLocalAttrTarget()) { if (la.kind == 93) { lexer.NextToken(); -#line 2247 "VBNET.ATG" +#line 2254 "VBNET.ATG" attributeTarget = "event"; } else if (la.kind == 154) { lexer.NextToken(); -#line 2248 "VBNET.ATG" +#line 2255 "VBNET.ATG" attributeTarget = "return"; } else { Identifier(); -#line 2251 "VBNET.ATG" +#line 2258 "VBNET.ATG" string val = t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture); if (val != "field" || val != "method" || val != "module" || val != "param" || @@ -662,20 +662,20 @@ IsLocalAttrTarget()) { Expect(13); } Attribute( -#line 2261 "VBNET.ATG" +#line 2268 "VBNET.ATG" out attribute); -#line 2261 "VBNET.ATG" +#line 2268 "VBNET.ATG" attributes.Add(attribute); while ( -#line 2262 "VBNET.ATG" +#line 2269 "VBNET.ATG" NotFinalComma()) { Expect(12); Attribute( -#line 2262 "VBNET.ATG" +#line 2269 "VBNET.ATG" out attribute); -#line 2262 "VBNET.ATG" +#line 2269 "VBNET.ATG" attributes.Add(attribute); } if (la.kind == 12) { @@ -683,7 +683,7 @@ out attribute); } Expect(26); -#line 2266 "VBNET.ATG" +#line 2273 "VBNET.ATG" section = new AttributeSection(attributeTarget, attributes); section.StartLocation = startPos; section.EndLocation = t.EndLocation; @@ -691,69 +691,69 @@ out attribute); } void TypeModifier( -#line 2959 "VBNET.ATG" +#line 2966 "VBNET.ATG" Modifiers m) { switch (la.kind) { case 148: { lexer.NextToken(); -#line 2960 "VBNET.ATG" +#line 2967 "VBNET.ATG" m.Add(Modifier.Public, t.Location); break; } case 147: { lexer.NextToken(); -#line 2961 "VBNET.ATG" +#line 2968 "VBNET.ATG" m.Add(Modifier.Protected, t.Location); break; } case 99: { lexer.NextToken(); -#line 2962 "VBNET.ATG" +#line 2969 "VBNET.ATG" m.Add(Modifier.Internal, t.Location); break; } case 145: { lexer.NextToken(); -#line 2963 "VBNET.ATG" +#line 2970 "VBNET.ATG" m.Add(Modifier.Private, t.Location); break; } case 158: { lexer.NextToken(); -#line 2964 "VBNET.ATG" +#line 2971 "VBNET.ATG" m.Add(Modifier.Static, t.Location); break; } case 157: { lexer.NextToken(); -#line 2965 "VBNET.ATG" +#line 2972 "VBNET.ATG" m.Add(Modifier.New, t.Location); break; } case 122: { lexer.NextToken(); -#line 2966 "VBNET.ATG" +#line 2973 "VBNET.ATG" m.Add(Modifier.Abstract, t.Location); break; } case 131: { lexer.NextToken(); -#line 2967 "VBNET.ATG" +#line 2974 "VBNET.ATG" m.Add(Modifier.Sealed, t.Location); break; } case 203: { lexer.NextToken(); -#line 2968 "VBNET.ATG" +#line 2975 "VBNET.ATG" m.Add(Modifier.Partial, t.Location); break; } @@ -792,27 +792,30 @@ Modifiers m, List attributes) { #line 663 "VBNET.ATG" newType.Templates); EndOfStmt(); + +#line 665 "VBNET.ATG" + newType.BodyStartLocation = t.Location; if (la.kind == 110) { ClassBaseType( -#line 665 "VBNET.ATG" +#line 666 "VBNET.ATG" out typeRef); -#line 665 "VBNET.ATG" +#line 666 "VBNET.ATG" newType.BaseTypes.Add(typeRef); } while (la.kind == 107) { TypeImplementsClause( -#line 666 "VBNET.ATG" +#line 667 "VBNET.ATG" out baseInterfaces); -#line 666 "VBNET.ATG" +#line 667 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } ClassBody( -#line 667 "VBNET.ATG" +#line 668 "VBNET.ATG" newType); -#line 669 "VBNET.ATG" +#line 670 "VBNET.ATG" compilationUnit.BlockEnd(); break; @@ -820,7 +823,7 @@ newType); case 121: { lexer.NextToken(); -#line 673 "VBNET.ATG" +#line 674 "VBNET.ATG" m.Check(Modifier.VBModules); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); compilationUnit.AddChild(newType); @@ -830,14 +833,17 @@ newType); Identifier(); -#line 680 "VBNET.ATG" +#line 681 "VBNET.ATG" newType.Name = t.val; Expect(1); + +#line 683 "VBNET.ATG" + newType.BodyStartLocation = t.Location; ModuleBody( -#line 682 "VBNET.ATG" +#line 684 "VBNET.ATG" newType); -#line 684 "VBNET.ATG" +#line 686 "VBNET.ATG" compilationUnit.BlockEnd(); break; @@ -845,7 +851,7 @@ newType); case 166: { lexer.NextToken(); -#line 688 "VBNET.ATG" +#line 690 "VBNET.ATG" m.Check(Modifier.VBStructures); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); compilationUnit.AddChild(newType); @@ -855,25 +861,28 @@ newType); Identifier(); -#line 695 "VBNET.ATG" +#line 697 "VBNET.ATG" newType.Name = t.val; TypeParameterList( -#line 696 "VBNET.ATG" +#line 698 "VBNET.ATG" newType.Templates); Expect(1); + +#line 700 "VBNET.ATG" + newType.BodyStartLocation = t.Location; while (la.kind == 107) { TypeImplementsClause( -#line 697 "VBNET.ATG" +#line 701 "VBNET.ATG" out baseInterfaces); -#line 697 "VBNET.ATG" +#line 701 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } StructureBody( -#line 698 "VBNET.ATG" +#line 702 "VBNET.ATG" newType); -#line 700 "VBNET.ATG" +#line 704 "VBNET.ATG" compilationUnit.BlockEnd(); break; @@ -881,7 +890,7 @@ newType); case 90: { lexer.NextToken(); -#line 705 "VBNET.ATG" +#line 709 "VBNET.ATG" m.Check(Modifier.VBEnums); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); newType.StartLocation = m.GetDeclarationLocation(t.Location); @@ -892,23 +901,26 @@ newType); Identifier(); -#line 713 "VBNET.ATG" +#line 717 "VBNET.ATG" newType.Name = t.val; if (la.kind == 48) { lexer.NextToken(); NonArrayTypeName( -#line 714 "VBNET.ATG" +#line 718 "VBNET.ATG" out typeRef, false); -#line 714 "VBNET.ATG" +#line 718 "VBNET.ATG" newType.BaseTypes.Add(typeRef); } Expect(1); + +#line 720 "VBNET.ATG" + newType.BodyStartLocation = t.Location; EnumBody( -#line 716 "VBNET.ATG" +#line 721 "VBNET.ATG" newType); -#line 718 "VBNET.ATG" +#line 723 "VBNET.ATG" compilationUnit.BlockEnd(); break; @@ -916,7 +928,7 @@ newType); case 112: { lexer.NextToken(); -#line 723 "VBNET.ATG" +#line 728 "VBNET.ATG" m.Check(Modifier.VBInterfacs); TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); newType.StartLocation = m.GetDeclarationLocation(t.Location); @@ -926,25 +938,28 @@ newType); Identifier(); -#line 730 "VBNET.ATG" +#line 735 "VBNET.ATG" newType.Name = t.val; TypeParameterList( -#line 731 "VBNET.ATG" +#line 736 "VBNET.ATG" newType.Templates); EndOfStmt(); + +#line 738 "VBNET.ATG" + newType.BodyStartLocation = t.Location; while (la.kind == 110) { InterfaceBase( -#line 732 "VBNET.ATG" +#line 739 "VBNET.ATG" out baseInterfaces); -#line 732 "VBNET.ATG" +#line 739 "VBNET.ATG" newType.BaseTypes.AddRange(baseInterfaces); } InterfaceBody( -#line 733 "VBNET.ATG" +#line 740 "VBNET.ATG" newType); -#line 735 "VBNET.ATG" +#line 742 "VBNET.ATG" compilationUnit.BlockEnd(); break; @@ -952,7 +967,7 @@ newType); case 80: { lexer.NextToken(); -#line 740 "VBNET.ATG" +#line 747 "VBNET.ATG" m.Check(Modifier.VBDelegates); DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes); delegateDeclr.ReturnType = new TypeReference("", "System.Void"); @@ -963,63 +978,63 @@ newType); lexer.NextToken(); Identifier(); -#line 747 "VBNET.ATG" +#line 754 "VBNET.ATG" delegateDeclr.Name = t.val; TypeParameterList( -#line 748 "VBNET.ATG" +#line 755 "VBNET.ATG" delegateDeclr.Templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 749 "VBNET.ATG" +#line 756 "VBNET.ATG" p); } Expect(25); -#line 749 "VBNET.ATG" +#line 756 "VBNET.ATG" delegateDeclr.Parameters = p; } } else if (la.kind == 100) { lexer.NextToken(); Identifier(); -#line 751 "VBNET.ATG" +#line 758 "VBNET.ATG" delegateDeclr.Name = t.val; TypeParameterList( -#line 752 "VBNET.ATG" +#line 759 "VBNET.ATG" delegateDeclr.Templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 753 "VBNET.ATG" +#line 760 "VBNET.ATG" p); } Expect(25); -#line 753 "VBNET.ATG" +#line 760 "VBNET.ATG" delegateDeclr.Parameters = p; } if (la.kind == 48) { lexer.NextToken(); -#line 754 "VBNET.ATG" +#line 761 "VBNET.ATG" TypeReference type; TypeName( -#line 754 "VBNET.ATG" +#line 761 "VBNET.ATG" out type); -#line 754 "VBNET.ATG" +#line 761 "VBNET.ATG" delegateDeclr.ReturnType = type; } } else SynErr(214); -#line 756 "VBNET.ATG" +#line 763 "VBNET.ATG" delegateDeclr.EndLocation = t.EndLocation; Expect(1); -#line 759 "VBNET.ATG" +#line 766 "VBNET.ATG" compilationUnit.AddChild(delegateDeclr); break; @@ -1158,163 +1173,163 @@ out constraint); } void ClassBaseType( -#line 936 "VBNET.ATG" +#line 943 "VBNET.ATG" out TypeReference typeRef) { -#line 938 "VBNET.ATG" +#line 945 "VBNET.ATG" typeRef = null; Expect(110); TypeName( -#line 941 "VBNET.ATG" +#line 948 "VBNET.ATG" out typeRef); EndOfStmt(); } void TypeImplementsClause( -#line 1673 "VBNET.ATG" +#line 1680 "VBNET.ATG" out List baseInterfaces) { -#line 1675 "VBNET.ATG" +#line 1682 "VBNET.ATG" baseInterfaces = new List(); TypeReference type = null; Expect(107); TypeName( -#line 1678 "VBNET.ATG" +#line 1685 "VBNET.ATG" out type); -#line 1680 "VBNET.ATG" +#line 1687 "VBNET.ATG" baseInterfaces.Add(type); while (la.kind == 12) { lexer.NextToken(); TypeName( -#line 1683 "VBNET.ATG" +#line 1690 "VBNET.ATG" out type); -#line 1684 "VBNET.ATG" +#line 1691 "VBNET.ATG" baseInterfaces.Add(type); } EndOfStmt(); } void ClassBody( -#line 769 "VBNET.ATG" +#line 776 "VBNET.ATG" TypeDeclaration newType) { -#line 770 "VBNET.ATG" +#line 777 "VBNET.ATG" AttributeSection section; while (StartOf(6)) { -#line 772 "VBNET.ATG" +#line 779 "VBNET.ATG" List attributes = new List(); Modifiers m = new Modifiers(); while (la.kind == 27) { AttributeSection( -#line 775 "VBNET.ATG" +#line 782 "VBNET.ATG" out section); -#line 775 "VBNET.ATG" +#line 782 "VBNET.ATG" attributes.Add(section); } while (StartOf(7)) { MemberModifier( -#line 776 "VBNET.ATG" +#line 783 "VBNET.ATG" m); } ClassMemberDecl( -#line 777 "VBNET.ATG" +#line 784 "VBNET.ATG" m, attributes); } Expect(88); Expect(67); -#line 779 "VBNET.ATG" +#line 786 "VBNET.ATG" newType.EndLocation = t.EndLocation; Expect(1); } void ModuleBody( -#line 798 "VBNET.ATG" +#line 805 "VBNET.ATG" TypeDeclaration newType) { -#line 799 "VBNET.ATG" +#line 806 "VBNET.ATG" AttributeSection section; while (StartOf(6)) { -#line 801 "VBNET.ATG" +#line 808 "VBNET.ATG" List attributes = new List(); Modifiers m = new Modifiers(); while (la.kind == 27) { AttributeSection( -#line 804 "VBNET.ATG" +#line 811 "VBNET.ATG" out section); -#line 804 "VBNET.ATG" +#line 811 "VBNET.ATG" attributes.Add(section); } while (StartOf(7)) { MemberModifier( -#line 805 "VBNET.ATG" +#line 812 "VBNET.ATG" m); } ClassMemberDecl( -#line 806 "VBNET.ATG" +#line 813 "VBNET.ATG" m, attributes); } Expect(88); Expect(121); -#line 808 "VBNET.ATG" +#line 815 "VBNET.ATG" newType.EndLocation = t.EndLocation; Expect(1); } void StructureBody( -#line 783 "VBNET.ATG" +#line 790 "VBNET.ATG" TypeDeclaration newType) { -#line 784 "VBNET.ATG" +#line 791 "VBNET.ATG" AttributeSection section; while (StartOf(6)) { -#line 786 "VBNET.ATG" +#line 793 "VBNET.ATG" List attributes = new List(); Modifiers m = new Modifiers(); while (la.kind == 27) { AttributeSection( -#line 789 "VBNET.ATG" +#line 796 "VBNET.ATG" out section); -#line 789 "VBNET.ATG" +#line 796 "VBNET.ATG" attributes.Add(section); } while (StartOf(7)) { MemberModifier( -#line 790 "VBNET.ATG" +#line 797 "VBNET.ATG" m); } StructureMemberDecl( -#line 791 "VBNET.ATG" +#line 798 "VBNET.ATG" m, attributes); } Expect(88); Expect(166); -#line 793 "VBNET.ATG" +#line 800 "VBNET.ATG" newType.EndLocation = t.EndLocation; Expect(1); } void NonArrayTypeName( -#line 2086 "VBNET.ATG" +#line 2093 "VBNET.ATG" out TypeReference typeref, bool canBeUnbound) { -#line 2088 "VBNET.ATG" +#line 2095 "VBNET.ATG" string name; typeref = null; bool isGlobal = false; @@ -1324,93 +1339,93 @@ out TypeReference typeref, bool canBeUnbound) { lexer.NextToken(); Expect(10); -#line 2093 "VBNET.ATG" +#line 2100 "VBNET.ATG" isGlobal = true; } QualIdentAndTypeArguments( -#line 2094 "VBNET.ATG" +#line 2101 "VBNET.ATG" out typeref, canBeUnbound); -#line 2095 "VBNET.ATG" +#line 2102 "VBNET.ATG" typeref.IsGlobal = isGlobal; while (la.kind == 10) { lexer.NextToken(); -#line 2096 "VBNET.ATG" +#line 2103 "VBNET.ATG" TypeReference nestedTypeRef; QualIdentAndTypeArguments( -#line 2097 "VBNET.ATG" +#line 2104 "VBNET.ATG" out nestedTypeRef, canBeUnbound); -#line 2098 "VBNET.ATG" +#line 2105 "VBNET.ATG" typeref = new InnerClassTypeReference(typeref, nestedTypeRef.Type, nestedTypeRef.GenericTypes); } } else if (la.kind == 133) { lexer.NextToken(); -#line 2101 "VBNET.ATG" +#line 2108 "VBNET.ATG" typeref = new TypeReference("System.Object"); } else if (StartOf(9)) { PrimitiveTypeName( -#line 2102 "VBNET.ATG" +#line 2109 "VBNET.ATG" out name); -#line 2102 "VBNET.ATG" +#line 2109 "VBNET.ATG" typeref = new TypeReference(name); } else SynErr(218); } void EnumBody( -#line 812 "VBNET.ATG" +#line 819 "VBNET.ATG" TypeDeclaration newType) { -#line 813 "VBNET.ATG" +#line 820 "VBNET.ATG" FieldDeclaration f; while (StartOf(10)) { EnumMemberDecl( -#line 815 "VBNET.ATG" +#line 822 "VBNET.ATG" out f); -#line 815 "VBNET.ATG" +#line 822 "VBNET.ATG" compilationUnit.AddChild(f); } Expect(88); Expect(90); -#line 817 "VBNET.ATG" +#line 824 "VBNET.ATG" newType.EndLocation = t.EndLocation; Expect(1); } void InterfaceBase( -#line 1658 "VBNET.ATG" +#line 1665 "VBNET.ATG" out List bases) { -#line 1660 "VBNET.ATG" +#line 1667 "VBNET.ATG" TypeReference type; bases = new List(); Expect(110); TypeName( -#line 1664 "VBNET.ATG" +#line 1671 "VBNET.ATG" out type); -#line 1664 "VBNET.ATG" +#line 1671 "VBNET.ATG" bases.Add(type); while (la.kind == 12) { lexer.NextToken(); TypeName( -#line 1667 "VBNET.ATG" +#line 1674 "VBNET.ATG" out type); -#line 1667 "VBNET.ATG" +#line 1674 "VBNET.ATG" bases.Add(type); } Expect(1); } void InterfaceBody( -#line 821 "VBNET.ATG" +#line 828 "VBNET.ATG" TypeDeclaration newType) { while (StartOf(11)) { InterfaceMemberDecl(); @@ -1418,33 +1433,33 @@ TypeDeclaration newType) { Expect(88); Expect(112); -#line 823 "VBNET.ATG" +#line 830 "VBNET.ATG" newType.EndLocation = t.EndLocation; Expect(1); } void FormalParameterList( -#line 2273 "VBNET.ATG" +#line 2280 "VBNET.ATG" List parameter) { -#line 2275 "VBNET.ATG" +#line 2282 "VBNET.ATG" ParameterDeclarationExpression p; AttributeSection section; List attributes = new List(); while (la.kind == 27) { AttributeSection( -#line 2279 "VBNET.ATG" +#line 2286 "VBNET.ATG" out section); -#line 2279 "VBNET.ATG" +#line 2286 "VBNET.ATG" attributes.Add(section); } FormalParameter( -#line 2281 "VBNET.ATG" +#line 2288 "VBNET.ATG" out p); -#line 2283 "VBNET.ATG" +#line 2290 "VBNET.ATG" bool paramsFound = false; p.Attributes = attributes; parameter.Add(p); @@ -1452,166 +1467,166 @@ out p); while (la.kind == 12) { lexer.NextToken(); -#line 2288 "VBNET.ATG" +#line 2295 "VBNET.ATG" if (paramsFound) Error("params array must be at end of parameter list"); while (la.kind == 27) { AttributeSection( -#line 2289 "VBNET.ATG" +#line 2296 "VBNET.ATG" out section); -#line 2289 "VBNET.ATG" +#line 2296 "VBNET.ATG" attributes.Add(section); } FormalParameter( -#line 2291 "VBNET.ATG" +#line 2298 "VBNET.ATG" out p); -#line 2291 "VBNET.ATG" +#line 2298 "VBNET.ATG" p.Attributes = attributes; parameter.Add(p); } } void MemberModifier( -#line 2971 "VBNET.ATG" +#line 2978 "VBNET.ATG" Modifiers m) { switch (la.kind) { case 122: { lexer.NextToken(); -#line 2972 "VBNET.ATG" +#line 2979 "VBNET.ATG" m.Add(Modifier.Abstract, t.Location); break; } case 79: { lexer.NextToken(); -#line 2973 "VBNET.ATG" +#line 2980 "VBNET.ATG" m.Add(Modifier.Default, t.Location); break; } case 99: { lexer.NextToken(); -#line 2974 "VBNET.ATG" +#line 2981 "VBNET.ATG" m.Add(Modifier.Internal, t.Location); break; } case 157: { lexer.NextToken(); -#line 2975 "VBNET.ATG" +#line 2982 "VBNET.ATG" m.Add(Modifier.New, t.Location); break; } case 142: { lexer.NextToken(); -#line 2976 "VBNET.ATG" +#line 2983 "VBNET.ATG" m.Add(Modifier.Override, t.Location); break; } case 123: { lexer.NextToken(); -#line 2977 "VBNET.ATG" +#line 2984 "VBNET.ATG" m.Add(Modifier.Abstract, t.Location); break; } case 145: { lexer.NextToken(); -#line 2978 "VBNET.ATG" +#line 2985 "VBNET.ATG" m.Add(Modifier.Private, t.Location); break; } case 147: { lexer.NextToken(); -#line 2979 "VBNET.ATG" +#line 2986 "VBNET.ATG" m.Add(Modifier.Protected, t.Location); break; } case 148: { lexer.NextToken(); -#line 2980 "VBNET.ATG" +#line 2987 "VBNET.ATG" m.Add(Modifier.Public, t.Location); break; } case 131: { lexer.NextToken(); -#line 2981 "VBNET.ATG" +#line 2988 "VBNET.ATG" m.Add(Modifier.Sealed, t.Location); break; } case 132: { lexer.NextToken(); -#line 2982 "VBNET.ATG" +#line 2989 "VBNET.ATG" m.Add(Modifier.Sealed, t.Location); break; } case 158: { lexer.NextToken(); -#line 2983 "VBNET.ATG" +#line 2990 "VBNET.ATG" m.Add(Modifier.Static, t.Location); break; } case 141: { lexer.NextToken(); -#line 2984 "VBNET.ATG" +#line 2991 "VBNET.ATG" m.Add(Modifier.Virtual, t.Location); break; } case 140: { lexer.NextToken(); -#line 2985 "VBNET.ATG" +#line 2992 "VBNET.ATG" m.Add(Modifier.Overloads, t.Location); break; } case 150: { lexer.NextToken(); -#line 2986 "VBNET.ATG" +#line 2993 "VBNET.ATG" m.Add(Modifier.ReadOnly, t.Location); break; } case 184: { lexer.NextToken(); -#line 2987 "VBNET.ATG" +#line 2994 "VBNET.ATG" m.Add(Modifier.WriteOnly, t.Location); break; } case 183: { lexer.NextToken(); -#line 2988 "VBNET.ATG" +#line 2995 "VBNET.ATG" m.Add(Modifier.WithEvents, t.Location); break; } case 81: { lexer.NextToken(); -#line 2989 "VBNET.ATG" +#line 2996 "VBNET.ATG" m.Add(Modifier.Dim, t.Location); break; } case 202: { lexer.NextToken(); -#line 2990 "VBNET.ATG" +#line 2997 "VBNET.ATG" m.Add(Modifier.Widening, t.Location); break; } case 201: { lexer.NextToken(); -#line 2991 "VBNET.ATG" +#line 2998 "VBNET.ATG" m.Add(Modifier.Narrowing, t.Location); break; } @@ -1620,18 +1635,18 @@ Modifiers m) { } void ClassMemberDecl( -#line 932 "VBNET.ATG" +#line 939 "VBNET.ATG" Modifiers m, List attributes) { StructureMemberDecl( -#line 933 "VBNET.ATG" +#line 940 "VBNET.ATG" m, attributes); } void StructureMemberDecl( -#line 946 "VBNET.ATG" +#line 953 "VBNET.ATG" Modifiers m, List attributes) { -#line 948 "VBNET.ATG" +#line 955 "VBNET.ATG" TypeReference type = null; List p = new List(); Statement stmt = null; @@ -1641,37 +1656,37 @@ Modifiers m, List attributes) { switch (la.kind) { case 67: case 80: case 90: case 112: case 121: case 166: { NonModuleDeclaration( -#line 954 "VBNET.ATG" +#line 961 "VBNET.ATG" m, attributes); break; } case 167: { lexer.NextToken(); -#line 958 "VBNET.ATG" +#line 965 "VBNET.ATG" Point startPos = t.Location; if (StartOf(12)) { -#line 962 "VBNET.ATG" +#line 969 "VBNET.ATG" string name = String.Empty; MethodDeclaration methodDeclaration; List handlesClause = null; List implementsClause = null; Identifier(); -#line 968 "VBNET.ATG" +#line 975 "VBNET.ATG" name = t.val; m.Check(Modifier.VBMethods); TypeParameterList( -#line 971 "VBNET.ATG" +#line 978 "VBNET.ATG" templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 972 "VBNET.ATG" +#line 979 "VBNET.ATG" p); } Expect(25); @@ -1679,23 +1694,23 @@ p); if (la.kind == 105 || la.kind == 107) { if (la.kind == 107) { ImplementsClause( -#line 975 "VBNET.ATG" +#line 982 "VBNET.ATG" out implementsClause); } else { HandlesClause( -#line 977 "VBNET.ATG" +#line 984 "VBNET.ATG" out handlesClause); } } -#line 980 "VBNET.ATG" +#line 987 "VBNET.ATG" Point endLocation = t.EndLocation; Expect(1); if ( -#line 984 "VBNET.ATG" +#line 991 "VBNET.ATG" IsMustOverride(m)) { -#line 986 "VBNET.ATG" +#line 993 "VBNET.ATG" methodDeclaration = new MethodDeclaration(name, m.Modifier, null, p, attributes); methodDeclaration.StartLocation = m.GetDeclarationLocation(startPos); methodDeclaration.EndLocation = endLocation; @@ -1709,7 +1724,7 @@ IsMustOverride(m)) { } else if (StartOf(13)) { -#line 999 "VBNET.ATG" +#line 1006 "VBNET.ATG" methodDeclaration = new MethodDeclaration(name, m.Modifier, null, p, attributes); methodDeclaration.StartLocation = m.GetDeclarationLocation(startPos); methodDeclaration.EndLocation = endLocation; @@ -1723,17 +1738,17 @@ IsMustOverride(m)) { compilationUnit.BlockStart(methodDeclaration); Block( -#line 1011 "VBNET.ATG" +#line 1018 "VBNET.ATG" out stmt); -#line 1013 "VBNET.ATG" +#line 1020 "VBNET.ATG" compilationUnit.BlockEnd(); methodDeclaration.Body = (BlockStatement)stmt; Expect(88); Expect(167); -#line 1016 "VBNET.ATG" +#line 1023 "VBNET.ATG" methodDeclaration.Body.EndLocation = t.EndLocation; Expect(1); } else SynErr(220); @@ -1743,29 +1758,29 @@ out stmt); lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1019 "VBNET.ATG" +#line 1026 "VBNET.ATG" p); } Expect(25); } -#line 1020 "VBNET.ATG" +#line 1027 "VBNET.ATG" m.Check(Modifier.Constructors); -#line 1021 "VBNET.ATG" +#line 1028 "VBNET.ATG" Point constructorEndLocation = t.EndLocation; Expect(1); Block( -#line 1023 "VBNET.ATG" +#line 1030 "VBNET.ATG" out stmt); Expect(88); Expect(167); -#line 1024 "VBNET.ATG" +#line 1031 "VBNET.ATG" Point endLocation = t.EndLocation; Expect(1); -#line 1026 "VBNET.ATG" +#line 1033 "VBNET.ATG" ConstructorDeclaration cd = new ConstructorDeclaration("New", m.Modifier, p, attributes); cd.StartLocation = m.GetDeclarationLocation(startPos); cd.EndLocation = constructorEndLocation; @@ -1779,7 +1794,7 @@ out stmt); case 100: { lexer.NextToken(); -#line 1038 "VBNET.ATG" +#line 1045 "VBNET.ATG" m.Check(Modifier.VBMethods); string name = String.Empty; Point startPos = t.Location; @@ -1789,16 +1804,16 @@ out stmt); Identifier(); -#line 1045 "VBNET.ATG" +#line 1052 "VBNET.ATG" name = t.val; TypeParameterList( -#line 1046 "VBNET.ATG" +#line 1053 "VBNET.ATG" templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1047 "VBNET.ATG" +#line 1054 "VBNET.ATG" p); } Expect(25); @@ -1807,15 +1822,15 @@ p); lexer.NextToken(); while (la.kind == 27) { AttributeSection( -#line 1048 "VBNET.ATG" +#line 1055 "VBNET.ATG" out returnTypeAttributeSection); } TypeName( -#line 1048 "VBNET.ATG" +#line 1055 "VBNET.ATG" out type); } -#line 1050 "VBNET.ATG" +#line 1057 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object"); } @@ -1823,20 +1838,20 @@ out type); if (la.kind == 105 || la.kind == 107) { if (la.kind == 107) { ImplementsClause( -#line 1056 "VBNET.ATG" +#line 1063 "VBNET.ATG" out implementsClause); } else { HandlesClause( -#line 1058 "VBNET.ATG" +#line 1065 "VBNET.ATG" out handlesClause); } } Expect(1); if ( -#line 1064 "VBNET.ATG" +#line 1071 "VBNET.ATG" IsMustOverride(m)) { -#line 1066 "VBNET.ATG" +#line 1073 "VBNET.ATG" methodDeclaration = new MethodDeclaration(name, m.Modifier, type, p, attributes); methodDeclaration.StartLocation = m.GetDeclarationLocation(startPos); methodDeclaration.EndLocation = t.EndLocation; @@ -1852,7 +1867,7 @@ IsMustOverride(m)) { } else if (StartOf(13)) { -#line 1081 "VBNET.ATG" +#line 1088 "VBNET.ATG" methodDeclaration = new MethodDeclaration(name, m.Modifier, type, p, attributes); methodDeclaration.StartLocation = m.GetDeclarationLocation(startPos); methodDeclaration.EndLocation = t.EndLocation; @@ -1869,17 +1884,17 @@ IsMustOverride(m)) { compilationUnit.BlockStart(methodDeclaration); Block( -#line 1096 "VBNET.ATG" +#line 1103 "VBNET.ATG" out stmt); -#line 1098 "VBNET.ATG" +#line 1105 "VBNET.ATG" compilationUnit.BlockEnd(); methodDeclaration.Body = (BlockStatement)stmt; Expect(88); Expect(100); -#line 1103 "VBNET.ATG" +#line 1110 "VBNET.ATG" methodDeclaration.Body.StartLocation = methodDeclaration.EndLocation; methodDeclaration.Body.EndLocation = t.EndLocation; @@ -1890,7 +1905,7 @@ out stmt); case 78: { lexer.NextToken(); -#line 1112 "VBNET.ATG" +#line 1119 "VBNET.ATG" m.Check(Modifier.VBExternalMethods); Point startPos = t.Location; CharsetModifier charsetModifer = CharsetModifier.None; @@ -1900,39 +1915,39 @@ out stmt); if (StartOf(14)) { Charset( -#line 1119 "VBNET.ATG" +#line 1126 "VBNET.ATG" out charsetModifer); } if (la.kind == 167) { lexer.NextToken(); Identifier(); -#line 1122 "VBNET.ATG" +#line 1129 "VBNET.ATG" name = t.val; Expect(115); Expect(3); -#line 1123 "VBNET.ATG" +#line 1130 "VBNET.ATG" library = t.literalValue.ToString(); if (la.kind == 44) { lexer.NextToken(); Expect(3); -#line 1124 "VBNET.ATG" +#line 1131 "VBNET.ATG" alias = t.literalValue.ToString(); } if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1125 "VBNET.ATG" +#line 1132 "VBNET.ATG" p); } Expect(25); } Expect(1); -#line 1128 "VBNET.ATG" +#line 1135 "VBNET.ATG" DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer); declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos); declareDeclaration.EndLocation = t.EndLocation; @@ -1942,25 +1957,25 @@ p); lexer.NextToken(); Identifier(); -#line 1135 "VBNET.ATG" +#line 1142 "VBNET.ATG" name = t.val; Expect(115); Expect(3); -#line 1136 "VBNET.ATG" +#line 1143 "VBNET.ATG" library = t.literalValue.ToString(); if (la.kind == 44) { lexer.NextToken(); Expect(3); -#line 1137 "VBNET.ATG" +#line 1144 "VBNET.ATG" alias = t.literalValue.ToString(); } if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1138 "VBNET.ATG" +#line 1145 "VBNET.ATG" p); } Expect(25); @@ -1968,12 +1983,12 @@ p); if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 1139 "VBNET.ATG" +#line 1146 "VBNET.ATG" out type); } Expect(1); -#line 1142 "VBNET.ATG" +#line 1149 "VBNET.ATG" DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer); declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos); declareDeclaration.EndLocation = t.EndLocation; @@ -1985,7 +2000,7 @@ out type); case 93: { lexer.NextToken(); -#line 1152 "VBNET.ATG" +#line 1159 "VBNET.ATG" m.Check(Modifier.VBEvents); Point startPos = t.Location; EventDeclaration eventDeclaration; @@ -1994,19 +2009,19 @@ out type); Identifier(); -#line 1158 "VBNET.ATG" +#line 1165 "VBNET.ATG" name= t.val; if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 1160 "VBNET.ATG" +#line 1167 "VBNET.ATG" out type); } else if (la.kind == 1 || la.kind == 24 || la.kind == 107) { if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1162 "VBNET.ATG" +#line 1169 "VBNET.ATG" p); } Expect(25); @@ -2014,11 +2029,11 @@ p); } else SynErr(224); if (la.kind == 107) { ImplementsClause( -#line 1164 "VBNET.ATG" +#line 1171 "VBNET.ATG" out implementsClause); } -#line 1166 "VBNET.ATG" +#line 1173 "VBNET.ATG" eventDeclaration = new EventDeclaration(type, m.Modifier, p, attributes, name, implementsClause); eventDeclaration.StartLocation = m.GetDeclarationLocation(startPos); eventDeclaration.EndLocation = t.EndLocation; @@ -2029,26 +2044,26 @@ out implementsClause); } case 2: case 47: case 49: case 50: case 51: case 70: case 144: case 169: case 176: case 177: { -#line 1173 "VBNET.ATG" +#line 1180 "VBNET.ATG" Point startPos = t.Location; -#line 1175 "VBNET.ATG" +#line 1182 "VBNET.ATG" m.Check(Modifier.Fields); FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier); fd.StartLocation = m.GetDeclarationLocation(startPos); VariableDeclarator( -#line 1179 "VBNET.ATG" +#line 1186 "VBNET.ATG" variableDeclarators); while (la.kind == 12) { lexer.NextToken(); VariableDeclarator( -#line 1180 "VBNET.ATG" +#line 1187 "VBNET.ATG" variableDeclarators); } Expect(1); -#line 1183 "VBNET.ATG" +#line 1190 "VBNET.ATG" fd.EndLocation = t.EndLocation; fd.Fields = variableDeclarators; compilationUnit.AddChild(fd); @@ -2057,35 +2072,35 @@ variableDeclarators); } case 71: { -#line 1188 "VBNET.ATG" +#line 1195 "VBNET.ATG" m.Check(Modifier.Fields); lexer.NextToken(); -#line 1189 "VBNET.ATG" +#line 1196 "VBNET.ATG" m.Add(Modifier.Const, t.Location); -#line 1191 "VBNET.ATG" +#line 1198 "VBNET.ATG" FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier); fd.StartLocation = m.GetDeclarationLocation(t.Location); List constantDeclarators = new List(); ConstantDeclarator( -#line 1195 "VBNET.ATG" +#line 1202 "VBNET.ATG" constantDeclarators); while (la.kind == 12) { lexer.NextToken(); ConstantDeclarator( -#line 1196 "VBNET.ATG" +#line 1203 "VBNET.ATG" constantDeclarators); } -#line 1198 "VBNET.ATG" +#line 1205 "VBNET.ATG" fd.Fields = constantDeclarators; fd.EndLocation = t.Location; Expect(1); -#line 1203 "VBNET.ATG" +#line 1210 "VBNET.ATG" fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd); @@ -2094,20 +2109,20 @@ constantDeclarators); case 146: { lexer.NextToken(); -#line 1209 "VBNET.ATG" +#line 1216 "VBNET.ATG" m.Check(Modifier.VBProperties); Point startPos = t.Location; List implementsClause = null; Identifier(); -#line 1213 "VBNET.ATG" +#line 1220 "VBNET.ATG" string propertyName = t.val; if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1214 "VBNET.ATG" +#line 1221 "VBNET.ATG" p); } Expect(25); @@ -2115,26 +2130,26 @@ p); if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 1215 "VBNET.ATG" +#line 1222 "VBNET.ATG" out type); } -#line 1217 "VBNET.ATG" +#line 1224 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object"); } if (la.kind == 107) { ImplementsClause( -#line 1221 "VBNET.ATG" +#line 1228 "VBNET.ATG" out implementsClause); } Expect(1); if ( -#line 1225 "VBNET.ATG" +#line 1232 "VBNET.ATG" IsMustOverride(m)) { -#line 1227 "VBNET.ATG" +#line 1234 "VBNET.ATG" PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes); pDecl.StartLocation = m.GetDeclarationLocation(startPos); pDecl.EndLocation = t.Location; @@ -2145,7 +2160,7 @@ IsMustOverride(m)) { } else if (la.kind == 27 || la.kind == 101 || la.kind == 156) { -#line 1237 "VBNET.ATG" +#line 1244 "VBNET.ATG" PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes); pDecl.StartLocation = m.GetDeclarationLocation(startPos); pDecl.EndLocation = t.Location; @@ -2157,13 +2172,13 @@ IsMustOverride(m)) { PropertySetRegion setRegion; AccessorDecls( -#line 1247 "VBNET.ATG" +#line 1254 "VBNET.ATG" out getRegion, out setRegion); Expect(88); Expect(146); Expect(1); -#line 1251 "VBNET.ATG" +#line 1258 "VBNET.ATG" pDecl.GetRegion = getRegion; pDecl.SetRegion = setRegion; pDecl.BodyEnd = t.EndLocation; @@ -2175,11 +2190,11 @@ out getRegion, out setRegion); case 204: { lexer.NextToken(); -#line 1258 "VBNET.ATG" +#line 1265 "VBNET.ATG" Point startPos = t.Location; Expect(93); -#line 1260 "VBNET.ATG" +#line 1267 "VBNET.ATG" m.Check(Modifier.VBCustomEvents); EventAddRemoveRegion eventAccessorDeclaration; EventAddRegion addHandlerAccessorDeclaration = null; @@ -2189,24 +2204,24 @@ out getRegion, out setRegion); Identifier(); -#line 1267 "VBNET.ATG" +#line 1274 "VBNET.ATG" string customEventName = t.val; Expect(48); TypeName( -#line 1268 "VBNET.ATG" +#line 1275 "VBNET.ATG" out type); if (la.kind == 107) { ImplementsClause( -#line 1269 "VBNET.ATG" +#line 1276 "VBNET.ATG" out implementsClause); } Expect(1); while (StartOf(15)) { EventAccessorDeclaration( -#line 1272 "VBNET.ATG" +#line 1279 "VBNET.ATG" out eventAccessorDeclaration); -#line 1274 "VBNET.ATG" +#line 1281 "VBNET.ATG" if(eventAccessorDeclaration is EventAddRegion) { addHandlerAccessorDeclaration = (EventAddRegion)eventAccessorDeclaration; @@ -2225,7 +2240,7 @@ out eventAccessorDeclaration); Expect(93); Expect(1); -#line 1290 "VBNET.ATG" +#line 1297 "VBNET.ATG" if(addHandlerAccessorDeclaration == null) { Error("Need to provide AddHandler accessor."); @@ -2254,7 +2269,7 @@ out eventAccessorDeclaration); case 187: { lexer.NextToken(); -#line 1316 "VBNET.ATG" +#line 1323 "VBNET.ATG" m.Check(Modifier.VBOperators); Point startPos = t.Location; TypeReference returnType = NullTypeReference.Instance; @@ -2266,7 +2281,7 @@ out eventAccessorDeclaration); List returnTypeAttributes = new List(); OverloadableOperator( -#line 1326 "VBNET.ATG" +#line 1333 "VBNET.ATG" out operatorType); Expect(24); if (la.kind == 55) { @@ -2274,16 +2289,16 @@ out operatorType); } Identifier(); -#line 1327 "VBNET.ATG" +#line 1334 "VBNET.ATG" operandName = t.val; if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 1328 "VBNET.ATG" +#line 1335 "VBNET.ATG" out operandType); } -#line 1329 "VBNET.ATG" +#line 1336 "VBNET.ATG" parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParamModifier.In)); while (la.kind == 12) { lexer.NextToken(); @@ -2292,48 +2307,48 @@ out operandType); } Identifier(); -#line 1333 "VBNET.ATG" +#line 1340 "VBNET.ATG" operandName = t.val; if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 1334 "VBNET.ATG" +#line 1341 "VBNET.ATG" out operandType); } -#line 1335 "VBNET.ATG" +#line 1342 "VBNET.ATG" parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParamModifier.In)); } Expect(25); -#line 1338 "VBNET.ATG" +#line 1345 "VBNET.ATG" Point endPos = t.EndLocation; if (la.kind == 48) { lexer.NextToken(); while (la.kind == 27) { AttributeSection( -#line 1339 "VBNET.ATG" +#line 1346 "VBNET.ATG" out section); -#line 1339 "VBNET.ATG" +#line 1346 "VBNET.ATG" returnTypeAttributes.Add(section); } TypeName( -#line 1339 "VBNET.ATG" +#line 1346 "VBNET.ATG" out returnType); -#line 1339 "VBNET.ATG" +#line 1346 "VBNET.ATG" endPos = t.EndLocation; Expect(1); } Block( -#line 1340 "VBNET.ATG" +#line 1347 "VBNET.ATG" out stmt); Expect(88); Expect(187); Expect(1); -#line 1342 "VBNET.ATG" +#line 1349 "VBNET.ATG" OperatorDeclaration operatorDeclaration = new OperatorDeclaration(m.Modifier, attributes, parameters, @@ -2355,25 +2370,25 @@ out stmt); } void EnumMemberDecl( -#line 914 "VBNET.ATG" +#line 921 "VBNET.ATG" out FieldDeclaration f) { -#line 916 "VBNET.ATG" +#line 923 "VBNET.ATG" Expression expr = null;List attributes = new List(); AttributeSection section = null; VariableDeclaration varDecl = null; while (la.kind == 27) { AttributeSection( -#line 920 "VBNET.ATG" +#line 927 "VBNET.ATG" out section); -#line 920 "VBNET.ATG" +#line 927 "VBNET.ATG" attributes.Add(section); } Identifier(); -#line 923 "VBNET.ATG" +#line 930 "VBNET.ATG" f = new FieldDeclaration(attributes); varDecl = new VariableDeclaration(t.val); f.Fields.Add(varDecl); @@ -2382,10 +2397,10 @@ out section); if (la.kind == 11) { lexer.NextToken(); Expr( -#line 928 "VBNET.ATG" +#line 935 "VBNET.ATG" out expr); -#line 928 "VBNET.ATG" +#line 935 "VBNET.ATG" varDecl.Initializer = expr; } Expect(1); @@ -2393,7 +2408,7 @@ out expr); void InterfaceMemberDecl() { -#line 831 "VBNET.ATG" +#line 838 "VBNET.ATG" TypeReference type =null; List p = new List(); List templates = new List(); @@ -2405,31 +2420,31 @@ out expr); if (StartOf(16)) { while (la.kind == 27) { AttributeSection( -#line 839 "VBNET.ATG" +#line 846 "VBNET.ATG" out section); -#line 839 "VBNET.ATG" +#line 846 "VBNET.ATG" attributes.Add(section); } while (StartOf(7)) { MemberModifier( -#line 842 "VBNET.ATG" +#line 849 "VBNET.ATG" mod); } if (la.kind == 93) { lexer.NextToken(); -#line 845 "VBNET.ATG" +#line 852 "VBNET.ATG" mod.Check(Modifier.VBInterfaceEvents); Identifier(); -#line 846 "VBNET.ATG" +#line 853 "VBNET.ATG" name = t.val; if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 847 "VBNET.ATG" +#line 854 "VBNET.ATG" p); } Expect(25); @@ -2437,12 +2452,12 @@ p); if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 848 "VBNET.ATG" +#line 855 "VBNET.ATG" out type); } Expect(1); -#line 851 "VBNET.ATG" +#line 858 "VBNET.ATG" EventDeclaration ed = new EventDeclaration(type, mod.Modifier, p, attributes, name, null); compilationUnit.AddChild(ed); ed.EndLocation = t.EndLocation; @@ -2450,27 +2465,27 @@ out type); } else if (la.kind == 167) { lexer.NextToken(); -#line 857 "VBNET.ATG" +#line 864 "VBNET.ATG" mod.Check(Modifier.VBInterfaceMethods); Identifier(); -#line 858 "VBNET.ATG" +#line 865 "VBNET.ATG" name = t.val; TypeParameterList( -#line 859 "VBNET.ATG" +#line 866 "VBNET.ATG" templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 860 "VBNET.ATG" +#line 867 "VBNET.ATG" p); } Expect(25); } Expect(1); -#line 863 "VBNET.ATG" +#line 870 "VBNET.ATG" MethodDeclaration md = new MethodDeclaration(name, mod.Modifier, null, p, attributes); md.TypeReference = new TypeReference("", "System.Void"); md.EndLocation = t.EndLocation; @@ -2480,20 +2495,20 @@ p); } else if (la.kind == 100) { lexer.NextToken(); -#line 871 "VBNET.ATG" +#line 878 "VBNET.ATG" mod.Check(Modifier.VBInterfaceMethods); Identifier(); -#line 872 "VBNET.ATG" +#line 879 "VBNET.ATG" name = t.val; TypeParameterList( -#line 873 "VBNET.ATG" +#line 880 "VBNET.ATG" templates); if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 874 "VBNET.ATG" +#line 881 "VBNET.ATG" p); } Expect(25); @@ -2502,15 +2517,15 @@ p); lexer.NextToken(); while (la.kind == 27) { AttributeSection( -#line 875 "VBNET.ATG" +#line 882 "VBNET.ATG" out returnTypeAttributeSection); } TypeName( -#line 875 "VBNET.ATG" +#line 882 "VBNET.ATG" out type); } -#line 877 "VBNET.ATG" +#line 884 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object"); } @@ -2527,17 +2542,17 @@ out type); } else if (la.kind == 146) { lexer.NextToken(); -#line 892 "VBNET.ATG" +#line 899 "VBNET.ATG" mod.Check(Modifier.VBInterfaceProperties); Identifier(); -#line 893 "VBNET.ATG" +#line 900 "VBNET.ATG" name = t.val; if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 894 "VBNET.ATG" +#line 901 "VBNET.ATG" p); } Expect(25); @@ -2545,18 +2560,18 @@ p); if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 895 "VBNET.ATG" +#line 902 "VBNET.ATG" out type); } -#line 897 "VBNET.ATG" +#line 904 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object"); } Expect(1); -#line 903 "VBNET.ATG" +#line 910 "VBNET.ATG" PropertyDeclaration pd = new PropertyDeclaration(name, type, mod.Modifier, attributes); pd.Parameters = p; pd.EndLocation = t.EndLocation; @@ -2565,97 +2580,97 @@ out type); } else SynErr(227); } else if (StartOf(17)) { NonModuleDeclaration( -#line 910 "VBNET.ATG" +#line 917 "VBNET.ATG" mod, attributes); } else SynErr(228); } void Expr( -#line 1719 "VBNET.ATG" +#line 1726 "VBNET.ATG" out Expression expr) { DisjunctionExpr( -#line 1721 "VBNET.ATG" +#line 1728 "VBNET.ATG" out expr); } void ImplementsClause( -#line 1690 "VBNET.ATG" +#line 1697 "VBNET.ATG" out List baseInterfaces) { -#line 1692 "VBNET.ATG" +#line 1699 "VBNET.ATG" baseInterfaces = new List(); TypeReference type = null; string memberName = null; Expect(107); NonArrayTypeName( -#line 1697 "VBNET.ATG" +#line 1704 "VBNET.ATG" out type, false); -#line 1698 "VBNET.ATG" +#line 1705 "VBNET.ATG" if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type); -#line 1699 "VBNET.ATG" +#line 1706 "VBNET.ATG" baseInterfaces.Add(new InterfaceImplementation(type, memberName)); while (la.kind == 12) { lexer.NextToken(); NonArrayTypeName( -#line 1701 "VBNET.ATG" +#line 1708 "VBNET.ATG" out type, false); -#line 1702 "VBNET.ATG" +#line 1709 "VBNET.ATG" if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type); -#line 1703 "VBNET.ATG" +#line 1710 "VBNET.ATG" baseInterfaces.Add(new InterfaceImplementation(type, memberName)); } } void HandlesClause( -#line 1648 "VBNET.ATG" +#line 1655 "VBNET.ATG" out List handlesClause) { -#line 1650 "VBNET.ATG" +#line 1657 "VBNET.ATG" handlesClause = new List(); string name; Expect(105); EventMemberSpecifier( -#line 1653 "VBNET.ATG" +#line 1660 "VBNET.ATG" out name); -#line 1653 "VBNET.ATG" +#line 1660 "VBNET.ATG" handlesClause.Add(name); while (la.kind == 12) { lexer.NextToken(); EventMemberSpecifier( -#line 1654 "VBNET.ATG" +#line 1661 "VBNET.ATG" out name); -#line 1654 "VBNET.ATG" +#line 1661 "VBNET.ATG" handlesClause.Add(name); } } void Block( -#line 2329 "VBNET.ATG" +#line 2336 "VBNET.ATG" out Statement stmt) { -#line 2332 "VBNET.ATG" +#line 2339 "VBNET.ATG" BlockStatement blockStmt = new BlockStatement(); blockStmt.StartLocation = t.Location; compilationUnit.BlockStart(blockStmt); while (StartOf(18) || -#line 2337 "VBNET.ATG" +#line 2344 "VBNET.ATG" IsEndStmtAhead()) { if ( -#line 2337 "VBNET.ATG" +#line 2344 "VBNET.ATG" IsEndStmtAhead()) { Expect(88); EndOfStmt(); -#line 2337 "VBNET.ATG" +#line 2344 "VBNET.ATG" compilationUnit.AddChild(new EndStatement()); } else { Statement(); @@ -2663,7 +2678,7 @@ IsEndStmtAhead()) { } } -#line 2342 "VBNET.ATG" +#line 2349 "VBNET.ATG" stmt = blockStmt; blockStmt.EndLocation = t.EndLocation; compilationUnit.BlockEnd(); @@ -2671,35 +2686,35 @@ IsEndStmtAhead()) { } void Charset( -#line 1640 "VBNET.ATG" +#line 1647 "VBNET.ATG" out CharsetModifier charsetModifier) { -#line 1641 "VBNET.ATG" +#line 1648 "VBNET.ATG" charsetModifier = CharsetModifier.None; if (la.kind == 100 || la.kind == 167) { } else if (la.kind == 47) { lexer.NextToken(); -#line 1642 "VBNET.ATG" +#line 1649 "VBNET.ATG" charsetModifier = CharsetModifier.ANSI; } else if (la.kind == 50) { lexer.NextToken(); -#line 1643 "VBNET.ATG" +#line 1650 "VBNET.ATG" charsetModifier = CharsetModifier.Auto; } else if (la.kind == 176) { lexer.NextToken(); -#line 1644 "VBNET.ATG" +#line 1651 "VBNET.ATG" charsetModifier = CharsetModifier.Unicode; } else SynErr(229); } void VariableDeclarator( -#line 1528 "VBNET.ATG" +#line 1535 "VBNET.ATG" List fieldDeclaration) { -#line 1530 "VBNET.ATG" +#line 1537 "VBNET.ATG" Expression expr = null; TypeReference type = null; ArrayList rank = null; @@ -2707,31 +2722,31 @@ List fieldDeclaration) { Identifier(); -#line 1535 "VBNET.ATG" +#line 1542 "VBNET.ATG" string name = t.val; if ( -#line 1536 "VBNET.ATG" +#line 1543 "VBNET.ATG" IsSize() && !IsDims()) { ArrayInitializationModifier( -#line 1536 "VBNET.ATG" +#line 1543 "VBNET.ATG" out dimension); } if ( -#line 1537 "VBNET.ATG" +#line 1544 "VBNET.ATG" IsDims()) { ArrayNameModifier( -#line 1537 "VBNET.ATG" +#line 1544 "VBNET.ATG" out rank); } if ( -#line 1539 "VBNET.ATG" +#line 1546 "VBNET.ATG" IsObjectCreation()) { Expect(48); ObjectCreateExpression( -#line 1539 "VBNET.ATG" +#line 1546 "VBNET.ATG" out expr); -#line 1541 "VBNET.ATG" +#line 1548 "VBNET.ATG" if (expr is ObjectCreateExpression) { type = ((ObjectCreateExpression)expr).CreateType; } else { @@ -2742,11 +2757,11 @@ out expr); if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 1548 "VBNET.ATG" +#line 1555 "VBNET.ATG" out type); } -#line 1550 "VBNET.ATG" +#line 1557 "VBNET.ATG" if (type != null && dimension != null) { if(type.RankSpecifier != null) { Error("array rank only allowed one time"); @@ -2772,40 +2787,40 @@ out type); if (la.kind == 11) { lexer.NextToken(); VariableInitializer( -#line 1572 "VBNET.ATG" +#line 1579 "VBNET.ATG" out expr); } } else SynErr(230); -#line 1574 "VBNET.ATG" +#line 1581 "VBNET.ATG" fieldDeclaration.Add(new VariableDeclaration(name, expr, type)); } void ConstantDeclarator( -#line 1511 "VBNET.ATG" +#line 1518 "VBNET.ATG" List constantDeclaration) { -#line 1513 "VBNET.ATG" +#line 1520 "VBNET.ATG" Expression expr = null; TypeReference type = null; string name = String.Empty; Identifier(); -#line 1517 "VBNET.ATG" +#line 1524 "VBNET.ATG" name = t.val; if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 1518 "VBNET.ATG" +#line 1525 "VBNET.ATG" out type); } Expect(11); Expr( -#line 1519 "VBNET.ATG" +#line 1526 "VBNET.ATG" out expr); -#line 1521 "VBNET.ATG" +#line 1528 "VBNET.ATG" VariableDeclaration f = new VariableDeclaration(name, expr); f.TypeReference = type; constantDeclaration.Add(f); @@ -2813,10 +2828,10 @@ out expr); } void AccessorDecls( -#line 1453 "VBNET.ATG" +#line 1460 "VBNET.ATG" out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { -#line 1455 "VBNET.ATG" +#line 1462 "VBNET.ATG" List attributes = new List(); AttributeSection section; getBlock = null; @@ -2824,60 +2839,60 @@ out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { while (la.kind == 27) { AttributeSection( -#line 1460 "VBNET.ATG" +#line 1467 "VBNET.ATG" out section); -#line 1460 "VBNET.ATG" +#line 1467 "VBNET.ATG" attributes.Add(section); } if (la.kind == 101) { GetAccessorDecl( -#line 1462 "VBNET.ATG" +#line 1469 "VBNET.ATG" out getBlock, attributes); if (la.kind == 27 || la.kind == 156) { -#line 1464 "VBNET.ATG" +#line 1471 "VBNET.ATG" attributes = new List(); while (la.kind == 27) { AttributeSection( -#line 1465 "VBNET.ATG" +#line 1472 "VBNET.ATG" out section); -#line 1465 "VBNET.ATG" +#line 1472 "VBNET.ATG" attributes.Add(section); } SetAccessorDecl( -#line 1466 "VBNET.ATG" +#line 1473 "VBNET.ATG" out setBlock, attributes); } } else if (la.kind == 156) { SetAccessorDecl( -#line 1469 "VBNET.ATG" +#line 1476 "VBNET.ATG" out setBlock, attributes); if (la.kind == 27 || la.kind == 101) { -#line 1471 "VBNET.ATG" +#line 1478 "VBNET.ATG" attributes = new List(); while (la.kind == 27) { AttributeSection( -#line 1472 "VBNET.ATG" +#line 1479 "VBNET.ATG" out section); -#line 1472 "VBNET.ATG" +#line 1479 "VBNET.ATG" attributes.Add(section); } GetAccessorDecl( -#line 1473 "VBNET.ATG" +#line 1480 "VBNET.ATG" out getBlock, attributes); } } else SynErr(231); } void EventAccessorDeclaration( -#line 1416 "VBNET.ATG" +#line 1423 "VBNET.ATG" out EventAddRemoveRegion eventAccessorDeclaration) { -#line 1418 "VBNET.ATG" +#line 1425 "VBNET.ATG" Statement stmt = null; List p = new List(); AttributeSection section; @@ -2886,10 +2901,10 @@ out EventAddRemoveRegion eventAccessorDeclaration) { while (la.kind == 27) { AttributeSection( -#line 1424 "VBNET.ATG" +#line 1431 "VBNET.ATG" out section); -#line 1424 "VBNET.ATG" +#line 1431 "VBNET.ATG" attributes.Add(section); } if (la.kind == 42) { @@ -2898,20 +2913,20 @@ out section); lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1426 "VBNET.ATG" +#line 1433 "VBNET.ATG" p); } Expect(25); } Expect(1); Block( -#line 1427 "VBNET.ATG" +#line 1434 "VBNET.ATG" out stmt); Expect(88); Expect(42); Expect(1); -#line 1429 "VBNET.ATG" +#line 1436 "VBNET.ATG" eventAccessorDeclaration = new EventAddRegion(attributes); eventAccessorDeclaration.Block = (BlockStatement)stmt; eventAccessorDeclaration.Parameters = p; @@ -2922,20 +2937,20 @@ out stmt); lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1434 "VBNET.ATG" +#line 1441 "VBNET.ATG" p); } Expect(25); } Expect(1); Block( -#line 1435 "VBNET.ATG" +#line 1442 "VBNET.ATG" out stmt); Expect(88); Expect(152); Expect(1); -#line 1437 "VBNET.ATG" +#line 1444 "VBNET.ATG" eventAccessorDeclaration = new EventRemoveRegion(attributes); eventAccessorDeclaration.Block = (BlockStatement)stmt; eventAccessorDeclaration.Parameters = p; @@ -2946,20 +2961,20 @@ out stmt); lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1442 "VBNET.ATG" +#line 1449 "VBNET.ATG" p); } Expect(25); } Expect(1); Block( -#line 1443 "VBNET.ATG" +#line 1450 "VBNET.ATG" out stmt); Expect(88); Expect(149); Expect(1); -#line 1445 "VBNET.ATG" +#line 1452 "VBNET.ATG" eventAccessorDeclaration = new EventRaiseRegion(attributes); eventAccessorDeclaration.Block = (BlockStatement)stmt; eventAccessorDeclaration.Parameters = p; @@ -2968,163 +2983,163 @@ out stmt); } void OverloadableOperator( -#line 1358 "VBNET.ATG" +#line 1365 "VBNET.ATG" out OverloadableOperatorType operatorType) { -#line 1359 "VBNET.ATG" +#line 1366 "VBNET.ATG" operatorType = OverloadableOperatorType.None; switch (la.kind) { case 14: { lexer.NextToken(); -#line 1361 "VBNET.ATG" +#line 1368 "VBNET.ATG" operatorType = OverloadableOperatorType.Add; break; } case 15: { lexer.NextToken(); -#line 1363 "VBNET.ATG" +#line 1370 "VBNET.ATG" operatorType = OverloadableOperatorType.Subtract; break; } case 16: { lexer.NextToken(); -#line 1365 "VBNET.ATG" +#line 1372 "VBNET.ATG" operatorType = OverloadableOperatorType.Multiply; break; } case 17: { lexer.NextToken(); -#line 1367 "VBNET.ATG" +#line 1374 "VBNET.ATG" operatorType = OverloadableOperatorType.Divide; break; } case 18: { lexer.NextToken(); -#line 1369 "VBNET.ATG" +#line 1376 "VBNET.ATG" operatorType = OverloadableOperatorType.DivideInteger; break; } case 19: { lexer.NextToken(); -#line 1371 "VBNET.ATG" +#line 1378 "VBNET.ATG" operatorType = OverloadableOperatorType.Concat; break; } case 116: { lexer.NextToken(); -#line 1373 "VBNET.ATG" +#line 1380 "VBNET.ATG" operatorType = OverloadableOperatorType.Like; break; } case 120: { lexer.NextToken(); -#line 1375 "VBNET.ATG" +#line 1382 "VBNET.ATG" operatorType = OverloadableOperatorType.Modulus; break; } case 45: { lexer.NextToken(); -#line 1377 "VBNET.ATG" +#line 1384 "VBNET.ATG" operatorType = OverloadableOperatorType.BitwiseAnd; break; } case 138: { lexer.NextToken(); -#line 1379 "VBNET.ATG" +#line 1386 "VBNET.ATG" operatorType = OverloadableOperatorType.BitwiseOr; break; } case 185: { lexer.NextToken(); -#line 1381 "VBNET.ATG" +#line 1388 "VBNET.ATG" operatorType = OverloadableOperatorType.ExclusiveOr; break; } case 20: { lexer.NextToken(); -#line 1383 "VBNET.ATG" +#line 1390 "VBNET.ATG" operatorType = OverloadableOperatorType.Power; break; } case 31: { lexer.NextToken(); -#line 1385 "VBNET.ATG" +#line 1392 "VBNET.ATG" operatorType = OverloadableOperatorType.ShiftLeft; break; } case 32: { lexer.NextToken(); -#line 1387 "VBNET.ATG" +#line 1394 "VBNET.ATG" operatorType = OverloadableOperatorType.ShiftRight; break; } case 11: { lexer.NextToken(); -#line 1389 "VBNET.ATG" +#line 1396 "VBNET.ATG" operatorType = OverloadableOperatorType.Equality; break; } case 28: { lexer.NextToken(); -#line 1391 "VBNET.ATG" +#line 1398 "VBNET.ATG" operatorType = OverloadableOperatorType.InEquality; break; } case 27: { lexer.NextToken(); -#line 1393 "VBNET.ATG" +#line 1400 "VBNET.ATG" operatorType = OverloadableOperatorType.LessThan; break; } case 30: { lexer.NextToken(); -#line 1395 "VBNET.ATG" +#line 1402 "VBNET.ATG" operatorType = OverloadableOperatorType.LessThanOrEqual; break; } case 26: { lexer.NextToken(); -#line 1397 "VBNET.ATG" +#line 1404 "VBNET.ATG" operatorType = OverloadableOperatorType.GreaterThan; break; } case 29: { lexer.NextToken(); -#line 1399 "VBNET.ATG" +#line 1406 "VBNET.ATG" operatorType = OverloadableOperatorType.GreaterThanOrEqual; break; } case 75: { lexer.NextToken(); -#line 1401 "VBNET.ATG" +#line 1408 "VBNET.ATG" operatorType = OverloadableOperatorType.CType; break; } case 2: case 47: case 49: case 50: case 51: case 70: case 144: case 169: case 176: case 177: { Identifier(); -#line 1405 "VBNET.ATG" +#line 1412 "VBNET.ATG" string opName = t.val; if (string.Equals(opName, "istrue", StringComparison.InvariantCultureIgnoreCase)) { operatorType = OverloadableOperatorType.IsTrue; @@ -3141,98 +3156,98 @@ out OverloadableOperatorType operatorType) { } void GetAccessorDecl( -#line 1479 "VBNET.ATG" +#line 1486 "VBNET.ATG" out PropertyGetRegion getBlock, List attributes) { -#line 1480 "VBNET.ATG" +#line 1487 "VBNET.ATG" Statement stmt = null; Expect(101); -#line 1482 "VBNET.ATG" +#line 1489 "VBNET.ATG" Point startLocation = t.Location; Expect(1); Block( -#line 1484 "VBNET.ATG" +#line 1491 "VBNET.ATG" out stmt); -#line 1485 "VBNET.ATG" +#line 1492 "VBNET.ATG" getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes); Expect(88); Expect(101); -#line 1487 "VBNET.ATG" +#line 1494 "VBNET.ATG" getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; Expect(1); } void SetAccessorDecl( -#line 1492 "VBNET.ATG" +#line 1499 "VBNET.ATG" out PropertySetRegion setBlock, List attributes) { -#line 1494 "VBNET.ATG" +#line 1501 "VBNET.ATG" Statement stmt = null; List p = new List(); Expect(156); -#line 1497 "VBNET.ATG" +#line 1504 "VBNET.ATG" Point startLocation = t.Location; if (la.kind == 24) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1498 "VBNET.ATG" +#line 1505 "VBNET.ATG" p); } Expect(25); } Expect(1); Block( -#line 1500 "VBNET.ATG" +#line 1507 "VBNET.ATG" out stmt); -#line 1502 "VBNET.ATG" +#line 1509 "VBNET.ATG" setBlock = new PropertySetRegion((BlockStatement)stmt, attributes); setBlock.Parameters = p; Expect(88); Expect(156); -#line 1506 "VBNET.ATG" +#line 1513 "VBNET.ATG" setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; Expect(1); } void ArrayInitializationModifier( -#line 1578 "VBNET.ATG" +#line 1585 "VBNET.ATG" out List arrayModifiers) { -#line 1580 "VBNET.ATG" +#line 1587 "VBNET.ATG" arrayModifiers = null; Expect(24); InitializationRankList( -#line 1582 "VBNET.ATG" +#line 1589 "VBNET.ATG" out arrayModifiers); Expect(25); } void ArrayNameModifier( -#line 2122 "VBNET.ATG" +#line 2129 "VBNET.ATG" out ArrayList arrayModifiers) { -#line 2124 "VBNET.ATG" +#line 2131 "VBNET.ATG" arrayModifiers = null; ArrayTypeModifiers( -#line 2126 "VBNET.ATG" +#line 2133 "VBNET.ATG" out arrayModifiers); } void ObjectCreateExpression( -#line 2004 "VBNET.ATG" +#line 2011 "VBNET.ATG" out Expression oce) { -#line 2006 "VBNET.ATG" +#line 2013 "VBNET.ATG" TypeReference type = null; Expression initializer = null; List arguments = null; @@ -3241,37 +3256,37 @@ out Expression oce) { Expect(127); NonArrayTypeName( -#line 2012 "VBNET.ATG" +#line 2019 "VBNET.ATG" out type, false); if (la.kind == 24) { lexer.NextToken(); if (StartOf(20)) { ArgumentList( -#line 2013 "VBNET.ATG" +#line 2020 "VBNET.ATG" out arguments); } Expect(25); } if (la.kind == 22 || -#line 2014 "VBNET.ATG" +#line 2021 "VBNET.ATG" la.kind == Tokens.OpenParenthesis) { if ( -#line 2014 "VBNET.ATG" +#line 2021 "VBNET.ATG" la.kind == Tokens.OpenParenthesis) { ArrayTypeModifiers( -#line 2015 "VBNET.ATG" +#line 2022 "VBNET.ATG" out dimensions); ArrayInitializer( -#line 2016 "VBNET.ATG" +#line 2023 "VBNET.ATG" out initializer); } else { ArrayInitializer( -#line 2017 "VBNET.ATG" +#line 2024 "VBNET.ATG" out initializer); } } -#line 2019 "VBNET.ATG" +#line 2026 "VBNET.ATG" if (initializer == null) { oce = new ObjectCreateExpression(type, arguments); } else { @@ -3286,120 +3301,120 @@ out initializer); } void VariableInitializer( -#line 1612 "VBNET.ATG" +#line 1619 "VBNET.ATG" out Expression initializerExpression) { -#line 1614 "VBNET.ATG" +#line 1621 "VBNET.ATG" initializerExpression = null; if (StartOf(21)) { Expr( -#line 1616 "VBNET.ATG" +#line 1623 "VBNET.ATG" out initializerExpression); } else if (la.kind == 22) { ArrayInitializer( -#line 1617 "VBNET.ATG" +#line 1624 "VBNET.ATG" out initializerExpression); } else SynErr(234); } void InitializationRankList( -#line 1586 "VBNET.ATG" +#line 1593 "VBNET.ATG" out List rank) { -#line 1588 "VBNET.ATG" +#line 1595 "VBNET.ATG" rank = new List(); Expression expr = null; Expr( -#line 1591 "VBNET.ATG" +#line 1598 "VBNET.ATG" out expr); if (la.kind == 172) { lexer.NextToken(); -#line 1593 "VBNET.ATG" +#line 1600 "VBNET.ATG" if (!(expr is PrimitiveExpression) || (expr as PrimitiveExpression).StringValue != "0") Error("lower bound of array must be zero"); Expr( -#line 1596 "VBNET.ATG" +#line 1603 "VBNET.ATG" out expr); } -#line 1598 "VBNET.ATG" +#line 1605 "VBNET.ATG" if (expr != null) { rank.Add(expr); } while (la.kind == 12) { lexer.NextToken(); Expr( -#line 1600 "VBNET.ATG" +#line 1607 "VBNET.ATG" out expr); if (la.kind == 172) { lexer.NextToken(); -#line 1602 "VBNET.ATG" +#line 1609 "VBNET.ATG" if (!(expr is PrimitiveExpression) || (expr as PrimitiveExpression).StringValue != "0") Error("lower bound of array must be zero"); Expr( -#line 1605 "VBNET.ATG" +#line 1612 "VBNET.ATG" out expr); } -#line 1607 "VBNET.ATG" +#line 1614 "VBNET.ATG" if (expr != null) { rank.Add(expr); } } } void ArrayInitializer( -#line 1621 "VBNET.ATG" +#line 1628 "VBNET.ATG" out Expression outExpr) { -#line 1623 "VBNET.ATG" +#line 1630 "VBNET.ATG" Expression expr = null; ArrayInitializerExpression initializer = new ArrayInitializerExpression(); Expect(22); if (StartOf(22)) { VariableInitializer( -#line 1628 "VBNET.ATG" +#line 1635 "VBNET.ATG" out expr); -#line 1630 "VBNET.ATG" +#line 1637 "VBNET.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } while ( -#line 1633 "VBNET.ATG" +#line 1640 "VBNET.ATG" NotFinalComma()) { Expect(12); VariableInitializer( -#line 1633 "VBNET.ATG" +#line 1640 "VBNET.ATG" out expr); -#line 1634 "VBNET.ATG" +#line 1641 "VBNET.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } } } Expect(23); -#line 1637 "VBNET.ATG" +#line 1644 "VBNET.ATG" outExpr = initializer; } void EventMemberSpecifier( -#line 1707 "VBNET.ATG" +#line 1714 "VBNET.ATG" out string name) { -#line 1708 "VBNET.ATG" +#line 1715 "VBNET.ATG" string type; name = String.Empty; if (StartOf(12)) { Identifier(); -#line 1709 "VBNET.ATG" +#line 1716 "VBNET.ATG" type = t.val; Expect(10); Identifier(); -#line 1711 "VBNET.ATG" +#line 1718 "VBNET.ATG" name = type + "." + t.val; } else if (la.kind == 124) { lexer.NextToken(); @@ -3407,128 +3422,128 @@ out string name) { if (StartOf(12)) { Identifier(); -#line 1714 "VBNET.ATG" +#line 1721 "VBNET.ATG" name = "MyBase." + t.val; } else if (la.kind == 92) { lexer.NextToken(); -#line 1715 "VBNET.ATG" +#line 1722 "VBNET.ATG" name = "MyBase.Error"; } else SynErr(235); } else SynErr(236); } void DisjunctionExpr( -#line 1853 "VBNET.ATG" +#line 1860 "VBNET.ATG" out Expression outExpr) { -#line 1855 "VBNET.ATG" +#line 1862 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ConjunctionExpr( -#line 1858 "VBNET.ATG" +#line 1865 "VBNET.ATG" out outExpr); while (la.kind == 138 || la.kind == 139 || la.kind == 185) { if (la.kind == 138) { lexer.NextToken(); -#line 1861 "VBNET.ATG" +#line 1868 "VBNET.ATG" op = BinaryOperatorType.BitwiseOr; } else if (la.kind == 139) { lexer.NextToken(); -#line 1862 "VBNET.ATG" +#line 1869 "VBNET.ATG" op = BinaryOperatorType.LogicalOr; } else { lexer.NextToken(); -#line 1863 "VBNET.ATG" +#line 1870 "VBNET.ATG" op = BinaryOperatorType.ExclusiveOr; } ConjunctionExpr( -#line 1865 "VBNET.ATG" +#line 1872 "VBNET.ATG" out expr); -#line 1865 "VBNET.ATG" +#line 1872 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void AssignmentOperator( -#line 1724 "VBNET.ATG" +#line 1731 "VBNET.ATG" out AssignmentOperatorType op) { -#line 1725 "VBNET.ATG" +#line 1732 "VBNET.ATG" op = AssignmentOperatorType.None; switch (la.kind) { case 11: { lexer.NextToken(); -#line 1726 "VBNET.ATG" +#line 1733 "VBNET.ATG" op = AssignmentOperatorType.Assign; break; } case 41: { lexer.NextToken(); -#line 1727 "VBNET.ATG" +#line 1734 "VBNET.ATG" op = AssignmentOperatorType.ConcatString; break; } case 33: { lexer.NextToken(); -#line 1728 "VBNET.ATG" +#line 1735 "VBNET.ATG" op = AssignmentOperatorType.Add; break; } case 35: { lexer.NextToken(); -#line 1729 "VBNET.ATG" +#line 1736 "VBNET.ATG" op = AssignmentOperatorType.Subtract; break; } case 36: { lexer.NextToken(); -#line 1730 "VBNET.ATG" +#line 1737 "VBNET.ATG" op = AssignmentOperatorType.Multiply; break; } case 37: { lexer.NextToken(); -#line 1731 "VBNET.ATG" +#line 1738 "VBNET.ATG" op = AssignmentOperatorType.Divide; break; } case 38: { lexer.NextToken(); -#line 1732 "VBNET.ATG" +#line 1739 "VBNET.ATG" op = AssignmentOperatorType.DivideInteger; break; } case 34: { lexer.NextToken(); -#line 1733 "VBNET.ATG" +#line 1740 "VBNET.ATG" op = AssignmentOperatorType.Power; break; } case 39: { lexer.NextToken(); -#line 1734 "VBNET.ATG" +#line 1741 "VBNET.ATG" op = AssignmentOperatorType.ShiftLeft; break; } case 40: { lexer.NextToken(); -#line 1735 "VBNET.ATG" +#line 1742 "VBNET.ATG" op = AssignmentOperatorType.ShiftRight; break; } @@ -3537,10 +3552,10 @@ out AssignmentOperatorType op) { } void SimpleExpr( -#line 1739 "VBNET.ATG" +#line 1746 "VBNET.ATG" out Expression pexpr) { -#line 1741 "VBNET.ATG" +#line 1748 "VBNET.ATG" Expression expr; TypeReference type = null; string name = String.Empty; @@ -3551,136 +3566,136 @@ out Expression pexpr) { case 3: { lexer.NextToken(); -#line 1749 "VBNET.ATG" +#line 1756 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 4: { lexer.NextToken(); -#line 1750 "VBNET.ATG" +#line 1757 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 7: { lexer.NextToken(); -#line 1751 "VBNET.ATG" +#line 1758 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 6: { lexer.NextToken(); -#line 1752 "VBNET.ATG" +#line 1759 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 5: { lexer.NextToken(); -#line 1753 "VBNET.ATG" +#line 1760 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 9: { lexer.NextToken(); -#line 1754 "VBNET.ATG" +#line 1761 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 8: { lexer.NextToken(); -#line 1755 "VBNET.ATG" +#line 1762 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 173: { lexer.NextToken(); -#line 1757 "VBNET.ATG" +#line 1764 "VBNET.ATG" pexpr = new PrimitiveExpression(true, "true"); break; } case 96: { lexer.NextToken(); -#line 1758 "VBNET.ATG" +#line 1765 "VBNET.ATG" pexpr = new PrimitiveExpression(false, "false"); break; } case 130: { lexer.NextToken(); -#line 1759 "VBNET.ATG" +#line 1766 "VBNET.ATG" pexpr = new PrimitiveExpression(null, "null"); break; } case 24: { lexer.NextToken(); Expr( -#line 1760 "VBNET.ATG" +#line 1767 "VBNET.ATG" out expr); Expect(25); -#line 1760 "VBNET.ATG" +#line 1767 "VBNET.ATG" pexpr = new ParenthesizedExpression(expr); break; } case 2: case 47: case 49: case 50: case 51: case 70: case 144: case 169: case 176: case 177: { Identifier(); -#line 1761 "VBNET.ATG" +#line 1768 "VBNET.ATG" pexpr = new IdentifierExpression(t.val); break; } case 52: case 54: case 65: case 76: case 77: case 84: case 111: case 117: case 159: case 160: case 165: case 190: case 191: case 192: case 193: { -#line 1762 "VBNET.ATG" +#line 1769 "VBNET.ATG" string val = String.Empty; PrimitiveTypeName( -#line 1763 "VBNET.ATG" +#line 1770 "VBNET.ATG" out val); Expect(10); -#line 1764 "VBNET.ATG" +#line 1771 "VBNET.ATG" t.val = ""; Identifier(); -#line 1764 "VBNET.ATG" +#line 1771 "VBNET.ATG" pexpr = new FieldReferenceExpression(new TypeReferenceExpression(val), t.val); break; } case 119: { lexer.NextToken(); -#line 1765 "VBNET.ATG" +#line 1772 "VBNET.ATG" pexpr = new ThisReferenceExpression(); break; } case 124: case 125: { -#line 1766 "VBNET.ATG" +#line 1773 "VBNET.ATG" Expression retExpr = null; if (la.kind == 124) { lexer.NextToken(); -#line 1767 "VBNET.ATG" +#line 1774 "VBNET.ATG" retExpr = new BaseReferenceExpression(); } else if (la.kind == 125) { lexer.NextToken(); -#line 1768 "VBNET.ATG" +#line 1775 "VBNET.ATG" retExpr = new ClassReferenceExpression(); } else SynErr(238); Expect(10); IdentifierOrKeyword( -#line 1770 "VBNET.ATG" +#line 1777 "VBNET.ATG" out name); -#line 1770 "VBNET.ATG" +#line 1777 "VBNET.ATG" pexpr = new FieldReferenceExpression(retExpr, name); break; } @@ -3689,77 +3704,77 @@ out name); Expect(10); Identifier(); -#line 1772 "VBNET.ATG" +#line 1779 "VBNET.ATG" type = new TypeReference(t.val ?? ""); -#line 1774 "VBNET.ATG" +#line 1781 "VBNET.ATG" type.IsGlobal = true; -#line 1775 "VBNET.ATG" +#line 1782 "VBNET.ATG" pexpr = new TypeReferenceExpression(type); break; } case 127: { ObjectCreateExpression( -#line 1776 "VBNET.ATG" +#line 1783 "VBNET.ATG" out expr); -#line 1776 "VBNET.ATG" +#line 1783 "VBNET.ATG" pexpr = expr; break; } case 75: case 82: case 199: { -#line 1778 "VBNET.ATG" +#line 1785 "VBNET.ATG" CastType castType = CastType.Cast; if (la.kind == 82) { lexer.NextToken(); } else if (la.kind == 75) { lexer.NextToken(); -#line 1780 "VBNET.ATG" +#line 1787 "VBNET.ATG" castType = CastType.Conversion; } else if (la.kind == 199) { lexer.NextToken(); -#line 1781 "VBNET.ATG" +#line 1788 "VBNET.ATG" castType = CastType.TryCast; } else SynErr(239); Expect(24); Expr( -#line 1783 "VBNET.ATG" +#line 1790 "VBNET.ATG" out expr); Expect(12); TypeName( -#line 1783 "VBNET.ATG" +#line 1790 "VBNET.ATG" out type); Expect(25); -#line 1784 "VBNET.ATG" +#line 1791 "VBNET.ATG" pexpr = new CastExpression(type, expr, castType); break; } case 59: case 60: case 61: case 62: case 63: case 64: case 66: case 68: case 69: case 72: case 73: case 74: case 194: case 195: case 196: case 197: { CastTarget( -#line 1785 "VBNET.ATG" +#line 1792 "VBNET.ATG" out type); Expect(24); Expr( -#line 1785 "VBNET.ATG" +#line 1792 "VBNET.ATG" out expr); Expect(25); -#line 1785 "VBNET.ATG" +#line 1792 "VBNET.ATG" pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); break; } case 43: { lexer.NextToken(); Expr( -#line 1786 "VBNET.ATG" +#line 1793 "VBNET.ATG" out expr); -#line 1786 "VBNET.ATG" +#line 1793 "VBNET.ATG" pexpr = new AddressOfExpression(expr); break; } @@ -3767,159 +3782,159 @@ out expr); lexer.NextToken(); Expect(24); GetTypeTypeName( -#line 1787 "VBNET.ATG" +#line 1794 "VBNET.ATG" out type); Expect(25); -#line 1787 "VBNET.ATG" +#line 1794 "VBNET.ATG" pexpr = new TypeOfExpression(type); break; } case 175: { lexer.NextToken(); SimpleExpr( -#line 1788 "VBNET.ATG" +#line 1795 "VBNET.ATG" out expr); Expect(113); TypeName( -#line 1788 "VBNET.ATG" +#line 1795 "VBNET.ATG" out type); -#line 1788 "VBNET.ATG" +#line 1795 "VBNET.ATG" pexpr = new TypeOfIsExpression(expr, type); break; } } while (la.kind == 10 || la.kind == 24) { InvocationOrMemberReferenceExpression( -#line 1790 "VBNET.ATG" +#line 1797 "VBNET.ATG" ref pexpr); } } else if (la.kind == 10) { lexer.NextToken(); IdentifierOrKeyword( -#line 1793 "VBNET.ATG" +#line 1800 "VBNET.ATG" out name); -#line 1793 "VBNET.ATG" +#line 1800 "VBNET.ATG" pexpr = new FieldReferenceExpression(pexpr, name); while (la.kind == 10 || la.kind == 24) { InvocationOrMemberReferenceExpression( -#line 1794 "VBNET.ATG" +#line 1801 "VBNET.ATG" ref pexpr); } } else SynErr(240); } void PrimitiveTypeName( -#line 2933 "VBNET.ATG" +#line 2940 "VBNET.ATG" out string type) { -#line 2934 "VBNET.ATG" +#line 2941 "VBNET.ATG" type = String.Empty; switch (la.kind) { case 52: { lexer.NextToken(); -#line 2935 "VBNET.ATG" +#line 2942 "VBNET.ATG" type = "Boolean"; break; } case 76: { lexer.NextToken(); -#line 2936 "VBNET.ATG" +#line 2943 "VBNET.ATG" type = "Date"; break; } case 65: { lexer.NextToken(); -#line 2937 "VBNET.ATG" +#line 2944 "VBNET.ATG" type = "Char"; break; } case 165: { lexer.NextToken(); -#line 2938 "VBNET.ATG" +#line 2945 "VBNET.ATG" type = "String"; break; } case 77: { lexer.NextToken(); -#line 2939 "VBNET.ATG" +#line 2946 "VBNET.ATG" type = "Decimal"; break; } case 54: { lexer.NextToken(); -#line 2940 "VBNET.ATG" +#line 2947 "VBNET.ATG" type = "Byte"; break; } case 159: { lexer.NextToken(); -#line 2941 "VBNET.ATG" +#line 2948 "VBNET.ATG" type = "Short"; break; } case 111: { lexer.NextToken(); -#line 2942 "VBNET.ATG" +#line 2949 "VBNET.ATG" type = "Integer"; break; } case 117: { lexer.NextToken(); -#line 2943 "VBNET.ATG" +#line 2950 "VBNET.ATG" type = "Long"; break; } case 160: { lexer.NextToken(); -#line 2944 "VBNET.ATG" +#line 2951 "VBNET.ATG" type = "Single"; break; } case 84: { lexer.NextToken(); -#line 2945 "VBNET.ATG" +#line 2952 "VBNET.ATG" type = "Double"; break; } case 191: { lexer.NextToken(); -#line 2946 "VBNET.ATG" +#line 2953 "VBNET.ATG" type = "UInteger"; break; } case 192: { lexer.NextToken(); -#line 2947 "VBNET.ATG" +#line 2954 "VBNET.ATG" type = "ULong"; break; } case 193: { lexer.NextToken(); -#line 2948 "VBNET.ATG" +#line 2955 "VBNET.ATG" type = "UShort"; break; } case 190: { lexer.NextToken(); -#line 2949 "VBNET.ATG" +#line 2956 "VBNET.ATG" type = "SByte"; break; } @@ -3928,130 +3943,130 @@ out string type) { } void IdentifierOrKeyword( -#line 2926 "VBNET.ATG" +#line 2933 "VBNET.ATG" out string name) { -#line 2928 "VBNET.ATG" +#line 2935 "VBNET.ATG" lexer.NextToken(); name = t.val; } void CastTarget( -#line 1831 "VBNET.ATG" +#line 1838 "VBNET.ATG" out TypeReference type) { -#line 1833 "VBNET.ATG" +#line 1840 "VBNET.ATG" type = null; switch (la.kind) { case 59: { lexer.NextToken(); -#line 1835 "VBNET.ATG" +#line 1842 "VBNET.ATG" type = new TypeReference("System.Boolean"); break; } case 60: { lexer.NextToken(); -#line 1836 "VBNET.ATG" +#line 1843 "VBNET.ATG" type = new TypeReference("System.Byte"); break; } case 194: { lexer.NextToken(); -#line 1837 "VBNET.ATG" +#line 1844 "VBNET.ATG" type = new TypeReference("System.SByte"); break; } case 61: { lexer.NextToken(); -#line 1838 "VBNET.ATG" +#line 1845 "VBNET.ATG" type = new TypeReference("System.Char"); break; } case 62: { lexer.NextToken(); -#line 1839 "VBNET.ATG" +#line 1846 "VBNET.ATG" type = new TypeReference("System.DateTime"); break; } case 64: { lexer.NextToken(); -#line 1840 "VBNET.ATG" +#line 1847 "VBNET.ATG" type = new TypeReference("System.Decimal"); break; } case 63: { lexer.NextToken(); -#line 1841 "VBNET.ATG" +#line 1848 "VBNET.ATG" type = new TypeReference("System.Double"); break; } case 72: { lexer.NextToken(); -#line 1842 "VBNET.ATG" +#line 1849 "VBNET.ATG" type = new TypeReference("System.Int16"); break; } case 66: { lexer.NextToken(); -#line 1843 "VBNET.ATG" +#line 1850 "VBNET.ATG" type = new TypeReference("System.Int32"); break; } case 68: { lexer.NextToken(); -#line 1844 "VBNET.ATG" +#line 1851 "VBNET.ATG" type = new TypeReference("System.Int64"); break; } case 195: { lexer.NextToken(); -#line 1845 "VBNET.ATG" +#line 1852 "VBNET.ATG" type = new TypeReference("System.UInt16"); break; } case 196: { lexer.NextToken(); -#line 1846 "VBNET.ATG" +#line 1853 "VBNET.ATG" type = new TypeReference("System.UInt32"); break; } case 197: { lexer.NextToken(); -#line 1847 "VBNET.ATG" +#line 1854 "VBNET.ATG" type = new TypeReference("System.UInt64"); break; } case 69: { lexer.NextToken(); -#line 1848 "VBNET.ATG" +#line 1855 "VBNET.ATG" type = new TypeReference("System.Object"); break; } case 73: { lexer.NextToken(); -#line 1849 "VBNET.ATG" +#line 1856 "VBNET.ATG" type = new TypeReference("System.Single"); break; } case 74: { lexer.NextToken(); -#line 1850 "VBNET.ATG" +#line 1857 "VBNET.ATG" type = new TypeReference("System.String"); break; } @@ -4060,19 +4075,19 @@ out TypeReference type) { } void GetTypeTypeName( -#line 2074 "VBNET.ATG" +#line 2081 "VBNET.ATG" out TypeReference typeref) { -#line 2075 "VBNET.ATG" +#line 2082 "VBNET.ATG" ArrayList rank = null; NonArrayTypeName( -#line 2077 "VBNET.ATG" +#line 2084 "VBNET.ATG" out typeref, true); ArrayTypeModifiers( -#line 2078 "VBNET.ATG" +#line 2085 "VBNET.ATG" out rank); -#line 2079 "VBNET.ATG" +#line 2086 "VBNET.ATG" if (rank != null && typeref != null) { typeref.RankSpecifier = (int[])rank.ToArray(typeof(int)); } @@ -4080,405 +4095,405 @@ out rank); } void InvocationOrMemberReferenceExpression( -#line 1798 "VBNET.ATG" +#line 1805 "VBNET.ATG" ref Expression pexpr) { -#line 1799 "VBNET.ATG" +#line 1806 "VBNET.ATG" string name; if (la.kind == 10) { lexer.NextToken(); IdentifierOrKeyword( -#line 1801 "VBNET.ATG" +#line 1808 "VBNET.ATG" out name); -#line 1801 "VBNET.ATG" +#line 1808 "VBNET.ATG" pexpr = new FieldReferenceExpression(pexpr, name); } else if (la.kind == 24) { InvocationExpression( -#line 1802 "VBNET.ATG" +#line 1809 "VBNET.ATG" ref pexpr); } else SynErr(243); } void InvocationExpression( -#line 1805 "VBNET.ATG" +#line 1812 "VBNET.ATG" ref Expression pexpr) { -#line 1806 "VBNET.ATG" +#line 1813 "VBNET.ATG" List typeParameters = new List(); List parameters = null; TypeReference type; Expect(24); -#line 1810 "VBNET.ATG" +#line 1817 "VBNET.ATG" Point start = t.Location; if (la.kind == 200) { lexer.NextToken(); TypeName( -#line 1812 "VBNET.ATG" +#line 1819 "VBNET.ATG" out type); -#line 1812 "VBNET.ATG" +#line 1819 "VBNET.ATG" if (type != null) typeParameters.Add(type); Expect(25); if (la.kind == 10) { lexer.NextToken(); Identifier(); -#line 1816 "VBNET.ATG" +#line 1823 "VBNET.ATG" pexpr = new FieldReferenceExpression(GetTypeReferenceExpression(pexpr, typeParameters), t.val); } else if (la.kind == 24) { lexer.NextToken(); ArgumentList( -#line 1818 "VBNET.ATG" +#line 1825 "VBNET.ATG" out parameters); Expect(25); -#line 1820 "VBNET.ATG" +#line 1827 "VBNET.ATG" pexpr = new InvocationExpression(pexpr, parameters, typeParameters); } else SynErr(244); } else if (StartOf(20)) { ArgumentList( -#line 1822 "VBNET.ATG" +#line 1829 "VBNET.ATG" out parameters); Expect(25); -#line 1824 "VBNET.ATG" +#line 1831 "VBNET.ATG" pexpr = new InvocationExpression(pexpr, parameters, typeParameters); } else SynErr(245); -#line 1826 "VBNET.ATG" +#line 1833 "VBNET.ATG" pexpr.StartLocation = start; pexpr.EndLocation = t.Location; } void ArgumentList( -#line 2033 "VBNET.ATG" +#line 2040 "VBNET.ATG" out List arguments) { -#line 2035 "VBNET.ATG" +#line 2042 "VBNET.ATG" arguments = new List(); Expression expr = null; if (StartOf(21)) { Argument( -#line 2039 "VBNET.ATG" +#line 2046 "VBNET.ATG" out expr); -#line 2039 "VBNET.ATG" +#line 2046 "VBNET.ATG" if (expr != null) { arguments.Add(expr); } while (la.kind == 12) { lexer.NextToken(); Argument( -#line 2042 "VBNET.ATG" +#line 2049 "VBNET.ATG" out expr); -#line 2042 "VBNET.ATG" +#line 2049 "VBNET.ATG" if (expr != null) { arguments.Add(expr); } } } } void ConjunctionExpr( -#line 1869 "VBNET.ATG" +#line 1876 "VBNET.ATG" out Expression outExpr) { -#line 1871 "VBNET.ATG" +#line 1878 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; NotExpr( -#line 1874 "VBNET.ATG" +#line 1881 "VBNET.ATG" out outExpr); while (la.kind == 45 || la.kind == 46) { if (la.kind == 45) { lexer.NextToken(); -#line 1877 "VBNET.ATG" +#line 1884 "VBNET.ATG" op = BinaryOperatorType.BitwiseAnd; } else { lexer.NextToken(); -#line 1878 "VBNET.ATG" +#line 1885 "VBNET.ATG" op = BinaryOperatorType.LogicalAnd; } NotExpr( -#line 1880 "VBNET.ATG" +#line 1887 "VBNET.ATG" out expr); -#line 1880 "VBNET.ATG" +#line 1887 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void NotExpr( -#line 1884 "VBNET.ATG" +#line 1891 "VBNET.ATG" out Expression outExpr) { -#line 1885 "VBNET.ATG" +#line 1892 "VBNET.ATG" UnaryOperatorType uop = UnaryOperatorType.None; while (la.kind == 129) { lexer.NextToken(); -#line 1886 "VBNET.ATG" +#line 1893 "VBNET.ATG" uop = UnaryOperatorType.Not; } ComparisonExpr( -#line 1887 "VBNET.ATG" +#line 1894 "VBNET.ATG" out outExpr); -#line 1888 "VBNET.ATG" +#line 1895 "VBNET.ATG" if (uop != UnaryOperatorType.None) outExpr = new UnaryOperatorExpression(outExpr, uop); } void ComparisonExpr( -#line 1893 "VBNET.ATG" +#line 1900 "VBNET.ATG" out Expression outExpr) { -#line 1895 "VBNET.ATG" +#line 1902 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( -#line 1898 "VBNET.ATG" +#line 1905 "VBNET.ATG" out outExpr); while (StartOf(24)) { switch (la.kind) { case 27: { lexer.NextToken(); -#line 1901 "VBNET.ATG" +#line 1908 "VBNET.ATG" op = BinaryOperatorType.LessThan; break; } case 26: { lexer.NextToken(); -#line 1902 "VBNET.ATG" +#line 1909 "VBNET.ATG" op = BinaryOperatorType.GreaterThan; break; } case 30: { lexer.NextToken(); -#line 1903 "VBNET.ATG" +#line 1910 "VBNET.ATG" op = BinaryOperatorType.LessThanOrEqual; break; } case 29: { lexer.NextToken(); -#line 1904 "VBNET.ATG" +#line 1911 "VBNET.ATG" op = BinaryOperatorType.GreaterThanOrEqual; break; } case 28: { lexer.NextToken(); -#line 1905 "VBNET.ATG" +#line 1912 "VBNET.ATG" op = BinaryOperatorType.InEquality; break; } case 11: { lexer.NextToken(); -#line 1906 "VBNET.ATG" +#line 1913 "VBNET.ATG" op = BinaryOperatorType.Equality; break; } case 116: { lexer.NextToken(); -#line 1907 "VBNET.ATG" +#line 1914 "VBNET.ATG" op = BinaryOperatorType.Like; break; } case 113: { lexer.NextToken(); -#line 1908 "VBNET.ATG" +#line 1915 "VBNET.ATG" op = BinaryOperatorType.ReferenceEquality; break; } case 189: { lexer.NextToken(); -#line 1909 "VBNET.ATG" +#line 1916 "VBNET.ATG" op = BinaryOperatorType.ReferenceInequality; break; } } ShiftExpr( -#line 1911 "VBNET.ATG" +#line 1918 "VBNET.ATG" out expr); -#line 1911 "VBNET.ATG" +#line 1918 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void ShiftExpr( -#line 1915 "VBNET.ATG" +#line 1922 "VBNET.ATG" out Expression outExpr) { -#line 1917 "VBNET.ATG" +#line 1924 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ConcatenationExpr( -#line 1920 "VBNET.ATG" +#line 1927 "VBNET.ATG" out outExpr); while (la.kind == 31 || la.kind == 32) { if (la.kind == 31) { lexer.NextToken(); -#line 1923 "VBNET.ATG" +#line 1930 "VBNET.ATG" op = BinaryOperatorType.ShiftLeft; } else { lexer.NextToken(); -#line 1924 "VBNET.ATG" +#line 1931 "VBNET.ATG" op = BinaryOperatorType.ShiftRight; } ConcatenationExpr( -#line 1926 "VBNET.ATG" +#line 1933 "VBNET.ATG" out expr); -#line 1926 "VBNET.ATG" +#line 1933 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void ConcatenationExpr( -#line 1930 "VBNET.ATG" +#line 1937 "VBNET.ATG" out Expression outExpr) { -#line 1931 "VBNET.ATG" +#line 1938 "VBNET.ATG" Expression expr; AdditiveExpr( -#line 1933 "VBNET.ATG" +#line 1940 "VBNET.ATG" out outExpr); while (la.kind == 19) { lexer.NextToken(); AdditiveExpr( -#line 1933 "VBNET.ATG" +#line 1940 "VBNET.ATG" out expr); -#line 1933 "VBNET.ATG" +#line 1940 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Concat, expr); } } void AdditiveExpr( -#line 1936 "VBNET.ATG" +#line 1943 "VBNET.ATG" out Expression outExpr) { -#line 1938 "VBNET.ATG" +#line 1945 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ModuloExpr( -#line 1941 "VBNET.ATG" +#line 1948 "VBNET.ATG" out outExpr); while (la.kind == 14 || la.kind == 15) { if (la.kind == 14) { lexer.NextToken(); -#line 1944 "VBNET.ATG" +#line 1951 "VBNET.ATG" op = BinaryOperatorType.Add; } else { lexer.NextToken(); -#line 1945 "VBNET.ATG" +#line 1952 "VBNET.ATG" op = BinaryOperatorType.Subtract; } ModuloExpr( -#line 1947 "VBNET.ATG" +#line 1954 "VBNET.ATG" out expr); -#line 1947 "VBNET.ATG" +#line 1954 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void ModuloExpr( -#line 1951 "VBNET.ATG" +#line 1958 "VBNET.ATG" out Expression outExpr) { -#line 1952 "VBNET.ATG" +#line 1959 "VBNET.ATG" Expression expr; IntegerDivisionExpr( -#line 1954 "VBNET.ATG" +#line 1961 "VBNET.ATG" out outExpr); while (la.kind == 120) { lexer.NextToken(); IntegerDivisionExpr( -#line 1954 "VBNET.ATG" +#line 1961 "VBNET.ATG" out expr); -#line 1954 "VBNET.ATG" +#line 1961 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Modulus, expr); } } void IntegerDivisionExpr( -#line 1957 "VBNET.ATG" +#line 1964 "VBNET.ATG" out Expression outExpr) { -#line 1958 "VBNET.ATG" +#line 1965 "VBNET.ATG" Expression expr; MultiplicativeExpr( -#line 1960 "VBNET.ATG" +#line 1967 "VBNET.ATG" out outExpr); while (la.kind == 18) { lexer.NextToken(); MultiplicativeExpr( -#line 1960 "VBNET.ATG" +#line 1967 "VBNET.ATG" out expr); -#line 1960 "VBNET.ATG" +#line 1967 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.DivideInteger, expr); } } void MultiplicativeExpr( -#line 1963 "VBNET.ATG" +#line 1970 "VBNET.ATG" out Expression outExpr) { -#line 1965 "VBNET.ATG" +#line 1972 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; UnaryExpr( -#line 1968 "VBNET.ATG" +#line 1975 "VBNET.ATG" out outExpr); while (la.kind == 16 || la.kind == 17) { if (la.kind == 16) { lexer.NextToken(); -#line 1971 "VBNET.ATG" +#line 1978 "VBNET.ATG" op = BinaryOperatorType.Multiply; } else { lexer.NextToken(); -#line 1972 "VBNET.ATG" +#line 1979 "VBNET.ATG" op = BinaryOperatorType.Divide; } UnaryExpr( -#line 1974 "VBNET.ATG" +#line 1981 "VBNET.ATG" out expr); -#line 1974 "VBNET.ATG" +#line 1981 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void UnaryExpr( -#line 1978 "VBNET.ATG" +#line 1985 "VBNET.ATG" out Expression uExpr) { -#line 1980 "VBNET.ATG" +#line 1987 "VBNET.ATG" Expression expr; UnaryOperatorType uop = UnaryOperatorType.None; bool isUOp = false; @@ -4487,25 +4502,25 @@ out Expression uExpr) { if (la.kind == 14) { lexer.NextToken(); -#line 1984 "VBNET.ATG" +#line 1991 "VBNET.ATG" uop = UnaryOperatorType.Plus; isUOp = true; } else if (la.kind == 15) { lexer.NextToken(); -#line 1985 "VBNET.ATG" +#line 1992 "VBNET.ATG" uop = UnaryOperatorType.Minus; isUOp = true; } else { lexer.NextToken(); -#line 1986 "VBNET.ATG" +#line 1993 "VBNET.ATG" uop = UnaryOperatorType.Star; isUOp = true; } } ExponentiationExpr( -#line 1988 "VBNET.ATG" +#line 1995 "VBNET.ATG" out expr); -#line 1990 "VBNET.ATG" +#line 1997 "VBNET.ATG" if (isUOp) { uExpr = new UnaryOperatorExpression(expr, uop); } else { @@ -4515,50 +4530,50 @@ out expr); } void ExponentiationExpr( -#line 1998 "VBNET.ATG" +#line 2005 "VBNET.ATG" out Expression outExpr) { -#line 1999 "VBNET.ATG" +#line 2006 "VBNET.ATG" Expression expr; SimpleExpr( -#line 2001 "VBNET.ATG" +#line 2008 "VBNET.ATG" out outExpr); while (la.kind == 20) { lexer.NextToken(); SimpleExpr( -#line 2001 "VBNET.ATG" +#line 2008 "VBNET.ATG" out expr); -#line 2001 "VBNET.ATG" +#line 2008 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Power, expr); } } void ArrayTypeModifiers( -#line 2131 "VBNET.ATG" +#line 2138 "VBNET.ATG" out ArrayList arrayModifiers) { -#line 2133 "VBNET.ATG" +#line 2140 "VBNET.ATG" arrayModifiers = new ArrayList(); int i = 0; while ( -#line 2136 "VBNET.ATG" +#line 2143 "VBNET.ATG" IsDims()) { Expect(24); if (la.kind == 12 || la.kind == 25) { RankList( -#line 2138 "VBNET.ATG" +#line 2145 "VBNET.ATG" out i); } -#line 2140 "VBNET.ATG" +#line 2147 "VBNET.ATG" arrayModifiers.Add(i); Expect(25); } -#line 2145 "VBNET.ATG" +#line 2152 "VBNET.ATG" if(arrayModifiers.Count == 0) { arrayModifiers = null; } @@ -4566,69 +4581,69 @@ out i); } void Argument( -#line 2048 "VBNET.ATG" +#line 2055 "VBNET.ATG" out Expression argumentexpr) { -#line 2050 "VBNET.ATG" +#line 2057 "VBNET.ATG" Expression expr; argumentexpr = null; string name; if ( -#line 2054 "VBNET.ATG" +#line 2061 "VBNET.ATG" IsNamedAssign()) { Identifier(); -#line 2054 "VBNET.ATG" +#line 2061 "VBNET.ATG" name = t.val; Expect(13); Expect(11); Expr( -#line 2054 "VBNET.ATG" +#line 2061 "VBNET.ATG" out expr); -#line 2056 "VBNET.ATG" +#line 2063 "VBNET.ATG" argumentexpr = new NamedArgumentExpression(name, expr); } else if (StartOf(21)) { Expr( -#line 2059 "VBNET.ATG" +#line 2066 "VBNET.ATG" out argumentexpr); } else SynErr(246); } void QualIdentAndTypeArguments( -#line 2105 "VBNET.ATG" +#line 2112 "VBNET.ATG" out TypeReference typeref, bool canBeUnbound) { -#line 2106 "VBNET.ATG" +#line 2113 "VBNET.ATG" string name; typeref = null; Qualident( -#line 2108 "VBNET.ATG" +#line 2115 "VBNET.ATG" out name); -#line 2109 "VBNET.ATG" +#line 2116 "VBNET.ATG" typeref = new TypeReference(name); if ( -#line 2110 "VBNET.ATG" +#line 2117 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { lexer.NextToken(); Expect(200); if ( -#line 2112 "VBNET.ATG" +#line 2119 "VBNET.ATG" canBeUnbound && (la.kind == Tokens.CloseParenthesis || la.kind == Tokens.Comma)) { -#line 2113 "VBNET.ATG" +#line 2120 "VBNET.ATG" typeref.GenericTypes.Add(NullTypeReference.Instance); while (la.kind == 12) { lexer.NextToken(); -#line 2114 "VBNET.ATG" +#line 2121 "VBNET.ATG" typeref.GenericTypes.Add(NullTypeReference.Instance); } } else if (StartOf(5)) { TypeArgumentList( -#line 2115 "VBNET.ATG" +#line 2122 "VBNET.ATG" typeref.GenericTypes); } else SynErr(247); Expect(25); @@ -4636,48 +4651,48 @@ typeref.GenericTypes); } void TypeArgumentList( -#line 2158 "VBNET.ATG" +#line 2165 "VBNET.ATG" List typeArguments) { -#line 2160 "VBNET.ATG" +#line 2167 "VBNET.ATG" TypeReference typeref; TypeName( -#line 2162 "VBNET.ATG" +#line 2169 "VBNET.ATG" out typeref); -#line 2162 "VBNET.ATG" +#line 2169 "VBNET.ATG" if (typeref != null) typeArguments.Add(typeref); while (la.kind == 12) { lexer.NextToken(); TypeName( -#line 2165 "VBNET.ATG" +#line 2172 "VBNET.ATG" out typeref); -#line 2165 "VBNET.ATG" +#line 2172 "VBNET.ATG" if (typeref != null) typeArguments.Add(typeref); } } void RankList( -#line 2152 "VBNET.ATG" +#line 2159 "VBNET.ATG" out int i) { -#line 2153 "VBNET.ATG" +#line 2160 "VBNET.ATG" i = 0; while (la.kind == 12) { lexer.NextToken(); -#line 2154 "VBNET.ATG" +#line 2161 "VBNET.ATG" ++i; } } void Attribute( -#line 2190 "VBNET.ATG" +#line 2197 "VBNET.ATG" out ICSharpCode.NRefactory.Parser.AST.Attribute attribute) { -#line 2191 "VBNET.ATG" +#line 2198 "VBNET.ATG" string name; List positional = new List(); List named = new List(); @@ -4687,39 +4702,39 @@ out ICSharpCode.NRefactory.Parser.AST.Attribute attribute) { Expect(10); } Qualident( -#line 2196 "VBNET.ATG" +#line 2203 "VBNET.ATG" out name); if (la.kind == 24) { AttributeArguments( -#line 2197 "VBNET.ATG" +#line 2204 "VBNET.ATG" positional, named); } -#line 2198 "VBNET.ATG" +#line 2205 "VBNET.ATG" attribute = new ICSharpCode.NRefactory.Parser.AST.Attribute(name, positional, named); } void AttributeArguments( -#line 2202 "VBNET.ATG" +#line 2209 "VBNET.ATG" List positional, List named) { -#line 2204 "VBNET.ATG" +#line 2211 "VBNET.ATG" bool nameFound = false; string name = ""; Expression expr; Expect(24); if ( -#line 2210 "VBNET.ATG" +#line 2217 "VBNET.ATG" IsNotClosingParenthesis()) { if ( -#line 2212 "VBNET.ATG" +#line 2219 "VBNET.ATG" IsNamedAssign()) { -#line 2212 "VBNET.ATG" +#line 2219 "VBNET.ATG" nameFound = true; IdentifierOrKeyword( -#line 2213 "VBNET.ATG" +#line 2220 "VBNET.ATG" out name); if (la.kind == 13) { lexer.NextToken(); @@ -4727,10 +4742,10 @@ out name); Expect(11); } Expr( -#line 2215 "VBNET.ATG" +#line 2222 "VBNET.ATG" out expr); -#line 2217 "VBNET.ATG" +#line 2224 "VBNET.ATG" if (expr != null) { if(name == "") positional.Add(expr); else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; } } @@ -4738,13 +4753,13 @@ out expr); while (la.kind == 12) { lexer.NextToken(); if ( -#line 2224 "VBNET.ATG" +#line 2231 "VBNET.ATG" IsNamedAssign()) { -#line 2224 "VBNET.ATG" +#line 2231 "VBNET.ATG" nameFound = true; IdentifierOrKeyword( -#line 2225 "VBNET.ATG" +#line 2232 "VBNET.ATG" out name); if (la.kind == 13) { lexer.NextToken(); @@ -4752,14 +4767,14 @@ out name); Expect(11); } else if (StartOf(21)) { -#line 2227 "VBNET.ATG" +#line 2234 "VBNET.ATG" if (nameFound) Error("no positional argument after named argument"); } else SynErr(248); Expr( -#line 2228 "VBNET.ATG" +#line 2235 "VBNET.ATG" out expr); -#line 2228 "VBNET.ATG" +#line 2235 "VBNET.ATG" if (expr != null) { if(name == "") positional.Add(expr); else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; } } @@ -4770,10 +4785,10 @@ out expr); } void FormalParameter( -#line 2297 "VBNET.ATG" +#line 2304 "VBNET.ATG" out ParameterDeclarationExpression p) { -#line 2299 "VBNET.ATG" +#line 2306 "VBNET.ATG" TypeReference type = null; ParamModifiers mod = new ParamModifiers(this); Expression expr = null; @@ -4781,28 +4796,28 @@ out ParameterDeclarationExpression p) { while (StartOf(25)) { ParameterModifier( -#line 2304 "VBNET.ATG" +#line 2311 "VBNET.ATG" mod); } Identifier(); -#line 2305 "VBNET.ATG" +#line 2312 "VBNET.ATG" string parameterName = t.val; if ( -#line 2306 "VBNET.ATG" +#line 2313 "VBNET.ATG" IsDims()) { ArrayTypeModifiers( -#line 2306 "VBNET.ATG" +#line 2313 "VBNET.ATG" out arrayModifiers); } if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 2307 "VBNET.ATG" +#line 2314 "VBNET.ATG" out type); } -#line 2309 "VBNET.ATG" +#line 2316 "VBNET.ATG" if(type != null) { if (arrayModifiers != null) { if (type.RankSpecifier != null) { @@ -4818,45 +4833,45 @@ out type); if (la.kind == 11) { lexer.NextToken(); Expr( -#line 2321 "VBNET.ATG" +#line 2328 "VBNET.ATG" out expr); } -#line 2323 "VBNET.ATG" +#line 2330 "VBNET.ATG" mod.Check(); p = new ParameterDeclarationExpression(type, parameterName, mod.Modifier, expr); } void ParameterModifier( -#line 2952 "VBNET.ATG" +#line 2959 "VBNET.ATG" ParamModifiers m) { if (la.kind == 55) { lexer.NextToken(); -#line 2953 "VBNET.ATG" +#line 2960 "VBNET.ATG" m.Add(ParamModifier.In); } else if (la.kind == 53) { lexer.NextToken(); -#line 2954 "VBNET.ATG" +#line 2961 "VBNET.ATG" m.Add(ParamModifier.Ref); } else if (la.kind == 137) { lexer.NextToken(); -#line 2955 "VBNET.ATG" +#line 2962 "VBNET.ATG" m.Add(ParamModifier.Optional); } else if (la.kind == 143) { lexer.NextToken(); -#line 2956 "VBNET.ATG" +#line 2963 "VBNET.ATG" m.Add(ParamModifier.Params); } else SynErr(249); } void Statement() { -#line 2350 "VBNET.ATG" +#line 2357 "VBNET.ATG" Statement stmt = null; Point startPos = la.Location; string label = String.Empty; @@ -4864,34 +4879,34 @@ ParamModifiers m) { if (la.kind == 1 || la.kind == 13) { } else if ( -#line 2356 "VBNET.ATG" +#line 2363 "VBNET.ATG" IsLabel()) { LabelName( -#line 2356 "VBNET.ATG" +#line 2363 "VBNET.ATG" out label); -#line 2358 "VBNET.ATG" +#line 2365 "VBNET.ATG" compilationUnit.AddChild(new LabelStatement(t.val)); Expect(13); Statement(); } else if (StartOf(26)) { EmbeddedStatement( -#line 2361 "VBNET.ATG" +#line 2368 "VBNET.ATG" out stmt); -#line 2361 "VBNET.ATG" +#line 2368 "VBNET.ATG" compilationUnit.AddChild(stmt); } else if (StartOf(27)) { LocalDeclarationStatement( -#line 2362 "VBNET.ATG" +#line 2369 "VBNET.ATG" out stmt); -#line 2362 "VBNET.ATG" +#line 2369 "VBNET.ATG" compilationUnit.AddChild(stmt); } else SynErr(250); -#line 2365 "VBNET.ATG" +#line 2372 "VBNET.ATG" if (stmt != null) { stmt.StartLocation = startPos; stmt.EndLocation = t.Location; @@ -4900,30 +4915,30 @@ out stmt); } void LabelName( -#line 2752 "VBNET.ATG" +#line 2759 "VBNET.ATG" out string name) { -#line 2754 "VBNET.ATG" +#line 2761 "VBNET.ATG" name = String.Empty; if (StartOf(12)) { Identifier(); -#line 2756 "VBNET.ATG" +#line 2763 "VBNET.ATG" name = t.val; } else if (la.kind == 5) { lexer.NextToken(); -#line 2757 "VBNET.ATG" +#line 2764 "VBNET.ATG" name = t.val; } else SynErr(251); } void EmbeddedStatement( -#line 2404 "VBNET.ATG" +#line 2411 "VBNET.ATG" out Statement statement) { -#line 2406 "VBNET.ATG" +#line 2413 "VBNET.ATG" Statement embeddedStatement = null; statement = null; Expression expr = null; @@ -4934,103 +4949,103 @@ out Statement statement) { case 94: { lexer.NextToken(); -#line 2412 "VBNET.ATG" +#line 2419 "VBNET.ATG" ExitType exitType = ExitType.None; switch (la.kind) { case 167: { lexer.NextToken(); -#line 2414 "VBNET.ATG" +#line 2421 "VBNET.ATG" exitType = ExitType.Sub; break; } case 100: { lexer.NextToken(); -#line 2416 "VBNET.ATG" +#line 2423 "VBNET.ATG" exitType = ExitType.Function; break; } case 146: { lexer.NextToken(); -#line 2418 "VBNET.ATG" +#line 2425 "VBNET.ATG" exitType = ExitType.Property; break; } case 83: { lexer.NextToken(); -#line 2420 "VBNET.ATG" +#line 2427 "VBNET.ATG" exitType = ExitType.Do; break; } case 98: { lexer.NextToken(); -#line 2422 "VBNET.ATG" +#line 2429 "VBNET.ATG" exitType = ExitType.For; break; } case 174: { lexer.NextToken(); -#line 2424 "VBNET.ATG" +#line 2431 "VBNET.ATG" exitType = ExitType.Try; break; } case 181: { lexer.NextToken(); -#line 2426 "VBNET.ATG" +#line 2433 "VBNET.ATG" exitType = ExitType.While; break; } case 155: { lexer.NextToken(); -#line 2428 "VBNET.ATG" +#line 2435 "VBNET.ATG" exitType = ExitType.Select; break; } default: SynErr(252); break; } -#line 2430 "VBNET.ATG" +#line 2437 "VBNET.ATG" statement = new ExitStatement(exitType); break; } case 174: { TryStatement( -#line 2431 "VBNET.ATG" +#line 2438 "VBNET.ATG" out statement); break; } case 186: { lexer.NextToken(); -#line 2432 "VBNET.ATG" +#line 2439 "VBNET.ATG" ContinueType continueType = ContinueType.None; if (la.kind == 83 || la.kind == 98 || la.kind == 181) { if (la.kind == 83) { lexer.NextToken(); -#line 2432 "VBNET.ATG" +#line 2439 "VBNET.ATG" continueType = ContinueType.Do; } else if (la.kind == 98) { lexer.NextToken(); -#line 2432 "VBNET.ATG" +#line 2439 "VBNET.ATG" continueType = ContinueType.For; } else { lexer.NextToken(); -#line 2432 "VBNET.ATG" +#line 2439 "VBNET.ATG" continueType = ContinueType.While; } } -#line 2432 "VBNET.ATG" +#line 2439 "VBNET.ATG" statement = new ContinueStatement(continueType); break; } @@ -5038,11 +5053,11 @@ out statement); lexer.NextToken(); if (StartOf(21)) { Expr( -#line 2434 "VBNET.ATG" +#line 2441 "VBNET.ATG" out expr); } -#line 2434 "VBNET.ATG" +#line 2441 "VBNET.ATG" statement = new ThrowStatement(expr); break; } @@ -5050,27 +5065,27 @@ out expr); lexer.NextToken(); if (StartOf(21)) { Expr( -#line 2436 "VBNET.ATG" +#line 2443 "VBNET.ATG" out expr); } -#line 2436 "VBNET.ATG" +#line 2443 "VBNET.ATG" statement = new ReturnStatement(expr); break; } case 168: { lexer.NextToken(); Expr( -#line 2438 "VBNET.ATG" +#line 2445 "VBNET.ATG" out expr); EndOfStmt(); Block( -#line 2438 "VBNET.ATG" +#line 2445 "VBNET.ATG" out embeddedStatement); Expect(88); Expect(168); -#line 2439 "VBNET.ATG" +#line 2446 "VBNET.ATG" statement = new LockStatement(expr, embeddedStatement); break; } @@ -5078,42 +5093,42 @@ out embeddedStatement); lexer.NextToken(); Identifier(); -#line 2441 "VBNET.ATG" +#line 2448 "VBNET.ATG" name = t.val; if (la.kind == 24) { lexer.NextToken(); if (StartOf(20)) { ArgumentList( -#line 2442 "VBNET.ATG" +#line 2449 "VBNET.ATG" out p); } Expect(25); } -#line 2443 "VBNET.ATG" +#line 2450 "VBNET.ATG" statement = new RaiseEventStatement(name, p); break; } case 182: { WithStatement( -#line 2445 "VBNET.ATG" +#line 2452 "VBNET.ATG" out statement); break; } case 42: { lexer.NextToken(); -#line 2447 "VBNET.ATG" +#line 2454 "VBNET.ATG" Expression handlerExpr = null; Expr( -#line 2448 "VBNET.ATG" +#line 2455 "VBNET.ATG" out expr); Expect(12); Expr( -#line 2448 "VBNET.ATG" +#line 2455 "VBNET.ATG" out handlerExpr); -#line 2450 "VBNET.ATG" +#line 2457 "VBNET.ATG" statement = new AddHandlerStatement(expr, handlerExpr); break; @@ -5121,17 +5136,17 @@ out handlerExpr); case 152: { lexer.NextToken(); -#line 2453 "VBNET.ATG" +#line 2460 "VBNET.ATG" Expression handlerExpr = null; Expr( -#line 2454 "VBNET.ATG" +#line 2461 "VBNET.ATG" out expr); Expect(12); Expr( -#line 2454 "VBNET.ATG" +#line 2461 "VBNET.ATG" out handlerExpr); -#line 2456 "VBNET.ATG" +#line 2463 "VBNET.ATG" statement = new RemoveHandlerStatement(expr, handlerExpr); break; @@ -5139,16 +5154,16 @@ out handlerExpr); case 181: { lexer.NextToken(); Expr( -#line 2459 "VBNET.ATG" +#line 2466 "VBNET.ATG" out expr); EndOfStmt(); Block( -#line 2460 "VBNET.ATG" +#line 2467 "VBNET.ATG" out embeddedStatement); Expect(88); Expect(181); -#line 2462 "VBNET.ATG" +#line 2469 "VBNET.ATG" statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start); break; @@ -5156,23 +5171,23 @@ out embeddedStatement); case 83: { lexer.NextToken(); -#line 2467 "VBNET.ATG" +#line 2474 "VBNET.ATG" ConditionType conditionType = ConditionType.None; if (la.kind == 177 || la.kind == 181) { WhileOrUntil( -#line 2470 "VBNET.ATG" +#line 2477 "VBNET.ATG" out conditionType); Expr( -#line 2470 "VBNET.ATG" +#line 2477 "VBNET.ATG" out expr); EndOfStmt(); Block( -#line 2471 "VBNET.ATG" +#line 2478 "VBNET.ATG" out embeddedStatement); Expect(118); -#line 2474 "VBNET.ATG" +#line 2481 "VBNET.ATG" statement = new DoLoopStatement(expr, embeddedStatement, conditionType == ConditionType.While ? ConditionType.DoWhile : conditionType, @@ -5181,19 +5196,19 @@ out embeddedStatement); } else if (la.kind == 1 || la.kind == 13) { EndOfStmt(); Block( -#line 2481 "VBNET.ATG" +#line 2488 "VBNET.ATG" out embeddedStatement); Expect(118); if (la.kind == 177 || la.kind == 181) { WhileOrUntil( -#line 2482 "VBNET.ATG" +#line 2489 "VBNET.ATG" out conditionType); Expr( -#line 2482 "VBNET.ATG" +#line 2489 "VBNET.ATG" out expr); } -#line 2484 "VBNET.ATG" +#line 2491 "VBNET.ATG" statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.End); } else SynErr(253); @@ -5202,7 +5217,7 @@ out expr); case 98: { lexer.NextToken(); -#line 2489 "VBNET.ATG" +#line 2496 "VBNET.ATG" Expression group = null; TypeReference typeReference; string typeName; @@ -5211,24 +5226,24 @@ out expr); if (la.kind == 85) { lexer.NextToken(); LoopControlVariable( -#line 2496 "VBNET.ATG" +#line 2503 "VBNET.ATG" out typeReference, out typeName); Expect(109); Expr( -#line 2497 "VBNET.ATG" +#line 2504 "VBNET.ATG" out group); EndOfStmt(); Block( -#line 2498 "VBNET.ATG" +#line 2505 "VBNET.ATG" out embeddedStatement); Expect(128); if (StartOf(21)) { Expr( -#line 2499 "VBNET.ATG" +#line 2506 "VBNET.ATG" out expr); } -#line 2501 "VBNET.ATG" +#line 2508 "VBNET.ATG" statement = new ForeachStatement(typeReference, typeName, group, @@ -5240,53 +5255,53 @@ out expr); } else if (StartOf(12)) { -#line 2512 "VBNET.ATG" +#line 2519 "VBNET.ATG" Expression start = null; Expression end = null; Expression step = null; Expression nextExpr = null;List nextExpressions = null; LoopControlVariable( -#line 2517 "VBNET.ATG" +#line 2524 "VBNET.ATG" out typeReference, out typeName); Expect(11); Expr( -#line 2518 "VBNET.ATG" +#line 2525 "VBNET.ATG" out start); Expect(172); Expr( -#line 2518 "VBNET.ATG" +#line 2525 "VBNET.ATG" out end); if (la.kind == 162) { lexer.NextToken(); Expr( -#line 2518 "VBNET.ATG" +#line 2525 "VBNET.ATG" out step); } EndOfStmt(); Block( -#line 2519 "VBNET.ATG" +#line 2526 "VBNET.ATG" out embeddedStatement); Expect(128); if (StartOf(21)) { Expr( -#line 2522 "VBNET.ATG" +#line 2529 "VBNET.ATG" out nextExpr); -#line 2522 "VBNET.ATG" +#line 2529 "VBNET.ATG" nextExpressions = new List(); nextExpressions.Add(nextExpr); while (la.kind == 12) { lexer.NextToken(); Expr( -#line 2523 "VBNET.ATG" +#line 2530 "VBNET.ATG" out nextExpr); -#line 2523 "VBNET.ATG" +#line 2530 "VBNET.ATG" nextExpressions.Add(nextExpr); } } -#line 2526 "VBNET.ATG" +#line 2533 "VBNET.ATG" statement = new ForNextStatement(typeReference, typeName, start, end, step, embeddedStatement, nextExpressions); } else SynErr(254); @@ -5295,29 +5310,29 @@ out nextExpr); case 92: { lexer.NextToken(); Expr( -#line 2530 "VBNET.ATG" +#line 2537 "VBNET.ATG" out expr); -#line 2530 "VBNET.ATG" +#line 2537 "VBNET.ATG" statement = new ErrorStatement(expr); break; } case 151: { lexer.NextToken(); -#line 2532 "VBNET.ATG" +#line 2539 "VBNET.ATG" bool isPreserve = false; if (la.kind == 144) { lexer.NextToken(); -#line 2532 "VBNET.ATG" +#line 2539 "VBNET.ATG" isPreserve = true; } Expr( -#line 2533 "VBNET.ATG" +#line 2540 "VBNET.ATG" out expr); -#line 2535 "VBNET.ATG" +#line 2542 "VBNET.ATG" ReDimStatement reDimStatement = new ReDimStatement(isPreserve); statement = reDimStatement; InvocationExpression redimClause = expr as InvocationExpression; @@ -5326,13 +5341,13 @@ out expr); while (la.kind == 12) { lexer.NextToken(); Expr( -#line 2540 "VBNET.ATG" +#line 2547 "VBNET.ATG" out expr); -#line 2541 "VBNET.ATG" +#line 2548 "VBNET.ATG" redimClause = expr as InvocationExpression; -#line 2542 "VBNET.ATG" +#line 2549 "VBNET.ATG" if (redimClause != null) { reDimStatement.ReDimClauses.Add(redimClause); } } break; @@ -5340,10 +5355,10 @@ out expr); case 91: { lexer.NextToken(); Expr( -#line 2546 "VBNET.ATG" +#line 2553 "VBNET.ATG" out expr); -#line 2547 "VBNET.ATG" +#line 2554 "VBNET.ATG" List arrays = new List(); if (expr != null) { arrays.Add(expr);} EraseStatement eraseStatement = new EraseStatement(arrays); @@ -5352,53 +5367,53 @@ out expr); while (la.kind == 12) { lexer.NextToken(); Expr( -#line 2552 "VBNET.ATG" +#line 2559 "VBNET.ATG" out expr); -#line 2552 "VBNET.ATG" +#line 2559 "VBNET.ATG" if (expr != null) { arrays.Add(expr); } } -#line 2553 "VBNET.ATG" +#line 2560 "VBNET.ATG" statement = eraseStatement; break; } case 163: { lexer.NextToken(); -#line 2555 "VBNET.ATG" +#line 2562 "VBNET.ATG" statement = new StopStatement(); break; } case 106: { lexer.NextToken(); Expr( -#line 2557 "VBNET.ATG" +#line 2564 "VBNET.ATG" out expr); if (la.kind == 170) { lexer.NextToken(); } if ( -#line 2559 "VBNET.ATG" +#line 2566 "VBNET.ATG" IsEndStmtAhead()) { Expect(88); -#line 2559 "VBNET.ATG" +#line 2566 "VBNET.ATG" statement = new IfElseStatement(expr, new EndStatement()); } else if (la.kind == 1 || la.kind == 13) { EndOfStmt(); Block( -#line 2562 "VBNET.ATG" +#line 2569 "VBNET.ATG" out embeddedStatement); -#line 2564 "VBNET.ATG" +#line 2571 "VBNET.ATG" IfElseStatement ifStatement = new IfElseStatement(expr, embeddedStatement); while (la.kind == 87 || -#line 2568 "VBNET.ATG" +#line 2575 "VBNET.ATG" IsElseIf()) { if ( -#line 2568 "VBNET.ATG" +#line 2575 "VBNET.ATG" IsElseIf()) { Expect(86); Expect(106); @@ -5406,20 +5421,20 @@ IsElseIf()) { lexer.NextToken(); } -#line 2571 "VBNET.ATG" +#line 2578 "VBNET.ATG" Expression condition = null; Statement block = null; Expr( -#line 2572 "VBNET.ATG" +#line 2579 "VBNET.ATG" out condition); if (la.kind == 170) { lexer.NextToken(); } EndOfStmt(); Block( -#line 2573 "VBNET.ATG" +#line 2580 "VBNET.ATG" out block); -#line 2575 "VBNET.ATG" +#line 2582 "VBNET.ATG" ifStatement.ElseIfSections.Add(new ElseIfSection(condition, block)); } @@ -5427,59 +5442,59 @@ out block); lexer.NextToken(); EndOfStmt(); Block( -#line 2580 "VBNET.ATG" +#line 2587 "VBNET.ATG" out embeddedStatement); -#line 2582 "VBNET.ATG" +#line 2589 "VBNET.ATG" ifStatement.FalseStatement.Add(embeddedStatement); } Expect(88); Expect(106); -#line 2586 "VBNET.ATG" +#line 2593 "VBNET.ATG" statement = ifStatement; } else if (StartOf(26)) { EmbeddedStatement( -#line 2589 "VBNET.ATG" +#line 2596 "VBNET.ATG" out embeddedStatement); -#line 2591 "VBNET.ATG" +#line 2598 "VBNET.ATG" IfElseStatement ifStatement = new IfElseStatement(expr, embeddedStatement); while (la.kind == 13) { lexer.NextToken(); EmbeddedStatement( -#line 2593 "VBNET.ATG" +#line 2600 "VBNET.ATG" out embeddedStatement); -#line 2593 "VBNET.ATG" +#line 2600 "VBNET.ATG" ifStatement.TrueStatement.Add(embeddedStatement); } if (la.kind == 86) { lexer.NextToken(); if (StartOf(26)) { EmbeddedStatement( -#line 2595 "VBNET.ATG" +#line 2602 "VBNET.ATG" out embeddedStatement); } -#line 2597 "VBNET.ATG" +#line 2604 "VBNET.ATG" ifStatement.FalseStatement.Add(embeddedStatement); while (la.kind == 13) { lexer.NextToken(); EmbeddedStatement( -#line 2600 "VBNET.ATG" +#line 2607 "VBNET.ATG" out embeddedStatement); -#line 2601 "VBNET.ATG" +#line 2608 "VBNET.ATG" ifStatement.FalseStatement.Add(embeddedStatement); } } -#line 2604 "VBNET.ATG" +#line 2611 "VBNET.ATG" statement = ifStatement; } else SynErr(255); break; @@ -5490,43 +5505,43 @@ out embeddedStatement); lexer.NextToken(); } Expr( -#line 2607 "VBNET.ATG" +#line 2614 "VBNET.ATG" out expr); EndOfStmt(); -#line 2608 "VBNET.ATG" +#line 2615 "VBNET.ATG" List selectSections = new List(); Statement block = null; while (la.kind == 57) { -#line 2612 "VBNET.ATG" +#line 2619 "VBNET.ATG" List caseClauses = null; lexer.NextToken(); CaseClauses( -#line 2613 "VBNET.ATG" +#line 2620 "VBNET.ATG" out caseClauses); if ( -#line 2613 "VBNET.ATG" +#line 2620 "VBNET.ATG" IsNotStatementSeparator()) { lexer.NextToken(); } EndOfStmt(); -#line 2615 "VBNET.ATG" +#line 2622 "VBNET.ATG" SwitchSection selectSection = new SwitchSection(caseClauses); Block( -#line 2617 "VBNET.ATG" +#line 2624 "VBNET.ATG" out block); -#line 2619 "VBNET.ATG" +#line 2626 "VBNET.ATG" selectSection.Children = block.Children; selectSections.Add(selectSection); } -#line 2623 "VBNET.ATG" +#line 2630 "VBNET.ATG" statement = new SwitchStatement(expr, selectSections); Expect(88); Expect(155); @@ -5534,43 +5549,43 @@ out block); } case 135: { -#line 2625 "VBNET.ATG" +#line 2632 "VBNET.ATG" OnErrorStatement onErrorStatement = null; OnErrorStatement( -#line 2626 "VBNET.ATG" +#line 2633 "VBNET.ATG" out onErrorStatement); -#line 2626 "VBNET.ATG" +#line 2633 "VBNET.ATG" statement = onErrorStatement; break; } case 104: { -#line 2627 "VBNET.ATG" +#line 2634 "VBNET.ATG" GotoStatement goToStatement = null; GotoStatement( -#line 2628 "VBNET.ATG" +#line 2635 "VBNET.ATG" out goToStatement); -#line 2628 "VBNET.ATG" +#line 2635 "VBNET.ATG" statement = goToStatement; break; } case 153: { -#line 2629 "VBNET.ATG" +#line 2636 "VBNET.ATG" ResumeStatement resumeStatement = null; ResumeStatement( -#line 2630 "VBNET.ATG" +#line 2637 "VBNET.ATG" out resumeStatement); -#line 2630 "VBNET.ATG" +#line 2637 "VBNET.ATG" statement = resumeStatement; break; } case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 24: case 43: case 47: case 49: case 50: case 51: case 52: case 54: case 59: case 60: case 61: case 62: case 63: case 64: case 65: case 66: case 68: case 69: case 70: case 72: case 73: case 74: case 75: case 76: case 77: case 82: case 84: case 96: case 102: case 111: case 117: case 119: case 124: case 125: case 127: case 130: case 144: case 159: case 160: case 165: case 169: case 173: case 175: case 176: case 177: case 190: case 191: case 192: case 193: case 194: case 195: case 196: case 197: case 198: case 199: { -#line 2633 "VBNET.ATG" +#line 2640 "VBNET.ATG" Expression val = null; AssignmentOperatorType op; @@ -5578,25 +5593,25 @@ out resumeStatement); la.kind == Tokens.Not || la.kind == Tokens.Times; SimpleExpr( -#line 2639 "VBNET.ATG" +#line 2646 "VBNET.ATG" out expr); if (StartOf(28)) { AssignmentOperator( -#line 2641 "VBNET.ATG" +#line 2648 "VBNET.ATG" out op); Expr( -#line 2641 "VBNET.ATG" +#line 2648 "VBNET.ATG" out val); -#line 2641 "VBNET.ATG" +#line 2648 "VBNET.ATG" expr = new AssignmentExpression(expr, op, val); } else if (la.kind == 1 || la.kind == 13 || la.kind == 86) { -#line 2642 "VBNET.ATG" +#line 2649 "VBNET.ATG" if (mustBeAssignment) Error("error in assignment."); } else SynErr(256); -#line 2645 "VBNET.ATG" +#line 2652 "VBNET.ATG" // a field reference expression that stands alone is a // invocation expression without parantheses and arguments if(expr is FieldReferenceExpression || expr is IdentifierExpression) { @@ -5609,10 +5624,10 @@ out val); case 56: { lexer.NextToken(); SimpleExpr( -#line 2652 "VBNET.ATG" +#line 2659 "VBNET.ATG" out expr); -#line 2652 "VBNET.ATG" +#line 2659 "VBNET.ATG" statement = new StatementExpression(expr); break; } @@ -5620,7 +5635,7 @@ out expr); lexer.NextToken(); Identifier(); -#line 2654 "VBNET.ATG" +#line 2661 "VBNET.ATG" string resourcename = t.val, typeName; Statement resourceAquisition = null, block = null; @@ -5628,45 +5643,45 @@ out expr); if (la.kind == 127) { lexer.NextToken(); Qualident( -#line 2657 "VBNET.ATG" +#line 2664 "VBNET.ATG" out typeName); -#line 2658 "VBNET.ATG" +#line 2665 "VBNET.ATG" List initializer = null; if (la.kind == 24) { lexer.NextToken(); if (StartOf(20)) { ArgumentList( -#line 2659 "VBNET.ATG" +#line 2666 "VBNET.ATG" out initializer); } Expect(25); } -#line 2661 "VBNET.ATG" +#line 2668 "VBNET.ATG" resourceAquisition = new LocalVariableDeclaration(new VariableDeclaration(resourcename, new ArrayInitializerExpression(initializer), new TypeReference(typeName))); } else if (StartOf(12)) { Qualident( -#line 2664 "VBNET.ATG" +#line 2671 "VBNET.ATG" out typeName); Expect(11); Expr( -#line 2664 "VBNET.ATG" +#line 2671 "VBNET.ATG" out expr); -#line 2666 "VBNET.ATG" +#line 2673 "VBNET.ATG" resourceAquisition = new LocalVariableDeclaration(new VariableDeclaration(resourcename, expr, new TypeReference(typeName))); } else SynErr(257); Block( -#line 2669 "VBNET.ATG" +#line 2676 "VBNET.ATG" out block); Expect(88); Expect(188); -#line 2671 "VBNET.ATG" +#line 2678 "VBNET.ATG" statement = new UsingStatement(resourceAquisition, block); break; } @@ -5675,10 +5690,10 @@ out block); } void LocalDeclarationStatement( -#line 2373 "VBNET.ATG" +#line 2380 "VBNET.ATG" out Statement statement) { -#line 2375 "VBNET.ATG" +#line 2382 "VBNET.ATG" Modifiers m = new Modifiers(); LocalVariableDeclaration localVariableDeclaration; bool dimfound = false; @@ -5687,22 +5702,22 @@ out Statement statement) { if (la.kind == 71) { lexer.NextToken(); -#line 2381 "VBNET.ATG" +#line 2388 "VBNET.ATG" m.Add(Modifier.Const, t.Location); } else if (la.kind == 161) { lexer.NextToken(); -#line 2382 "VBNET.ATG" +#line 2389 "VBNET.ATG" m.Add(Modifier.Static, t.Location); } else { lexer.NextToken(); -#line 2383 "VBNET.ATG" +#line 2390 "VBNET.ATG" dimfound = true; } } -#line 2386 "VBNET.ATG" +#line 2393 "VBNET.ATG" if(dimfound && (m.Modifier & Modifier.Const) != 0) { Error("Dim is not allowed on constants."); } @@ -5715,137 +5730,137 @@ out Statement statement) { localVariableDeclaration.StartLocation = t.Location; VariableDeclarator( -#line 2397 "VBNET.ATG" +#line 2404 "VBNET.ATG" localVariableDeclaration.Variables); while (la.kind == 12) { lexer.NextToken(); VariableDeclarator( -#line 2398 "VBNET.ATG" +#line 2405 "VBNET.ATG" localVariableDeclaration.Variables); } -#line 2400 "VBNET.ATG" +#line 2407 "VBNET.ATG" statement = localVariableDeclaration; } void TryStatement( -#line 2864 "VBNET.ATG" +#line 2871 "VBNET.ATG" out Statement tryStatement) { -#line 2866 "VBNET.ATG" +#line 2873 "VBNET.ATG" Statement blockStmt = null, finallyStmt = null;List catchClauses = null; Expect(174); EndOfStmt(); Block( -#line 2869 "VBNET.ATG" +#line 2876 "VBNET.ATG" out blockStmt); if (la.kind == 58 || la.kind == 88 || la.kind == 97) { CatchClauses( -#line 2870 "VBNET.ATG" +#line 2877 "VBNET.ATG" out catchClauses); } if (la.kind == 97) { lexer.NextToken(); EndOfStmt(); Block( -#line 2871 "VBNET.ATG" +#line 2878 "VBNET.ATG" out finallyStmt); } Expect(88); Expect(174); -#line 2874 "VBNET.ATG" +#line 2881 "VBNET.ATG" tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt); } void WithStatement( -#line 2842 "VBNET.ATG" +#line 2849 "VBNET.ATG" out Statement withStatement) { -#line 2844 "VBNET.ATG" +#line 2851 "VBNET.ATG" Statement blockStmt = null; Expression expr = null; Expect(182); -#line 2847 "VBNET.ATG" +#line 2854 "VBNET.ATG" Point start = t.Location; Expr( -#line 2848 "VBNET.ATG" +#line 2855 "VBNET.ATG" out expr); EndOfStmt(); -#line 2850 "VBNET.ATG" +#line 2857 "VBNET.ATG" withStatement = new WithStatement(expr); withStatement.StartLocation = start; withStatements.Push(withStatement); Block( -#line 2854 "VBNET.ATG" +#line 2861 "VBNET.ATG" out blockStmt); -#line 2856 "VBNET.ATG" +#line 2863 "VBNET.ATG" ((WithStatement)withStatement).Body = (BlockStatement)blockStmt; withStatements.Pop(); Expect(88); Expect(182); -#line 2860 "VBNET.ATG" +#line 2867 "VBNET.ATG" withStatement.EndLocation = t.Location; } void WhileOrUntil( -#line 2835 "VBNET.ATG" +#line 2842 "VBNET.ATG" out ConditionType conditionType) { -#line 2836 "VBNET.ATG" +#line 2843 "VBNET.ATG" conditionType = ConditionType.None; if (la.kind == 181) { lexer.NextToken(); -#line 2837 "VBNET.ATG" +#line 2844 "VBNET.ATG" conditionType = ConditionType.While; } else if (la.kind == 177) { lexer.NextToken(); -#line 2838 "VBNET.ATG" +#line 2845 "VBNET.ATG" conditionType = ConditionType.Until; } else SynErr(259); } void LoopControlVariable( -#line 2676 "VBNET.ATG" +#line 2683 "VBNET.ATG" out TypeReference type, out string name) { -#line 2677 "VBNET.ATG" +#line 2684 "VBNET.ATG" ArrayList arrayModifiers = null; type = null; Qualident( -#line 2681 "VBNET.ATG" +#line 2688 "VBNET.ATG" out name); if ( -#line 2682 "VBNET.ATG" +#line 2689 "VBNET.ATG" IsDims()) { ArrayTypeModifiers( -#line 2682 "VBNET.ATG" +#line 2689 "VBNET.ATG" out arrayModifiers); } if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 2683 "VBNET.ATG" +#line 2690 "VBNET.ATG" out type); -#line 2683 "VBNET.ATG" +#line 2690 "VBNET.ATG" if (name.IndexOf('.') > 0) { Error("No type def for 'for each' member indexer allowed."); } } -#line 2685 "VBNET.ATG" +#line 2692 "VBNET.ATG" if (type != null) { if(type.RankSpecifier != null && arrayModifiers != null) { Error("array rank only allowed one time"); @@ -5863,48 +5878,48 @@ out type); } void CaseClauses( -#line 2795 "VBNET.ATG" +#line 2802 "VBNET.ATG" out List caseClauses) { -#line 2797 "VBNET.ATG" +#line 2804 "VBNET.ATG" caseClauses = new List(); CaseLabel caseClause = null; CaseClause( -#line 2800 "VBNET.ATG" +#line 2807 "VBNET.ATG" out caseClause); -#line 2800 "VBNET.ATG" +#line 2807 "VBNET.ATG" if (caseClause != null) { caseClauses.Add(caseClause); } while (la.kind == 12) { lexer.NextToken(); CaseClause( -#line 2801 "VBNET.ATG" +#line 2808 "VBNET.ATG" out caseClause); -#line 2801 "VBNET.ATG" +#line 2808 "VBNET.ATG" if (caseClause != null) { caseClauses.Add(caseClause); } } } void OnErrorStatement( -#line 2702 "VBNET.ATG" +#line 2709 "VBNET.ATG" out OnErrorStatement stmt) { -#line 2704 "VBNET.ATG" +#line 2711 "VBNET.ATG" stmt = null; GotoStatement goToStatement = null; Expect(135); Expect(92); if ( -#line 2710 "VBNET.ATG" +#line 2717 "VBNET.ATG" IsNegativeLabelName()) { Expect(104); Expect(15); Expect(5); -#line 2712 "VBNET.ATG" +#line 2719 "VBNET.ATG" long intLabel = Int64.Parse(t.val); if(intLabel != 1) { Error("invalid label in on error statement."); @@ -5913,10 +5928,10 @@ IsNegativeLabelName()) { } else if (la.kind == 104) { GotoStatement( -#line 2718 "VBNET.ATG" +#line 2725 "VBNET.ATG" out goToStatement); -#line 2720 "VBNET.ATG" +#line 2727 "VBNET.ATG" string val = goToStatement.Label; // if value is numeric, make sure that is 0 @@ -5933,63 +5948,63 @@ out goToStatement); lexer.NextToken(); Expect(128); -#line 2734 "VBNET.ATG" +#line 2741 "VBNET.ATG" stmt = new OnErrorStatement(new ResumeStatement(true)); } else SynErr(260); } void GotoStatement( -#line 2740 "VBNET.ATG" +#line 2747 "VBNET.ATG" out ICSharpCode.NRefactory.Parser.AST.GotoStatement goToStatement) { -#line 2742 "VBNET.ATG" +#line 2749 "VBNET.ATG" string label = String.Empty; Expect(104); LabelName( -#line 2745 "VBNET.ATG" +#line 2752 "VBNET.ATG" out label); -#line 2747 "VBNET.ATG" +#line 2754 "VBNET.ATG" goToStatement = new ICSharpCode.NRefactory.Parser.AST.GotoStatement(label); } void ResumeStatement( -#line 2784 "VBNET.ATG" +#line 2791 "VBNET.ATG" out ResumeStatement resumeStatement) { -#line 2786 "VBNET.ATG" +#line 2793 "VBNET.ATG" resumeStatement = null; string label = String.Empty; if ( -#line 2789 "VBNET.ATG" +#line 2796 "VBNET.ATG" IsResumeNext()) { Expect(153); Expect(128); -#line 2790 "VBNET.ATG" +#line 2797 "VBNET.ATG" resumeStatement = new ResumeStatement(true); } else if (la.kind == 153) { lexer.NextToken(); if (StartOf(29)) { LabelName( -#line 2791 "VBNET.ATG" +#line 2798 "VBNET.ATG" out label); } -#line 2791 "VBNET.ATG" +#line 2798 "VBNET.ATG" resumeStatement = new ResumeStatement(label); } else SynErr(261); } void CaseClause( -#line 2805 "VBNET.ATG" +#line 2812 "VBNET.ATG" out CaseLabel caseClause) { -#line 2807 "VBNET.ATG" +#line 2814 "VBNET.ATG" Expression expr = null; Expression sexpr = null; BinaryOperatorType op = BinaryOperatorType.None; @@ -5998,7 +6013,7 @@ out CaseLabel caseClause) { if (la.kind == 86) { lexer.NextToken(); -#line 2813 "VBNET.ATG" +#line 2820 "VBNET.ATG" caseClause = new CaseLabel(); } else if (StartOf(30)) { if (la.kind == 113) { @@ -6008,76 +6023,76 @@ out CaseLabel caseClause) { case 27: { lexer.NextToken(); -#line 2817 "VBNET.ATG" +#line 2824 "VBNET.ATG" op = BinaryOperatorType.LessThan; break; } case 26: { lexer.NextToken(); -#line 2818 "VBNET.ATG" +#line 2825 "VBNET.ATG" op = BinaryOperatorType.GreaterThan; break; } case 30: { lexer.NextToken(); -#line 2819 "VBNET.ATG" +#line 2826 "VBNET.ATG" op = BinaryOperatorType.LessThanOrEqual; break; } case 29: { lexer.NextToken(); -#line 2820 "VBNET.ATG" +#line 2827 "VBNET.ATG" op = BinaryOperatorType.GreaterThanOrEqual; break; } case 11: { lexer.NextToken(); -#line 2821 "VBNET.ATG" +#line 2828 "VBNET.ATG" op = BinaryOperatorType.Equality; break; } case 28: { lexer.NextToken(); -#line 2822 "VBNET.ATG" +#line 2829 "VBNET.ATG" op = BinaryOperatorType.InEquality; break; } default: SynErr(262); break; } Expr( -#line 2824 "VBNET.ATG" +#line 2831 "VBNET.ATG" out expr); -#line 2826 "VBNET.ATG" +#line 2833 "VBNET.ATG" caseClause = new CaseLabel(op, expr); } else if (StartOf(21)) { Expr( -#line 2828 "VBNET.ATG" +#line 2835 "VBNET.ATG" out expr); if (la.kind == 172) { lexer.NextToken(); Expr( -#line 2828 "VBNET.ATG" +#line 2835 "VBNET.ATG" out sexpr); } -#line 2830 "VBNET.ATG" +#line 2837 "VBNET.ATG" caseClause = new CaseLabel(expr, sexpr); } else SynErr(263); } void CatchClauses( -#line 2879 "VBNET.ATG" +#line 2886 "VBNET.ATG" out List catchClauses) { -#line 2881 "VBNET.ATG" +#line 2888 "VBNET.ATG" catchClauses = new List(); TypeReference type = null; Statement blockStmt = null; @@ -6089,27 +6104,27 @@ out List catchClauses) { if (StartOf(12)) { Identifier(); -#line 2889 "VBNET.ATG" +#line 2896 "VBNET.ATG" name = t.val; if (la.kind == 48) { lexer.NextToken(); TypeName( -#line 2889 "VBNET.ATG" +#line 2896 "VBNET.ATG" out type); } } if (la.kind == 180) { lexer.NextToken(); Expr( -#line 2890 "VBNET.ATG" +#line 2897 "VBNET.ATG" out expr); } EndOfStmt(); Block( -#line 2892 "VBNET.ATG" +#line 2899 "VBNET.ATG" out blockStmt); -#line 2893 "VBNET.ATG" +#line 2900 "VBNET.ATG" catchClauses.Add(new CatchClause(type, name, blockStmt, expr)); } } diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG index 9eae7cb3b5..91214f8714 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG @@ -534,9 +534,9 @@ ImportsStmt Point startPos = t.Location; Using u; .) - ImportClause (. usings.Add(u); .) + ImportClause (. if (u != null) { usings.Add(u); } .) { - "," ImportClause (. usings.Add(u); .) + "," ImportClause (. if (u != null) { usings.Add(u); } .) } EndOfStmt (. @@ -662,6 +662,7 @@ NonModuleDeclaration attributes> Identifier (. newType.Name = t.val; .) TypeParameterList EndOfStmt + (. newType.BodyStartLocation = t.Location; .) [ ClassBaseType (. newType.BaseTypes.Add(typeRef); .) ] { TypeImplementsClause (. newType.BaseTypes.AddRange(baseInterfaces); .) } ClassBody @@ -679,6 +680,7 @@ NonModuleDeclaration attributes> .) Identifier (. newType.Name = t.val; .) EOL + (. newType.BodyStartLocation = t.Location; .) ModuleBody (. compilationUnit.BlockEnd(); @@ -694,7 +696,9 @@ NonModuleDeclaration attributes> .) Identifier (. newType.Name = t.val; .) TypeParameterList - EOL { TypeImplementsClause (. newType.BaseTypes.AddRange(baseInterfaces);.) } + EOL + (. newType.BodyStartLocation = t.Location; .) + { TypeImplementsClause (. newType.BaseTypes.AddRange(baseInterfaces);.) } StructureBody (. compilationUnit.BlockEnd(); @@ -713,6 +717,7 @@ NonModuleDeclaration attributes> Identifier (. newType.Name = t.val; .) [ "As" NonArrayTypeName (. newType.BaseTypes.Add(typeRef); .) ] EOL + (. newType.BodyStartLocation = t.Location; .) EnumBody (. compilationUnit.BlockEnd(); @@ -729,7 +734,9 @@ NonModuleDeclaration attributes> .) Identifier (. newType.Name = t.val; .) TypeParameterList - EndOfStmt { InterfaceBase (. newType.BaseTypes.AddRange(baseInterfaces); .) } + EndOfStmt + (. newType.BodyStartLocation = t.Location; .) + { InterfaceBase (. newType.BaseTypes.AddRange(baseInterfaces); .) } InterfaceBody (. compilationUnit.BlockEnd(); diff --git a/src/Libraries/NRefactory/Project/Src/Parser/gen.bat b/src/Libraries/NRefactory/Project/Src/Parser/gen.bat index f1069be016..b6d6e0caa3 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/gen.bat +++ b/src/Libraries/NRefactory/Project/Src/Parser/gen.bat @@ -35,3 +35,5 @@ del VBNET.ATG :exit pause cd .. +cd ..\..\.. +%windir%\microsoft.net\framework\v2.0.50727\msbuild diff --git a/src/Libraries/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs b/src/Libraries/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs index 2332109562..df06e9bb80 100644 --- a/src/Libraries/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs +++ b/src/Libraries/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs @@ -32,7 +32,19 @@ namespace ICSharpCode.NRefactory.Tests.AST } [Test] - public void CSharpSimplePartitialClassTypeDeclarationTest() + public void CSharpSimpleClassRegionTest() + { + const string program = "class MyClass\n{\n}\n"; + TypeDeclaration td = ParseUtilCSharp.ParseGlobal(program); + Assert.AreEqual(1, td.StartLocation.Y, "StartLocation.Y"); + Assert.AreEqual(1, td.StartLocation.X, "StartLocation.X"); + Assert.AreEqual(1, td.BodyStartLocation.Y, "BodyStartLocation.Y"); + Assert.AreEqual(14, td.BodyStartLocation.X, "BodyStartLocation.X"); + Assert.AreEqual(3, td.EndLocation.Y, "EndLocation.Y"); + } + + [Test] + public void CSharpSimplePartialClassTypeDeclarationTest() { TypeDeclaration td = ParseUtilCSharp.ParseGlobal("partial class MyClass { }"); Assert.IsNotNull(td); @@ -184,6 +196,8 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2 Assert.AreEqual("TestClass", td.Name); Assert.AreEqual(ClassType.Class, td.Type); Assert.AreEqual(1, td.StartLocation.Y, "start line"); + Assert.AreEqual(1, td.BodyStartLocation.Y, "bodystart line"); + Assert.AreEqual(16, td.BodyStartLocation.X, "bodystart col"); Assert.AreEqual(2, td.EndLocation.Y, "end line"); } diff --git a/src/Libraries/NRefactory/Test/Parser/GlobalScope/UsingDeclarationTests.cs b/src/Libraries/NRefactory/Test/Parser/GlobalScope/UsingDeclarationTests.cs index b2d1a4c33f..37611bedde 100644 --- a/src/Libraries/NRefactory/Test/Parser/GlobalScope/UsingDeclarationTests.cs +++ b/src/Libraries/NRefactory/Test/Parser/GlobalScope/UsingDeclarationTests.cs @@ -107,7 +107,25 @@ namespace ICSharpCode.NRefactory.Tests.AST IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(program)); parser.Parse(); Assert.IsTrue(parser.Errors.count > 0); + UsingDeclaration u = (UsingDeclaration)parser.CompilationUnit.Children[0]; + foreach (Using us in u.Usings) { + Assert.IsNotNull(us); + } } + + [Test] + public void VBNetWrongUsing2Test() + { + string program = "Imports ,\n"; + IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(program)); + parser.Parse(); + Assert.IsTrue(parser.Errors.count > 0); + UsingDeclaration u = (UsingDeclaration)parser.CompilationUnit.Children[0]; + foreach (Using us in u.Usings) { + Assert.IsNotNull(us); + } + } + [Test] public void VBNetDeclarationTest() { diff --git a/src/Main/Base/Project/Configuration/AssemblyInfo.cs b/src/Main/Base/Project/Configuration/AssemblyInfo.cs index cdf47c571b..8d4e7f3a42 100644 --- a/src/Main/Base/Project/Configuration/AssemblyInfo.cs +++ b/src/Main/Base/Project/Configuration/AssemblyInfo.cs @@ -13,6 +13,15 @@ using System.Runtime.CompilerServices; [assembly: CLSCompliant(false)] [assembly: StringFreezing()] +// Use hard-binding for ICSharpCode.SharpDevelop: +[assembly: Dependency("ICSharpCode.Core", LoadHint.Always)] +[assembly: Dependency("ICSharpCode.TextEditor", LoadHint.Always)] +[assembly: Dependency("ICSharpCode.NRefactory", LoadHint.Always)] +[assembly: Dependency("System.Drawing", LoadHint.Always)] +[assembly: Dependency("System.Xml", LoadHint.Always)] +[assembly: Dependency("System.Windows.Forms", LoadHint.Always)] +[assembly: Dependency("WeifenLuo.WinFormsUI.Docking", LoadHint.Always)] + [assembly: AssemblyTitle("SharpDevelopBase")] [assembly: AssemblyDescription("The base add-in of SharpDevelop")] [assembly: AssemblyConfiguration("")] diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj index 6e68872f26..24c3f36d7d 100644 --- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj +++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj @@ -16,7 +16,7 @@ False False Auto - 84410368 + 84934656 AnyCPU 4096 false @@ -765,6 +765,7 @@ + @@ -793,4 +794,4 @@ - + \ No newline at end of file diff --git a/src/Main/Base/Project/Src/Commands/BuildCommands.cs b/src/Main/Base/Project/Src/Commands/BuildCommands.cs index 2c29c8f57f..e8a68875cb 100644 --- a/src/Main/Base/Project/Src/Commands/BuildCommands.cs +++ b/src/Main/Base/Project/Src/Commands/BuildCommands.cs @@ -37,6 +37,15 @@ namespace ICSharpCode.SharpDevelop.Project.Commands public override void Run() { if (CanRunBuild) { + if (DebuggerService.IsDebuggerLoaded && DebuggerService.CurrentDebugger.IsDebugging) { + if (MessageService.AskQuestion("${res:XML.MainMenu.RunMenu.Compile.StopDebuggingQuestion}", + "${res:XML.MainMenu.RunMenu.Compile.StopDebuggingTitle}")) + { + DebuggerService.CurrentDebugger.Stop(); + } else { + return; + } + } BeforeBuild(); StartBuild(); } else { diff --git a/src/Main/Base/Project/Src/Commands/FileCommands.cs b/src/Main/Base/Project/Src/Commands/FileCommands.cs index 2e63898ee8..002448379f 100644 --- a/src/Main/Base/Project/Src/Commands/FileCommands.cs +++ b/src/Main/Base/Project/Src/Commands/FileCommands.cs @@ -25,6 +25,17 @@ namespace ICSharpCode.SharpDevelop.Commands { public override void Run() { + if (ProjectService.CurrentProject != null) { + if (MessageService.ShowCustomDialog("${res:Dialog.NewFile.AddToProjectQuestionTitle}", + "${res:Dialog.NewFile.AddToProjectQuestion}", + "${res:Dialog.NewFile.AddToProjectQuestionProject}", + "${res:Dialog.NewFile.AddToProjectQuestionStandalone}") + == 0) + { + new Project.Commands.AddNewItemsToProject().Run(); + return; + } + } using (NewFileDialog nfd = new NewFileDialog(null)) { nfd.Owner = (Form)WorkbenchSingleton.Workbench; nfd.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm); @@ -164,7 +175,7 @@ namespace ICSharpCode.SharpDevelop.Commands fdiag.AddExtension = true; fdiag.Filter = String.Join("|", (string[])(AddInTree.GetTreeNode("/SharpDevelop/Workbench/FileFilter").BuildChildItems(null)).ToArray(typeof(string))); - + if (fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { string fileName = fdiag.FileName; // currently useless, because the fdiag.FileName can't @@ -247,7 +258,7 @@ namespace ICSharpCode.SharpDevelop.Commands public class ExitWorkbenchCommand : AbstractMenuCommand { public override void Run() - { + { ((Form)WorkbenchSingleton.Workbench).Close(); } } @@ -312,7 +323,7 @@ namespace ICSharpCode.SharpDevelop.Commands public class ClearRecentFiles : AbstractMenuCommand { public override void Run() - { + { try { FileService.RecentOpen.ClearRecentFiles(); @@ -323,7 +334,7 @@ namespace ICSharpCode.SharpDevelop.Commands public class ClearRecentProjects : AbstractMenuCommand { public override void Run() - { + { try { FileService.RecentOpen.ClearRecentProjects(); diff --git a/src/Main/Base/Project/Src/Dom/IClass.cs b/src/Main/Base/Project/Src/Dom/IClass.cs index 1a60f3c83b..a3f08a4679 100644 --- a/src/Main/Base/Project/Src/Dom/IClass.cs +++ b/src/Main/Base/Project/Src/Dom/IClass.cs @@ -55,10 +55,17 @@ namespace ICSharpCode.SharpDevelop.Dom get; } + /// + /// Region of the whole class including the body. + /// DomRegion Region { get; } + DomRegion BodyRegion { + get; + } + List BaseTypes { get; } diff --git a/src/Main/Base/Project/Src/Dom/IMember.cs b/src/Main/Base/Project/Src/Dom/IMember.cs index e6bbe1f85f..69cb73acc8 100644 --- a/src/Main/Base/Project/Src/Dom/IMember.cs +++ b/src/Main/Base/Project/Src/Dom/IMember.cs @@ -16,6 +16,9 @@ namespace ICSharpCode.SharpDevelop.Dom get; } + /// + /// Declaration region of the member (without body!) + /// DomRegion Region { get; } diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs index 12afb67c04..26a17aafe3 100644 --- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs +++ b/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs @@ -166,7 +166,7 @@ namespace ICSharpCode.SharpDevelop.Dom } public bool IsOverridable { get { - return (IsOverride || IsVirtual) && !IsSealed; + return (IsOverride || IsVirtual || IsAbstract) && !IsSealed; } } public bool IsNew { diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs b/src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs index 4a4b369e62..7e33697378 100644 --- a/src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs +++ b/src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Text; using ICSharpCode.Core; namespace ICSharpCode.SharpDevelop.Dom @@ -16,15 +17,81 @@ namespace ICSharpCode.SharpDevelop.Dom /// public sealed class AnonymousMethodReturnType : ProxyReturnType { + IReturnType returnType; + List parameters = new List(); + ICompilationUnit cu; + + public AnonymousMethodReturnType(ICompilationUnit cu) + { + this.cu = cu; + } + + /// + /// Return type of the anonymous method. Can be null if inferred from context. + /// + public IReturnType MethodReturnType { + get { + return returnType; + } + set { + returnType = value; + } + } + + /// + /// Gets the list of method parameters. + /// + public IList MethodParameters { + get { + return parameters; + } + } + public override bool IsDefaultReturnType { get { return false; } } + volatile DefaultClass cachedClass; + + public override IClass GetUnderlyingClass() + { + if (cachedClass != null) return cachedClass; + DefaultClass c = new DefaultClass(cu, ClassType.Delegate, ModifierEnum.None, DomRegion.Empty, null); + c.BaseTypes.Add(ReflectionReturnType.CreatePrimitive(typeof(Delegate))); + AddDefaultDelegateMethod(c, returnType ?? ReflectionReturnType.Object, parameters); + cachedClass = c; + return c; + } + + internal static void AddDefaultDelegateMethod(DefaultClass c, IReturnType returnType, IList parameters) + { + DefaultMethod invokeMethod = new DefaultMethod("Invoke", returnType, ModifierEnum.Public, c.Region, DomRegion.Empty, c); + foreach (IParameter par in parameters) { + invokeMethod.Parameters.Add(par); + } + c.Methods.Add(invokeMethod); + invokeMethod = new DefaultMethod("BeginInvoke", CreateReturnType(typeof(IAsyncResult)), ModifierEnum.Public, c.Region, DomRegion.Empty, c); + foreach (IParameter par in parameters) { + invokeMethod.Parameters.Add(par); + } + invokeMethod.Parameters.Add(new DefaultParameter("callback", CreateReturnType(typeof(AsyncCallback)), DomRegion.Empty)); + invokeMethod.Parameters.Add(new DefaultParameter("object", ReflectionReturnType.Object, DomRegion.Empty)); + c.Methods.Add(invokeMethod); + invokeMethod = new DefaultMethod("EndInvoke", returnType, ModifierEnum.Public, c.Region, DomRegion.Empty, c); + invokeMethod.Parameters.Add(new DefaultParameter("result", CreateReturnType(typeof(IAsyncResult)), DomRegion.Empty)); + c.Methods.Add(invokeMethod); + } + + static IReturnType CreateReturnType(Type type) + { + return ReflectionReturnType.Create(ProjectContentRegistry.Mscorlib, null, type, false); + } + public override IReturnType BaseType { get { - return ReflectionReturnType.Delegate; + return GetUnderlyingClass().DefaultReturnType; } } @@ -36,7 +103,22 @@ namespace ICSharpCode.SharpDevelop.Dom public override string FullyQualifiedName { get { - return Name; + StringBuilder b = new StringBuilder("delegate("); + bool first = true; + foreach (IParameter p in parameters) { + if (first) first = false; else b.Append(", "); + b.Append(p.Name); + if (p.ReturnType != null) { + b.Append(":"); + b.Append(p.ReturnType.Name); + } + } + b.Append(")"); + if (returnType != null) { + b.Append(":"); + b.Append(returnType.Name); + } + return b.ToString(); } } diff --git a/src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs b/src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs index 6c8d4ff2e9..38b9d245fd 100644 --- a/src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs +++ b/src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs @@ -20,6 +20,7 @@ namespace ICSharpCode.SharpDevelop.Dom { ClassType classType; DomRegion region; + DomRegion bodyRegion; ICompilationUnit compilationUnit; @@ -172,6 +173,15 @@ namespace ICSharpCode.SharpDevelop.Dom } } + public DomRegion BodyRegion { + get { + return bodyRegion; + } + set { + bodyRegion = value; + } + } + public override string DotNetName { get { if (typeParameters == null || typeParameters.Count == 0) { @@ -326,14 +336,24 @@ namespace ICSharpCode.SharpDevelop.Dom return BaseTypes[index]; } + IReturnType cachedBaseType; + public IReturnType BaseType { get { - foreach (IReturnType baseType in this.BaseTypes) { - IClass baseClass = baseType.GetUnderlyingClass(); - if (baseClass != null && baseClass.ClassType == this.ClassType) - return baseType; + if (cachedBaseType == null) { + foreach (IReturnType baseType in this.BaseTypes) { + IClass baseClass = baseType.GetUnderlyingClass(); + if (baseClass != null && baseClass.ClassType == this.ClassType) { + cachedBaseType = baseType; + break; + } + } + } + if (cachedBaseType == null) { + return GetBaseTypeByClassType(); + } else { + return cachedBaseType; } - return GetBaseTypeByClassType(); } } diff --git a/src/Main/Base/Project/Src/Dom/Implementations/DefaultReturnType.cs b/src/Main/Base/Project/Src/Dom/Implementations/DefaultReturnType.cs index f78dfd5fd9..ea33b9d93b 100644 --- a/src/Main/Base/Project/Src/Dom/Implementations/DefaultReturnType.cs +++ b/src/Main/Base/Project/Src/Dom/Implementations/DefaultReturnType.cs @@ -43,23 +43,40 @@ namespace ICSharpCode.SharpDevelop.Dom return c; } + bool getMembersBusy; + public override List GetMethods() { + if (getMembersBusy) return new List(); + getMembersBusy = true; List l = new List(); - foreach (IClass bc in c.ClassInheritanceTree) { - if (bc.ClassType == ClassType.Interface && c.ClassType != ClassType.Interface) - continue; // ignore explicit interface implementations - - foreach (IMethod m in bc.Methods) { - // do not add base class constructors - if (m.IsConstructor && c != bc) + l.AddRange(c.Methods); + if (c.ClassType == ClassType.Interface) { + if (c.BaseTypes.Count == 0) { + AddMethodsFromBaseType(l, ReflectionReturnType.Object); + } else { + foreach (IReturnType baseType in c.BaseTypes) { + AddMethodsFromBaseType(l, baseType); + } + } + } else { + AddMethodsFromBaseType(l, c.BaseType); + } + getMembersBusy = false; + return l; + } + + void AddMethodsFromBaseType(List l, IReturnType baseType) + { + if (baseType != null) { + foreach (IMethod m in baseType.GetMethods()) { + if (m.IsConstructor) continue; - // do not add methods that were overridden bool ok = true; if (m.IsOverridable) { StringComparer comparer = m.DeclaringType.ProjectContent.Language.NameComparer; - foreach (IMethod oldMethod in l) { + foreach (IMethod oldMethod in c.Methods) { if (comparer.Equals(oldMethod.Name, m.Name)) { if (m.IsStatic == oldMethod.IsStatic) { if (DiffUtility.Compare(oldMethod.Parameters, m.Parameters) == 0) { @@ -74,22 +91,33 @@ namespace ICSharpCode.SharpDevelop.Dom l.Add(m); } } - return l; } public override List GetProperties() { + if (getMembersBusy) return new List(); + getMembersBusy = true; List l = new List(); - foreach (IClass bc in c.ClassInheritanceTree) { - if (bc.ClassType == ClassType.Interface && c.ClassType != ClassType.Interface) - continue; // ignore explicit interface implementations - - foreach (IProperty p in bc.Properties) { - // do not add methods that were overridden + l.AddRange(c.Properties); + if (c.ClassType == ClassType.Interface) { + foreach (IReturnType baseType in c.BaseTypes) { + AddPropertiesFromBaseType(l, baseType); + } + } else { + AddPropertiesFromBaseType(l, c.BaseType); + } + getMembersBusy = false; + return l; + } + + void AddPropertiesFromBaseType(List l, IReturnType baseType) + { + if (baseType != null) { + foreach (IProperty p in baseType.GetProperties()) { bool ok = true; if (p.IsOverridable) { StringComparer comparer = p.DeclaringType.ProjectContent.Language.NameComparer; - foreach (IProperty oldProperty in l) { + foreach (IProperty oldProperty in c.Properties) { if (comparer.Equals(oldProperty.Name, p.Name)) { if (p.IsStatic == oldProperty.IsStatic) { if (DiffUtility.Compare(oldProperty.Parameters, p.Parameters) == 0) { @@ -104,28 +132,43 @@ namespace ICSharpCode.SharpDevelop.Dom l.Add(p); } } - return l; } public override List GetFields() { - List l = new List(); - foreach (IClass bc in c.ClassInheritanceTree) { - if (bc.ClassType == ClassType.Interface && c.ClassType != ClassType.Interface) - continue; // ignore explicit interface implementations - l.AddRange(bc.Fields); + if (getMembersBusy) return new List(); + getMembersBusy = true; + List l; + if (c.ClassType == ClassType.Interface) { + l = new List(); + foreach (IReturnType baseType in c.BaseTypes) { + l.AddRange(baseType.GetFields()); + } + } else { + IReturnType baseType = c.BaseType; + l = baseType != null ? c.BaseType.GetFields() : new List(); } + l.AddRange(c.Fields); + getMembersBusy = false; return l; } public override List GetEvents() { - List l = new List(); - foreach (IClass bc in c.ClassInheritanceTree) { - if (bc.ClassType == ClassType.Interface && c.ClassType != ClassType.Interface) - continue; // ignore explicit interface implementations - l.AddRange(bc.Events); + if (getMembersBusy) return new List(); + getMembersBusy = true; + List l; + if (c.ClassType == ClassType.Interface) { + l = new List(); + foreach (IReturnType baseType in c.BaseTypes) { + l.AddRange(baseType.GetEvents()); + } + } else { + IReturnType baseType = c.BaseType; + l = baseType != null ? c.BaseType.GetEvents() : new List(); } + l.AddRange(c.Events); + getMembersBusy = false; return l; } diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs index c77b38a92d..7dd853a1da 100644 --- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs +++ b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs @@ -74,8 +74,12 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver } } - string GetDocumentation(int line) + string GetDocumentation(int line, IList attributes) { + foreach (AST.AttributeSection att in attributes) { + if (att.StartLocation.Y > 0 && att.StartLocation.Y < line) + line = att.StartLocation.Y; + } List lines = new List(); int length = 0; while (line > 0) { @@ -141,7 +145,6 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver public override object Visit(AST.CompilationUnit compilationUnit, object data) { - //TODO: usings, Comments if (compilationUnit == null) { return null; } @@ -276,9 +279,12 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver public override object Visit(AST.TypeDeclaration typeDeclaration, object data) { DomRegion region = GetRegion(typeDeclaration.StartLocation, typeDeclaration.EndLocation); + DomRegion bodyRegion = GetRegion(typeDeclaration.BodyStartLocation, typeDeclaration.EndLocation); + DefaultClass c = new DefaultClass(cu, TranslateClassType(typeDeclaration.Type), ConvertModifier(typeDeclaration.Modifier, ModifierEnum.Internal), region, GetCurrentClass()); + c.BodyRegion = bodyRegion; ConvertAttributes(typeDeclaration, c); - c.Documentation = GetDocumentation(region.BeginLine); + c.Documentation = GetDocumentation(region.BeginLine, typeDeclaration.Attributes); if (currentClass.Count > 0) { DefaultClass cur = GetCurrentClass(); @@ -365,7 +371,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver { DomRegion region = GetRegion(delegateDeclaration.StartLocation, delegateDeclaration.EndLocation); DefaultClass c = new DefaultClass(cu, ClassType.Delegate, ConvertModifier(delegateDeclaration.Modifier, ModifierEnum.Internal), region, GetCurrentClass()); - c.Documentation = GetDocumentation(region.BeginLine); + c.Documentation = GetDocumentation(region.BeginLine, delegateDeclaration.Attributes); ConvertAttributes(delegateDeclaration, c); CreateDelegate(c, delegateDeclaration.Name, delegateDeclaration.ReturnType, delegateDeclaration.Templates, delegateDeclaration.Parameters); @@ -389,25 +395,15 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver } currentClass.Push(c); // necessary for CreateReturnType ConvertTemplates(templates, c); - DefaultMethod invokeMethod = new DefaultMethod("Invoke", CreateReturnType(returnType), ModifierEnum.Public, c.Region, DomRegion.Empty, c); - if (parameters != null) { - foreach (AST.ParameterDeclarationExpression par in parameters) { - invokeMethod.Parameters.Add(CreateParameter(par)); - } - } - c.Methods.Add(invokeMethod); - invokeMethod = new DefaultMethod("BeginInvoke", CreateReturnType(typeof(IAsyncResult)), ModifierEnum.Public, c.Region, DomRegion.Empty, c); + + List p = new List(); if (parameters != null) { - foreach (AST.ParameterDeclarationExpression par in parameters) { - invokeMethod.Parameters.Add(CreateParameter(par)); + foreach (AST.ParameterDeclarationExpression param in parameters) { + p.Add(CreateParameter(param)); } } - invokeMethod.Parameters.Add(new DefaultParameter("callback", CreateReturnType(typeof(AsyncCallback)), DomRegion.Empty)); - invokeMethod.Parameters.Add(new DefaultParameter("object", ReflectionReturnType.Object, DomRegion.Empty)); - c.Methods.Add(invokeMethod); - invokeMethod = new DefaultMethod("EndInvoke", CreateReturnType(returnType), ModifierEnum.Public, c.Region, DomRegion.Empty, c); - invokeMethod.Parameters.Add(new DefaultParameter("result", CreateReturnType(typeof(IAsyncResult)), DomRegion.Empty)); - c.Methods.Add(invokeMethod); + AnonymousMethodReturnType.AddDefaultDelegateMethod(c, CreateReturnType(returnType), p); + currentClass.Pop(); } @@ -418,7 +414,12 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver IParameter CreateParameter(AST.ParameterDeclarationExpression par, IMethod method) { - IReturnType parType = CreateReturnType(par.TypeReference, method); + return CreateParameter(par, method, GetCurrentClass(), cu); + } + + internal static IParameter CreateParameter(AST.ParameterDeclarationExpression par, IMethod method, IClass currentClass, ICompilationUnit cu) + { + IReturnType parType = CreateReturnType(par.TypeReference, method, currentClass, cu); DefaultParameter p = new DefaultParameter(par.ParameterName, parType, new DomRegion(par.StartLocation, par.EndLocation)); p.Modifiers = (ParameterModifiers)par.ParamModifier; return p; @@ -431,7 +432,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver DefaultClass c = GetCurrentClass(); DefaultMethod method = new DefaultMethod(methodDeclaration.Name, null, ConvertModifier(methodDeclaration.Modifier), region, bodyRegion, GetCurrentClass()); - method.Documentation = GetDocumentation(region.BeginLine); + method.Documentation = GetDocumentation(region.BeginLine, methodDeclaration.Attributes); ConvertTemplates(methodDeclaration.Templates, method); method.ReturnType = CreateReturnType(methodDeclaration.TypeReference, method); ConvertAttributes(methodDeclaration, method); @@ -471,7 +472,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver DefaultClass c = GetCurrentClass(); Constructor constructor = new Constructor(ConvertModifier(constructorDeclaration.Modifier), region, bodyRegion, GetCurrentClass()); - constructor.Documentation = GetDocumentation(region.BeginLine); + constructor.Documentation = GetDocumentation(region.BeginLine, constructorDeclaration.Attributes); ConvertAttributes(constructorDeclaration, constructor); if (constructorDeclaration.Parameters != null) { foreach (AST.ParameterDeclarationExpression par in constructorDeclaration.Parameters) { @@ -500,7 +501,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver { DomRegion region = GetRegion(fieldDeclaration.StartLocation, fieldDeclaration.EndLocation); DefaultClass c = GetCurrentClass(); - string doku = GetDocumentation(region.BeginLine); + string doku = GetDocumentation(region.BeginLine, fieldDeclaration.Attributes); if (currentClass.Count > 0) { for (int i = 0; i < fieldDeclaration.Fields.Count; ++i) { AST.VariableDeclaration field = (AST.VariableDeclaration)fieldDeclaration.Fields[i]; @@ -540,7 +541,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver property.SetterRegion = GetRegion(propertyDeclaration.SetRegion.StartLocation, propertyDeclaration.SetRegion.EndLocation); property.CanSet = true; } - property.Documentation = GetDocumentation(region.BeginLine); + property.Documentation = GetDocumentation(region.BeginLine, propertyDeclaration.Attributes); ConvertAttributes(propertyDeclaration, property); c.Properties.Add(property); return null; @@ -570,7 +571,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver ConvertAttributes(eventDeclaration, e); c.Events.Add(e); if (e != null) { - e.Documentation = GetDocumentation(region.BeginLine); + e.Documentation = GetDocumentation(region.BeginLine, eventDeclaration.Attributes); } else { LoggingService.Warn("NRefactoryASTConvertVisitor: " + eventDeclaration + " has no events!"); } @@ -583,7 +584,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver DomRegion bodyRegion = GetRegion(indexerDeclaration.BodyStart, indexerDeclaration.BodyEnd); DefaultProperty i = new DefaultProperty("Indexer", CreateReturnType(indexerDeclaration.TypeReference), ConvertModifier(indexerDeclaration.Modifier), region, bodyRegion, GetCurrentClass()); i.IsIndexer = true; - i.Documentation = GetDocumentation(region.BeginLine); + i.Documentation = GetDocumentation(region.BeginLine, indexerDeclaration.Attributes); ConvertAttributes(indexerDeclaration, i); if (indexerDeclaration.Parameters != null) { foreach (AST.ParameterDeclarationExpression par in indexerDeclaration.Parameters) { @@ -597,11 +598,15 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver IReturnType CreateReturnType(AST.TypeReference reference, IMethod method) { - IClass c = GetCurrentClass(); - if (c == null) { + return CreateReturnType(reference, method, GetCurrentClass(), cu); + } + + static IReturnType CreateReturnType(AST.TypeReference reference, IMethod method, IClass currentClass, ICompilationUnit cu) + { + if (currentClass == null) { return TypeVisitor.CreateReturnType(reference, new DefaultClass(cu, "___DummyClass"), method, 1, 1, cu.ProjectContent, true); } else { - return TypeVisitor.CreateReturnType(reference, c, method, c.Region.BeginLine + 1, 1, cu.ProjectContent, true); + return TypeVisitor.CreateReturnType(reference, currentClass, method, currentClass.Region.BeginLine + 1, 1, cu.ProjectContent, true); } } @@ -609,10 +614,5 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver { return CreateReturnType(reference, null); } - - IReturnType CreateReturnType(Type type) - { - return ReflectionReturnType.Create(ProjectContentRegistry.Mscorlib, null, type, false); - } } } diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs index 49f1a97c42..ed94cfbaca 100644 --- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs +++ b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs @@ -121,6 +121,28 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver return expression; } + public static ResolveResult GetResultFromDeclarationLine(IClass callingClass, IMethodOrProperty callingMember, int caretLine, int caretColumn, string expression) + { + if (callingClass == null) return null; + int pos = expression.IndexOf('('); + if (pos >= 0) { + expression = expression.Substring(0, pos); + } + expression = expression.Trim(); + if (!callingClass.BodyRegion.IsInside(caretLine, caretColumn) + && callingClass.ProjectContent.Language.NameComparer.Equals(expression, callingClass.Name)) + { + return new TypeResolveResult(callingClass, callingMember, callingClass); + } + if (callingMember != null + && !callingMember.BodyRegion.IsInside(caretLine, caretColumn) + && callingClass.ProjectContent.Language.NameComparer.Equals(expression, callingMember.Name)) + { + return new MemberResolveResult(callingClass, callingMember, callingMember); + } + return null; + } + public ResolveResult Resolve(ExpressionResult expressionResult, int caretLineNumber, int caretColumn, @@ -179,6 +201,9 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver RunLookupTableVisitor(fileContent); + ResolveResult rr = GetResultFromDeclarationLine(callingClass, callingMember as IMethodOrProperty, caretLine, caretColumn, expression); + if (rr != null) return rr; + return ResolveInternal(expr, expressionResult.Context); } @@ -422,11 +447,13 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver return CreateMemberResolveResult(member); c = type.GetUnderlyingClass(); if (c != null) { - List innerClasses = c.InnerClasses; - if (innerClasses != null) { - foreach (IClass innerClass in innerClasses) { - if (IsSameName(innerClass.Name, fieldReferenceExpression.FieldName)) { - return new TypeResolveResult(callingClass, callingMember, innerClass); + foreach (IClass baseClass in c.ClassInheritanceTree) { + List innerClasses = baseClass.InnerClasses; + if (innerClasses != null) { + foreach (IClass innerClass in innerClasses) { + if (IsSameName(innerClass.Name, fieldReferenceExpression.FieldName)) { + return new TypeResolveResult(callingClass, callingMember, innerClass); + } } } } @@ -1026,7 +1053,6 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver members.Clear(); IClass c = callingClass.DeclaringType; while (c != null) { - result.Add(c); t = c.DefaultReturnType; members.AddRange(t.GetMethods()); members.AddRange(t.GetFields()); @@ -1052,9 +1078,12 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver AddUsing(result, projectContent.DefaultImports, projectContent); if (callingClass != null) { - foreach (object member in projectContent.GetNamespaceContents(callingClass.Namespace)) { - if (!result.Contains(member)) - result.Add(member); + string[] namespaceParts = callingClass.Namespace.Split('.'); + for (int i = 1; i <= namespaceParts.Length; i++) { + foreach (object member in projectContent.GetNamespaceContents(string.Join(".", namespaceParts, 0, i))) { + if (!result.Contains(member)) + result.Add(member); + } } IClass currentClass = callingClass; do { diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/TypeVisitor.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/TypeVisitor.cs index 0e536b8e98..0e05c3e2e8 100644 --- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/TypeVisitor.cs +++ b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/TypeVisitor.cs @@ -428,7 +428,11 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver public override object Visit(AnonymousMethodExpression anonymousMethodExpression, object data) { - return new AnonymousMethodReturnType(); + AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(resolver.CompilationUnit); + foreach (ParameterDeclarationExpression param in anonymousMethodExpression.Parameters) { + amrt.MethodParameters.Add(NRefactoryASTConvertVisitor.CreateParameter(param, resolver.CallingMember as IMethod, resolver.CallingClass, resolver.CompilationUnit)); + } + return amrt; } public override object Visit(ArrayInitializerExpression arrayInitializerExpression, object data) diff --git a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionReturnType.cs b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionReturnType.cs index 1d366bb7c5..652c97c91e 100644 --- a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionReturnType.cs +++ b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionReturnType.cs @@ -116,16 +116,16 @@ namespace ICSharpCode.SharpDevelop.Dom return ProjectContentRegistry.Mscorlib.GetClass(FullyQualifiedName); } public override List GetMethods() { - return new List(1); + return new List(); } public override List GetProperties() { - return new List(1); + return new List(); } public override List GetFields() { - return new List(1); + return new List(); } public override List GetEvents() { - return new List(1); + return new List(); } } diff --git a/src/Main/Base/Project/Src/Dom/ResolveResult.cs b/src/Main/Base/Project/Src/Dom/ResolveResult.cs index da236f28e7..ce5d3de352 100644 --- a/src/Main/Base/Project/Src/Dom/ResolveResult.cs +++ b/src/Main/Base/Project/Src/Dom/ResolveResult.cs @@ -214,6 +214,13 @@ namespace ICSharpCode.SharpDevelop.Dom } } + public IEnumerable Results { + get { + yield return primaryResult; + yield return secondaryResult; + } + } + public TypeResolveResult TypeResult { get { if (primaryResult is TypeResolveResult) @@ -423,7 +430,9 @@ namespace ICSharpCode.SharpDevelop.Dom { ArrayList ar = GetCompletionData(projectContent.Language, true); if (resolvedClass != null) { - ar.AddRange(resolvedClass.InnerClasses); + foreach (IClass baseClass in resolvedClass.ClassInheritanceTree) { + ar.AddRange(baseClass.InnerClasses); + } } return ar; } diff --git a/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs b/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs index a5562c803c..2e9d4ea9cc 100644 --- a/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs +++ b/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs @@ -249,6 +249,20 @@ namespace ICSharpCode.SharpDevelop.Gui } } + bool canClearSelection = true; + + /// + /// Gets/Sets whether the user can clear the selection by clicking in the empty area. + /// + public bool CanClearSelection { + get { + return canClearSelection; + } + set { + canClearSelection = value; + } + } + protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); @@ -258,7 +272,9 @@ namespace ICSharpCode.SharpDevelop.Gui SelectedNode = node; } } else { - SelectedNode = null; + if (canClearSelection) { + SelectedNode = null; + } } } diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/WebReference.cs b/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/WebReference.cs index 188b3cc25f..d63ecc6d0f 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/WebReference.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/WebReference.cs @@ -372,6 +372,7 @@ namespace ICSharpCode.SharpDevelop.Gui webReferenceUrl.Include = url; webReferenceUrl.UpdateFromURL = url; webReferenceUrl.RelPath = relativePath; + webReferenceUrl.Namespace = proxyNamespace; items.Add(webReferenceUrl); // References. diff --git a/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs b/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs index 3db7737677..593c9794cc 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs @@ -277,8 +277,12 @@ namespace ICSharpCode.SharpDevelop.Gui FileInfo info = new FileInfo(e.FullPath); - fileItem.SubItems[1].Text = Math.Round((double)info.Length / 1024).ToString() + " KB"; - fileItem.SubItems[2].Text = info.LastWriteTime.ToString(); + try { + fileItem.SubItems[1].Text = Math.Round((double)info.Length / 1024).ToString() + " KB"; + fileItem.SubItems[2].Text = info.LastWriteTime.ToString(); + } catch (IOException) { + // ignore IO errors + } break; } } @@ -292,8 +296,12 @@ namespace ICSharpCode.SharpDevelop.Gui FileInfo info = new FileInfo(e.FullPath); ListViewItem fileItem = Items.Add(new FileListItem(e.FullPath)); - fileItem.SubItems.Add(Math.Round((double)info.Length / 1024).ToString() + " KB"); - fileItem.SubItems.Add(info.LastWriteTime.ToString()); + try { + fileItem.SubItems.Add(Math.Round((double)info.Length / 1024).ToString() + " KB"); + fileItem.SubItems.Add(info.LastWriteTime.ToString()); + } catch (IOException) { + // ignore IO errors + } }; WorkbenchSingleton.SafeThreadAsyncCall(method); } diff --git a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs index 96d25bd102..27f21810c7 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs @@ -263,9 +263,10 @@ namespace ICSharpCode.SharpDevelop.Project.Commands public override void Run() { TreeNode selectedNode = ProjectBrowserPad.Instance.ProjectBrowserControl.SelectedNode; - DirectoryNode node = selectedNode as DirectoryNode; - if (node == null) { - node = selectedNode.Parent as DirectoryNode; + DirectoryNode node = null; + while (selectedNode != null && node == null) { + node = selectedNode as DirectoryNode; + selectedNode = selectedNode.Parent; } if (node == null) { return; diff --git a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/ReferenceFolderNodeCommands.cs b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/ReferenceFolderNodeCommands.cs index b263268e1a..7d6f41aeb7 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/ReferenceFolderNodeCommands.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/ReferenceFolderNodeCommands.cs @@ -56,7 +56,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands DiscoveryClientProtocol protocol = DiscoverWebServices(url.UpdateFromURL); if (protocol != null) { // Save web services. - WebReference webReference = new WebReference(url.Project, url.UpdateFromURL, node.Text, url.Project.RootNamespace, protocol); + WebReference webReference = new WebReference(url.Project, url.UpdateFromURL, node.Text, url.Namespace, protocol); webReference.Save(); // Update project. @@ -117,7 +117,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands { public override void Run() { - AbstractProjectBrowserTreeNode node = Owner as AbstractProjectBrowserTreeNode; + AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.SelectedNode; if (node != null && node.Project != null) { using (AddWebReferenceDialog refDialog = new AddWebReferenceDialog(node.Project)) { refDialog.NamespacePrefix = node.Project.RootNamespace; @@ -152,7 +152,8 @@ namespace ICSharpCode.SharpDevelop.Project.Commands } else if (node is ReferenceFolder && node.Parent != null && node.Parent is ProjectNode) { webReferencesNode = AddWebReferenceToProjectNode((ProjectNode)node.Parent, webReference); } else { - LoggingService.Error("AddWebReferenceToProjectBrowser: Selected node type is not handled."); + LoggingService.Warn("AddWebReferenceToProjectBrowser: Selected node type is not handled."); + AddWebReferenceToProjectBrowser(node.Parent as AbstractProjectBrowserTreeNode, webReference); } if (webReferencesNode != null) { diff --git a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserControl.cs b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserControl.cs index 6dea583738..c2a6fa7a4b 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserControl.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserControl.cs @@ -62,6 +62,7 @@ namespace ICSharpCode.SharpDevelop.Project public ProjectBrowserControl() { InitializeComponent(); + treeView.CanClearSelection = false; treeView.BeforeSelect += TreeViewBeforeSelect; treeView.AfterExpand += TreeViewAfterExpand; FileService.FileRenamed += FileServiceFileRenamed; diff --git a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserPad.cs b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserPad.cs index 2051b9dd1e..89c1a23955 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserPad.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserPad.cs @@ -72,6 +72,7 @@ namespace ICSharpCode.SharpDevelop.Project if (ProjectService.OpenSolution != null) { ProjectServiceSolutionLoaded(null, new SolutionEventArgs(ProjectService.OpenSolution)); } + ActiveWindowChanged(null, null); } public void StartLabelEdit(ExtTreeNode node) diff --git a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserPanel.cs b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserPanel.cs index 10beeeddce..27ea31e2af 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserPanel.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserPanel.cs @@ -60,14 +60,15 @@ namespace ICSharpCode.SharpDevelop.Project void TreeViewBeforeSelect(object sender, TreeViewCancelEventArgs e) { - AbstractProjectBrowserTreeNode node = e.Node as AbstractProjectBrowserTreeNode; - if (node == null) { - toolStrip.Items.Clear(); - return; - } + UpdateToolStrip(e.Node as AbstractProjectBrowserTreeNode); + } + + void UpdateToolStrip(AbstractProjectBrowserTreeNode node) + { toolStrip.Items.Clear(); toolStrip.Items.AddRange(standardItems); - if (node.ToolbarAddinTreePath != null) { + ToolbarService.UpdateToolbar(toolStrip); + if (node != null && node.ToolbarAddinTreePath != null) { toolStrip.Items.Add(new ToolStripSeparator()); toolStrip.Items.AddRange((ToolStripItem[])AddInTree.BuildItems(node.ToolbarAddinTreePath, node, false).ToArray(typeof(ToolStripItem))); } @@ -75,6 +76,7 @@ namespace ICSharpCode.SharpDevelop.Project public void ViewSolution(Solution solution) { + UpdateToolStrip(null); projectBrowserControl.ViewSolution(solution); } @@ -161,6 +163,7 @@ namespace ICSharpCode.SharpDevelop.Project public void Clear() { projectBrowserControl.Clear(); + UpdateToolStrip(null); } public void SelectFile(string fileName) diff --git a/src/Main/Base/Project/Src/Gui/TreeGrid/DynamicTreeRow.cs b/src/Main/Base/Project/Src/Gui/TreeGrid/DynamicTreeRow.cs index 8cc9c33a93..b03152e973 100644 --- a/src/Main/Base/Project/Src/Gui/TreeGrid/DynamicTreeRow.cs +++ b/src/Main/Base/Project/Src/Gui/TreeGrid/DynamicTreeRow.cs @@ -193,15 +193,32 @@ namespace ICSharpCode.SharpDevelop.Gui.TreeGrid #region Child form static bool isOpeningChild; + /// + /// Block the next click event - used to ensure that a click on the "-" sign + /// does not cause the submenu to open again when the "-" sign becomes a "+" sign + /// before the click event is handled. + /// + bool blockClickEvent; + protected virtual void OnPlusClick(object sender, DynamicListEventArgs e) { + if (blockClickEvent) { blockClickEvent = false; return; } OnExpanding(e); ChildForm frm = new ChildForm(); frm.Closed += delegate { + blockClickEvent = true; if (expandedIn != null) expandedIn.Remove(e.List); OnCollapsed(e); plus.RaiseItemChanged(); + Timer timer = new Timer(); + timer.Interval = 85; + timer.Tick += delegate(object sender2, EventArgs e2) { + ((Timer)sender2).Stop(); + ((Timer)sender2).Dispose(); + blockClickEvent = false; + }; + timer.Start(); }; Point p = e.List.PointToScreen(e.List.GetPositionFromRow(this)); p.Offset(e.List.Columns[0].Width, Height); @@ -292,6 +309,9 @@ namespace ICSharpCode.SharpDevelop.Gui.TreeGrid bool showWindowWithoutActivation; + /// + /// Gets/Sets whether the window will receive focus when it is shown. + /// public bool ShowWindowWithoutActivation { get { return showWindowWithoutActivation; diff --git a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/LayoutConfiguration.cs b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/LayoutConfiguration.cs index 14626ed016..97dfdf55bb 100644 --- a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/LayoutConfiguration.cs +++ b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/LayoutConfiguration.cs @@ -90,11 +90,17 @@ namespace ICSharpCode.SharpDevelop.Gui return PropertyService.Get("Workbench.CurrentLayout", "Default"); } set { + if (WorkbenchSingleton.InvokeRequired) + throw new InvalidOperationException("Invoke required"); if (value != CurrentLayoutName) { - PropertyService.Set("Workbench.CurrentLayout", value); - WorkbenchSingleton.SafeThreadCall(WorkbenchSingleton.Workbench.WorkbenchLayout, "LoadConfiguration"); - WorkbenchSingleton.SafeThreadCall(typeof(LayoutConfiguration), "OnLayoutChanged", EventArgs.Empty); + WorkbenchSingleton.Workbench.WorkbenchLayout.LoadConfiguration(); + OnLayoutChanged(EventArgs.Empty); + #if DEBUG + GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); + #endif } } } diff --git a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs index 827a700687..9df2344f9f 100644 --- a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs +++ b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs @@ -134,6 +134,10 @@ namespace ICSharpCode.SharpDevelop.Gui private void CreateViewTabControl() { viewTabControl = new TabControl(); + viewTabControl.GotFocus += delegate { + TabPage page = viewTabControl.TabPages[viewTabControl.TabIndex]; + if (page.Controls.Count == 1 && !page.ContainsFocus) page.Controls[0].Focus(); + }; viewTabControl.Alignment = TabAlignment.Bottom; viewTabControl.Dock = DockStyle.Fill; viewTabControl.Selected += viewTabControlSelected; diff --git a/src/Main/Base/Project/Src/Project/AbstractProject.cs b/src/Main/Base/Project/Src/Project/AbstractProject.cs index e192c5f6b8..2352015867 100644 --- a/src/Main/Base/Project/Src/Project/AbstractProject.cs +++ b/src/Main/Base/Project/Src/Project/AbstractProject.cs @@ -779,6 +779,8 @@ namespace ICSharpCode.SharpDevelop.Project return properties; } + internal static List filesToOpenAfterSolutionLoad = new List(); + /// /// Loads project preferences (currently opened files, bookmarks etc.). /// @@ -788,9 +790,7 @@ namespace ICSharpCode.SharpDevelop.Project ICSharpCode.SharpDevelop.Bookmarks.BookmarkManager.AddMark(mark); } foreach (string fileName in properties.Get("files", new string[0])) { - if (File.Exists(fileName)) { - FileService.OpenFile(fileName); - } + filesToOpenAfterSolutionLoad.Add(fileName); } } } diff --git a/src/Main/Base/Project/Src/Project/Items/FileProjectItem.cs b/src/Main/Base/Project/Src/Project/Items/FileProjectItem.cs index 2f81150bbc..8616ccdecb 100644 --- a/src/Main/Base/Project/Src/Project/Items/FileProjectItem.cs +++ b/src/Main/Base/Project/Src/Project/Items/FileProjectItem.cs @@ -131,5 +131,13 @@ namespace ICSharpCode.SharpDevelop.Project { this.type = type; } + + public override ProjectItem Clone() + { + ProjectItem n = new FileProjectItem(this.Project, this.ItemType); + n.Include = this.Include; + this.CopyExtraPropertiesTo(n); + return n; + } } } diff --git a/src/Main/Base/Project/Src/Project/Items/ImportProjectItem.cs b/src/Main/Base/Project/Src/Project/Items/ImportProjectItem.cs index 73fad4724e..395eb31bd8 100644 --- a/src/Main/Base/Project/Src/Project/Items/ImportProjectItem.cs +++ b/src/Main/Base/Project/Src/Project/Items/ImportProjectItem.cs @@ -23,5 +23,13 @@ namespace ICSharpCode.SharpDevelop.Project return ItemType.Import; } } + + public override ProjectItem Clone() + { + ImportProjectItem n = new ImportProjectItem(this.Project); + n.Include = this.Include; + this.CopyExtraPropertiesTo(n); + return n; + } } } diff --git a/src/Main/Base/Project/Src/Project/Items/ProjectItem.cs b/src/Main/Base/Project/Src/Project/Items/ProjectItem.cs index dcef5205d6..10d82d0481 100644 --- a/src/Main/Base/Project/Src/Project/Items/ProjectItem.cs +++ b/src/Main/Base/Project/Src/Project/Items/ProjectItem.cs @@ -42,7 +42,7 @@ namespace ICSharpCode.SharpDevelop.Project BootstrapperFile } - public abstract class ProjectItem : LocalizedObject, IDisposable + public abstract class ProjectItem : LocalizedObject, IDisposable, ICloneable { string include; PropertyGroup properties = new PropertyGroup(); @@ -82,6 +82,17 @@ namespace ICSharpCode.SharpDevelop.Project item.Include = newInclude; } + public virtual ProjectItem Clone() + { + // TODO: Make me abstract in SD 2.1 + throw new NotSupportedException(); + } + + object ICloneable.Clone() + { + return this.Clone(); + } + [Browsable(false)] public PropertyGroup Properties { get { diff --git a/src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs b/src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs index 1a38678340..aa7a684017 100644 --- a/src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs +++ b/src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs @@ -169,5 +169,13 @@ namespace ICSharpCode.SharpDevelop.Project return null; } + + public override ProjectItem Clone() + { + ProjectItem n = new ReferenceProjectItem(this.Project); + n.Include = this.Include; + this.CopyExtraPropertiesTo(n); + return n; + } } } diff --git a/src/Main/Base/Project/Src/Project/Items/UnknownProjectItem.cs b/src/Main/Base/Project/Src/Project/Items/UnknownProjectItem.cs index b8a2fd0731..f86b70b8a2 100644 --- a/src/Main/Base/Project/Src/Project/Items/UnknownProjectItem.cs +++ b/src/Main/Base/Project/Src/Project/Items/UnknownProjectItem.cs @@ -13,7 +13,7 @@ using ICSharpCode.Core; namespace ICSharpCode.SharpDevelop.Project { /// - /// Description of ReferenceProjectItem. + /// A project item whose type is not known by SharpDevelop. /// public class UnknownProjectItem : ProjectItem { @@ -35,5 +35,13 @@ namespace ICSharpCode.SharpDevelop.Project { this.tag = tag; } + + public override ProjectItem Clone() + { + ProjectItem n = new UnknownProjectItem(this.Project, this.Tag); + n.Include = this.Include; + this.CopyExtraPropertiesTo(n); + return n; + } } } diff --git a/src/Main/Base/Project/Src/Project/MSBuildProject.cs b/src/Main/Base/Project/Src/Project/MSBuildProject.cs index 5e86fd8f7c..0e6b971d6b 100644 --- a/src/Main/Base/Project/Src/Project/MSBuildProject.cs +++ b/src/Main/Base/Project/Src/Project/MSBuildProject.cs @@ -121,6 +121,7 @@ namespace ICSharpCode.SharpDevelop.Project } } } + ExpandWildcards(); string userSettingsFileName = projectFileName + ".user"; if (File.Exists(userSettingsFileName)) { @@ -143,6 +144,26 @@ namespace ICSharpCode.SharpDevelop.Project } } + void ExpandWildcards() + { + for (int i = 0; i < items.Count; i++) { + ProjectItem item = items[i]; + if (item.Include.IndexOf('*') >= 0 && item is FileProjectItem) { + items.RemoveAt(i--); + try { + string path = Path.Combine(this.Directory, Path.GetDirectoryName(item.Include)); + foreach (string file in System.IO.Directory.GetFiles(path, Path.GetFileName(item.Include))) { + ProjectItem n = item.Clone(); + n.Include = FileUtility.GetRelativePath(this.Directory, file); + items.Insert(++i, n); + } + } catch (Exception ex) { + MessageService.ShowError(ex, "Error expanding wildcards in " + item.Include); + } + } + } + } + void LoadPropertyGroup(XmlReader reader, bool isUserFile) { string condition = reader.GetAttribute("Condition"); @@ -336,6 +357,10 @@ namespace ICSharpCode.SharpDevelop.Project MessageService.ShowError(psi.FileName + " does not exist and cannot be started."); return; } + if (!System.IO.Directory.Exists(psi.WorkingDirectory)) { + MessageService.ShowError("Working directory " + psi.WorkingDirectory + " does not exist; the process cannot be started. You can specify the working directory in the project options."); + return; + } if (withDebugging) { DebuggerService.CurrentDebugger.Start(psi); diff --git a/src/Main/Base/Project/Src/Project/WebReferenceUrl.cs b/src/Main/Base/Project/Src/Project/WebReferenceUrl.cs index 91ec5dafd6..a215960daf 100644 --- a/src/Main/Base/Project/Src/Project/WebReferenceUrl.cs +++ b/src/Main/Base/Project/Src/Project/WebReferenceUrl.cs @@ -98,6 +98,20 @@ namespace ICSharpCode.SharpDevelop.Project } } + [Browsable(false)] + public string Namespace { + get { + string ns = base.Properties["Namespace"]; + if (ns.Length > 0) { + return ns; + } + return Project.RootNamespace; + } + set { + base.Properties["Namespace"] = value; + } + } + public override string FileName { get { if (Project != null && RelPath != null) { @@ -116,5 +130,13 @@ namespace ICSharpCode.SharpDevelop.Project { UrlBehavior = "Static"; } + + public override ProjectItem Clone() + { + ProjectItem n = new WebReferenceUrl(this.Project); + n.Include = this.Include; + this.CopyExtraPropertiesTo(n); + return n; + } } } diff --git a/src/Main/Base/Project/Src/Services/IconService.cs b/src/Main/Base/Project/Src/Services/IconService.cs index 4495f74a2f..0673b7934f 100644 --- a/src/Main/Base/Project/Src/Services/IconService.cs +++ b/src/Main/Base/Project/Src/Services/IconService.cs @@ -73,8 +73,9 @@ namespace ICSharpCode.Core public static Bitmap GetBitmap(string name) { - if (ResourceService.GetBitmap(name) != null) { - return ResourceService.GetBitmap(name); + Bitmap bmp = ResourceService.GetBitmap(name); + if (bmp != null) { + return bmp; } return ResourceService.GetBitmap("Icons.16x16.MiscFiles"); @@ -82,8 +83,11 @@ namespace ICSharpCode.Core public static Icon GetIcon(string name) { - Bitmap bitmap = GetBitmap(name); - return Icon.FromHandle(bitmap.GetHicon()); + Icon icon = ResourceService.GetIcon(name); + if (icon != null) { + return icon; + } + return ResourceService.GetIcon("Icons.16x16.MiscFiles"); } diff --git a/src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs b/src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs index 0bd8994651..1e5bda5c73 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs @@ -565,12 +565,14 @@ namespace ICSharpCode.Core string outerName = typeName.Substring(0, lastIndex); IClass upperClass = GetClassInternal(outerName, typeParameterCount, language); if (upperClass != null) { - List innerClasses = upperClass.InnerClasses; - if (innerClasses != null) { - string innerName = typeName.Substring(lastIndex + 1); - foreach (IClass innerClass in innerClasses) { - if (language.NameComparer.Equals(innerClass.Name, innerName)) { - return innerClass; + foreach (IClass upperBaseClass in upperClass.ClassInheritanceTree) { + List innerClasses = upperBaseClass.InnerClasses; + if (innerClasses != null) { + string innerName = typeName.Substring(lastIndex + 1); + foreach (IClass innerClass in innerClasses) { + if (language.NameComparer.Equals(innerClass.Name, innerName)) { + return innerClass; + } } } } diff --git a/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs b/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs index aeeb5c83bf..828a1c59a4 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs @@ -177,6 +177,13 @@ namespace ICSharpCode.Core return project.Items.Count; } + internal void ReInitialize2() + { + if (initializing) return; + initializing = true; + Initialize2(); + } + internal void Initialize2() { if (!initializing) return; diff --git a/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs b/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs index a21a3805b6..b9844cf872 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs @@ -155,6 +155,7 @@ namespace ICSharpCode.Core ICSharpCode.Core.MessageService.ShowError(e, "Error while retrieving project contents from " + project); } } + WorkbenchSingleton.SafeThreadAsyncCall((ThreadStart)ProjectService.ParserServiceCreatedProjectContents); int workAmount = 0; foreach (ParseProjectContent newContent in createdContents) { if (abortLoadSolutionProjectsThread) return; @@ -167,7 +168,7 @@ namespace ICSharpCode.Core } StatusBarService.ProgressMonitor.BeginTask("Parsing...", workAmount); foreach (ParseProjectContent newContent in createdContents) { - if (abortLoadSolutionProjectsThread) return; + if (abortLoadSolutionProjectsThread) break; try { newContent.Initialize2(); } catch (Exception e) { @@ -181,7 +182,25 @@ namespace ICSharpCode.Core { ParseProjectContent newContent = (ParseProjectContent)state; newContent.Initialize1(); + StatusBarService.ProgressMonitor.BeginTask("Parsing...", newContent.GetInitializationWorkAmount()); newContent.Initialize2(); + StatusBarService.ProgressMonitor.Done(); + } + + static void ReparseProject(object state) + { + ParseProjectContent newContent = (ParseProjectContent)state; + StatusBarService.ProgressMonitor.BeginTask("Parsing...", newContent.GetInitializationWorkAmount()); + newContent.ReInitialize2(); + StatusBarService.ProgressMonitor.Done(); + } + + public static void Reparse(IProject project) + { + ParseProjectContent pc = GetProjectContent(project) as ParseProjectContent; + if (pc != null) { + ThreadPool.QueueUserWorkItem(ReparseProject, pc); + } } internal static IProjectContent CreateProjectContentForAddedProject(IProject project) @@ -196,8 +215,10 @@ namespace ICSharpCode.Core public static IProjectContent GetProjectContent(IProject project) { - if (projectContents.ContainsKey(project)) { - return projectContents[project]; + lock (projectContents) { + if (projectContents.ContainsKey(project)) { + return projectContents[project]; + } } return null; } diff --git a/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs b/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs index 6104cf820e..a120105f69 100644 --- a/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs +++ b/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs @@ -246,20 +246,36 @@ namespace ICSharpCode.SharpDevelop.Project MessageService.ShowError(ex.Message); return; } + AbstractProject.filesToOpenAfterSolutionLoad.Clear(); try { string file = GetPreferenceFileName(openSolution.FileName); if (FileUtility.IsValidFileName(file) && File.Exists(file)) { (openSolution.Preferences as IMementoCapable).SetMemento(Properties.Load(file)); + } else { + (openSolution.Preferences as IMementoCapable).SetMemento(new Properties()); } ApplyConfigurationAndReadPreferences(); } catch (Exception ex) { MessageService.ShowError(ex); } + // Create project contents for solution + ParserService.OnSolutionLoaded(); + // preferences must be read before OnSolutionLoad is called to enable // the event listeners to read e.Solution.Preferences.Properties OnSolutionLoaded(new SolutionEventArgs(openSolution)); } + internal static void ParserServiceCreatedProjectContents() + { + foreach (string file in AbstractProject.filesToOpenAfterSolutionLoad) { + if (File.Exists(file)) { + FileService.OpenFile(file); + } + } + AbstractProject.filesToOpenAfterSolutionLoad.Clear(); + } + static void ApplyConfigurationAndReadPreferences() { openSolution.ApplySolutionConfigurationToProjects(); @@ -301,7 +317,12 @@ namespace ICSharpCode.SharpDevelop.Project ProjectSection configSection = solution.GetSolutionConfigurationsSection(); foreach (string configuration in project.GetConfigurationNames()) { foreach (string platform in project.GetPlatformNames()) { - string key = configuration + "|" + platform; + string key; + if (platform == "AnyCPU") { // Fix for SD2-786 + key = configuration + "|Any CPU"; + } else { + key = configuration + "|" + platform; + } configSection.Items.Add(new SolutionItem(key, key)); } } @@ -412,7 +433,6 @@ namespace ICSharpCode.SharpDevelop.Project static void OnSolutionLoaded(SolutionEventArgs e) { - ParserService.OnSolutionLoaded(); if (SolutionLoaded != null) { SolutionLoaded(null, e); } diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/NamespaceRefactoring.cs b/src/Main/Base/Project/Src/Services/RefactoringService/NamespaceRefactoring.cs new file mode 100644 index 0000000000..8c0797ea23 --- /dev/null +++ b/src/Main/Base/Project/Src/Services/RefactoringService/NamespaceRefactoring.cs @@ -0,0 +1,16 @@ +// +// +// +// +// $Revision$ +// + +using System; + +namespace ICSharpCode.SharpDevelop.Refactoring +{ + public static class NamespaceRefactoring + { + + } +} diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs index 1d452610e0..98df9a7aa2 100644 --- a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs +++ b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs @@ -37,19 +37,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring // can derive from the class continue; } - foreach (IClass c in pc.Classes) { - int count = c.BaseTypes.Count; - for (int i = 0; i < count; i++) { - string baseTypeName = c.BaseTypes[i].Name; - if (pc.Language.NameComparer.Equals(baseTypeName, baseClassName) || - pc.Language.NameComparer.Equals(baseTypeName, baseClassFullName)) { - IReturnType possibleBaseClass = c.GetBaseType(i); - if (possibleBaseClass.FullyQualifiedName == baseClass.FullyQualifiedName) { - list.Add(c); - } - } - } - } + AddDerivedClasses(pc, baseClass, baseClassName, baseClassFullName, pc.Classes, list); } if (!directDerivationOnly) { List additional = new List(); @@ -63,6 +51,25 @@ namespace ICSharpCode.SharpDevelop.Refactoring } return list; } + + static void AddDerivedClasses(IProjectContent pc, IClass baseClass, string baseClassName, string baseClassFullName, + IEnumerable classList, IList resultList) + { + foreach (IClass c in classList) { + AddDerivedClasses(pc, baseClass, baseClassName, baseClassFullName, c.InnerClasses, resultList); + int count = c.BaseTypes.Count; + for (int i = 0; i < count; i++) { + string baseTypeName = c.BaseTypes[i].Name; + if (pc.Language.NameComparer.Equals(baseTypeName, baseClassName) || + pc.Language.NameComparer.Equals(baseTypeName, baseClassFullName)) { + IReturnType possibleBaseClass = c.GetBaseType(i); + if (possibleBaseClass.FullyQualifiedName == baseClass.FullyQualifiedName) { + resultList.Add(c); + } + } + } + } + } #endregion #region FindReferences @@ -79,15 +86,33 @@ namespace ICSharpCode.SharpDevelop.Refactoring /// public static List FindReferences(IClass @class, IProgressMonitor progressMonitor) { + if (@class == null) + throw new ArgumentNullException("class"); return RunFindReferences(@class, null, false, progressMonitor); } /// - /// Find all references to the specified local variable. + /// Find all references to the resolved entity. /// - public static List FindReferences(LocalResolveResult local, IProgressMonitor progressMonitor) + public static List FindReferences(ResolveResult entity, IProgressMonitor progressMonitor) { - return RunFindReferences(local.CallingClass, local.Field, true, progressMonitor); + if (entity == null) + throw new ArgumentNullException("entity"); + if (entity is LocalResolveResult) { + return RunFindReferences(entity.CallingClass, (entity as LocalResolveResult).Field, true, progressMonitor); + } else if (entity is TypeResolveResult) { + return FindReferences((entity as TypeResolveResult).ResolvedClass, progressMonitor); + } else if (entity is MemberResolveResult) { + return FindReferences((entity as MemberResolveResult).ResolvedMember, progressMonitor); + } else if (entity is MethodResolveResult) { + IMethod method = (entity as MethodResolveResult).GetMethodIfSingleOverload(); + if (method != null) { + return FindReferences(method, progressMonitor); + } + } else if (entity is MixedResolveResult) { + return FindReferences((entity as MixedResolveResult).PrimaryResult, progressMonitor); + } + return null; } /// diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs index 4094b6e721..54f2522be6 100644 --- a/src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs +++ b/src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs @@ -7,6 +7,7 @@ using System; using System.Collections; +using System.Collections.Generic; using System.IO; using System.Drawing; using System.ComponentModel; @@ -276,20 +277,26 @@ namespace ICSharpCode.SharpDevelop.Gui foreach (IProject project in ProjectService.OpenSolution.Projects) { IProjectContent projectContent = ParserService.GetProjectContent(project); if (projectContent != null) { - foreach (IClass c in projectContent.Classes) { - string className = c.Name; - if (className.Length >= text.Length) { - if (className.ToLowerInvariant().IndexOf(lowerText) >= 0) { - list.Add(c); - } - } - } + AddClasses(lowerText, list, projectContent.Classes); } } } return list; } + void AddClasses(string lowerText, ArrayList list, IEnumerable classes) + { + foreach (IClass c in classes) { + string className = c.Name; + if (className.Length >= lowerText.Length) { + if (className.ToLowerInvariant().IndexOf(lowerText) >= 0) { + list.Add(c); + } + } + AddClasses(lowerText, list, c.InnerClasses); + } + } + void AddItem(string text, int imageIndex, object tag, double priority) { if (visibleEntries.ContainsKey(text)) diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ParserFoldingStrategy.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ParserFoldingStrategy.cs index a0ff47ab54..c58b66f7c3 100644 --- a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ParserFoldingStrategy.cs +++ b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ParserFoldingStrategy.cs @@ -22,9 +22,11 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor if (c.ClassType == ClassType.Delegate) { return; } - if (c.Region.BeginLine < c.Region.EndLine) { - FoldMarker newFoldMarker = new FoldMarker(document, c.Region.BeginLine - 1, c.Region.BeginColumn - 1, - c.Region.EndLine - 1, c.Region.EndColumn, FoldType.TypeBody); + DomRegion cRegion = c.BodyRegion; + if (cRegion.IsEmpty) cRegion = c.Region; + if (cRegion.BeginLine < cRegion.EndLine) { + FoldMarker newFoldMarker = new FoldMarker(document, cRegion.BeginLine - 1, cRegion.BeginColumn - 1, + cRegion.EndLine - 1, cRegion.EndColumn, FoldType.TypeBody); if (newFoldMarker.Length > 0) { foldMarkers.Add(newFoldMarker); } diff --git a/src/Main/Base/Test/GenericResolverTests.cs b/src/Main/Base/Test/GenericResolverTests.cs index 0fbd070815..06ea629f7f 100644 --- a/src/Main/Base/Test/GenericResolverTests.cs +++ b/src/Main/Base/Test/GenericResolverTests.cs @@ -156,6 +156,37 @@ class TestClass { LocalResolveResult lr = Resolve(program, "a", 5) as LocalResolveResult; Assert.AreEqual("System.Collections.Generic.List{System.String}", lr.ResolvedType.DotNetName, "a"); } + + [Test] + public void InheritFromGenericClass() + { + string program = @"using System; +class BaseClass { + public T value; +} +class DerivedClass : BaseClass { + +}"; + MemberResolveResult rr = Resolve(program, "value", 6) as MemberResolveResult; + Assert.AreEqual("System.String", rr.ResolvedType.FullyQualifiedName); + } + + [Test] + public void CrossTypeParametersInheritance() + { + string program = @"using System; +class BaseClass { + public A a; + public B b; +} +class DerivedClass : BaseClass { + +}"; + MemberResolveResult rr = Resolve(program, "a", 7) as MemberResolveResult; + Assert.AreEqual("B", rr.ResolvedType.Name); + rr = Resolve(program, "b", 7) as MemberResolveResult; + Assert.AreEqual("A", rr.ResolvedType.Name); + } #endregion #region CodeCompletion inside generic classes diff --git a/src/Main/Base/Test/InnerClassesResolverTests.cs b/src/Main/Base/Test/InnerClassesResolverTests.cs index f0f2c21cef..a3e2658842 100644 --- a/src/Main/Base/Test/InnerClassesResolverTests.cs +++ b/src/Main/Base/Test/InnerClassesResolverTests.cs @@ -106,6 +106,21 @@ class C : A { ResolveResult result = Resolve(program, "B", 6); Assert.IsTrue(result is TypeResolveResult); Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName); + + result = Resolve(program, "C.B", 6); + Assert.IsTrue(result is TypeResolveResult); + Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName); + + result = Resolve(program, "C", 6); + Assert.IsTrue(result is TypeResolveResult); + Assert.AreEqual("C", result.ResolvedType.FullyQualifiedName); + foreach (object o in result.GetCompletionData(nrrt.lastPC)) { + if (o is IClass) { + Assert.AreEqual("A.B", ((IClass)o).FullyQualifiedName); + return; + } + } + Assert.Fail("Inherited inner class not visible."); } } } diff --git a/src/Main/Base/Test/NRefactoryResolverTests.cs b/src/Main/Base/Test/NRefactoryResolverTests.cs index 9d8150c96f..a612d0836f 100644 --- a/src/Main/Base/Test/NRefactoryResolverTests.cs +++ b/src/Main/Base/Test/NRefactoryResolverTests.cs @@ -606,6 +606,58 @@ class Activator { Assert.AreEqual("Testnamespace.Activator", result.ResolvedType.FullyQualifiedName); } + [Test] + public void ParentNamespaceTypeLookup() + { + // Classes in the current namespace are preferred over classes from + // imported namespaces + string program = @"using System; +namespace Root { + class Alpha {} +} +namespace Root.Child { + class Beta { + + } +} +"; + ResolveResult result = Resolve(program, "Alpha", 7); + Assert.AreEqual("Root.Alpha", result.ResolvedType.FullyQualifiedName); + } + + [Test] + public void ParentNamespaceCtrlSpace() + { + // Classes in the current namespace are preferred over classes from + // imported namespaces + string program = @"using System; +namespace Root { + class Alpha {} +} +namespace Root.Child { + class Beta { + + } +} +"; + AddCompilationUnit(Parse("a.cs", program), "a.cs"); + + NRefactoryResolver resolver = new NRefactoryResolver(ICSharpCode.NRefactory.Parser.SupportedLanguage.CSharp); + ArrayList m = resolver.CtrlSpace(7, 0, "a.cs", program, ExpressionContext.Default); + Assert.IsTrue(TypeExists(m, "Beta"), "Meta must exist"); + Assert.IsTrue(TypeExists(m, "Alpha"), "Alpha must exist"); + } + + bool TypeExists(ArrayList m, string name) + { + foreach (object o in m) { + IClass c = o as IClass; + if (c != null && c.Name == name) + return true; + } + return false; + } + [Test] public void ImportedSubnamespaceTestCSharp() { @@ -793,6 +845,37 @@ class B { } return false; } + + [Test] + public void OverriddenMemberVisibilityTest() + { + string program = @"using System; + public abstract class GrandParent { + protected abstract void OverrideMe(); + } + public class Parent: GrandParent { + protected override void OverrideMe() { + } + } + public class Child: Parent { + } +"; + ResolveResult result = Resolve(program, "(Child)someVar", 6); + Assert.AreEqual("Child", result.ResolvedType.FullyQualifiedName); + int count = 0; + foreach (IMethod m in result.ResolvedType.GetMethods()) { + if (m.Name == "OverrideMe") + count += 1; + } + Assert.AreEqual(1, count); + count = 0; + foreach (object o in result.GetCompletionData(lastPC)) { + IMethod m = o as IMethod; + if (m != null && m.Name == "OverrideMe") + count += 1; + } + Assert.AreEqual(1, count); + } #endregion #region MixedType tests diff --git a/src/Main/Base/Test/WebReferences/WebReferenceProjectItemsTest.cs b/src/Main/Base/Test/WebReferences/WebReferenceProjectItemsTest.cs index 9dfe90318e..0454da1eb9 100644 --- a/src/Main/Base/Test/WebReferences/WebReferenceProjectItemsTest.cs +++ b/src/Main/Base/Test/WebReferences/WebReferenceProjectItemsTest.cs @@ -110,6 +110,12 @@ namespace ICSharpCode.SharpDevelop.Tests.WebReferences Assert.AreEqual("Static", webReferenceUrl.UrlBehavior); } + [Test] + public void WebReferenceUrlNamespace() + { + Assert.AreEqual(proxyNamespace, webReferenceUrl.Namespace); + } + [Test] public void WebReferenceRelPath() { diff --git a/src/Main/Base/Test/WebReferences/WebReferenceUrlTests.cs b/src/Main/Base/Test/WebReferences/WebReferenceUrlTests.cs index d63ece8171..75e5bbaf2c 100644 --- a/src/Main/Base/Test/WebReferences/WebReferenceUrlTests.cs +++ b/src/Main/Base/Test/WebReferences/WebReferenceUrlTests.cs @@ -54,6 +54,28 @@ namespace ICSharpCode.SharpDevelop.Tests.WebReferences Assert.AreEqual("http://localhost/test.asmx", url.Include); Assert.AreEqual("Web References\\mywebservice", url.RelPath); } - + + [Test] + public void NoNamespaceSpecified() + { + MSBuildProject project = new MSBuildProject(); + project.FileName = "c:\\projects\\test\\foo.csproj"; + project.RootNamespace = "TestRootNamespace"; + WebReferenceUrl url = new WebReferenceUrl(project); + + Assert.AreEqual("TestRootNamespace", url.Namespace); + } + + [Test] + public void NamespaceSpecified() + { + MSBuildProject project = new MSBuildProject(); + project.FileName = "c:\\projects\\test\\foo.csproj"; + project.RootNamespace = "TestRootNamespace"; + WebReferenceUrl url = new WebReferenceUrl(project); + url.Namespace = "WebReferenceNamespace"; + + Assert.AreEqual("WebReferenceNamespace", url.Namespace); + } } } diff --git a/src/Main/Core/Project/Configuration/AssemblyInfo.cs b/src/Main/Core/Project/Configuration/AssemblyInfo.cs index 2583bb9518..5ab5c37506 100644 --- a/src/Main/Core/Project/Configuration/AssemblyInfo.cs +++ b/src/Main/Core/Project/Configuration/AssemblyInfo.cs @@ -12,6 +12,9 @@ using System.Runtime.CompilerServices; [assembly: CLSCompliant(true)] [assembly: StringFreezing()] +// Use hard-binding for ICSharpCode.Core: +[assembly: Dependency("log4net", LoadHint.Always)] + [assembly: AssemblyTitle("ICSharpCode.Core")] [assembly: AssemblyDescription("The ICSharpCode Core containing the AddInTree and service Subsystem")] [assembly: AssemblyConfiguration("")] diff --git a/src/Main/Core/Project/Src/Services/MessageService/CustomDialog.cs b/src/Main/Core/Project/Src/Services/MessageService/CustomDialog.cs index 41c0bb1f87..771d5e4131 100644 --- a/src/Main/Core/Project/Src/Services/MessageService/CustomDialog.cs +++ b/src/Main/Core/Project/Src/Services/MessageService/CustomDialog.cs @@ -50,7 +50,6 @@ namespace ICSharpCode.Core for (int i = 0; i < buttons.Length; i++) { Button newButton = new Button(); newButton.FlatStyle = FlatStyle.System; - newButton.Anchor = AnchorStyles.Right; newButton.Tag = i; string buttonLabel = StringParser.Parse(buttonLabels[i]); newButton.Text = buttonLabel; @@ -68,15 +67,17 @@ namespace ICSharpCode.Core CancelButton = buttons[cancelButton]; } - pos -= 4; // remove space after last button + pos += 4; // add space before first button + // (we don't start with pos=4 because this space doesn't belong to the button panel) + if (pos > clientSize.Width) { clientSize.Width = pos; } clientSize.Height += panel.Height + 6; this.ClientSize = clientSize; - int start = (panel.ClientSize.Width - pos) / 2; + int start = (clientSize.Width - pos) / 2; for (int i = 0; i < buttons.Length; i++) { - ((Button)buttons[i]).Location = new Point(start + positions[i], 4); + buttons[i].Location = new Point(start + positions[i], 4); } panel.Controls.AddRange(buttons); } @@ -92,7 +93,6 @@ namespace ICSharpCode.Core this.Close(); } - #region Windows Forms Designer generated code /// /// This method is required for Windows Forms designer support. /// Do not change the method contents inside the source code editor. The Forms designer might @@ -123,7 +123,6 @@ namespace ICSharpCode.Core // // CustomDialog // -// this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(274, 112); this.Controls.Add(this.label); this.Controls.Add(this.panel); @@ -137,6 +136,5 @@ namespace ICSharpCode.Core this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "CustomDialog"; } - #endregion } } diff --git a/src/Main/Core/Project/Src/Services/MessageService/MessageService.cs b/src/Main/Core/Project/Src/Services/MessageService/MessageService.cs index dc2807ee97..e23034bd46 100644 --- a/src/Main/Core/Project/Src/Services/MessageService/MessageService.cs +++ b/src/Main/Core/Project/Src/Services/MessageService/MessageService.cs @@ -63,6 +63,8 @@ namespace ICSharpCode.Core public static void ShowError(Exception ex, string message) { + if (message == null) message = string.Empty; + if (ex != null) { LoggingService.Error(message, ex); if (customErrorReporter != null) { @@ -73,21 +75,7 @@ namespace ICSharpCode.Core LoggingService.Error(message); } - #if DEBUG - if (ex != null) { - Console.Beep(); - return; - } - #endif - string msg = String.Empty; - - if (message != null) { - msg += message; - } - - if (message != null && ex != null) { - msg += "\n\n"; - } + string msg = message + "\n\n"; if (ex != null) { msg += "Exception occurred: " + ex.ToString(); diff --git a/src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs b/src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs index c7f8b3f182..f8be596a4a 100644 --- a/src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs +++ b/src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs @@ -65,6 +65,9 @@ namespace ICSharpCode.Core static Hashtable localStrings = null; static Hashtable localIcons = null; + static Dictionary iconCache = new Dictionary(); + static Dictionary bitmapCache = new Dictionary(); + /// Strings resource managers for the current language static List localStringsResMgrs = new List(); /// Image resource managers for the current language @@ -182,6 +185,9 @@ namespace ICSharpCode.Core static void LoadLanguageResources(string language) { + iconCache.Clear(); + bitmapCache.Clear(); + try { Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(language); } catch (Exception) { @@ -400,15 +406,22 @@ namespace ICSharpCode.Core /// public static Icon GetIcon(string name) { - object iconobj = GetImageResource(name); - - if (iconobj == null) { - return null; - } - if (iconobj is Icon) { - return (Icon)iconobj; - } else { - return Icon.FromHandle(((Bitmap)iconobj).GetHicon()); + lock (iconCache) { + Icon ico; + if (iconCache.TryGetValue(name, out ico)) + return ico; + + object iconobj = GetImageResource(name); + if (iconobj == null) { + return null; + } + if (iconobj is Icon) { + ico = (Icon)iconobj; + } else { + ico = Icon.FromHandle(((Bitmap)iconobj).GetHicon()); + } + iconCache[name] = ico; + return ico; } } @@ -427,9 +440,15 @@ namespace ICSharpCode.Core /// public static Bitmap GetBitmap(string name) { - Bitmap b = (Bitmap)GetImageResource(name); - Debug.Assert(b != null, "Resource " + name); - return b; + lock (bitmapCache) { + Bitmap bmp; + if (bitmapCache.TryGetValue(name, out bmp)) + return bmp; + bmp = (Bitmap)GetImageResource(name); + Debug.Assert(bmp != null, "Resource " + name); + bitmapCache[name] = bmp; + return bmp; + } } } } diff --git a/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs b/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs index 3a6afe41db..4d505182d2 100644 --- a/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs +++ b/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs @@ -110,10 +110,8 @@ namespace ICSharpCode.SharpDevelop { CopyInfoToClipboard(); - StartUrl("http://community.sharpdevelop.net/forums/23/ShowForum.aspx"); - - //Version v = Assembly.GetEntryAssembly().GetName().Version; - //StartUrl("http://www.icsharpcode.net/OpenSource/SD/BugReporting.aspx?version=" + v.Major + "." + v.Minor + "." + v.Revision + "." + v.Build); + Version v = Assembly.GetEntryAssembly().GetName().Version; + StartUrl("http://www.icsharpcode.net/OpenSource/SD/BugReporting.aspx?version=" + v.Major + "." + v.Minor + "." + v.Revision + "." + v.Build); /* string text = "This version of SharpDevelop is an internal build, " + diff --git a/src/Main/StartUp/Project/Resources/StringResources.resources b/src/Main/StartUp/Project/Resources/StringResources.resources index 4e62afab2c..96b0f595a6 100644 Binary files a/src/Main/StartUp/Project/Resources/StringResources.resources and b/src/Main/StartUp/Project/Resources/StringResources.resources differ diff --git a/src/Main/StartUp/Project/StartUp.csproj b/src/Main/StartUp/Project/StartUp.csproj index 521efbf88f..fa2a68b51e 100644 --- a/src/Main/StartUp/Project/StartUp.csproj +++ b/src/Main/StartUp/Project/StartUp.csproj @@ -13,7 +13,7 @@ Resources\StartUp.snk .\Resources\SharpDevelop.ico Always - 92798976 + 4194304 False False Auto diff --git a/src/SharpDevelop.Tests.sln b/src/SharpDevelop.Tests.sln index 714bb3111f..6df16f1a5f 100644 --- a/src/SharpDevelop.Tests.sln +++ b/src/SharpDevelop.Tests.sln @@ -1,9 +1,15 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.0.0.1084 +# SharpDevelop 2.1.0.1340 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}" ProjectSection(SolutionItems) = postProject EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormsDesigner", "AddIns\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj", "{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BooBinding.Tests", "AddIns\BackendBindings\Boo\BooBinding\Test\BooBinding.Tests.csproj", "{6FA16499-896F-4C02-BB43-1AF5C6C7C713}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BooBinding", "AddIns\BackendBindings\Boo\BooBinding\Project\BooBinding.csproj", "{4AC2D5F1-F671-480C-A075-6BF62B3721B2}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAntAddIn.Tests", "AddIns\Misc\NAntAddIn\Test\NAntAddIn.Tests.csproj", "{13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAntAddIn", "AddIns\Misc\NAntAddIn\Project\NAntAddIn.csproj", "{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}" @@ -206,6 +212,18 @@ Global {1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.Build.0 = Release|Any CPU {1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4AC2D5F1-F671-480C-A075-6BF62B3721B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4AC2D5F1-F671-480C-A075-6BF62B3721B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4AC2D5F1-F671-480C-A075-6BF62B3721B2}.Release|Any CPU.Build.0 = Release|Any CPU + {4AC2D5F1-F671-480C-A075-6BF62B3721B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6FA16499-896F-4C02-BB43-1AF5C6C7C713}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6FA16499-896F-4C02-BB43-1AF5C6C7C713}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6FA16499-896F-4C02-BB43-1AF5C6C7C713}.Release|Any CPU.Build.0 = Release|Any CPU + {6FA16499-896F-4C02-BB43-1AF5C6C7C713}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Release|Any CPU.Build.0 = Release|Any CPU + {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -225,6 +243,9 @@ Global {1F261725-6318-4434-A1B1-6C70CE4CD324} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5} {1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5} {13AB8351-39E5-4F9D-A59C-B30D60CF6B8C} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5} + {4AC2D5F1-F671-480C-A075-6BF62B3721B2} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5} + {6FA16499-896F-4C02-BB43-1AF5C6C7C713} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5} + {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5} {B08385CD-F0CC-488C-B4F4-EEB34B6D2688} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D} {1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D} {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}