diff --git a/SharpDevelop.Tests.sln b/SharpDevelop.Tests.sln index 69c6aa0ae9..fc26d53d68 100644 --- a/SharpDevelop.Tests.sln +++ b/SharpDevelop.Tests.sln @@ -310,37 +310,37 @@ Global {70966F84-74C9-4067-A379-0C674A929233}.Release|x86.Build.0 = Release|Any CPU {70966F84-74C9-4067-A379-0C674A929233}.Release|x86.ActiveCfg = Release|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|x86.Build.0 = Debug|Any CPU - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|x86.ActiveCfg = Debug|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|x86.ActiveCfg = net_4_5_Debug|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.Build.0 = Release|Any CPU - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|x86.Build.0 = Release|Any CPU - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|x86.ActiveCfg = Release|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|x86.ActiveCfg = net_4_5_Release|Any CPU {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|x86.Build.0 = Debug|Any CPU - {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|x86.ActiveCfg = Debug|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|x86.ActiveCfg = net_4_5_Debug|Any CPU {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Any CPU.Build.0 = Release|Any CPU - {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.Build.0 = Release|Any CPU - {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.ActiveCfg = Release|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.ActiveCfg = net_4_5_Release|Any CPU {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|x86.Build.0 = Debug|Any CPU - {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|x86.ActiveCfg = Debug|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|x86.ActiveCfg = net_4_5_Debug|Any CPU {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|Any CPU.Build.0 = Release|Any CPU - {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|x86.Build.0 = Release|Any CPU - {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|x86.ActiveCfg = Release|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|x86.ActiveCfg = net_4_5_Release|Any CPU {63D3B27A-D966-4902-90B3-30290E1692F1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {63D3B27A-D966-4902-90B3-30290E1692F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {63D3B27A-D966-4902-90B3-30290E1692F1}.Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU {63D3B27A-D966-4902-90B3-30290E1692F1}.Debug|x86.Build.0 = Debug|x86 - {63D3B27A-D966-4902-90B3-30290E1692F1}.Debug|x86.ActiveCfg = Debug|x86 + {63D3B27A-D966-4902-90B3-30290E1692F1}.Debug|x86.ActiveCfg = net_4_5_Debug|x86 {63D3B27A-D966-4902-90B3-30290E1692F1}.Release|Any CPU.Build.0 = Release|Any CPU - {63D3B27A-D966-4902-90B3-30290E1692F1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {63D3B27A-D966-4902-90B3-30290E1692F1}.Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU {63D3B27A-D966-4902-90B3-30290E1692F1}.Release|x86.Build.0 = Release|x86 - {63D3B27A-D966-4902-90B3-30290E1692F1}.Release|x86.ActiveCfg = Release|x86 + {63D3B27A-D966-4902-90B3-30290E1692F1}.Release|x86.ActiveCfg = net_4_5_Release|x86 {52006F3F-3156-45DE-89D8-C4813694FBA4}.Debug|Any CPU.Build.0 = Debug|Any CPU {52006F3F-3156-45DE-89D8-C4813694FBA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {52006F3F-3156-45DE-89D8-C4813694FBA4}.Debug|x86.Build.0 = Debug|Any CPU diff --git a/SharpDevelop.sln b/SharpDevelop.sln index 88b4670ccd..a4a463f1de 100644 --- a/SharpDevelop.sln +++ b/SharpDevelop.sln @@ -234,29 +234,29 @@ Global {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.Build.0 = net_2_0_Debug|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.ActiveCfg = net_4_0_Release|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|x86.Build.0 = Debug|Any CPU - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|x86.ActiveCfg = Debug|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|x86.ActiveCfg = net_4_5_Debug|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.Build.0 = Release|Any CPU - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|x86.Build.0 = Release|Any CPU - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|x86.ActiveCfg = Release|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|x86.ActiveCfg = net_4_5_Release|Any CPU {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|x86.Build.0 = Debug|Any CPU - {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|x86.ActiveCfg = Debug|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.Debug|x86.ActiveCfg = net_4_5_Debug|Any CPU {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Any CPU.Build.0 = Release|Any CPU - {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.Build.0 = Release|Any CPU - {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.ActiveCfg = Release|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.ActiveCfg = net_4_5_Release|Any CPU {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|x86.Build.0 = Debug|Any CPU - {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|x86.ActiveCfg = Debug|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Debug|x86.ActiveCfg = net_4_5_Debug|Any CPU {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|Any CPU.Build.0 = Release|Any CPU - {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|x86.Build.0 = Release|Any CPU - {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|x86.ActiveCfg = Release|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.Release|x86.ActiveCfg = net_4_5_Release|Any CPU {E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Debug|Any CPU.Build.0 = Debug|Any CPU {E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E618A9CD-A39F-4925-A538-E8A3FEF24E54}.Debug|x86.Build.0 = Debug|Any CPU diff --git a/TODOnewNR.txt b/TODOnewNR.txt index 744f1d477e..da19855e65 100644 --- a/TODOnewNR.txt +++ b/TODOnewNR.txt @@ -25,7 +25,7 @@ Stuff that was renamed/moved: ICSharpCode.SharpDevelop.Dom -> the type system and resolvers now are part of ICSharpCode.NRefactory IDocument -> moved to ICSharpCode.NRefactory.Editor IClass -> ITypeDefinition - ICompilationUnit -> IParsedFile + ISyntaxTree -> IUnresolvedFile ITextBuffer -> ITextSource (in ICSharpCode.NRefactory.Editor) IReturnType -> ITypeReference (unresolved) or IType (resolved) Location -> TextLocation in ICSharpCode.NRefactory @@ -77,8 +77,8 @@ Functionality changes: The result of a parser run (ParseInformation) now may contain a fully parsed AST. The ParserService may cache such full ASTs, but may also drop them from memory at any time. This will be implemented by keeping the last N accessed files in the cache. (currently we just keep the caches around forever) - Every parse information also contains an IParsedFile instance with the type system information. - The IParsedFile is stored permanently (both in ParserService and in the IProjectContents). + Every parse information also contains an IUnresolvedFile instance with the type system information. + The IUnresolvedFile is stored permanently (both in ParserService and in the IProjectContents). Context Actions vs. Member Context Menu: diff --git a/src/AddIns/Analysis/UnitTesting/Gui/UnitTestsPad.cs b/src/AddIns/Analysis/UnitTesting/Gui/UnitTestsPad.cs index b7dfd11ea6..ec8201559e 100644 --- a/src/AddIns/Analysis/UnitTesting/Gui/UnitTestsPad.cs +++ b/src/AddIns/Analysis/UnitTesting/Gui/UnitTestsPad.cs @@ -24,7 +24,7 @@ namespace ICSharpCode.UnitTesting bool disposed; DockPanel panel; ToolBar toolBar; - List> pending = new List>(); + List> pending = new List>(); static UnitTestsPad instance; public UnitTestsPad() @@ -154,7 +154,7 @@ namespace ICSharpCode.UnitTesting /// /// Protected method so we can test this method. /// - protected void UpdateParseInfo(IParsedFile oldFile, IParsedFile newFile) + protected void UpdateParseInfo(IUnresolvedFile oldFile, IUnresolvedFile newFile) { RootUnitTestNode root = (RootUnitTestNode)treeView.Root; if (root == null) { diff --git a/src/AddIns/Analysis/UnitTesting/Model/TestClass.cs b/src/AddIns/Analysis/UnitTesting/Model/TestClass.cs index 7f0604dab8..6cfe2fbe23 100644 --- a/src/AddIns/Analysis/UnitTesting/Model/TestClass.cs +++ b/src/AddIns/Analysis/UnitTesting/Model/TestClass.cs @@ -148,14 +148,14 @@ namespace ICSharpCode.UnitTesting int i = 0; while (i < parts.Count) { var part = parts[i]; - if (!definition.Parts.Any(p => p.ParsedFile.FileName == part.ParsedFile.FileName && p.Region == part.Region)) + if (!definition.Parts.Any(p => p.UnresolvedFile.FileName == part.UnresolvedFile.FileName && p.Region == part.Region)) parts.RemoveAt(i); else i++; } foreach (var part in definition.Parts) { - if (!parts.Any(p => p.ParsedFile.FileName == part.ParsedFile.FileName && p.Region == part.Region)) + if (!parts.Any(p => p.UnresolvedFile.FileName == part.UnresolvedFile.FileName && p.Region == part.Region)) parts.Add(part); } testMembers.RemoveWhere(m => !definition.Methods.Any(dm => dm.ReflectionName == m.Method.ReflectionName && testFrameworks.IsTestMethod(dm, definition.Compilation))); diff --git a/src/AddIns/Analysis/UnitTesting/Model/TestProject.cs b/src/AddIns/Analysis/UnitTesting/Model/TestProject.cs index 2b4dce6a92..556a1b4827 100644 --- a/src/AddIns/Analysis/UnitTesting/Model/TestProject.cs +++ b/src/AddIns/Analysis/UnitTesting/Model/TestProject.cs @@ -45,11 +45,11 @@ namespace ICSharpCode.UnitTesting { var context = new SimpleTypeResolveContext(SD.ParserService.GetCompilation(project).MainAssembly); IEnumerable @new; - if (e.NewParsedFile != null) - @new = e.NewParsedFile.TopLevelTypeDefinitions.Select(utd => utd.Resolve(context).GetDefinition()).Where(x => x != null && testFrameworks.IsTestClass(x, SD.ParserService.GetCompilation(project))); + if (e.NewUnresolvedFile != null) + @new = e.NewUnresolvedFile.TopLevelTypeDefinitions.Select(utd => utd.Resolve(context).GetDefinition()).Where(x => x != null && testFrameworks.IsTestClass(x, SD.ParserService.GetCompilation(project))); else @new = Enumerable.Empty(); - testClasses.UpdateTestClasses(testFrameworks, testClasses.Where(tc => tc.Parts.Any(td => td.ParsedFile.FileName == e.OldParsedFile.FileName)).Select(tc => new DefaultResolvedTypeDefinition(context, tc.Parts.ToArray())).ToList(), @new.ToList(), null, this); + testClasses.UpdateTestClasses(testFrameworks, testClasses.Where(tc => tc.Parts.Any(td => td.UnresolvedFile.FileName == e.OldUnresolvedFile.FileName)).Select(tc => new DefaultResolvedTypeDefinition(context, tc.Parts.ToArray())).ToList(), @new.ToList(), null, this); } public IProject Project { diff --git a/src/AddIns/Analysis/UnitTesting/Service/RegisteredTestFrameworks.cs b/src/AddIns/Analysis/UnitTesting/Service/RegisteredTestFrameworks.cs index 7815abd37e..c47289a491 100644 --- a/src/AddIns/Analysis/UnitTesting/Service/RegisteredTestFrameworks.cs +++ b/src/AddIns/Analysis/UnitTesting/Service/RegisteredTestFrameworks.cs @@ -76,7 +76,7 @@ namespace ICSharpCode.UnitTesting IProject GetProject(ITypeDefinition c) { if (c != null && ProjectService.OpenSolution != null) { - return ProjectService.OpenSolution.FindProjectContainingFile(c.Parts[0].ParsedFile.FileName); + return ProjectService.OpenSolution.FindProjectContainingFile(c.Parts[0].UnresolvedFile.FileName); } return null; } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighter.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighter.cs index b2e060fdbd..7e37281d2c 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighter.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighter.cs @@ -241,10 +241,10 @@ namespace CSharpBinding this.line = line; this.lineNumber = lineNumber; if (Debugger.IsAttached) { - parseInfo.CompilationUnit.AcceptVisitor(this); + parseInfo.SyntaxTree.AcceptVisitor(this); } else { try { - parseInfo.CompilationUnit.AcceptVisitor(this); + parseInfo.SyntaxTree.AcceptVisitor(this); } catch (Exception ex) { hasCrashed = true; throw new ApplicationException("Error highlighting line " + lineNumber, ex); @@ -403,7 +403,7 @@ namespace CSharpBinding string symbol = attr.PositionalArguments[0].ConstantValue as string; if (symbol != null) { hasConditionalAttribute = true; - var cu = this.resolver.RootNode as CompilationUnit; + var cu = this.resolver.RootNode as SyntaxTree; if (cu != null) { if (cu.ConditionalSymbols.Contains(symbol)) return false; // conditional is active diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CodeManipulation.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CodeManipulation.cs index 456cea2444..3888882ebd 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CodeManipulation.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CodeManipulation.cs @@ -211,7 +211,7 @@ namespace CSharpBinding } // could work to extend selection to set of adjacent statements separated by blank lines - Selection ExtendSelection(ITextEditor editor, CompilationUnit parsedCU, IList commentsBlankLines, out INode selectedResultNode, Type[] interestingNodeTypes) + Selection ExtendSelection(ITextEditor editor, SyntaxTree parsedCU, IList commentsBlankLines, out INode selectedResultNode, Type[] interestingNodeTypes) { selectedResultNode = null; @@ -394,7 +394,7 @@ namespace CSharpBinding } // could depend just on IDocument - CompilationUnit ParseDocument(ITextEditor editor, out IList parsedSpecials) + SyntaxTree ParseDocument(ITextEditor editor, out IList parsedSpecials) { parsedSpecials = null; var editorLang = EditorContext.GetEditorLanguage(editor); @@ -404,7 +404,7 @@ namespace CSharpBinding parser.ParseMethodBodies = true; parser.Lexer.SkipAllComments = false; parser.Parse(); - var parsedCU = parser.CompilationUnit; + var parsedCU = parser.SyntaxTree; if (parsedCU == null) return null; foreach (var node in parsedCU.Children) { // fix StartLocation / EndLocation diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs index 63da2d025e..cff608d34b 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs @@ -49,8 +49,8 @@ namespace CSharpBinding.Completion this.ParseInformation = parseInfo; this.Compilation = compilation; this.ProjectContent = projectContent; - this.TypeResolveContextAtCaret = parseInfo.ParsedFile.GetTypeResolveContext(compilation, editor.Caret.Location); - this.CompletionContextProvider = new DefaultCompletionContextProvider(editor.Document, parseInfo.ParsedFile); + this.TypeResolveContextAtCaret = parseInfo.UnresolvedFile.GetTypeResolveContext(compilation, editor.Caret.Location); + this.CompletionContextProvider = new DefaultCompletionContextProvider(editor.Document, parseInfo.UnresolvedFile); } } } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs index d8b5e12e6a..fe200b053e 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs @@ -33,26 +33,12 @@ namespace CSharpBinding.Completion } #region ICompletionDataFactory implementation - public ICompletionData CreateEntityCompletionData(IUnresolvedEntity entity) - { - return new CompletionData(entity.Name) { - Image = ClassBrowserIconService.GetIcon(entity) - }; - } - - public ICompletionData CreateEntityCompletionData(IUnresolvedEntity entity, string text) - { - return new CompletionData(text) { - Image = ClassBrowserIconService.GetIcon(entity) - }; - } - - public ICompletionData CreateEntityCompletionData(IEntity entity) + ICompletionData ICompletionDataFactory.CreateEntityCompletionData(IEntity entity) { return new EntityCompletionData(entity); } - public ICompletionData CreateEntityCompletionData(IEntity entity, string text) + ICompletionData ICompletionDataFactory.CreateEntityCompletionData(IEntity entity, string text) { return new EntityCompletionData(entity) { CompletionText = text, @@ -60,19 +46,12 @@ namespace CSharpBinding.Completion }; } - public ICompletionData CreateTypeCompletionData(IType type, string shortType) + ICompletionData ICompletionDataFactory.CreateTypeCompletionData(IType type, string shortType) { return new CompletionData(shortType); } - public ICompletionData CreateTypeCompletionData(IUnresolvedTypeDefinition type, string shortType) - { - return new CompletionData(shortType) { - Image = ClassBrowserIconService.GetIcon(type) - }; - } - - public ICompletionData CreateLiteralCompletionData(string title, string description, string insertText) + ICompletionData ICompletionDataFactory.CreateLiteralCompletionData(string title, string description, string insertText) { return new CompletionData(title) { Description = description, @@ -81,36 +60,36 @@ namespace CSharpBinding.Completion }; } - public ICompletionData CreateNamespaceCompletionData(string name) + ICompletionData ICompletionDataFactory.CreateNamespaceCompletionData(string name) { return new CompletionData(name) { Image = ClassBrowserIconService.Namespace }; } - public ICompletionData CreateVariableCompletionData(IVariable variable) + ICompletionData ICompletionDataFactory.CreateVariableCompletionData(IVariable variable) { return new CompletionData(variable.Name) { Image = ClassBrowserIconService.LocalVariable }; } - public ICompletionData CreateVariableCompletionData(IUnresolvedTypeParameter parameter) + ICompletionData ICompletionDataFactory.CreateVariableCompletionData(ITypeParameter parameter) { return new CompletionData(parameter.Name); } - public ICompletionData CreateEventCreationCompletionData(string varName, IType delegateType, IEvent evt, string parameterDefinition, IUnresolvedMember currentMember, IUnresolvedTypeDefinition currentType) + ICompletionData ICompletionDataFactory.CreateEventCreationCompletionData(string varName, IType delegateType, IEvent evt, string parameterDefinition, IUnresolvedMember currentMember, IUnresolvedTypeDefinition currentType) { return new CompletionData("TODO: event creation"); } - public ICompletionData CreateNewOverrideCompletionData(int declarationBegin, IUnresolvedTypeDefinition type, IMember m) + ICompletionData ICompletionDataFactory.CreateNewOverrideCompletionData(int declarationBegin, IUnresolvedTypeDefinition type, IMember m) { return new OverrideCompletionData(declarationBegin, m, contextAtCaret); } - public ICompletionData CreateNewPartialCompletionData(int declarationBegin, IUnresolvedTypeDefinition type, IUnresolvedMember m) + ICompletionData ICompletionDataFactory.CreateNewPartialCompletionData(int declarationBegin, IUnresolvedTypeDefinition type, IUnresolvedMember m) { return new CompletionData("TODO: partial completion"); } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs index c00ba7a696..380bd80f77 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs @@ -16,13 +16,13 @@ namespace CSharpBinding /// public static class ExtensionMethods { - public static async Task GetCompilationUnitAsync(this EditorRefactoringContext editorContext) + public static async Task GetSyntaxTreeAsync(this EditorRefactoringContext editorContext) { var parseInfo = (await editorContext.GetParseInformationAsync().ConfigureAwait(false)) as CSharpFullParseInformation; if (parseInfo != null) - return parseInfo.CompilationUnit; + return parseInfo.SyntaxTree; else - return new CompilationUnit(); + return new SyntaxTree(); } public static Task GetAstResolverAsync(this EditorRefactoringContext editorContext) @@ -34,7 +34,7 @@ namespace CSharpBinding if (parseInfo != null) return parseInfo.GetResolver(compilation); else - return new CSharpAstResolver(compilation, new CompilationUnit(), new CSharpParsedFile(ec.FileName)); + return new CSharpAstResolver(compilation, new SyntaxTree(), new CSharpUnresolvedFile(ec.FileName)); }); } } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs index 70867635b9..f970c5d27a 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs @@ -181,12 +181,12 @@ namespace CSharpBinding.FormattingStrategy FileName fileName = editor.FileName; IUnresolvedEntity nextElement = null; if (fileName != null) { - IParsedFile parsedFile = SD.ParserService.ParseFile(fileName, editor.Document); - if (parsedFile != null) { - var currentClass = parsedFile.GetInnermostTypeDefinition(caretLine, 0); + IUnresolvedFile unresolvedFile = SD.ParserService.ParseFile(fileName, editor.Document); + if (unresolvedFile != null) { + var currentClass = unresolvedFile.GetInnermostTypeDefinition(caretLine, 0); int nextElementLine = int.MaxValue; if (currentClass == null) { - foreach (var c in parsedFile.TopLevelTypeDefinitions) { + foreach (var c in unresolvedFile.TopLevelTypeDefinitions) { if (c.Region.BeginLine < nextElementLine && c.Region.BeginLine > caretLine) { nextElementLine = c.Region.BeginLine; nextElement = c; diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpFullParseInformation.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpFullParseInformation.cs index cf074d7a67..aeb5c10743 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpFullParseInformation.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpFullParseInformation.cs @@ -14,25 +14,25 @@ namespace CSharpBinding.Parser { public class CSharpFullParseInformation : ParseInformation { - readonly CompilationUnit compilationUnit; + readonly SyntaxTree compilationUnit; readonly ITextSourceVersion parsedVersion; - public CSharpFullParseInformation(CSharpParsedFile parsedFile, ITextSourceVersion parsedVersion, CompilationUnit compilationUnit) - : base(parsedFile, isFullParseInformation: true) + public CSharpFullParseInformation(CSharpUnresolvedFile unresolvedFile, ITextSourceVersion parsedVersion, SyntaxTree compilationUnit) + : base(unresolvedFile, isFullParseInformation: true) { - if (parsedFile == null) - throw new ArgumentNullException("parsedFile"); + if (unresolvedFile == null) + throw new ArgumentNullException("unresolvedFile"); if (compilationUnit == null) throw new ArgumentNullException("compilationUnit"); this.parsedVersion = parsedVersion; this.compilationUnit = compilationUnit; } - public new CSharpParsedFile ParsedFile { - get { return (CSharpParsedFile)base.ParsedFile; } + public new CSharpUnresolvedFile UnresolvedFile { + get { return (CSharpUnresolvedFile)base.UnresolvedFile; } } - public CompilationUnit CompilationUnit { + public SyntaxTree SyntaxTree { get { return compilationUnit; } } @@ -43,7 +43,7 @@ namespace CSharpBinding.Parser public CSharpAstResolver GetResolver(ICompilation compilation) { return (CSharpAstResolver)compilation.CacheManager.GetOrAddShared( - this, _ => new CSharpAstResolver(compilation, compilationUnit, ParsedFile) + this, _ => new CSharpAstResolver(compilation, compilationUnit, UnresolvedFile) ); } } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs index 0197555ecc..c0e9852241 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs @@ -101,7 +101,7 @@ namespace CSharpBinding ISyntaxHighlighter highlighter = null; List results = new List(); fr.FindReferencesInFile( - searchScope, parseInfo.ParsedFile, parseInfo.CompilationUnit, compilation, + searchScope, parseInfo.UnresolvedFile, parseInfo.SyntaxTree, compilation, delegate (AstNode node, ResolveResult result) { if (document == null) { document = new ReadOnlyDocument(textSource); diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs index aadd2e77c2..5619ed73a8 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs @@ -37,7 +37,7 @@ namespace CSharpBinding.Parser } /* - void RetrieveRegions(ICompilationUnit cu, ICSharpCode.NRefactory.Parser.SpecialTracker tracker) + void RetrieveRegions(ISyntaxTree cu, ICSharpCode.NRefactory.Parser.SpecialTracker tracker) { for (int i = 0; i < tracker.CurrentSpecials.Count; ++i) { ICSharpCode.NRefactory.PreprocessingDirective directive = tracker.CurrentSpecials[i] as ICSharpCode.NRefactory.PreprocessingDirective; @@ -76,10 +76,10 @@ namespace CSharpBinding.Parser CSharpParser parser = new CSharpParser(csharpProject != null ? csharpProject.CompilerSettings : null); parser.GenerateTypeSystemMode = !fullParseInformationRequested; - CompilationUnit cu = parser.Parse(fileContent, fileName); + SyntaxTree cu = parser.Parse(fileContent, fileName); cu.Freeze(); - CSharpParsedFile file = cu.ToTypeSystem(); + CSharpUnresolvedFile file = cu.ToTypeSystem(); ParseInformation parseInfo; if (fullParseInformationRequested) @@ -92,7 +92,7 @@ namespace CSharpBinding.Parser return parseInfo; } - void AddCommentTags(CompilationUnit cu, IList tagComments, ITextSource fileContent) + void AddCommentTags(SyntaxTree cu, IList tagComments, ITextSource fileContent) { ReadOnlyDocument document = null; foreach (var comment in cu.Descendants.OfType().Where(c => c.CommentType != CommentType.InactiveCode)) { @@ -125,22 +125,22 @@ namespace CSharpBinding.Parser { var csParseInfo = parseInfo as CSharpFullParseInformation; if (csParseInfo == null) - throw new ArgumentException("Parse info does not have CompilationUnit"); + throw new ArgumentException("Parse info does not have SyntaxTree"); - return ResolveAtLocation.Resolve(compilation, csParseInfo.ParsedFile, csParseInfo.CompilationUnit, location, cancellationToken); + return ResolveAtLocation.Resolve(compilation, csParseInfo.UnresolvedFile, csParseInfo.SyntaxTree, location, cancellationToken); } public void FindLocalReferences(ParseInformation parseInfo, ITextSource fileContent, IVariable variable, ICompilation compilation, Action callback, CancellationToken cancellationToken) { var csParseInfo = parseInfo as CSharpFullParseInformation; if (csParseInfo == null) - throw new ArgumentException("Parse info does not have CompilationUnit"); + throw new ArgumentException("Parse info does not have SyntaxTree"); ReadOnlyDocument document = null; ISyntaxHighlighter highlighter = null; new FindReferences().FindLocalReferences( - variable, csParseInfo.ParsedFile, csParseInfo.CompilationUnit, compilation, + variable, csParseInfo.UnresolvedFile, csParseInfo.SyntaxTree, compilation, delegate (AstNode node, ResolveResult result) { if (document == null) { document = new ReadOnlyDocument(fileContent); @@ -164,11 +164,11 @@ namespace CSharpBinding.Parser return assemblies.Select(asm => new CecilLoader().LoadAssemblyFile(asm.Location)).ToArray(); }); - public ICompilation CreateCompilationForSingleFile(FileName fileName, IParsedFile parsedFile) + public ICompilation CreateCompilationForSingleFile(FileName fileName, IUnresolvedFile unresolvedFile) { return new CSharpProjectContent() .AddAssemblyReferences(defaultReferences.Value) - .UpdateProjectContent(null, parsedFile) + .UpdateProjectContent(null, unresolvedFile) .CreateCompilation(); } @@ -176,16 +176,16 @@ namespace CSharpBinding.Parser { var csParseInfo = parseInfo as CSharpFullParseInformation; if (csParseInfo == null) - throw new ArgumentException("Parse info does not have CompilationUnit"); - CSharpAstResolver contextResolver = new CSharpAstResolver(compilation, csParseInfo.CompilationUnit, csParseInfo.ParsedFile); - var node = csParseInfo.CompilationUnit.GetNodeAt(location); + throw new ArgumentException("Parse info does not have SyntaxTree"); + CSharpAstResolver contextResolver = new CSharpAstResolver(compilation, csParseInfo.SyntaxTree, csParseInfo.UnresolvedFile); + var node = csParseInfo.SyntaxTree.GetNodeAt(location); CSharpResolver context; if (node != null) context = contextResolver.GetResolverStateAfter(node, cancellationToken); else context = new CSharpResolver(compilation); CSharpParser parser = new CSharpParser(); - var expr = parser.ParseExpression(new StringReader(codeSnippet)); + var expr = parser.ParseExpression(codeSnippet); if (parser.HasErrors) return new ErrorResolveResult(SpecialType.UnknownType, PrintErrorsAsString(parser.Errors), TextLocation.Empty); CSharpAstResolver snippetResolver = new CSharpAstResolver(context, expr); diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/VBNetToCSharpConverter.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/VBNetToCSharpConverter.cs index 4ab90e3434..7fb28edc07 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/VBNetToCSharpConverter.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/VBNetToCSharpConverter.cs @@ -64,7 +64,7 @@ namespace CSharpBinding v => v.Replace(ProjectTypeGuids.VBNet, ProjectTypeGuids.CSharp, StringComparison.OrdinalIgnoreCase)); } - protected override void ConvertAst(CompilationUnit compilationUnit, List specials, FileProjectItem sourceItem) + protected override void ConvertAst(SyntaxTree compilationUnit, List specials, FileProjectItem sourceItem) { PreprocessingDirective.VBToCSharp(specials); CompilableProject project = (CompilableProject)sourceItem.Project; @@ -82,7 +82,7 @@ namespace CSharpBinding compilationUnit.AcceptVisitor(visitor, null); } - void RemoveWindowsFormsSpecificCode(CompilationUnit compilationUnit, List specials, bool keepCode) + void RemoveWindowsFormsSpecificCode(SyntaxTree compilationUnit, List specials, bool keepCode) { for (int i = 0; i < specials.Count; i++) { PreprocessingDirective ppd = specials[i] as PreprocessingDirective; diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/SDScript.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/SDScript.cs index 378c9018c9..3948cb1581 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/SDScript.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/SDScript.cs @@ -49,9 +49,9 @@ namespace CSharpBinding.Refactoring if (parseInfo != null) { //var startLocation = editor.Document.GetLocation(offset); //var endLocation = editor.Document.GetLocation(offset + length); - //var node = parseInfo.CompilationUnit.GetNodeContaining(startLocation, endLocation); + //var node = parseInfo.SyntaxTree.GetNodeContaining(startLocation, endLocation); var formatter = new AstFormattingVisitor(FormattingOptionsFactory.CreateSharpDevelop(), editor.Document, context.TextEditorOptions); - parseInfo.CompilationUnit.AcceptVisitor(formatter); + parseInfo.SyntaxTree.AcceptVisitor(formatter); var segment = GetSegment(node); formatter.ApplyChanges(segment.Offset, segment.Length); } else { @@ -93,7 +93,7 @@ namespace CSharpBinding.Refactoring { if (parentType == null) return completedTask; - var currentPart = parentType.Parts.FirstOrDefault(p => p.ParsedFile != null && string.Equals(p.ParsedFile.FileName, editor.FileName, StringComparison.OrdinalIgnoreCase)); + var currentPart = parentType.Parts.FirstOrDefault(p => p.UnresolvedFile != null && string.Equals(p.UnresolvedFile.FileName, editor.FileName, StringComparison.OrdinalIgnoreCase)); if (currentPart != null) { var insertionPoints = InsertionPoint.GetInsertionPoints(editor.Document, currentPart); if (insertionPoints.Count > 0) { diff --git a/src/AddIns/BackendBindings/CSharpBinding/Tests/OverrideCompletionTests.cs b/src/AddIns/BackendBindings/CSharpBinding/Tests/OverrideCompletionTests.cs index c49209d9ec..8b22b89820 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Tests/OverrideCompletionTests.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Tests/OverrideCompletionTests.cs @@ -55,7 +55,7 @@ class DerivedClass : BaseClass { textEditor.Document.Text = programStart + "override " + programEnd; textEditor.Caret.Offset = programStart.Length + "override ".Length; var parseInfo = textEditor.CreateParseInformation(); - var pc = new CSharpProjectContent().UpdateProjectContent(null, parseInfo.ParsedFile); + var pc = new CSharpProjectContent().UpdateProjectContent(null, parseInfo.UnresolvedFile); pc = pc.AddAssemblyReferences(new[] { Corlib }); var compilation = pc.CreateCompilation(); SD.Services.AddService(typeof(IParserService), MockRepository.GenerateStrictMock()); diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCompletionItemList.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCompletionItemList.cs index 23589a8137..691c7948bb 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCompletionItemList.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCompletionItemList.cs @@ -144,7 +144,7 @@ namespace ICSharpCode.XamlBinding // static bool CreateEventHandlerCode(CompletionContext context, NewEventCompletionItem completionItem, out int discriminator) // { // ParseInformation p = ParserService.GetParseInformation(context.Editor.FileName); -// var unit = p.CompilationUnit; +// var unit = p.SyntaxTree; // var loc = context.Editor.Document.OffsetToPosition(context.StartOffset); // IClass c = unit.GetInnermostClass(loc.Line, loc.Column); // @@ -188,7 +188,7 @@ namespace ICSharpCode.XamlBinding // // node.Modifier = Modifiers.None; // -// IViewContent viewContent = FileService.OpenFile(part.CompilationUnit.FileName, XamlBindingOptions.SwitchToCodeViewAfterInsertion); +// IViewContent viewContent = FileService.OpenFile(part.SyntaxTree.FileName, XamlBindingOptions.SwitchToCodeViewAfterInsertion); // IFileDocumentProvider document = viewContent as IFileDocumentProvider; // // if (viewContent != null && document != null) { diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlFullParseInformation.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlFullParseInformation.cs index fbf9949ff3..387dd3c49c 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlFullParseInformation.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlFullParseInformation.cs @@ -13,11 +13,11 @@ namespace ICSharpCode.XamlBinding readonly AXmlDocument document; readonly ITextSource text; - public XamlFullParseInformation(XamlParsedFile parsedFile, AXmlDocument document, ITextSource text) - : base(parsedFile, true) + public XamlFullParseInformation(XamlUnresolvedFile unresolvedFile, AXmlDocument document, ITextSource text) + : base(unresolvedFile, true) { - if (parsedFile == null) - throw new ArgumentNullException("parsedFile"); + if (unresolvedFile == null) + throw new ArgumentNullException("unresolvedFile"); if (document == null) throw new ArgumentNullException("document"); if (text == null) @@ -26,8 +26,8 @@ namespace ICSharpCode.XamlBinding this.text = text; } - public new XamlParsedFile ParsedFile { - get { return (XamlParsedFile)base.ParsedFile; } + public new XamlUnresolvedFile UnresolvedFile { + get { return (XamlUnresolvedFile)base.UnresolvedFile; } } public AXmlDocument Document { diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlOutlineContentHost.xaml.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlOutlineContentHost.xaml.cs index a3d6683197..39fcb6c32f 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlOutlineContentHost.xaml.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlOutlineContentHost.xaml.cs @@ -36,7 +36,7 @@ namespace ICSharpCode.XamlBinding return; #warning Reimplement XAML outline -// var cu = e.NewCompilationUnit as XamlCompilationUnit; +// var cu = e.NewSyntaxTree as XamlSyntaxTree; // // if (cu != null && cu.TreeRootNode != null) // UpdateTree(cu.TreeRootNode); diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlParsedFile.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlParsedFile.cs index 4b50ca21b4..8918e96467 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlParsedFile.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlParsedFile.cs @@ -22,23 +22,23 @@ using ICSharpCode.SharpDevelop.Refactoring; namespace ICSharpCode.XamlBinding { - public sealed class XamlParsedFile : IParsedFile + public sealed class XamlUnresolvedFile : IUnresolvedFile { FileName fileName; AXmlDocument document; List errors; IUnresolvedTypeDefinition[] topLevel; - XamlParsedFile(FileName fileName, AXmlDocument document) + XamlUnresolvedFile(FileName fileName, AXmlDocument document) { this.fileName = fileName; this.document = document; this.errors = new List(); } - public static XamlParsedFile Create(FileName fileName, ITextSource fileContent, AXmlDocument document) + public static XamlUnresolvedFile Create(FileName fileName, ITextSource fileContent, AXmlDocument document) { - XamlParsedFile file = new XamlParsedFile(fileName, document); + XamlUnresolvedFile file = new XamlUnresolvedFile(fileName, document); file.errors.AddRange(document.SyntaxErrors.Select(err => new Error(ErrorType.Error, err.Description))); var visitor = new XamlDocumentVisitor(file, fileContent); @@ -114,11 +114,11 @@ namespace ICSharpCode.XamlBinding { public DefaultUnresolvedTypeDefinition TypeDefinition { get; private set; } - IParsedFile file; + IUnresolvedFile file; AXmlDocument currentDocument; ReadOnlyDocument textDocument; - public XamlDocumentVisitor(IParsedFile file, ITextSource fileContent) + public XamlDocumentVisitor(IUnresolvedFile file, ITextSource fileContent) { this.file = file; textDocument = new ReadOnlyDocument(fileContent); @@ -133,7 +133,7 @@ namespace ICSharpCode.XamlBinding if (className != null) { TypeDefinition = new DefaultUnresolvedTypeDefinition(className) { Kind = TypeKind.Class, - ParsedFile = file, + UnresolvedFile = file, Region = new DomRegion(file.FileName, textDocument.GetLocation(rootElement.StartOffset), textDocument.GetLocation(rootElement.EndOffset)) }; TypeDefinition.Members.Add( diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlParser.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlParser.cs index 77c327efe5..5457f04645 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlParser.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlParser.cs @@ -63,12 +63,12 @@ namespace ICSharpCode.XamlBinding document = parser.ParseIncremental(parserState, fileContent, out newParserState, cancellationToken); } parserState = newParserState; - XamlParsedFile parsedFile = XamlParsedFile.Create(fileName, fileContent, document); + XamlUnresolvedFile unresolvedFile = XamlUnresolvedFile.Create(fileName, fileContent, document); ParseInformation parseInfo; if (fullParseInformationRequested) - parseInfo = new XamlFullParseInformation(parsedFile, document, fileContent); + parseInfo = new XamlFullParseInformation(unresolvedFile, document, fileContent); else - parseInfo = new ParseInformation(parsedFile, false); + parseInfo = new ParseInformation(unresolvedFile, false); AddTagComments(document, parseInfo, fileContent); return parseInfo; } @@ -105,7 +105,7 @@ namespace ICSharpCode.XamlBinding throw new NotImplementedException(); } - public ICompilation CreateCompilationForSingleFile(FileName fileName, IParsedFile parsedFile) + public ICompilation CreateCompilationForSingleFile(FileName fileName, IUnresolvedFile unresolvedFile) { // TODO: create a simple compilation with WPF references? return null; diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlResolver.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlResolver.cs index 21cd6c4f51..b12cfd287d 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlResolver.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlResolver.cs @@ -136,7 +136,7 @@ namespace ICSharpCode.XamlBinding ResolveResult ResolveAttributeValue(IMember propertyOrEvent, AXmlAttribute attribute) { - IType type = parseInfo.ParsedFile.GetTopLevelTypeDefinition(location).Resolve(new SimpleTypeResolveContext(compilation.MainAssembly)); + IType type = parseInfo.UnresolvedFile.GetTopLevelTypeDefinition(location).Resolve(new SimpleTypeResolveContext(compilation.MainAssembly)); if (propertyOrEvent is IEvent) { var memberLookup = new MemberLookup(type.GetDefinition(), compilation.MainAssembly); var rr = memberLookup.Lookup(new ThisResolveResult(type), attribute.Value, EmptyList.Instance, false); diff --git a/src/AddIns/Debugger/Debugger.Tests/Tests/ExpressionEvaluatorVisitor_Tests.cs b/src/AddIns/Debugger/Debugger.Tests/Tests/ExpressionEvaluatorVisitor_Tests.cs index c1d3f33ab3..1a6907e739 100644 --- a/src/AddIns/Debugger/Debugger.Tests/Tests/ExpressionEvaluatorVisitor_Tests.cs +++ b/src/AddIns/Debugger/Debugger.Tests/Tests/ExpressionEvaluatorVisitor_Tests.cs @@ -320,7 +320,7 @@ namespace Debugger.Tests else context = new CSharpResolver(compilation); CSharpParser parser = new CSharpParser(); - var expr = parser.ParseExpression(new StringReader(codeSnippet)); + var expr = parser.ParseExpression(codeSnippet); Assert.IsFalse(parser.HasErrors); CSharpAstResolver snippetResolver = new CSharpAstResolver(context, expr); return snippetResolver.Resolve(expr, CancellationToken.None); diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs index ff27f472a8..4da018d6bb 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs @@ -595,14 +595,14 @@ namespace ICSharpCode.AvalonEdit.AddIn if (parseInfo != null && CodeEditorOptions.Instance.EnableQuickClassBrowser) { // don't create quickClassBrowser for files that don't have any classes // (but do keep the quickClassBrowser when the last class is removed from a file) - if (quickClassBrowser != null || parseInfo.ParsedFile.TopLevelTypeDefinitions.Count > 0) { + if (quickClassBrowser != null || parseInfo.UnresolvedFile.TopLevelTypeDefinitions.Count > 0) { if (quickClassBrowser == null) { quickClassBrowser = new QuickClassBrowser(); quickClassBrowser.JumpAction = (line, col) => ActiveTextEditor.JumpTo(line, col); SetRow(quickClassBrowser, 0); this.Children.Add(quickClassBrowser); } - quickClassBrowser.Update(parseInfo.ParsedFile); + quickClassBrowser.Update(parseInfo.UnresolvedFile); quickClassBrowser.SelectItemAtCaretPosition(this.ActiveTextEditor.TextArea.Caret.Location); } } else { @@ -611,7 +611,7 @@ namespace ICSharpCode.AvalonEdit.AddIn quickClassBrowser = null; } } - iconBarManager.UpdateClassMemberBookmarks(parseInfo != null ? parseInfo.ParsedFile : null, document); + iconBarManager.UpdateClassMemberBookmarks(parseInfo != null ? parseInfo.UnresolvedFile : null, document); primaryTextEditor.UpdateParseInformationForFolding(parseInfo); if (secondaryTextEditor != null) secondaryTextEditor.UpdateParseInformationForFolding(parseInfo); diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/IconBarManager.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/IconBarManager.cs index 32034ce9f9..967a4c71c6 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/IconBarManager.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/IconBarManager.cs @@ -42,7 +42,7 @@ namespace ICSharpCode.AvalonEdit.AddIn public event EventHandler RedrawRequested; - public void UpdateClassMemberBookmarks(IParsedFile parseInfo, IDocument document) + public void UpdateClassMemberBookmarks(IUnresolvedFile parseInfo, IDocument document) { for (int i = bookmarks.Count - 1; i >= 0; i--) { if (bookmarks[i] is EntityBookmark) diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ParserFoldingStrategy.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ParserFoldingStrategy.cs index 16c64b45f5..f10d50ada4 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ParserFoldingStrategy.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ParserFoldingStrategy.cs @@ -52,7 +52,7 @@ namespace ICSharpCode.AvalonEdit.AddIn { List newFoldMarkers = new List(); if (parseInfo != null) { - foreach (var c in parseInfo.ParsedFile.TopLevelTypeDefinitions) { + foreach (var c in parseInfo.UnresolvedFile.TopLevelTypeDefinitions) { AddClassMembers(c, newFoldMarkers); } #warning Additional folding regions diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/QuickClassBrowser.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/QuickClassBrowser.cs index 63132b02d1..9ec8883b9b 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/QuickClassBrowser.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/QuickClassBrowser.cs @@ -117,7 +117,7 @@ namespace ICSharpCode.AvalonEdit.AddIn /// This causes the classes combo box to lose its current selection, /// so the members combo box will be cleared. /// - public void Update(IParsedFile compilationUnit) + public void Update(IUnresolvedFile compilationUnit) { runUpdateWhenDropDownClosed = true; runUpdateWhenDropDownClosedCU = compilationUnit; @@ -130,7 +130,7 @@ namespace ICSharpCode.AvalonEdit.AddIn List classItems = new List(); List memberItems = new List(); - void DoUpdate(IParsedFile compilationUnit) + void DoUpdate(IUnresolvedFile compilationUnit) { classItems = new List(); if (compilationUnit != null) { @@ -146,7 +146,7 @@ namespace ICSharpCode.AvalonEdit.AddIn // Delayed execution - avoid changing combo boxes while the user is browsing the dropdown list. bool runUpdateWhenDropDownClosed; - IParsedFile runUpdateWhenDropDownClosedCU; + IUnresolvedFile runUpdateWhenDropDownClosedCU; bool runSelectItemWhenDropDownClosed; TextLocation runSelectItemWhenDropDownClosedLocation; @@ -242,7 +242,7 @@ namespace ICSharpCode.AvalonEdit.AddIn IUnresolvedTypeDefinition selectedClass = item != null ? item.Entity as IUnresolvedTypeDefinition : null; memberItems = new List(); if (selectedClass != null) { - ICompilation compilation = SD.ParserService.GetCompilationForFile(FileName.Create(selectedClass.ParsedFile.FileName)); + ICompilation compilation = SD.ParserService.GetCompilationForFile(FileName.Create(selectedClass.UnresolvedFile.FileName)); var context = new SimpleTypeResolveContext(compilation.MainAssembly); ITypeDefinition compoundClass = selectedClass.Resolve(context).GetDefinition(); if (compoundClass != null) { @@ -250,7 +250,7 @@ namespace ICSharpCode.AvalonEdit.AddIn foreach (var member in compoundClass.Members) { if (member.IsSynthetic) continue; - bool isInSamePart = string.Equals(member.UnresolvedMember.ParsedFile.FileName, selectedClass.ParsedFile.FileName, StringComparison.OrdinalIgnoreCase); + bool isInSamePart = string.Equals(member.UnresolvedMember.UnresolvedFile.FileName, selectedClass.UnresolvedFile.FileName, StringComparison.OrdinalIgnoreCase); memberItems.Add(new EntityItem(member, ambience) { IsInSamePart = isInSamePart }); } memberItems.Sort(); diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Snippets/CodeSnippet.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Snippets/CodeSnippet.cs index 7b22bd779f..9ce1e62e88 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Snippets/CodeSnippet.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Snippets/CodeSnippet.cs @@ -199,7 +199,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.Snippets static IUnresolvedTypeDefinition GetCurrentClass(ITextEditor editor) { - var parseInfo = SD.ParserService.GetExistingParsedFile(editor.FileName); + var parseInfo = SD.ParserService.GetExistingUnresolvedFile(editor.FileName); if (parseInfo != null) { return parseInfo.GetInnermostTypeDefinition(editor.Caret.Location); } diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockDocument.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockDocument.cs index 0878c3dd62..9d5cc4a1df 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockDocument.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockDocument.cs @@ -238,5 +238,15 @@ namespace XmlEditor.Tests.Utils { throw new NotImplementedException(); } + + public void WriteTextTo(TextWriter writer) + { + throw new NotImplementedException(); + } + + public void WriteTextTo(TextWriter writer, int offset, int length) + { + throw new NotImplementedException(); + } } } diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs index a33e1cf19d..5cf49db06f 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs @@ -136,5 +136,17 @@ namespace ICSharpCode.AvalonEdit.Document { return rope.LastIndexOf(searchText, startIndex, count, comparisonType); } + + /// + public void WriteTextTo(TextWriter writer) + { + rope.WriteTo(writer, 0, rope.Length); + } + + /// + public void WriteTextTo(TextWriter writer, int offset, int length) + { + rope.WriteTo(writer, offset, length); + } } } diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs index 454124df12..083ce59e37 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs @@ -370,6 +370,18 @@ namespace ICSharpCode.AvalonEdit.Document return new RopeTextReader(rope.GetRange(offset, length)); } } + + public void WriteTextTo(System.IO.TextWriter writer) + { + VerifyAccess(); + rope.WriteTo(writer, 0, rope.Length); + } + + public void WriteTextTo(System.IO.TextWriter writer, int offset, int length) + { + VerifyAccess(); + rope.WriteTo(writer, offset, length); + } #endregion #region BeginUpdate / EndUpdate diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/CharRope.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/CharRope.cs index a35e957b92..37514daa09 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/CharRope.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/CharRope.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.IO; using System.Text; namespace ICSharpCode.AvalonEdit.Utils @@ -42,14 +43,14 @@ namespace ICSharpCode.AvalonEdit.Utils } /// - /// Retrieves the text for a portion of the rope and writes it to the specified string builder. + /// Retrieves the text for a portion of the rope and writes it to the specified text writer. /// Runs in O(lg N + M), where M=. /// /// offset or length is outside the valid range. /// /// This method counts as a read access and may be called concurrently to other read accesses. /// - public static void WriteTo(this Rope rope, StringBuilder output, int startIndex, int length) + public static void WriteTo(this Rope rope, TextWriter output, int startIndex, int length) { if (rope == null) throw new ArgumentNullException("rope"); @@ -111,7 +112,7 @@ namespace ICSharpCode.AvalonEdit.Utils } } - internal static void WriteTo(this RopeNode node, int index, StringBuilder output, int count) + internal static void WriteTo(this RopeNode node, int index, TextWriter output, int count) { if (node.height == 0) { if (node.contents == null) { @@ -119,7 +120,7 @@ namespace ICSharpCode.AvalonEdit.Utils node.GetContentNode().WriteTo(index, output, count); } else { // leaf node: append data - output.Append(node.contents, index, count); + output.Write(node.contents, index, count); } } else { // concat node: do recursive calls diff --git a/src/Libraries/NRefactory/.gitignore b/src/Libraries/NRefactory/.gitignore index 1027b084e5..0031dcbe29 100644 --- a/src/Libraries/NRefactory/.gitignore +++ b/src/Libraries/NRefactory/.gitignore @@ -1,3 +1,5 @@ +bin +obj /lib/*.dll /ICSharpCode.NRefactory.Tests/PartCover/* _ReSharper*/* diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.AstVerifier/.gitignore b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.AstVerifier/.gitignore deleted file mode 100644 index 9ce745d95d..0000000000 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.AstVerifier/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -bin/ -obj/ \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.AstVerifier/ICSharpCode.NRefactory.CSharp.AstVerifier.csproj b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.AstVerifier/ICSharpCode.NRefactory.CSharp.AstVerifier.csproj index bd6e1e8230..b75da9acdb 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.AstVerifier/ICSharpCode.NRefactory.CSharp.AstVerifier.csproj +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.AstVerifier/ICSharpCode.NRefactory.CSharp.AstVerifier.csproj @@ -1,49 +1,69 @@ - - - - Debug - AnyCPU - 10.0.0 - 2.0 - {961DADFA-7CE6-429F-BC22-47630D6DB826} - Exe - ICSharpCode.NRefactory.CSharp.AstVerifier - AstVerifier - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - true - - - none - false - bin\Release - prompt - 4 - true - - - - - - - - - - - - {53DCA265-3C3C-42F9-B647-F72BA678122B} - ICSharpCode.NRefactory.CSharp - - - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} - ICSharpCode.NRefactory - - + + + + Debug + AnyCPU + 10.0.0 + 2.0 + {961DADFA-7CE6-429F-BC22-47630D6DB826} + Exe + ICSharpCode.NRefactory.CSharp.AstVerifier + AstVerifier + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + + + none + false + bin\Release + prompt + 4 + true + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + v4.5 + + + none + false + bin\Release + prompt + 4 + true + v4.5 + + + + + + + + + + + + {53DCA265-3C3C-42F9-B647-F72BA678122B} + ICSharpCode.NRefactory.CSharp + + + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} + ICSharpCode.NRefactory + + \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.AstVerifier/Main.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.AstVerifier/Main.cs index 43d3531b7f..54ac57b80a 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.AstVerifier/Main.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.AstVerifier/Main.cs @@ -59,7 +59,7 @@ namespace ICSharpCode.NRefactory.CSharp.AstVerifier if (!file.EndsWith (".cs")) continue; string text = File.ReadAllText (file); - var unit = CompilationUnit.Parse (text, file); + var unit = SyntaxTree.Parse (text, file); if (unit == null) continue; string generated = unit.GetText (); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/.gitignore b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/.gitignore deleted file mode 100644 index 9ce745d95d..0000000000 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -bin/ -obj/ \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Analysis/DefiniteAssignmentAnalysis.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Analysis/DefiniteAssignmentAnalysis.cs index fa3ca39144..0e2ad2b896 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Analysis/DefiniteAssignmentAnalysis.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Analysis/DefiniteAssignmentAnalysis.cs @@ -443,7 +443,7 @@ namespace ICSharpCode.NRefactory.CSharp.Analysis // the special values are valid as output only, not as input Debug.Assert(data == CleanSpecialValues(data)); DefiniteAssignmentStatus status = data; - foreach (AstNode child in node.Children) { + for (AstNode child = node.FirstChild; child != null; child = child.NextSibling) { analysis.analysisCancellationToken.ThrowIfCancellationRequested(); Debug.Assert(!(child is Statement)); // statements are visited with the CFG, not with the visitor pattern diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs index 3f9f86bb78..5d73c90db5 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs @@ -1,4 +1,4 @@ -// +// // AstNode.cs // // Author: @@ -23,6 +23,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + using System; using System.Collections; using System.Collections.Generic; @@ -194,13 +195,13 @@ namespace ICSharpCode.NRefactory.CSharp /// /// Gets the region from StartLocation to EndLocation for this node. - /// The file name of the region is set based on the parent CompilationUnit's file name. + /// The file name of the region is set based on the parent SyntaxTree's file name. /// If this node is not connected to a whole compilation, the file name will be null. /// public ICSharpCode.NRefactory.TypeSystem.DomRegion GetRegion() { - var cu = (this.Ancestors.LastOrDefault() ?? this) as CompilationUnit; - string fileName = (cu != null ? cu.FileName : null); + var syntaxTree = (this.Ancestors.LastOrDefault() ?? this) as SyntaxTree; + string fileName = (syntaxTree != null ? syntaxTree.FileName : null); return new ICSharpCode.NRefactory.TypeSystem.DomRegion(fileName, this.StartLocation, this.EndLocation); } @@ -288,17 +289,31 @@ namespace ICSharpCode.NRefactory.CSharp /// Gets all descendants of this node (excluding this node itself). /// public IEnumerable Descendants { - get { - return Utils.TreeTraversal.PreOrder (this.Children, n => n.Children); - } + get { return GetDescendants(false); } } /// /// Gets all descendants of this node (including this node itself). /// public IEnumerable DescendantsAndSelf { - get { - return Utils.TreeTraversal.PreOrder (this, n => n.Children); + get { return GetDescendants(true); } + } + + IEnumerable GetDescendants(bool includeSelf) + { + if (includeSelf) + yield return this; + Stack nextStack = new Stack(); + nextStack.Push(null); + AstNode pos = firstChild; + while (pos != null) { + if (pos.nextSibling != null) + nextStack.Push(pos.nextSibling); + yield return pos; + if (pos.firstChild != null) + pos = pos.firstChild; + else + pos = nextStack.Pop(); } } @@ -322,7 +337,7 @@ namespace ICSharpCode.NRefactory.CSharp { return Ancestors.OfType().FirstOrDefault(); } - + public AstNodeCollection GetChildrenByRole (Role role) where T : AstNode { return new AstNodeCollection (this, role); @@ -367,13 +382,6 @@ namespace ICSharpCode.NRefactory.CSharp } } - public void InsertChildsBefore(AstNode nextSibling, Role role, params T[] child) where T : AstNode - { - foreach (var cur in child) { - InsertChildBefore(nextSibling, cur, role); - } - } - public void InsertChildBefore (AstNode nextSibling, T child, Role role) where T : AstNode { if (role == null) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/DepthFirstAstVisitor.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/DepthFirstAstVisitor.cs index 68bce6c35b..81982caf52 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/DepthFirstAstVisitor.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/DepthFirstAstVisitor.cs @@ -44,9 +44,9 @@ namespace ICSharpCode.NRefactory.CSharp } } - public virtual void VisitCompilationUnit (CompilationUnit unit) + public virtual void VisitSyntaxTree (SyntaxTree syntaxTree) { - VisitChildren (unit); + VisitChildren (syntaxTree); } public virtual void VisitComment(Comment comment) @@ -642,7 +642,7 @@ namespace ICSharpCode.NRefactory.CSharp return default (T); } - public virtual T VisitCompilationUnit (CompilationUnit unit) + public virtual T VisitSyntaxTree (SyntaxTree unit) { return VisitChildren (unit); } @@ -1240,7 +1240,7 @@ namespace ICSharpCode.NRefactory.CSharp return default (S); } - public virtual S VisitCompilationUnit (CompilationUnit unit, T data) + public virtual S VisitSyntaxTree (SyntaxTree unit, T data) { return VisitChildren (unit, data); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ArrayInitializerExpression.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ArrayInitializerExpression.cs index ec01a9e406..0bfc1c1d76 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ArrayInitializerExpression.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ArrayInitializerExpression.cs @@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.CSharp public class ArrayInitializerExpression : Expression { /// - /// For ease of use purposes in the resolver the ast representation + /// For ease of use purposes in the resolver the ast representation /// of { a, b, c } is { {a}, {b}, {c} }. /// If IsSingleElement is true then this array initializer expression is a generated one. /// That has no meaning in the source code (and contains no brace tokens). @@ -73,7 +73,7 @@ namespace ICSharpCode.NRefactory.CSharp public override void AcceptVisitor (IAstVisitor visitor) { } - + public override T AcceptVisitor (IAstVisitor visitor) { return default (T); @@ -107,7 +107,7 @@ namespace ICSharpCode.NRefactory.CSharp { visitor.VisitArrayInitializerExpression (this); } - + public override T AcceptVisitor (IAstVisitor visitor) { return visitor.VisitArrayInitializerExpression (this); @@ -138,8 +138,54 @@ namespace ICSharpCode.NRefactory.CSharp return true; } } - + + } + + #region PatternPlaceholder + public static implicit operator ArrayInitializerExpression(PatternMatching.Pattern pattern) + { + return pattern != null ? new PatternPlaceholder(pattern) : null; + } + + sealed class PatternPlaceholder : ArrayInitializerExpression, PatternMatching.INode + { + readonly PatternMatching.Pattern child; + + public PatternPlaceholder(PatternMatching.Pattern child) + { + this.child = child; + } + + public override NodeType NodeType { + get { return NodeType.Pattern; } + } + + public override void AcceptVisitor (IAstVisitor visitor) + { + visitor.VisitPatternPlaceholder(this, child); + } + + public override T AcceptVisitor (IAstVisitor visitor) + { + return visitor.VisitPatternPlaceholder(this, child); + } + + public override S AcceptVisitor(IAstVisitor visitor, T data) + { + return visitor.VisitPatternPlaceholder(this, child, data); + } + + protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) + { + return child.DoMatch(other, match); + } + + bool PatternMatching.INode.DoMatchCollection(Role role, PatternMatching.INode pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) + { + return child.DoMatchCollection(role, pos, match, backtrackingInfo); + } } + #endregion } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/NamespaceDeclaration.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/NamespaceDeclaration.cs index 01198222b4..a374f490d7 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/NamespaceDeclaration.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/NamespaceDeclaration.cs @@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.CSharp /// public class NamespaceDeclaration : AstNode { - public static readonly Role MemberRole = CompilationUnit.MemberRole; + public static readonly Role MemberRole = SyntaxTree.MemberRole; public override NodeType NodeType { get { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/IAstVisitor.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/IAstVisitor.cs index 58836e655d..c375afacfb 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/IAstVisitor.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/IAstVisitor.cs @@ -129,7 +129,7 @@ namespace ICSharpCode.NRefactory.CSharp void VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration); void VisitFixedVariableInitializer(FixedVariableInitializer fixedVariableInitializer); - void VisitCompilationUnit(CompilationUnit compilationUnit); + void VisitSyntaxTree(SyntaxTree syntaxTree); void VisitSimpleType(SimpleType simpleType); void VisitMemberType(MemberType memberType); void VisitComposedType(ComposedType composedType); @@ -260,7 +260,7 @@ namespace ICSharpCode.NRefactory.CSharp S VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration); S VisitFixedVariableInitializer(FixedVariableInitializer fixedVariableInitializer); - S VisitCompilationUnit(CompilationUnit compilationUnit); + S VisitSyntaxTree(SyntaxTree syntaxTree); S VisitSimpleType(SimpleType simpleType); S VisitMemberType(MemberType memberType); S VisitComposedType(ComposedType composedType); @@ -391,7 +391,7 @@ namespace ICSharpCode.NRefactory.CSharp S VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration, T data); S VisitFixedVariableInitializer(FixedVariableInitializer fixedVariableInitializer, T data); - S VisitCompilationUnit(CompilationUnit compilationUnit, T data); + S VisitSyntaxTree(SyntaxTree syntaxTree, T data); S VisitSimpleType(SimpleType simpleType, T data); S VisitMemberType(MemberType memberType, T data); S VisitComposedType(ComposedType composedType, T data); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/ObservableAstVisitor.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/ObservableAstVisitor.cs index 3d47dd81fc..3291bccf7b 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/ObservableAstVisitor.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/ObservableAstVisitor.cs @@ -1,6 +1,6 @@ // // ObservableAstVisitor.cs -// +// // Author: // Mike Krüger // @@ -23,1178 +23,834 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + using System; namespace ICSharpCode.NRefactory.CSharp { - public class ObservableAstVisitor: IAstVisitor + public class ObservableAstVisitor : IAstVisitor { - S VisitChildren (AstNode node, T data) + void Visit(Action enter, Action leave, T node) where T : AstNode { + if (enter != null) + enter(node); AstNode next; for (var child = node.FirstChild; child != null; child = next) { // Store next to allow the loop to continue - // if the visitor removes/replaces child. + // if the visitor removes/replaces children. next = child.NextSibling; - child.AcceptVisitor (this, data); + child.AcceptVisitor (this); } - return default (S); + if (leave != null) + leave(node); } - public event Action CompilationUnitVisited; - - S IAstVisitor.VisitCompilationUnit (CompilationUnit unit, T data) + public event Action EnterSyntaxTree, LeaveSyntaxTree; + + void IAstVisitor.VisitSyntaxTree(SyntaxTree unit) { - var handler = CompilationUnitVisited; - if (handler != null) - handler (unit, data); - return VisitChildren (unit, data); + Visit(EnterSyntaxTree, LeaveSyntaxTree, unit); } - public event Action CommentVisited; - - S IAstVisitor.VisitComment (Comment comment, T data) + public event Action EnterComment, LeaveComment; + + void IAstVisitor.VisitComment(Comment comment) { - var handler = CommentVisited; - if (handler != null) - handler (comment, data); - return VisitChildren (comment, data); + Visit(EnterComment, LeaveComment, comment); } - - public event Action NewLineVisited; - - S IAstVisitor.VisitNewLine(NewLineNode newLineNode, T data) + + public event Action EnterNewLine, LeaveNewLine; + + void IAstVisitor.VisitNewLine(NewLineNode newLineNode) { - var handler = NewLineVisited; - if (handler != null) - handler(newLineNode, data); - return VisitChildren(newLineNode, data); + Visit(EnterNewLine, LeaveNewLine, newLineNode); } - - public event Action WhitespaceVisited; - - S IAstVisitor.VisitWhitespace(WhitespaceNode whitespace, T data) + + public event Action EnterWhitespace, LeaveWhitespace; + + void IAstVisitor.VisitWhitespace(WhitespaceNode whitespace) { - var handler = WhitespaceVisited; - if (handler != null) - handler(whitespace, data); - return VisitChildren(whitespace, data); + Visit(EnterWhitespace, LeaveWhitespace, whitespace); } - - public event Action TextVisited; - - S IAstVisitor.VisitText(TextNode textNode, T data) + + public event Action EnterText, LeaveText; + + void IAstVisitor.VisitText(TextNode textNode) { - var handler = TextVisited; - if (handler != null) - handler(textNode, data); - return VisitChildren(textNode, data); + Visit(EnterText, LeaveText, textNode); } - - public event Action PreProcessorDirectiveVisited; - S IAstVisitor.VisitPreProcessorDirective (PreProcessorDirective preProcessorDirective, T data) + + public event Action EnterPreProcessorDirective, LeavePreProcessorDirective; + void IAstVisitor.VisitPreProcessorDirective(PreProcessorDirective preProcessorDirective) { - var handler = PreProcessorDirectiveVisited; - if (handler != null) - handler (preProcessorDirective, data); - return VisitChildren (preProcessorDirective, data); + Visit(EnterPreProcessorDirective, LeavePreProcessorDirective, preProcessorDirective); } - public event Action DocumentationReferenceVisited; - - S IAstVisitor.VisitDocumentationReference (DocumentationReference documentationReference, T data) + public event Action EnterDocumentationReference, LeaveDocumentationReference; + + void IAstVisitor.VisitDocumentationReference(DocumentationReference documentationReference) { - var handler = DocumentationReferenceVisited; - if (handler != null) - handler (documentationReference, data); - return VisitChildren (documentationReference, data); + Visit(EnterDocumentationReference, LeaveDocumentationReference, documentationReference); } - public event Action IdentifierVisited; - - S IAstVisitor.VisitIdentifier (Identifier identifier, T data) + public event Action EnterIdentifier, LeaveIdentifier; + + void IAstVisitor.VisitIdentifier(Identifier identifier) { - var handler = IdentifierVisited; - if (handler != null) - handler (identifier, data); - return VisitChildren (identifier, data); + Visit(EnterIdentifier, LeaveIdentifier, identifier); } - public event Action CSharpTokenNodeVisited; - - S IAstVisitor.VisitCSharpTokenNode (CSharpTokenNode token, T data) + public event Action EnterCSharpTokenNode, LeaveCSharpTokenNode; + + void IAstVisitor.VisitCSharpTokenNode(CSharpTokenNode token) { - var handler = CSharpTokenNodeVisited; - if (handler != null) - handler (token, data); - return VisitChildren (token, data); + Visit(EnterCSharpTokenNode, LeaveCSharpTokenNode, token); } - public event Action PrimitiveTypeVisited; - - S IAstVisitor.VisitPrimitiveType (PrimitiveType primitiveType, T data) + public event Action EnterPrimitiveType, LeavePrimitiveType; + + void IAstVisitor.VisitPrimitiveType(PrimitiveType primitiveType) { - var handler = PrimitiveTypeVisited; - if (handler != null) - handler (primitiveType, data); - return VisitChildren (primitiveType, data); + Visit(EnterPrimitiveType, LeavePrimitiveType, primitiveType); } - public event Action ComposedTypeVisited; - - S IAstVisitor.VisitComposedType (ComposedType composedType, T data) + public event Action EnterComposedType, LeaveComposedType; + + void IAstVisitor.VisitComposedType(ComposedType composedType) { - var handler = ComposedTypeVisited; - if (handler != null) - handler (composedType, data); - return VisitChildren (composedType, data); + Visit(EnterComposedType, LeaveComposedType, composedType); } - public event Action SimpleTypeVisited; - - S IAstVisitor.VisitSimpleType (SimpleType simpleType, T data) + public event Action EnterSimpleType, LeaveSimpleType; + + void IAstVisitor.VisitSimpleType(SimpleType simpleType) { - var handler = SimpleTypeVisited; - if (handler != null) - handler (simpleType, data); - return VisitChildren (simpleType, data); + Visit(EnterSimpleType, LeaveSimpleType, simpleType); } - public event Action MemberTypeVisited; - - S IAstVisitor.VisitMemberType (MemberType memberType, T data) + public event Action EnterMemberType, LeaveMemberType; + + void IAstVisitor.VisitMemberType(MemberType memberType) { - var handler = MemberTypeVisited; - if (handler != null) - handler (memberType, data); - return VisitChildren (memberType, data); + Visit(EnterMemberType, LeaveMemberType, memberType); } - public event Action AttributeVisited; - - S IAstVisitor.VisitAttribute (Attribute attribute, T data) + public event Action EnterAttribute, LeaveAttribute; + + void IAstVisitor.VisitAttribute(Attribute attribute) { - var handler = AttributeVisited; - if (handler != null) - handler (attribute, data); - return VisitChildren (attribute, data); + Visit(EnterAttribute, LeaveAttribute, attribute); } - public event Action AttributeSectionVisited; - - S IAstVisitor.VisitAttributeSection (AttributeSection attributeSection, T data) + public event Action EnterAttributeSection, LeaveAttributeSection; + + void IAstVisitor.VisitAttributeSection(AttributeSection attributeSection) { - var handler = AttributeSectionVisited; - if (handler != null) - handler (attributeSection, data); - return VisitChildren (attributeSection, data); + Visit(EnterAttributeSection, LeaveAttributeSection, attributeSection); } - public event Action DelegateDeclarationVisited; - - S IAstVisitor.VisitDelegateDeclaration (DelegateDeclaration delegateDeclaration, T data) + public event Action EnterDelegateDeclaration, LeaveDelegateDeclaration; + + void IAstVisitor.VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration) { - var handler = DelegateDeclarationVisited; - if (handler != null) - handler (delegateDeclaration, data); - return VisitChildren (delegateDeclaration, data); + Visit(EnterDelegateDeclaration, LeaveDelegateDeclaration, delegateDeclaration); } - public event Action NamespaceDeclarationVisited; - - S IAstVisitor.VisitNamespaceDeclaration (NamespaceDeclaration namespaceDeclaration, T data) + public event Action EnterNamespaceDeclaration, LeaveNamespaceDeclaration; + + void IAstVisitor.VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration) { - var handler = NamespaceDeclarationVisited; - if (handler != null) - handler (namespaceDeclaration, data); - return VisitChildren (namespaceDeclaration, data); + Visit(EnterNamespaceDeclaration, LeaveNamespaceDeclaration, namespaceDeclaration); } - public event Action TypeDeclarationVisited; - - S IAstVisitor.VisitTypeDeclaration (TypeDeclaration typeDeclaration, T data) + public event Action EnterTypeDeclaration, LeaveTypeDeclaration; + + void IAstVisitor.VisitTypeDeclaration(TypeDeclaration typeDeclaration) { - var handler = TypeDeclarationVisited; - if (handler != null) - handler (typeDeclaration, data); - return VisitChildren (typeDeclaration, data); + Visit(EnterTypeDeclaration, LeaveTypeDeclaration, typeDeclaration); } - public event Action TypeParameterDeclarationVisited; - - S IAstVisitor.VisitTypeParameterDeclaration (TypeParameterDeclaration typeParameterDeclaration, T data) + public event Action EnterTypeParameterDeclaration, LeaveTypeParameterDeclaration; + + void IAstVisitor.VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration) { - var handler = TypeParameterDeclarationVisited; - if (handler != null) - handler (typeParameterDeclaration, data); - return VisitChildren (typeParameterDeclaration, data); + Visit(EnterTypeParameterDeclaration, LeaveTypeParameterDeclaration, typeParameterDeclaration); } - public event Action EnumMemberDeclarationVisited; - - S IAstVisitor.VisitEnumMemberDeclaration (EnumMemberDeclaration enumMemberDeclaration, T data) + public event Action EnterEnumMemberDeclaration, LeaveEnumMemberDeclaration; + + void IAstVisitor.VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration) { - var handler = EnumMemberDeclarationVisited; - if (handler != null) - handler (enumMemberDeclaration, data); - return VisitChildren (enumMemberDeclaration, data); + Visit(EnterEnumMemberDeclaration, LeaveEnumMemberDeclaration, enumMemberDeclaration); } - public event Action UsingDeclarationVisited; - - S IAstVisitor.VisitUsingDeclaration (UsingDeclaration usingDeclaration, T data) + public event Action EnterUsingDeclaration, LeaveUsingDeclaration; + + void IAstVisitor.VisitUsingDeclaration(UsingDeclaration usingDeclaration) { - var handler = UsingDeclarationVisited; - if (handler != null) - handler (usingDeclaration, data); - return VisitChildren (usingDeclaration, data); + Visit(EnterUsingDeclaration, LeaveUsingDeclaration, usingDeclaration); } - public event Action UsingAliasDeclarationVisited; - - S IAstVisitor.VisitUsingAliasDeclaration (UsingAliasDeclaration usingDeclaration, T data) + public event Action EnterUsingAliasDeclaration, LeaveUsingAliasDeclaration; + + void IAstVisitor.VisitUsingAliasDeclaration(UsingAliasDeclaration usingDeclaration) { - var handler = UsingAliasDeclarationVisited; - if (handler != null) - handler (usingDeclaration, data); - return VisitChildren (usingDeclaration, data); + Visit(EnterUsingAliasDeclaration, LeaveUsingAliasDeclaration, usingDeclaration); } - public event Action ExternAliasDeclarationVisited; - - S IAstVisitor.VisitExternAliasDeclaration (ExternAliasDeclaration externAliasDeclaration, T data) + public event Action EnterExternAliasDeclaration, LeaveExternAliasDeclaration; + + void IAstVisitor.VisitExternAliasDeclaration(ExternAliasDeclaration externAliasDeclaration) { - var handler = ExternAliasDeclarationVisited; - if (handler != null) - handler (externAliasDeclaration, data); - return VisitChildren (externAliasDeclaration, data); + Visit(EnterExternAliasDeclaration, LeaveExternAliasDeclaration, externAliasDeclaration); } - public event Action ConstructorDeclarationVisited; - - S IAstVisitor.VisitConstructorDeclaration (ConstructorDeclaration constructorDeclaration, T data) + public event Action EnterConstructorDeclaration, LeaveConstructorDeclaration; + + void IAstVisitor.VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration) { - var handler = ConstructorDeclarationVisited; - if (handler != null) - handler (constructorDeclaration, data); - return VisitChildren (constructorDeclaration, data); + Visit(EnterConstructorDeclaration, LeaveConstructorDeclaration, constructorDeclaration); } - public event Action ConstructorInitializerVisited; - - S IAstVisitor.VisitConstructorInitializer (ConstructorInitializer constructorInitializer, T data) + public event Action EnterConstructorInitializer, LeaveConstructorInitializer; + + void IAstVisitor.VisitConstructorInitializer(ConstructorInitializer constructorInitializer) { - var handler = ConstructorInitializerVisited; - if (handler != null) - handler (constructorInitializer, data); - return VisitChildren (constructorInitializer, data); + Visit(EnterConstructorInitializer, LeaveConstructorInitializer, constructorInitializer); } - public event Action DestructorDeclarationVisited; - - S IAstVisitor.VisitDestructorDeclaration (DestructorDeclaration destructorDeclaration, T data) + public event Action EnterDestructorDeclaration, LeaveDestructorDeclaration; + + void IAstVisitor.VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration) { - var handler = DestructorDeclarationVisited; - if (handler != null) - handler (destructorDeclaration, data); - return VisitChildren (destructorDeclaration, data); + Visit(EnterDestructorDeclaration, LeaveDestructorDeclaration, destructorDeclaration); } - public event Action EventDeclarationVisited; - - S IAstVisitor.VisitEventDeclaration (EventDeclaration eventDeclaration, T data) + public event Action EnterEventDeclaration, LeaveEventDeclaration; + + void IAstVisitor.VisitEventDeclaration(EventDeclaration eventDeclaration) { - var handler = EventDeclarationVisited; - if (handler != null) - handler (eventDeclaration, data); - return VisitChildren (eventDeclaration, data); + Visit(EnterEventDeclaration, LeaveEventDeclaration, eventDeclaration); } - public event Action CustomEventDeclarationVisited; - - S IAstVisitor.VisitCustomEventDeclaration (CustomEventDeclaration eventDeclaration, T data) + public event Action EnterCustomEventDeclaration, LeaveCustomEventDeclaration; + + void IAstVisitor.VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration) { - var handler = CustomEventDeclarationVisited; - if (handler != null) - handler (eventDeclaration, data); - return VisitChildren (eventDeclaration, data); + Visit(EnterCustomEventDeclaration, LeaveCustomEventDeclaration, eventDeclaration); } - public event Action FieldDeclarationVisited; - - S IAstVisitor.VisitFieldDeclaration (FieldDeclaration fieldDeclaration, T data) + public event Action EnterFieldDeclaration, LeaveFieldDeclaration; + + void IAstVisitor.VisitFieldDeclaration(FieldDeclaration fieldDeclaration) { - var handler = FieldDeclarationVisited; - if (handler != null) - handler (fieldDeclaration, data); - return VisitChildren (fieldDeclaration, data); + Visit(EnterFieldDeclaration, LeaveFieldDeclaration, fieldDeclaration); } - public event Action FixedFieldDeclarationVisited; - - S IAstVisitor.VisitFixedFieldDeclaration (FixedFieldDeclaration fixedFieldDeclaration, T data) + public event Action EnterFixedFieldDeclaration, LeaveFixedFieldDeclaration; + + void IAstVisitor.VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration) { - var handler = FixedFieldDeclarationVisited; - if (handler != null) - handler (fixedFieldDeclaration, data); - return VisitChildren (fixedFieldDeclaration, data); + Visit(EnterFixedFieldDeclaration, LeaveFixedFieldDeclaration, fixedFieldDeclaration); } - public event Action FixedVariableInitializerVisited; - - S IAstVisitor.VisitFixedVariableInitializer (FixedVariableInitializer fixedVariableInitializer, T data) + public event Action EnterFixedVariableInitializer, LeaveFixedVariableInitializer; + + void IAstVisitor.VisitFixedVariableInitializer(FixedVariableInitializer fixedVariableInitializer) { - var handler = FixedVariableInitializerVisited; - if (handler != null) - handler (fixedVariableInitializer, data); - return VisitChildren (fixedVariableInitializer, data); + Visit(EnterFixedVariableInitializer, LeaveFixedVariableInitializer, fixedVariableInitializer); } - public event Action IndexerDeclarationVisited; - - S IAstVisitor.VisitIndexerDeclaration (IndexerDeclaration indexerDeclaration, T data) + public event Action EnterIndexerDeclaration, LeaveIndexerDeclaration; + + void IAstVisitor.VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration) { - var handler = IndexerDeclarationVisited; - if (handler != null) - handler (indexerDeclaration, data); - return VisitChildren (indexerDeclaration, data); + Visit(EnterIndexerDeclaration, LeaveIndexerDeclaration, indexerDeclaration); } - public event Action MethodDeclarationVisited; - - S IAstVisitor.VisitMethodDeclaration (MethodDeclaration methodDeclaration, T data) + public event Action EnterMethodDeclaration, LeaveMethodDeclaration; + + void IAstVisitor.VisitMethodDeclaration(MethodDeclaration methodDeclaration) { - var handler = MethodDeclarationVisited; - if (handler != null) - handler (methodDeclaration, data); - return VisitChildren (methodDeclaration, data); + Visit(EnterMethodDeclaration, LeaveMethodDeclaration, methodDeclaration); } - public event Action OperatorDeclarationVisited; - - S IAstVisitor.VisitOperatorDeclaration (OperatorDeclaration operatorDeclaration, T data) + public event Action EnterOperatorDeclaration, LeaveOperatorDeclaration; + + void IAstVisitor.VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration) { - var handler = OperatorDeclarationVisited; - if (handler != null) - handler (operatorDeclaration, data); - return VisitChildren (operatorDeclaration, data); + Visit(EnterOperatorDeclaration, LeaveOperatorDeclaration, operatorDeclaration); } - public event Action PropertyDeclarationVisited; - - S IAstVisitor.VisitPropertyDeclaration (PropertyDeclaration propertyDeclaration, T data) + public event Action EnterPropertyDeclaration, LeavePropertyDeclaration; + + void IAstVisitor.VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration) { - var handler = PropertyDeclarationVisited; - if (handler != null) - handler (propertyDeclaration, data); - return VisitChildren (propertyDeclaration, data); + Visit(EnterPropertyDeclaration, LeavePropertyDeclaration, propertyDeclaration); } - public event Action AccessorVisited; - - S IAstVisitor.VisitAccessor (Accessor accessor, T data) + public event Action EnterAccessor, LeaveAccessor; + + void IAstVisitor.VisitAccessor(Accessor accessor) { - var handler = AccessorVisited; - if (handler != null) - handler (accessor, data); - return VisitChildren (accessor, data); + Visit(EnterAccessor, LeaveAccessor, accessor); } - public event Action VariableInitializerVisited; - - S IAstVisitor.VisitVariableInitializer (VariableInitializer variableInitializer, T data) + public event Action EnterVariableInitializer, LeaveVariableInitializer; + + void IAstVisitor.VisitVariableInitializer(VariableInitializer variableInitializer) { - var handler = VariableInitializerVisited; - if (handler != null) - handler (variableInitializer, data); - return VisitChildren (variableInitializer, data); + Visit(EnterVariableInitializer, LeaveVariableInitializer, variableInitializer); } - public event Action ParameterDeclarationVisited; - - S IAstVisitor.VisitParameterDeclaration (ParameterDeclaration parameterDeclaration, T data) + public event Action EnterParameterDeclaration, LeaveParameterDeclaration; + + void IAstVisitor.VisitParameterDeclaration(ParameterDeclaration parameterDeclaration) { - var handler = ParameterDeclarationVisited; - if (handler != null) - handler (parameterDeclaration, data); - return VisitChildren (parameterDeclaration, data); + Visit(EnterParameterDeclaration, LeaveParameterDeclaration, parameterDeclaration); } - public event Action ConstraintVisited; - - S IAstVisitor.VisitConstraint (Constraint constraint, T data) + public event Action EnterConstraint, LeaveConstraint; + + void IAstVisitor.VisitConstraint(Constraint constraint) { - var handler = ConstraintVisited; - if (handler != null) - handler (constraint, data); - return VisitChildren (constraint, data); + Visit(EnterConstraint, LeaveConstraint, constraint); } - public event Action BlockStatementVisited; - - S IAstVisitor.VisitBlockStatement (BlockStatement blockStatement, T data) + public event Action EnterBlockStatement, LeaveBlockStatement; + + void IAstVisitor.VisitBlockStatement(BlockStatement blockStatement) { - var handler = BlockStatementVisited; - if (handler != null) - handler (blockStatement, data); - return VisitChildren (blockStatement, data); + Visit(EnterBlockStatement, LeaveBlockStatement, blockStatement); } - public event Action ExpressionStatementVisited; - - S IAstVisitor.VisitExpressionStatement (ExpressionStatement expressionStatement, T data) + public event Action EnterExpressionStatement, LeaveExpressionStatement; + + void IAstVisitor.VisitExpressionStatement(ExpressionStatement expressionStatement) { - var handler = ExpressionStatementVisited; - if (handler != null) - handler (expressionStatement, data); - return VisitChildren (expressionStatement, data); + Visit(EnterExpressionStatement, LeaveExpressionStatement, expressionStatement); } - public event Action BreakStatementVisited; - - S IAstVisitor.VisitBreakStatement (BreakStatement breakStatement, T data) + public event Action EnterBreakStatement, LeaveBreakStatement; + + void IAstVisitor.VisitBreakStatement(BreakStatement breakStatement) { - var handler = BreakStatementVisited; - if (handler != null) - handler (breakStatement, data); - return VisitChildren (breakStatement, data); + Visit(EnterBreakStatement, LeaveBreakStatement, breakStatement); } - public event Action CheckedStatementVisited; - - S IAstVisitor.VisitCheckedStatement (CheckedStatement checkedStatement, T data) + public event Action EnterCheckedStatement, LeaveCheckedStatement; + + void IAstVisitor.VisitCheckedStatement(CheckedStatement checkedStatement) { - var handler = CheckedStatementVisited; - if (handler != null) - handler (checkedStatement, data); - return VisitChildren (checkedStatement, data); + Visit(EnterCheckedStatement, LeaveCheckedStatement, checkedStatement); } - public event Action ContinueStatementVisited; - - S IAstVisitor.VisitContinueStatement (ContinueStatement continueStatement, T data) + public event Action EnterContinueStatement, LeaveContinueStatement; + + void IAstVisitor.VisitContinueStatement(ContinueStatement continueStatement) { - var handler = ContinueStatementVisited; - if (handler != null) - handler (continueStatement, data); - return VisitChildren (continueStatement, data); + Visit(EnterContinueStatement, LeaveContinueStatement, continueStatement); } - public event Action DoWhileStatementVisited; - - S IAstVisitor.VisitDoWhileStatement (DoWhileStatement doWhileStatement, T data) + public event Action EnterDoWhileStatement, LeaveDoWhileStatement; + + void IAstVisitor.VisitDoWhileStatement(DoWhileStatement doWhileStatement) { - var handler = DoWhileStatementVisited; - if (handler != null) - handler (doWhileStatement, data); - return VisitChildren (doWhileStatement, data); + Visit(EnterDoWhileStatement, LeaveDoWhileStatement, doWhileStatement); } - public event Action EmptyStatementVisited; - - S IAstVisitor.VisitEmptyStatement (EmptyStatement emptyStatement, T data) + public event Action EnterEmptyStatement, LeaveEmptyStatement; + + void IAstVisitor.VisitEmptyStatement(EmptyStatement emptyStatement) { - var handler = EmptyStatementVisited; - if (handler != null) - handler (emptyStatement, data); - return VisitChildren (emptyStatement, data); + Visit(EnterEmptyStatement, LeaveEmptyStatement, emptyStatement); } - public event Action FixedStatementVisited; - - S IAstVisitor.VisitFixedStatement (FixedStatement fixedStatement, T data) + public event Action EnterFixedStatement, LeaveFixedStatement; + + void IAstVisitor.VisitFixedStatement(FixedStatement fixedStatement) { - var handler = FixedStatementVisited; - if (handler != null) - handler (fixedStatement, data); - return VisitChildren (fixedStatement, data); + Visit(EnterFixedStatement, LeaveFixedStatement, fixedStatement); } - public event Action ForeachStatementVisited; - - S IAstVisitor.VisitForeachStatement (ForeachStatement foreachStatement, T data) + public event Action EnterForeachStatement, LeaveForeachStatement; + + void IAstVisitor.VisitForeachStatement(ForeachStatement foreachStatement) { - var handler = ForeachStatementVisited; - if (handler != null) - handler (foreachStatement, data); - return VisitChildren (foreachStatement, data); + Visit(EnterForeachStatement, LeaveForeachStatement, foreachStatement); } - public event Action ForStatementVisited; - - S IAstVisitor.VisitForStatement (ForStatement forStatement, T data) + public event Action EnterForStatement, LeaveForStatement; + + void IAstVisitor.VisitForStatement(ForStatement forStatement) { - var handler = ForStatementVisited; - if (handler != null) - handler (forStatement, data); - return VisitChildren (forStatement, data); + Visit(EnterForStatement, LeaveForStatement, forStatement); } - public event Action GotoCaseStatementVisited; - - S IAstVisitor.VisitGotoCaseStatement (GotoCaseStatement gotoCaseStatement, T data) + public event Action EnterGotoCaseStatement, LeaveGotoCaseStatement; + + void IAstVisitor.VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement) { - var handler = GotoCaseStatementVisited; - if (handler != null) - handler (gotoCaseStatement, data); - return VisitChildren (gotoCaseStatement, data); + Visit(EnterGotoCaseStatement, LeaveGotoCaseStatement, gotoCaseStatement); } - public event Action GotoDefaultStatementVisited; - - S IAstVisitor.VisitGotoDefaultStatement (GotoDefaultStatement gotoDefaultStatement, T data) + public event Action EnterGotoDefaultStatement, LeaveGotoDefaultStatement; + + void IAstVisitor.VisitGotoDefaultStatement(GotoDefaultStatement gotoDefaultStatement) { - var handler = GotoDefaultStatementVisited; - if (handler != null) - handler (gotoDefaultStatement, data); - return VisitChildren (gotoDefaultStatement, data); + Visit(EnterGotoDefaultStatement, LeaveGotoDefaultStatement, gotoDefaultStatement); } - public event Action GotoStatementVisited; - - S IAstVisitor.VisitGotoStatement (GotoStatement gotoStatement, T data) + public event Action EnterGotoStatement, LeaveGotoStatement; + + void IAstVisitor.VisitGotoStatement(GotoStatement gotoStatement) { - var handler = GotoStatementVisited; - if (handler != null) - handler (gotoStatement, data); - return VisitChildren (gotoStatement, data); + Visit(EnterGotoStatement, LeaveGotoStatement, gotoStatement); } - public event Action IfElseStatementVisited; - - S IAstVisitor.VisitIfElseStatement (IfElseStatement ifElseStatement, T data) + public event Action EnterIfElseStatement, LeaveIfElseStatement; + + void IAstVisitor.VisitIfElseStatement(IfElseStatement ifElseStatement) { - var handler = IfElseStatementVisited; - if (handler != null) - handler (ifElseStatement, data); - return VisitChildren (ifElseStatement, data); + Visit(EnterIfElseStatement, LeaveIfElseStatement, ifElseStatement); } - public event Action LabelStatementVisited; - - S IAstVisitor.VisitLabelStatement (LabelStatement labelStatement, T data) + public event Action EnterLabelStatement, LeaveLabelStatement; + + void IAstVisitor.VisitLabelStatement(LabelStatement labelStatement) { - var handler = LabelStatementVisited; - if (handler != null) - handler (labelStatement, data); - return VisitChildren (labelStatement, data); + Visit(EnterLabelStatement, LeaveLabelStatement, labelStatement); } - public event Action LockStatementVisited; - - S IAstVisitor.VisitLockStatement (LockStatement lockStatement, T data) + public event Action EnterLockStatement, LeaveLockStatement; + + void IAstVisitor.VisitLockStatement(LockStatement lockStatement) { - var handler = LockStatementVisited; - if (handler != null) - handler (lockStatement, data); - return VisitChildren (lockStatement, data); + Visit(EnterLockStatement, LeaveLockStatement, lockStatement); } - public event Action ReturnStatementVisited; - - S IAstVisitor.VisitReturnStatement (ReturnStatement returnStatement, T data) + public event Action EnterReturnStatement, LeaveReturnStatement; + + void IAstVisitor.VisitReturnStatement(ReturnStatement returnStatement) { - var handler = ReturnStatementVisited; - if (handler != null) - handler (returnStatement, data); - return VisitChildren (returnStatement, data); + Visit(EnterReturnStatement, LeaveReturnStatement, returnStatement); } - public event Action SwitchStatementVisited; - - S IAstVisitor.VisitSwitchStatement (SwitchStatement switchStatement, T data) + public event Action EnterSwitchStatement, LeaveSwitchStatement; + + void IAstVisitor.VisitSwitchStatement(SwitchStatement switchStatement) { - var handler = SwitchStatementVisited; - if (handler != null) - handler (switchStatement, data); - return VisitChildren (switchStatement, data); + Visit(EnterSwitchStatement, LeaveSwitchStatement, switchStatement); } - public event Action SwitchSectionVisited; - - S IAstVisitor.VisitSwitchSection (SwitchSection switchSection, T data) + public event Action EnterSwitchSection, LeaveSwitchSection; + + void IAstVisitor.VisitSwitchSection(SwitchSection switchSection) { - var handler = SwitchSectionVisited; - if (handler != null) - handler (switchSection, data); - return VisitChildren (switchSection, data); + Visit(EnterSwitchSection, LeaveSwitchSection, switchSection); } - public event Action CaseLabelVisited; - - S IAstVisitor.VisitCaseLabel (CaseLabel caseLabel, T data) + public event Action EnterCaseLabel, LeaveCaseLabel; + + void IAstVisitor.VisitCaseLabel(CaseLabel caseLabel) { - var handler = CaseLabelVisited; - if (handler != null) - handler (caseLabel, data); - return VisitChildren (caseLabel, data); + Visit(EnterCaseLabel, LeaveCaseLabel, caseLabel); } - public event Action ThrowStatementVisited; - - S IAstVisitor.VisitThrowStatement (ThrowStatement throwStatement, T data) + public event Action EnterThrowStatement, LeaveThrowStatement; + + void IAstVisitor.VisitThrowStatement(ThrowStatement throwStatement) { - var handler = ThrowStatementVisited; - if (handler != null) - handler (throwStatement, data); - return VisitChildren (throwStatement, data); + Visit(EnterThrowStatement, LeaveThrowStatement, throwStatement); } - public event Action TryCatchStatementVisited; - - S IAstVisitor.VisitTryCatchStatement (TryCatchStatement tryCatchStatement, T data) + public event Action EnterTryCatchStatement, LeaveTryCatchStatement; + + void IAstVisitor.VisitTryCatchStatement(TryCatchStatement tryCatchStatement) { - var handler = TryCatchStatementVisited; - if (handler != null) - handler (tryCatchStatement, data); - return VisitChildren (tryCatchStatement, data); + Visit(EnterTryCatchStatement, LeaveTryCatchStatement, tryCatchStatement); } - public event Action CatchClauseVisited; - - S IAstVisitor.VisitCatchClause (CatchClause catchClause, T data) + public event Action EnterCatchClause, LeaveCatchClause; + + void IAstVisitor.VisitCatchClause(CatchClause catchClause) { - var handler = CatchClauseVisited; - if (handler != null) - handler (catchClause, data); - return VisitChildren (catchClause, data); + Visit(EnterCatchClause, LeaveCatchClause, catchClause); } - public event Action UncheckedStatementVisited; - - S IAstVisitor.VisitUncheckedStatement (UncheckedStatement uncheckedStatement, T data) + public event Action EnterUncheckedStatement, LeaveUncheckedStatement; + + void IAstVisitor.VisitUncheckedStatement(UncheckedStatement uncheckedStatement) { - var handler = UncheckedStatementVisited; - if (handler != null) - handler (uncheckedStatement, data); - return VisitChildren (uncheckedStatement, data); + Visit(EnterUncheckedStatement, LeaveUncheckedStatement, uncheckedStatement); } - public event Action UnsafeStatementVisited; - - S IAstVisitor.VisitUnsafeStatement (UnsafeStatement unsafeStatement, T data) + public event Action EnterUnsafeStatement, LeaveUnsafeStatement; + + void IAstVisitor.VisitUnsafeStatement(UnsafeStatement unsafeStatement) { - var handler = UnsafeStatementVisited; - if (handler != null) - handler (unsafeStatement, data); - return VisitChildren (unsafeStatement, data); + Visit(EnterUnsafeStatement, LeaveUnsafeStatement, unsafeStatement); } - public event Action UsingStatementVisited; - - S IAstVisitor.VisitUsingStatement (UsingStatement usingStatement, T data) + public event Action EnterUsingStatement, LeaveUsingStatement; + + void IAstVisitor.VisitUsingStatement(UsingStatement usingStatement) { - var handler = UsingStatementVisited; - if (handler != null) - handler (usingStatement, data); - return VisitChildren (usingStatement, data); + Visit(EnterUsingStatement, LeaveUsingStatement, usingStatement); } - public event Action VariableDeclarationStatementVisited; - - S IAstVisitor.VisitVariableDeclarationStatement (VariableDeclarationStatement variableDeclarationStatement, T data) + public event Action EnterVariableDeclarationStatement, LeaveVariableDeclarationStatement; + + void IAstVisitor.VisitVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement) { - var handler = VariableDeclarationStatementVisited; - if (handler != null) - handler (variableDeclarationStatement, data); - return VisitChildren (variableDeclarationStatement, data); + Visit(EnterVariableDeclarationStatement, LeaveVariableDeclarationStatement, variableDeclarationStatement); } - public event Action WhileStatementVisited; - - S IAstVisitor.VisitWhileStatement (WhileStatement whileStatement, T data) + public event Action EnterWhileStatement, LeaveWhileStatement; + + void IAstVisitor.VisitWhileStatement(WhileStatement whileStatement) { - var handler = WhileStatementVisited; - if (handler != null) - handler (whileStatement, data); - return VisitChildren (whileStatement, data); + Visit(EnterWhileStatement, LeaveWhileStatement, whileStatement); } - public event Action YieldBreakStatementVisited; - - S IAstVisitor.VisitYieldBreakStatement (YieldBreakStatement yieldBreakStatement, T data) + public event Action EnterYieldBreakStatement, LeaveYieldBreakStatement; + + void IAstVisitor.VisitYieldBreakStatement(YieldBreakStatement yieldBreakStatement) { - var handler = YieldBreakStatementVisited; - if (handler != null) - handler (yieldBreakStatement, data); - return VisitChildren (yieldBreakStatement, data); + Visit(EnterYieldBreakStatement, LeaveYieldBreakStatement, yieldBreakStatement); } - public event Action YieldReturnStatementVisited; - - S IAstVisitor.VisitYieldReturnStatement (YieldReturnStatement yieldStatement, T data) + public event Action EnterYieldReturnStatement, LeaveYieldReturnStatement; + + void IAstVisitor.VisitYieldReturnStatement(YieldReturnStatement yieldStatement) { - var handler = YieldReturnStatementVisited; - if (handler != null) - handler (yieldStatement, data); - return VisitChildren (yieldStatement, data); + Visit(EnterYieldReturnStatement, LeaveYieldReturnStatement, yieldStatement); } - public event Action AnonymousMethodExpressionVisited; - - S IAstVisitor.VisitAnonymousMethodExpression (AnonymousMethodExpression anonymousMethodExpression, T data) + public event Action EnterAnonymousMethodExpression, LeaveAnonymousMethodExpression; + + void IAstVisitor.VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression) { - var handler = AnonymousMethodExpressionVisited; - if (handler != null) - handler (anonymousMethodExpression, data); - return VisitChildren (anonymousMethodExpression, data); + Visit(EnterAnonymousMethodExpression, LeaveAnonymousMethodExpression, anonymousMethodExpression); } - public event Action LambdaExpressionVisited; - - S IAstVisitor.VisitLambdaExpression (LambdaExpression lambdaExpression, T data) + public event Action EnterLambdaExpression, LeaveLambdaExpression; + + void IAstVisitor.VisitLambdaExpression(LambdaExpression lambdaExpression) { - var handler = LambdaExpressionVisited; - if (handler != null) - handler (lambdaExpression, data); - return VisitChildren (lambdaExpression, data); + Visit(EnterLambdaExpression, LeaveLambdaExpression, lambdaExpression); } - public event Action AssignmentExpressionVisited; - - S IAstVisitor.VisitAssignmentExpression (AssignmentExpression assignmentExpression, T data) + public event Action EnterAssignmentExpression, LeaveAssignmentExpression; + + void IAstVisitor.VisitAssignmentExpression(AssignmentExpression assignmentExpression) { - var handler = AssignmentExpressionVisited; - if (handler != null) - handler (assignmentExpression, data); - return VisitChildren (assignmentExpression, data); + Visit(EnterAssignmentExpression, LeaveAssignmentExpression, assignmentExpression); } - public event Action BaseReferenceExpressionVisited; - - S IAstVisitor.VisitBaseReferenceExpression (BaseReferenceExpression baseReferenceExpression, T data) + public event Action EnterBaseReferenceExpression, LeaveBaseReferenceExpression; + + void IAstVisitor.VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression) { - var handler = BaseReferenceExpressionVisited; - if (handler != null) - handler (baseReferenceExpression, data); - return VisitChildren (baseReferenceExpression, data); + Visit(EnterBaseReferenceExpression, LeaveBaseReferenceExpression, baseReferenceExpression); } - public event Action BinaryOperatorExpressionVisited; - - S IAstVisitor.VisitBinaryOperatorExpression (BinaryOperatorExpression binaryOperatorExpression, T data) + public event Action EnterBinaryOperatorExpression, LeaveBinaryOperatorExpression; + + void IAstVisitor.VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression) { - var handler = BinaryOperatorExpressionVisited; - if (handler != null) - handler (binaryOperatorExpression, data); - return VisitChildren (binaryOperatorExpression, data); + Visit(EnterBinaryOperatorExpression, LeaveBinaryOperatorExpression, binaryOperatorExpression); } - public event Action CastExpressionVisited; - - S IAstVisitor.VisitCastExpression (CastExpression castExpression, T data) + public event Action EnterCastExpression, LeaveCastExpression; + + void IAstVisitor.VisitCastExpression(CastExpression castExpression) { - var handler = CastExpressionVisited; - if (handler != null) - handler (castExpression, data); - return VisitChildren (castExpression, data); + Visit(EnterCastExpression, LeaveCastExpression, castExpression); } - public event Action CheckedExpressionVisited; - - S IAstVisitor.VisitCheckedExpression (CheckedExpression checkedExpression, T data) + public event Action EnterCheckedExpression, LeaveCheckedExpression; + + void IAstVisitor.VisitCheckedExpression(CheckedExpression checkedExpression) { - var handler = CheckedExpressionVisited; - if (handler != null) - handler (checkedExpression, data); - return VisitChildren (checkedExpression, data); + Visit(EnterCheckedExpression, LeaveCheckedExpression, checkedExpression); } - public event Action ConditionalExpressionVisited; - - S IAstVisitor.VisitConditionalExpression (ConditionalExpression conditionalExpression, T data) + public event Action EnterConditionalExpression, LeaveConditionalExpression; + + void IAstVisitor.VisitConditionalExpression(ConditionalExpression conditionalExpression) { - var handler = ConditionalExpressionVisited; - if (handler != null) - handler (conditionalExpression, data); - return VisitChildren (conditionalExpression, data); + Visit(EnterConditionalExpression, LeaveConditionalExpression, conditionalExpression); } - public event Action IdentifierExpressionVisited; - - S IAstVisitor.VisitIdentifierExpression (IdentifierExpression identifierExpression, T data) + public event Action EnterIdentifierExpression, LeaveIdentifierExpression; + + void IAstVisitor.VisitIdentifierExpression(IdentifierExpression identifierExpression) { - var handler = IdentifierExpressionVisited; - if (handler != null) - handler (identifierExpression, data); - return VisitChildren (identifierExpression, data); + Visit(EnterIdentifierExpression, LeaveIdentifierExpression, identifierExpression); } - public event Action IndexerExpressionVisited; - - S IAstVisitor.VisitIndexerExpression (IndexerExpression indexerExpression, T data) + public event Action EnterIndexerExpression, LeaveIndexerExpression; + + void IAstVisitor.VisitIndexerExpression(IndexerExpression indexerExpression) { - var handler = IndexerExpressionVisited; - if (handler != null) - handler (indexerExpression, data); - return VisitChildren (indexerExpression, data); + Visit(EnterIndexerExpression, LeaveIndexerExpression, indexerExpression); } - public event Action InvocationExpressionVisited; - - S IAstVisitor.VisitInvocationExpression (InvocationExpression invocationExpression, T data) + public event Action EnterInvocationExpression, LeaveInvocationExpression; + + void IAstVisitor.VisitInvocationExpression(InvocationExpression invocationExpression) { - var handler = InvocationExpressionVisited; - if (handler != null) - handler (invocationExpression, data); - return VisitChildren (invocationExpression, data); + Visit(EnterInvocationExpression, LeaveInvocationExpression, invocationExpression); } - public event Action DirectionExpressionVisited; - - S IAstVisitor.VisitDirectionExpression (DirectionExpression directionExpression, T data) + public event Action EnterDirectionExpression, LeaveDirectionExpression; + + void IAstVisitor.VisitDirectionExpression(DirectionExpression directionExpression) { - var handler = DirectionExpressionVisited; - if (handler != null) - handler (directionExpression, data); - return VisitChildren (directionExpression, data); + Visit(EnterDirectionExpression, LeaveDirectionExpression, directionExpression); } - public event Action MemberReferenceExpressionVisited; - - S IAstVisitor.VisitMemberReferenceExpression (MemberReferenceExpression memberReferenceExpression, T data) + public event Action EnterMemberReferenceExpression, LeaveMemberReferenceExpression; + + void IAstVisitor.VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression) { - var handler = MemberReferenceExpressionVisited; - if (handler != null) - handler (memberReferenceExpression, data); - return VisitChildren (memberReferenceExpression, data); + Visit(EnterMemberReferenceExpression, LeaveMemberReferenceExpression, memberReferenceExpression); } - public event Action NullReferenceExpressionVisited; - - S IAstVisitor.VisitNullReferenceExpression (NullReferenceExpression nullReferenceExpression, T data) + public event Action EnterNullReferenceExpression, LeaveNullReferenceExpression; + + void IAstVisitor.VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression) { - var handler = NullReferenceExpressionVisited; - if (handler != null) - handler (nullReferenceExpression, data); - return VisitChildren (nullReferenceExpression, data); + Visit(EnterNullReferenceExpression, LeaveNullReferenceExpression, nullReferenceExpression); } - public event Action ObjectCreateExpressionVisited; - - S IAstVisitor.VisitObjectCreateExpression (ObjectCreateExpression objectCreateExpression, T data) + public event Action EnterObjectCreateExpression, LeaveObjectCreateExpression; + + void IAstVisitor.VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression) { - var handler = ObjectCreateExpressionVisited; - if (handler != null) - handler (objectCreateExpression, data); - return VisitChildren (objectCreateExpression, data); + Visit(EnterObjectCreateExpression, LeaveObjectCreateExpression, objectCreateExpression); } - public event Action AnonymousTypeCreateExpressionVisited; - - S IAstVisitor.VisitAnonymousTypeCreateExpression (AnonymousTypeCreateExpression anonymousTypeCreateExpression, T data) + public event Action EnterAnonymousTypeCreateExpression, LeaveAnonymousTypeCreateExpression; + + void IAstVisitor.VisitAnonymousTypeCreateExpression(AnonymousTypeCreateExpression anonymousTypeCreateExpression) { - var handler = AnonymousTypeCreateExpressionVisited; - if (handler != null) - handler (anonymousTypeCreateExpression, data); - return VisitChildren (anonymousTypeCreateExpression, data); + Visit(EnterAnonymousTypeCreateExpression, LeaveAnonymousTypeCreateExpression, anonymousTypeCreateExpression); } - public event Action ArrayCreateExpressionVisited; - - S IAstVisitor.VisitArrayCreateExpression (ArrayCreateExpression arraySCreateExpression, T data) + public event Action EnterArrayCreateExpression, LeaveArrayCreateExpression; + + void IAstVisitor.VisitArrayCreateExpression(ArrayCreateExpression arraySCreateExpression) { - var handler = ArrayCreateExpressionVisited; - if (handler != null) - handler (arraySCreateExpression, data); - return VisitChildren (arraySCreateExpression, data); + Visit(EnterArrayCreateExpression, LeaveArrayCreateExpression, arraySCreateExpression); } - public event Action ParenthesizedExpressionVisited; - - S IAstVisitor.VisitParenthesizedExpression (ParenthesizedExpression parenthesizedExpression, T data) + public event Action EnterParenthesizedExpression, LeaveParenthesizedExpression; + + void IAstVisitor.VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression) { - var handler = ParenthesizedExpressionVisited; - if (handler != null) - handler (parenthesizedExpression, data); - return VisitChildren (parenthesizedExpression, data); + Visit(EnterParenthesizedExpression, LeaveParenthesizedExpression, parenthesizedExpression); } - public event Action PointerReferenceExpressionVisited; - - S IAstVisitor.VisitPointerReferenceExpression (PointerReferenceExpression pointerReferenceExpression, T data) + public event Action EnterPointerReferenceExpression, LeavePointerReferenceExpression; + + void IAstVisitor.VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression) { - var handler = PointerReferenceExpressionVisited; - if (handler != null) - handler (pointerReferenceExpression, data); - return VisitChildren (pointerReferenceExpression, data); + Visit(EnterPointerReferenceExpression, LeavePointerReferenceExpression, pointerReferenceExpression); } - public event Action PrimitiveExpressionVisited; - - S IAstVisitor.VisitPrimitiveExpression (PrimitiveExpression primitiveExpression, T data) + public event Action EnterPrimitiveExpression, LeavePrimitiveExpression; + + void IAstVisitor.VisitPrimitiveExpression(PrimitiveExpression primitiveExpression) { - var handler = PrimitiveExpressionVisited; - if (handler != null) - handler (primitiveExpression, data); - return VisitChildren (primitiveExpression, data); + Visit(EnterPrimitiveExpression, LeavePrimitiveExpression, primitiveExpression); } - public event Action SizeOfExpressionVisited; - - S IAstVisitor.VisitSizeOfExpression (SizeOfExpression sizeOfExpression, T data) + public event Action EnterSizeOfExpression, LeaveSizeOfExpression; + + void IAstVisitor.VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { - var handler = SizeOfExpressionVisited; - if (handler != null) - handler (sizeOfExpression, data); - return VisitChildren (sizeOfExpression, data); + Visit(EnterSizeOfExpression, LeaveSizeOfExpression, sizeOfExpression); } - public event Action StackAllocExpressionVisited; - - S IAstVisitor.VisitStackAllocExpression (StackAllocExpression stackAllocExpression, T data) + public event Action EnterStackAllocExpression, LeaveStackAllocExpression; + + void IAstVisitor.VisitStackAllocExpression(StackAllocExpression stackAllocExpression) { - var handler = StackAllocExpressionVisited; - if (handler != null) - handler (stackAllocExpression, data); - return VisitChildren (stackAllocExpression, data); + Visit(EnterStackAllocExpression, LeaveStackAllocExpression, stackAllocExpression); } - public event Action ThisReferenceExpressionVisited; - - S IAstVisitor.VisitThisReferenceExpression (ThisReferenceExpression thisReferenceExpression, T data) + public event Action EnterThisReferenceExpression, LeaveThisReferenceExpression; + + void IAstVisitor.VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression) { - var handler = ThisReferenceExpressionVisited; - if (handler != null) - handler (thisReferenceExpression, data); - return VisitChildren (thisReferenceExpression, data); + Visit(EnterThisReferenceExpression, LeaveThisReferenceExpression, thisReferenceExpression); } - public event Action TypeOfExpressionVisited; - - S IAstVisitor.VisitTypeOfExpression (TypeOfExpression typeOfExpression, T data) + public event Action EnterTypeOfExpression, LeaveTypeOfExpression; + + void IAstVisitor.VisitTypeOfExpression(TypeOfExpression typeOfExpression) { - var handler = TypeOfExpressionVisited; - if (handler != null) - handler (typeOfExpression, data); - return VisitChildren (typeOfExpression, data); + Visit(EnterTypeOfExpression, LeaveTypeOfExpression, typeOfExpression); } - public event Action TypeReferenceExpressionVisited; - - S IAstVisitor.VisitTypeReferenceExpression (TypeReferenceExpression typeReferenceExpression, T data) + public event Action EnterTypeReferenceExpression, LeaveTypeReferenceExpression; + + void IAstVisitor.VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression) { - var handler = TypeReferenceExpressionVisited; - if (handler != null) - handler (typeReferenceExpression, data); - return VisitChildren (typeReferenceExpression, data); + Visit(EnterTypeReferenceExpression, LeaveTypeReferenceExpression, typeReferenceExpression); } - public event Action UnaryOperatorExpressionVisited; - - S IAstVisitor.VisitUnaryOperatorExpression (UnaryOperatorExpression unaryOperatorExpression, T data) + public event Action EnterUnaryOperatorExpression, LeaveUnaryOperatorExpression; + + void IAstVisitor.VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression) { - var handler = UnaryOperatorExpressionVisited; - if (handler != null) - handler (unaryOperatorExpression, data); - return VisitChildren (unaryOperatorExpression, data); + Visit(EnterUnaryOperatorExpression, LeaveUnaryOperatorExpression, unaryOperatorExpression); } - public event Action UncheckedExpressionVisited; - - S IAstVisitor.VisitUncheckedExpression (UncheckedExpression uncheckedExpression, T data) + public event Action EnterUncheckedExpression, LeaveUncheckedExpression; + + void IAstVisitor.VisitUncheckedExpression(UncheckedExpression uncheckedExpression) { - var handler = UncheckedExpressionVisited; - if (handler != null) - handler (uncheckedExpression, data); - return VisitChildren (uncheckedExpression, data); + Visit(EnterUncheckedExpression, LeaveUncheckedExpression, uncheckedExpression); } - public event Action QueryExpressionVisited; - - S IAstVisitor.VisitQueryExpression (QueryExpression queryExpression, T data) + public event Action EnterQueryExpression, LeaveQueryExpression; + + void IAstVisitor.VisitQueryExpression(QueryExpression queryExpression) { - var handler = QueryExpressionVisited; - if (handler != null) - handler (queryExpression, data); - return VisitChildren (queryExpression, data); + Visit(EnterQueryExpression, LeaveQueryExpression, queryExpression); } - public event Action QueryContinuationClauseVisited; - - S IAstVisitor.VisitQueryContinuationClause (QueryContinuationClause queryContinuationClause, T data) + public event Action EnterQueryContinuationClause, LeaveQueryContinuationClause; + + void IAstVisitor.VisitQueryContinuationClause(QueryContinuationClause queryContinuationClause) { - var handler = QueryContinuationClauseVisited; - if (handler != null) - handler (queryContinuationClause, data); - return VisitChildren (queryContinuationClause, data); + Visit(EnterQueryContinuationClause, LeaveQueryContinuationClause, queryContinuationClause); } - public event Action QueryFromClauseVisited; - - S IAstVisitor.VisitQueryFromClause (QueryFromClause queryFromClause, T data) + public event Action EnterQueryFromClause, LeaveQueryFromClause; + + void IAstVisitor.VisitQueryFromClause(QueryFromClause queryFromClause) { - var handler = QueryFromClauseVisited; - if (handler != null) - handler (queryFromClause, data); - return VisitChildren (queryFromClause, data); + Visit(EnterQueryFromClause, LeaveQueryFromClause, queryFromClause); } - public event Action QueryLetClauseVisited; - - S IAstVisitor.VisitQueryLetClause (QueryLetClause queryLetClause, T data) + public event Action EnterQueryLetClause, LeaveQueryLetClause; + + void IAstVisitor.VisitQueryLetClause(QueryLetClause queryLetClause) { - var handler = QueryLetClauseVisited; - if (handler != null) - handler (queryLetClause, data); - return VisitChildren (queryLetClause, data); + Visit(EnterQueryLetClause, LeaveQueryLetClause, queryLetClause); } - public event Action QueryWhereClauseVisited; - - S IAstVisitor.VisitQueryWhereClause (QueryWhereClause queryWhereClause, T data) + public event Action EnterQueryWhereClause, LeaveQueryWhereClause; + + void IAstVisitor.VisitQueryWhereClause(QueryWhereClause queryWhereClause) { - var handler = QueryWhereClauseVisited; - if (handler != null) - handler (queryWhereClause, data); - return VisitChildren (queryWhereClause, data); + Visit(EnterQueryWhereClause, LeaveQueryWhereClause, queryWhereClause); } - public event Action QueryJoinClauseVisited; - - S IAstVisitor.VisitQueryJoinClause (QueryJoinClause queryJoinClause, T data) + public event Action EnterQueryJoinClause, LeaveQueryJoinClause; + + void IAstVisitor.VisitQueryJoinClause(QueryJoinClause queryJoinClause) { - var handler = QueryJoinClauseVisited; - if (handler != null) - handler (queryJoinClause, data); - return VisitChildren (queryJoinClause, data); + Visit(EnterQueryJoinClause, LeaveQueryJoinClause, queryJoinClause); } - public event Action QueryOrderClauseVisited; - - S IAstVisitor.VisitQueryOrderClause (QueryOrderClause queryOrderClause, T data) + public event Action EnterQueryOrderClause, LeaveQueryOrderClause; + + void IAstVisitor.VisitQueryOrderClause(QueryOrderClause queryOrderClause) { - var handler = QueryOrderClauseVisited; - if (handler != null) - handler (queryOrderClause, data); - return VisitChildren (queryOrderClause, data); + Visit(EnterQueryOrderClause, LeaveQueryOrderClause, queryOrderClause); } - public event Action QueryOrderingVisited; - - S IAstVisitor.VisitQueryOrdering (QueryOrdering queryOrdering, T data) + public event Action EnterQueryOrdering, LeaveQueryOrdering; + + void IAstVisitor.VisitQueryOrdering(QueryOrdering queryOrdering) { - var handler = QueryOrderingVisited; - if (handler != null) - handler (queryOrdering, data); - return VisitChildren (queryOrdering, data); + Visit(EnterQueryOrdering, LeaveQueryOrdering, queryOrdering); } - public event Action QuerySelectClauseVisited; - - S IAstVisitor.VisitQuerySelectClause (QuerySelectClause querySelectClause, T data) + public event Action EnterQuerySelectClause, LeaveQuerySelectClause; + + void IAstVisitor.VisitQuerySelectClause(QuerySelectClause querySelectClause) { - var handler = QuerySelectClauseVisited; - if (handler != null) - handler (querySelectClause, data); - return VisitChildren (querySelectClause, data); + Visit(EnterQuerySelectClause, LeaveQuerySelectClause, querySelectClause); } - public event Action QueryGroupClauseVisited; - - S IAstVisitor.VisitQueryGroupClause (QueryGroupClause queryGroupClause, T data) + public event Action EnterQueryGroupClause, LeaveQueryGroupClause; + + void IAstVisitor.VisitQueryGroupClause(QueryGroupClause queryGroupClause) { - var handler = QueryGroupClauseVisited; - if (handler != null) - handler (queryGroupClause, data); - return VisitChildren (queryGroupClause, data); + Visit(EnterQueryGroupClause, LeaveQueryGroupClause, queryGroupClause); } - public event Action AsExpressionVisited; - - S IAstVisitor.VisitAsExpression (AsExpression asExpression, T data) + public event Action EnterAsExpression, LeaveAsExpression; + + void IAstVisitor.VisitAsExpression(AsExpression asExpression) { - var handler = AsExpressionVisited; - if (handler != null) - handler (asExpression, data); - return VisitChildren (asExpression, data); + Visit(EnterAsExpression, LeaveAsExpression, asExpression); } - public event Action IsExpressionVisited; - - S IAstVisitor.VisitIsExpression (IsExpression isExpression, T data) + public event Action EnterIsExpression, LeaveIsExpression; + + void IAstVisitor.VisitIsExpression(IsExpression isExpression) { - var handler = IsExpressionVisited; - if (handler != null) - handler (isExpression, data); - return VisitChildren (isExpression, data); + Visit(EnterIsExpression, LeaveIsExpression, isExpression); } - public event Action DefaultValueExpressionVisited; - - S IAstVisitor.VisitDefaultValueExpression (DefaultValueExpression defaultValueExpression, T data) + public event Action EnterDefaultValueExpression, LeaveDefaultValueExpression; + + void IAstVisitor.VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression) { - var handler = DefaultValueExpressionVisited; - if (handler != null) - handler (defaultValueExpression, data); - return VisitChildren (defaultValueExpression, data); + Visit(EnterDefaultValueExpression, LeaveDefaultValueExpression, defaultValueExpression); } - public event Action UndocumentedExpressionVisited; - - S IAstVisitor.VisitUndocumentedExpression (UndocumentedExpression undocumentedExpression, T data) + public event Action EnterUndocumentedExpression, LeaveUndocumentedExpression; + + void IAstVisitor.VisitUndocumentedExpression(UndocumentedExpression undocumentedExpression) { - var handler = UndocumentedExpressionVisited; - if (handler != null) - handler (undocumentedExpression, data); - return VisitChildren (undocumentedExpression, data); + Visit(EnterUndocumentedExpression, LeaveUndocumentedExpression, undocumentedExpression); } - public event Action ArrayInitializerExpressionVisited; - - S IAstVisitor.VisitArrayInitializerExpression (ArrayInitializerExpression arrayInitializerExpression, T data) + public event Action EnterArrayInitializerExpression, LeaveArrayInitializerExpression; + + void IAstVisitor.VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression) { - var handler = ArrayInitializerExpressionVisited; - if (handler != null) - handler (arrayInitializerExpression, data); - return VisitChildren (arrayInitializerExpression, data); + Visit(EnterArrayInitializerExpression, LeaveArrayInitializerExpression, arrayInitializerExpression); } - public event Action ArraySpecifierVisited; - - S IAstVisitor.VisitArraySpecifier (ArraySpecifier arraySpecifier, T data) + public event Action EnterArraySpecifier, LeaveArraySpecifier; + + void IAstVisitor.VisitArraySpecifier(ArraySpecifier arraySpecifier) { - var handler = ArraySpecifierVisited; - if (handler != null) - handler (arraySpecifier, data); - return VisitChildren (arraySpecifier, data); + Visit(EnterArraySpecifier, LeaveArraySpecifier, arraySpecifier); } - public event Action NamedArgumentExpressionVisited; - - S IAstVisitor.VisitNamedArgumentExpression (NamedArgumentExpression namedArgumentExpression, T data) + public event Action EnterNamedArgumentExpression, LeaveNamedArgumentExpression; + + void IAstVisitor.VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression) { - var handler = NamedArgumentExpressionVisited; - if (handler != null) - handler (namedArgumentExpression, data); - return VisitChildren (namedArgumentExpression, data); + Visit(EnterNamedArgumentExpression, LeaveNamedArgumentExpression, namedArgumentExpression); } - public event Action NamedExpressionVisited; - - S IAstVisitor.VisitNamedExpression (NamedExpression namedExpression, T data) + public event Action EnterNamedExpression, LeaveNamedExpression; + + void IAstVisitor.VisitNamedExpression(NamedExpression namedExpression) { - var handler = NamedExpressionVisited; - if (handler != null) - handler (namedExpression, data); - return VisitChildren (namedExpression, data); + Visit(EnterNamedExpression, LeaveNamedExpression, namedExpression); } - public event Action EmptyExpressionVisited; - - S IAstVisitor.VisitEmptyExpression (EmptyExpression emptyExpression, T data) + public event Action EnterEmptyExpression, LeaveEmptyExpression; + + void IAstVisitor.VisitEmptyExpression(EmptyExpression emptyExpression) { - var handler = EmptyExpressionVisited; - if (handler != null) - handler (emptyExpression, data); - return VisitChildren (emptyExpression, data); + Visit(EnterEmptyExpression, LeaveEmptyExpression, emptyExpression); } - S IAstVisitor.VisitPatternPlaceholder (AstNode placeholder, PatternMatching.Pattern pattern, T data) + void IAstVisitor.VisitPatternPlaceholder(AstNode placeholder, PatternMatching.Pattern pattern) { - return VisitChildren (placeholder, data); } } } - - diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/CompilationUnit.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs similarity index 77% rename from src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/CompilationUnit.cs rename to src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs index a48b924974..2906696b36 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/CompilationUnit.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs @@ -1,5 +1,5 @@ // -// CompilationUnit.cs +// SyntaxTree.cs // // Author: // Mike Krüger @@ -23,6 +23,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + using System; using System.Collections.Generic; using ICSharpCode.NRefactory.CSharp.Resolver; @@ -35,7 +36,10 @@ using ICSharpCode.NRefactory.Editor; namespace ICSharpCode.NRefactory.CSharp { - public class CompilationUnit : AstNode + [Obsolete("CompilationUnit was renamed to SyntaxTree", true)] + public class CompilationUnit {} + + public class SyntaxTree : AstNode { public static readonly Role MemberRole = new Role("Member", AstNode.Null); @@ -48,7 +52,7 @@ namespace ICSharpCode.NRefactory.CSharp string fileName; /// - /// Gets/Sets the file name of this compilation unit. + /// Gets/Sets the file name of this syntax tree. /// public string FileName { get { return fileName; } @@ -97,7 +101,7 @@ namespace ICSharpCode.NRefactory.CSharp internal set; } - public CompilationUnit () + public SyntaxTree () { } @@ -120,59 +124,59 @@ namespace ICSharpCode.NRefactory.CSharp protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { - CompilationUnit o = other as CompilationUnit; + SyntaxTree o = other as SyntaxTree; return o != null && GetChildrenByRole(MemberRole).DoMatch(o.GetChildrenByRole(MemberRole), match); } public override void AcceptVisitor (IAstVisitor visitor) { - visitor.VisitCompilationUnit (this); + visitor.VisitSyntaxTree (this); } public override T AcceptVisitor (IAstVisitor visitor) { - return visitor.VisitCompilationUnit (this); + return visitor.VisitSyntaxTree (this); } public override S AcceptVisitor (IAstVisitor visitor, T data) { - return visitor.VisitCompilationUnit (this, data); + return visitor.VisitSyntaxTree (this, data); } /// - /// Converts this compilation unit into a parsed file that can be stored in the type system. + /// Converts this syntax tree into a parsed file that can be stored in the type system. /// - public CSharpParsedFile ToTypeSystem () + public CSharpUnresolvedFile ToTypeSystem () { if (string.IsNullOrEmpty (this.FileName)) - throw new InvalidOperationException ("Cannot use ToTypeSystem() on a compilation unit without file name."); + throw new InvalidOperationException ("Cannot use ToTypeSystem() on a syntax tree without file name."); var v = new TypeSystemConvertVisitor (this.FileName); - v.VisitCompilationUnit (this); - return v.ParsedFile; + v.VisitSyntaxTree (this); + return v.UnresolvedFile; } - public static CompilationUnit Parse (string text, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) + public static SyntaxTree Parse (string program, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) { var parser = new CSharpParser (settings); - return parser.Parse (text, fileName); + return parser.Parse (program, fileName); } - public static CompilationUnit Parse (TextReader reader, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) + public static SyntaxTree Parse (TextReader reader, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) { var parser = new CSharpParser (settings); - return parser.Parse (reader, fileName, 0); + return parser.Parse (reader, fileName); } - public static CompilationUnit Parse (Stream stream, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) + public static SyntaxTree Parse (Stream stream, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) { var parser = new CSharpParser (settings); - return parser.Parse (stream, fileName, 0); + return parser.Parse (stream, fileName); } - public static CompilationUnit Parse (ITextSource textSource, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) + public static SyntaxTree Parse (ITextSource textSource, string fileName = "", CompilerSettings settings = null, CancellationToken cancellationToken = default (CancellationToken)) { var parser = new CSharpParser (settings); - return parser.Parse (textSource, fileName, 0); + return parser.Parse (textSource, fileName); } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/old_ObservableAstVisitor.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/old_ObservableAstVisitor.cs new file mode 100644 index 0000000000..6baf690dfd --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/old_ObservableAstVisitor.cs @@ -0,0 +1,1201 @@ +// +// ObservableAstVisitor.cs +// +// Author: +// Mike Krüger +// +// Copyright (c) 2011 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; + +namespace ICSharpCode.NRefactory.CSharp +{ + [Obsolete("Use the non-generic version of the ObservableAstVisitor instead (the 'data' parameter and return value cannot be used meaningfully when using events)")] + public class ObservableAstVisitor: IAstVisitor + { + S VisitChildren (AstNode node, T data) + { + AstNode next; + for (var child = node.FirstChild; child != null; child = next) { + // Store next to allow the loop to continue + // if the visitor removes/replaces child. + next = child.NextSibling; + child.AcceptVisitor (this, data); + } + return default (S); + } + + public event Action CompilationUnitVisited; + + S IAstVisitor.VisitSyntaxTree (SyntaxTree unit, T data) + { + var handler = CompilationUnitVisited; + if (handler != null) + handler (unit, data); + return VisitChildren (unit, data); + } + + public event Action CommentVisited; + + S IAstVisitor.VisitComment (Comment comment, T data) + { + var handler = CommentVisited; + if (handler != null) + handler (comment, data); + return VisitChildren (comment, data); + } + + public event Action NewLineVisited; + + S IAstVisitor.VisitNewLine(NewLineNode newLineNode, T data) + { + var handler = NewLineVisited; + if (handler != null) + handler(newLineNode, data); + return VisitChildren(newLineNode, data); + } + + public event Action WhitespaceVisited; + + S IAstVisitor.VisitWhitespace(WhitespaceNode whitespace, T data) + { + var handler = WhitespaceVisited; + if (handler != null) + handler(whitespace, data); + return VisitChildren(whitespace, data); + } + + public event Action TextVisited; + + S IAstVisitor.VisitText(TextNode textNode, T data) + { + var handler = TextVisited; + if (handler != null) + handler(textNode, data); + return VisitChildren(textNode, data); + } + + public event Action PreProcessorDirectiveVisited; + S IAstVisitor.VisitPreProcessorDirective (PreProcessorDirective preProcessorDirective, T data) + { + var handler = PreProcessorDirectiveVisited; + if (handler != null) + handler (preProcessorDirective, data); + return VisitChildren (preProcessorDirective, data); + } + + public event Action DocumentationReferenceVisited; + + S IAstVisitor.VisitDocumentationReference (DocumentationReference documentationReference, T data) + { + var handler = DocumentationReferenceVisited; + if (handler != null) + handler (documentationReference, data); + return VisitChildren (documentationReference, data); + } + + public event Action IdentifierVisited; + + S IAstVisitor.VisitIdentifier (Identifier identifier, T data) + { + var handler = IdentifierVisited; + if (handler != null) + handler (identifier, data); + return VisitChildren (identifier, data); + } + + public event Action CSharpTokenNodeVisited; + + S IAstVisitor.VisitCSharpTokenNode (CSharpTokenNode token, T data) + { + var handler = CSharpTokenNodeVisited; + if (handler != null) + handler (token, data); + return VisitChildren (token, data); + } + + public event Action PrimitiveTypeVisited; + + S IAstVisitor.VisitPrimitiveType (PrimitiveType primitiveType, T data) + { + var handler = PrimitiveTypeVisited; + if (handler != null) + handler (primitiveType, data); + return VisitChildren (primitiveType, data); + } + + public event Action ComposedTypeVisited; + + S IAstVisitor.VisitComposedType (ComposedType composedType, T data) + { + var handler = ComposedTypeVisited; + if (handler != null) + handler (composedType, data); + return VisitChildren (composedType, data); + } + + public event Action SimpleTypeVisited; + + S IAstVisitor.VisitSimpleType (SimpleType simpleType, T data) + { + var handler = SimpleTypeVisited; + if (handler != null) + handler (simpleType, data); + return VisitChildren (simpleType, data); + } + + public event Action MemberTypeVisited; + + S IAstVisitor.VisitMemberType (MemberType memberType, T data) + { + var handler = MemberTypeVisited; + if (handler != null) + handler (memberType, data); + return VisitChildren (memberType, data); + } + + public event Action AttributeVisited; + + S IAstVisitor.VisitAttribute (Attribute attribute, T data) + { + var handler = AttributeVisited; + if (handler != null) + handler (attribute, data); + return VisitChildren (attribute, data); + } + + public event Action AttributeSectionVisited; + + S IAstVisitor.VisitAttributeSection (AttributeSection attributeSection, T data) + { + var handler = AttributeSectionVisited; + if (handler != null) + handler (attributeSection, data); + return VisitChildren (attributeSection, data); + } + + public event Action DelegateDeclarationVisited; + + S IAstVisitor.VisitDelegateDeclaration (DelegateDeclaration delegateDeclaration, T data) + { + var handler = DelegateDeclarationVisited; + if (handler != null) + handler (delegateDeclaration, data); + return VisitChildren (delegateDeclaration, data); + } + + public event Action NamespaceDeclarationVisited; + + S IAstVisitor.VisitNamespaceDeclaration (NamespaceDeclaration namespaceDeclaration, T data) + { + var handler = NamespaceDeclarationVisited; + if (handler != null) + handler (namespaceDeclaration, data); + return VisitChildren (namespaceDeclaration, data); + } + + public event Action TypeDeclarationVisited; + + S IAstVisitor.VisitTypeDeclaration (TypeDeclaration typeDeclaration, T data) + { + var handler = TypeDeclarationVisited; + if (handler != null) + handler (typeDeclaration, data); + return VisitChildren (typeDeclaration, data); + } + + public event Action TypeParameterDeclarationVisited; + + S IAstVisitor.VisitTypeParameterDeclaration (TypeParameterDeclaration typeParameterDeclaration, T data) + { + var handler = TypeParameterDeclarationVisited; + if (handler != null) + handler (typeParameterDeclaration, data); + return VisitChildren (typeParameterDeclaration, data); + } + + public event Action EnumMemberDeclarationVisited; + + S IAstVisitor.VisitEnumMemberDeclaration (EnumMemberDeclaration enumMemberDeclaration, T data) + { + var handler = EnumMemberDeclarationVisited; + if (handler != null) + handler (enumMemberDeclaration, data); + return VisitChildren (enumMemberDeclaration, data); + } + + public event Action UsingDeclarationVisited; + + S IAstVisitor.VisitUsingDeclaration (UsingDeclaration usingDeclaration, T data) + { + var handler = UsingDeclarationVisited; + if (handler != null) + handler (usingDeclaration, data); + return VisitChildren (usingDeclaration, data); + } + + public event Action UsingAliasDeclarationVisited; + + S IAstVisitor.VisitUsingAliasDeclaration (UsingAliasDeclaration usingDeclaration, T data) + { + var handler = UsingAliasDeclarationVisited; + if (handler != null) + handler (usingDeclaration, data); + return VisitChildren (usingDeclaration, data); + } + + public event Action ExternAliasDeclarationVisited; + + S IAstVisitor.VisitExternAliasDeclaration (ExternAliasDeclaration externAliasDeclaration, T data) + { + var handler = ExternAliasDeclarationVisited; + if (handler != null) + handler (externAliasDeclaration, data); + return VisitChildren (externAliasDeclaration, data); + } + + public event Action ConstructorDeclarationVisited; + + S IAstVisitor.VisitConstructorDeclaration (ConstructorDeclaration constructorDeclaration, T data) + { + var handler = ConstructorDeclarationVisited; + if (handler != null) + handler (constructorDeclaration, data); + return VisitChildren (constructorDeclaration, data); + } + + public event Action ConstructorInitializerVisited; + + S IAstVisitor.VisitConstructorInitializer (ConstructorInitializer constructorInitializer, T data) + { + var handler = ConstructorInitializerVisited; + if (handler != null) + handler (constructorInitializer, data); + return VisitChildren (constructorInitializer, data); + } + + public event Action DestructorDeclarationVisited; + + S IAstVisitor.VisitDestructorDeclaration (DestructorDeclaration destructorDeclaration, T data) + { + var handler = DestructorDeclarationVisited; + if (handler != null) + handler (destructorDeclaration, data); + return VisitChildren (destructorDeclaration, data); + } + + public event Action EventDeclarationVisited; + + S IAstVisitor.VisitEventDeclaration (EventDeclaration eventDeclaration, T data) + { + var handler = EventDeclarationVisited; + if (handler != null) + handler (eventDeclaration, data); + return VisitChildren (eventDeclaration, data); + } + + public event Action CustomEventDeclarationVisited; + + S IAstVisitor.VisitCustomEventDeclaration (CustomEventDeclaration eventDeclaration, T data) + { + var handler = CustomEventDeclarationVisited; + if (handler != null) + handler (eventDeclaration, data); + return VisitChildren (eventDeclaration, data); + } + + public event Action FieldDeclarationVisited; + + S IAstVisitor.VisitFieldDeclaration (FieldDeclaration fieldDeclaration, T data) + { + var handler = FieldDeclarationVisited; + if (handler != null) + handler (fieldDeclaration, data); + return VisitChildren (fieldDeclaration, data); + } + + public event Action FixedFieldDeclarationVisited; + + S IAstVisitor.VisitFixedFieldDeclaration (FixedFieldDeclaration fixedFieldDeclaration, T data) + { + var handler = FixedFieldDeclarationVisited; + if (handler != null) + handler (fixedFieldDeclaration, data); + return VisitChildren (fixedFieldDeclaration, data); + } + + public event Action FixedVariableInitializerVisited; + + S IAstVisitor.VisitFixedVariableInitializer (FixedVariableInitializer fixedVariableInitializer, T data) + { + var handler = FixedVariableInitializerVisited; + if (handler != null) + handler (fixedVariableInitializer, data); + return VisitChildren (fixedVariableInitializer, data); + } + + public event Action IndexerDeclarationVisited; + + S IAstVisitor.VisitIndexerDeclaration (IndexerDeclaration indexerDeclaration, T data) + { + var handler = IndexerDeclarationVisited; + if (handler != null) + handler (indexerDeclaration, data); + return VisitChildren (indexerDeclaration, data); + } + + public event Action MethodDeclarationVisited; + + S IAstVisitor.VisitMethodDeclaration (MethodDeclaration methodDeclaration, T data) + { + var handler = MethodDeclarationVisited; + if (handler != null) + handler (methodDeclaration, data); + return VisitChildren (methodDeclaration, data); + } + + public event Action OperatorDeclarationVisited; + + S IAstVisitor.VisitOperatorDeclaration (OperatorDeclaration operatorDeclaration, T data) + { + var handler = OperatorDeclarationVisited; + if (handler != null) + handler (operatorDeclaration, data); + return VisitChildren (operatorDeclaration, data); + } + + public event Action PropertyDeclarationVisited; + + S IAstVisitor.VisitPropertyDeclaration (PropertyDeclaration propertyDeclaration, T data) + { + var handler = PropertyDeclarationVisited; + if (handler != null) + handler (propertyDeclaration, data); + return VisitChildren (propertyDeclaration, data); + } + + public event Action AccessorVisited; + + S IAstVisitor.VisitAccessor (Accessor accessor, T data) + { + var handler = AccessorVisited; + if (handler != null) + handler (accessor, data); + return VisitChildren (accessor, data); + } + + public event Action VariableInitializerVisited; + + S IAstVisitor.VisitVariableInitializer (VariableInitializer variableInitializer, T data) + { + var handler = VariableInitializerVisited; + if (handler != null) + handler (variableInitializer, data); + return VisitChildren (variableInitializer, data); + } + + public event Action ParameterDeclarationVisited; + + S IAstVisitor.VisitParameterDeclaration (ParameterDeclaration parameterDeclaration, T data) + { + var handler = ParameterDeclarationVisited; + if (handler != null) + handler (parameterDeclaration, data); + return VisitChildren (parameterDeclaration, data); + } + + public event Action ConstraintVisited; + + S IAstVisitor.VisitConstraint (Constraint constraint, T data) + { + var handler = ConstraintVisited; + if (handler != null) + handler (constraint, data); + return VisitChildren (constraint, data); + } + + public event Action BlockStatementVisited; + + S IAstVisitor.VisitBlockStatement (BlockStatement blockStatement, T data) + { + var handler = BlockStatementVisited; + if (handler != null) + handler (blockStatement, data); + return VisitChildren (blockStatement, data); + } + + public event Action ExpressionStatementVisited; + + S IAstVisitor.VisitExpressionStatement (ExpressionStatement expressionStatement, T data) + { + var handler = ExpressionStatementVisited; + if (handler != null) + handler (expressionStatement, data); + return VisitChildren (expressionStatement, data); + } + + public event Action BreakStatementVisited; + + S IAstVisitor.VisitBreakStatement (BreakStatement breakStatement, T data) + { + var handler = BreakStatementVisited; + if (handler != null) + handler (breakStatement, data); + return VisitChildren (breakStatement, data); + } + + public event Action CheckedStatementVisited; + + S IAstVisitor.VisitCheckedStatement (CheckedStatement checkedStatement, T data) + { + var handler = CheckedStatementVisited; + if (handler != null) + handler (checkedStatement, data); + return VisitChildren (checkedStatement, data); + } + + public event Action ContinueStatementVisited; + + S IAstVisitor.VisitContinueStatement (ContinueStatement continueStatement, T data) + { + var handler = ContinueStatementVisited; + if (handler != null) + handler (continueStatement, data); + return VisitChildren (continueStatement, data); + } + + public event Action DoWhileStatementVisited; + + S IAstVisitor.VisitDoWhileStatement (DoWhileStatement doWhileStatement, T data) + { + var handler = DoWhileStatementVisited; + if (handler != null) + handler (doWhileStatement, data); + return VisitChildren (doWhileStatement, data); + } + + public event Action EmptyStatementVisited; + + S IAstVisitor.VisitEmptyStatement (EmptyStatement emptyStatement, T data) + { + var handler = EmptyStatementVisited; + if (handler != null) + handler (emptyStatement, data); + return VisitChildren (emptyStatement, data); + } + + public event Action FixedStatementVisited; + + S IAstVisitor.VisitFixedStatement (FixedStatement fixedStatement, T data) + { + var handler = FixedStatementVisited; + if (handler != null) + handler (fixedStatement, data); + return VisitChildren (fixedStatement, data); + } + + public event Action ForeachStatementVisited; + + S IAstVisitor.VisitForeachStatement (ForeachStatement foreachStatement, T data) + { + var handler = ForeachStatementVisited; + if (handler != null) + handler (foreachStatement, data); + return VisitChildren (foreachStatement, data); + } + + public event Action ForStatementVisited; + + S IAstVisitor.VisitForStatement (ForStatement forStatement, T data) + { + var handler = ForStatementVisited; + if (handler != null) + handler (forStatement, data); + return VisitChildren (forStatement, data); + } + + public event Action GotoCaseStatementVisited; + + S IAstVisitor.VisitGotoCaseStatement (GotoCaseStatement gotoCaseStatement, T data) + { + var handler = GotoCaseStatementVisited; + if (handler != null) + handler (gotoCaseStatement, data); + return VisitChildren (gotoCaseStatement, data); + } + + public event Action GotoDefaultStatementVisited; + + S IAstVisitor.VisitGotoDefaultStatement (GotoDefaultStatement gotoDefaultStatement, T data) + { + var handler = GotoDefaultStatementVisited; + if (handler != null) + handler (gotoDefaultStatement, data); + return VisitChildren (gotoDefaultStatement, data); + } + + public event Action GotoStatementVisited; + + S IAstVisitor.VisitGotoStatement (GotoStatement gotoStatement, T data) + { + var handler = GotoStatementVisited; + if (handler != null) + handler (gotoStatement, data); + return VisitChildren (gotoStatement, data); + } + + public event Action IfElseStatementVisited; + + S IAstVisitor.VisitIfElseStatement (IfElseStatement ifElseStatement, T data) + { + var handler = IfElseStatementVisited; + if (handler != null) + handler (ifElseStatement, data); + return VisitChildren (ifElseStatement, data); + } + + public event Action LabelStatementVisited; + + S IAstVisitor.VisitLabelStatement (LabelStatement labelStatement, T data) + { + var handler = LabelStatementVisited; + if (handler != null) + handler (labelStatement, data); + return VisitChildren (labelStatement, data); + } + + public event Action LockStatementVisited; + + S IAstVisitor.VisitLockStatement (LockStatement lockStatement, T data) + { + var handler = LockStatementVisited; + if (handler != null) + handler (lockStatement, data); + return VisitChildren (lockStatement, data); + } + + public event Action ReturnStatementVisited; + + S IAstVisitor.VisitReturnStatement (ReturnStatement returnStatement, T data) + { + var handler = ReturnStatementVisited; + if (handler != null) + handler (returnStatement, data); + return VisitChildren (returnStatement, data); + } + + public event Action SwitchStatementVisited; + + S IAstVisitor.VisitSwitchStatement (SwitchStatement switchStatement, T data) + { + var handler = SwitchStatementVisited; + if (handler != null) + handler (switchStatement, data); + return VisitChildren (switchStatement, data); + } + + public event Action SwitchSectionVisited; + + S IAstVisitor.VisitSwitchSection (SwitchSection switchSection, T data) + { + var handler = SwitchSectionVisited; + if (handler != null) + handler (switchSection, data); + return VisitChildren (switchSection, data); + } + + public event Action CaseLabelVisited; + + S IAstVisitor.VisitCaseLabel (CaseLabel caseLabel, T data) + { + var handler = CaseLabelVisited; + if (handler != null) + handler (caseLabel, data); + return VisitChildren (caseLabel, data); + } + + public event Action ThrowStatementVisited; + + S IAstVisitor.VisitThrowStatement (ThrowStatement throwStatement, T data) + { + var handler = ThrowStatementVisited; + if (handler != null) + handler (throwStatement, data); + return VisitChildren (throwStatement, data); + } + + public event Action TryCatchStatementVisited; + + S IAstVisitor.VisitTryCatchStatement (TryCatchStatement tryCatchStatement, T data) + { + var handler = TryCatchStatementVisited; + if (handler != null) + handler (tryCatchStatement, data); + return VisitChildren (tryCatchStatement, data); + } + + public event Action CatchClauseVisited; + + S IAstVisitor.VisitCatchClause (CatchClause catchClause, T data) + { + var handler = CatchClauseVisited; + if (handler != null) + handler (catchClause, data); + return VisitChildren (catchClause, data); + } + + public event Action UncheckedStatementVisited; + + S IAstVisitor.VisitUncheckedStatement (UncheckedStatement uncheckedStatement, T data) + { + var handler = UncheckedStatementVisited; + if (handler != null) + handler (uncheckedStatement, data); + return VisitChildren (uncheckedStatement, data); + } + + public event Action UnsafeStatementVisited; + + S IAstVisitor.VisitUnsafeStatement (UnsafeStatement unsafeStatement, T data) + { + var handler = UnsafeStatementVisited; + if (handler != null) + handler (unsafeStatement, data); + return VisitChildren (unsafeStatement, data); + } + + public event Action UsingStatementVisited; + + S IAstVisitor.VisitUsingStatement (UsingStatement usingStatement, T data) + { + var handler = UsingStatementVisited; + if (handler != null) + handler (usingStatement, data); + return VisitChildren (usingStatement, data); + } + + public event Action VariableDeclarationStatementVisited; + + S IAstVisitor.VisitVariableDeclarationStatement (VariableDeclarationStatement variableDeclarationStatement, T data) + { + var handler = VariableDeclarationStatementVisited; + if (handler != null) + handler (variableDeclarationStatement, data); + return VisitChildren (variableDeclarationStatement, data); + } + + public event Action WhileStatementVisited; + + S IAstVisitor.VisitWhileStatement (WhileStatement whileStatement, T data) + { + var handler = WhileStatementVisited; + if (handler != null) + handler (whileStatement, data); + return VisitChildren (whileStatement, data); + } + + public event Action YieldBreakStatementVisited; + + S IAstVisitor.VisitYieldBreakStatement (YieldBreakStatement yieldBreakStatement, T data) + { + var handler = YieldBreakStatementVisited; + if (handler != null) + handler (yieldBreakStatement, data); + return VisitChildren (yieldBreakStatement, data); + } + + public event Action YieldReturnStatementVisited; + + S IAstVisitor.VisitYieldReturnStatement (YieldReturnStatement yieldStatement, T data) + { + var handler = YieldReturnStatementVisited; + if (handler != null) + handler (yieldStatement, data); + return VisitChildren (yieldStatement, data); + } + + public event Action AnonymousMethodExpressionVisited; + + S IAstVisitor.VisitAnonymousMethodExpression (AnonymousMethodExpression anonymousMethodExpression, T data) + { + var handler = AnonymousMethodExpressionVisited; + if (handler != null) + handler (anonymousMethodExpression, data); + return VisitChildren (anonymousMethodExpression, data); + } + + public event Action LambdaExpressionVisited; + + S IAstVisitor.VisitLambdaExpression (LambdaExpression lambdaExpression, T data) + { + var handler = LambdaExpressionVisited; + if (handler != null) + handler (lambdaExpression, data); + return VisitChildren (lambdaExpression, data); + } + + public event Action AssignmentExpressionVisited; + + S IAstVisitor.VisitAssignmentExpression (AssignmentExpression assignmentExpression, T data) + { + var handler = AssignmentExpressionVisited; + if (handler != null) + handler (assignmentExpression, data); + return VisitChildren (assignmentExpression, data); + } + + public event Action BaseReferenceExpressionVisited; + + S IAstVisitor.VisitBaseReferenceExpression (BaseReferenceExpression baseReferenceExpression, T data) + { + var handler = BaseReferenceExpressionVisited; + if (handler != null) + handler (baseReferenceExpression, data); + return VisitChildren (baseReferenceExpression, data); + } + + public event Action BinaryOperatorExpressionVisited; + + S IAstVisitor.VisitBinaryOperatorExpression (BinaryOperatorExpression binaryOperatorExpression, T data) + { + var handler = BinaryOperatorExpressionVisited; + if (handler != null) + handler (binaryOperatorExpression, data); + return VisitChildren (binaryOperatorExpression, data); + } + + public event Action CastExpressionVisited; + + S IAstVisitor.VisitCastExpression (CastExpression castExpression, T data) + { + var handler = CastExpressionVisited; + if (handler != null) + handler (castExpression, data); + return VisitChildren (castExpression, data); + } + + public event Action CheckedExpressionVisited; + + S IAstVisitor.VisitCheckedExpression (CheckedExpression checkedExpression, T data) + { + var handler = CheckedExpressionVisited; + if (handler != null) + handler (checkedExpression, data); + return VisitChildren (checkedExpression, data); + } + + public event Action ConditionalExpressionVisited; + + S IAstVisitor.VisitConditionalExpression (ConditionalExpression conditionalExpression, T data) + { + var handler = ConditionalExpressionVisited; + if (handler != null) + handler (conditionalExpression, data); + return VisitChildren (conditionalExpression, data); + } + + public event Action IdentifierExpressionVisited; + + S IAstVisitor.VisitIdentifierExpression (IdentifierExpression identifierExpression, T data) + { + var handler = IdentifierExpressionVisited; + if (handler != null) + handler (identifierExpression, data); + return VisitChildren (identifierExpression, data); + } + + public event Action IndexerExpressionVisited; + + S IAstVisitor.VisitIndexerExpression (IndexerExpression indexerExpression, T data) + { + var handler = IndexerExpressionVisited; + if (handler != null) + handler (indexerExpression, data); + return VisitChildren (indexerExpression, data); + } + + public event Action InvocationExpressionVisited; + + S IAstVisitor.VisitInvocationExpression (InvocationExpression invocationExpression, T data) + { + var handler = InvocationExpressionVisited; + if (handler != null) + handler (invocationExpression, data); + return VisitChildren (invocationExpression, data); + } + + public event Action DirectionExpressionVisited; + + S IAstVisitor.VisitDirectionExpression (DirectionExpression directionExpression, T data) + { + var handler = DirectionExpressionVisited; + if (handler != null) + handler (directionExpression, data); + return VisitChildren (directionExpression, data); + } + + public event Action MemberReferenceExpressionVisited; + + S IAstVisitor.VisitMemberReferenceExpression (MemberReferenceExpression memberReferenceExpression, T data) + { + var handler = MemberReferenceExpressionVisited; + if (handler != null) + handler (memberReferenceExpression, data); + return VisitChildren (memberReferenceExpression, data); + } + + public event Action NullReferenceExpressionVisited; + + S IAstVisitor.VisitNullReferenceExpression (NullReferenceExpression nullReferenceExpression, T data) + { + var handler = NullReferenceExpressionVisited; + if (handler != null) + handler (nullReferenceExpression, data); + return VisitChildren (nullReferenceExpression, data); + } + + public event Action ObjectCreateExpressionVisited; + + S IAstVisitor.VisitObjectCreateExpression (ObjectCreateExpression objectCreateExpression, T data) + { + var handler = ObjectCreateExpressionVisited; + if (handler != null) + handler (objectCreateExpression, data); + return VisitChildren (objectCreateExpression, data); + } + + public event Action AnonymousTypeCreateExpressionVisited; + + S IAstVisitor.VisitAnonymousTypeCreateExpression (AnonymousTypeCreateExpression anonymousTypeCreateExpression, T data) + { + var handler = AnonymousTypeCreateExpressionVisited; + if (handler != null) + handler (anonymousTypeCreateExpression, data); + return VisitChildren (anonymousTypeCreateExpression, data); + } + + public event Action ArrayCreateExpressionVisited; + + S IAstVisitor.VisitArrayCreateExpression (ArrayCreateExpression arraySCreateExpression, T data) + { + var handler = ArrayCreateExpressionVisited; + if (handler != null) + handler (arraySCreateExpression, data); + return VisitChildren (arraySCreateExpression, data); + } + + public event Action ParenthesizedExpressionVisited; + + S IAstVisitor.VisitParenthesizedExpression (ParenthesizedExpression parenthesizedExpression, T data) + { + var handler = ParenthesizedExpressionVisited; + if (handler != null) + handler (parenthesizedExpression, data); + return VisitChildren (parenthesizedExpression, data); + } + + public event Action PointerReferenceExpressionVisited; + + S IAstVisitor.VisitPointerReferenceExpression (PointerReferenceExpression pointerReferenceExpression, T data) + { + var handler = PointerReferenceExpressionVisited; + if (handler != null) + handler (pointerReferenceExpression, data); + return VisitChildren (pointerReferenceExpression, data); + } + + public event Action PrimitiveExpressionVisited; + + S IAstVisitor.VisitPrimitiveExpression (PrimitiveExpression primitiveExpression, T data) + { + var handler = PrimitiveExpressionVisited; + if (handler != null) + handler (primitiveExpression, data); + return VisitChildren (primitiveExpression, data); + } + + public event Action SizeOfExpressionVisited; + + S IAstVisitor.VisitSizeOfExpression (SizeOfExpression sizeOfExpression, T data) + { + var handler = SizeOfExpressionVisited; + if (handler != null) + handler (sizeOfExpression, data); + return VisitChildren (sizeOfExpression, data); + } + + public event Action StackAllocExpressionVisited; + + S IAstVisitor.VisitStackAllocExpression (StackAllocExpression stackAllocExpression, T data) + { + var handler = StackAllocExpressionVisited; + if (handler != null) + handler (stackAllocExpression, data); + return VisitChildren (stackAllocExpression, data); + } + + public event Action ThisReferenceExpressionVisited; + + S IAstVisitor.VisitThisReferenceExpression (ThisReferenceExpression thisReferenceExpression, T data) + { + var handler = ThisReferenceExpressionVisited; + if (handler != null) + handler (thisReferenceExpression, data); + return VisitChildren (thisReferenceExpression, data); + } + + public event Action TypeOfExpressionVisited; + + S IAstVisitor.VisitTypeOfExpression (TypeOfExpression typeOfExpression, T data) + { + var handler = TypeOfExpressionVisited; + if (handler != null) + handler (typeOfExpression, data); + return VisitChildren (typeOfExpression, data); + } + + public event Action TypeReferenceExpressionVisited; + + S IAstVisitor.VisitTypeReferenceExpression (TypeReferenceExpression typeReferenceExpression, T data) + { + var handler = TypeReferenceExpressionVisited; + if (handler != null) + handler (typeReferenceExpression, data); + return VisitChildren (typeReferenceExpression, data); + } + + public event Action UnaryOperatorExpressionVisited; + + S IAstVisitor.VisitUnaryOperatorExpression (UnaryOperatorExpression unaryOperatorExpression, T data) + { + var handler = UnaryOperatorExpressionVisited; + if (handler != null) + handler (unaryOperatorExpression, data); + return VisitChildren (unaryOperatorExpression, data); + } + + public event Action UncheckedExpressionVisited; + + S IAstVisitor.VisitUncheckedExpression (UncheckedExpression uncheckedExpression, T data) + { + var handler = UncheckedExpressionVisited; + if (handler != null) + handler (uncheckedExpression, data); + return VisitChildren (uncheckedExpression, data); + } + + public event Action QueryExpressionVisited; + + S IAstVisitor.VisitQueryExpression (QueryExpression queryExpression, T data) + { + var handler = QueryExpressionVisited; + if (handler != null) + handler (queryExpression, data); + return VisitChildren (queryExpression, data); + } + + public event Action QueryContinuationClauseVisited; + + S IAstVisitor.VisitQueryContinuationClause (QueryContinuationClause queryContinuationClause, T data) + { + var handler = QueryContinuationClauseVisited; + if (handler != null) + handler (queryContinuationClause, data); + return VisitChildren (queryContinuationClause, data); + } + + public event Action QueryFromClauseVisited; + + S IAstVisitor.VisitQueryFromClause (QueryFromClause queryFromClause, T data) + { + var handler = QueryFromClauseVisited; + if (handler != null) + handler (queryFromClause, data); + return VisitChildren (queryFromClause, data); + } + + public event Action QueryLetClauseVisited; + + S IAstVisitor.VisitQueryLetClause (QueryLetClause queryLetClause, T data) + { + var handler = QueryLetClauseVisited; + if (handler != null) + handler (queryLetClause, data); + return VisitChildren (queryLetClause, data); + } + + public event Action QueryWhereClauseVisited; + + S IAstVisitor.VisitQueryWhereClause (QueryWhereClause queryWhereClause, T data) + { + var handler = QueryWhereClauseVisited; + if (handler != null) + handler (queryWhereClause, data); + return VisitChildren (queryWhereClause, data); + } + + public event Action QueryJoinClauseVisited; + + S IAstVisitor.VisitQueryJoinClause (QueryJoinClause queryJoinClause, T data) + { + var handler = QueryJoinClauseVisited; + if (handler != null) + handler (queryJoinClause, data); + return VisitChildren (queryJoinClause, data); + } + + public event Action QueryOrderClauseVisited; + + S IAstVisitor.VisitQueryOrderClause (QueryOrderClause queryOrderClause, T data) + { + var handler = QueryOrderClauseVisited; + if (handler != null) + handler (queryOrderClause, data); + return VisitChildren (queryOrderClause, data); + } + + public event Action QueryOrderingVisited; + + S IAstVisitor.VisitQueryOrdering (QueryOrdering queryOrdering, T data) + { + var handler = QueryOrderingVisited; + if (handler != null) + handler (queryOrdering, data); + return VisitChildren (queryOrdering, data); + } + + public event Action QuerySelectClauseVisited; + + S IAstVisitor.VisitQuerySelectClause (QuerySelectClause querySelectClause, T data) + { + var handler = QuerySelectClauseVisited; + if (handler != null) + handler (querySelectClause, data); + return VisitChildren (querySelectClause, data); + } + + public event Action QueryGroupClauseVisited; + + S IAstVisitor.VisitQueryGroupClause (QueryGroupClause queryGroupClause, T data) + { + var handler = QueryGroupClauseVisited; + if (handler != null) + handler (queryGroupClause, data); + return VisitChildren (queryGroupClause, data); + } + + public event Action AsExpressionVisited; + + S IAstVisitor.VisitAsExpression (AsExpression asExpression, T data) + { + var handler = AsExpressionVisited; + if (handler != null) + handler (asExpression, data); + return VisitChildren (asExpression, data); + } + + public event Action IsExpressionVisited; + + S IAstVisitor.VisitIsExpression (IsExpression isExpression, T data) + { + var handler = IsExpressionVisited; + if (handler != null) + handler (isExpression, data); + return VisitChildren (isExpression, data); + } + + public event Action DefaultValueExpressionVisited; + + S IAstVisitor.VisitDefaultValueExpression (DefaultValueExpression defaultValueExpression, T data) + { + var handler = DefaultValueExpressionVisited; + if (handler != null) + handler (defaultValueExpression, data); + return VisitChildren (defaultValueExpression, data); + } + + public event Action UndocumentedExpressionVisited; + + S IAstVisitor.VisitUndocumentedExpression (UndocumentedExpression undocumentedExpression, T data) + { + var handler = UndocumentedExpressionVisited; + if (handler != null) + handler (undocumentedExpression, data); + return VisitChildren (undocumentedExpression, data); + } + + public event Action ArrayInitializerExpressionVisited; + + S IAstVisitor.VisitArrayInitializerExpression (ArrayInitializerExpression arrayInitializerExpression, T data) + { + var handler = ArrayInitializerExpressionVisited; + if (handler != null) + handler (arrayInitializerExpression, data); + return VisitChildren (arrayInitializerExpression, data); + } + + public event Action ArraySpecifierVisited; + + S IAstVisitor.VisitArraySpecifier (ArraySpecifier arraySpecifier, T data) + { + var handler = ArraySpecifierVisited; + if (handler != null) + handler (arraySpecifier, data); + return VisitChildren (arraySpecifier, data); + } + + public event Action NamedArgumentExpressionVisited; + + S IAstVisitor.VisitNamedArgumentExpression (NamedArgumentExpression namedArgumentExpression, T data) + { + var handler = NamedArgumentExpressionVisited; + if (handler != null) + handler (namedArgumentExpression, data); + return VisitChildren (namedArgumentExpression, data); + } + + public event Action NamedExpressionVisited; + + S IAstVisitor.VisitNamedExpression (NamedExpression namedExpression, T data) + { + var handler = NamedExpressionVisited; + if (handler != null) + handler (namedExpression, data); + return VisitChildren (namedExpression, data); + } + + public event Action EmptyExpressionVisited; + + S IAstVisitor.VisitEmptyExpression (EmptyExpression emptyExpression, T data) + { + var handler = EmptyExpressionVisited; + if (handler != null) + handler (emptyExpression, data); + return VisitChildren (emptyExpression, data); + } + + S IAstVisitor.VisitPatternPlaceholder (AstNode placeholder, PatternMatching.Pattern pattern, T data) + { + return VisitChildren (placeholder, data); + } + } +} + + diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/CSharpProjectContent.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/CSharpProjectContent.cs index a890c1ea41..fccba4622f 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/CSharpProjectContent.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/CSharpProjectContent.cs @@ -31,15 +31,15 @@ namespace ICSharpCode.NRefactory.CSharp public class CSharpProjectContent : IProjectContent { string assemblyName; + string projectFileName; string location; - Dictionary parsedFiles; + Dictionary unresolvedFiles; List assemblyReferences; CompilerSettings compilerSettings; public CSharpProjectContent() { - this.assemblyName = string.Empty; - this.parsedFiles = new Dictionary(Platform.FileNameComparer); + this.unresolvedFiles = new Dictionary(Platform.FileNameComparer); this.assemblyReferences = new List(); this.compilerSettings = new CompilerSettings(); compilerSettings.Freeze(); @@ -48,20 +48,25 @@ namespace ICSharpCode.NRefactory.CSharp protected CSharpProjectContent(CSharpProjectContent pc) { this.assemblyName = pc.assemblyName; + this.projectFileName = pc.projectFileName; this.location = pc.location; - this.parsedFiles = new Dictionary(pc.parsedFiles, Platform.FileNameComparer); + this.unresolvedFiles = new Dictionary(pc.unresolvedFiles, Platform.FileNameComparer); this.assemblyReferences = new List(pc.assemblyReferences); this.compilerSettings = pc.compilerSettings; } - public IEnumerable Files { - get { return parsedFiles.Values; } + public IEnumerable Files { + get { return unresolvedFiles.Values; } } public IEnumerable AssemblyReferences { get { return assemblyReferences; } } + public string ProjectFileName { + get { return projectFileName; } + } + public string AssemblyName { get { return assemblyName; } } @@ -96,10 +101,10 @@ namespace ICSharpCode.NRefactory.CSharp } } - public IParsedFile GetFile(string fileName) + public IUnresolvedFile GetFile(string fileName) { - IParsedFile file; - if (parsedFiles.TryGetValue(fileName, out file)) + IUnresolvedFile file; + if (unresolvedFiles.TryGetValue(fileName, out file)) return file; else return null; @@ -129,11 +134,18 @@ namespace ICSharpCode.NRefactory.CSharp pc.assemblyName = newAssemblyName; return pc; } + + public IProjectContent SetProjectFileName(string newProjectFileName) + { + CSharpProjectContent pc = Clone(); + pc.projectFileName = newProjectFileName; + return pc; + } - public IProjectContent SetLocation(string location) + public IProjectContent SetLocation(string newLocation) { CSharpProjectContent pc = Clone(); - pc.location = location; + pc.location = newLocation; return pc; } @@ -148,6 +160,11 @@ namespace ICSharpCode.NRefactory.CSharp } public IProjectContent AddAssemblyReferences(IEnumerable references) + { + return AddAssemblyReferences(references.ToArray()); + } + + public IProjectContent AddAssemblyReferences(params IAssemblyReference[] references) { CSharpProjectContent pc = Clone(); pc.assemblyReferences.AddRange(references); @@ -155,13 +172,62 @@ namespace ICSharpCode.NRefactory.CSharp } public IProjectContent RemoveAssemblyReferences(IEnumerable references) + { + return RemoveAssemblyReferences(references.ToArray()); + } + + public IProjectContent RemoveAssemblyReferences(params IAssemblyReference[] references) { CSharpProjectContent pc = Clone(); - pc.assemblyReferences.RemoveAll(r => references.Contains(r)); + foreach (var r in references) + pc.assemblyReferences.Remove(r); return pc; } - public IProjectContent UpdateProjectContent(IParsedFile oldFile, IParsedFile newFile) + /// + /// Adds the specified files to the project content. + /// If a file with the same name already exists, updated the existing file. + /// + public IProjectContent AddOrUpdateFiles(IEnumerable newFiles) + { + CSharpProjectContent pc = Clone(); + foreach (var file in newFiles) { + pc.unresolvedFiles[file.FileName] = file; + } + return pc; + } + + /// + /// Adds the specified files to the project content. + /// If a file with the same name already exists, this method updates the existing file. + /// + public IProjectContent AddOrUpdateFiles(params IUnresolvedFile[] newFiles) + { + return AddOrUpdateFiles((IEnumerable)newFiles); + } + + /// + /// Removes the files with the specified names. + /// + public IProjectContent RemoveFiles(IEnumerable fileNames) + { + CSharpProjectContent pc = Clone(); + foreach (var fileName in fileNames) { + pc.unresolvedFiles.Remove(fileName); + } + return pc; + } + + /// + /// Removes the files with the specified names. + /// + public IProjectContent RemoveFiles(params string[] fileNames) + { + return RemoveFiles((IEnumerable)fileNames); + } + + [Obsolete("Use RemoveFiles/AddOrUpdateFiles instead")] + public IProjectContent UpdateProjectContent(IUnresolvedFile oldFile, IUnresolvedFile newFile) { if (oldFile == null && newFile == null) return this; @@ -171,23 +237,24 @@ namespace ICSharpCode.NRefactory.CSharp } CSharpProjectContent pc = Clone(); if (newFile == null) - pc.parsedFiles.Remove(oldFile.FileName); + pc.unresolvedFiles.Remove(oldFile.FileName); else - pc.parsedFiles[newFile.FileName] = newFile; + pc.unresolvedFiles[newFile.FileName] = newFile; return pc; } - public IProjectContent UpdateProjectContent(IEnumerable oldFiles, IEnumerable newFiles) + [Obsolete("Use RemoveFiles/AddOrUpdateFiles instead")] + public IProjectContent UpdateProjectContent(IEnumerable oldFiles, IEnumerable newFiles) { CSharpProjectContent pc = Clone(); if (oldFiles != null) { foreach (var oldFile in oldFiles) { - pc.parsedFiles.Remove(oldFile.FileName); + pc.unresolvedFiles.Remove(oldFile.FileName); } } if (newFiles != null) { foreach (var newFile in newFiles) { - pc.parsedFiles.Add(newFile.FileName, newFile); + pc.unresolvedFiles.Add(newFile.FileName, newFile); } } return pc; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs index 07d30e84ac..4897520b12 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs @@ -48,7 +48,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion public string EolMarker { get; set; } public string IndentString { get; set; } -#endregion + #endregion #region Result properties public bool AutoCompleteEmptyMatch; @@ -230,7 +230,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion return miniLexer.IsInPreprocessorDirective; } - IEnumerable HandleObjectInitializer(CompilationUnit unit, AstNode n) + IEnumerable HandleObjectInitializer(SyntaxTree unit, AstNode n) { var p = n.Parent; while (p != null && !(p is ObjectCreateExpression)) { @@ -262,7 +262,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion return contextList.Result; } - foreach (var m in initializerResult.Item1.Type.GetMembers (m => !m.IsSynthetic && m.IsPublic && (m.EntityType == EntityType.Property || m.EntityType == EntityType.Field))) { + foreach (var m in initializerResult.Item1.Type.GetMembers (m => m.IsPublic && (m.EntityType == EntityType.Property || m.EntityType == EntityType.Field))) { contextList.AddMember(m); } @@ -543,7 +543,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion var wrapper = new CompletionDataWrapper(this); if (currentType != null) { // bool includeProtected = DomType.IncludeProtected (dom, typeFromDatabase, resolver.CallingType); - foreach (var method in currentType.Methods) { + foreach (var method in ctx.CurrentTypeDefinition.Methods) { if (MatchDelegate(delegateType, method) /*&& method.IsAccessibleFrom (dom, resolver.CallingType, resolver.CallingMember, includeProtected) &&*/) { wrapper.AddMember(method); // data.SetText (data.CompletionText + ";"); @@ -723,7 +723,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion // var astResolver = new CSharpAstResolver( // GetState(), // identifierStart.Unit, - // CSharpParsedFile + // CSharpUnresolvedFile // ); // // foreach (var type in CreateFieldAction.GetValidTypes(astResolver, (Expression)n)) { @@ -1027,15 +1027,15 @@ namespace ICSharpCode.NRefactory.CSharp.Completion IEnumerable HandleEnumContext() { - var cu = ParseStub("a", false); - if (cu == null) { + var syntaxTree = ParseStub("a", false); + if (syntaxTree == null) { return null; } - var curType = cu.GetNodeAt(location); + var curType = syntaxTree.GetNodeAt(location); if (curType == null || curType.ClassType != ClassType.Enum) { - cu = ParseStub("a {}", false); - var node = cu.GetNodeAt(location); + syntaxTree = ParseStub("a {}", false); + var node = syntaxTree.GetNodeAt(location); if (node != null) { var wrapper = new CompletionDataWrapper(this); AddKeywords(wrapper, validEnumBaseTypes); @@ -1043,7 +1043,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion } } - var member = cu.GetNodeAt(location); + var member = syntaxTree.GetNodeAt(location); if (member != null && member.NameToken.EndLocation < location) { return DefaultControlSpaceItems(); } @@ -1102,7 +1102,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion xp = GetExpressionAtCursor(); } AstNode node; - CompilationUnit unit; + SyntaxTree unit; Tuple rr; if (xp != null) { node = xp.Node; @@ -1172,7 +1172,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion if (csResolver == null) { if (node != null) { csResolver = GetState(); - //var astResolver = new CSharpAstResolver (csResolver, node, xp != null ? xp.Item1 : CSharpParsedFile); + //var astResolver = new CSharpAstResolver (csResolver, node, xp != null ? xp.Item1 : CSharpUnresolvedFile); try { //csResolver = astResolver.GetResolverStateBefore (node); @@ -1200,16 +1200,16 @@ namespace ICSharpCode.NRefactory.CSharp.Completion wrapper.AddVariable(variable); } } - - if (currentMember is IUnresolvedParameterizedMember && !(node is AstType)) { - var param = (IParameterizedMember)currentMember.CreateResolved(ctx); + + if (state.CurrentMember is IParameterizedMember && !(node is AstType)) { + var param = (IParameterizedMember)state.CurrentMember; foreach (var p in param.Parameters) { wrapper.AddVariable(p); } } - if (currentMember is IUnresolvedMethod) { - var method = (IUnresolvedMethod)currentMember; + if (state.CurrentMember is IMethod) { + var method = (IMethod)state.CurrentMember; foreach (var p in method.TypeParameters) { wrapper.AddTypeParameter(p); } @@ -1319,10 +1319,8 @@ namespace ICSharpCode.NRefactory.CSharp.Completion { var lookup = new MemberLookup(ctx.CurrentTypeDefinition, Compilation.MainAssembly); if (currentType != null) { - for (var ct = currentType; ct != null; ct = ct.DeclaringTypeDefinition) { + for (var ct = ctx.CurrentTypeDefinition; ct != null; ct = ct.DeclaringTypeDefinition) { foreach (var nestedType in ct.NestedTypes) { - if (nestedType.IsSynthetic) - continue; string name = nestedType.Name; if (IsAttributeContext(node) && name.EndsWith("Attribute") && name.Length > "Attribute".Length) { name = name.Substring(0, name.Length - "Attribute".Length); @@ -1333,7 +1331,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion continue; } - var type = typePred(nestedType.Resolve(ctx)); + var type = typePred(nestedType); if (type != null) { var a2 = wrapper.AddType(type, name); if (a2 != null && callback != null) { @@ -1351,8 +1349,6 @@ namespace ICSharpCode.NRefactory.CSharp.Completion if (member is IMethod && ((IMethod)member).FullName == "System.Object.Finalize") { continue; } - if (member.IsSynthetic) - continue; if (member.EntityType == EntityType.Operator) { continue; } @@ -1369,7 +1365,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion } var declaring = def.DeclaringTypeDefinition; while (declaring != null) { - foreach (var member in declaring.GetMembers (m => m.IsStatic && !m.IsSynthetic)) { + foreach (var member in declaring.GetMembers (m => m.IsStatic)) { if (memberPred == null || memberPred(member)) { wrapper.AddMember(member); } @@ -1378,8 +1374,10 @@ namespace ICSharpCode.NRefactory.CSharp.Completion } } } - foreach (var p in currentType.TypeParameters) { - wrapper.AddTypeParameter(p); + if (ctx.CurrentTypeDefinition != null) { + foreach (var p in ctx.CurrentTypeDefinition.TypeParameters) { + wrapper.AddTypeParameter(p); + } } } var scope = ctx.CurrentUsingScope; @@ -1916,7 +1914,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion return; } foreach (var m in curType.GetMembers ().Reverse ()) { - if (m.IsSynthetic || curType.Kind != TypeKind.Interface && !m.IsOverridable) { + if (curType.Kind != TypeKind.Interface && !m.IsOverridable) { continue; } // filter out the "Finalize" methods, because finalizers should be done with destructors. @@ -1987,7 +1985,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion return result; } - bool MatchDelegate(IType delegateType, IUnresolvedMethod method) + bool MatchDelegate(IType delegateType, IMethod method) { var delegateMethod = delegateType.GetDelegateInvokeMethod(); if (delegateMethod == null || delegateMethod.Parameters.Count != method.Parameters.Count) { @@ -1995,7 +1993,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion } for (int i = 0; i < delegateMethod.Parameters.Count; i++) { - if (!delegateMethod.Parameters [i].Type.Equals(method.Parameters [i].Type.Resolve(ctx))) { + if (!delegateMethod.Parameters [i].Type.Equals(method.Parameters [i].Type)) { return false; } } @@ -2016,34 +2014,47 @@ namespace ICSharpCode.NRefactory.CSharp.Completion "delegate", "Creates anonymous delegate.", "delegate {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString - ); + ); } var sb = new StringBuilder("("); var sbWithoutTypes = new StringBuilder("("); + var state = GetState(); + var builder = new TypeSystemAstBuilder(state); + for (int k = 0; k < delegateMethod.Parameters.Count; k++) { if (k > 0) { sb.Append(", "); sbWithoutTypes.Append(", "); } - var parameterType = delegateMethod.Parameters [k].Type; - sb.Append(GetShortType(parameterType, GetState())); - sb.Append(" "); - sb.Append(delegateMethod.Parameters [k].Name); + var convertedParameter = builder.ConvertParameter (delegateMethod.Parameters [k]); + if (convertedParameter.ParameterModifier == ParameterModifier.Params) + convertedParameter.ParameterModifier = ParameterModifier.None; + sb.Append(convertedParameter.GetText (FormattingPolicy)); sbWithoutTypes.Append(delegateMethod.Parameters [k].Name); } + sb.Append(")"); sbWithoutTypes.Append(")"); completionList.AddCustom( "delegate" + sb, "Creates anonymous delegate.", "delegate" + sb + " {" + EolMarker + thisLineIndent + IndentString + "|" + delegateEndString - ); - if (!completionList.Result.Any(data => data.DisplayText == sbWithoutTypes.ToString())) { + ); + + if (!completionList.Result.Any(data => data.DisplayText == sb.ToString())) { + completionList.AddCustom( + sb.ToString(), + "Creates typed lambda expression.", + sb + " => |" + (addSemicolon ? ";" : "") + ); + } + + if (!delegateMethod.Parameters.Any (p => p.IsOut || p.IsRef) && !completionList.Result.Any(data => data.DisplayText == sbWithoutTypes.ToString())) { completionList.AddCustom( sbWithoutTypes.ToString(), "Creates lambda expression.", sbWithoutTypes + " => |" + (addSemicolon ? ";" : "") - ); + ); } /* TODO:Make factory method out of it. // It's needed to temporarly disable inserting auto matching bracket because the anonymous delegates are selectable with '(' @@ -2057,7 +2068,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion }*/ return sb.ToString(); } - + bool IsAccessibleFrom(IEntity member, ITypeDefinition calledType, IMember currentMember, bool includeProtected) { if (currentMember == null) { @@ -2140,7 +2151,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion return null; } var exprParent = resolvedNode.GetParent(); - var unit = exprParent != null ? exprParent.GetParent() : null; + var unit = exprParent != null ? exprParent.GetParent() : null; var astResolver = unit != null ? CompletionContextProvider.GetResolver(state, unit) : null; IType hintType = exprParent != null && astResolver != null ? @@ -2151,8 +2162,6 @@ namespace ICSharpCode.NRefactory.CSharp.Completion var nr = (NamespaceResolveResult)resolveResult; if (!(resolvedNode.Parent is UsingDeclaration || resolvedNode.Parent != null && resolvedNode.Parent.Parent is UsingDeclaration)) { foreach (var cl in nr.Namespace.Types) { - if (cl.IsSynthetic) - continue; string name = cl.Name; if (hintType != null && hintType.Kind != TypeKind.Array && cl.Kind == TypeKind.Interface) { continue; @@ -2189,7 +2198,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion } } - IEnumerable CreateParameterCompletion(MethodGroupResolveResult resolveResult, CSharpResolver state, AstNode invocation, CompilationUnit unit, int parameter, bool controlSpace) + IEnumerable CreateParameterCompletion(MethodGroupResolveResult resolveResult, CSharpResolver state, AstNode invocation, SyntaxTree unit, int parameter, bool controlSpace) { var result = new CompletionDataWrapper(this); var addedEnums = new HashSet(); @@ -2291,8 +2300,6 @@ namespace ICSharpCode.NRefactory.CSharp.Completion var namespaceContents = new CompletionDataWrapper(this); foreach (var cl in nr.Namespace.Types) { - if (cl.IsSynthetic) - continue; IType addType = typePred != null ? typePred(cl) : cl; if (addType != null) namespaceContents.AddType(addType, addType.Name); @@ -2393,8 +2400,6 @@ namespace ICSharpCode.NRefactory.CSharp.Completion var filteredList = new List(); foreach (var member in type.GetMembers ()) { - if (member.IsSynthetic) - continue; if (member.EntityType == EntityType.Indexer || member.EntityType == EntityType.Operator || member.EntityType == EntityType.Constructor || member.EntityType == EntityType.Destructor) { continue; } @@ -2445,7 +2450,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion } if (resolveResult is TypeResolveResult || includeStaticMembers) { - foreach (var nested in type.GetNestedTypes (t => !t.IsSynthetic)) { + foreach (var nested in type.GetNestedTypes ()) { if (!lookup.IsAccessible(nested.GetDefinition(), isProtectedAllowed)) continue; IType addType = typePred != null ? typePred(nested) : nested; @@ -2515,7 +2520,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion #region Parsing methods ExpressionResult GetExpressionBeforeCursor() { - CompilationUnit baseUnit; + SyntaxTree baseUnit; if (currentMember == null) { baseUnit = ParseStub("a", false); var type = baseUnit.GetNodeAt(location); @@ -2746,9 +2751,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion var sb = new StringBuilder(text); sb.Append("a;"); AppendMissingClosingBrackets(sb, text, false); - var stream = new System.IO.StringReader(sb.ToString()); - var completionUnit = parser.Parse(stream, "a.cs", 0); - stream.Close(); + var completionUnit = parser.Parse(sb.ToString()); var loc = document.GetLocation(offset); var expr = completionUnit.GetNodeAt( @@ -2769,9 +2772,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion sb.Append("a ();"); AppendMissingClosingBrackets(sb, text, false); - var stream = new System.IO.StringReader(sb.ToString()); - var completionUnit = parser.Parse(stream, "a.cs", 0); - stream.Close(); + var completionUnit = parser.Parse(sb.ToString()); var loc = document.GetLocation(offset); var expr = completionUnit.GetNodeAt(loc, n => n is Expression); @@ -2780,9 +2781,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion sb = new StringBuilder(text); sb.Append("a ()"); AppendMissingClosingBrackets(sb, text, false); - stream = new System.IO.StringReader(sb.ToString()); - completionUnit = parser.Parse(stream, "a.cs", 0); - stream.Close(); + completionUnit = parser.Parse(sb.ToString()); loc = document.GetLocation(offset); expr = completionUnit.GetNodeAt(loc, n => n is Expression); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs index 3ffa14a9c5..85cf16368f 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs @@ -1,4 +1,4 @@ -// +// // CSharpCompletionEngineBase.cs // // Author: @@ -494,13 +494,13 @@ namespace ICSharpCode.NRefactory.CSharp.Completion state.CurrentMember = currentMember; state.CurrentTypeDefinition = currentType; - state.CurrentUsingScope = CSharpParsedFile.GetUsingScope (location); + state.CurrentUsingScope = CSharpUnresolvedFile.GetUsingScope (location); if (state.CurrentMember != null) { var node = Unit.GetNodeAt (location); if (node == null) return state; var navigator = new NodeListResolveVisitorNavigator (new[] { node }); - var visitor = new ResolveVisitor (state, CSharpParsedFile, navigator); + var visitor = new ResolveVisitor (state, CSharpUnresolvedFile, navigator); Unit.AcceptVisitor (visitor, null); try { var newState = visitor.GetResolverStateBefore (node); @@ -655,7 +655,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion wrapper.Append (';'); } - protected CompilationUnit ParseStub(string continuation, bool appendSemicolon = true, string afterContinuation = null) + protected SyntaxTree ParseStub(string continuation, bool appendSemicolon = true, string afterContinuation = null) { var mt = GetMemberTextToCaret(); if (mt == null) { @@ -681,17 +681,12 @@ namespace ICSharpCode.NRefactory.CSharp.Completion if (closingBrackets > 0) { wrapper.Append(new string('}', closingBrackets)); } - using (var stream = new System.IO.StringReader (wrapper.ToString ())) { - try { - var parser = new CSharpParser (); - var result = parser.Parse(stream, "stub.cs", memberLocation.Line - 1 - generatedLines); - return result; - } catch (Exception) { - Console.WriteLine("------"); - Console.WriteLine(wrapper); - throw; - } - } + var parser = new CSharpParser (); + foreach (var sym in CompletionContextProvider.ConditionalSymbols) + parser.CompilerSettings.ConditionalSymbols.Add (sym); + parser.InitialLocation = new TextLocation(memberLocation.Line - generatedLines, 1); + var result = parser.Parse(wrapper.ToString ()); + return result; } // string cachedText = null; @@ -708,7 +703,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion protected ExpressionResult GetInvocationBeforeCursor(bool afterBracket) { - CompilationUnit baseUnit; + SyntaxTree baseUnit; baseUnit = ParseStub("a", false); var section = baseUnit.GetNodeAt(location.Line, location.Column - 2); @@ -763,10 +758,10 @@ namespace ICSharpCode.NRefactory.CSharp.Completion public class ExpressionResult { public AstNode Node { get; private set; } - public CompilationUnit Unit { get; private set; } + public SyntaxTree Unit { get; private set; } - public ExpressionResult (AstNode item2, CompilationUnit item3) + public ExpressionResult (AstNode item2, SyntaxTree item3) { this.Node = item2; this.Unit = item3; @@ -797,7 +792,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion resolveNode = expr; } try { - var root = expr.AncestorsAndSelf.FirstOrDefault(n => n is EntityDeclaration || n is CompilationUnit); + var root = expr.AncestorsAndSelf.FirstOrDefault(n => n is EntityDeclaration || n is SyntaxTree); if (root == null) { return null; } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpParameterCompletionEngine.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpParameterCompletionEngine.cs index 6dc68605e6..721c0f0a8f 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpParameterCompletionEngine.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpParameterCompletionEngine.cs @@ -1,4 +1,4 @@ -// +// // CSharpParameterCompletionEngine.cs // // Author: @@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion public ExpressionResult GetIndexerBeforeCursor() { - CompilationUnit baseUnit; + SyntaxTree baseUnit; if (currentMember == null && currentType == null) { return null; } @@ -73,7 +73,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion public ExpressionResult GetConstructorInitializerBeforeCursor() { - CompilationUnit baseUnit; + SyntaxTree baseUnit; if (currentMember == null && currentType == null) { return null; } @@ -88,7 +88,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion public ExpressionResult GetTypeBeforeCursor() { - CompilationUnit baseUnit; + SyntaxTree baseUnit; if (currentMember == null && currentType == null) { return null; } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs index 68f20c593a..ea8352ab67 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs @@ -75,31 +75,24 @@ namespace ICSharpCode.NRefactory.CSharp.Completion } HashSet usedTypes = new HashSet (); - + public ICompletionData AddType(IType type, string shortType) { if (type == null || string.IsNullOrEmpty(shortType) || usedTypes.Contains(shortType)) return null; if (type.Name == "Void" && type.Namespace == "System") return null; - usedTypes.Add(shortType); - var iCompletionData = Factory.CreateTypeCompletionData(type, shortType); - result.Add(iCompletionData); - return iCompletionData; - } - - public ICompletionData AddType(IUnresolvedTypeDefinition type, string shortType) - { - if (type == null || string.IsNullOrEmpty(shortType) || usedTypes.Contains(shortType)) - return null; - if (type.Name == "Void" && type.Namespace == "System") + + var def = type.GetDefinition (); + if (def != null && def.ParentAssembly != completion.ctx.CurrentAssembly && !def.IsBrowsable ()) return null; + usedTypes.Add(shortType); var iCompletionData = Factory.CreateTypeCompletionData(type, shortType); result.Add(iCompletionData); return iCompletionData; } - + Dictionary> data = new Dictionary> (); public ICompletionData AddVariable(IVariable variable) @@ -126,59 +119,25 @@ namespace ICSharpCode.NRefactory.CSharp.Completion return cd; } - public void AddTypeParameter (IUnresolvedTypeParameter variable) + public void AddTypeParameter (ITypeParameter variable) { if (data.ContainsKey (variable.Name)) return; data [variable.Name] = new List (); result.Add (Factory.CreateVariableCompletionData (variable)); } - - public ICompletionData AddMember (IUnresolvedMember member) - { - var newData = Factory.CreateEntityCompletionData (member); - - // newData.HideExtensionParameter = HideExtensionParameter; - string memberKey = newData.DisplayText; - if (memberKey == null) - return null; - if (member is IMember) { - newData.CompletionCategory = GetCompletionCategory (member.DeclaringTypeDefinition.Resolve (completion.ctx)); - } - List existingData; - data.TryGetValue (memberKey, out existingData); - - if (existingData != null) { - var a = member as IEntity; - foreach (var d in existingData) { - if (!(d is IEntityCompletionData)) - continue; - var b = ((IEntityCompletionData)d).Entity; - if (a == null || b == null || a.EntityType == b.EntityType) { - d.AddOverload (newData); - return d; - } - } - if (newData != null) { - result.Add (newData); - data [memberKey].Add (newData); - } - } else { - result.Add (newData); - data [memberKey] = new List (); - data [memberKey].Add (newData); - } - return newData; - } - + public ICompletionData AddMember (IMember member) { var newData = Factory.CreateEntityCompletionData (member); - // newData.HideExtensionParameter = HideExtensionParameter; + if (member.ParentAssembly != completion.ctx.CurrentAssembly && !member.IsBrowsable ()) + return null; + string memberKey = newData.DisplayText; if (memberKey == null) return null; + if (member is IMember) { newData.CompletionCategory = GetCompletionCategory (member.DeclaringTypeDefinition); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/ICompletionContextProvider.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/ICompletionContextProvider.cs index b477dc1bbf..c590007fbe 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/ICompletionContextProvider.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/ICompletionContextProvider.cs @@ -1,4 +1,4 @@ -// +// // IMemberProvider.cs // // Author: @@ -35,6 +35,10 @@ namespace ICSharpCode.NRefactory.CSharp.Completion { public interface ICompletionContextProvider { + IList ConditionalSymbols { + get; + } + void GetCurrentMembers (int offset, out IUnresolvedTypeDefinition currentType, out IUnresolvedMember currentMember); Tuple GetMemberTextToCaret(int caretOffset, IUnresolvedTypeDefinition currentType, IUnresolvedMember currentMember); @@ -45,18 +49,29 @@ namespace ICSharpCode.NRefactory.CSharp.Completion public class DefaultCompletionContextProvider : ICompletionContextProvider { readonly IDocument document; - readonly CSharpParsedFile parsedFile; + readonly CSharpUnresolvedFile unresolvedFile; + readonly List symbols = new List (); + + public IList ConditionalSymbols { + get { + return symbols; + } + } - public DefaultCompletionContextProvider (IDocument document, CSharpParsedFile parsedFile) + public DefaultCompletionContextProvider (IDocument document, CSharpUnresolvedFile unresolvedFile) { if (document == null) throw new ArgumentNullException("document"); - if (parsedFile == null) - throw new ArgumentNullException("parsedFile"); + if (unresolvedFile == null) + throw new ArgumentNullException("unresolvedFile"); this.document = document; - this.parsedFile = parsedFile; + this.unresolvedFile = unresolvedFile; + } + + public void AddSymbol (string sym) + { + symbols.Add (sym); } - public void GetCurrentMembers(int offset, out IUnresolvedTypeDefinition currentType, out IUnresolvedMember currentMember) { //var document = engine.document; @@ -64,7 +79,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion currentType = null; - foreach (var type in parsedFile.TopLevelTypeDefinitions) { + foreach (var type in unresolvedFile.TopLevelTypeDefinitions) { if (type.Region.Begin < location) currentType = type; } @@ -189,7 +204,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion public CSharpAstResolver GetResolver (CSharpResolver resolver, AstNode rootNode) { - return new CSharpAstResolver (resolver, rootNode, parsedFile); + return new CSharpAstResolver (resolver, rootNode, unresolvedFile); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/ICompletionDataFactory.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/ICompletionDataFactory.cs index fe367f4eb0..a258dff812 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/ICompletionDataFactory.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/ICompletionDataFactory.cs @@ -32,14 +32,11 @@ namespace ICSharpCode.NRefactory.CSharp.Completion { public interface ICompletionDataFactory { - ICompletionData CreateEntityCompletionData (IUnresolvedEntity entity); - ICompletionData CreateEntityCompletionData (IUnresolvedEntity entity, string text); ICompletionData CreateEntityCompletionData (IEntity entity); ICompletionData CreateEntityCompletionData (IEntity entity, string text); ICompletionData CreateTypeCompletionData (IType type, string shortType); - ICompletionData CreateTypeCompletionData (IUnresolvedTypeDefinition type, string shortType); - + /// /// Creates a generic completion data. /// @@ -58,7 +55,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion ICompletionData CreateVariableCompletionData (IVariable variable); - ICompletionData CreateVariableCompletionData (IUnresolvedTypeParameter parameter); + ICompletionData CreateVariableCompletionData (ITypeParameter parameter); ICompletionData CreateEventCreationCompletionData (string varName, IType delegateType, IEvent evt, string parameterDefinition, IUnresolvedMember currentMember, IUnresolvedTypeDefinition currentType); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs index 14f23360b3..8a12bc84a1 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs @@ -1,4 +1,4 @@ -// +// // AstFormattingVisitor.cs // // Author: @@ -199,9 +199,9 @@ namespace ICSharpCode.NRefactory.CSharp changes.Clear(); } - public override void VisitCompilationUnit(CompilationUnit unit) + public override void VisitSyntaxTree(SyntaxTree unit) { - base.VisitCompilationUnit(unit); + base.VisitSyntaxTree(unit); } public void EnsureBlankLinesAfter(AstNode node, int blankLines) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Formatter/GeneratedCodeSettings.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Formatter/GeneratedCodeSettings.cs index 827a3dc949..2095b0d333 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Formatter/GeneratedCodeSettings.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Formatter/GeneratedCodeSettings.cs @@ -1,4 +1,4 @@ -// +// // GeneratedCodeSettings.cs // // Author: @@ -177,7 +177,9 @@ namespace ICSharpCode.NRefactory.CSharp var cmt = new Comment ("", CommentType.SingleLine); var cmt2 = new Comment (" " + label, CommentType.SingleLine); var cmt3 = new Comment ("", CommentType.SingleLine); - mem.Parent.InsertChildsBefore (mem, Roles.Comment, cmt, cmt2, cmt3); + mem.Parent.InsertChildBefore (mem, cmt, Roles.Comment); + mem.Parent.InsertChildBefore (mem, cmt2, Roles.Comment); + mem.Parent.InsertChildBefore (mem, cmt3, Roles.Comment); if (cmt.PrevSibling is EntityDeclaration) mem.Parent.InsertChildBefore (cmt, new UnixNewLine (), Roles.NewLine); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj index c07d4a6454..f0d1294c9f 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj @@ -18,8 +18,9 @@ ..\ICSharpCode.NRefactory.snk False File - ..\ICSharpCode.NRefactory\bin\$(Configuration)\ICSharpCode.NRefactory.CSharp.xml + ..\bin\$(Configuration)\ICSharpCode.NRefactory.CSharp.xml 1591,1587,1570 + ..\bin\$(Configuration)\ AnyCPU @@ -29,13 +30,11 @@ 4096 - ..\ICSharpCode.NRefactory\bin\Debug\ False False DEBUG;TRACE;FULL_AST - ..\ICSharpCode.NRefactory\bin\Release\ True False TRACE;FULL_AST @@ -47,6 +46,25 @@ full True + + False + False + DEBUG;TRACE;FULL_AST;NET45 + v4.5 + + + full + True + + + True + False + TRACE;FULL_AST;NET45 + v4.5 + + + PdbOnly + @@ -69,7 +87,7 @@ - + @@ -130,6 +148,7 @@ + @@ -241,6 +260,7 @@ + @@ -280,7 +300,7 @@ - + @@ -377,6 +397,7 @@ + diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpOutputVisitor.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpOutputVisitor.cs index 23932e802c..665e15e71a 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpOutputVisitor.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpOutputVisitor.cs @@ -2172,6 +2172,7 @@ namespace ICSharpCode.NRefactory.CSharp WriteAttributes(indexerDeclaration.Attributes); WriteModifiers(indexerDeclaration.ModifierTokens); indexerDeclaration.ReturnType.AcceptVisitor(this); + Space(); WritePrivateImplementationType(indexerDeclaration.PrivateImplementationType); WriteKeyword(IndexerDeclaration.ThisKeywordRole); Space(policy.SpaceBeforeMethodDeclarationParentheses); @@ -2304,10 +2305,10 @@ namespace ICSharpCode.NRefactory.CSharp EndNode(variableInitializer); } - public void VisitCompilationUnit(CompilationUnit compilationUnit) + public void VisitSyntaxTree(SyntaxTree syntaxTree) { // don't do node tracking as we visit all children directly - foreach (AstNode node in compilationUnit.Children) { + foreach (AstNode node in syntaxTree.Children) { node.AcceptVisitor(this); } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs index b8e94dcfb5..b7db647027 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/CodeDomConvertVisitor.cs @@ -60,24 +60,24 @@ namespace ICSharpCode.NRefactory.CSharp } /// - /// Converts a compilation unit to CodeDom. + /// Converts a syntax tree to CodeDom. /// - /// The input compilation unit. + /// The input syntax tree. /// The current compilation. - /// CSharpParsedFile, used for resolving. + /// CSharpUnresolvedFile, used for resolving. /// Converted CodeCompileUnit /// /// This conversion process requires a resolver because it needs to distinguish field/property/event references etc. /// - public CodeCompileUnit Convert(ICompilation compilation, CompilationUnit compilationUnit, CSharpParsedFile parsedFile) + public CodeCompileUnit Convert(ICompilation compilation, SyntaxTree syntaxTree, CSharpUnresolvedFile unresolvedFile) { - if (compilationUnit == null) - throw new ArgumentNullException("compilationUnit"); + if (syntaxTree == null) + throw new ArgumentNullException("syntaxTree"); if (compilation == null) throw new ArgumentNullException("compilation"); - CSharpAstResolver resolver = new CSharpAstResolver(compilation, compilationUnit, parsedFile); - return (CodeCompileUnit)Convert(compilationUnit, resolver); + CSharpAstResolver resolver = new CSharpAstResolver(compilation, syntaxTree, unresolvedFile); + return (CodeCompileUnit)Convert(syntaxTree, resolver); } /// @@ -1236,10 +1236,10 @@ namespace ICSharpCode.NRefactory.CSharp throw new NotSupportedException(); // should be handled by the parent node } - CodeObject IAstVisitor.VisitCompilationUnit(CompilationUnit compilationUnit) + CodeObject IAstVisitor.VisitSyntaxTree(SyntaxTree syntaxTree) { CodeCompileUnit cu = new CodeCompileUnit(); - foreach (AstNode node in compilationUnit.Children) { + foreach (AstNode node in syntaxTree.Children) { CodeObject o = node.AcceptVisitor(this); CodeNamespace ns = o as CodeNamespace; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index 440aadea6e..ea913279be 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -40,10 +40,10 @@ namespace ICSharpCode.NRefactory.CSharp class ConversionVisitor : StructuralVisitor { - CompilationUnit unit = new CompilationUnit (); + SyntaxTree unit = new SyntaxTree (); internal bool convertTypeSystemMode; - public CompilationUnit Unit { + public SyntaxTree Unit { get { return unit; } @@ -335,12 +335,16 @@ namespace ICSharpCode.NRefactory.CSharp if (loc != null && pos < loc.Count) result.AddChild (new CSharpTokenNode (Convert (loc [pos++])), Roles.Colon); } - + + int attributeCount = 0; foreach (var attr in GetAttributes (optAttributes)) { result.AddChild (attr, Roles.Attribute); + attributeCount++; } + // Left and right bracket + commas between the attributes + int locCount = 2 + attributeCount - 1; // optional comma - if (loc != null && pos < loc.Count - 1 && !loc [pos].Equals (loc [pos + 1])) + if (loc != null && pos < loc.Count - 1 && loc.Count == locCount + 1) result.AddChild (new CSharpTokenNode (Convert (loc [pos++])), Roles.Comma); if (loc != null && pos < loc.Count) result.AddChild (new CSharpTokenNode (Convert (loc [pos++])), Roles.RBracket); @@ -668,7 +672,7 @@ namespace ICSharpCode.NRefactory.CSharp if (namespaceStack.Count > 0) { namespaceStack.Peek ().AddChild (child, NamespaceDeclaration.MemberRole); } else { - unit.AddChild (child, CompilationUnit.MemberRole); + unit.AddChild (child, SyntaxTree.MemberRole); } } @@ -2387,7 +2391,9 @@ namespace ICSharpCode.NRefactory.CSharp if (binaryExpression.Left != null) result.AddChild ((Expression)binaryExpression.Left.Accept (this), BinaryOperatorExpression.LeftRole); - result.AddChild (new CSharpTokenNode (Convert (binaryExpression.Location)), BinaryOperatorExpression.GetOperatorRole (result.Operator)); + var location = LocationsBag.GetLocations (binaryExpression); + if (location != null) + result.AddChild (new CSharpTokenNode (Convert (location[0])), BinaryOperatorExpression.GetOperatorRole (result.Operator)); if (binaryExpression.Right != null) result.AddChild ((Expression)binaryExpression.Right.Accept (this), BinaryOperatorExpression.RightRole); return result; @@ -2399,7 +2405,9 @@ namespace ICSharpCode.NRefactory.CSharp result.Operator = BinaryOperatorType.NullCoalescing; if (nullCoalescingOperator.LeftExpression != null) result.AddChild ((Expression)nullCoalescingOperator.LeftExpression.Accept (this), BinaryOperatorExpression.LeftRole); - result.AddChild (new CSharpTokenNode (Convert (nullCoalescingOperator.Location)), BinaryOperatorExpression.NullCoalescingRole); + var location = LocationsBag.GetLocations (nullCoalescingOperator); + if (location != null) + result.AddChild (new CSharpTokenNode (Convert (location[0])), BinaryOperatorExpression.NullCoalescingRole); if (nullCoalescingOperator.RightExpression != null) result.AddChild ((Expression)nullCoalescingOperator.RightExpression.Accept (this), BinaryOperatorExpression.RightRole); return result; @@ -2794,8 +2802,8 @@ namespace ICSharpCode.NRefactory.CSharp } if (commaLoc != null && curComma < commaLoc.Count) init.AddChild(new CSharpTokenNode(Convert(commaLoc [curComma++])), Roles.Comma); - } + if (initLoc != null) { if (initLoc.Count == 3) // optional comma init.AddChild(new CSharpTokenNode(Convert(initLoc [1])), Roles.Comma); @@ -2879,9 +2887,11 @@ namespace ICSharpCode.NRefactory.CSharp initializer.AddChild (new CSharpTokenNode (Convert (commaLocations [i])), Roles.Comma); } } - - if (initLocation != null) + if (initLocation != null) { + if (initLocation.Count == 2) // optional comma + initializer.AddChild (new CSharpTokenNode(Convert(initLocation [0])), Roles.Comma); initializer.AddChild (new CSharpTokenNode (Convert (initLocation [initLocation.Count - 1])), Roles.RBrace); + } result.AddChild (initializer, ArrayCreateExpression.InitializerRole); } @@ -3073,7 +3083,9 @@ namespace ICSharpCode.NRefactory.CSharp result.Operator = AssignmentOperatorType.Assign; if (simpleAssign.Target != null) result.AddChild ((Expression)simpleAssign.Target.Accept (this), AssignmentExpression.LeftRole); - result.AddChild (new CSharpTokenNode (Convert (simpleAssign.Location)), AssignmentExpression.AssignRole); + var location = LocationsBag.GetLocations (simpleAssign); + if (location != null) + result.AddChild (new CSharpTokenNode (Convert (location[0])), AssignmentExpression.AssignRole); if (simpleAssign.Source != null) { result.AddChild ((Expression)simpleAssign.Source.Accept (this), AssignmentExpression.RightRole); } @@ -3118,7 +3130,9 @@ namespace ICSharpCode.NRefactory.CSharp if (compoundAssign.Target != null) result.AddChild ((Expression)compoundAssign.Target.Accept (this), AssignmentExpression.LeftRole); - result.AddChild (new CSharpTokenNode (Convert (compoundAssign.Location)), AssignmentExpression.GetOperatorRole (result.Operator)); + var location = LocationsBag.GetLocations (compoundAssign); + if (location != null) + result.AddChild (new CSharpTokenNode (Convert (location[0])), AssignmentExpression.GetOperatorRole (result.Operator)); if (compoundAssign.Source != null) result.AddChild ((Expression)compoundAssign.Source.Accept (this), AssignmentExpression.RightRole); return result; @@ -3204,7 +3218,7 @@ namespace ICSharpCode.NRefactory.CSharp if (location != null) { if (location.Count == 2) // optional comma - result.AddChild (new CSharpTokenNode (Convert (location [1])), Roles.Comma); + result.AddChild (new CSharpTokenNode (Convert (location [0])), Roles.Comma); result.AddChild (new CSharpTokenNode (Convert (location [location.Count - 1])), Roles.RBrace); } return result; @@ -3213,25 +3227,36 @@ namespace ICSharpCode.NRefactory.CSharp #endregion #region LINQ expressions + QueryOrderClause currentQueryOrderClause; + public override object Visit (Mono.CSharp.Linq.QueryExpression queryExpression) { - var result = new QueryExpression (); - - var currentClause = queryExpression.next; - - while (currentClause != null) { - QueryClause clause = (QueryClause)currentClause.Accept (this); - if (clause is QueryContinuationClause) { - // insert preceding query at beginning of QueryContinuationClause - clause.InsertChildAfter (null, result, QueryContinuationClause.PrecedingQueryRole); - // create a new QueryExpression for the remaining query - result = new QueryExpression (); + var oldQueryOrderClause = currentQueryOrderClause; + try { + currentQueryOrderClause = null; + var result = new QueryExpression (); + + var currentClause = queryExpression.next; + + while (currentClause != null) { + QueryClause clause = (QueryClause)currentClause.Accept (this); + if (clause is QueryContinuationClause) { + // insert preceding query at beginning of QueryContinuationClause + clause.InsertChildAfter (null, result, QueryContinuationClause.PrecedingQueryRole); + // create a new QueryExpression for the remaining query + result = new QueryExpression (); + } + if (clause != null) { + result.AddChild (clause, QueryExpression.ClauseRole); + } + currentClause = currentClause.next; } - result.AddChild (clause, QueryExpression.ClauseRole); - currentClause = currentClause.next; + + return result; + } + finally { + currentQueryOrderClause = oldQueryOrderClause; } - - return result; } public override object Visit (Mono.CSharp.Linq.QueryStartClause queryStart) @@ -3397,7 +3422,7 @@ namespace ICSharpCode.NRefactory.CSharp public override object Visit (Mono.CSharp.Linq.OrderByAscending orderByAscending) { - var result = new QueryOrderClause (); + currentQueryOrderClause = new QueryOrderClause(); var ordering = new QueryOrdering (); if (orderByAscending.Expr != null) @@ -3407,13 +3432,13 @@ namespace ICSharpCode.NRefactory.CSharp ordering.Direction = QueryOrderingDirection.Ascending; ordering.AddChild (new CSharpTokenNode (Convert (location [0])), QueryOrdering.AscendingKeywordRole); } - result.AddChild (ordering, QueryOrderClause.OrderingRole); - return result; + currentQueryOrderClause.AddChild (ordering, QueryOrderClause.OrderingRole); + return currentQueryOrderClause; } public override object Visit (Mono.CSharp.Linq.OrderByDescending orderByDescending) { - var result = new QueryOrderClause (); + currentQueryOrderClause = new QueryOrderClause (); var ordering = new QueryOrdering (); if (orderByDescending.Expr != null) @@ -3423,14 +3448,12 @@ namespace ICSharpCode.NRefactory.CSharp ordering.Direction = QueryOrderingDirection.Descending; ordering.AddChild (new CSharpTokenNode (Convert (location [0])), QueryOrdering.DescendingKeywordRole); } - result.AddChild (ordering, QueryOrderClause.OrderingRole); - return result; + currentQueryOrderClause.AddChild (ordering, QueryOrderClause.OrderingRole); + return currentQueryOrderClause; } public override object Visit (Mono.CSharp.Linq.ThenByAscending thenByAscending) { - var result = new QueryOrderClause (); - var ordering = new QueryOrdering (); if (thenByAscending.Expr != null) ordering.AddChild ((Expression)thenByAscending.Expr.Accept (this), Roles.Expression); @@ -3439,14 +3462,12 @@ namespace ICSharpCode.NRefactory.CSharp ordering.Direction = QueryOrderingDirection.Ascending; ordering.AddChild (new CSharpTokenNode (Convert (location [0])), QueryOrdering.AscendingKeywordRole); } - result.AddChild (ordering, QueryOrderClause.OrderingRole); - return result; + currentQueryOrderClause.AddChild (ordering, QueryOrderClause.OrderingRole); + return null; } public override object Visit (Mono.CSharp.Linq.ThenByDescending thenByDescending) { - var result = new QueryOrderClause (); - var ordering = new QueryOrdering (); if (thenByDescending.Expr != null) ordering.AddChild ((Expression)thenByDescending.Expr.Accept (this), Roles.Expression); @@ -3455,8 +3476,8 @@ namespace ICSharpCode.NRefactory.CSharp ordering.Direction = QueryOrderingDirection.Descending; ordering.AddChild (new CSharpTokenNode (Convert (location [0])), QueryOrdering.DescendingKeywordRole); } - result.AddChild (ordering, QueryOrderClause.OrderingRole); - return result; + currentQueryOrderClause.AddChild (ordering, QueryOrderClause.OrderingRole); + return null; } public override object Visit (Await awaitExpr) @@ -3701,28 +3722,34 @@ namespace ICSharpCode.NRefactory.CSharp get { return errorReportPrinter.Errors; } } - public CompilationUnit Parse (ITextSource textSource, string fileName, int lineModifier = 0) + /// + /// Parses a C# code file. + /// + /// The source code to parse. + /// The file name. Used to identify the file (e.g. when building a type system). + /// This can be an arbitrary identifier, NRefactory never tries to access the file on disk. + /// Returns the syntax tree. + public SyntaxTree Parse (string program, string fileName = "") { - return Parse (textSource.CreateReader (), fileName, lineModifier); + return Parse (new StringTextSource (program), fileName); } - public CompilationUnit Parse (TextReader reader, string fileName, int lineModifier = 0) + /// + /// Parses a C# code file. + /// + /// The text reader containing the source code to parse. + /// The file name. Used to identify the file (e.g. when building a type system). + /// This can be an arbitrary identifier, NRefactory never tries to access the file on disk. + /// Returns the syntax tree. + public SyntaxTree Parse (TextReader reader, string fileName = "") { - // TODO: can we optimize this to avoid the text->stream->text roundtrip? - using (MemoryStream stream = new MemoryStream ()) { - StreamWriter w = new StreamWriter (stream, Encoding.UTF8); - char[] buffer = new char[2048]; - int read; - while ((read = reader.ReadBlock(buffer, 0, buffer.Length)) > 0) - w.Write (buffer, 0, read); - w.Flush (); // we can't close the StreamWriter because that would also close the MemoryStream - stream.Position = 0; - - return Parse (stream, fileName, lineModifier); - } + return Parse(new StringTextSource (reader.ReadToEnd ()), fileName); } - public CompilationUnit Parse(CompilerCompilationUnit top, string fileName, int lineModifier = 0) + /// + /// Converts a Mono.CSharp syntax tree into an NRefactory syntax tree. + /// + public SyntaxTree Parse(CompilerCompilationUnit top, string fileName) { if (top == null) { return null; @@ -3738,7 +3765,7 @@ namespace ICSharpCode.NRefactory.CSharp } conversionVisitor.Unit.FileName = fileName; - conversionVisitor.Unit.ConditionalSymbols = top.Conditionals.ToArray (); + conversionVisitor.Unit.ConditionalSymbols = top.Conditionals.Concat (compilerSettings.ConditionalSymbols).ToArray (); return conversionVisitor.Unit; } @@ -3751,55 +3778,104 @@ namespace ICSharpCode.NRefactory.CSharp } } + /// + /// Callback that gets called with the Mono.CSharp syntax tree whenever some code is parsed. + /// public Action CompilationUnitCallback { get; set; } + /// + /// Specifies whether to run the parser in a special mode for generating the type system. + /// If this property is true, the syntax tree will only contain nodes relevant for the + /// call and might be missing other nodes (e.g. method bodies). + /// The default is false. + /// public bool GenerateTypeSystemMode { get; set; } - public CompilationUnit Parse (string program, string fileName) - { - return Parse (new StringReader (program), fileName); + TextLocation initialLocation = new TextLocation(1, 1); + + /// + /// Specifies the text location where parsing starts. + /// This property can be used when parsing a part of a file to make the locations of the AstNodes + /// refer to the position in the whole file. + /// The default is (1,1). + /// + public TextLocation InitialLocation { + get { return initialLocation; } + set { initialLocation = value; } } internal static object parseLock = new object (); - public CompilationUnit Parse(Stream stream, string fileName, int lineModifier = 0) + /// + /// Parses a C# code file. + /// + /// The stream containing the source code to parse. + /// The file name. Used to identify the file (e.g. when building a type system). + /// This can be an arbitrary identifier, NRefactory never tries to access the file on disk. + /// Returns the syntax tree. + public SyntaxTree Parse (Stream stream, string fileName = "") + { + return Parse (new StreamReader (stream), fileName); + } + + /// + /// Parses a C# code file. + /// + /// The source code to parse. + /// The file name. Used to identify the file (e.g. when building a type system). + /// This can be an arbitrary identifier, NRefactory never tries to access the file on disk. + /// + /// Returns the syntax tree. + public SyntaxTree Parse(ITextSource program, string fileName = "") + { + return Parse(program, fileName, initialLocation.Line, initialLocation.Column); + } + + SyntaxTree Parse(ITextSource program, string fileName, int initialLine, int initialColumn) { lock (parseLock) { errorReportPrinter = new ErrorReportPrinter (""); var ctx = new CompilerContext (compilerSettings.ToMono(), errorReportPrinter); ctx.Settings.TabSize = 1; - var reader = new SeekableStreamReader (stream, Encoding.UTF8); + var reader = new SeekableStreamReader (program); var file = new SourceFile (fileName, fileName, 0); Location.Initialize (new List (new [] { file })); var module = new ModuleContainer (ctx); - var parser = Driver.Parse (reader, file, module, lineModifier); - + var session = new ParserSession (); + session.LocationsBag = new LocationsBag (); + var report = new Report (ctx, errorReportPrinter); + var parser = Driver.Parse (reader, file, module, session, report, initialLine - 1, initialColumn - 1); var top = new CompilerCompilationUnit () { ModuleCompiled = module, - LocationsBag = parser.LocationsBag, + LocationsBag = session.LocationsBag, SpecialsBag = parser.Lexer.sbag, Conditionals = parser.Lexer.SourceFile.Conditionals }; - var unit = Parse (top, fileName, lineModifier); + var unit = Parse (top, fileName); unit.Errors.AddRange (errorReportPrinter.Errors); CompilerCallableEntryPoint.Reset (); return unit; } } - public IEnumerable ParseTypeMembers (TextReader reader, int lineModifier = 0) + public IEnumerable ParseTypeMembers (string code) + { + return ParseTypeMembers(code, initialLocation.Line, initialLocation.Column); + } + + IEnumerable ParseTypeMembers (string code, int initialLine, int initialColumn) { - string code = "unsafe partial class MyClass { " + Environment.NewLine + reader.ReadToEnd () + "}"; - var cu = Parse (new StringReader (code), "parsed.cs", lineModifier - 1); - if (cu == null) + const string prefix = "unsafe partial class MyClass { "; + var syntaxTree = Parse (new StringTextSource (prefix + code + "}"), "parsed.cs", initialLine, initialColumn - prefix.Length); + if (syntaxTree == null) return Enumerable.Empty (); - var td = cu.Children.FirstOrDefault () as TypeDeclaration; + var td = syntaxTree.FirstChild as TypeDeclaration; if (td != null) { var members = td.Members.ToArray(); // detach members from parent @@ -3810,10 +3886,16 @@ namespace ICSharpCode.NRefactory.CSharp return Enumerable.Empty (); } - public IEnumerable ParseStatements (TextReader reader, int lineModifier = 0) + public IEnumerable ParseStatements (string code) + { + return ParseStatements(code, initialLocation.Line, initialLocation.Column); + } + + IEnumerable ParseStatements (string code, int initialLine, int initialColumn) { - string code = "void M() { " + Environment.NewLine + reader.ReadToEnd () + "}"; - var members = ParseTypeMembers (new StringReader (code), lineModifier - 1); + // the dummy method is async so that 'await' expressions are parsed as expected + const string prefix = "async void M() { "; + var members = ParseTypeMembers (prefix + code + "}", initialLine, initialColumn - prefix.Length); var method = members.FirstOrDefault () as MethodDeclaration; if (method != null && method.Body != null) { var statements = method.Body.Statements.ToArray(); @@ -3825,10 +3907,9 @@ namespace ICSharpCode.NRefactory.CSharp return Enumerable.Empty (); } - public AstType ParseTypeReference (TextReader reader) + public AstType ParseTypeReference (string code) { - string code = reader.ReadToEnd () + " a;"; - var members = ParseTypeMembers (new StringReader (code)); + var members = ParseTypeMembers (code + " a;"); var field = members.FirstOrDefault () as FieldDeclaration; if (field != null) { AstType type = field.ReturnType; @@ -3838,9 +3919,11 @@ namespace ICSharpCode.NRefactory.CSharp return AstType.Null; } - public Expression ParseExpression (TextReader reader) + public Expression ParseExpression (string code) { - var es = ParseStatements (new StringReader ("tmp = " + Environment.NewLine + reader.ReadToEnd () + ";"), -1).FirstOrDefault () as ExpressionStatement; + const string prefix = "tmp = "; + var statements = ParseStatements (prefix + code + ";", initialLocation.Line, initialLocation.Column - prefix.Length); + var es = statements.FirstOrDefault () as ExpressionStatement; if (es != null) { AssignmentExpression ae = es.Expression as AssignmentExpression; if (ae != null) { @@ -3852,14 +3935,16 @@ namespace ICSharpCode.NRefactory.CSharp return Expression.Null; } + /* /// - /// Parses a file snippet; guessing what the code snippet represents (compilation unit, type members, block, type reference, expression). + /// Parses a file snippet; guessing what the code snippet represents (whole file, type members, block, type reference, expression). /// - public AstNode ParseSnippet (TextReader reader) + public AstNode ParseSnippet (string code) { // TODO: add support for parsing a part of a file throw new NotImplementedException (); } + */ public DocumentationReference ParseDocumentationReference (string cref) { @@ -3874,15 +3959,18 @@ namespace ICSharpCode.NRefactory.CSharp errorReportPrinter = new ErrorReportPrinter(""); var ctx = new CompilerContext(compilerSettings.ToMono(), errorReportPrinter); ctx.Settings.TabSize = 1; - var stream = new MemoryStream(Encoding.Unicode.GetBytes(cref)); - var reader = new SeekableStreamReader(stream, Encoding.Unicode); + var reader = new SeekableStreamReader(new StringTextSource (cref)); var file = new SourceFile("", "", 0); Location.Initialize(new List (new [] { file })); var module = new ModuleContainer(ctx); - module.DocumentationBuilder = new DocumentationBuilder(); + module.DocumentationBuilder = new DocumentationBuilder(module); var source_file = new CompilationSourceFile (module); var report = new Report (ctx, errorReportPrinter); - var parser = new Mono.CSharp.CSharpParser (reader, source_file, report); + ParserSession session = new ParserSession (); + session.LocationsBag = new LocationsBag (); + var parser = new Mono.CSharp.CSharpParser (reader, source_file, report, session); + parser.Lexer.Line += initialLocation.Line - 1; + parser.Lexer.Column += initialLocation.Column - 1; parser.Lexer.putback_char = Tokenizer.DocumentationXref; parser.Lexer.parsing_generic_declaration_doc = true; parser.parse (); @@ -3891,7 +3979,7 @@ namespace ICSharpCode.NRefactory.CSharp // mc.GetSignatureForError (), cref); } - ConversionVisitor conversionVisitor = new ConversionVisitor (false, parser.LocationsBag); + ConversionVisitor conversionVisitor = new ConversionVisitor (false, session.LocationsBag); DocumentationReference docRef = conversionVisitor.ConvertXmlDoc(module.DocumentationBuilder); CompilerCallableEntryPoint.Reset(); return docRef; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/SeekableStreamReader.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/SeekableStreamReader.cs new file mode 100644 index 0000000000..5a853c54e5 --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/SeekableStreamReader.cs @@ -0,0 +1,103 @@ +// +// SeekableStreamReader.cs +// +// Author: +// Mike Krüger +// +// Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using ICSharpCode.NRefactory.Editor; +using System.IO; +using System.Text; + +namespace Mono.CSharp +{ + public class SeekableStreamReader : IDisposable + { + public const int DefaultReadAheadSize = 2048; + + readonly ITextSource textSource; + + int pos; + + static string GetAllText(Stream stream, Encoding encoding) { + using (var rdr = new StreamReader(stream, encoding)) { + return rdr.ReadToEnd(); + } + } + + public SeekableStreamReader (Stream stream, Encoding encoding, char[] sharedBuffer = null) : this(new StringTextSource(GetAllText(stream, encoding))) + { + } + + public SeekableStreamReader (ITextSource source) + { + this.textSource = source; + } + + + public void Dispose () + { + } + + /// + /// This value corresponds to the current position in a stream of characters. + /// The StreamReader hides its manipulation of the underlying byte stream and all + /// character set/decoding issues. Thus, we cannot use this position to guess at + /// the corresponding position in the underlying byte stream even though there is + /// a correlation between them. + /// + public int Position { + get { + return pos; + } + + set { + pos = value; + } + } + + public char GetChar (int position) + { + return textSource.GetCharAt (position); + } + + public char[] ReadChars (int fromPosition, int toPosition) + { + return textSource.GetText (fromPosition, toPosition - fromPosition).ToCharArray (); + } + + public int Peek () + { + if (pos >= textSource.TextLength) + return -1; + return textSource.GetCharAt (pos); + } + + public int Read () + { + if (pos >= textSource.TextLength) + return -1; + return textSource.GetCharAt (pos++); + } + } +} + diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolFile.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolFile.cs index 664cdf0cf8..9b83bf3bed 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolFile.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolFile.cs @@ -53,7 +53,7 @@ namespace Mono.CompilerServices.SymbolWriter } } - internal class MyBinaryWriter : BinaryWriter + sealed class MyBinaryWriter : BinaryWriter { public MyBinaryWriter (Stream stream) : base (stream) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs index c9beaa0d43..88d604f2e3 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/MonoSymbolTable.cs @@ -183,6 +183,7 @@ namespace Mono.CompilerServices.SymbolWriter { #region This is actually written to the symbol file public readonly int Row; + public int Column; public readonly int File; public readonly int Offset; public readonly bool IsHidden; // Obsolete is never used @@ -195,28 +196,35 @@ namespace Mono.CompilerServices.SymbolWriter public int Compare (LineNumberEntry l1, LineNumberEntry l2) { return l1.Row == l2.Row ? - l1.Offset.CompareTo (l2.Offset) : + l1.Column.CompareTo (l2.Column) : l1.Row.CompareTo (l2.Row); } } - public static readonly LineNumberEntry Null = new LineNumberEntry (0, 0, 0); + public static readonly LineNumberEntry Null = new LineNumberEntry (0, 0, 0, 0); + + public LineNumberEntry (int file, int row, int column, int offset) + : this (file, row, offset, column, false) + { + } public LineNumberEntry (int file, int row, int offset) - : this (file, row, offset, false) - { } + : this (file, row, -1, offset, false) + { + } - public LineNumberEntry (int file, int row, int offset, bool is_hidden) + public LineNumberEntry (int file, int row, int column, int offset, bool is_hidden) { this.File = file; this.Row = row; + this.Column = column; this.Offset = offset; this.IsHidden = is_hidden; } public override string ToString () { - return String.Format ("[Line {0}:{1}:{2}]", File, Row, Offset); + return String.Format ("[Line {0}:{1,2}:{3}]", File, Row, Column, Offset); } } @@ -675,8 +683,7 @@ namespace Mono.CompilerServices.SymbolWriter creating = true; } - public SourceFileEntry (MonoSymbolFile file, string file_name, - byte[] guid, byte[] checksum) + public SourceFileEntry (MonoSymbolFile file, string file_name, byte[] guid, byte[] checksum) : this (file, file_name) { this.guid = guid; @@ -694,13 +701,15 @@ namespace Mono.CompilerServices.SymbolWriter DataOffset = (int) bw.BaseStream.Position; bw.Write (file_name); - if (guid == null) { - guid = Guid.NewGuid ().ToByteArray (); + if (guid == null) + guid = new byte[16]; + + if (hash == null) { try { - using (FileStream fs = new FileStream (file_name, FileMode.Open, FileAccess.Read)) { - MD5 md5 = MD5.Create (); - hash = md5.ComputeHash (fs); - } + using (FileStream fs = new FileStream (file_name, FileMode.Open, FileAccess.Read)) { + MD5 md5 = MD5.Create (); + hash = md5.ComputeHash (fs); + } } catch { hash = new byte [16]; } @@ -791,7 +800,6 @@ namespace Mono.CompilerServices.SymbolWriter public const int Default_LineRange = 8; public const byte Default_OpcodeBase = 9; - public const bool SuppressDuplicates = true; #endregion public const byte DW_LNS_copy = 1; @@ -822,7 +830,7 @@ namespace Mono.CompilerServices.SymbolWriter this._line_numbers = lines; } - internal void Write (MonoSymbolFile file, MyBinaryWriter bw) + internal void Write (MonoSymbolFile file, MyBinaryWriter bw, bool readColumnsInfo) { int start = (int) bw.BaseStream.Position; @@ -832,11 +840,6 @@ namespace Mono.CompilerServices.SymbolWriter int line_inc = LineNumbers [i].Row - last_line; int offset_inc = LineNumbers [i].Offset - last_offset; - if (SuppressDuplicates && (i+1 < LineNumbers.Length)) { - if (LineNumbers [i+1].Equals (LineNumbers [i])) - continue; - } - if (LineNumbers [i].File != last_file) { bw.Write (DW_LNS_set_file); bw.WriteLeb128 (LineNumbers [i].File); @@ -884,17 +887,23 @@ namespace Mono.CompilerServices.SymbolWriter bw.Write ((byte) 1); bw.Write (DW_LNE_end_sequence); + for (int i = 0; i < LineNumbers.Length; i++) { + var ln = LineNumbers [i]; + if (ln.Row >= 0) + bw.WriteLeb128 (ln.Column); + } + file.ExtendedLineNumberSize += (int) bw.BaseStream.Position - start; } - internal static LineNumberTable Read (MonoSymbolFile file, MyBinaryReader br) + internal static LineNumberTable Read (MonoSymbolFile file, MyBinaryReader br, bool readColumnsInfo) { LineNumberTable lnt = new LineNumberTable (file); - lnt.DoRead (file, br); + lnt.DoRead (file, br, readColumnsInfo); return lnt; } - void DoRead (MonoSymbolFile file, MyBinaryReader br) + void DoRead (MonoSymbolFile file, MyBinaryReader br, bool includesColumns) { var lines = new List (); @@ -911,7 +920,7 @@ namespace Mono.CompilerServices.SymbolWriter if (opcode == DW_LNE_end_sequence) { if (modified) lines.Add (new LineNumberEntry ( - stm_file, stm_line, stm_offset, is_hidden)); + stm_file, stm_line, -1, stm_offset, is_hidden)); break; } else if (opcode == DW_LNE_MONO_negate_is_hidden) { is_hidden = !is_hidden; @@ -929,7 +938,7 @@ namespace Mono.CompilerServices.SymbolWriter switch (opcode) { case DW_LNS_copy: lines.Add (new LineNumberEntry ( - stm_file, stm_line, stm_offset, is_hidden)); + stm_file, stm_line, -1, stm_offset, is_hidden)); modified = false; break; case DW_LNS_advance_pc: @@ -959,13 +968,20 @@ namespace Mono.CompilerServices.SymbolWriter stm_offset += opcode / LineRange; stm_line += LineBase + (opcode % LineRange); lines.Add (new LineNumberEntry ( - stm_file, stm_line, stm_offset, is_hidden)); + stm_file, stm_line, -1, stm_offset, is_hidden)); modified = false; } } - _line_numbers = new LineNumberEntry [lines.Count]; - lines.CopyTo (_line_numbers, 0); + _line_numbers = lines.ToArray (); + + if (includesColumns) { + for (int i = 0; i < _line_numbers.Length; ++i) { + var ln = _line_numbers[i]; + if (ln.Row >= 0) + ln.Column = br.ReadLeb128 (); + } + } } public bool GetMethodBounds (out LineNumberEntry start, out LineNumberEntry end) @@ -1022,7 +1038,8 @@ namespace Mono.CompilerServices.SymbolWriter [Flags] public enum Flags { - LocalNamesAmbiguous = 1 + LocalNamesAmbiguous = 1, + ColumnsInfoIncluded = 1 << 1 } public const int Size = 12; @@ -1176,7 +1193,7 @@ namespace Mono.CompilerServices.SymbolWriter } LineNumberTableOffset = (int) bw.BaseStream.Position; - lnt.Write (file, bw); + lnt.Write (file, bw, (flags & Flags.ColumnsInfoIncluded) != 0); DataOffset = (int) bw.BaseStream.Position; @@ -1204,7 +1221,7 @@ namespace Mono.CompilerServices.SymbolWriter long old_pos = reader.BaseStream.Position; reader.BaseStream.Position = LineNumberTableOffset; - lnt = LineNumberTable.Read (SymbolFile, reader); + lnt = LineNumberTable.Read (SymbolFile, reader, (flags & Flags.ColumnsInfoIncluded) != 0); reader.BaseStream.Position = old_pos; return lnt; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/SourceMethodBuilder.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/SourceMethodBuilder.cs index 1ff399cdcd..b45bf8a1fb 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/SourceMethodBuilder.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/SourceMethodBuilder.cs @@ -64,7 +64,7 @@ namespace Mono.CompilerServices.SymbolWriter public void MarkSequencePoint (int offset, SourceFileEntry file, int line, int column, bool is_hidden) { int file_idx = file != null ? file.Index : 0; - var lne = new LineNumberEntry (file_idx, line, offset, is_hidden); + var lne = new LineNumberEntry (file_idx, line, column, offset, is_hidden); if (method_lines.Count > 0) { var prev = method_lines[method_lines.Count - 1]; @@ -185,7 +185,7 @@ namespace Mono.CompilerServices.SymbolWriter { MethodEntry entry = new MethodEntry ( file, _comp_unit.Entry, token, ScopeVariables, - Locals, method_lines.ToArray (), Blocks, null, 0, ns_id); + Locals, method_lines.ToArray (), Blocks, null, MethodEntry.Flags.ColumnsInfoIncluded, ns_id); file.AddMethod (entry); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs index 87a472af79..9a2c4a334a 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs @@ -816,7 +816,7 @@ namespace Mono.CSharp { sealed class HoistedFieldAssign : CompilerAssign { public HoistedFieldAssign (Expression target, Expression source) - : base (target, source, source.Location) + : base (target, source, target.Location) { } @@ -1503,6 +1503,10 @@ namespace Mono.CSharp { aec.Set (flags); + var bc = ec as BlockContext; + if (bc != null) + aec.FlowOffset = bc.FlowOffset; + var errors = ec.Report.Errors; bool res = Block.Resolve (ec.CurrentBranching, aec, null); @@ -2013,11 +2017,11 @@ namespace Mono.CSharp { IntConstant FNV_prime = new IntConstant (Compiler.BuiltinTypes, 16777619, loc); rs_hashcode = new Binary (Binary.Operator.Multiply, - new Binary (Binary.Operator.ExclusiveOr, rs_hashcode, field_hashcode, loc), - FNV_prime, loc); + new Binary (Binary.Operator.ExclusiveOr, rs_hashcode, field_hashcode), + FNV_prime); Expression field_to_string = new Conditional (new BooleanExpression (new Binary (Binary.Operator.Inequality, - new MemberAccess (new This (f.Location), f.Name), new NullLiteral (loc), loc)), + new MemberAccess (new This (f.Location), f.Name), new NullLiteral (loc))), new Invocation (new MemberAccess ( new MemberAccess (new This (f.Location), f.Name), "ToString"), null), new StringConstant (Compiler.BuiltinTypes, string.Empty, loc), loc); @@ -2028,9 +2032,7 @@ namespace Mono.CSharp { string_concat, new Binary (Binary.Operator.Addition, new StringConstant (Compiler.BuiltinTypes, " " + p.Name + " = ", loc), - field_to_string, - loc), - loc); + field_to_string)); continue; } @@ -2040,18 +2042,15 @@ namespace Mono.CSharp { string_concat = new Binary (Binary.Operator.Addition, new Binary (Binary.Operator.Addition, string_concat, - new StringConstant (Compiler.BuiltinTypes, ", " + p.Name + " = ", loc), - loc), - field_to_string, - loc); + new StringConstant (Compiler.BuiltinTypes, ", " + p.Name + " = ", loc)), + field_to_string); - rs_equals = new Binary (Binary.Operator.LogicalAnd, rs_equals, field_equal, loc); + rs_equals = new Binary (Binary.Operator.LogicalAnd, rs_equals, field_equal); } string_concat = new Binary (Binary.Operator.Addition, string_concat, - new StringConstant (Compiler.BuiltinTypes, " }", loc), - loc); + new StringConstant (Compiler.BuiltinTypes, " }", loc)); // // Equals (object obj) override @@ -2062,9 +2061,9 @@ namespace Mono.CSharp { new As (equals_block.GetParameterReference (0, loc), current_type, loc), loc))); - Expression equals_test = new Binary (Binary.Operator.Inequality, other_variable, new NullLiteral (loc), loc); + Expression equals_test = new Binary (Binary.Operator.Inequality, other_variable, new NullLiteral (loc)); if (rs_equals != null) - equals_test = new Binary (Binary.Operator.LogicalAnd, equals_test, rs_equals, loc); + equals_test = new Binary (Binary.Operator.LogicalAnd, equals_test, rs_equals); equals_block.AddStatement (new Return (equals_test, loc)); equals.Block = equals_block; @@ -2106,19 +2105,19 @@ namespace Mono.CSharp { var hash_variable = new LocalVariableReference (li_hash, loc); hashcode_block.AddStatement (new StatementExpression ( new CompoundAssign (Binary.Operator.Addition, hash_variable, - new Binary (Binary.Operator.LeftShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 13, loc), loc), loc))); + new Binary (Binary.Operator.LeftShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 13, loc))))); hashcode_block.AddStatement (new StatementExpression ( new CompoundAssign (Binary.Operator.ExclusiveOr, hash_variable, - new Binary (Binary.Operator.RightShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 7, loc), loc), loc))); + new Binary (Binary.Operator.RightShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 7, loc))))); hashcode_block.AddStatement (new StatementExpression ( new CompoundAssign (Binary.Operator.Addition, hash_variable, - new Binary (Binary.Operator.LeftShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 3, loc), loc), loc))); + new Binary (Binary.Operator.LeftShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 3, loc))))); hashcode_block.AddStatement (new StatementExpression ( new CompoundAssign (Binary.Operator.ExclusiveOr, hash_variable, - new Binary (Binary.Operator.RightShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 17, loc), loc), loc))); + new Binary (Binary.Operator.RightShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 17, loc))))); hashcode_block.AddStatement (new StatementExpression ( new CompoundAssign (Binary.Operator.Addition, hash_variable, - new Binary (Binary.Operator.LeftShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 5, loc), loc), loc))); + new Binary (Binary.Operator.LeftShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 5, loc))))); hashcode_block.AddStatement (new Return (hash_variable, loc)); hashcode.Block = hashcode_top; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/argument.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/argument.cs index 9da98b8a80..22e28eaf72 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/argument.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/argument.cs @@ -320,20 +320,20 @@ namespace Mono.CSharp if (a.Expr is Constant) { info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags, - new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "Constant", loc), loc); + new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "Constant", loc)); } else if (a.ArgType == Argument.AType.Ref) { info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags, - new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsRef", loc), loc); + new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsRef", loc)); info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags, - new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc), loc); + new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc)); } else if (a.ArgType == Argument.AType.Out) { info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags, - new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsOut", loc), loc); + new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsOut", loc)); info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags, - new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc), loc); + new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc)); } else if (a.ArgType == Argument.AType.DynamicTypeName) { info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags, - new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsStaticType", loc), loc); + new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsStaticType", loc)); } var arg_type = a.Expr.Type; @@ -354,14 +354,14 @@ namespace Mono.CSharp } info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags, - new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc), loc); + new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc)); } string named_value; NamedArgument na = a as NamedArgument; if (na != null) { info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags, - new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "NamedArgument", loc), loc); + new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "NamedArgument", loc)); named_value = na.Name; } else { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/assign.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/assign.cs index 673d586d10..ce8e254308 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/assign.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/assign.cs @@ -543,11 +543,11 @@ namespace Mono.CSharp { ExpressionStatement resolved; IMemberContext mc; - public FieldInitializer (FieldSpec spec, Expression expression, IMemberContext mc) - : base (new FieldExpr (spec, expression.Location), expression, expression.Location) + public FieldInitializer (FieldBase mc, Expression expression, Location loc) + : base (new FieldExpr (mc.Spec, expression.Location), expression, loc) { this.mc = mc; - if (!spec.IsStatic) + if (!mc.IsStatic) ((FieldExpr)target).InstanceExpression = new CompilerGeneratedThis (mc.CurrentType, expression.Location); } @@ -660,15 +660,15 @@ namespace Mono.CSharp { } } - public CompoundAssign (Binary.Operator op, Expression target, Expression source, Location loc) - : base (target, source, loc) + public CompoundAssign (Binary.Operator op, Expression target, Expression source) + : base (target, source, target.Location) { right = source; this.op = op; } - public CompoundAssign (Binary.Operator op, Expression target, Expression source, Expression left, Location loc) - : this (op, target, source, loc) + public CompoundAssign (Binary.Operator op, Expression target, Expression source, Expression left) + : this (op, target, source) { this.left = left; } @@ -731,7 +731,7 @@ namespace Mono.CSharp { if (left == null) left = new TargetExpression (target); - source = new Binary (op, left, right, true, loc); + source = new Binary (op, left, right, true); if (target is DynamicMemberAssignable) { Arguments targs = ((DynamicMemberAssignable) target).Arguments; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs index 4c0cce6127..e962e7d623 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/async.cs @@ -227,7 +227,9 @@ namespace Mono.CSharp // // awaiter = expr.GetAwaiter (); // - fe_awaiter.EmitAssign (ec, expr, false, false); + using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) { + fe_awaiter.EmitAssign (ec, expr, false, false); + } Label skip_continuation = ec.DefineLabel (); @@ -284,14 +286,8 @@ namespace Mono.CSharp awaiter.IsAvailableForReuse = true; - if (ResultType.Kind != MemberKind.Void) { - var storey = (AsyncTaskStorey) machine_initializer.Storey; - - if (storey.HoistedReturn != null) - storey.HoistedReturn.EmitAssign (ec); - else - ec.Emit (OpCodes.Pop); - } + if (ResultType.Kind != MemberKind.Void) + ec.Emit (OpCodes.Pop); } void Error_WrongAwaiterPattern (ResolveContext rc, TypeSpec awaiter) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs index 47eaad62e0..eff7a5231d 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/attribute.cs @@ -1016,7 +1016,7 @@ namespace Mono.CSharp { if (pos_args.Count == 1 && pos_args[0].Expr is Constant) { var value = ((Constant) pos_args[0].Expr).GetValue () as string; if (string.IsNullOrEmpty (value)) - Error_AttributeEmitError ("DllName cannot be empty"); + Error_AttributeEmitError ("DllName cannot be empty or null"); } } else if (Type == predefined.MethodImpl && pt.BuiltinType == BuiltinTypeSpec.Type.Short && !System.Enum.IsDefined (typeof (MethodImplOptions), ((Constant) arg_expr).GetValue ().ToString ())) { @@ -1476,6 +1476,12 @@ namespace Mono.CSharp { Encode (type.MemberDefinition.IsImported ? old_type.AssemblyQualifiedName : old_type.FullName); } + public void EncodeTypeName (TypeContainer type) + { + Encode (type.GetSignatureForMetadata ()); + } + + // // Encodes single property named argument per call // @@ -1629,6 +1635,10 @@ namespace Mono.CSharp { // New in .NET 4.0 public readonly PredefinedDynamicAttribute Dynamic; + // New in .NET 4.5 + public readonly PredefinedStateMachineAttribute AsyncStateMachine; + public readonly PredefinedStateMachineAttribute IteratorStateMachine; + // // Optional types which are used as types and for member lookup // @@ -1690,6 +1700,11 @@ namespace Mono.CSharp { StructLayout = new PredefinedAttribute (module, "System.Runtime.InteropServices", "StructLayoutAttribute"); FieldOffset = new PredefinedAttribute (module, "System.Runtime.InteropServices", "FieldOffsetAttribute"); + AsyncStateMachine = new PredefinedStateMachineAttribute (module, "System.Runtime.CompilerServices", "AsyncStateMachineAttribute"); + IteratorStateMachine = new PredefinedStateMachineAttribute (module, "System.Runtime.CompilerServices", "IteratorStateMachineAttribute") { + IsIterator = true + }; + CallerMemberNameAttribute = new PredefinedAttribute (module, "System.Runtime.CompilerServices", "CallerMemberNameAttribute"); CallerLineNumberAttribute = new PredefinedAttribute (module, "System.Runtime.CompilerServices", "CallerLineNumberAttribute"); CallerFilePathAttribute = new PredefinedAttribute (module, "System.Runtime.CompilerServices", "CallerFilePathAttribute"); @@ -1877,6 +1892,34 @@ namespace Mono.CSharp { } } + public class PredefinedStateMachineAttribute : PredefinedAttribute + { + public PredefinedStateMachineAttribute (ModuleContainer module, string ns, string name) + : base (module, ns, name) + { + } + + public bool IsIterator { get; set; } + + public void EmitAttribute (MethodBuilder builder, StateMachine type) + { + var predefined_ctor = IsIterator ? + module.PredefinedMembers.IteratorStateMachineAttributeCtor : + module.PredefinedMembers.AsyncStateMachineAttributeCtor; + + var ctor = predefined_ctor.Get (); + + if (ctor == null) + return; + + AttributeEncoder encoder = new AttributeEncoder (); + encoder.EncodeTypeName (type); + encoder.EncodeEmptyNamedArguments (); + + builder.SetCustomAttribute ((ConstructorInfo) ctor.GetMetaInfo (), encoder.ToArray ()); + } + } + public class PredefinedDynamicAttribute : PredefinedAttribute { MethodSpec tctor; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cfold.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cfold.cs index 9e2cfc8b96..8724e48b52 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cfold.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cfold.cs @@ -187,7 +187,7 @@ namespace Mono.CSharp { // if ((lt.BuiltinType == BuiltinTypeSpec.Type.Bool && right is NullLiteral) || (rt.BuiltinType == BuiltinTypeSpec.Type.Bool && left is NullLiteral)) { - var b = new Nullable.LiftedBinaryOperator (oper, left, right, loc).Resolve (ec); + var b = new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); // false | null => null // null | false => null @@ -231,7 +231,7 @@ namespace Mono.CSharp { // if ((lt.BuiltinType == BuiltinTypeSpec.Type.Bool && right is NullLiteral) || (rt.BuiltinType == BuiltinTypeSpec.Type.Bool && left is NullLiteral)) { - var b = new Nullable.LiftedBinaryOperator (oper, left, right, loc).Resolve (ec); + var b = new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); // false & null => false // null & false => false @@ -469,7 +469,7 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); } if (!DoBinaryNumericPromotions (ec, ref left, ref right)) @@ -566,7 +566,7 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); } if (!DoBinaryNumericPromotions (ec, ref left, ref right)) @@ -662,7 +662,7 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); } if (!DoBinaryNumericPromotions (ec, ref left, ref right)) @@ -762,7 +762,7 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); } if (!DoBinaryNumericPromotions (ec, ref left, ref right)) @@ -852,7 +852,7 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); } IntConstant ic = right.ConvertImplicitly (ec.BuiltinTypes.Int) as IntConstant; @@ -873,7 +873,7 @@ namespace Mono.CSharp { // null << value => null if (left is NullLiteral) - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); left = left.ConvertImplicitly (ec.BuiltinTypes.Int); if (left.Type.BuiltinType == BuiltinTypeSpec.Type.Int) @@ -889,7 +889,7 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); } IntConstant sic = right.ConvertImplicitly (ec.BuiltinTypes.Int) as IntConstant; @@ -909,7 +909,7 @@ namespace Mono.CSharp { // null >> value => null if (left is NullLiteral) - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); left = left.ConvertImplicitly (ec.BuiltinTypes.Int); if (left.Type.BuiltinType == BuiltinTypeSpec.Type.Int) @@ -925,7 +925,7 @@ namespace Mono.CSharp { if (left.IsNull || right.IsNull) { return ReducedExpression.Create ( new BoolConstant (ec.BuiltinTypes, left.IsNull == right.IsNull, left.Location), - new Binary (oper, left, right, loc)); + new Binary (oper, left, right)); } if (left is StringConstant && right is StringConstant) @@ -969,7 +969,7 @@ namespace Mono.CSharp { if (left.IsNull || right.IsNull) { return ReducedExpression.Create ( new BoolConstant (ec.BuiltinTypes, left.IsNull != right.IsNull, left.Location), - new Binary (oper, left, right, loc)); + new Binary (oper, left, right)); } if (left is StringConstant && right is StringConstant) @@ -1011,11 +1011,11 @@ namespace Mono.CSharp { if (left is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); } if (left is Nullable.LiftedNull) { - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); } } @@ -1051,11 +1051,11 @@ namespace Mono.CSharp { if (left is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); } if (left is Nullable.LiftedNull) { - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); } } @@ -1091,11 +1091,11 @@ namespace Mono.CSharp { if (left is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); } if (left is Nullable.LiftedNull) { - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); } } @@ -1131,11 +1131,11 @@ namespace Mono.CSharp { if (left is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); } if (left is Nullable.LiftedNull) { - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right, loc).Resolve (ec); + return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs index c776c47b08..645f53245c 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs @@ -346,6 +346,24 @@ namespace Mono.CSharp return MemberName.GetSignatureForError (); } + public string GetSignatureForMetadata () + { +#if STATIC + var name = TypeNameParser.Escape (MemberName.Basename); + + if (Parent is TypeDefinition) { + return Parent.GetSignatureForMetadata () + "+" + name; + } + + if (Parent != null && Parent.MemberName != null) + return Parent.GetSignatureForMetadata () + "." + name; + + return name; +#else + throw new NotImplementedException (); +#endif + } + public virtual void RemoveContainer (TypeContainer cont) { if (containers != null) @@ -1845,13 +1863,20 @@ namespace Mono.CSharp return; string class_indexer_name = null; - has_normal_indexers = true; // // Check normal indexers for consistent name, explicit interface implementation // indexers are ignored // foreach (var indexer in indexers) { + // + // FindMembers can return unfiltered full hierarchy names + // + if (indexer.DeclaringType != spec) + continue; + + has_normal_indexers = true; + if (class_indexer_name == null) { indexer_name = class_indexer_name = indexer.Name; continue; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/codegen.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/codegen.cs index 026d410698..9bb7066758 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/codegen.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/codegen.cs @@ -944,10 +944,10 @@ namespace Mono.CSharp if (method.ReturnType.Kind == MemberKind.Void && method.IsConditionallyExcluded (ec.MemberContext, loc)) return; - EmitPredefined (ec, method, Arguments); + EmitPredefined (ec, method, Arguments, loc); } - public void EmitPredefined (EmitContext ec, MethodSpec method, Arguments Arguments) + public void EmitPredefined (EmitContext ec, MethodSpec method, Arguments Arguments, Location? loc = null) { Expression instance_copy = null; @@ -1006,6 +1006,18 @@ namespace Mono.CSharp ec.Emit (OpCodes.Constrained, InstanceExpression.Type); } + if (loc != null) { + // + // Emit explicit sequence point for expressions like Foo.Bar () to help debugger to + // break at right place when LHS expression can be stepped-into + // + // TODO: The list is probably not comprehensive, need to do more testing + // + if (InstanceExpression is PropertyExpr || InstanceExpression is Invocation || InstanceExpression is IndexerExpr || + InstanceExpression is New || InstanceExpression is DelegateInvocation) + ec.Mark (loc.Value); + } + // // Set instance expression to actual result expression. When it contains await it can be // picked up by caller diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/const.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/const.cs index 5eb93d129a..31cba91fe0 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/const.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/const.cs @@ -59,7 +59,7 @@ namespace Mono.CSharp { if ((field_attr & FieldAttributes.InitOnly) != 0) Parent.PartialContainer.RegisterFieldForInitialization (this, - new FieldInitializer (spec, initializer, this)); + new FieldInitializer (this, initializer, Location)); if (declarators != null) { var t = new TypeExpression (MemberType, TypeExpression.Location); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/context.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/context.cs index 5f309854bd..0e45bd5deb 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/context.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/context.cs @@ -13,6 +13,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Security.Cryptography; namespace Mono.CSharp { @@ -730,4 +731,28 @@ namespace Mono.CSharp return new FlagsHandle (this, options, enable ? options : 0); } } + + // + // Parser session objects. We could recreate all these objects for each parser + // instance but the best parser performance the session object can be reused + // + public class ParserSession + { + MD5 md5; + + public readonly char[] StreamReaderBuffer = new char[SeekableStreamReader.DefaultReadAheadSize * 2]; + public readonly Dictionary[] Identifiers = new Dictionary[Tokenizer.MaxIdentifierLength + 1]; + public readonly List ParametersStack = new List (4); + public readonly char[] IDBuilder = new char[Tokenizer.MaxIdentifierLength]; + public readonly char[] NumberBuilder = new char[Tokenizer.MaxNumberLength]; + + public LocationsBag LocationsBag { get; set; } + public bool UseJayGlobalArrays { get; set; } + public Tokenizer.LocatedToken[] LocatedTokens { get; set; } + + public MD5 GetChecksumAlgorithm () + { + return md5 ?? (md5 = MD5.Create ()); + } + } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs index 32eafa832d..b9491273a1 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs @@ -78,7 +78,7 @@ namespace Mono.CSharp /// /// An out-of-band stack. /// - static Stack oob_stack; + Stack oob_stack; /// /// Controls the verbosity of the errors produced by the parser @@ -134,12 +134,19 @@ namespace Mono.CSharp // share the bucket for very common constructs which can never // be recursive // - static List parameters_bucket = new List (6); + List parameters_bucket; // // Full AST support members // - LocationsBag lbag; + readonly LocationsBag lbag; + + public LocationsBag LocationsBag { + get { + return lbag; + } + } + List> mod_locations; Location parameterModifierLocation, savedLocation, savedOpenLocation, savedCloseLocation; Location savedAttrParenOpenLocation, savedAttrParenCloseLocation, savedOperatorLocation; @@ -163,10 +170,10 @@ namespace Mono.CSharp public void yyerror (string message) { yyerror(message, null); } - +#pragma warning disable 649 /* An EOF token */ public int eof_token; - +#pragma warning restore 649 /** (syntax) error message. Can be overwritten to control message format. @param message text to be displayed. @@ -516,6 +523,7 @@ namespace Mono.CSharp //t "enum_member_declaration : opt_attributes IDENTIFIER", //t "$$59 :", //t "enum_member_declaration : opt_attributes IDENTIFIER $$59 ASSIGN constant_expression", +//t "enum_member_declaration : opt_attributes IDENTIFIER error", //t "enum_member_declaration : attributes_without_members", //t "$$60 :", //t "$$61 :", @@ -753,7 +761,6 @@ namespace Mono.CSharp //t "additive_expression : multiplicative_expression", //t "additive_expression : additive_expression PLUS multiplicative_expression", //t "additive_expression : additive_expression MINUS multiplicative_expression", -//t "additive_expression : parenthesized_expression MINUS multiplicative_expression", //t "additive_expression : additive_expression AS type", //t "additive_expression : additive_expression IS type", //t "shift_expression : additive_expression", @@ -1045,10 +1052,12 @@ namespace Mono.CSharp //t "goto_statement : GOTO CASE constant_expression SEMICOLON", //t "goto_statement : GOTO DEFAULT SEMICOLON", //t "return_statement : RETURN opt_expression SEMICOLON", +//t "return_statement : RETURN expression error", //t "return_statement : RETURN error", //t "throw_statement : THROW opt_expression SEMICOLON", //t "throw_statement : THROW error", //t "yield_statement : identifier_inside_body RETURN opt_expression SEMICOLON", +//t "yield_statement : identifier_inside_body RETURN expression error", //t "yield_statement : identifier_inside_body BREAK SEMICOLON", //t "opt_expression :", //t "opt_expression : expression", @@ -1240,7 +1249,9 @@ namespace Mono.CSharp //t return "[unknown]"; //t } +#pragma warning disable 414 int yyExpectingState; +#pragma warning restore 414 /** computes list of expected tokens on error by tracing the tables. @param state for which to compute the list. @return list of token names. @@ -1306,7 +1317,9 @@ namespace Mono.CSharp static int[] global_yyStates; static object[] global_yyVals; +#pragma warning disable 649 protected bool use_global_stacks; +#pragma warning restore 649 object[] yyVals; // value stack object yyVal; // value stack ptr int yyToken; // current input @@ -2328,38 +2341,38 @@ case 322: case 323: case_323(); break; -case 325: -#line 2678 "cs-parser.jay" +case 324: + case_324(); + break; +case 326: +#line 2693 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out | ParameterModifierType.Params | ParameterModifierType.DefaultValue; } break; -case 326: - case_326(); - break; case 327: -#line 2697 "cs-parser.jay" + case_327(); + break; +case 328: +#line 2712 "cs-parser.jay" { lexer.ConstraintsParsing = false; } break; -case 328: - case_328(); - break; -case 330: - case_330(); +case 329: + case_329(); break; -case 332: - case_332(); +case 331: + case_331(); break; -case 334: - case_334(); +case 333: + case_333(); break; case 335: case_335(); break; -case 337: - case_337(); +case 336: + case_336(); break; case 338: case_338(); @@ -2371,19 +2384,19 @@ case 340: case_340(); break; case 341: -#line 2803 "cs-parser.jay" + case_341(); + break; +case 342: +#line 2818 "cs-parser.jay" { lexer.parsing_generic_declaration = true; } break; -case 342: - case_342(); - break; case 343: case_343(); break; -case 345: - case_345(); +case 344: + case_344(); break; case 346: case_346(); @@ -2400,8 +2413,8 @@ case 349: case 350: case_350(); break; -case 352: - case_352(); +case 351: + case_351(); break; case 353: case_353(); @@ -2415,60 +2428,60 @@ case 355: case 356: case_356(); break; -case 358: -#line 2925 "cs-parser.jay" +case 357: + case_357(); + break; +case 359: +#line 2940 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); } break; -case 359: -#line 2932 "cs-parser.jay" +case 360: +#line 2947 "cs-parser.jay" { lexer.parsing_generic_declaration = true; } break; -case 361: - case_361(); +case 362: + case_362(); break; -case 363: - case_363(); +case 364: + case_364(); break; -case 365: - case_365(); +case 366: + case_366(); break; -case 367: -#line 2970 "cs-parser.jay" +case 368: +#line 2985 "cs-parser.jay" { yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; -case 368: - case_368(); - break; case 369: -#line 2989 "cs-parser.jay" + case_369(); + break; +case 370: +#line 3004 "cs-parser.jay" { yyVal = new ComposedCast ((ATypeNameExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; -case 370: - case_370(); - break; case 371: -#line 2998 "cs-parser.jay" + case_371(); + break; +case 372: +#line 3013 "cs-parser.jay" { yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; -case 372: -#line 3002 "cs-parser.jay" +case 373: +#line 3017 "cs-parser.jay" { yyVal = new ComposedCast (new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[-1+yyTop])), (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; -case 373: - case_373(); - break; case 374: case_374(); break; @@ -2476,95 +2489,95 @@ case 375: case_375(); break; case 376: -#line 3036 "cs-parser.jay" - { yyVal = new TypeExpression (compiler.BuiltinTypes.Object, GetLocation (yyVals[0+yyTop])); } + case_376(); break; case 377: -#line 3037 "cs-parser.jay" - { yyVal = new TypeExpression (compiler.BuiltinTypes.String, GetLocation (yyVals[0+yyTop])); } +#line 3051 "cs-parser.jay" + { yyVal = new TypeExpression (compiler.BuiltinTypes.Object, GetLocation (yyVals[0+yyTop])); } break; case 378: -#line 3038 "cs-parser.jay" - { yyVal = new TypeExpression (compiler.BuiltinTypes.Bool, GetLocation (yyVals[0+yyTop])); } +#line 3052 "cs-parser.jay" + { yyVal = new TypeExpression (compiler.BuiltinTypes.String, GetLocation (yyVals[0+yyTop])); } break; case 379: -#line 3039 "cs-parser.jay" - { yyVal = new TypeExpression (compiler.BuiltinTypes.Decimal, GetLocation (yyVals[0+yyTop])); } +#line 3053 "cs-parser.jay" + { yyVal = new TypeExpression (compiler.BuiltinTypes.Bool, GetLocation (yyVals[0+yyTop])); } break; case 380: -#line 3040 "cs-parser.jay" - { yyVal = new TypeExpression (compiler.BuiltinTypes.Float, GetLocation (yyVals[0+yyTop])); } +#line 3054 "cs-parser.jay" + { yyVal = new TypeExpression (compiler.BuiltinTypes.Decimal, GetLocation (yyVals[0+yyTop])); } break; case 381: -#line 3041 "cs-parser.jay" +#line 3055 "cs-parser.jay" + { yyVal = new TypeExpression (compiler.BuiltinTypes.Float, GetLocation (yyVals[0+yyTop])); } + break; +case 382: +#line 3056 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Double, GetLocation (yyVals[0+yyTop])); } break; -case 383: -#line 3046 "cs-parser.jay" +case 384: +#line 3061 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.SByte, GetLocation (yyVals[0+yyTop])); } break; -case 384: -#line 3047 "cs-parser.jay" +case 385: +#line 3062 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Byte, GetLocation (yyVals[0+yyTop])); } break; -case 385: -#line 3048 "cs-parser.jay" +case 386: +#line 3063 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Short, GetLocation (yyVals[0+yyTop])); } break; -case 386: -#line 3049 "cs-parser.jay" +case 387: +#line 3064 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.UShort, GetLocation (yyVals[0+yyTop])); } break; -case 387: -#line 3050 "cs-parser.jay" +case 388: +#line 3065 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Int, GetLocation (yyVals[0+yyTop])); } break; -case 388: -#line 3051 "cs-parser.jay" +case 389: +#line 3066 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.UInt, GetLocation (yyVals[0+yyTop])); } break; -case 389: -#line 3052 "cs-parser.jay" +case 390: +#line 3067 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Long, GetLocation (yyVals[0+yyTop])); } break; -case 390: -#line 3053 "cs-parser.jay" +case 391: +#line 3068 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.ULong, GetLocation (yyVals[0+yyTop])); } break; -case 391: -#line 3054 "cs-parser.jay" +case 392: +#line 3069 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Char, GetLocation (yyVals[0+yyTop])); } break; -case 412: - case_412(); - break; case 413: case_413(); break; -case 417: -#line 3101 "cs-parser.jay" - { yyVal = new NullLiteral (GetLocation (yyVals[0+yyTop])); } +case 414: + case_414(); break; case 418: -#line 3105 "cs-parser.jay" - { yyVal = new BoolLiteral (compiler.BuiltinTypes, true, GetLocation (yyVals[0+yyTop])); } +#line 3116 "cs-parser.jay" + { yyVal = new NullLiteral (GetLocation (yyVals[0+yyTop])); } break; case 419: -#line 3106 "cs-parser.jay" - { yyVal = new BoolLiteral (compiler.BuiltinTypes, false, GetLocation (yyVals[0+yyTop])); } +#line 3120 "cs-parser.jay" + { yyVal = new BoolLiteral (compiler.BuiltinTypes, true, GetLocation (yyVals[0+yyTop])); } break; -case 424: - case_424(); +case 420: +#line 3121 "cs-parser.jay" + { yyVal = new BoolLiteral (compiler.BuiltinTypes, false, GetLocation (yyVals[0+yyTop])); } break; case 425: -#line 3139 "cs-parser.jay" + case_425(); + break; +case 426: +#line 3154 "cs-parser.jay" { yyVal = new ParenthesizedExpression ((Expression) yyVals[-1+yyTop]); } break; -case 426: - case_426(); - break; case 427: case_427(); break; @@ -2575,23 +2588,23 @@ case 429: case_429(); break; case 430: -#line 3174 "cs-parser.jay" + case_430(); + break; +case 431: +#line 3189 "cs-parser.jay" { yyVal = new CompletionMemberAccess ((Expression) yyVals[-2+yyTop], null,GetLocation (yyVals[0+yyTop])); } break; -case 431: - case_431(); - break; case 432: -#line 3182 "cs-parser.jay" + case_432(); + break; +case 433: +#line 3197 "cs-parser.jay" { yyVal = new CompletionMemberAccess ((Expression) yyVals[-2+yyTop], null, lexer.Location); } break; -case 433: - case_433(); - break; case 434: case_434(); break; @@ -2599,28 +2612,28 @@ case 435: case_435(); break; case 436: -#line 3206 "cs-parser.jay" - { yyVal = null; } + case_436(); break; -case 438: - case_438(); +case 437: +#line 3221 "cs-parser.jay" + { yyVal = null; } break; case 439: case_439(); break; case 440: -#line 3229 "cs-parser.jay" - { yyVal = null; } + case_440(); break; case 441: -#line 3233 "cs-parser.jay" +#line 3244 "cs-parser.jay" + { yyVal = null; } + break; +case 442: +#line 3248 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; -case 442: - case_442(); - break; case 443: case_443(); break; @@ -2631,26 +2644,26 @@ case 445: case_445(); break; case 446: -#line 3266 "cs-parser.jay" + case_446(); + break; +case 447: +#line 3281 "cs-parser.jay" { yyVal = new CompletionElementInitializer (null, GetLocation (yyVals[0+yyTop])); } break; -case 447: - case_447(); - break; case 448: case_448(); break; case 449: case_449(); break; -case 452: -#line 3297 "cs-parser.jay" - { yyVal = null; } +case 450: + case_450(); break; -case 454: - case_454(); +case 453: +#line 3312 "cs-parser.jay" + { yyVal = null; } break; case 455: case_455(); @@ -2665,14 +2678,14 @@ case 458: case_458(); break; case 459: -#line 3350 "cs-parser.jay" + case_459(); + break; +case 460: +#line 3365 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } break; -case 463: - case_463(); - break; case 464: case_464(); break; @@ -2682,8 +2695,8 @@ case 465: case 466: case_466(); break; -case 468: - case_468(); +case 467: + case_467(); break; case 469: case_469(); @@ -2707,38 +2720,38 @@ case 475: case_475(); break; case 476: -#line 3447 "cs-parser.jay" + case_476(); + break; +case 477: +#line 3462 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } break; -case 478: -#line 3455 "cs-parser.jay" +case 479: +#line 3470 "cs-parser.jay" { yyVal = new This (GetLocation (yyVals[0+yyTop])); } break; -case 479: - case_479(); - break; case 480: case_480(); break; case 481: -#line 3475 "cs-parser.jay" + case_481(); + break; +case 482: +#line 3490 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PostIncrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop])); } break; -case 482: -#line 3482 "cs-parser.jay" +case 483: +#line 3497 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PostDecrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop])); } break; -case 483: - case_483(); - break; case 484: case_484(); break; @@ -2758,23 +2771,23 @@ case 489: case_489(); break; case 490: -#line 3549 "cs-parser.jay" + case_490(); + break; +case 491: +#line 3564 "cs-parser.jay" { ++lexer.parsing_type; } break; -case 491: - case_491(); - break; case 492: case_492(); break; -case 495: -#line 3576 "cs-parser.jay" - { yyVal = null; } +case 493: + case_493(); break; -case 497: - case_497(); +case 496: +#line 3591 "cs-parser.jay" + { yyVal = null; } break; case 498: case_498(); @@ -2791,8 +2804,8 @@ case 501: case 502: case_502(); break; -case 506: - case_506(); +case 503: + case_503(); break; case 507: case_507(); @@ -2801,32 +2814,32 @@ case 508: case_508(); break; case 509: -#line 3654 "cs-parser.jay" + case_509(); + break; +case 510: +#line 3669 "cs-parser.jay" { yyVal = 2; } break; -case 510: -#line 3658 "cs-parser.jay" +case 511: +#line 3673 "cs-parser.jay" { yyVal = ((int) yyVals[-1+yyTop]) + 1; } break; -case 511: -#line 3665 "cs-parser.jay" +case 512: +#line 3680 "cs-parser.jay" { yyVal = null; } break; -case 512: -#line 3669 "cs-parser.jay" +case 513: +#line 3684 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; -case 513: - case_513(); - break; case 514: case_514(); break; @@ -2837,16 +2850,16 @@ case 516: case_516(); break; case 517: -#line 3713 "cs-parser.jay" + case_517(); + break; +case 518: +#line 3728 "cs-parser.jay" { lexer.TypeOfParsing = true; } break; -case 518: - case_518(); - break; -case 521: - case_521(); +case 519: + case_519(); break; case 522: case_522(); @@ -2882,124 +2895,121 @@ case 532: case_532(); break; case 533: -#line 3833 "cs-parser.jay" + case_533(); + break; +case 534: +#line 3848 "cs-parser.jay" { start_anonymous (false, (ParametersCompiled) yyVals[0+yyTop], false, GetLocation (yyVals[-1+yyTop])); } break; -case 534: - case_534(); - break; case 535: -#line 3846 "cs-parser.jay" + case_535(); + break; +case 536: +#line 3861 "cs-parser.jay" { start_anonymous (false, (ParametersCompiled) yyVals[0+yyTop], true, GetLocation (yyVals[-2+yyTop])); } break; -case 536: - case_536(); - break; case 537: -#line 3863 "cs-parser.jay" + case_537(); + break; +case 538: +#line 3878 "cs-parser.jay" { yyVal = ParametersCompiled.Undefined; } break; -case 539: -#line 3871 "cs-parser.jay" +case 540: +#line 3886 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; -case 540: - case_540(); - break; case 541: case_541(); break; -case 543: -#line 3897 "cs-parser.jay" +case 542: + case_542(); + break; +case 544: +#line 3912 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.LogicalNot, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; -case 544: -#line 3901 "cs-parser.jay" +case 545: +#line 3916 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.OnesComplement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; -case 545: - case_545(); - break; case 546: case_546(); break; -case 548: -#line 3937 "cs-parser.jay" +case 547: + case_547(); + break; +case 549: +#line 3952 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.UnaryPlus, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; -case 549: -#line 3941 "cs-parser.jay" +case 550: +#line 3956 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.UnaryNegation, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; -case 550: -#line 3945 "cs-parser.jay" +case 551: +#line 3960 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PreIncrement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; -case 551: -#line 3949 "cs-parser.jay" +case 552: +#line 3964 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PreDecrement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; -case 552: -#line 3953 "cs-parser.jay" +case 553: +#line 3968 "cs-parser.jay" { yyVal = new Indirection ((Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; -case 553: -#line 3957 "cs-parser.jay" +case 554: +#line 3972 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.AddressOf, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; -case 555: - case_555(); - break; case 556: case_556(); break; case 557: case_557(); break; -case 559: - case_559(); +case 558: + case_558(); break; case 560: -#line 3989 "cs-parser.jay" - { - yyVal = new Binary (Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); - } + case_560(); break; case 561: case_561(); break; case 562: -#line 3998 "cs-parser.jay" +#line 4009 "cs-parser.jay" { yyVal = new As ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 563: -#line 4002 "cs-parser.jay" +#line 4013 "cs-parser.jay" { yyVal = new Is ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } @@ -3053,10 +3063,7 @@ case 589: case_589(); break; case 590: -#line 4131 "cs-parser.jay" - { - yyVal = new SimpleAssign ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); - } + case_590(); break; case 591: case_591(); @@ -3104,14 +3111,14 @@ case 605: case_605(); break; case 606: -#line 4228 "cs-parser.jay" +#line 4241 "cs-parser.jay" { yyVal = ParametersCompiled.EmptyReadOnlyParameters; } break; case 607: case_607(); break; case 610: -#line 4244 "cs-parser.jay" +#line 4257 "cs-parser.jay" { start_block (Location.Null); } @@ -3135,7 +3142,7 @@ case 617: case_617(); break; case 618: -#line 4289 "cs-parser.jay" +#line 4302 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } @@ -3147,7 +3154,7 @@ case 620: case_620(); break; case 621: -#line 4303 "cs-parser.jay" +#line 4316 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } @@ -3159,7 +3166,7 @@ case 623: case_623(); break; case 629: -#line 4328 "cs-parser.jay" +#line 4341 "cs-parser.jay" { yyVal = new ArglistAccess (GetLocation (yyVals[0+yyTop])); } @@ -3174,13 +3181,13 @@ case 632: case_632(); break; case 634: -#line 4357 "cs-parser.jay" +#line 4370 "cs-parser.jay" { yyVal = new BooleanExpression ((Expression) yyVals[0+yyTop]); } break; case 635: -#line 4370 "cs-parser.jay" +#line 4383 "cs-parser.jay" { lexer.ConstraintsParsing = true; } @@ -3198,18 +3205,18 @@ case 639: case_639(); break; case 640: -#line 4415 "cs-parser.jay" +#line 4428 "cs-parser.jay" { yyVal = null; } break; case 641: -#line 4417 "cs-parser.jay" +#line 4430 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; StoreModifierLocation (Modifiers.PARTIAL, GetLocation (yyVals[0+yyTop])); } break; case 642: case_642(); break; case 643: -#line 4430 "cs-parser.jay" +#line 4443 "cs-parser.jay" { lexer.parsing_modifiers = false; } @@ -3269,7 +3276,7 @@ case 663: case_663(); break; case 665: -#line 4556 "cs-parser.jay" +#line 4569 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -3299,19 +3306,19 @@ case 673: case_673(); break; case 674: -#line 4649 "cs-parser.jay" +#line 4662 "cs-parser.jay" { yyVal = new SpecialContraintExpr (SpecialConstraint.Class, GetLocation (yyVals[0+yyTop])); } break; case 675: -#line 4653 "cs-parser.jay" +#line 4666 "cs-parser.jay" { yyVal = new SpecialContraintExpr (SpecialConstraint.Struct, GetLocation (yyVals[0+yyTop])); } break; case 676: -#line 4660 "cs-parser.jay" +#line 4673 "cs-parser.jay" { yyVal = Variance.None; } @@ -3329,7 +3336,7 @@ case 680: case_680(); break; case 681: -#line 4705 "cs-parser.jay" +#line 4718 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -3350,13 +3357,13 @@ case 686: case_686(); break; case 691: -#line 4754 "cs-parser.jay" +#line 4767 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 692: -#line 4758 "cs-parser.jay" +#line 4771 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } @@ -3368,13 +3375,13 @@ case 695: case_695(); break; case 698: -#line 4792 "cs-parser.jay" +#line 4805 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 699: -#line 4796 "cs-parser.jay" +#line 4809 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } @@ -3407,13 +3414,13 @@ case 738: case_738(); break; case 739: -#line 4940 "cs-parser.jay" +#line 4953 "cs-parser.jay" { yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 740: -#line 4944 "cs-parser.jay" +#line 4957 "cs-parser.jay" { yyVal = new ComposedCast (new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[-1+yyTop])), (ComposedTypeSpecifier) yyVals[0+yyTop]); } @@ -3425,7 +3432,7 @@ case 743: case_743(); break; case 744: -#line 4965 "cs-parser.jay" +#line 4978 "cs-parser.jay" { yyVal = ComposedTypeSpecifier.CreatePointer (GetLocation (yyVals[0+yyTop])); } @@ -3467,7 +3474,7 @@ case 764: case_764(); break; case 765: -#line 5100 "cs-parser.jay" +#line 5113 "cs-parser.jay" { report.Error (145, lexer.Location, "A const field requires a value to be provided"); } @@ -3488,18 +3495,18 @@ case 775: case_775(); break; case 776: -#line 5150 "cs-parser.jay" +#line 5163 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 777: case_777(); break; case 778: -#line 5160 "cs-parser.jay" +#line 5173 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 779: -#line 5161 "cs-parser.jay" +#line 5174 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 780: @@ -3521,7 +3528,7 @@ case 787: case_787(); break; case 788: -#line 5236 "cs-parser.jay" +#line 5249 "cs-parser.jay" { start_block (GetLocation (yyVals[0+yyTop])); } @@ -3545,13 +3552,13 @@ case 795: case_795(); break; case 796: -#line 5287 "cs-parser.jay" +#line 5300 "cs-parser.jay" { current_block = current_block.CreateSwitchBlock (lexer.Location); } break; case 797: -#line 5291 "cs-parser.jay" +#line 5304 "cs-parser.jay" { yyVal = new SwitchSection ((List) yyVals[-2+yyTop], current_block); } @@ -3569,7 +3576,7 @@ case 801: case_801(); break; case 802: -#line 5325 "cs-parser.jay" +#line 5338 "cs-parser.jay" { yyVal = new SwitchLabel (null, GetLocation (yyVals[0+yyTop])); } @@ -3593,7 +3600,7 @@ case 812: case_812(); break; case 813: -#line 5386 "cs-parser.jay" +#line 5399 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -3602,7 +3609,7 @@ case 814: case_814(); break; case 815: -#line 5401 "cs-parser.jay" +#line 5414 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -3614,7 +3621,7 @@ case 817: case_817(); break; case 818: -#line 5422 "cs-parser.jay" +#line 5435 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } @@ -3629,7 +3636,7 @@ case 821: case_821(); break; case 822: -#line 5456 "cs-parser.jay" +#line 5469 "cs-parser.jay" { yyVal = new EmptyStatement (lexer.Location); } break; case 824: @@ -3639,11 +3646,11 @@ case 825: case_825(); break; case 827: -#line 5477 "cs-parser.jay" +#line 5490 "cs-parser.jay" { yyVal = null; } break; case 829: -#line 5482 "cs-parser.jay" +#line 5495 "cs-parser.jay" { yyVal = new EmptyStatement (lexer.Location); } break; case 833: @@ -3703,17 +3710,17 @@ case 856: case 857: case_857(); break; -case 860: -#line 5699 "cs-parser.jay" - { - yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false); - } +case 858: + case_858(); break; -case 861: - case_861(); +case 859: + case_859(); break; case 862: - case_862(); +#line 5735 "cs-parser.jay" + { + yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false); + } break; case 863: case_863(); @@ -3724,50 +3731,50 @@ case 864: case 865: case_865(); break; -case 868: -#line 5749 "cs-parser.jay" - { - yyVal = new Catch ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); - } +case 866: + case_866(); break; -case 869: - case_869(); +case 867: + case_867(); break; case 870: -#line 5768 "cs-parser.jay" +#line 5785 "cs-parser.jay" { - yyVal = yyVals[-1+yyTop]; + yyVal = new Catch ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 871: case_871(); break; case 872: -#line 5786 "cs-parser.jay" +#line 5804 "cs-parser.jay" { - yyVal = new Checked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = yyVals[-1+yyTop]; } break; case 873: -#line 5793 "cs-parser.jay" - { - yyVal = new Unchecked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); - } + case_873(); break; case 874: - case_874(); +#line 5822 "cs-parser.jay" + { + yyVal = new Checked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + } break; case 875: -#line 5803 "cs-parser.jay" +#line 5829 "cs-parser.jay" { - yyVal = new Unsafe ((Block) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); + yyVal = new Unchecked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 876: case_876(); break; case 877: - case_877(); +#line 5839 "cs-parser.jay" + { + yyVal = new Unsafe ((Block) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); + } break; case 878: case_878(); @@ -3793,20 +3800,20 @@ case 884: case 885: case_885(); break; +case 886: + case_886(); + break; case 887: case_887(); break; -case 888: -#line 5908 "cs-parser.jay" - { - Error_MissingInitializer (lexer.Location); - } - break; case 889: case_889(); break; case 890: - case_890(); +#line 5944 "cs-parser.jay" + { + Error_MissingInitializer (lexer.Location); + } break; case 891: case_891(); @@ -3830,16 +3837,13 @@ case 897: case_897(); break; case 898: -#line 6013 "cs-parser.jay" - { - current_block = new Linq.QueryBlock (current_block, lexer.Location); - } + case_898(); break; case 899: case_899(); break; case 900: -#line 6029 "cs-parser.jay" +#line 6049 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -3848,28 +3852,31 @@ case 901: case_901(); break; case 902: - case_902(); +#line 6065 "cs-parser.jay" + { + current_block = new Linq.QueryBlock (current_block, lexer.Location); + } break; case 903: case_903(); break; +case 904: + case_904(); + break; case 905: case_905(); break; -case 906: - case_906(); - break; case 907: -#line 6093 "cs-parser.jay" - { - current_block = new Linq.QueryBlock (current_block, lexer.Location); - } + case_907(); break; case 908: case_908(); break; case 909: - case_909(); +#line 6129 "cs-parser.jay" + { + current_block = new Linq.QueryBlock (current_block, lexer.Location); + } break; case 910: case_910(); @@ -3877,20 +3884,17 @@ case 910: case 911: case_911(); break; +case 912: + case_912(); + break; case 913: case_913(); break; -case 919: -#line 6147 "cs-parser.jay" - { - current_block = new Linq.QueryBlock (current_block, lexer.Location); - } - break; -case 920: - case_920(); +case 915: + case_915(); break; case 921: -#line 6166 "cs-parser.jay" +#line 6183 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } @@ -3899,7 +3903,10 @@ case 922: case_922(); break; case 923: - case_923(); +#line 6202 "cs-parser.jay" + { + current_block = new Linq.QueryBlock (current_block, lexer.Location); + } break; case 924: case_924(); @@ -3922,141 +3929,147 @@ case 929: case 930: case_930(); break; +case 931: + case_931(); + break; case 932: case_932(); break; -case 933: -#line 6320 "cs-parser.jay" +case 934: + case_934(); + break; +case 935: +#line 6356 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } break; -case 934: - case_934(); - break; case 936: case_936(); break; -case 937: - case_937(); +case 938: + case_938(); break; case 939: case_939(); break; -case 940: - case_940(); - break; case 941: -#line 6366 "cs-parser.jay" - { - yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); - } + case_941(); break; case 942: case_942(); break; case 943: - case_943(); - break; -case 944: -#line 6383 "cs-parser.jay" +#line 6402 "cs-parser.jay" { - yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); + yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); } break; +case 944: + case_944(); + break; case 945: case_945(); break; case 946: - case_946(); +#line 6419 "cs-parser.jay" + { + yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); + } + break; +case 947: + case_947(); break; case 948: case_948(); break; -case 949: - case_949(); +case 950: + case_950(); + break; +case 951: + case_951(); break; -case 952: - case_952(); +case 954: + case_954(); break; -case 953: - case_953(); +case 955: + case_955(); break; -case 961: -#line 6505 "cs-parser.jay" +case 963: +#line 6541 "cs-parser.jay" { module.DocumentationBuilder.ParsedName = (MemberName) yyVals[0+yyTop]; } break; -case 962: -#line 6512 "cs-parser.jay" +case 964: +#line 6548 "cs-parser.jay" { module.DocumentationBuilder.ParsedParameters = (List)yyVals[0+yyTop]; } break; -case 963: - case_963(); +case 965: + case_965(); break; -case 964: - case_964(); +case 966: + case_966(); break; -case 965: -#line 6529 "cs-parser.jay" +case 967: +#line 6565 "cs-parser.jay" { yyVal = new MemberName ((MemberName) yyVals[-2+yyTop], MemberCache.IndexerNameAlias, Location.Null); } break; -case 966: -#line 6533 "cs-parser.jay" +case 968: +#line 6569 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; -case 967: - case_967(); - break; -case 968: - case_968(); - break; case 969: case_969(); break; case 970: case_970(); break; +case 971: + case_971(); + break; case 972: -#line 6569 "cs-parser.jay" + case_972(); + break; +case 974: +#line 6605 "cs-parser.jay" { yyVal = new MemberName (((MemberName) yyVals[-2+yyTop]), (MemberName) yyVals[0+yyTop]); } break; -case 974: -#line 6577 "cs-parser.jay" +case 976: +#line 6613 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; -case 975: -#line 6581 "cs-parser.jay" +case 977: +#line 6617 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; -case 976: -#line 6588 "cs-parser.jay" +case 978: +#line 6624 "cs-parser.jay" { yyVal = new List (0); } break; -case 978: - case_978(); - break; -case 979: - case_979(); - break; case 980: case_980(); break; +case 981: + case_981(); + break; +case 982: + case_982(); + break; #line default } yyTop -= yyLen[yyN]; @@ -5949,8 +5962,25 @@ void case_323() yyVal = em; } -void case_326() -#line 2680 "cs-parser.jay" +void case_324() +#line 2668 "cs-parser.jay" +{ + Error_SyntaxError (yyToken); + + var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; + var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-2+yyTop]); + ((Enum) current_type).AddEnumMember (em); + + if (doc_support) { + em.DocComment = Lexer.consume_doc_comment (); + Lexer.doc_state = XmlCommentState.Allowed; + } + + yyVal = em; + } + +void case_327() +#line 2695 "cs-parser.jay" { valid_param_mod = 0; @@ -5966,8 +5996,8 @@ void case_326() lexer.ConstraintsParsing = true; } -void case_328() -#line 2699 "cs-parser.jay" +void case_329() +#line 2714 "cs-parser.jay" { if (doc_support) { current_delegate.DocComment = Lexer.consume_doc_comment (); @@ -5983,8 +6013,8 @@ void case_328() current_delegate = null; } -void case_330() -#line 2718 "cs-parser.jay" +void case_331() +#line 2733 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[0+yyTop]), "nullable types"); @@ -5992,8 +6022,8 @@ void case_330() yyVal = ComposedTypeSpecifier.CreateNullable (GetLocation (yyVals[0+yyTop])); } -void case_332() -#line 2729 "cs-parser.jay" +void case_333() +#line 2744 "cs-parser.jay" { var lt1 = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; var lt2 = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; @@ -6002,23 +6032,23 @@ void case_332() lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_334() -#line 2741 "cs-parser.jay" +void case_335() +#line 2756 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new MemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } -void case_335() -#line 2750 "cs-parser.jay" +void case_336() +#line 2765 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new SimpleName (lt.Value, (TypeArguments)yyVals[0+yyTop], lt.Location); } -void case_337() -#line 2762 "cs-parser.jay" +void case_338() +#line 2777 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-2+yyTop]), "generics"); @@ -6030,15 +6060,15 @@ void case_337() yyVal = yyVals[-1+yyTop];; } -void case_338() -#line 2773 "cs-parser.jay" +void case_339() +#line 2788 "cs-parser.jay" { Error_TypeExpected (lexer.Location); yyVal = new TypeArguments (); } -void case_339() -#line 2781 "cs-parser.jay" +void case_340() +#line 2796 "cs-parser.jay" { TypeArguments type_args = new TypeArguments (); type_args.Add ((FullNamedExpression) yyVals[0+yyTop]); @@ -6046,8 +6076,8 @@ void case_339() locationListStack.Push (new List ()); } -void case_340() -#line 2788 "cs-parser.jay" +void case_341() +#line 2803 "cs-parser.jay" { TypeArguments type_args = (TypeArguments) yyVals[-2+yyTop]; type_args.Add ((FullNamedExpression) yyVals[0+yyTop]); @@ -6055,16 +6085,16 @@ void case_340() locationListStack.Peek ().Add (GetLocation (yyVals[-1+yyTop])); } -void case_342() -#line 2805 "cs-parser.jay" +void case_343() +#line 2820 "cs-parser.jay" { lexer.parsing_generic_declaration = false; var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; yyVal = new MemberName (lt.Value, (TypeParameters)yyVals[0+yyTop], lt.Location); } -void case_343() -#line 2814 "cs-parser.jay" +void case_344() +#line 2829 "cs-parser.jay" { MemberName mn = (MemberName)yyVals[0+yyTop]; if (mn.TypeParameters != null) @@ -6072,38 +6102,38 @@ void case_343() mn.GetSignatureForError ())); } -void case_345() -#line 2825 "cs-parser.jay" +void case_346() +#line 2840 "cs-parser.jay" { lexer.parsing_generic_declaration = false; var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new MemberName (lt.Value, (TypeParameters) yyVals[0+yyTop], (ATypeNameExpression) yyVals[-2+yyTop], lt.Location); } -void case_346() -#line 2834 "cs-parser.jay" +void case_347() +#line 2849 "cs-parser.jay" { lexer.parsing_generic_declaration = false; yyVal = new MemberName (TypeDefinition.DefaultIndexerName, GetLocation (yyVals[0+yyTop])); } -void case_347() -#line 2839 "cs-parser.jay" +void case_348() +#line 2854 "cs-parser.jay" { lexer.parsing_generic_declaration = false; yyVal = new MemberName (TypeDefinition.DefaultIndexerName, null, (ATypeNameExpression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop])); } -void case_348() -#line 2847 "cs-parser.jay" +void case_349() +#line 2862 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; yyVal = new SimpleName (lt.Value, (TypeArguments) yyVals[-1+yyTop], lt.Location); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_349() -#line 2853 "cs-parser.jay" +void case_350() +#line 2868 "cs-parser.jay" { var lt1 = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; var lt2 = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; @@ -6112,16 +6142,16 @@ void case_349() lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_350() -#line 2861 "cs-parser.jay" +void case_351() +#line 2876 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; yyVal = new MemberAccess ((ATypeNameExpression) yyVals[-3+yyTop], lt.Value, (TypeArguments) yyVals[-1+yyTop], lt.Location); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_352() -#line 2871 "cs-parser.jay" +void case_353() +#line 2886 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-2+yyTop]), "generics"); @@ -6133,8 +6163,8 @@ void case_352() lbag.AddLocation (yyVals[-1+yyTop], list); } -void case_353() -#line 2885 "cs-parser.jay" +void case_354() +#line 2900 "cs-parser.jay" { var tparams = new TypeParameters (); tparams.Add ((TypeParameter)yyVals[0+yyTop]); @@ -6142,8 +6172,8 @@ void case_353() locationListStack.Push (new List ()); } -void case_354() -#line 2892 "cs-parser.jay" +void case_355() +#line 2907 "cs-parser.jay" { var tparams = (TypeParameters) yyVals[-2+yyTop]; tparams.Add ((TypeParameter)yyVals[0+yyTop]); @@ -6151,15 +6181,15 @@ void case_354() locationListStack.Peek ().Add (GetLocation (yyVals[-1+yyTop])); } -void case_355() -#line 2902 "cs-parser.jay" +void case_356() +#line 2917 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken)yyVals[0+yyTop]; yyVal = new TypeParameter (new MemberName (lt.Value, lt.Location), (Attributes)yyVals[-2+yyTop], (Variance) yyVals[-1+yyTop]); } -void case_356() -#line 2907 "cs-parser.jay" +void case_357() +#line 2922 "cs-parser.jay" { if (GetTokenName (yyToken) == "type") report.Error (81, GetLocation (yyVals[0+yyTop]), "Type parameter declaration must be an identifier not a type"); @@ -6169,29 +6199,29 @@ void case_356() yyVal = new TypeParameter (MemberName.Null, null, Variance.None); } -void case_361() -#line 2941 "cs-parser.jay" +void case_362() +#line 2956 "cs-parser.jay" { Expression.Error_VoidInvalidInTheContext (GetLocation (yyVals[0+yyTop]), report); yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); } -void case_363() -#line 2950 "cs-parser.jay" +void case_364() +#line 2965 "cs-parser.jay" { Expression.Error_VoidInvalidInTheContext (GetLocation (yyVals[0+yyTop]), report); yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); } -void case_365() -#line 2959 "cs-parser.jay" +void case_366() +#line 2974 "cs-parser.jay" { report.Error (1536, GetLocation (yyVals[0+yyTop]), "Invalid parameter type `void'"); yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); } -void case_368() -#line 2975 "cs-parser.jay" +void case_369() +#line 2990 "cs-parser.jay" { if (yyVals[0+yyTop] != null) { yyVal = new ComposedCast ((ATypeNameExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); @@ -6204,23 +6234,23 @@ void case_368() } } -void case_370() -#line 2991 "cs-parser.jay" +void case_371() +#line 3006 "cs-parser.jay" { if (yyVals[0+yyTop] != null) yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } -void case_373() -#line 3007 "cs-parser.jay" +void case_374() +#line 3022 "cs-parser.jay" { var types = new List (2); types.Add ((FullNamedExpression) yyVals[0+yyTop]); yyVal = types; } -void case_374() -#line 3013 "cs-parser.jay" +void case_375() +#line 3028 "cs-parser.jay" { var types = (List) yyVals[-2+yyTop]; types.Add ((FullNamedExpression) yyVals[0+yyTop]); @@ -6228,8 +6258,8 @@ void case_374() yyVal = types; } -void case_375() -#line 3023 "cs-parser.jay" +void case_376() +#line 3038 "cs-parser.jay" { if (yyVals[0+yyTop] is ComposedCast) { report.Error (1521, GetLocation (yyVals[0+yyTop]), "Invalid base type `{0}'", ((ComposedCast)yyVals[0+yyTop]).GetSignatureForError ()); @@ -6237,29 +6267,29 @@ void case_375() yyVal = yyVals[0+yyTop]; } -void case_412() -#line 3087 "cs-parser.jay" +void case_413() +#line 3102 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new SimpleName (lt.Value, (TypeArguments)yyVals[0+yyTop], lt.Location); } -void case_413() -#line 3091 "cs-parser.jay" +void case_414() +#line 3106 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new CompletionSimpleName (MemberName.MakeName (lt.Value, null), lt.Location); } -void case_424() -#line 3132 "cs-parser.jay" +void case_425() +#line 3147 "cs-parser.jay" { yyVal = new ParenthesizedExpression ((Expression) yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_426() -#line 3144 "cs-parser.jay" +void case_427() +#line 3159 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new MemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location) { @@ -6267,8 +6297,8 @@ void case_426() }; } -void case_427() -#line 3151 "cs-parser.jay" +void case_428() +#line 3166 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new MemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location) { @@ -6276,8 +6306,8 @@ void case_427() }; } -void case_428() -#line 3158 "cs-parser.jay" +void case_429() +#line 3173 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new MemberAccess (new BaseThis (GetLocation (yyVals[-3+yyTop])), lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location) { @@ -6285,8 +6315,8 @@ void case_428() }; } -void case_429() -#line 3165 "cs-parser.jay" +void case_430() +#line 3180 "cs-parser.jay" { var lt1 = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; var lt2 = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; @@ -6295,29 +6325,29 @@ void case_429() lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_431() -#line 3175 "cs-parser.jay" +void case_432() +#line 3190 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new CompletionMemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, lt.Location); } -void case_433() -#line 3183 "cs-parser.jay" +void case_434() +#line 3198 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new CompletionMemberAccess ((Expression) yyVals[-3+yyTop], lt.Value, lt.Location); } -void case_434() -#line 3191 "cs-parser.jay" +void case_435() +#line 3206 "cs-parser.jay" { yyVal = new Invocation ((Expression) yyVals[-3+yyTop], (Arguments) yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_435() -#line 3196 "cs-parser.jay" +void case_436() +#line 3211 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -6325,8 +6355,8 @@ void case_435() lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } -void case_438() -#line 3212 "cs-parser.jay" +void case_439() +#line 3227 "cs-parser.jay" { if (yyVals[-1+yyTop] == null) { yyVal = new CollectionOrObjectInitializers (new List (), GetLocation (yyVals[-2+yyTop])); @@ -6337,23 +6367,23 @@ void case_438() } } -void case_439() -#line 3222 "cs-parser.jay" +void case_440() +#line 3237 "cs-parser.jay" { yyVal = new CollectionOrObjectInitializers ((List) yyVals[-2+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_442() -#line 3238 "cs-parser.jay" +void case_443() +#line 3253 "cs-parser.jay" { var a = new List (); a.Add ((Expression) yyVals[0+yyTop]); yyVal = a; } -void case_443() -#line 3244 "cs-parser.jay" +void case_444() +#line 3259 "cs-parser.jay" { var a = (List)yyVals[-2+yyTop]; a.Add ((Expression) yyVals[0+yyTop]); @@ -6361,23 +6391,23 @@ void case_443() yyVal = a; } -void case_444() -#line 3250 "cs-parser.jay" +void case_445() +#line 3265 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = yyVals[-1+yyTop]; } -void case_445() -#line 3258 "cs-parser.jay" +void case_446() +#line 3273 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; yyVal = new ElementInitializer (lt.Value, (Expression)yyVals[0+yyTop], lt.Location); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_447() -#line 3267 "cs-parser.jay" +void case_448() +#line 3282 "cs-parser.jay" { CompletionSimpleName csn = yyVals[-1+yyTop] as CompletionSimpleName; if (csn == null) @@ -6386,8 +6416,8 @@ void case_447() yyVal = new CompletionElementInitializer (csn.Prefix, csn.Location); } -void case_448() -#line 3275 "cs-parser.jay" +void case_449() +#line 3290 "cs-parser.jay" { if (yyVals[-1+yyTop] == null) yyVal = null; @@ -6397,24 +6427,24 @@ void case_448() } } -void case_449() -#line 3284 "cs-parser.jay" +void case_450() +#line 3299 "cs-parser.jay" { report.Error (1920, GetLocation (yyVals[-1+yyTop]), "An element initializer cannot be empty"); yyVal = new CollectionElementInitializer (new List (), GetLocation (yyVals[-1+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_454() -#line 3303 "cs-parser.jay" +void case_455() +#line 3318 "cs-parser.jay" { Arguments list = new Arguments (4); list.Add ((Argument) yyVals[0+yyTop]); yyVal = list; } -void case_455() -#line 3309 "cs-parser.jay" +void case_456() +#line 3324 "cs-parser.jay" { Arguments list = (Arguments) yyVals[-2+yyTop]; if (list [list.Count - 1] is NamedArgument) @@ -6425,8 +6455,8 @@ void case_455() yyVal = list; } -void case_456() -#line 3319 "cs-parser.jay" +void case_457() +#line 3334 "cs-parser.jay" { Arguments list = (Arguments) yyVals[-2+yyTop]; NamedArgument a = (NamedArgument) yyVals[0+yyTop]; @@ -6442,80 +6472,80 @@ void case_456() yyVal = list; } -void case_457() -#line 3334 "cs-parser.jay" +void case_458() +#line 3349 "cs-parser.jay" { lexer.putback (')'); /* TODO: Wrong but what can I do*/ Error_SyntaxError (yyToken); yyVal = yyVals[-2+yyTop]; } -void case_458() -#line 3340 "cs-parser.jay" +void case_459() +#line 3355 "cs-parser.jay" { report.Error (839, GetLocation (yyVals[-1+yyTop]), "An argument is missing"); yyVal = null; } -void case_463() -#line 3361 "cs-parser.jay" +void case_464() +#line 3376 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop], Argument.AType.Ref); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_464() -#line 3366 "cs-parser.jay" +void case_465() +#line 3381 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop], Argument.AType.Out); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_465() -#line 3371 "cs-parser.jay" +void case_466() +#line 3386 "cs-parser.jay" { yyVal = new Argument (new Arglist ((Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop]))); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_466() -#line 3376 "cs-parser.jay" +void case_467() +#line 3391 "cs-parser.jay" { yyVal = new Argument (new Arglist (GetLocation (yyVals[-2+yyTop]))); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_468() -#line 3388 "cs-parser.jay" +void case_469() +#line 3403 "cs-parser.jay" { yyVal = new ElementAccess ((Expression) yyVals[-3+yyTop], (Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_469() -#line 3393 "cs-parser.jay" +void case_470() +#line 3408 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new ElementAccess ((Expression) yyVals[-3+yyTop], (Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); } -void case_470() -#line 3398 "cs-parser.jay" +void case_471() +#line 3413 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new ElementAccess ((Expression) yyVals[-2+yyTop], null, GetLocation (yyVals[-1+yyTop])); } -void case_471() -#line 3406 "cs-parser.jay" +void case_472() +#line 3421 "cs-parser.jay" { var list = new List (4); list.Add ((Expression) yyVals[0+yyTop]); yyVal = list; } -void case_472() -#line 3412 "cs-parser.jay" +void case_473() +#line 3427 "cs-parser.jay" { var list = (List) yyVals[-2+yyTop]; list.Add ((Expression) yyVals[0+yyTop]); @@ -6523,23 +6553,23 @@ void case_472() yyVal = list; } -void case_473() -#line 3418 "cs-parser.jay" +void case_474() +#line 3433 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = yyVals[-1+yyTop]; } -void case_474() -#line 3426 "cs-parser.jay" +void case_475() +#line 3441 "cs-parser.jay" { Arguments args = new Arguments (4); args.Add ((Argument) yyVals[0+yyTop]); yyVal = args; } -void case_475() -#line 3432 "cs-parser.jay" +void case_476() +#line 3447 "cs-parser.jay" { Arguments args = (Arguments) yyVals[-2+yyTop]; if (args [args.Count - 1] is NamedArgument && !(yyVals[0+yyTop] is NamedArgument)) @@ -6550,22 +6580,22 @@ void case_475() yyVal = args; } -void case_479() -#line 3460 "cs-parser.jay" +void case_480() +#line 3475 "cs-parser.jay" { yyVal = new ElementAccess (new BaseThis (GetLocation (yyVals[-3+yyTop])), (Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_480() -#line 3465 "cs-parser.jay" +void case_481() +#line 3480 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new ElementAccess (null, null, GetLocation (yyVals[-1+yyTop])); } -void case_483() -#line 3487 "cs-parser.jay" +void case_484() +#line 3502 "cs-parser.jay" { if (yyVals[0+yyTop] != null) { if (lang_version <= LanguageVersion.ISO_2) @@ -6579,8 +6609,8 @@ void case_483() lbag.AddLocation (yyVal, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop])); } -void case_484() -#line 3500 "cs-parser.jay" +void case_485() +#line 3515 "cs-parser.jay" { if (lang_version <= LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-2+yyTop]), "collection initializers"); @@ -6588,8 +6618,8 @@ void case_484() yyVal = new NewInitialize ((FullNamedExpression) yyVals[-1+yyTop], null, (CollectionOrObjectInitializers) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); } -void case_485() -#line 3512 "cs-parser.jay" +void case_486() +#line 3527 "cs-parser.jay" { yyVal = new ArrayCreation ((FullNamedExpression) yyVals[-5+yyTop], (List) yyVals[-3+yyTop], new ComposedTypeSpecifier (((List) yyVals[-3+yyTop]).Count, GetLocation (yyVals[-4+yyTop])) { @@ -6598,8 +6628,8 @@ void case_485() lbag.AddLocation (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop])); } -void case_486() -#line 3520 "cs-parser.jay" +void case_487() +#line 3535 "cs-parser.jay" { if (yyVals[0+yyTop] == null) report.Error (1586, GetLocation (yyVals[-3+yyTop]), "Array creation must have array size or array initializer"); @@ -6607,8 +6637,8 @@ void case_486() yyVal = new ArrayCreation ((FullNamedExpression) yyVals[-2+yyTop], (ComposedTypeSpecifier) yyVals[-1+yyTop], (ArrayInitializer) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop])); } -void case_487() -#line 3527 "cs-parser.jay" +void case_488() +#line 3542 "cs-parser.jay" { if (lang_version <= LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-2+yyTop]), "implicitly typed arrays"); @@ -6616,30 +6646,30 @@ void case_487() yyVal = new ImplicitlyTypedArrayCreation ((ComposedTypeSpecifier) yyVals[-1+yyTop], (ArrayInitializer) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); } -void case_488() -#line 3534 "cs-parser.jay" +void case_489() +#line 3549 "cs-parser.jay" { report.Error (178, GetLocation (yyVals[-1+yyTop]), "Invalid rank specifier, expecting `,' or `]'"); yyVal = new ArrayCreation ((FullNamedExpression) yyVals[-5+yyTop], null, GetLocation (yyVals[-6+yyTop])); } -void case_489() -#line 3539 "cs-parser.jay" +void case_490() +#line 3554 "cs-parser.jay" { Error_SyntaxError (yyToken); /* It can be any of new expression, create the most common one*/ yyVal = new New ((FullNamedExpression) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop])); } -void case_491() -#line 3551 "cs-parser.jay" +void case_492() +#line 3566 "cs-parser.jay" { --lexer.parsing_type; yyVal = yyVals[0+yyTop]; } -void case_492() -#line 3559 "cs-parser.jay" +void case_493() +#line 3574 "cs-parser.jay" { if (lang_version <= LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-3+yyTop]), "anonymous types"); @@ -6650,16 +6680,16 @@ void case_492() lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_497() -#line 3582 "cs-parser.jay" +void case_498() +#line 3597 "cs-parser.jay" { var a = new List (4); a.Add ((AnonymousTypeParameter) yyVals[0+yyTop]); yyVal = a; } -void case_498() -#line 3588 "cs-parser.jay" +void case_499() +#line 3603 "cs-parser.jay" { var a = (List) yyVals[-2+yyTop]; a.Add ((AnonymousTypeParameter) yyVals[0+yyTop]); @@ -6668,60 +6698,60 @@ void case_498() yyVal = a; } -void case_499() -#line 3599 "cs-parser.jay" +void case_500() +#line 3614 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken)yyVals[-2+yyTop]; yyVal = new AnonymousTypeParameter ((Expression)yyVals[0+yyTop], lt.Value, lt.Location); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_500() -#line 3605 "cs-parser.jay" +void case_501() +#line 3620 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken)yyVals[0+yyTop]; yyVal = new AnonymousTypeParameter (new SimpleName (lt.Value, lt.Location), lt.Value, lt.Location); } -void case_501() -#line 3611 "cs-parser.jay" +void case_502() +#line 3626 "cs-parser.jay" { MemberAccess ma = (MemberAccess) yyVals[0+yyTop]; yyVal = new AnonymousTypeParameter (ma, ma.Name, ma.Location); } -void case_502() -#line 3616 "cs-parser.jay" +void case_503() +#line 3631 "cs-parser.jay" { report.Error (746, lexer.Location, "Invalid anonymous type member declarator. Anonymous type members must be a member assignment, simple name or member access expression"); yyVal = null; } -void case_506() -#line 3631 "cs-parser.jay" +void case_507() +#line 3646 "cs-parser.jay" { ((ComposedTypeSpecifier) yyVals[-1+yyTop]).Next = (ComposedTypeSpecifier) yyVals[0+yyTop]; yyVal = yyVals[-1+yyTop]; } -void case_507() -#line 3639 "cs-parser.jay" +void case_508() +#line 3654 "cs-parser.jay" { yyVal = ComposedTypeSpecifier.CreateArrayDimension (1, GetLocation (yyVals[-1+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_508() -#line 3644 "cs-parser.jay" +void case_509() +#line 3659 "cs-parser.jay" { yyVal = ComposedTypeSpecifier.CreateArrayDimension ((int)yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_513() -#line 3674 "cs-parser.jay" +void case_514() +#line 3689 "cs-parser.jay" { var ai = new ArrayInitializer (0, GetLocation (yyVals[-1+yyTop])); ai.VariableDeclaration = current_variable; @@ -6729,8 +6759,8 @@ void case_513() yyVal = ai; } -void case_514() -#line 3681 "cs-parser.jay" +void case_515() +#line 3696 "cs-parser.jay" { var ai = new ArrayInitializer ((List) yyVals[-2+yyTop], GetLocation (yyVals[-3+yyTop])); ai.VariableDeclaration = current_variable; @@ -6742,16 +6772,16 @@ void case_514() yyVal = ai; } -void case_515() -#line 3695 "cs-parser.jay" +void case_516() +#line 3710 "cs-parser.jay" { var list = new List (4); list.Add ((Expression) yyVals[0+yyTop]); yyVal = list; } -void case_516() -#line 3701 "cs-parser.jay" +void case_517() +#line 3716 "cs-parser.jay" { var list = (List) yyVals[-2+yyTop]; list.Add ((Expression) yyVals[0+yyTop]); @@ -6759,31 +6789,31 @@ void case_516() yyVal = list; } -void case_518() -#line 3715 "cs-parser.jay" +void case_519() +#line 3730 "cs-parser.jay" { lexer.TypeOfParsing = false; yyVal = new TypeOf ((FullNamedExpression) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_521() -#line 3726 "cs-parser.jay" +void case_522() +#line 3741 "cs-parser.jay" { Error_TypeExpected (lexer.Location); yyVal = null; } -void case_522() -#line 3734 "cs-parser.jay" +void case_523() +#line 3749 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new SimpleName (lt.Value, (int) yyVals[0+yyTop], lt.Location); } -void case_523() -#line 3740 "cs-parser.jay" +void case_524() +#line 3755 "cs-parser.jay" { var lt1 = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; var lt2 = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; @@ -6792,8 +6822,8 @@ void case_523() lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_524() -#line 3748 "cs-parser.jay" +void case_525() +#line 3763 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; @@ -6802,8 +6832,8 @@ void case_524() }; } -void case_525() -#line 3756 "cs-parser.jay" +void case_526() +#line 3771 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; @@ -6812,8 +6842,8 @@ void case_525() }; } -void case_526() -#line 3764 "cs-parser.jay" +void case_527() +#line 3779 "cs-parser.jay" { var tne = (ATypeNameExpression) yyVals[-3+yyTop]; if (tne.HasTypeArguments) @@ -6825,8 +6855,8 @@ void case_526() }; } -void case_527() -#line 3778 "cs-parser.jay" +void case_528() +#line 3793 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[0+yyTop]), "generics"); @@ -6834,8 +6864,8 @@ void case_527() yyVal = yyVals[0+yyTop]; } -void case_528() -#line 3788 "cs-parser.jay" +void case_529() +#line 3803 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; if (lang_version == LanguageVersion.ISO_1) @@ -6844,36 +6874,36 @@ void case_528() yyVal = lt; } -void case_529() -#line 3799 "cs-parser.jay" +void case_530() +#line 3814 "cs-parser.jay" { yyVal = new SizeOf ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_530() -#line 3807 "cs-parser.jay" +void case_531() +#line 3822 "cs-parser.jay" { yyVal = new CheckedExpr ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_531() -#line 3815 "cs-parser.jay" +void case_532() +#line 3830 "cs-parser.jay" { yyVal = new UnCheckedExpr ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_532() -#line 3823 "cs-parser.jay" +void case_533() +#line 3838 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new MemberAccess (new Indirection ((Expression) yyVals[-3+yyTop], GetLocation (yyVals[-2+yyTop])), lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location); } -void case_534() -#line 3835 "cs-parser.jay" +void case_535() +#line 3850 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); if ((ParametersCompiled) yyVals[-2+yyTop] != ParametersCompiled.Undefined) { @@ -6883,8 +6913,8 @@ void case_534() } } -void case_536() -#line 3848 "cs-parser.jay" +void case_537() +#line 3863 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); @@ -6895,8 +6925,8 @@ void case_536() } } -void case_540() -#line 3873 "cs-parser.jay" +void case_541() +#line 3888 "cs-parser.jay" { valid_param_mod = 0; yyVal = yyVals[-1+yyTop]; @@ -6904,8 +6934,8 @@ void case_540() savedCloseLocation = GetLocation (yyVals[-2+yyTop]); } -void case_541() -#line 3883 "cs-parser.jay" +void case_542() +#line 3898 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-3+yyTop]), "default value expression"); @@ -6914,15 +6944,15 @@ void case_541() lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_545() -#line 3903 "cs-parser.jay" +void case_546() +#line 3918 "cs-parser.jay" { yyVal = new Cast ((FullNamedExpression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_546() -#line 3908 "cs-parser.jay" +void case_547() +#line 3923 "cs-parser.jay" { if (!async_block) { if (current_anonymous_method is LambdaExpression) { @@ -6942,227 +6972,235 @@ void case_546() yyVal = new Await ((Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } -void case_555() -#line 3963 "cs-parser.jay" +void case_556() +#line 3978 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.Multiply, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.Multiply, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_556() -#line 3968 "cs-parser.jay" +void case_557() +#line 3983 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.Division, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.Division, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_557() -#line 3973 "cs-parser.jay" +void case_558() +#line 3988 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.Modulus, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.Modulus, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_559() -#line 3982 "cs-parser.jay" +void case_560() +#line 3997 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.Addition, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.Addition, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_561() -#line 3991 "cs-parser.jay" +#line 4002 "cs-parser.jay" { - /* Shift/Reduce conflict*/ - yyVal = new Binary (Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); - } + yyVal = new Binary (Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); + } void case_565() -#line 4008 "cs-parser.jay" +#line 4019 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.LeftShift, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.LeftShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_566() -#line 4013 "cs-parser.jay" +#line 4024 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.RightShift, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.RightShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_568() -#line 4022 "cs-parser.jay" +#line 4033 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.LessThan, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.LessThan, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_569() -#line 4027 "cs-parser.jay" +#line 4038 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.GreaterThan, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.GreaterThan, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_570() -#line 4032 "cs-parser.jay" +#line 4043 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.LessThanOrEqual, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.LessThanOrEqual, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_571() -#line 4037 "cs-parser.jay" +#line 4048 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.GreaterThanOrEqual, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.GreaterThanOrEqual, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_573() -#line 4046 "cs-parser.jay" +#line 4057 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.Equality, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.Equality, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_574() -#line 4051 "cs-parser.jay" +#line 4062 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.Inequality, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.Inequality, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_576() -#line 4060 "cs-parser.jay" +#line 4071 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.BitwiseAnd, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.BitwiseAnd, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_578() -#line 4069 "cs-parser.jay" +#line 4080 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.ExclusiveOr, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.ExclusiveOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_580() -#line 4078 "cs-parser.jay" +#line 4089 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.BitwiseOr, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.BitwiseOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_582() -#line 4087 "cs-parser.jay" +#line 4098 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.LogicalAnd, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.LogicalAnd, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_584() -#line 4096 "cs-parser.jay" +#line 4107 "cs-parser.jay" { - yyVal = new Binary (Binary.Operator.LogicalOr, - (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Binary (Binary.Operator.LogicalOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_586() -#line 4105 "cs-parser.jay" +#line 4116 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-1+yyTop]), "null coalescing operator"); - yyVal = new Nullable.NullCoalescingOperator ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new Nullable.NullCoalescingOperator ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_588() -#line 4116 "cs-parser.jay" +#line 4128 "cs-parser.jay" { yyVal = new Conditional (new BooleanExpression ((Expression) yyVals[-4+yyTop]), (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_589() -#line 4121 "cs-parser.jay" +#line 4133 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new Conditional (new BooleanExpression ((Expression) yyVals[-3+yyTop]), (Expression) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop])); } +void case_590() +#line 4141 "cs-parser.jay" +{ + yyVal = new SimpleAssign ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); + } + void case_591() -#line 4133 "cs-parser.jay" +#line 4146 "cs-parser.jay" { - yyVal = new CompoundAssign ( - Binary.Operator.Multiply, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new CompoundAssign (Binary.Operator.Multiply, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_592() -#line 4138 "cs-parser.jay" +#line 4151 "cs-parser.jay" { - yyVal = new CompoundAssign ( - Binary.Operator.Division, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new CompoundAssign (Binary.Operator.Division, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_593() -#line 4143 "cs-parser.jay" +#line 4156 "cs-parser.jay" { - yyVal = new CompoundAssign ( - Binary.Operator.Modulus, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new CompoundAssign (Binary.Operator.Modulus, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_594() -#line 4148 "cs-parser.jay" +#line 4161 "cs-parser.jay" { - yyVal = new CompoundAssign ( - Binary.Operator.Addition, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new CompoundAssign (Binary.Operator.Addition, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_595() -#line 4153 "cs-parser.jay" +#line 4166 "cs-parser.jay" { - yyVal = new CompoundAssign ( - Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new CompoundAssign (Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_596() -#line 4158 "cs-parser.jay" +#line 4171 "cs-parser.jay" { - yyVal = new CompoundAssign ( - Binary.Operator.LeftShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new CompoundAssign (Binary.Operator.LeftShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_597() -#line 4163 "cs-parser.jay" +#line 4176 "cs-parser.jay" { - yyVal = new CompoundAssign ( - Binary.Operator.RightShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new CompoundAssign (Binary.Operator.RightShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_598() -#line 4168 "cs-parser.jay" +#line 4181 "cs-parser.jay" { - yyVal = new CompoundAssign ( - Binary.Operator.BitwiseAnd, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new CompoundAssign (Binary.Operator.BitwiseAnd, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_599() -#line 4173 "cs-parser.jay" +#line 4186 "cs-parser.jay" { - yyVal = new CompoundAssign ( - Binary.Operator.BitwiseOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new CompoundAssign (Binary.Operator.BitwiseOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_600() -#line 4178 "cs-parser.jay" +#line 4191 "cs-parser.jay" { - yyVal = new CompoundAssign ( - Binary.Operator.ExclusiveOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); + yyVal = new CompoundAssign (Binary.Operator.ExclusiveOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_601() -#line 4186 "cs-parser.jay" +#line 4199 "cs-parser.jay" { var pars = new List (4); pars.Add ((Parameter) yyVals[0+yyTop]); @@ -7171,7 +7209,7 @@ void case_601() } void case_602() -#line 4193 "cs-parser.jay" +#line 4206 "cs-parser.jay" { var pars = (List) yyVals[-2+yyTop]; Parameter p = (Parameter)yyVals[0+yyTop]; @@ -7186,7 +7224,7 @@ void case_602() } void case_603() -#line 4209 "cs-parser.jay" +#line 4222 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; @@ -7194,7 +7232,7 @@ void case_603() } void case_604() -#line 4215 "cs-parser.jay" +#line 4228 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; @@ -7202,14 +7240,14 @@ void case_604() } void case_605() -#line 4221 "cs-parser.jay" +#line 4234 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; yyVal = new ImplicitLambdaParameter (lt.Value, lt.Location); } void case_607() -#line 4229 "cs-parser.jay" +#line 4242 "cs-parser.jay" { var pars_list = (List) yyVals[0+yyTop]; yyVal = new ParametersCompiled (pars_list.ToArray ()); @@ -7217,7 +7255,7 @@ void case_607() } void case_611() -#line 4246 "cs-parser.jay" +#line 4259 "cs-parser.jay" { Block b = end_block (Location.Null); b.IsCompilerGenerated = true; @@ -7226,14 +7264,14 @@ void case_611() } void case_613() -#line 4257 "cs-parser.jay" +#line 4270 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = EmptyExpression.Null; } void case_614() -#line 4265 "cs-parser.jay" +#line 4278 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location); @@ -7241,14 +7279,14 @@ void case_614() } void case_615() -#line 4271 "cs-parser.jay" +#line 4284 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } void case_616() -#line 4276 "cs-parser.jay" +#line 4289 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location); @@ -7256,63 +7294,63 @@ void case_616() } void case_617() -#line 4282 "cs-parser.jay" +#line 4295 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop])); } void case_619() -#line 4291 "cs-parser.jay" +#line 4304 "cs-parser.jay" { valid_param_mod = 0; start_anonymous (true, (ParametersCompiled) yyVals[-2+yyTop], false, GetLocation (yyVals[-4+yyTop])); } void case_620() -#line 4296 "cs-parser.jay" +#line 4309 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-2+yyTop])); } void case_622() -#line 4305 "cs-parser.jay" +#line 4318 "cs-parser.jay" { valid_param_mod = 0; start_anonymous (true, (ParametersCompiled) yyVals[-2+yyTop], true, GetLocation (yyVals[-5+yyTop])); } void case_623() -#line 4310 "cs-parser.jay" +#line 4323 "cs-parser.jay" { yyVal = end_anonymous ((ParametersBlock) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-7+yyTop]), GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-2+yyTop])); } void case_630() -#line 4333 "cs-parser.jay" +#line 4346 "cs-parser.jay" { yyVal = new RefValueExpr ((Expression) yyVals[-3+yyTop], (FullNamedExpression) yyVals[-1+yyTop], GetLocation (yyVals[-5+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_631() -#line 4338 "cs-parser.jay" +#line 4351 "cs-parser.jay" { yyVal = new RefTypeExpr ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_632() -#line 4343 "cs-parser.jay" +#line 4356 "cs-parser.jay" { yyVal = new MakeRefExpr ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_636() -#line 4372 "cs-parser.jay" +#line 4385 "cs-parser.jay" { Class c = new Class (current_container, (MemberName) yyVals[0+yyTop], (Modifiers) yyVals[-4+yyTop], (Attributes) yyVals[-5+yyTop]); if (((c.ModFlags & Modifiers.STATIC) != 0) && lang_version == LanguageVersion.ISO_1) { @@ -7324,7 +7362,7 @@ void case_636() } void case_637() -#line 4383 "cs-parser.jay" +#line 4396 "cs-parser.jay" { lexer.ConstraintsParsing = false; @@ -7340,7 +7378,7 @@ void case_637() } void case_638() -#line 4397 "cs-parser.jay" +#line 4410 "cs-parser.jay" { --lexer.parsing_declaration; if (doc_support) @@ -7348,7 +7386,7 @@ void case_638() } void case_639() -#line 4403 "cs-parser.jay" +#line 4416 "cs-parser.jay" { if (yyVals[0+yyTop] == null) { lbag.AppendToMember (current_container, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop])); @@ -7359,7 +7397,7 @@ void case_639() } void case_642() -#line 4422 "cs-parser.jay" +#line 4435 "cs-parser.jay" { mod_locations = null; yyVal = ModifierNone; @@ -7367,7 +7405,7 @@ void case_642() } void case_645() -#line 4436 "cs-parser.jay" +#line 4449 "cs-parser.jay" { var m1 = (Modifiers) yyVals[-1+yyTop]; var m2 = (Modifiers) yyVals[0+yyTop]; @@ -7385,7 +7423,7 @@ void case_645() } void case_646() -#line 4455 "cs-parser.jay" +#line 4468 "cs-parser.jay" { yyVal = Modifiers.NEW; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); @@ -7395,91 +7433,91 @@ void case_646() } void case_647() -#line 4463 "cs-parser.jay" +#line 4476 "cs-parser.jay" { yyVal = Modifiers.PUBLIC; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_648() -#line 4468 "cs-parser.jay" +#line 4481 "cs-parser.jay" { yyVal = Modifiers.PROTECTED; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_649() -#line 4473 "cs-parser.jay" +#line 4486 "cs-parser.jay" { yyVal = Modifiers.INTERNAL; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_650() -#line 4478 "cs-parser.jay" +#line 4491 "cs-parser.jay" { yyVal = Modifiers.PRIVATE; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_651() -#line 4483 "cs-parser.jay" +#line 4496 "cs-parser.jay" { yyVal = Modifiers.ABSTRACT; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_652() -#line 4488 "cs-parser.jay" +#line 4501 "cs-parser.jay" { yyVal = Modifiers.SEALED; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_653() -#line 4493 "cs-parser.jay" +#line 4506 "cs-parser.jay" { yyVal = Modifiers.STATIC; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_654() -#line 4498 "cs-parser.jay" +#line 4511 "cs-parser.jay" { yyVal = Modifiers.READONLY; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_655() -#line 4503 "cs-parser.jay" +#line 4516 "cs-parser.jay" { yyVal = Modifiers.VIRTUAL; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_656() -#line 4508 "cs-parser.jay" +#line 4521 "cs-parser.jay" { yyVal = Modifiers.OVERRIDE; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_657() -#line 4513 "cs-parser.jay" +#line 4526 "cs-parser.jay" { yyVal = Modifiers.EXTERN; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_658() -#line 4518 "cs-parser.jay" +#line 4531 "cs-parser.jay" { yyVal = Modifiers.VOLATILE; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_659() -#line 4523 "cs-parser.jay" +#line 4536 "cs-parser.jay" { yyVal = Modifiers.UNSAFE; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); @@ -7488,21 +7526,21 @@ void case_659() } void case_660() -#line 4530 "cs-parser.jay" +#line 4543 "cs-parser.jay" { yyVal = Modifiers.ASYNC; StoreModifierLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_662() -#line 4539 "cs-parser.jay" +#line 4552 "cs-parser.jay" { current_type.AddBasesForPart ((List) yyVals[0+yyTop]); lbag.AppendToMember (current_type, GetLocation (yyVals[-1+yyTop])); } void case_663() -#line 4544 "cs-parser.jay" +#line 4557 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7510,7 +7548,7 @@ void case_663() } void case_666() -#line 4561 "cs-parser.jay" +#line 4574 "cs-parser.jay" { var constraints = new List (1); constraints.Add ((Constraints) yyVals[0+yyTop]); @@ -7518,7 +7556,7 @@ void case_666() } void case_667() -#line 4567 "cs-parser.jay" +#line 4580 "cs-parser.jay" { var constraints = (List) yyVals[-1+yyTop]; Constraints new_constraint = (Constraints)yyVals[0+yyTop]; @@ -7536,7 +7574,7 @@ void case_667() } void case_668() -#line 4586 "cs-parser.jay" +#line 4599 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; yyVal = new Constraints (new SimpleMemberName (lt.Value, lt.Location), (List) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop])); @@ -7544,7 +7582,7 @@ void case_668() } void case_669() -#line 4592 "cs-parser.jay" +#line 4605 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -7553,7 +7591,7 @@ void case_669() } void case_670() -#line 4602 "cs-parser.jay" +#line 4615 "cs-parser.jay" { var constraints = new List (1); constraints.Add ((FullNamedExpression) yyVals[0+yyTop]); @@ -7561,7 +7599,7 @@ void case_670() } void case_671() -#line 4608 "cs-parser.jay" +#line 4621 "cs-parser.jay" { var constraints = (List) yyVals[-2+yyTop]; var prev = constraints [constraints.Count - 1] as SpecialContraintExpr; @@ -7587,7 +7625,7 @@ void case_671() } void case_672() -#line 4635 "cs-parser.jay" +#line 4648 "cs-parser.jay" { if (yyVals[0+yyTop] is ComposedCast) report.Error (706, GetLocation (yyVals[0+yyTop]), "Invalid constraint type `{0}'", ((ComposedCast)yyVals[0+yyTop]).GetSignatureForError ()); @@ -7596,14 +7634,14 @@ void case_672() } void case_673() -#line 4642 "cs-parser.jay" +#line 4655 "cs-parser.jay" { yyVal = new SpecialContraintExpr (SpecialConstraint.Constructor, GetLocation (yyVals[-2+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_677() -#line 4662 "cs-parser.jay" +#line 4675 "cs-parser.jay" { if (lang_version <= LanguageVersion.V_3) FeatureIsNotAvailable (lexer.Location, "generic type variance"); @@ -7612,56 +7650,56 @@ void case_677() } void case_678() -#line 4672 "cs-parser.jay" +#line 4685 "cs-parser.jay" { yyVal = Variance.Covariant; savedLocation = GetLocation (yyVals[0+yyTop]); } void case_679() -#line 4677 "cs-parser.jay" +#line 4690 "cs-parser.jay" { yyVal = Variance.Contravariant; savedLocation = GetLocation (yyVals[0+yyTop]); } void case_680() -#line 4698 "cs-parser.jay" +#line 4711 "cs-parser.jay" { ++lexer.parsing_block; start_block (GetLocation (yyVals[0+yyTop])); } void case_682() -#line 4710 "cs-parser.jay" +#line 4723 "cs-parser.jay" { --lexer.parsing_block; yyVal = end_block (GetLocation (yyVals[0+yyTop])); } void case_683() -#line 4715 "cs-parser.jay" +#line 4728 "cs-parser.jay" { --lexer.parsing_block; yyVal = end_block (lexer.Location); } void case_684() -#line 4724 "cs-parser.jay" +#line 4737 "cs-parser.jay" { ++lexer.parsing_block; current_block.StartLocation = GetLocation (yyVals[0+yyTop]); } void case_685() -#line 4729 "cs-parser.jay" +#line 4742 "cs-parser.jay" { --lexer.parsing_block; yyVal = end_block (GetLocation (yyVals[0+yyTop])); } void case_686() -#line 4733 "cs-parser.jay" +#line 4746 "cs-parser.jay" { report.Error (1525, GetLocation (yyVals[0+yyTop]), "Unexpected symbol '}', expected '{'"); lexer.putback ('}'); @@ -7669,7 +7707,7 @@ void case_686() } void case_694() -#line 4762 "cs-parser.jay" +#line 4775 "cs-parser.jay" { Error_SyntaxError (yyToken); var lt =(Tokenizer.LocatedToken) yyVals[-1+yyTop]; @@ -7679,42 +7717,42 @@ void case_694() } void case_695() -#line 4771 "cs-parser.jay" +#line 4784 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = null; } void case_728() -#line 4835 "cs-parser.jay" +#line 4848 "cs-parser.jay" { report.Error (1023, GetLocation (yyVals[0+yyTop]), "An embedded statement may not be a declaration or labeled statement"); yyVal = null; } void case_729() -#line 4840 "cs-parser.jay" +#line 4853 "cs-parser.jay" { report.Error (1023, GetLocation (yyVals[0+yyTop]), "An embedded statement may not be a declaration or labeled statement"); yyVal = null; } void case_730() -#line 4845 "cs-parser.jay" +#line 4858 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new EmptyStatement (GetLocation (yyVals[0+yyTop])); } void case_731() -#line 4853 "cs-parser.jay" +#line 4866 "cs-parser.jay" { /* Uses lexer.Location because semicolon location is not kept in quick mode*/ yyVal = new EmptyStatement (lexer.Location); } void case_732() -#line 4861 "cs-parser.jay" +#line 4874 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; LabeledStatement labeled = new LabeledStatement (lt.Value, current_block, lt.Location); @@ -7724,7 +7762,7 @@ void case_732() } void case_735() -#line 4874 "cs-parser.jay" +#line 4887 "cs-parser.jay" { if (yyVals[-1+yyTop] is VarExpr) yyVals[-1+yyTop] = new SimpleName ("var", ((VarExpr) yyVals[-1+yyTop]).Location); @@ -7733,7 +7771,7 @@ void case_735() } void case_736() -#line 4890 "cs-parser.jay" +#line 4903 "cs-parser.jay" { /* Ok, the above "primary_expression" is there to get rid of*/ /* both reduce/reduce and shift/reduces in the grammar, it should*/ @@ -7765,7 +7803,7 @@ void case_736() } void case_737() -#line 4920 "cs-parser.jay" +#line 4933 "cs-parser.jay" { ATypeNameExpression expr = yyVals[-1+yyTop] as ATypeNameExpression; @@ -7778,7 +7816,7 @@ void case_737() } void case_738() -#line 4931 "cs-parser.jay" +#line 4944 "cs-parser.jay" { if (yyVals[0+yyTop] == null) yyVal = yyVals[-1+yyTop]; @@ -7787,30 +7825,30 @@ void case_738() } void case_741() -#line 4946 "cs-parser.jay" +#line 4959 "cs-parser.jay" { Expression.Error_VoidInvalidInTheContext (GetLocation (yyVals[0+yyTop]), report); yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); } void case_743() -#line 4955 "cs-parser.jay" +#line 4968 "cs-parser.jay" { ((ComposedTypeSpecifier) yyVals[-1+yyTop]).Next = (ComposedTypeSpecifier) yyVals[0+yyTop]; yyVal = yyVals[-1+yyTop]; } void case_746() -#line 4971 "cs-parser.jay" +#line 4984 "cs-parser.jay" { if (async_block) { report.Error (4003, GetLocation (yyVals[0+yyTop]), "`await' cannot be used as an identifier within an async method or lambda expression"); - yyVal = Tokenizer.LocatedToken.Create ("await", GetLocation (yyVals[0+yyTop])); + yyVal = new Tokenizer.LocatedToken ("await", GetLocation (yyVals[0+yyTop])); } } void case_747() -#line 4981 "cs-parser.jay" +#line 4994 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; var li = new LocalVariable (current_block, lt.Value, lt.Location); @@ -7819,7 +7857,7 @@ void case_747() } void case_748() -#line 4988 "cs-parser.jay" +#line 5001 "cs-parser.jay" { yyVal = current_variable; current_variable = null; @@ -7827,7 +7865,7 @@ void case_748() } void case_749() -#line 4994 "cs-parser.jay" +#line 5007 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.Constant, lt.Location); @@ -7836,7 +7874,7 @@ void case_749() } void case_750() -#line 5001 "cs-parser.jay" +#line 5014 "cs-parser.jay" { if (current_variable.Initializer != null) { lbag.AddLocation (current_variable, GetLocation (yyVals[-6+yyTop]), savedLocation, GetLocation (yyVals[0+yyTop])); @@ -7848,7 +7886,7 @@ void case_750() } void case_752() -#line 5014 "cs-parser.jay" +#line 5027 "cs-parser.jay" { /* Redundant, but wont regress*/ report.Error (1525, lexer.Location, "Unexpected symbol }"); @@ -7857,14 +7895,14 @@ void case_752() } void case_754() -#line 5025 "cs-parser.jay" +#line 5038 "cs-parser.jay" { current_variable.Initializer = (Expression) yyVals[0+yyTop]; lbag.AppendTo (current_variable, GetLocation (yyVals[-1+yyTop])); } void case_755() -#line 5030 "cs-parser.jay" +#line 5043 "cs-parser.jay" { if (yyToken == Token.OPEN_BRACKET_EXPR) { report.Error (650, lexer.Location, @@ -7880,7 +7918,7 @@ void case_755() } void case_756() -#line 5044 "cs-parser.jay" +#line 5057 "cs-parser.jay" { if (yyToken == Token.OPEN_BRACKET_EXPR) { report.Error (650, lexer.Location, @@ -7891,7 +7929,7 @@ void case_756() } void case_760() -#line 5062 "cs-parser.jay" +#line 5075 "cs-parser.jay" { foreach (var d in current_variable.Declarators) { if (d.Initializer == null) @@ -7900,7 +7938,7 @@ void case_760() } void case_763() -#line 5077 "cs-parser.jay" +#line 5090 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; var li = new LocalVariable (current_variable.Variable, lt.Value, lt.Location); @@ -7911,7 +7949,7 @@ void case_763() } void case_764() -#line 5086 "cs-parser.jay" +#line 5099 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; var li = new LocalVariable (current_variable.Variable, lt.Value, lt.Location); @@ -7922,14 +7960,14 @@ void case_764() } void case_766() -#line 5102 "cs-parser.jay" +#line 5115 "cs-parser.jay" { savedLocation = GetLocation (yyVals[-1+yyTop]); current_variable.Initializer = (Expression) yyVals[0+yyTop]; } void case_771() -#line 5120 "cs-parser.jay" +#line 5133 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.Constant, lt.Location); @@ -7940,28 +7978,28 @@ void case_771() } void case_773() -#line 5133 "cs-parser.jay" +#line 5146 "cs-parser.jay" { yyVal = new StackAlloc ((Expression) yyVals[-3+yyTop], (Expression) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_774() -#line 5138 "cs-parser.jay" +#line 5151 "cs-parser.jay" { report.Error (1575, GetLocation (yyVals[-1+yyTop]), "A stackalloc expression requires [] after type"); yyVal = new StackAlloc ((Expression) yyVals[0+yyTop], null, GetLocation (yyVals[-1+yyTop])); } void case_775() -#line 5146 "cs-parser.jay" +#line 5159 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop])); } void case_777() -#line 5152 "cs-parser.jay" +#line 5165 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; report.Error (1002, GetLocation (yyVals[0+yyTop]), "; expected"); @@ -7969,7 +8007,7 @@ void case_777() } void case_780() -#line 5170 "cs-parser.jay" +#line 5183 "cs-parser.jay" { ExpressionStatement s = yyVals[0+yyTop] as ExpressionStatement; if (s == null) { @@ -7981,7 +8019,7 @@ void case_780() } void case_781() -#line 5183 "cs-parser.jay" +#line 5196 "cs-parser.jay" { Expression expr = (Expression) yyVals[0+yyTop]; ExpressionStatement s; @@ -7991,14 +8029,14 @@ void case_781() } void case_782() -#line 5191 "cs-parser.jay" +#line 5204 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new EmptyStatement (GetLocation (yyVals[0+yyTop])); } void case_785() -#line 5205 "cs-parser.jay" +#line 5218 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8008,7 +8046,7 @@ void case_785() } void case_786() -#line 5214 "cs-parser.jay" +#line 5227 "cs-parser.jay" { yyVal = new If ((BooleanExpression) yyVals[-4+yyTop], (Statement) yyVals[-2+yyTop], (Statement) yyVals[0+yyTop], GetLocation (yyVals[-6+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop])); @@ -8020,7 +8058,7 @@ void case_786() } void case_787() -#line 5224 "cs-parser.jay" +#line 5237 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8029,7 +8067,7 @@ void case_787() } void case_789() -#line 5238 "cs-parser.jay" +#line 5251 "cs-parser.jay" { yyVal = new Switch ((Expression) yyVals[-5+yyTop], (ExplicitBlock) current_block.Explicit, (List) yyVals[-1+yyTop], GetLocation (yyVals[-7+yyTop])); end_block (GetLocation (yyVals[0+yyTop])); @@ -8037,7 +8075,7 @@ void case_789() } void case_790() -#line 5244 "cs-parser.jay" +#line 5257 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8046,14 +8084,14 @@ void case_790() } void case_791() -#line 5254 "cs-parser.jay" +#line 5267 "cs-parser.jay" { report.Warning (1522, 1, current_block.StartLocation, "Empty switch block"); yyVal = new List (); } void case_793() -#line 5263 "cs-parser.jay" +#line 5276 "cs-parser.jay" { var sections = new List (4); @@ -8062,7 +8100,7 @@ void case_793() } void case_794() -#line 5270 "cs-parser.jay" +#line 5283 "cs-parser.jay" { var sections = (List) yyVals[-1+yyTop]; @@ -8071,14 +8109,14 @@ void case_794() } void case_795() -#line 5277 "cs-parser.jay" +#line 5290 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new List (); } void case_798() -#line 5296 "cs-parser.jay" +#line 5309 "cs-parser.jay" { var labels = new List (2); @@ -8087,7 +8125,7 @@ void case_798() } void case_799() -#line 5303 "cs-parser.jay" +#line 5316 "cs-parser.jay" { var labels = (List) (yyVals[-1+yyTop]); labels.Add ((SwitchLabel) yyVals[0+yyTop]); @@ -8096,21 +8134,21 @@ void case_799() } void case_800() -#line 5313 "cs-parser.jay" +#line 5326 "cs-parser.jay" { yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } void case_801() -#line 5318 "cs-parser.jay" +#line 5331 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); } void case_807() -#line 5337 "cs-parser.jay" +#line 5350 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8120,7 +8158,7 @@ void case_807() } void case_808() -#line 5345 "cs-parser.jay" +#line 5358 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8129,30 +8167,30 @@ void case_808() } void case_809() -#line 5355 "cs-parser.jay" +#line 5368 "cs-parser.jay" { - yyVal = new Do ((Statement) yyVals[-5+yyTop], (BooleanExpression) yyVals[-2+yyTop], GetLocation (yyVals[-6+yyTop])); + yyVal = new Do ((Statement) yyVals[-5+yyTop], (BooleanExpression) yyVals[-2+yyTop], GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[-4+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_810() -#line 5360 "cs-parser.jay" +#line 5373 "cs-parser.jay" { Error_SyntaxError (yyToken); - yyVal = new Do ((Statement) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop])); + yyVal = new Do ((Statement) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop]), Location.Null); } void case_811() -#line 5365 "cs-parser.jay" +#line 5378 "cs-parser.jay" { Error_SyntaxError (yyToken); - yyVal = new Do ((Statement) yyVals[-4+yyTop], (BooleanExpression) yyVals[-1+yyTop], GetLocation (yyVals[-5+yyTop])); + yyVal = new Do ((Statement) yyVals[-4+yyTop], (BooleanExpression) yyVals[-1+yyTop], GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-3+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-2+yyTop])); } void case_812() -#line 5375 "cs-parser.jay" +#line 5388 "cs-parser.jay" { start_block (GetLocation (yyVals[0+yyTop])); current_block.IsCompilerGenerated = true; @@ -8163,7 +8201,7 @@ void case_812() } void case_814() -#line 5392 "cs-parser.jay" +#line 5405 "cs-parser.jay" { For f = (For) yyVals[-2+yyTop]; f.Initializer = (Statement) yyVals[-1+yyTop]; @@ -8172,7 +8210,7 @@ void case_814() } void case_816() -#line 5402 "cs-parser.jay" +#line 5415 "cs-parser.jay" { report.Error (1525, GetLocation (yyVals[0+yyTop]), "Unexpected symbol ')', expected ';'"); For f = (For) yyVals[-2+yyTop]; @@ -8182,7 +8220,7 @@ void case_816() } void case_817() -#line 5413 "cs-parser.jay" +#line 5426 "cs-parser.jay" { For f = (For) yyVals[-2+yyTop]; f.Condition = (BooleanExpression) yyVals[-1+yyTop]; @@ -8191,7 +8229,7 @@ void case_817() } void case_819() -#line 5424 "cs-parser.jay" +#line 5437 "cs-parser.jay" { report.Error (1525, GetLocation (yyVals[0+yyTop]), "Unexpected symbol ')', expected ';'"); For f = (For) yyVals[-2+yyTop]; @@ -8201,7 +8239,7 @@ void case_819() } void case_820() -#line 5436 "cs-parser.jay" +#line 5449 "cs-parser.jay" { For f = (For) yyVals[-3+yyTop]; f.Iterator = (Statement) yyVals[-2+yyTop]; @@ -8216,14 +8254,14 @@ void case_820() } void case_821() -#line 5449 "cs-parser.jay" +#line 5462 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = end_block (current_block.StartLocation); } void case_824() -#line 5462 "cs-parser.jay" +#line 5475 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; var li = new LocalVariable (current_block, lt.Value, lt.Location); @@ -8232,14 +8270,14 @@ void case_824() } void case_825() -#line 5469 "cs-parser.jay" +#line 5482 "cs-parser.jay" { yyVal = current_variable; current_variable = null; } void case_833() -#line 5493 "cs-parser.jay" +#line 5506 "cs-parser.jay" { var sl = yyVals[-2+yyTop] as StatementList; if (sl == null) { @@ -8255,7 +8293,7 @@ void case_833() } void case_834() -#line 5510 "cs-parser.jay" +#line 5523 "cs-parser.jay" { report.Error (230, GetLocation (yyVals[-3+yyTop]), "Type and identifier are both required in a foreach statement"); @@ -8270,7 +8308,7 @@ void case_834() } void case_835() -#line 5523 "cs-parser.jay" +#line 5536 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8289,7 +8327,7 @@ void case_835() } void case_836() -#line 5540 "cs-parser.jay" +#line 5553 "cs-parser.jay" { start_block (GetLocation (yyVals[-5+yyTop])); current_block.IsCompilerGenerated = true; @@ -8300,7 +8338,7 @@ void case_836() } void case_837() -#line 5549 "cs-parser.jay" +#line 5562 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8313,7 +8351,7 @@ void case_837() } void case_838() -#line 5560 "cs-parser.jay" +#line 5573 "cs-parser.jay" { start_block (GetLocation (yyVals[-3+yyTop])); current_block.IsCompilerGenerated = true; @@ -8328,7 +8366,7 @@ void case_838() } void case_839() -#line 5573 "cs-parser.jay" +#line 5586 "cs-parser.jay" { Foreach f = new Foreach ((Expression) yyVals[-1+yyTop], null, null, null, null, GetLocation (yyVals[-3+yyTop])); current_block.AddStatement (f); @@ -8338,28 +8376,28 @@ void case_839() } void case_846() -#line 5593 "cs-parser.jay" +#line 5606 "cs-parser.jay" { yyVal = new Break (GetLocation (yyVals[-1+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop])); } void case_847() -#line 5601 "cs-parser.jay" +#line 5614 "cs-parser.jay" { yyVal = new Continue (GetLocation (yyVals[-1+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop])); } void case_848() -#line 5606 "cs-parser.jay" +#line 5619 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new Continue (GetLocation (yyVals[-1+yyTop])); } void case_849() -#line 5614 "cs-parser.jay" +#line 5627 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop]; yyVal = new Goto (lt.Value, GetLocation (yyVals[-2+yyTop])); @@ -8367,49 +8405,56 @@ void case_849() } void case_850() -#line 5620 "cs-parser.jay" +#line 5633 "cs-parser.jay" { yyVal = new GotoCase ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_851() -#line 5625 "cs-parser.jay" +#line 5638 "cs-parser.jay" { yyVal = new GotoDefault (GetLocation (yyVals[-2+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_852() -#line 5633 "cs-parser.jay" +#line 5646 "cs-parser.jay" { yyVal = new Return ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop])); } void case_853() -#line 5638 "cs-parser.jay" +#line 5651 "cs-parser.jay" { Error_SyntaxError (yyToken); - yyVal = new Return (null, GetLocation (yyVals[-1+yyTop])); + yyVal = new Return ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); } void case_854() -#line 5646 "cs-parser.jay" +#line 5656 "cs-parser.jay" +{ + Error_SyntaxError (yyToken); + yyVal = new Return (null, GetLocation (yyVals[-1+yyTop])); + } + +void case_855() +#line 5664 "cs-parser.jay" { yyVal = new Throw ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_855() -#line 5651 "cs-parser.jay" +void case_856() +#line 5669 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new Throw (null, GetLocation (yyVals[-1+yyTop])); } -void case_856() -#line 5659 "cs-parser.jay" +void case_857() +#line 5677 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; string s = lt.Value; @@ -8426,8 +8471,28 @@ void case_856() lbag.AddStatement (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_857() -#line 5675 "cs-parser.jay" +void case_858() +#line 5693 "cs-parser.jay" +{ + Error_SyntaxError (yyToken); + + var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; + string s = lt.Value; + if (s != "yield"){ + report.Error (1003, lt.Location, "; expected"); + } else if (yyVals[-1+yyTop] == null) { + report.Error (1627, GetLocation (yyVals[0+yyTop]), "Expression expected after yield return"); + } else if (lang_version == LanguageVersion.ISO_1){ + FeatureIsNotAvailable (lt.Location, "iterators"); + } + + current_block.Explicit.RegisterIteratorYield (); + yyVal = new Yield ((Expression) yyVals[-1+yyTop], lt.Location); + lbag.AddStatement (yyVal, GetLocation (yyVals[-2+yyTop])); + } + +void case_859() +#line 5711 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; string s = lt.Value; @@ -8442,30 +8507,30 @@ void case_857() lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop])); } -void case_861() -#line 5701 "cs-parser.jay" +void case_863() +#line 5737 "cs-parser.jay" { yyVal = new TryFinally ((Statement) yyVals[-2+yyTop], (Block) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop])); lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_862() -#line 5706 "cs-parser.jay" +void case_864() +#line 5742 "cs-parser.jay" { var loc = GetLocation (yyVals[-4+yyTop]); yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List) yyVals[-2+yyTop], loc, true), (Block) yyVals[0+yyTop], loc); lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop])); } -void case_863() -#line 5712 "cs-parser.jay" +void case_865() +#line 5748 "cs-parser.jay" { Error_SyntaxError (1524, yyToken); yyVal = new TryCatch ((Block) yyVals[-1+yyTop], null, GetLocation (yyVals[-2+yyTop]), false); } -void case_864() -#line 5720 "cs-parser.jay" +void case_866() +#line 5756 "cs-parser.jay" { var l = new List (2); @@ -8473,8 +8538,8 @@ void case_864() yyVal = l; } -void case_865() -#line 5727 "cs-parser.jay" +void case_867() +#line 5763 "cs-parser.jay" { var l = (List) yyVals[-1+yyTop]; @@ -8487,8 +8552,8 @@ void case_865() yyVal = l; } -void case_869() -#line 5751 "cs-parser.jay" +void case_871() +#line 5787 "cs-parser.jay" { start_block (GetLocation (yyVals[-3+yyTop])); var c = new Catch (current_block, GetLocation (yyVals[-4+yyTop])); @@ -8504,8 +8569,8 @@ void case_869() yyVal = c; } -void case_871() -#line 5770 "cs-parser.jay" +void case_873() +#line 5806 "cs-parser.jay" { if (yyToken == Token.CLOSE_PARENS) { report.Error (1015, lexer.Location, @@ -8517,15 +8582,15 @@ void case_871() yyVal = new Catch (null, GetLocation (yyVals[-2+yyTop])); } -void case_874() -#line 5798 "cs-parser.jay" +void case_876() +#line 5834 "cs-parser.jay" { if (!settings.Unsafe) Error_UnsafeCodeNotAllowed (GetLocation (yyVals[0+yyTop])); } -void case_876() -#line 5808 "cs-parser.jay" +void case_878() +#line 5844 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8534,8 +8599,8 @@ void case_876() lbag.AddStatement (yyVal, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop])); } -void case_877() -#line 5816 "cs-parser.jay" +void case_879() +#line 5852 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8543,8 +8608,8 @@ void case_877() lbag.AddStatement (yyVal, GetLocation (yyVals[-2+yyTop])); } -void case_878() -#line 5826 "cs-parser.jay" +void case_880() +#line 5862 "cs-parser.jay" { start_block (GetLocation (yyVals[-2+yyTop])); @@ -8555,15 +8620,15 @@ void case_878() current_variable = new Fixed.VariableDeclaration ((FullNamedExpression) yyVals[-1+yyTop], li); } -void case_879() -#line 5836 "cs-parser.jay" +void case_881() +#line 5872 "cs-parser.jay" { yyVal = current_variable; current_variable = null; } -void case_880() -#line 5841 "cs-parser.jay" +void case_882() +#line 5877 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8574,8 +8639,8 @@ void case_880() yyVal = end_block (GetLocation (yyVals[-2+yyTop])); } -void case_881() -#line 5854 "cs-parser.jay" +void case_883() +#line 5890 "cs-parser.jay" { start_block (GetLocation (yyVals[-2+yyTop])); @@ -8586,15 +8651,15 @@ void case_881() current_variable = new Using.VariableDeclaration ((FullNamedExpression) yyVals[-1+yyTop], li); } -void case_882() -#line 5864 "cs-parser.jay" +void case_884() +#line 5900 "cs-parser.jay" { yyVal = current_variable; current_variable = null; } -void case_883() -#line 5869 "cs-parser.jay" +void case_885() +#line 5905 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8605,8 +8670,8 @@ void case_883() yyVal = end_block (GetLocation (yyVals[-2+yyTop])); } -void case_884() -#line 5879 "cs-parser.jay" +void case_886() +#line 5915 "cs-parser.jay" { if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE) Warning_EmptyStatement (GetLocation (yyVals[0+yyTop])); @@ -8615,8 +8680,8 @@ void case_884() lbag.AddStatement (yyVal, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop])); } -void case_885() -#line 5887 "cs-parser.jay" +void case_887() +#line 5923 "cs-parser.jay" { Error_SyntaxError (yyToken); @@ -8624,23 +8689,23 @@ void case_885() lbag.AddStatement (yyVal, GetLocation (yyVals[-2+yyTop])); } -void case_887() -#line 5898 "cs-parser.jay" +void case_889() +#line 5934 "cs-parser.jay" { /* It has to be here for the parent to safely restore artificial block*/ Error_SyntaxError (yyToken); } -void case_889() -#line 5910 "cs-parser.jay" +void case_891() +#line 5946 "cs-parser.jay" { current_variable.Initializer = (Expression) yyVals[0+yyTop]; lbag.AppendTo (current_variable, GetLocation (yyVals[-1+yyTop])); yyVal = current_variable; } -void case_890() -#line 5922 "cs-parser.jay" +void case_892() +#line 5958 "cs-parser.jay" { lexer.query_parsing = false; @@ -8653,8 +8718,8 @@ void case_890() current_block = current_block.Parent; } -void case_891() -#line 5934 "cs-parser.jay" +void case_893() +#line 5970 "cs-parser.jay" { Linq.AQueryClause from = yyVals[-1+yyTop] as Linq.AQueryClause; @@ -8665,8 +8730,8 @@ void case_891() current_block = current_block.Parent; } -void case_892() -#line 5945 "cs-parser.jay" +void case_894() +#line 5981 "cs-parser.jay" { lexer.query_parsing = false; yyVal = yyVals[-1+yyTop]; @@ -8675,16 +8740,16 @@ void case_892() current_block = current_block.Parent; } -void case_893() -#line 5952 "cs-parser.jay" +void case_895() +#line 5988 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; } -void case_894() -#line 5961 "cs-parser.jay" +void case_896() +#line 5997 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); @@ -8695,8 +8760,8 @@ void case_894() yyVal = new Linq.QueryExpression (start); } -void case_895() -#line 5971 "cs-parser.jay" +void case_897() +#line 6007 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); @@ -8709,8 +8774,8 @@ void case_895() yyVal = new Linq.QueryExpression (start); } -void case_896() -#line 5986 "cs-parser.jay" +void case_898() +#line 6022 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); @@ -8721,8 +8786,8 @@ void case_896() yyVal = new Linq.QueryExpression (start); } -void case_897() -#line 5996 "cs-parser.jay" +void case_899() +#line 6032 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); @@ -8735,8 +8800,8 @@ void case_897() yyVal = new Linq.QueryExpression (start); } -void case_899() -#line 6015 "cs-parser.jay" +void case_901() +#line 6051 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; var sn = new Linq.RangeVariable (lt.Value, lt.Location); @@ -8749,8 +8814,8 @@ void case_899() lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } -void case_901() -#line 6031 "cs-parser.jay" +void case_903() +#line 6067 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; var sn = new Linq.RangeVariable (lt.Value, lt.Location); @@ -8767,8 +8832,8 @@ void case_901() lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop])); } -void case_902() -#line 6050 "cs-parser.jay" +void case_904() +#line 6086 "cs-parser.jay" { Linq.AQueryClause head = (Linq.AQueryClause)yyVals[-1+yyTop]; @@ -8784,8 +8849,8 @@ void case_902() yyVal = head; } -void case_903() -#line 6065 "cs-parser.jay" +void case_905() +#line 6101 "cs-parser.jay" { Linq.AQueryClause head = (Linq.AQueryClause)yyVals[0+yyTop]; @@ -8798,22 +8863,22 @@ void case_903() yyVal = head; } -void case_905() -#line 6078 "cs-parser.jay" +void case_907() +#line 6114 "cs-parser.jay" { report.Error (742, GetLocation (yyVals[0+yyTop]), "Unexpected symbol `{0}'. A query body must end with select or group clause", GetSymbolName (yyToken)); yyVal = yyVals[-1+yyTop]; } -void case_906() -#line 6083 "cs-parser.jay" +void case_908() +#line 6119 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = null; } -void case_908() -#line 6095 "cs-parser.jay" +void case_910() +#line 6131 "cs-parser.jay" { yyVal = new Linq.Select ((Linq.QueryBlock)current_block, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); @@ -8821,8 +8886,8 @@ void case_908() current_block = current_block.Parent; } -void case_909() -#line 6102 "cs-parser.jay" +void case_911() +#line 6138 "cs-parser.jay" { if (linq_clause_blocks == null) linq_clause_blocks = new Stack (); @@ -8831,8 +8896,8 @@ void case_909() linq_clause_blocks.Push ((Linq.QueryBlock)current_block); } -void case_910() -#line 6110 "cs-parser.jay" +void case_912() +#line 6146 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -8840,8 +8905,8 @@ void case_910() current_block = new Linq.QueryBlock (current_block, lexer.Location); } -void case_911() -#line 6117 "cs-parser.jay" +void case_913() +#line 6153 "cs-parser.jay" { yyVal = new Linq.GroupBy ((Linq.QueryBlock)current_block, (Expression)yyVals[-3+yyTop], linq_clause_blocks.Pop (), (Expression)yyVals[0+yyTop], GetLocation (yyVals[-5+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); @@ -8850,15 +8915,15 @@ void case_911() current_block = current_block.Parent; } -void case_913() -#line 6129 "cs-parser.jay" +void case_915() +#line 6165 "cs-parser.jay" { ((Linq.AQueryClause)yyVals[-1+yyTop]).Tail.Next = (Linq.AQueryClause)yyVals[0+yyTop]; yyVal = yyVals[-1+yyTop]; } -void case_920() -#line 6149 "cs-parser.jay" +void case_922() +#line 6185 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; var sn = new Linq.RangeVariable (lt.Value, lt.Location); @@ -8871,8 +8936,8 @@ void case_920() ((Linq.QueryBlock)current_block).AddRangeVariable (sn); } -void case_922() -#line 6168 "cs-parser.jay" +void case_924() +#line 6204 "cs-parser.jay" { yyVal = new Linq.Where ((Linq.QueryBlock)current_block, (Expression)yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); @@ -8880,8 +8945,8 @@ void case_922() current_block = current_block.Parent; } -void case_923() -#line 6178 "cs-parser.jay" +void case_925() +#line 6214 "cs-parser.jay" { if (linq_clause_blocks == null) linq_clause_blocks = new Stack (); @@ -8890,8 +8955,8 @@ void case_923() linq_clause_blocks.Push ((Linq.QueryBlock) current_block); } -void case_924() -#line 6186 "cs-parser.jay" +void case_926() +#line 6222 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -8900,8 +8965,8 @@ void case_924() linq_clause_blocks.Push ((Linq.QueryBlock) current_block); } -void case_925() -#line 6194 "cs-parser.jay" +void case_927() +#line 6230 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -8910,8 +8975,8 @@ void case_925() current_block = new Linq.QueryBlock (current_block, lexer.Location); } -void case_926() -#line 6202 "cs-parser.jay" +void case_928() +#line 6238 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -8950,8 +9015,8 @@ void case_926() ((Linq.QueryBlock)current_block).AddRangeVariable (into); } -void case_927() -#line 6240 "cs-parser.jay" +void case_929() +#line 6276 "cs-parser.jay" { if (linq_clause_blocks == null) linq_clause_blocks = new Stack (); @@ -8960,8 +9025,8 @@ void case_927() linq_clause_blocks.Push ((Linq.QueryBlock) current_block); } -void case_928() -#line 6248 "cs-parser.jay" +void case_930() +#line 6284 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -8970,8 +9035,8 @@ void case_928() linq_clause_blocks.Push ((Linq.QueryBlock) current_block); } -void case_929() -#line 6256 "cs-parser.jay" +void case_931() +#line 6292 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -8980,8 +9045,8 @@ void case_929() current_block = new Linq.QueryBlock (current_block, lexer.Location); } -void case_930() -#line 6264 "cs-parser.jay" +void case_932() +#line 6300 "cs-parser.jay" { current_block.AddStatement (new ContextualReturn ((Expression) yyVals[-1+yyTop])); current_block.SetEndLocation (lexer.Location); @@ -9024,15 +9089,15 @@ void case_930() ((Linq.QueryBlock)current_block).AddRangeVariable (into); } -void case_932() -#line 6310 "cs-parser.jay" +void case_934() +#line 6346 "cs-parser.jay" { opt_intoStack.Push (GetLocation (yyVals[-1+yyTop])); yyVal = yyVals[0+yyTop]; } -void case_934() -#line 6322 "cs-parser.jay" +void case_936() +#line 6358 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -9040,8 +9105,8 @@ void case_934() yyVal = yyVals[0+yyTop]; } -void case_936() -#line 6333 "cs-parser.jay" +void case_938() +#line 6369 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -9049,15 +9114,15 @@ void case_936() current_block = new Linq.QueryBlock (current_block, lexer.Location); } -void case_937() -#line 6340 "cs-parser.jay" +void case_939() +#line 6376 "cs-parser.jay" { ((Linq.AQueryClause)yyVals[-3+yyTop]).Next = (Linq.AQueryClause)yyVals[0+yyTop]; yyVal = yyVals[-3+yyTop]; } -void case_939() -#line 6349 "cs-parser.jay" +void case_941() +#line 6385 "cs-parser.jay" { current_block.SetEndLocation (lexer.Location); current_block = current_block.Parent; @@ -9065,43 +9130,43 @@ void case_939() current_block = new Linq.QueryBlock ((Linq.QueryBlock) current_block, lexer.Location); } -void case_940() -#line 6356 "cs-parser.jay" +void case_942() +#line 6392 "cs-parser.jay" { ((Linq.AQueryClause)yyVals[-3+yyTop]).Tail.Next = (Linq.AQueryClause)yyVals[0+yyTop]; yyVal = yyVals[-3+yyTop]; } -void case_942() -#line 6368 "cs-parser.jay" +void case_944() +#line 6404 "cs-parser.jay" { yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_943() -#line 6373 "cs-parser.jay" +void case_945() +#line 6409 "cs-parser.jay" { yyVal = new Linq.OrderByDescending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_945() -#line 6385 "cs-parser.jay" +void case_947() +#line 6421 "cs-parser.jay" { yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_946() -#line 6390 "cs-parser.jay" +void case_948() +#line 6426 "cs-parser.jay" { yyVal = new Linq.ThenByDescending ((Linq.QueryBlock) current_block, (Expression)yyVals[-1+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop])); } -void case_948() -#line 6400 "cs-parser.jay" +void case_950() +#line 6436 "cs-parser.jay" { /* query continuation block is not linked with query block but with block*/ /* before. This means each query can use same range variable names for*/ @@ -9118,8 +9183,8 @@ void case_948() linq_clause_blocks.Push ((Linq.QueryBlock) current_block); } -void case_949() -#line 6416 "cs-parser.jay" +void case_951() +#line 6452 "cs-parser.jay" { var current_block = linq_clause_blocks.Pop (); var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; @@ -9129,8 +9194,8 @@ void case_949() }; } -void case_952() -#line 6443 "cs-parser.jay" +void case_954() +#line 6479 "cs-parser.jay" { current_container = current_type = new Class (current_container, new MemberName (""), Modifiers.PUBLIC, null); @@ -9159,8 +9224,8 @@ void case_952() start_block (lexer.Location); } -void case_953() -#line 6471 "cs-parser.jay" +void case_955() +#line 6507 "cs-parser.jay" { --lexer.parsing_block; Method method = (Method) oob_stack.Pop (); @@ -9171,16 +9236,16 @@ void case_953() current_local_parameters = null; } -void case_963() -#line 6514 "cs-parser.jay" +void case_965() +#line 6550 "cs-parser.jay" { module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)yyVals[-1+yyTop]; module.DocumentationBuilder.ParsedParameters = (List)yyVals[0+yyTop]; yyVal = null; } -void case_964() -#line 6520 "cs-parser.jay" +void case_966() +#line 6556 "cs-parser.jay" { module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)yyVals[-3+yyTop]; module.DocumentationBuilder.ParsedParameters = (List)yyVals[0+yyTop]; @@ -9188,15 +9253,15 @@ void case_964() yyVal = new MemberName (lt.Value); } -void case_967() -#line 6535 "cs-parser.jay" +void case_969() +#line 6571 "cs-parser.jay" { module.DocumentationBuilder.ParsedParameters = (List)yyVals[-1+yyTop]; yyVal = new MemberName ((MemberName) yyVals[-6+yyTop], MemberCache.IndexerNameAlias, Location.Null); } -void case_968() -#line 6540 "cs-parser.jay" +void case_970() +#line 6576 "cs-parser.jay" { var p = (List)yyVals[0+yyTop] ?? new List (1); p.Add (new DocumentationParameter ((FullNamedExpression) yyVals[-1+yyTop])); @@ -9205,8 +9270,8 @@ void case_968() yyVal = null; } -void case_969() -#line 6548 "cs-parser.jay" +void case_971() +#line 6584 "cs-parser.jay" { var p = (List)yyVals[0+yyTop] ?? new List (1); p.Add (new DocumentationParameter ((FullNamedExpression) yyVals[-1+yyTop])); @@ -9215,8 +9280,8 @@ void case_969() yyVal = null; } -void case_970() -#line 6556 "cs-parser.jay" +void case_972() +#line 6592 "cs-parser.jay" { var p = (List)yyVals[0+yyTop] ?? new List (1); module.DocumentationBuilder.ParsedParameters = p; @@ -9224,24 +9289,24 @@ void case_970() yyVal = null; } -void case_978() -#line 6594 "cs-parser.jay" +void case_980() +#line 6630 "cs-parser.jay" { var parameters = new List (); parameters.Add ((DocumentationParameter) yyVals[0+yyTop]); yyVal = parameters; } -void case_979() -#line 6600 "cs-parser.jay" +void case_981() +#line 6636 "cs-parser.jay" { var parameters = yyVals[-2+yyTop] as List; parameters.Add ((DocumentationParameter) yyVals[0+yyTop]); yyVal = parameters; } -void case_980() -#line 6609 "cs-parser.jay" +void case_982() +#line 6645 "cs-parser.jay" { if (yyVals[-1+yyTop] != null) yyVal = new DocumentationParameter ((Parameter.Modifier) yyVals[-1+yyTop], (FullNamedExpression) yyVals[0+yyTop]); @@ -9283,30 +9348,30 @@ void case_980() 171, 172, 173, 172, 174, 169, 166, 166, 166, 166, 166, 178, 175, 179, 176, 177, 177, 61, 181, 183, 184, 29, 180, 180, 180, 182, 182, 182, 185, 185, - 186, 187, 186, 186, 188, 189, 190, 30, 191, 191, - 16, 16, 192, 192, 195, 194, 194, 194, 196, 196, - 198, 64, 121, 101, 101, 126, 126, 199, 199, 199, - 197, 197, 200, 200, 201, 201, 203, 203, 82, 72, - 72, 86, 86, 116, 116, 146, 146, 204, 204, 204, - 204, 204, 208, 208, 209, 207, 207, 207, 207, 207, - 207, 207, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 211, 211, 211, 211, 211, 211, 211, 211, 211, + 186, 187, 186, 186, 186, 188, 189, 190, 30, 191, + 191, 16, 16, 192, 192, 195, 194, 194, 194, 196, + 196, 198, 64, 121, 101, 101, 126, 126, 199, 199, + 199, 197, 197, 200, 200, 201, 201, 203, 203, 82, + 72, 72, 86, 86, 116, 116, 146, 146, 204, 204, + 204, 204, 204, 208, 208, 209, 207, 207, 207, 207, + 207, 207, 207, 210, 210, 210, 210, 210, 210, 210, + 210, 210, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, - 211, 212, 212, 212, 213, 213, 213, 233, 233, 234, - 234, 235, 235, 215, 215, 232, 232, 232, 232, 232, - 232, 232, 232, 217, 217, 237, 237, 238, 238, 239, - 239, 241, 241, 241, 242, 242, 242, 242, 242, 243, - 243, 159, 159, 236, 236, 236, 236, 236, 248, 248, - 247, 247, 249, 249, 249, 249, 250, 218, 218, 218, - 246, 246, 246, 251, 251, 252, 252, 219, 220, 220, - 221, 222, 223, 223, 214, 214, 214, 214, 214, 257, - 253, 224, 258, 258, 259, 259, 260, 260, 261, 261, - 261, 261, 254, 254, 205, 205, 256, 256, 262, 262, - 255, 255, 81, 81, 263, 263, 264, 225, 265, 265, - 265, 266, 266, 266, 266, 266, 267, 193, 226, 227, - 228, 229, 269, 230, 270, 230, 268, 268, 272, 271, - 216, 273, 273, 273, 273, 273, 274, 274, 274, 274, - 274, 274, 274, 275, 275, 275, 275, 276, 276, 276, + 211, 211, 212, 212, 212, 213, 213, 213, 233, 233, + 234, 234, 235, 235, 215, 215, 232, 232, 232, 232, + 232, 232, 232, 232, 217, 217, 237, 237, 238, 238, + 239, 239, 241, 241, 241, 242, 242, 242, 242, 242, + 243, 243, 159, 159, 236, 236, 236, 236, 236, 248, + 248, 247, 247, 249, 249, 249, 249, 250, 218, 218, + 218, 246, 246, 246, 251, 251, 252, 252, 219, 220, + 220, 221, 222, 223, 223, 214, 214, 214, 214, 214, + 257, 253, 224, 258, 258, 259, 259, 260, 260, 261, + 261, 261, 261, 254, 254, 205, 205, 256, 256, 262, + 262, 255, 255, 81, 81, 263, 263, 264, 225, 265, + 265, 265, 266, 266, 266, 266, 266, 267, 193, 226, + 227, 228, 229, 269, 230, 270, 230, 268, 268, 272, + 271, 216, 273, 273, 273, 273, 273, 274, 274, 274, + 274, 274, 274, 274, 275, 275, 275, 275, 276, 276, 276, 276, 276, 277, 277, 277, 278, 278, 278, 278, 278, 279, 279, 279, 280, 280, 281, 281, 282, 282, 283, 283, 284, 284, 285, 285, 286, 286, 286, 288, @@ -9336,19 +9401,20 @@ void case_980() 378, 374, 374, 382, 381, 381, 377, 377, 380, 380, 384, 383, 383, 371, 371, 385, 371, 371, 371, 330, 330, 330, 330, 330, 330, 386, 387, 387, 388, 388, - 388, 389, 389, 390, 390, 391, 391, 392, 392, 331, - 331, 331, 331, 393, 393, 395, 395, 394, 396, 394, - 394, 332, 333, 397, 336, 334, 334, 399, 400, 337, - 402, 403, 335, 335, 335, 401, 401, 398, 398, 302, - 302, 302, 302, 404, 404, 406, 406, 408, 407, 409, - 407, 405, 405, 405, 405, 405, 413, 411, 414, 415, - 411, 410, 410, 416, 416, 416, 416, 416, 421, 417, - 422, 418, 423, 424, 425, 419, 427, 428, 429, 419, - 426, 426, 431, 420, 430, 434, 430, 433, 436, 433, - 432, 432, 432, 435, 435, 435, 412, 437, 412, 3, - 3, 438, 3, 3, 439, 439, 245, 245, 240, 240, - 5, 440, 440, 440, 440, 444, 440, 440, 440, 440, - 441, 441, 442, 445, 442, 443, 443, 446, 446, 447, + 388, 389, 389, 389, 390, 390, 391, 391, 391, 392, + 392, 331, 331, 331, 331, 393, 393, 395, 395, 394, + 396, 394, 394, 332, 333, 397, 336, 334, 334, 399, + 400, 337, 402, 403, 335, 335, 335, 401, 401, 398, + 398, 302, 302, 302, 302, 404, 404, 406, 406, 408, + 407, 409, 407, 405, 405, 405, 405, 405, 413, 411, + 414, 415, 411, 410, 410, 416, 416, 416, 416, 416, + 421, 417, 422, 418, 423, 424, 425, 419, 427, 428, + 429, 419, 426, 426, 431, 420, 430, 434, 430, 433, + 436, 433, 432, 432, 432, 435, 435, 435, 412, 437, + 412, 3, 3, 438, 3, 3, 439, 439, 245, 245, + 240, 240, 5, 440, 440, 440, 440, 444, 440, 440, + 440, 440, 441, 441, 442, 445, 442, 443, 443, 446, + 446, 447, }; static readonly short [] yyLen = { 2, 2, 0, 3, 1, 2, 4, 3, 1, 0, 1, @@ -9383,30 +9449,30 @@ void case_980() 2, 2, 0, 5, 0, 2, 2, 2, 1, 1, 1, 0, 5, 0, 5, 1, 1, 2, 0, 0, 0, 12, 0, 2, 2, 0, 1, 2, 1, 3, - 2, 0, 5, 1, 0, 0, 0, 13, 0, 1, - 1, 3, 1, 4, 2, 0, 3, 2, 1, 3, - 0, 3, 1, 1, 3, 1, 2, 3, 4, 4, - 0, 3, 1, 3, 3, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, - 2, 2, 1, 3, 1, 1, 1, 1, 1, 1, + 2, 0, 5, 3, 1, 0, 0, 0, 13, 0, + 1, 1, 3, 1, 4, 2, 0, 3, 2, 1, + 3, 0, 3, 1, 1, 3, 1, 2, 3, 4, + 4, 0, 3, 1, 3, 3, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, + 2, 2, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 3, 4, 4, 4, 3, 3, - 4, 3, 4, 4, 4, 0, 1, 3, 4, 0, - 1, 1, 3, 2, 3, 1, 2, 3, 2, 1, - 1, 0, 1, 1, 3, 3, 3, 2, 1, 1, - 1, 1, 2, 2, 4, 3, 1, 4, 4, 3, - 1, 3, 2, 1, 3, 1, 1, 1, 4, 3, - 2, 2, 6, 3, 7, 4, 3, 7, 3, 0, - 2, 4, 1, 2, 0, 1, 1, 3, 3, 1, - 1, 1, 0, 1, 1, 2, 2, 3, 1, 2, - 0, 1, 2, 4, 1, 3, 0, 5, 1, 1, - 1, 2, 3, 3, 4, 4, 1, 2, 4, 4, - 4, 4, 0, 4, 0, 5, 0, 1, 0, 4, - 4, 1, 2, 2, 4, 2, 1, 2, 2, 2, - 2, 2, 2, 1, 3, 3, 3, 1, 3, 3, + 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 3, 4, 4, 4, 3, + 3, 4, 3, 4, 4, 4, 0, 1, 3, 4, + 0, 1, 1, 3, 2, 3, 1, 2, 3, 2, + 1, 1, 0, 1, 1, 3, 3, 3, 2, 1, + 1, 1, 1, 2, 2, 4, 3, 1, 4, 4, + 3, 1, 3, 2, 1, 3, 1, 1, 1, 4, + 3, 2, 2, 6, 3, 7, 4, 3, 7, 3, + 0, 2, 4, 1, 2, 0, 1, 1, 3, 3, + 1, 1, 1, 0, 1, 1, 2, 2, 3, 1, + 2, 0, 1, 2, 4, 1, 3, 0, 5, 1, + 1, 1, 2, 3, 3, 4, 4, 1, 2, 4, + 4, 4, 4, 0, 4, 0, 5, 0, 1, 0, + 4, 4, 1, 2, 2, 4, 2, 1, 2, 2, + 2, 2, 2, 2, 1, 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 5, 4, 3, @@ -9436,1446 +9502,1408 @@ void case_980() 1, 0, 1, 0, 5, 1, 0, 1, 0, 1, 1, 1, 3, 4, 5, 0, 9, 5, 4, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, - 3, 3, 2, 3, 2, 4, 3, 0, 1, 3, - 4, 5, 3, 1, 2, 0, 1, 2, 0, 7, - 3, 2, 2, 0, 3, 5, 4, 0, 0, 10, - 0, 0, 9, 5, 4, 2, 1, 0, 2, 2, - 2, 2, 2, 4, 5, 4, 5, 0, 5, 0, - 6, 3, 2, 2, 2, 1, 0, 3, 0, 0, - 6, 1, 2, 1, 1, 1, 1, 1, 0, 5, - 0, 3, 0, 0, 0, 12, 0, 0, 0, 13, - 0, 2, 0, 3, 1, 0, 4, 1, 0, 4, - 1, 2, 2, 1, 2, 2, 0, 0, 4, 2, - 3, 0, 4, 2, 2, 3, 0, 1, 1, 1, - 2, 2, 2, 4, 3, 0, 7, 4, 4, 3, - 1, 3, 0, 0, 4, 0, 1, 1, 3, 2, + 3, 3, 3, 2, 3, 2, 4, 4, 3, 0, + 1, 3, 4, 5, 3, 1, 2, 0, 1, 2, + 0, 7, 3, 2, 2, 0, 3, 5, 4, 0, + 0, 10, 0, 0, 9, 5, 4, 2, 1, 0, + 2, 2, 2, 2, 2, 4, 5, 4, 5, 0, + 5, 0, 6, 3, 2, 2, 2, 1, 0, 3, + 0, 0, 6, 1, 2, 1, 1, 1, 1, 1, + 0, 5, 0, 3, 0, 0, 0, 12, 0, 0, + 0, 13, 0, 2, 0, 3, 1, 0, 4, 1, + 0, 4, 1, 2, 2, 1, 2, 2, 0, 0, + 4, 2, 3, 0, 4, 2, 2, 3, 0, 1, + 1, 1, 2, 2, 2, 4, 3, 0, 7, 4, + 4, 3, 1, 3, 0, 0, 4, 0, 1, 1, + 3, 2, }; static readonly short [] yyDefRed = { 0, 8, 0, 0, 0, 0, 0, 0, 0, 2, 4, - 0, 0, 11, 14, 0, 950, 0, 0, 954, 0, - 0, 15, 17, 378, 384, 391, 379, 381, 0, 380, - 0, 387, 389, 376, 0, 383, 385, 377, 388, 390, - 386, 341, 971, 0, 382, 961, 0, 10, 1, 0, + 0, 0, 11, 14, 0, 952, 0, 0, 956, 0, + 0, 15, 17, 379, 385, 392, 380, 382, 0, 381, + 0, 388, 390, 377, 0, 384, 386, 378, 389, 391, + 387, 342, 973, 0, 383, 963, 0, 10, 1, 0, 0, 0, 12, 0, 782, 0, 0, 0, 0, 0, - 0, 0, 0, 419, 0, 0, 0, 0, 0, 0, - 0, 417, 0, 0, 0, 478, 0, 418, 0, 517, - 0, 874, 0, 0, 0, 629, 0, 0, 0, 0, + 0, 0, 0, 420, 0, 0, 0, 0, 0, 0, + 0, 418, 0, 0, 0, 479, 0, 419, 0, 518, + 0, 876, 0, 0, 0, 629, 0, 0, 0, 0, 0, 0, 0, 680, 0, 731, 0, 0, 0, 0, - 0, 0, 0, 0, 416, 0, 618, 0, 781, 0, - 714, 0, 0, 0, 0, 393, 394, 0, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, - 408, 409, 410, 411, 414, 415, 625, 547, 0, 0, + 0, 0, 0, 0, 417, 0, 618, 0, 781, 0, + 714, 0, 0, 0, 0, 394, 395, 396, 397, 398, + 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, + 409, 410, 411, 412, 415, 416, 625, 548, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 626, 624, 627, 628, 698, 700, 0, 696, 699, 715, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 716, 0, 0, 0, 783, 784, 803, 804, 805, 806, 840, 841, 842, 843, 844, 845, 0, 0, 0, 20, - 0, 0, 331, 0, 333, 958, 16, 951, 0, 0, + 0, 0, 332, 0, 334, 960, 16, 953, 0, 0, 241, 240, 237, 242, 243, 236, 255, 254, 247, 248, 244, 246, 245, 249, 238, 239, 250, 251, 257, 256, - 252, 253, 0, 0, 974, 0, 963, 0, 962, 3, + 252, 253, 0, 0, 976, 0, 965, 0, 964, 3, 51, 0, 0, 0, 40, 37, 39, 42, 43, 44, - 45, 46, 49, 13, 0, 0, 0, 846, 420, 421, - 872, 0, 0, 0, 0, 0, 0, 395, 0, 848, - 847, 0, 539, 533, 538, 730, 780, 701, 728, 727, - 729, 702, 703, 704, 705, 706, 707, 708, 709, 710, - 711, 712, 713, 0, 0, 0, 812, 0, 0, 0, - 746, 745, 0, 0, 0, 0, 0, 0, 0, 0, - 853, 0, 0, 859, 0, 392, 0, 0, 0, 855, - 0, 0, 0, 873, 0, 0, 0, 744, 740, 0, - 0, 0, 0, 0, 0, 0, 360, 0, 0, 0, - 0, 0, 0, 0, 0, 621, 0, 546, 0, 0, - 544, 548, 549, 543, 553, 552, 550, 551, 614, 528, - 0, 413, 412, 0, 0, 0, 0, 0, 732, 0, - 330, 0, 738, 739, 0, 481, 482, 0, 0, 0, + 45, 46, 49, 13, 0, 0, 0, 846, 421, 422, + 874, 0, 0, 0, 0, 0, 0, 0, 848, 847, + 0, 540, 534, 539, 730, 780, 701, 728, 727, 729, + 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + 712, 713, 0, 0, 0, 812, 0, 0, 0, 746, + 745, 0, 0, 0, 0, 0, 0, 0, 0, 854, + 0, 0, 0, 0, 393, 0, 0, 0, 856, 861, + 0, 0, 0, 875, 0, 0, 0, 744, 740, 0, + 0, 0, 0, 0, 0, 0, 361, 0, 0, 0, + 0, 0, 0, 0, 0, 621, 0, 547, 0, 0, + 545, 549, 550, 544, 554, 553, 551, 552, 614, 529, + 0, 414, 413, 0, 0, 0, 0, 0, 732, 0, + 331, 0, 738, 739, 0, 482, 483, 0, 0, 0, 736, 737, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 953, 697, 747, 735, - 0, 778, 779, 906, 921, 0, 0, 907, 909, 0, - 933, 892, 890, 914, 0, 0, 912, 915, 916, 917, - 918, 893, 891, 0, 0, 0, 335, 0, 18, 0, - 0, 0, 970, 0, 342, 0, 0, 0, 972, 0, - 0, 38, 651, 657, 649, 0, 646, 656, 650, 648, - 647, 654, 652, 653, 659, 655, 658, 660, 0, 0, - 644, 41, 50, 480, 0, 476, 477, 0, 0, 474, - 0, 749, 0, 0, 0, 810, 0, 777, 775, 776, - 0, 0, 0, 633, 0, 851, 849, 634, 0, 0, - 502, 0, 0, 0, 493, 0, 497, 507, 509, 0, - 489, 0, 0, 0, 0, 0, 484, 0, 487, 0, - 491, 362, 852, 0, 0, 854, 863, 0, 0, 0, - 864, 0, 0, 875, 0, 0, 743, 0, 372, 368, - 369, 0, 0, 367, 370, 371, 0, 0, 0, 554, - 0, 0, 535, 0, 616, 695, 0, 0, 0, 689, - 691, 692, 693, 424, 425, 0, 338, 339, 0, 179, - 178, 180, 0, 0, 0, 0, 364, 0, 601, 0, - 0, 857, 0, 0, 429, 0, 432, 0, 430, 0, - 470, 0, 0, 0, 0, 0, 459, 462, 0, 0, - 454, 461, 460, 0, 590, 591, 592, 593, 594, 595, - 596, 597, 598, 600, 599, 555, 557, 556, 562, 563, + 0, 0, 0, 0, 0, 955, 697, 747, 735, 0, + 778, 779, 908, 923, 0, 0, 909, 911, 0, 935, + 894, 892, 916, 0, 0, 914, 917, 918, 919, 920, + 895, 893, 0, 0, 0, 336, 0, 18, 0, 0, + 0, 972, 0, 343, 0, 0, 0, 974, 0, 0, + 38, 651, 657, 649, 0, 646, 656, 650, 648, 647, + 654, 652, 653, 659, 655, 658, 660, 0, 0, 644, + 41, 50, 481, 0, 477, 478, 0, 0, 475, 0, + 749, 0, 0, 0, 810, 0, 777, 775, 776, 0, + 0, 0, 633, 0, 851, 849, 634, 0, 0, 503, + 0, 0, 0, 494, 0, 498, 508, 510, 0, 490, + 0, 0, 0, 0, 0, 485, 0, 488, 0, 492, + 363, 853, 852, 0, 0, 855, 865, 0, 0, 0, + 866, 0, 0, 877, 0, 0, 743, 0, 373, 369, + 370, 0, 0, 368, 371, 372, 0, 0, 0, 555, + 0, 0, 536, 0, 616, 695, 0, 0, 0, 689, + 691, 692, 693, 425, 426, 0, 339, 340, 0, 179, + 178, 180, 0, 0, 0, 0, 365, 0, 601, 0, + 0, 859, 0, 0, 0, 430, 0, 433, 0, 431, + 0, 471, 0, 0, 0, 0, 0, 460, 463, 0, + 0, 455, 462, 461, 590, 591, 592, 593, 594, 595, + 596, 597, 598, 600, 599, 556, 558, 557, 562, 563, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 586, 0, 0, 506, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 905, 904, - 0, 913, 0, 903, 0, 0, 332, 968, 969, 356, - 0, 0, 0, 353, 0, 0, 176, 0, 0, 978, - 964, 966, 59, 57, 58, 0, 0, 52, 0, 0, + 0, 0, 0, 0, 0, 586, 0, 0, 507, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 907, 906, + 0, 915, 0, 905, 0, 0, 333, 970, 971, 357, + 0, 0, 0, 354, 0, 0, 176, 0, 0, 980, + 966, 968, 59, 57, 58, 0, 0, 52, 0, 0, 60, 62, 26, 24, 0, 0, 0, 641, 0, 645, - 428, 0, 479, 0, 530, 0, 541, 165, 187, 0, - 0, 0, 155, 0, 0, 0, 166, 534, 0, 878, + 429, 0, 480, 0, 531, 0, 542, 165, 187, 0, + 0, 0, 155, 0, 0, 0, 166, 535, 0, 880, 0, 832, 813, 0, 823, 0, 834, 0, 850, 787, - 0, 877, 0, 0, 492, 0, 508, 510, 0, 0, - 446, 0, 0, 442, 0, 0, 471, 0, 512, 486, - 0, 0, 140, 513, 138, 139, 515, 0, 529, 790, - 0, 868, 0, 861, 0, 865, 521, 0, 0, 0, - 357, 0, 519, 0, 0, 531, 885, 0, 881, 808, - 0, 896, 0, 894, 0, 0, 631, 632, 0, 0, + 0, 879, 0, 0, 493, 0, 509, 511, 0, 0, + 447, 0, 0, 443, 0, 0, 472, 0, 513, 487, + 0, 0, 140, 514, 138, 139, 516, 0, 530, 790, + 0, 870, 0, 863, 0, 867, 522, 0, 0, 0, + 358, 0, 520, 0, 0, 532, 887, 0, 883, 808, + 0, 898, 0, 896, 0, 0, 631, 632, 0, 0, 0, 694, 682, 683, 681, 690, 609, 615, 608, 0, - 0, 337, 604, 0, 0, 0, 545, 856, 733, 433, - 427, 431, 426, 532, 469, 468, 467, 464, 463, 0, - 458, 422, 423, 434, 435, 0, 589, 0, 756, 0, - 0, 613, 612, 922, 898, 0, 923, 0, 908, 910, - 919, 0, 934, 0, 902, 948, 19, 334, 679, 678, - 0, 677, 0, 352, 980, 177, 975, 0, 0, 53, - 0, 0, 0, 0, 0, 0, 359, 0, 635, 0, - 0, 79, 78, 0, 475, 0, 0, 0, 0, 0, - 170, 540, 0, 0, 0, 0, 0, 824, 816, 814, - 0, 835, 0, 0, 876, 499, 498, 449, 0, 0, - 959, 960, 438, 444, 0, 447, 0, 473, 0, 0, - 0, 0, 0, 788, 871, 0, 862, 0, 527, 522, - 0, 0, 518, 0, 884, 0, 807, 897, 895, 0, - 536, 0, 617, 611, 340, 603, 602, 619, 466, 0, - 457, 456, 455, 588, 140, 0, 772, 754, 0, 0, - 0, 761, 0, 900, 0, 927, 0, 0, 942, 943, - 936, 0, 355, 354, 979, 0, 0, 61, 55, 0, - 63, 25, 22, 0, 0, 309, 0, 213, 0, 102, - 0, 76, 766, 113, 114, 0, 0, 0, 769, 185, - 186, 0, 0, 0, 0, 158, 167, 159, 161, 811, - 0, 0, 0, 0, 0, 833, 0, 0, 448, 450, - 451, 445, 439, 443, 0, 504, 0, 472, 483, 437, - 516, 514, 0, 867, 0, 0, 0, 523, 0, 887, - 0, 0, 630, 622, 0, 465, 0, 0, 752, 751, - 748, 762, 899, 0, 0, 0, 0, 920, 0, 949, - 967, 0, 0, 0, 68, 69, 72, 73, 0, 325, - 315, 314, 0, 636, 209, 97, 0, 750, 770, 171, - 0, 183, 0, 0, 0, 809, 889, 0, 0, 0, - 0, 815, 0, 836, 786, 488, 485, 795, 0, 802, - 0, 0, 793, 0, 798, 869, 526, 525, 886, 882, - 0, 620, 0, 0, 901, 924, 0, 911, 0, 0, - 938, 0, 74, 66, 0, 0, 0, 310, 0, 0, - 0, 0, 0, 172, 0, 162, 160, 879, 825, 819, - 817, 0, 0, 789, 794, 0, 799, 0, 0, 623, - 0, 764, 0, 928, 945, 946, 939, 54, 0, 70, - 71, 0, 0, 0, 0, 0, 0, 0, 771, 169, - 0, 182, 0, 0, 837, 801, 800, 0, 684, 686, - 870, 883, 773, 0, 0, 0, 75, 0, 0, 326, - 0, 0, 324, 311, 0, 319, 375, 0, 373, 0, - 637, 0, 666, 210, 98, 173, 880, 821, 818, 0, - 0, 830, 0, 925, 0, 940, 0, 0, 0, 308, - 0, 0, 663, 0, 0, 0, 667, 0, 0, 0, - 0, 0, 929, 28, 23, 327, 0, 0, 320, 374, - 669, 0, 0, 0, 99, 820, 685, 0, 0, 0, - 0, 312, 674, 0, 675, 672, 0, 670, 95, 0, - 93, 0, 0, 82, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 94, 141, 0, 0, 226, 218, 219, - 220, 221, 222, 223, 224, 225, 0, 0, 216, 0, - 0, 926, 0, 328, 323, 0, 0, 0, 638, 83, - 0, 269, 264, 268, 0, 211, 217, 0, 932, 930, - 673, 671, 0, 0, 0, 0, 0, 0, 0, 278, - 0, 0, 227, 0, 0, 235, 0, 153, 142, 152, - 0, 100, 0, 0, 263, 0, 0, 262, 0, 146, - 0, 0, 346, 0, 344, 0, 0, 188, 0, 0, - 0, 0, 0, 639, 212, 0, 103, 0, 343, 0, - 0, 0, 0, 117, 0, 0, 0, 0, 0, 0, - 151, 143, 0, 0, 192, 0, 347, 0, 230, 229, - 228, 0, 101, 0, 282, 0, 260, 119, 0, 258, - 0, 0, 0, 121, 0, 348, 0, 0, 189, 0, - 0, 0, 345, 233, 112, 110, 0, 0, 286, 0, - 0, 0, 0, 0, 147, 0, 266, 0, 0, 0, - 0, 125, 0, 0, 0, 0, 349, 350, 0, 0, - 0, 0, 0, 107, 301, 0, 283, 0, 0, 295, - 0, 0, 0, 290, 0, 137, 0, 0, 0, 0, - 132, 0, 0, 279, 0, 122, 0, 116, 126, 144, - 150, 200, 0, 190, 0, 0, 0, 0, 111, 0, - 104, 108, 0, 0, 0, 297, 0, 298, 287, 0, - 0, 281, 291, 261, 0, 0, 118, 133, 259, 0, - 277, 0, 267, 271, 128, 0, 0, 0, 197, 199, - 193, 234, 109, 302, 304, 284, 0, 0, 296, 293, - 136, 134, 148, 276, 0, 0, 0, 145, 201, 203, - 191, 0, 0, 0, 295, 0, 272, 274, 129, 0, - 0, 194, 306, 307, 303, 305, 294, 149, 0, 0, - 207, 206, 205, 202, 204, 0, 0, 0, 195, 273, - 275, + 0, 338, 604, 0, 0, 0, 546, 858, 857, 733, + 434, 428, 432, 427, 533, 470, 469, 468, 465, 464, + 0, 459, 423, 424, 435, 436, 0, 589, 0, 756, + 0, 0, 613, 612, 924, 900, 0, 925, 0, 910, + 912, 921, 0, 936, 0, 904, 950, 19, 335, 679, + 678, 0, 677, 0, 353, 982, 177, 977, 0, 0, + 53, 0, 0, 0, 0, 0, 0, 360, 0, 635, + 0, 0, 79, 78, 0, 476, 0, 0, 0, 0, + 0, 170, 541, 0, 0, 0, 0, 0, 824, 816, + 814, 0, 835, 0, 0, 878, 500, 499, 450, 0, + 0, 961, 962, 439, 445, 0, 448, 0, 474, 0, + 0, 0, 0, 0, 788, 873, 0, 864, 0, 528, + 523, 0, 0, 519, 0, 886, 0, 807, 899, 897, + 0, 537, 0, 617, 611, 341, 603, 602, 619, 467, + 0, 458, 457, 456, 588, 140, 0, 772, 754, 0, + 0, 0, 761, 0, 902, 0, 929, 0, 0, 944, + 945, 938, 0, 356, 355, 981, 0, 0, 61, 55, + 0, 63, 25, 22, 0, 0, 309, 0, 213, 0, + 102, 0, 76, 766, 113, 114, 0, 0, 0, 769, + 185, 186, 0, 0, 0, 0, 158, 167, 159, 161, + 811, 0, 0, 0, 0, 0, 833, 0, 0, 449, + 451, 452, 446, 440, 444, 0, 505, 0, 473, 484, + 438, 517, 515, 0, 869, 0, 0, 0, 524, 0, + 889, 0, 0, 630, 622, 0, 466, 0, 0, 752, + 751, 748, 762, 901, 0, 0, 0, 0, 922, 0, + 951, 969, 0, 0, 0, 68, 69, 72, 73, 0, + 326, 315, 314, 0, 636, 209, 97, 0, 750, 770, + 171, 0, 183, 0, 0, 0, 809, 891, 0, 0, + 0, 0, 815, 0, 836, 786, 489, 486, 795, 0, + 802, 0, 0, 793, 0, 798, 871, 527, 526, 888, + 884, 0, 620, 0, 0, 903, 926, 0, 913, 0, + 0, 940, 0, 74, 66, 0, 0, 0, 310, 0, + 0, 0, 0, 0, 172, 0, 162, 160, 881, 825, + 819, 817, 0, 0, 789, 794, 0, 799, 0, 0, + 623, 0, 764, 0, 930, 947, 948, 941, 54, 0, + 70, 71, 0, 0, 0, 0, 0, 0, 0, 771, + 169, 0, 182, 0, 0, 837, 801, 800, 0, 684, + 686, 872, 885, 773, 0, 0, 0, 75, 0, 0, + 327, 0, 0, 325, 311, 0, 319, 376, 0, 374, + 0, 637, 0, 666, 210, 98, 173, 882, 821, 818, + 0, 0, 830, 0, 927, 0, 942, 0, 0, 0, + 308, 0, 0, 663, 0, 0, 0, 667, 0, 0, + 0, 0, 0, 931, 28, 23, 328, 324, 0, 0, + 320, 375, 669, 0, 0, 0, 99, 820, 685, 0, + 0, 0, 0, 312, 674, 0, 675, 672, 0, 670, + 95, 0, 93, 0, 0, 82, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 94, 141, 0, 0, 226, + 218, 219, 220, 221, 222, 223, 224, 225, 0, 0, + 216, 0, 0, 928, 0, 329, 323, 0, 0, 0, + 638, 83, 0, 269, 264, 268, 0, 211, 217, 0, + 934, 932, 673, 671, 0, 0, 0, 0, 0, 0, + 0, 278, 0, 0, 227, 0, 0, 235, 0, 153, + 142, 152, 0, 100, 0, 0, 263, 0, 0, 262, + 0, 146, 0, 0, 347, 0, 345, 0, 0, 188, + 0, 0, 0, 0, 0, 639, 212, 0, 103, 0, + 344, 0, 0, 0, 0, 117, 0, 0, 0, 0, + 0, 0, 151, 143, 0, 0, 192, 0, 348, 0, + 230, 229, 228, 0, 101, 0, 282, 0, 260, 119, + 0, 258, 0, 0, 0, 121, 0, 349, 0, 0, + 189, 0, 0, 0, 346, 233, 112, 110, 0, 0, + 286, 0, 0, 0, 0, 0, 147, 0, 266, 0, + 0, 0, 0, 125, 0, 0, 0, 0, 350, 351, + 0, 0, 0, 0, 0, 107, 301, 0, 283, 0, + 0, 295, 0, 0, 0, 290, 0, 137, 0, 0, + 0, 0, 132, 0, 0, 279, 0, 122, 0, 116, + 126, 144, 150, 200, 0, 190, 0, 0, 0, 0, + 111, 0, 104, 108, 0, 0, 0, 297, 0, 298, + 287, 0, 0, 281, 291, 261, 0, 0, 118, 133, + 259, 0, 277, 0, 267, 271, 128, 0, 0, 0, + 197, 199, 193, 234, 109, 302, 304, 284, 0, 0, + 296, 293, 136, 134, 148, 276, 0, 0, 0, 145, + 201, 203, 191, 0, 0, 0, 295, 0, 272, 274, + 129, 0, 0, 194, 306, 307, 303, 305, 294, 149, + 0, 0, 207, 206, 205, 202, 204, 0, 0, 0, + 195, 273, 275, }; protected static readonly short [] yyDgoto = { 7, 8, 49, 9, 50, 10, 11, 51, 232, 700, 662, - 12, 13, 52, 22, 23, 324, 235, 685, 855, 1049, - 1169, 1513, 852, 236, 237, 238, 239, 240, 241, 242, - 243, 678, 450, 679, 680, 957, 681, 682, 961, 853, - 1044, 1045, 1046, 267, 598, 1139, 110, 864, 1242, 1243, - 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, - 1254, 469, 689, 1325, 971, 1146, 1111, 1181, 1209, 1270, - 1336, 1177, 1387, 1364, 1412, 1413, 1414, 973, 1410, 974, - 746, 1302, 1375, 1349, 1400, 521, 1393, 1369, 1429, 937, - 1398, 1401, 1402, 1497, 1430, 1431, 1427, 1255, 1309, 1281, - 1326, 702, 1377, 1476, 1346, 1433, 1506, 470, 268, 703, - 704, 705, 706, 707, 665, 575, 1151, 666, 667, 870, - 1328, 1354, 1444, 1405, 1478, 1329, 1380, 1502, 1526, 1445, - 1446, 1524, 1510, 1511, 969, 1110, 1208, 1267, 1311, 1268, - 1269, 1303, 1361, 1332, 1304, 327, 223, 1409, 1306, 1394, - 1391, 1256, 1283, 1322, 1473, 1435, 1161, 1474, 599, 1519, - 1520, 1321, 1390, 1366, 1422, 1417, 1388, 1454, 1459, 1420, - 1423, 1424, 1505, 1460, 1418, 1419, 1515, 1503, 1504, 966, - 1053, 1174, 1144, 1201, 1175, 1176, 1217, 1107, 1198, 1230, - 540, 193, 112, 353, 195, 569, 445, 224, 1341, 663, - 664, 841, 857, 328, 410, 539, 305, 1178, 1179, 45, - 114, 306, 116, 117, 118, 119, 120, 121, 122, 123, + 12, 13, 52, 22, 23, 324, 235, 685, 856, 1050, + 1170, 1515, 853, 236, 237, 238, 239, 240, 241, 242, + 243, 678, 449, 679, 680, 958, 681, 682, 962, 854, + 1045, 1046, 1047, 266, 599, 1140, 110, 865, 1244, 1245, + 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, + 1256, 468, 689, 1327, 972, 1147, 1112, 1182, 1210, 1272, + 1338, 1178, 1389, 1366, 1414, 1415, 1416, 974, 1412, 975, + 746, 1304, 1377, 1351, 1402, 520, 1395, 1371, 1431, 938, + 1400, 1403, 1404, 1499, 1432, 1433, 1429, 1257, 1311, 1283, + 1328, 702, 1379, 1478, 1348, 1435, 1508, 469, 267, 703, + 704, 705, 706, 707, 665, 575, 1152, 666, 667, 871, + 1330, 1356, 1446, 1407, 1480, 1331, 1382, 1504, 1528, 1447, + 1448, 1526, 1512, 1513, 970, 1111, 1209, 1269, 1313, 1270, + 1271, 1305, 1363, 1334, 1306, 327, 223, 1411, 1308, 1396, + 1393, 1258, 1285, 1324, 1475, 1437, 1162, 1476, 600, 1521, + 1522, 1323, 1392, 1368, 1424, 1419, 1390, 1456, 1461, 1422, + 1425, 1426, 1507, 1462, 1420, 1421, 1517, 1505, 1506, 967, + 1054, 1175, 1145, 1202, 1176, 1177, 1219, 1108, 1199, 1232, + 540, 193, 112, 353, 195, 569, 444, 224, 1343, 663, + 664, 842, 858, 328, 409, 539, 304, 1179, 1180, 45, + 114, 305, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 252, 814, 742, 1009, 517, 732, 893, - 733, 734, 1002, 137, 198, 738, 601, 602, 603, 808, - 479, 480, 298, 1007, 740, 411, 300, 504, 505, 506, - 507, 510, 748, 313, 764, 765, 910, 264, 485, 779, - 265, 484, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 824, 152, 578, 579, - 580, 788, 789, 790, 153, 566, 781, 354, 1025, 554, - 1091, 154, 499, 967, 1109, 1206, 1307, 471, 1182, 1183, - 1237, 1238, 842, 558, 339, 785, 1193, 559, 560, 269, - 270, 271, 157, 158, 159, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 282, 283, 171, 284, 584, - 172, 173, 320, 821, 638, 940, 1031, 867, 696, 977, - 938, 941, 1069, 942, 978, 979, 285, 174, 175, 176, - 1081, 1013, 1082, 1083, 1084, 1126, 1085, 177, 178, 179, - 180, 713, 492, 714, 1072, 995, 1073, 1189, 1154, 1190, - 715, 994, 716, 1192, 1122, 181, 182, 183, 184, 185, - 186, 307, 530, 531, 1015, 1128, 316, 993, 877, 1153, - 1022, 916, 1129, 187, 423, 188, 424, 943, 1034, 425, - 426, 654, 645, 646, 947, 427, 428, 429, 430, 431, - 948, 640, 945, 1133, 1212, 1272, 1036, 1165, 1229, 833, - 648, 834, 1100, 1039, 1101, 1166, 952, 17, 19, 46, - 47, 227, 668, 849, 446, 669, 670, + 134, 135, 136, 252, 815, 742, 1010, 516, 732, 894, + 733, 734, 1003, 137, 198, 738, 602, 603, 604, 809, + 478, 479, 297, 1008, 740, 410, 299, 503, 504, 505, + 506, 509, 748, 313, 764, 765, 911, 263, 484, 779, + 264, 483, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 825, 152, 578, 579, + 580, 788, 789, 790, 153, 566, 781, 354, 1026, 554, + 1092, 154, 498, 968, 1110, 1207, 1309, 470, 1183, 1184, + 1239, 1240, 843, 558, 339, 785, 1194, 559, 560, 268, + 269, 270, 157, 158, 159, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 171, 283, 585, + 172, 173, 320, 822, 638, 941, 1032, 868, 696, 978, + 939, 942, 1070, 943, 979, 980, 284, 174, 175, 176, + 1082, 1014, 1083, 1084, 1085, 1127, 1086, 177, 178, 179, + 180, 713, 491, 714, 1073, 996, 1074, 1190, 1155, 1191, + 715, 995, 716, 1193, 1123, 181, 182, 183, 184, 185, + 186, 306, 530, 531, 1016, 1129, 316, 994, 878, 1154, + 1023, 917, 1130, 187, 422, 188, 423, 944, 1035, 424, + 425, 654, 645, 646, 948, 426, 427, 428, 429, 430, + 949, 640, 946, 1134, 1213, 1274, 1037, 1166, 1231, 834, + 648, 835, 1101, 1040, 1102, 1167, 953, 17, 19, 46, + 47, 227, 668, 850, 445, 669, 670, }; - protected static readonly short [] yySindex = { -94, - 0, -192, -119, -209, -237,12563, 0, 53, 0, 0, - -237, -209, 0, 0, -84, 0, 6810, -237, 0, -191, - 45, 0, 0, 0, 0, 0, 0, 0, 72, 0, - 382, 0, 0, 0, 5309, 0, 0, 0, 0, 0, - 0, 0, 0, 765, 0, 0, 768, 0, 0, 53, - 440, -237, 0, 408, 0, 276, 485, 248,12045, -132, - 235, 467, 6967, 0, 235, 235, 235, -135, 235, 235, - 599, 0, 8656, 235, 235, 0, 8813, 0, 474, 0, - 248, 0, 235, 495, 235, 0,12607,12607, 538, 235, - 235, 5,11828, 0,11148, 0,11828,11828,11828,11828, -11828,11828,11828,11828, 0, 331, 0, 8221, 0, 148, - 0, 516, 462, 580, -222, 0, 0, 573, 0, 0, + protected static readonly short [] yySindex = { -167, + 0, -194, 51, 72, 108,12563, 0, 231, 0, 0, + 108, 72, 0, 0, -63, 0, 6715, 108, 0, -179, + -254, 0, 0, 0, 0, 0, 0, 0, 244, 0, + 327, 0, 0, 0, 3845, 0, 0, 0, 0, 0, + 0, 0, 0, 439, 0, 0, 575, 0, 0, 231, + 215, 108, 0, 319, 0, 264, 358, 279,12045, -163, + 9, 399, 6872, 0, 9, 9, 9, -137, 9, 9, + 706, 0, 8561, 9, 9, 0, 8718, 0, 482, 0, + 279, 0, 9, 419, 9, 0, 1465, 1465, 501, 9, + 9, -216,11828, 0,11148, 0,11828,11828,11828,11828, +11828,11828,11828,11828, 0, 133, 0, 7831, 0, 131, + 0, 437, 505, 318, 429, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1161, 759, - 86, 344, 574, 781, 674, 635, 682, 672, 463, 714, - 0, 0, 0, 0, 0, 0, 3610, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1044, 775, + 84, 280, 559, 260, 523, 568, 580, 593, -288, 609, + 0, 0, 0, 0, 0, 0, 3546, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 23, 743, -31, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -150, 187, 440, 0, - 414, 603, 0, 697, 0, 0, 0, 0, 8221, 8221, + 0, 168, 614, 250, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 317, 332, 215, 0, + 451, 191, 0, 587, 0, 0, 0, 0, 7831, 7831, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 749, 720, 0, 725, 0, -149, 0, 0, - 0, 440,13118, 763, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 894, 739,11284, 0, 0, 0, - 0,11148, 235, 235, 885, 396, 580, 0, 23, 0, - 0, 8221, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 665, 599, 0, 629, 0, 69, 0, 0, + 0, 215,13031, 713, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 794, 641,11284, 0, 0, 0, + 0,11148, 9, 9, 785, 331, 318, 168, 0, 0, + 7831, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 212, 138,12045, 0, 8221,11148, 790, - 0, 0, 799,11148,11148, 4877, 43, 59, 818, 8516, - 0,11828, 331, 0, 816, 0, 830, 8221,11148, 0, - 834, 611, 235, 0,11148, 474,10604, 0, 0, 495, -11148, 495, 236, 514, 956, 23, 0, 743, -222, 961, - 23,11148,11148,11148, 467, 0, 930, 0, 7124, -271, + 0, 0, -176, -267,12045, 0, 7831,11148, 716, 0, + 0, 734,11148,11148, 9503, -251, -118, 772, 8126, 0, +11828, 133, 889, 800, 0, 818, 7831,11148, 0, 0, + 830, 591, 9, 0,11148, 482,10604, 0, 0, 419, +11148, 419, -279, 539, 854, 168, 0, 614, 429, 919, + 168,11148,11148,11148, 399, 0, 840, 0, 7029, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4334, 0, 0,12518, 236, 909, 907,11148, 0, 871, - 0, 262, 0, 0, 509, 0, 0, 884, 8970,10468, - 0, 0,11828,11148,11148,11148,11148,11148,11148,11148, -11148,11148,11148,11148,11828,11828,11828, 8221, 8221,11828, + 4270, 0, 0,12518, -279, 843, 857,11148, 0, 809, + 0, -294, 0, 0, 356, 0, 0, 810, 8875,10468, + 0, 0,11148,11148,11148,11148,11148,11148,11148,11148, +11148,11148,11148,11828,11828,11828, 7831, 7831,11828,11828, 11828,11828,11828,11828,11828,11828,11828,11828,11828,11828, -11828,11828,11828,11828,11828,11148, 0, 0, 0, 0, - 743, 0, 0, 0, 0,12607,12607, 0, 0, 23, - 0, 0, 0, 0, 428, 954, 0, 0, 0, 0, - 0, 0, 0, 440, 763, 900, 0, 902, 0, 871, - 749, 749, 0, 82, 0, 557, 749, 953, 0, -163, -13118, 0, 0, 0, 0, -172, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -205,13148, - 0, 0, 0, 0, 871, 0, 0, 951, 441, 0, - 957, 0, 958, 202, 474, 0, 235, 0, 0, 0, - 23,10604, -170, 0, 955, 0, 0, 0, -58, 83, - 0, 337, 0, 966, 0, 965, 0, 0, 0, 566, - 0, 8340, 595,11148, 818,10468, 0, 7595, 0, 495, - 0, 0, 0, 968, 122, 0, 0, 248, 474, 475, - 0, 4016, 970, 0, 123, 23, 0, 182, 0, 0, - 0,11148, 1049, 0, 0, 0,11148, 1050, 971, 0, - 974, 976, 0,12518, 0, 0, -174, -287, 7124, 0, - 0, 0, 0, 0, 0, 474, 0, 0, -253, 0, - 0, 0, 495, 236, 23, 8673, 0, 977, 0, 978, -11828, 0, 979, 7124, 0, 343, 0, 461, 0, 871, - 0, 46,11148,11148, 982, 1098, 0, 0, 191, -141, - 0, 0, 0, 759, 0, 0, 0, 0, 0, 0, +11828,11828,11828,11828,11148, 0, 0, 0, 0, 614, + 0, 0, 0, 0, 1465, 1465, 0, 0, 168, 0, + 0, 0, 0, 374, 875, 0, 0, 0, 0, 0, + 0, 0, 215, 713, 821, 0, 841, 0, 809, 665, + 665, 0, -86, 0, 551, 665, 873, 0, -184,13031, + 0, 0, 0, 0, -174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 198,13061, 0, + 0, 0, 0, 809, 0, 0, 872, 534, 0, 888, + 0, 890, 144, 482, 0, 9, 0, 0, 0, 168, +10604, -156, 0, 885, 0, 0, 0, -40, 53, 0, + 438, 0, 897, 0, 892, 0, 0, 0, 596, 0, + 8245, 615,11148, 772,10468, 0, 7500, 0, 419, 0, + 0, 0, 0, 896, 92, 0, 0, 279, 482, -159, + 0, 4111, 900, 0, 135, 168, 0, 136, 0, 0, + 0,11148, 975, 0, 0, 0,11148, 979, 901, 0, + 904, 906, 0,12518, 0, 0, -186, 44, 7029, 0, + 0, 0, 0, 0, 0, 482, 0, 0, -268, 0, + 0, 0, 419, -279, 168, 8421, 0, 907, 0, 908, +11828, 0, 1029, 920, 7029, 0, -300, 0, 240, 0, + 809, 0, 81,11148,11148, 924, 1041, 0, 0, 123, + -80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 759, 759, 86, 86, 344, 344, 344, 344, 574, 574, - 781, 674, 635, 682, 672, 0, -164, -72, 0, 9127, - 1063, 23, 1065, 23, 9127, 9127, 980,11148, 0, 0, - 954, 0, 23, 0, 620, 871, 0, 0, 0, 0, - 578, 440, 265, 0, 8673, 557, 0, 988, 989, 0, - 0, 0, 0, 0, 0, 236, 992, 0, 993, 995, - 0, 0, 0, 0, 997, 8830, 962, 0, 374, 0, - 0, 641, 0,11284, 0, 990, 0, 0, 0, 586, - 155, 1000, 0, 999, 1001, 1002, 0, 0,11148, 0, - 23, 0, 0, 685, 0, 1005, 0, 481, 0, 0, - 6967, 0, 6967, 8499, 0, 4877, 0, 0,10740, 297, - 0, -268, -90, 0, 945, 959, 0, 55, 0, 0, - 1012, 1011, 0, 0, 0, 0, 0, 1013, 0, 0, - 1022, 0, 4493, 0, 474, 0, 0, 495, 517, 969, - 0, 100, 0, 1020, 1021, 0, 0, 6967, 0, 0, - 6967, 0,11148, 0,11148, 8221, 0, 0, 474, 1023, - 474, 0, 0, 0, 0, 0, 0, 0, 0, 9127, - 8221, 0, 0, 23,12518, 1053, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0,10332, - 0, 0, 0, 0, 0, 7752, 0, 9127, 0, 7909, - 1024, 0, 0, 0, 0, 1103, 0, 1105, 0, 0, - 0, 893, 0, 1027, 0, 0, 0, 0, 0, 0, - 984, 0, 82, 0, 0, 0, 0, 557, 557, 0, - 900, 1033, 1035, 991, 1040, 962, 0, 1037, 0, 1157, - 1158, 0, 0,11148, 0,10876, 1041, 586, 8673, 8221, - 0, 0, 345, 1173, 1174, 188, 1051, 0, 0, 0, -11148, 0,11148, 1151, 0, 0, 0, 0, 17,11012, - 0, 0, 0, 0, 8045, 0, 1177, 0, 743,11148, - 1067, 8499, 1068, 0, 0, 23, 0, 196, 0, 0, - 871, 969, 0, 23, 0, -68, 0, 0, 0, 1066, - 0, 1094, 0, 0, 0, 0, 0, 0, 0, 779, - 0, 0, 0, 0, 0, 8516, 0, 0, 23, 544, - 1024, 0, 9127, 0, 9127, 0, 1099, 9127, 0, 0, - 0, 506, 0, 0, 0, 1075, 900, 0, 0,11420, - 0, 0, 0, 1078, 7612, 0, 962, 0, 962, 0, - 962, 0, 0, 0, 0, 23, 1076, 1041, 0, 0, - 0, -169, -162, 1079, 1081, 0, 0, 0, 0, 0, - 1080, 8499, 1024, -72,11148, 0, 1085, 6967, 0, 0, - 0, 0, 0, 0, 1088, 0, 818, 0, 0, 0, - 0, 0, -183, 0, 1087, 871, 969, 0, 969, 0, - 1024, 1091, 0, 0, 474, 0, 1043, 1083, 0, 0, - 0, 0, 0, 9127, 1113, 9127, 9127, 0,11148, 0, - 0, 995, 313, 793, 0, 0, 0, 0, -209, 0, - 0, 0, 1101, 0, 0, 0, 1086, 0, 0, 0, - 548, 0, 1089, 1213, 1215, 0, 0, 1024, 1104, 1024, - 1106, 0, 1096, 0, 0, 0, 0, 0,11148, 0, - 1107, -213, 0, -213, 0, 0, 0, 0, 0, 0, - 474, 0,11148, 8204, 0, 0, 1130, 0, 899, 1108, - 0, 1109, 0, 0,11420, -237, 202, 0, 1110, 1110, - 1110,10876, 1111, 0,11148, 0, 0, 0, 0, 0, - 0, 6967, -124, 0, 0, 7124, 0, 826, 6967, 0, - 1114, 0, 9127, 0, 0, 0, 0, 0,11148, 0, - 0, 440, 1115, 440, 8221, 1144, 1144, 1144, 0, 0, -11148, 0, 6967, 9284, 0, 0, 0, 7124, 0, 0, - 0, 0, 0, 1138, 9127,11148, 0, 440, 1124, 0, - 1077, 908, 0, 0, 1119, 0, 0, 31, 0, 1082, - 0, 1144, 0, 0, 0, 0, 0, 0, 0, 1122, - 1005, 0, 7124, 0, 1156, 0, 1129, 1144, 0, 0, - 1139, 440, 0, 8221, -20, 1141, 0, 1142, 1143, 6967, - 1145, 9127, 0, 0, 0, 0, 1131, 1129, 0, 0, - 0,12124, 159, 440, 0, 0, 0, 1155, 9127, 1146, -11148, 0, 0, 1150, 0, 0, 1140, 0, 0,13148, - 0, 1147, 159, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 619,13148, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1171, 440, 0, 159, - 23, 0, 1155, 0, 0, 1169,12124,12290, 0, 0, - 174, 0, 0, 0,12322, 0, 0, 1175, 0, 0, - 0, 0, 8221, 8221, 397, 8516, 415, 495, 1207, 0, - 236,10238, 0, 1240, 0, 0, 1129, 0, 0, 0, - 1129, 0, 1132, 1134, 0, 8221, -159, 0, 8221, 0, - 1135, 1176, 0, 236, 0, -51,10268, 0, 1179, 1136, - 51, 284, 5309, 0, 0, 1129, 0, 236, 0, 1182, - 1159, 1180, 1181, 0, 1185, 1134, 1188, 202, 1193, 1187, - 0, 0, 1190, 1208, 0, 871, 0, 875, 0, 0, - 0, 1205, 0, -25, 0, 1198, 0, 0, 1211, 0, - 1210, 1212, 1214, 0, 1209, 0, 202, 202, 0, 202, - 1216, 1217, 0, 0, 0, 0, 1219, 211, 0, 1220, - 202, 1331, 1221, 202, 0, 174, 0, 8499, 1170, 1223, - 1209, 0, 1224, 1228, 215, 1231, 0, 0, 202,10876, - 1189, 1230, 1219, 0, 0,13148, 0, 440, 440, 0, - 1191, 1238, 1220, 0, 1243, 0,11148, 1199, 1244, 1221, - 0, 1247, 202, 0, 34, 0, 1235, 0, 0, 0, - 0, 0,13148, 0, 215, 215, 1254, 1253, 0, -25, - 0, 0, 118, 1258,13148, 0,13148, 0, 0, 8499, - 1246, 0, 0, 0, 1259, 1211, 0, 0, 0, 1256, - 0, 278, 0, 0, 0, 1144, 914, 1262, 0, 0, - 0, 0, 0, 0, 0, 0, 1276, 1368, 0, 0, - 0, 0, 0, 0, 1264, 1267, 8499, 0, 0, 0, - 0, 215, 565, 565, 0, 1144, 0, 0, 0, -32, - -32, 0, 0, 0, 0, 0, 0, 0,10468,10468, - 0, 0, 0, 0, 0, 1265, 1268, 1269, 0, 0, - 0, + 775, 775, 84, 84, 280, 280, 280, 280, 559, 559, + 260, 523, 568, 580, 593, 0, -161, -149, 0, 9032, + 1005, 168, 1006, 168, 9032, 9032, 921,11148, 0, 0, + 875, 0, 168, 0, 422, 809, 0, 0, 0, 0, + 481, 215, 31, 0, 8421, 551, 0, 931, 930, 0, + 0, 0, 0, 0, 0, -279, 933, 0, 934, 936, + 0, 0, 0, 0, 938, 8578, 894, 0, 267, 0, + 0, 321, 0,11284, 0, 932, 0, 0, 0, 454, + -47, 942, 0, 941, 943, 944, 0, 0,11148, 0, + 168, 0, 0, 704, 0, 945, 0, 427, 0, 0, + 6872, 0, 6872, 8404, 0, 9503, 0, 0,10740, 151, + 0, 114, -34, 0, 887, 899, 0, 91, 0, 0, + 948, 949, 0, 0, 0, 0, 0, 950, 0, 0, + 958, 0, 4429, 0, 482, 0, 0, 419, 617, 905, + 0, 175, 0, 955, 956, 0, 0, 6872, 0, 0, + 6872, 0,11148, 0,11148, 7831, 0, 0, 482, 959, + 482, 0, 0, 0, 0, 0, 0, 0, 0, 9032, + 7831, 0, 0, 168,12518, 987, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +10332, 0, 0, 0, 0, 0, 7657, 0, 9032, 0, + 7814, 964, 0, 0, 0, 0, 1038, 0, 1039, 0, + 0, 0, 566, 0, 966, 0, 0, 0, 0, 0, + 0, 926, 0, -86, 0, 0, 0, 0, 551, 551, + 0, 821, 976, 974, 937, 981, 894, 0, 977, 0, + 1093, 1095, 0, 0,11148, 0,10876, 980, 454, 8421, + 7831, 0, 0, -233, 1100, 1102, 137, 984, 0, 0, + 0,11148, 0,11148, 1080, 0, 0, 0, 0, 41, +11012, 0, 0, 0, 0, 7950, 0, 1105, 0, 614, +11148, 999, 8404, 1001, 0, 0, 168, 0, 196, 0, + 0, 809, 905, 0, 168, 0, -62, 0, 0, 0, + 995, 0, 1027, 0, 0, 0, 0, 0, 0, 0, + 729, 0, 0, 0, 0, 0, 8126, 0, 0, 168, + 13, 964, 0, 9032, 0, 9032, 0, 1020, 9032, 0, + 0, 0, 584, 0, 0, 0, 1004, 821, 0, 0, +11420, 0, 0, 0, 1007, 4594, 0, 894, 0, 894, + 0, 894, 0, 0, 0, 0, 168, 1000, 980, 0, + 0, 0, -166, -164, 1003, 1008, 0, 0, 0, 0, + 0, 1010, 8404, 964, -149,11148, 0, 1009, 6872, 0, + 0, 0, 0, 0, 0, 1014, 0, 772, 0, 0, + 0, 0, 0, -172, 0, 1015, 809, 905, 0, 905, + 0, 964, 1016, 0, 0, 482, 0, 952, 998, 0, + 0, 0, 0, 0, 9032, 1042, 9032, 9032, 0,11148, + 0, 0, 936, 208, 746, 0, 0, 0, 0, 72, + 0, 0, 0, 1023, 0, 0, 0, 1013, 0, 0, + 0, 428, 0, 1021, 1135, 1140, 0, 0, 964, 1025, + 964, 1037, 0, 1035, 0, 0, 0, 0, 0,11148, + 0, 1046, -153, 0, -153, 0, 0, 0, 0, 0, + 0, 482, 0,11148, 8109, 0, 0, 1068, 0, 760, + 1045, 0, 1048, 0, 0,11420, 108, 144, 0, 1049, + 1049, 1049,10876, 1050, 0,11148, 0, 0, 0, 0, + 0, 0, 6872, -139, 0, 0, 7029, 0, 784, 6872, + 0, 1056, 0, 9032, 0, 0, 0, 0, 0,11148, + 0, 0, 215, 1055, 215, 7831, 1077, 1077, 1077, 0, + 0,11148, 0, 6872, 9189, 0, 0, 0, 7029, 0, + 0, 0, 0, 0, 1082, 9032,11148, 0, 215, 1060, + 0, 1017, 789, 0, 0, 1057, 0, 0, 36, 0, + 1018, 0, 1077, 0, 0, 0, 0, 0, 0, 0, + 1061, 945, 0, 7029, 0, 1089, 0, 1063, 1077, 1184, + 0, 1073, 215, 0, 7831, -105, 1075, 0, 1090, 1092, + 6872, 1076, 9032, 0, 0, 0, 0, 0, 1079, 1063, + 0, 0, 0,12124, 120, 215, 0, 0, 0, 1106, + 9032, 1085,11148, 0, 0, 1094, 0, 0, 1097, 0, + 0,13061, 0, 1098, 120, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 583,13061, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1099, 215, + 0, 120, 168, 0, 1106, 0, 0, 1091,12124,12290, + 0, 0, 20, 0, 0, 0,12322, 0, 0, 1101, + 0, 0, 0, 0, 7831, 7831, 265, 8126, 278, 419, + 1127, 0, -279, 946, 0, 1163, 0, 0, 1063, 0, + 0, 0, 1063, 0, 1052, 1054, 0, 7831, -151, 0, + 7831, 0, 1059, 1103, 0, -279, 0, -45,10251, 0, + 1104, 1062, 73, 506, 3845, 0, 0, 1063, 0, -279, + 0, 1111, 1065, 1110, 1108, 0, 1114, 1054, 1115, 144, + 1107, 1117, 0, 0, 1116, 1128, 0, 809, 0, 795, + 0, 0, 0, 1123, 0, -52, 0, 1121, 0, 0, + 1129, 0, 1125, 1131, 1136, 0, 1133, 0, 144, 144, + 0, 144, 1124, 1138, 0, 0, 0, 0, 1141, 128, + 0, 1142, 144, 1253, 1143, 144, 0, 20, 0, 8404, + 1109, 1144, 1133, 0, 1147, 1149, 130, 1154, 0, 0, + 144,10876, 1112, 1152, 1141, 0, 0,13061, 0, 215, + 215, 0, 1126, 1153, 1142, 0, 1173, 0,11148, 1130, + 1170, 1143, 0, 1175, 144, 0, -96, 0, 1168, 0, + 0, 0, 0, 0,13061, 0, 130, 130, 1145, 1178, + 0, -52, 0, 0, 256, 1157,13061, 0,13061, 0, + 0, 8404, 1171, 0, 0, 0, 1181, 1129, 0, 0, + 0, 1182, 0, 294, 0, 0, 0, 1077, 847, 1185, + 0, 0, 0, 0, 0, 0, 0, 0, 1241, 1295, + 0, 0, 0, 0, 0, 0, 1189, 1193, 8404, 0, + 0, 0, 0, 130, 526, 526, 0, 1077, 0, 0, + 0, 55, 55, 0, 0, 0, 0, 0, 0, 0, +10468,10468, 0, 0, 0, 0, 0, 1197, 1194, 1195, + 0, 0, 0, }; - protected static readonly short [] yyRindex = { 1441, - 0, 0, 7281, 1441, 0, 0, 0, 1642, 0, 0, - 3199, 1301, 0, 0, 0, 0, 0, 3199, 0, 0, - 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, + protected static readonly short [] yyRindex = { 1410, + 0, 0, 7186, 1410, 0, 0, 0, 1568, 0, 0, + 1513, 1341, 0, 0, 0, 0, 0, 1513, 0, 0, + 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1569, 0, 0, 1569, 0, 0, 1568, + 3215, 1788, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1203, 0, 0, 0, 0, 0, 0, 0, 0, + 8735, 0, 1196, 0, 0, 0, 1196, 0, 0, 0, + 0, 0, 0, 197, 0, 0, 0, 0, 0, 0, + 0, 0, 153, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 4587, 0, 0, 0, 0, + 0, 0, 286, 4680, 1796, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1644, 0, 0, 1644, 0, 0, 1642, - 3242, 2018, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1279, 0, 0, 0, 0, 0, 0, 0, 0, - 8987, 0, 1271, 0, 0, 0, 1271, 0, 0, 0, - 0, 0, 0, 267, 0, 0, 0, 0, 0, 0, - 0, 0, 194, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 4716, 0, 0, 0, 0, - 0, 0, 306, 4875, 4086, 0, 0, 4651, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 4836, 4904, + 5144, 5348, 5688, 5892, 6028, 6164, 6300, 6436, 1187, 2889, + 0, 0, 0, 0, 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 5031, 5099, - 1443, 5579, 5919, 679, 6191, 6327, 1837, 6531, 1072, 2873, - 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, + 0, 0, 199, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 3258, 0, + 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 224, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 3322, 0, - 721, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1569, 237, 0, 0, 0, 0, 0, 0, + 0, 3338, 320, 3381, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1644, 146, 0, 0, 0, 0, 0, 0, - 0, 3365, 511, 3408, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3633, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3697, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1205, 0, 0, 0, 0, 0, + 0, 3633, 1202, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2421, + 0, 2931, 420, 2551, 0, 0, 0, 2681, 2551, 0, + 0, 0, 0, 0, 1203, 0, 0, 0, 152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1280, 0, 0, 0, 0, - 0, 0, 3697, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 2405, - 0, 2915, 216, 2535, 0, 0, 0, 2665, 2535, 0, - 0, 0, 0, 0, 1279, 0, 0, 0, -60, 0, + 0, 0, 0, 1199, 2785, 0, 0, 1196, 0, 3633, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1277, 2769, 0, 0, 1271, 0, 3697, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 214, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1605, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3913, 0, 0, 0, 0, 0, + 0, 0, 3424, 3467, 0, 0, 0, 0, 2275, 1569, + 1569, 0, -10, 0, 7517, 1569, 1595, 0, 0, 245, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1604, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 912, 0, 0, 0, 0, - 0, 0, 0, 3451, 3531, 0, 0, 0, 0, 2259, - 1644, 1644, 0, -189, 0, 7769, 1644, 1650, 0, 0, - 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 407,11977, - 0, 0, 0, 0, 3697, 0, 0, 0, 0, 0, - 0, 0, 0,12366, 0, 0, 0, 0, 0, 0, - 0, 710, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 571, 901, 0, 0, 1283, 0, 0, 0, 0, - 0, 20, 0, 0, 4174, 1281, 0, 0, 0, 290, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1781, + 0, 0, 0, 0, 0, 0, 0, 453,11977, 0, + 0, 0, 0, 3633, 0, 0, 0, 0, 0, 0, + 0, 0,12366, 0, 0, 0, 0, 0, 0, 0, + 711, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 604, 693, 0, 0, 1228, 0, 0, 0, 0, 0, + 165, 0, 0, 4110, 1225, 0, 0, 0, 670, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1982, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1277, 0, 0, 6650, 0, 115, 0, - 0, 0, 0, 0, 0, 9441, 0, 0, 0, 0, - 0, 0, -166, 756, 0, 0, 0, 1284, 0, 0, - 0, 0, 0, 0, 0, 3697, 0, 3697, 0, 4333, - 0, 0, 0, 0, -140, 0, 0, 0, 0, 218, - 0, 0, 0, 5203, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1199, 0, 0, 6555, 0, 176, 0, + 0, 0, 0, 0, 0, 9346, 0, 0, 0, 0, + 0, 0, 5, 802, 0, 0, 0, 1227, 0, 0, + 0, 0, 1202, 0, 0, 0, 3633, 0, 3633, 0, + 4269, 0, 0, 0, 0, -191, 0, 0, 0, 0, + 174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 5271, 5375, 5443, 5511, 5647, 5715, 5783, 5851, 5987, 6055, - 6123, 6259, 6395, 6463, 6587, 0, 0, 670, 0, 0, + 5008, 5076, 5212, 5280, 5416, 5484, 5552, 5620, 5756, 5824, + 5960, 6096, 6232, 6368, 6492, 0, 0, 675, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 912, 0, 0, 0, 0, 2259, 0, 0, 0, 0, - 1234, 9645, 0, 0, 0, 9144, 0, 0, 814, 0, - 0, 0, 0, 0, 0, 700, 469, 0, 0, 1285, - 0, 0, 0, 0, 1290, 0, 0, 0, 0, 0, - 0,11556, 0, 0, 0, 823, 0, 0, 0, 9301, -12442, 0, 0, 828, 833, 839, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 733, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1292, 0, 0, 0, 3763, - 0, 0, 143, 0, 181, 3856, 0, 0, 0, 0, - 0, 1286, 0, 0, 0, 0, 0, 1293, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 254, 727, 0, - 0, 0, 0, 0, 1294, 0, 0, 0, 0, 0, + 3913, 0, 0, 0, 0, 2275, 0, 0, 0, 0, + 1183, 9694, 0, 0, 0, 8892, 0, 0, 755, 0, + 0, 0, 0, 0, 0, 683, 698, 0, 0, 1230, + 0, 0, 0, 0, 1236, 0, 0, 0, 0, 0, + 0,11556, 0, 0, 0, 758, 0, 0, 0, 9049, +12442, 0, 0, 759, 766, 796, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 722, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1238, 0, 0, 0, 3699, + 0, 0, 177, 0, 98, 3792, 0, 0, 0, 0, + 0, 1232, 0, 0, 0, 0, 0, 1239, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -51, 676, 0, + 0, 0, 0, 0, 1237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 9441, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 9346, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 570, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -179, 0, 477, 0, 0, 0, 0, 0, 0, - 0, 0, -189, 0, 0, 0, 0, 9301, 7926, 0, - 1295, 0, 737, 0, 0, 0, 0, 1297, 0, 1249, - 1250, 0, 0, 0, 0, 0, 1296,12631, 0, 0, - 0, 0,12474, 0, 0, 0, 841, 0, 0, 0, - 0, 0, 0, 2133, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 4015, 0, - 4492, 1303, 0, 0, 0, 1302, 0, 0, 0, 0, - 252, 0, 0, 0, 0, 841, 0, 0, 0, 0, + 0, 567, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -181, 0, 472, 0, 0, 0, 0, 0, + 0, 0, 0, -10, 0, 0, 0, 0, 9049, 7674, + 0, 1240, 0, 700, 0, 0, 0, 0, 1244, 0, + 1201, 1206, 0, 0, 0, 0, 0, 1245, 9206, 0, + 0, 0, 0,12474, 0, 0, 0, 798, 0, 0, + 0, 0, 0, 0, 2149, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3951, + 0, 4428, 1246, 0, 0, 0, 1243, 0, 0, 0, + 0, 333, 0, 0, 0, 0, 798, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 684, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 844, + 0, 657, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1299, 0, 0, - 0, 0, 0, 847, 850, 0, 0, 0, 0, 0, - 0, 0, 1305, 665, 1304, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4174, 0, 0, 0, - 0, 0, 1313, 0, 0, 252, 0, 0, 919, 0, - 1305, 0, 0, 0, 9441, 0, 634, 639, 0, 0, + 807, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1247, 0, + 0, 0, 0, 0, 814, 820, 0, 0, 0, 0, + 0, 0, 0, 1248, 608, 1250, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 4110, 0, 0, + 0, 0, 0, 1249, 0, 0, 333, 0, 0, 846, + 0, 1248, 0, 0, 0, 9346, 0, 643, 654, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1285, 9491, 0, 0, 0, 0, 0,12682, 0, + 0, 0, 1230, 9540, 0, 0, 0, 0, 0,12605, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 711, 0, 719, 0, 0, 0, 0, 1310, 0, 738, - 1307, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1317, 0, 7438, 0, 0, 0, 0, 0, 0, - 9441, 0, 0, 0, 0, 0, 0, 0, -167, 552, - 0, 0, 0, 0, 0,12725,12366, 0, 447, 447, - 447, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 630, 0, 737, 0, 0, 0, 0, 1255, 0, + 736, 1252, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1261, 0, 7343, 0, 0, 0, 0, 0, + 0, 9346, 0, 0, 0, 0, 0, 0, 0, -154, + 484, 0, 0, 0, 0, 0,12681,12366, 0, 218, + 218, 218, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,12811, 0, -293, 0, 1306, 1306, 1306, 0, 0, - 0, 0, 0, 1315, 0, 0, 0, -146, 0, 0, - 0, 0, 0, 0, 0, 0, 0,12854, 0, 0, - 0, 9948, 0, 0, 1320, 0, 0, 465, 0, 0, - 0, 583, 0, 0, 0, 0, 0, 0, 0, 0, - 1318, 0, 1321, 0, 0, 0, 3156, 1316, 542, 0, - 0, 299, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3073, 0, 0, - 0, 0, 9750,10034, 0, 0, 0, 569, 0, 0, - 0, 0, 0, 0, 0, 0, 446, 0, 0,12148, - 0, 0, 9849, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0,12216, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0,10128, 0, 9750, - 0, 0, 569, 0, 0, 0, 0, 407, 0, 0, - 0, 0, 0, 0, 407, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 4648, 423, 0, -10170, 0, 0, 0, 5005, 0, 3073, 0, 0, 0, - 3073, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 237, 0, 1324, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3073, 0, 669, 0, 640, - 0, 0, 0, 0, 0, 0, 0,12366, 864, 0, - 0, 0, 0, 0, 0, 1289, 0, 131, 0, 0, - 0, 0, 0, 0, 0, 865, 0, 0, 0, 0, - 0, 0, 0, 0, 1325, 0,12366,12366, 0,12398, - 0, 0, 0, 0, 0, 0, 1328,13078, 0, 1329, -12366,11692, 1330,12366, 0, 0, 0, 0, 0, 0, - 1332, 0, 0, 0,13048, 0, 0, 0,12366, 0, - 0, 0, 1333, 0, 0, 320, 0,12972,13010, 0, - 0, 0, 1334, 0, 0, 0, 0, 0, 0, 1335, - 0, 0,12366, 0, 621, 0, 868, 0, 0, 0, - 0, 0, 931, 0,12896,12934, 0, 0, 0, 0, - 0, 0, 0, 0, 1378, 0, 1433, 0, 0, 0, - 869, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 623, 0, 0, 0, 0, + 0, 0,12724, 0, -285, 0, 1263, 1263, 1263, 0, + 0, 0, 0, 0, 1259, 0, 0, 0, -182, 0, + 0, 0, 0, 0, 0, 0, 0, 0,12767, 0, + 0, 0, 9997, 0, 0, 1264, 0, 0, 369, 0, + 0, 0, 533, 0, 0, 0, 0, 0, 0, 0, + 0, 1262, 0, 1267, 0, 0, 0, 3172, 1260, 537, + 0, 0, -269, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3089, + 0, 0, 0, 0, 9799,10083, 0, 0, 0, 642, + 0, 0, 0, 0, 0, 0, 0, 0, 478, 0, + 0,12148, 0, 0, 9898, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,12216, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,10177, + 0, 9799, 0, 0, 642, 0, 0, 0, 0, 453, + 0, 0, 0, 0, 0, 0, 453, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1096, + 457, 0,10219, 0, 0, 0, 4810, 0, 3089, 0, + 0, 0, 3089, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 271, 0, 1272, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 3089, 0, 543, + 0, 494, 0, 0, 0, 0, 0, 0, 0,12366, + 819, 0, 0, 0, 0, 0, 0, 1235, 0, 516, + 0, 0, 0, 0, 0, 0, 0, 824, 0, 0, + 0, 0, 0, 0, 0, 0, 1265, 0,12366,12366, + 0,12398, 0, 0, 0, 0, 0, 0, 1268,12991, + 0, 1269,12366,11692, 1270,12366, 0, 0, 0, 0, + 0, 0, 1271, 0, 0, 0,12961, 0, 0, 0, +12366, 0, 0, 0, 1273, 0, 0, 378, 0,12885, +12923, 0, 0, 0, 1278, 0, 0, 0, 0, 0, + 0, 1279, 0, 0,12366, 0, 664, 0, 825, 0, + 0, 0, 0, 0, 861, 0,12809,12847, 0, 0, + 0, 0, 0, 0, 0, 0, 1325, 0, 1393, 0, + 0, 0, 829, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 571, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,13048,11864,12768, 0, 623, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1281, 1281, + 0, 0, 0,12961, 9534,11864, 0, 571, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, + 1225, 1225, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, }; protected static readonly short [] yyGindex = { 0, - 0, 1657, 0, 0, 0, -1, -16, -181, -41, -42, - 0, 1688, 1707, 708, 0, 3, 0, 0, 0, 0, - 0, -875, -691, -219, -474, 0, 0, 0, 0, 0, - -210, 0, 0, 0, 762, 0, 870, 0, 0, 0, - 0, 618, 622, -17, -217, 0, -46, 0, 454, 0, - 473,-1129, -820, -656, -570, -542, -477, -471, -470, 0, --1024,-1169, 0, 13, 0, 204, 0,-1094, 0, 0, - 0, -70, 280, 0, 0, 0, 318,-1068, 0, -273, - -292, 1046, 0, 0, 0, -897, 260, 0, 0, -512, - 0, 0, 332, 0, 0, 304, 0, 0, 339, 0, - -481, -816, 0, 0, 0, 0, 0, 434, -13, 0, - 0, 866, 867, 872, 1044, -529, 0, 0, -317, 873, - 432, 0, -880, 0, 0, 0, 0, 0, 0, 0, - 0, 238, 0, 0, 0, 0, 0, 0, 0, 0, - 486, 0, 0, 0, 0, -311, 422, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 500, 0, -515, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, - 0, 334, 0, 0, 340, 348, 257, 0, 0, 0, - 0, 0, 0, 0, 0, 561, 0, 0, 0, 0, - -54, 0, 401, -180, 0, 0, 409, 0, 466, 0, - 926, 0, 1239, -295, -266, -63, 1100, 0, 568, 0, - -33, 11, 0, 0, 10, 0, 0, 0, 0, 0, + 0, 1607, 0, 0, 0, 2, -16, -180, -48, -43, + 0, 1647, 1655, 101, 0, 4, 0, 0, 0, 0, + 0,-1020, -693, -215, -482, 0, 0, 0, 0, 0, + -224, 0, 0, 0, 703, 0, 811, 0, 0, 0, + 0, 560, 563, -17, -226, 0, -46, 0, 393, 0, + 430, -573, -569, -553, -471, -469, -462, -444, -435, 0, +-1042,-1171, 0, 1, 0, 129, 0,-1095, 0, 0, + 0, -44, 220, 0, 0, 0, 258,-1073, 0, -273, + -293, 992, 0, 0, 0, -899, 212, 0, 0, -501, + 0, 0, 281, 0, 0, 249, 0, 0, 287, 0, + -579, -976, 0, 0, 0, 0, 0, 382, -13, 0, + 0, 815, 816, 822, 988, -528, 0, 0, -321, 823, + 377, 0,-1327, 0, 0, 0, 0, 0, 0, 0, + 0, 182, 0, 0, 0, 0, 0, 0, 0, 0, + 432, 0, 0, 0, 0, -335, 362, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 441, 0, -514, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 201, 0, + 0, 288, 0, 0, 283, 285, 210, 0, 0, 0, + 0, 0, 0, 0, 0, 511, 0, 0, 0, 0, + -39, 0, 552, -173, 0, 0, 364, 0, 421, 0, + 882, 0, 1204, -286, -265, -56, 947, 0, 524, 0, + -30, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -260, 0, 1242, 0, -335, 0, -767, 0, 0, - 0, 878, 0, -298, -130, 1055, 0, 964, 0, 1184, - 1406, 1112, 0, 0, 778, 1717, 0, 0, 0, 0, - 1074, 0, 0, 0, 0, 0, -425, 1466, 0, 0, - 0, 0, 0, 1133, 534, 905, 776, 906, 1402, 1403, - 1405, 1409, 1401, 0, 1404, 0, -489, 0, 0, 1019, - 1266, -718, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -290, 0, 0, 0, 0, -450, 0, 626, - 0, 539, 0, 629, 0, 0, 0, 698, -526, -3, - -314, -2, 0, 1672, 0, 62, 0, 63, 85, 101, - 110, 111, 114, 136, 142, 164, 170, 0, -672, 0, - 8, 0, 0, 836, 0, 761, 0, 0, 0, 0, - 740, -258, 815, -858, 0, 857, -463, 0, 0, 0, - 0, 0, 0, 764, 0, 0, 766, 0, 0, 0, + 0, -256, 0, 367, 0, -333, 0, -773, 0, 0, + 0, 832, 0, -296, -126, 1012, 0, 917, 0, 1155, + 1368, 1053, 0, 0, 731, 1678, 0, 0, 0, 0, + 1028, 0, 0, 0, 0, 0, -506, 1416, 0, 0, + 0, 0, 0, 1190, 855, 845, 748, 852, 1356, 1358, + 1355, 1357, 1359, 0, 1360, 0, -611, 0, 0, 968, + 1207, -714, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -298, 0, 0, 0, 0, -458, 0, 585, + 0, 487, 0, 573, 0, 0, 0, 646, -534, -5, + -313, -3, 0, 1618, 0, 68, 0, 70, 74, 99, + 125, 142, 149, 156, 157, 163, 171, 0, -674, 0, + -7, 0, 0, 782, 0, 707, 0, 0, 0, 0, + 685, -322, 762, -863, 0, 803, -461, 0, 0, 0, + 0, 0, 0, 708, 0, 0, 701, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 691, 0, 0, 0, 0, 0, 0, 0, - 0, 14, 0, 1319, 0, 0, 0, 932, 0, 0, - 0, 0, 0, 0, -176, 0, 0, 0, 0, 0, - 1422, 1200, 0, 0, 0, 1427, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 581, 0, 0, 0, 0, - 0, 0, 0, 0, 689, 0, 0, 0, 0, 0, - 0, -7, 1008, 0, 0, 0, 1010, + 0, 0, 634, 0, 0, 0, 0, 0, 0, 0, + 0, -27, 0, 1274, 0, 0, 0, 876, 0, 0, + 0, 0, 0, 0, -168, 0, 0, 0, 0, 0, + 1374, 1150, 0, 0, 0, 1376, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 517, 0, 0, 0, 0, + 0, 0, 0, 0, 636, 0, 0, 0, 0, 0, + 0, 64, 957, 0, 0, 0, 962, }; protected static readonly short [] yyTable = { 109, - 741, 189, 18, 111, 522, 747, 519, 434, 234, 233, - 437, 433, 452, 155, 156, 495, 326, 331, 43, 690, - 319, 293, 192, 473, 562, 257, 407, 115, 712, 477, - 538, 515, 786, 549, 600, 503, 576, 356, 1027, 229, - 325, 330, 577, 1149, 251, 337, 794, 957, 884, 364, - 885, 372, 1184, 1185, 1079, 304, 903, 799, 363, 304, - 371, 544, 923, 14, 190, 312, 259, 314, 258, 115, - 1278, 686, 1078, 115, 316, 687, 941, 340, 160, 161, - 783, 782, 1032, 683, 1079, 717, 1060, 1285, 944, 365, - 311, 817, 673, 1062, 1259, 915, 1343, 20, 917, 891, - 564, 162, 258, 1216, 47, 414, 258, 258, 258, 258, - 258, 258, 258, 258, 815, 629, 47, 163, 674, 1173, - 791, 797, 1001, 260, 47, 409, 164, 165, 441, 442, - 166, 1156, 289, 1010, 361, 845, 688, 16, 1259, 109, - 290, 784, 437, 111, 639, 351, 435, 233, 2, 6, - 675, 477, 167, 155, 156, 829, 830, 565, 168, 941, - 892, 1, 792, 318, 941, 894, 941, 115, 349, 941, - 941, 944, 941, 941, 437, 448, 944, 1173, 944, 585, - 169, 944, 944, 819, 944, 944, 170, 1020, 415, 435, - 451, 483, 291, 416, 941, 417, 365, 720, 418, 419, - 478, 420, 421, 365, 1351, 365, 944, 365, 1080, 1032, - 818, 886, 482, 735, 452, 443, 350, 493, 160, 161, - 761, 797, 739, 1521, 473, 15, 191, 291, 47, 476, - 1385, 629, 816, 629, 481, 1221, 576, 524, 1080, 351, - 449, 162, 577, 261, 562, 684, 1453, 292, 1061, 941, - 1157, 365, 257, 352, 676, 1063, 537, 163, 1344, 657, - 541, 944, 257, 2, 577, 546, 164, 165, 42, 562, - 166, 494, 898, 1477, 545, 797, 498, 500, 422, 543, - 568, 335, 292, 895, 548, 1487, 1203, 1488, 629, 1471, - 1143, 525, 167, 491, 691, 258, 115, 533, 168, 535, - 924, 805, 534, 498, 957, 258, 1092, 687, 820, 48, - 898, 258, 992, 721, 511, 551, 552, 619, 620, 1352, - 169, 1215, 478, 478, 536, 1075, 170, 115, 934, 3, - 4, 5, 6, 54, 94, 561, 563, 660, 722, 982, - 304, 1449, 1232, 1522, 412, 642, 644, 388, 846, 115, - 1102, 476, 597, 577, 1222, 1386, 605, 606, 607, 608, - 609, 610, 611, 612, 613, 614, 615, 291, 687, 641, - 643, 583, 1130, 647, 761, 1357, 199, 750, 767, 20, - 1484, 1498, 258, 389, 999, 291, 351, 440, 637, 1011, - 900, 435, 233, 437, 258, 258, 258, 413, 1317, 258, - 258, 351, 661, 1260, 1204, 801, 6, 803, 1472, 804, - 871, 1518, 508, 357, 1239, 806, 509, 996, 876, 694, - 194, 642, 292, 336, 899, 512, 642, 513, 900, 249, - 642, 1334, 1485, 658, 659, 1335, 957, 770, 655, 671, - 292, 701, 414, 990, 710, 642, 718, 1260, 440, 1155, - 231, 473, 677, 1033, 723, 1035, 1162, 698, 1038, 746, - 1363, 358, 291, 390, 391, 503, 1415, 486, 1358, 478, - 1442, 708, 642, 196, 930, 838, 477, 576, 250, 1067, - 1187, 514, 688, 577, 351, 760, 1018, 194, 194, 769, - 473, 642, 341, 751, 768, 437, 737, 351, 597, 711, - 745, 351, 115, 336, 351, 488, 351, 746, 194, 745, - 441, 351, 351, 489, 752, 754, 351, 911, 351, 351, - 351, 351, 359, 231, 772, 415, 351, 231, 793, 774, - 416, 1373, 417, 1494, 759, 418, 419, 1226, 420, 421, - 94, 1495, 699, 688, 1095, 363, 1097, 1098, 957, 1308, - 980, 487, 787, 771, 957, 561, 563, 577, 291, 991, - 1403, 1404, 812, 1406, 1479, 1480, 490, 1261, 746, 115, - 231, 441, 336, 975, 1425, 807, 807, 1432, 336, 231, - 561, 563, 642, 231, 336, 452, 734, 336, 336, 453, - 258, 1087, 1448, 1088, 115, 826, 735, 828, 932, 194, - 194, 336, 1496, 341, 896, 249, 836, 341, 336, 336, - 115, 1261, 115, 1016, 94, 432, 1470, 115, 249, 813, - 336, 1512, 823, 336, 336, 358, 350, 823, 823, 741, - 832, 786, 1006, 336, 642, 741, 745, 336, 843, 349, - 522, 734, 452, 1164, 245, 859, 453, 478, 246, 351, - 94, 341, 1315, 1262, 250, 349, 363, 363, 363, 1359, - 363, 363, 194, 363, 878, 363, 318, 250, 329, 860, - 1318, 358, 745, 349, 329, 1195, 476, 890, 640, 586, - 844, 1263, 906, 649, 741, 984, 200, 350, 194, 587, - 712, 498, 257, 1103, 641, 541, 861, 1262, 247, 858, - 194, 1316, 640, 350, 1071, 920, 745, 363, 194, 363, - 351, 737, 363, 231, 739, 912, 47, 724, 641, 1319, - 925, 350, 1228, 329, 352, 1263, 351, 350, 197, 640, - 657, 115, 935, 115, 1068, 258, 882, 392, 393, 1273, - 352, 907, 1048, 528, 351, 641, 1264, 926, 1241, 1258, - 351, 194, 1265, 1266, 194, 918, 351, 919, 352, 197, - 755, 414, 1068, 478, 352, 921, 415, 787, 1241, 478, - 800, 416, 823, 417, 883, 1040, 418, 419, 115, 420, - 421, 115, 642, 244, 668, 661, 350, 642, 194, 194, - 1264, 642, 597, 1258, 436, 1241, 1265, 1266, 597, 983, - 823, 661, 745, 662, 350, 1123, 642, 937, 231, 351, - 693, 562, 668, 661, 694, 935, 194, 194, 361, 975, - 935, 668, 935, 352, 931, 935, 935, 351, 935, 935, - 701, 662, 1339, 642, 362, 838, 194, 263, 64, 64, - 94, 1152, 64, 562, 415, 1353, 972, 318, 494, 416, - 194, 417, 642, 677, 418, 419, 650, 420, 421, 1014, - 248, 1017, 570, 404, 1371, 997, 527, 1019, 964, 571, - 361, 839, 1000, 361, 351, 405, 690, 1186, 562, 528, - 318, 572, 1008, 840, 745, 1436, 438, 1048, 802, 908, - 937, 570, 1028, 868, 1052, 937, 529, 937, 571, 318, - 937, 937, 318, 937, 937, 935, 604, 931, 332, 321, - 572, 1029, 931, 478, 931, 321, 1113, 931, 931, 1030, - 931, 931, 322, 621, 622, 823, 588, 823, 1114, 1057, - 823, 94, 762, 360, 575, 727, 589, 757, 500, 728, - 1214, 336, 1047, 336, 500, 757, 862, 1489, 452, 665, - 249, 373, 365, 863, 194, 394, 395, 1275, 665, 677, - 1168, 473, 336, 336, 736, 296, 1305, 297, 509, 396, - 397, 366, 367, 1305, 745, 438, 194, 498, 439, 1054, - 937, 1055, 336, 1056, 1509, 1159, 1160, 270, 270, 664, - 336, 368, 438, 336, 1282, 837, 270, 931, 664, 250, - 522, 774, 369, 1527, 1528, 774, 763, 774, 115, 774, - 763, 787, 763, 280, 763, 280, 823, 575, 823, 823, - 280, 1099, 575, 401, 575, 575, 575, 575, 575, 575, - 575, 575, 575, 575, 575, 341, 753, 753, 753, 341, - 753, 336, 341, 753, 341, 753, 575, 1106, 575, 341, - 575, 758, 575, 575, 575, 758, 879, 400, 478, 758, - 880, 494, 575, 575, 701, 194, 402, 575, 575, 336, - 336, 403, 336, 336, 56, 1131, 745, 787, 575, 575, - 168, 822, 168, 341, 168, 822, 194, 1047, 181, 1142, - 181, 575, 181, 336, 494, 329, 336, 494, 329, 435, - 233, 1172, 1171, 406, 826, 44, 65, 575, 826, 757, - 65, 297, 336, 757, 440, 823, 113, 975, 336, 225, - 437, 1167, 561, 563, 336, 435, 233, 605, 336, 605, - 472, 231, 115, 494, 444, 225, 115, 226, 225, 115, - 228, 336, 447, 1350, 385, 386, 387, 823, 1099, 474, - 1026, 1236, 816, 194, 561, 563, 475, 1350, 113, 1172, - 1171, 335, 113, 115, 1104, 496, 1105, 947, 115, 625, - 626, 627, 628, 336, 497, 1381, 194, 1382, 398, 399, - 1172, 1240, 1257, 977, 518, 977, 329, 329, 362, 561, - 563, 194, 1159, 1160, 823, 194, 765, 156, 765, 156, - 1172, 1240, 163, 115, 163, 523, 1236, 329, 164, 526, - 164, 823, 888, 494, 888, 67, 187, 67, 187, 157, - 115, 157, 1313, 1314, 1289, 338, 1257, 1172, 1240, 341, - 342, 343, 344, 345, 346, 347, 348, 120, 285, 120, - 285, 127, 292, 127, 292, 1342, 949, 950, 1345, 542, - 947, 194, 1135, 1136, 547, 947, 113, 947, 947, 947, - 947, 947, 947, 947, 947, 947, 947, 1310, 501, 194, - 194, 414, 555, 414, 501, 1200, 231, 1499, 1500, 947, - 581, 947, 582, 947, 351, 947, 947, 947, 351, 444, - 524, 524, 414, 414, 642, 642, 623, 624, 329, 329, - 34, 590, 262, 629, 630, 701, 286, 287, 288, 653, - 294, 295, 414, 1147, 1148, 308, 309, 355, 1360, 656, - 414, 672, 315, 414, 317, 692, 321, 585, 695, 697, - 719, 333, 334, 725, 701, 701, 194, 701, 726, 749, - 947, 766, 773, 775, 776, 777, 1416, 778, 701, 796, - 795, 701, 810, 811, 798, 370, 825, 194, 827, 847, - 831, 329, 848, 1443, 438, 194, 701, 850, 851, 854, - 866, 872, 873, 196, 874, 875, 1455, 1457, 881, 42, - 745, 897, 1310, 901, 816, 113, 902, 329, 904, 909, - 701, 913, 494, 914, 922, 928, 944, 939, 946, 329, - 951, 953, 959, 1443, 1443, 960, 963, 329, 962, 1465, - 585, 965, 968, 970, 976, 585, 113, 585, 585, 585, - 585, 585, 585, 585, 585, 585, 585, 585, 988, 989, - 998, 992, 1005, 512, 338, 1012, 1024, 1023, 113, 585, - 33, 585, 745, 585, 1041, 585, 585, 585, 1050, 1037, - 329, 1058, 1064, 329, 1065, 1066, 1074, 1076, 1086, 1096, - 1443, 585, 1090, 1094, 550, 1093, 1112, 1108, 1116, 1115, - 1117, 1121, 478, 478, 1124, 1118, 1134, 1120, 1138, 745, - 1150, 1137, 1180, 1163, 1145, 1194, 1170, 329, 329, 1514, - 1514, 1197, 1202, 1210, 1199, 315, 1523, 1523, 370, 1205, - 585, 597, 597, 1213, 1214, 550, 1218, 1223, 1224, 1225, - 1271, 1231, 1227, 1277, 1279, 329, 329, 616, 617, 618, - 1276, 1274, 550, 550, 550, 550, 550, 550, 550, 550, - 550, 550, 550, 550, 550, 550, 550, 550, 1286, 516, - 1291, 374, 1312, 1320, 1333, 194, 1348, 1355, 1365, 1337, - 1367, 1338, 1347, 1356, 532, 1370, 1368, 34, 1372, 1376, - 1378, 34, 375, 376, 377, 378, 379, 380, 381, 382, - 383, 384, 34, 1374, 1379, 1384, 1358, 34, 1389, 1392, - 1395, 34, 1399, 1396, 34, 1397, 1426, 1437, 1407, 1408, - 1485, 113, 1411, 1421, 1428, 1440, 34, 34, 1438, 1441, - 1447, 34, 34, 505, 194, 1451, 1450, 34, 1461, 34, - 34, 34, 34, 1462, 1464, 1475, 1466, 34, 1469, 1467, - 1481, 34, 194, 34, 1482, 1486, 1490, 1493, 1491, 1501, - 1484, 329, 1529, 34, 1507, 34, 34, 1508, 34, 1530, - 1531, 9, 34, 973, 550, 537, 858, 495, 606, 965, - 496, 676, 452, 329, 29, 607, 21, 453, 113, 494, - 29, 336, 34, 313, 30, 520, 208, 96, 34, 34, - 30, 767, 664, 866, 768, 329, 759, 194, 194, 827, - 791, 760, 828, 113, 792, 194, 829, 317, 687, 831, - 343, 664, 642, 194, 194, 642, 194, 33, 564, 53, - 123, 33, 1330, 105, 288, 130, 230, 124, 106, 289, - 131, 21, 33, 797, 1330, 1280, 194, 33, 1042, 194, - 958, 33, 1140, 1288, 33, 1492, 1141, 1330, 709, 1483, - 1452, 856, 1439, 1468, 1434, 1327, 33, 33, 985, 986, - 981, 33, 33, 869, 987, 1340, 1330, 33, 1525, 33, - 33, 33, 33, 1287, 1362, 1284, 1463, 33, 1458, 1517, - 1516, 33, 1219, 33, 329, 1456, 1383, 1331, 954, 753, - 763, 1220, 1004, 33, 592, 33, 33, 809, 33, 933, - 860, 564, 33, 889, 1077, 329, 564, 299, 564, 564, - 564, 564, 564, 564, 564, 564, 564, 564, 564, 887, - 553, 631, 33, 632, 635, 865, 633, 1207, 636, 33, - 564, 634, 564, 927, 564, 1292, 564, 564, 564, 780, - 113, 1211, 113, 1158, 564, 564, 564, 564, 408, 1070, - 1119, 564, 564, 1132, 1059, 1089, 564, 564, 564, 564, - 564, 564, 564, 564, 1191, 1125, 651, 1021, 756, 1127, - 835, 652, 329, 1290, 1196, 564, 956, 955, 0, 505, - 0, 0, 0, 0, 505, 505, 0, 113, 0, 0, - 113, 564, 0, 0, 0, 329, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 505, 0, 0, - 329, 0, 0, 0, 329, 0, 0, 0, 0, 0, - 505, 505, 0, 0, 0, 505, 0, 0, 505, 0, - 505, 0, 505, 505, 505, 505, 0, 0, 0, 0, - 505, 0, 0, 0, 505, 0, 0, 0, 505, 0, - 0, 0, 0, 0, 0, 0, 505, 0, 0, 505, - 0, 505, 505, 0, 0, 0, 0, 505, 0, 505, - 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, - 0, 0, 0, 0, 0, 505, 505, 0, 329, 329, - 505, 505, 0, 505, 505, 505, 505, 505, 505, 505, - 0, 505, 505, 0, 505, 505, 505, 505, 505, 505, - 505, 505, 505, 505, 0, 505, 505, 505, 505, 505, - 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, - 505, 505, 505, 505, 505, 505, 505, 32, 0, 505, - 0, 505, 0, 505, 0, 0, 505, 550, 0, 0, - 0, 0, 505, 0, 0, 329, 860, 860, 0, 0, - 0, 0, 0, 0, 860, 860, 860, 860, 860, 0, - 860, 860, 0, 860, 860, 860, 860, 860, 860, 860, - 860, 0, 0, 0, 329, 860, 0, 860, 860, 860, - 860, 860, 860, 0, 0, 860, 0, 0, 0, 860, - 860, 0, 860, 860, 860, 0, 0, 0, 0, 0, - 0, 0, 581, 0, 860, 0, 860, 113, 860, 860, - 0, 0, 860, 0, 860, 860, 860, 860, 860, 860, - 860, 860, 860, 860, 860, 860, 0, 860, 0, 0, - 860, 860, 0, 0, 860, 860, 0, 0, 0, 0, - 0, 0, 785, 0, 0, 0, 0, 0, 0, 860, - 860, 860, 860, 860, 0, 0, 0, 860, 860, 0, - 0, 860, 0, 0, 0, 0, 860, 860, 860, 860, - 860, 0, 0, 0, 860, 0, 860, 0, 0, 0, - 0, 0, 860, 860, 0, 581, 0, 0, 0, 0, - 581, 0, 581, 581, 581, 581, 581, 581, 581, 581, - 581, 581, 581, 0, 0, 0, 0, 860, 860, 860, - 860, 0, 860, 0, 581, 0, 581, 0, 581, 860, - 581, 581, 581, 0, 0, 0, 0, 0, 0, 0, - 0, 113, 0, 0, 0, 113, 581, 0, 113, 0, - 0, 0, 0, 0, 0, 0, 581, 581, 0, 0, - 0, 0, 0, 0, 329, 0, 0, 0, 0, 581, - 0, 0, 113, 0, 0, 0, 0, 113, 336, 0, - 0, 0, 0, 0, 0, 581, 0, 0, 0, 0, - 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, - 0, 0, 113, 0, 32, 0, 0, 0, 32, 0, - 0, 32, 0, 329, 0, 0, 0, 0, 0, 113, - 0, 0, 0, 32, 32, 0, 0, 0, 32, 32, - 0, 329, 0, 0, 32, 0, 32, 32, 32, 32, + 741, 189, 233, 111, 518, 18, 43, 234, 433, 472, + 690, 155, 521, 156, 494, 747, 451, 436, 577, 432, + 476, 292, 538, 192, 786, 562, 115, 319, 257, 712, + 406, 514, 576, 830, 831, 549, 601, 1028, 502, 1150, + 325, 330, 326, 331, 251, 337, 885, 794, 886, 311, + 800, 258, 1185, 1186, 904, 303, 364, 959, 372, 310, + 335, 14, 544, 356, 629, 312, 924, 314, 115, 782, + 1280, 673, 115, 363, 943, 371, 190, 340, 1033, 485, + 20, 683, 316, 1079, 160, 797, 161, 1287, 1, 1061, + 162, 1063, 259, 916, 818, 1080, 918, 674, 318, 717, + 487, 946, 1174, 1217, 1345, 791, 820, 985, 488, 528, + 229, 350, 403, 351, 1080, 163, 1157, 1002, 507, 1481, + 1482, 197, 508, 587, 404, 408, 755, 801, 1011, 675, + 288, 1144, 47, 588, 351, 231, 846, 510, 289, 109, + 233, 164, 476, 111, 639, 434, 290, 792, 47, 436, + 1223, 155, 197, 156, 440, 441, 349, 943, 165, 1473, + 1174, 489, 943, 486, 943, 166, 115, 943, 943, 660, + 943, 943, 167, 168, 196, 816, 1514, 1216, 925, 169, + 629, 436, 629, 450, 946, 797, 586, 170, 434, 946, + 2, 946, 943, 1021, 946, 946, 761, 946, 946, 1234, + 477, 291, 336, 1387, 350, 1033, 290, 935, 872, 472, + 1353, 481, 260, 819, 735, 720, 482, 451, 577, 946, + 739, 895, 887, 15, 160, 290, 161, 351, 448, 475, + 162, 821, 576, 676, 480, 1158, 352, 629, 191, 797, + 577, 352, 492, 684, 6, 562, 1455, 943, 511, 1081, + 512, 1062, 249, 1064, 257, 163, 3, 4, 5, 6, + 366, 291, 524, 537, 257, 657, 1346, 541, 1081, 1224, + 493, 562, 546, 1479, 946, 497, 499, 490, 1474, 543, + 291, 164, 231, 47, 548, 1489, 442, 1490, 1336, 545, + 525, 1204, 1337, 817, 115, 47, 899, 533, 165, 535, + 691, 250, 534, 497, 513, 166, 568, 16, 722, 536, + 1523, 1093, 167, 168, 959, 551, 552, 1365, 993, 169, + 359, 231, 477, 477, 1076, 1354, 115, 170, 1388, 577, + 584, 721, 1034, 561, 1036, 563, 806, 1039, 1451, 896, + 583, 983, 619, 620, 847, 387, 899, 750, 115, 1103, + 761, 475, 598, 959, 54, 605, 606, 607, 608, 609, + 610, 611, 612, 613, 614, 615, 359, 366, 641, 643, + 642, 644, 647, 1375, 366, 1241, 366, 1131, 366, 249, + 1030, 388, 1500, 1417, 233, 1444, 94, 637, 1031, 434, + 767, 770, 991, 447, 661, 1310, 357, 1359, 1319, 698, + 436, 1012, 1405, 1406, 844, 1408, 1019, 47, 1000, 1205, + 877, 783, 1520, 802, 901, 804, 1427, 805, 746, 1434, + 997, 94, 366, 1096, 723, 1098, 1099, 261, 250, 2, + 1524, 285, 286, 287, 1450, 293, 294, 472, 655, 701, + 307, 308, 20, 710, 358, 718, 845, 315, 1156, 317, + 807, 321, 677, 564, 694, 1163, 333, 334, 1472, 577, + 900, 389, 390, 751, 901, 959, 746, 476, 477, 502, + 708, 959, 784, 576, 686, 349, 472, 931, 687, 1188, + 370, 892, 839, 711, 699, 760, 42, 48, 231, 769, + 1360, 1068, 352, 349, 813, 737, 231, 598, 231, 745, + 115, 6, 436, 658, 659, 359, 768, 771, 992, 671, + 565, 1088, 231, 1089, 752, 754, 642, 453, 1486, 687, + 1317, 642, 1165, 350, 772, 642, 342, 746, 793, 774, + 290, 891, 441, 1320, 577, 759, 1228, 290, 860, 688, + 642, 350, 893, 688, 442, 454, 351, 981, 199, 1496, + 349, 814, 787, 561, 1196, 563, 661, 1497, 290, 741, + 352, 734, 861, 437, 351, 741, 438, 642, 115, 1318, + 1487, 194, 413, 976, 453, 352, 808, 808, 352, 561, + 687, 563, 1321, 231, 661, 291, 642, 413, 1104, 862, + 933, 642, 912, 441, 115, 827, 642, 829, 350, 735, + 642, 1230, 454, 352, 688, 442, 837, 352, 897, 352, + 352, 352, 352, 1017, 741, 642, 734, 352, 1498, 1275, + 315, 351, 824, 370, 786, 411, 863, 824, 824, 649, + 833, 200, 245, 864, 1007, 352, 246, 342, 194, 194, + 642, 342, 642, 337, 115, 94, 115, 477, 330, 249, + 521, 115, 1261, 351, 330, 414, 1262, 397, 398, 194, + 415, 642, 416, 515, 879, 417, 418, 803, 419, 420, + 414, 1069, 1263, 391, 392, 415, 475, 416, 412, 532, + 417, 418, 883, 419, 420, 342, 247, 859, 249, 337, + 365, 497, 642, 712, 244, 257, 1261, 1072, 250, 1069, + 1262, 337, 541, 330, 337, 337, 745, 662, 907, 366, + 367, 737, 414, 745, 739, 913, 1263, 415, 337, 416, + 884, 350, 417, 418, 640, 419, 420, 937, 641, 368, + 115, 921, 115, 248, 1049, 662, 1341, 250, 657, 939, + 369, 908, 1243, 1260, 351, 421, 926, 927, 640, 1355, + 194, 194, 641, 745, 1264, 919, 1265, 920, 352, 570, + 431, 869, 1243, 1266, 477, 922, 571, 787, 1373, 262, + 477, 352, 824, 589, 840, 640, 337, 115, 572, 641, + 115, 1267, 337, 590, 1041, 361, 841, 1260, 337, 1243, + 1268, 337, 337, 598, 437, 661, 1114, 838, 1264, 598, + 1265, 824, 650, 745, 318, 337, 1124, 1266, 1115, 225, + 937, 226, 194, 562, 318, 937, 668, 937, 724, 976, + 937, 937, 939, 937, 937, 1267, 984, 939, 350, 939, + 701, 435, 939, 939, 1268, 939, 939, 337, 194, 413, + 745, 350, 1153, 839, 668, 562, 527, 973, 94, 493, + 194, 351, 709, 668, 360, 677, 570, 965, 194, 528, + 1015, 361, 1018, 571, 351, 352, 998, 280, 1020, 280, + 690, 332, 94, 1001, 280, 572, 529, 362, 1187, 1049, + 562, 1361, 352, 1009, 337, 745, 352, 337, 337, 352, + 318, 352, 94, 1029, 753, 361, 352, 933, 1438, 665, + 937, 1215, 194, 693, 321, 194, 399, 694, 665, 342, + 321, 437, 939, 342, 477, 337, 342, 322, 342, 950, + 951, 1053, 414, 342, 318, 364, 824, 415, 824, 416, + 1058, 824, 417, 418, 757, 419, 420, 664, 194, 194, + 393, 394, 757, 1048, 1307, 225, 664, 228, 472, 1160, + 1161, 1307, 44, 451, 395, 396, 400, 342, 1284, 1277, + 1491, 677, 1169, 113, 401, 727, 194, 194, 1055, 728, + 1056, 501, 1057, 361, 337, 745, 337, 501, 497, 753, + 933, 753, 296, 753, 736, 933, 194, 933, 508, 909, + 933, 933, 402, 933, 933, 337, 337, 1511, 405, 168, + 194, 168, 318, 168, 439, 113, 1529, 1530, 115, 113, + 774, 521, 787, 443, 774, 337, 774, 824, 774, 824, + 824, 763, 1100, 337, 758, 763, 337, 763, 758, 763, + 270, 270, 758, 329, 329, 225, 364, 364, 364, 270, + 364, 364, 753, 364, 330, 364, 446, 330, 753, 473, + 753, 1107, 337, 337, 329, 337, 337, 56, 474, 477, + 502, 335, 493, 415, 701, 415, 502, 64, 64, 65, + 933, 64, 295, 65, 296, 880, 1132, 745, 787, 881, + 471, 231, 822, 762, 415, 415, 822, 364, 1048, 364, + 1143, 495, 364, 826, 233, 493, 1172, 826, 493, 434, + 1027, 1173, 817, 113, 415, 194, 181, 757, 181, 496, + 181, 757, 415, 1136, 1137, 415, 824, 1105, 976, 1106, + 233, 561, 1168, 563, 979, 434, 979, 194, 156, 436, + 156, 765, 115, 765, 493, 163, 115, 163, 517, 115, + 625, 626, 627, 628, 522, 329, 329, 542, 824, 1100, + 1160, 1161, 1352, 561, 1172, 563, 1201, 231, 337, 1173, + 384, 385, 386, 115, 337, 164, 1352, 164, 115, 890, + 337, 890, 362, 605, 337, 605, 1242, 1259, 67, 1238, + 67, 1173, 555, 187, 1383, 187, 1384, 337, 561, 157, + 563, 157, 120, 523, 120, 824, 1242, 285, 127, 285, + 127, 1173, 292, 115, 292, 526, 452, 329, 351, 443, + 1501, 1502, 547, 824, 581, 493, 194, 525, 525, 337, + 115, 1259, 351, 1242, 642, 642, 1291, 591, 1173, 453, + 653, 113, 582, 329, 1238, 623, 624, 194, 355, 1148, + 1149, 672, 454, 621, 622, 329, 692, 456, 629, 630, + 1315, 1316, 457, 329, 458, 459, 460, 461, 656, 695, + 719, 697, 462, 113, 725, 726, 463, 749, 773, 1312, + 1325, 766, 775, 1344, 776, 777, 1347, 778, 464, 796, + 795, 465, 338, 466, 798, 113, 341, 342, 343, 344, + 345, 346, 347, 348, 811, 799, 812, 329, 826, 828, + 329, 832, 848, 849, 194, 437, 701, 467, 851, 852, + 855, 42, 867, 873, 874, 196, 875, 876, 882, 902, + 1362, 898, 817, 903, 905, 910, 914, 194, 915, 929, + 923, 945, 947, 329, 329, 701, 701, 940, 701, 952, + 34, 1418, 194, 954, 961, 960, 194, 964, 969, 701, + 971, 966, 701, 977, 963, 989, 359, 990, 1445, 999, + 1006, 329, 329, 1326, 993, 511, 1024, 701, 1013, 1025, + 1038, 1457, 1459, 1042, 1094, 1059, 1065, 1051, 1095, 359, + 1075, 1066, 745, 1077, 1312, 1067, 1087, 1091, 1097, 1109, + 1117, 701, 359, 1113, 493, 1118, 1119, 359, 1445, 1445, + 232, 1116, 359, 194, 359, 359, 359, 359, 1121, 33, + 1122, 1467, 359, 1125, 1135, 1181, 359, 1139, 1138, 1151, + 359, 194, 194, 1146, 373, 1164, 1171, 1198, 359, 1195, + 1203, 359, 1211, 359, 1200, 1206, 1214, 113, 1215, 1218, + 1220, 1225, 585, 1229, 745, 374, 375, 376, 377, 378, + 379, 380, 381, 382, 383, 1445, 1226, 359, 1227, 1233, + 1276, 1273, 1293, 1322, 1278, 1281, 1288, 1335, 1314, 1339, + 1279, 1340, 1357, 1350, 477, 477, 1349, 1367, 329, 1358, + 1369, 745, 1360, 1370, 1372, 1374, 1380, 1376, 194, 1378, + 338, 1516, 1516, 1386, 1381, 1397, 1409, 1394, 1525, 1525, + 329, 1391, 1398, 598, 598, 113, 1401, 1399, 1428, 194, + 1410, 1483, 31, 359, 1413, 1423, 1430, 194, 1442, 1440, + 1443, 550, 329, 1449, 1488, 585, 1439, 1453, 1464, 1452, + 585, 113, 585, 585, 585, 585, 585, 585, 585, 585, + 585, 585, 585, 1463, 1466, 1469, 1471, 1468, 1477, 1484, + 1493, 1492, 1503, 1495, 585, 1487, 585, 1486, 585, 1509, + 585, 585, 585, 1510, 1531, 1532, 1533, 9, 975, 538, + 606, 860, 496, 616, 617, 618, 585, 861, 550, 550, + 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, + 550, 550, 550, 550, 967, 497, 453, 34, 607, 29, + 676, 34, 21, 454, 506, 495, 29, 337, 521, 30, + 313, 329, 34, 30, 868, 585, 791, 34, 208, 759, + 767, 34, 768, 96, 34, 827, 760, 828, 792, 664, + 829, 317, 329, 831, 687, 664, 34, 34, 344, 642, + 123, 34, 34, 105, 288, 130, 124, 34, 106, 34, + 34, 34, 34, 289, 131, 642, 230, 34, 53, 21, + 1043, 34, 959, 34, 1290, 1141, 33, 113, 1142, 113, + 33, 1485, 1454, 34, 1282, 34, 34, 857, 34, 1494, + 1470, 33, 34, 1441, 1436, 1329, 33, 870, 986, 987, + 33, 982, 1342, 33, 1527, 988, 1364, 194, 1286, 329, + 550, 1289, 34, 1460, 1458, 33, 33, 1519, 34, 34, + 33, 33, 1465, 1221, 113, 1518, 33, 113, 33, 33, + 33, 33, 329, 1385, 1333, 955, 33, 1005, 1222, 24, + 33, 25, 33, 934, 26, 763, 593, 329, 1078, 27, + 890, 329, 33, 28, 33, 33, 866, 33, 298, 810, + 553, 33, 30, 888, 631, 633, 194, 632, 634, 32, + 780, 635, 928, 636, 33, 1294, 1212, 1208, 34, 31, + 797, 33, 1159, 31, 407, 194, 1071, 1120, 33, 1133, + 36, 1060, 37, 1090, 31, 1128, 38, 32, 1192, 31, + 1126, 1292, 1022, 31, 39, 40, 31, 651, 41, 652, + 836, 322, 1197, 756, 0, 0, 957, 0, 31, 31, + 956, 0, 0, 31, 31, 0, 329, 329, 0, 31, + 0, 31, 31, 31, 31, 0, 0, 290, 0, 31, + 194, 194, 0, 31, 0, 31, 0, 0, 194, 0, + 0, 0, 0, 0, 0, 31, 194, 194, 31, 194, + 31, 0, 0, 0, 31, 1332, 0, 0, 0, 0, + 506, 0, 0, 0, 0, 506, 506, 1332, 0, 194, + 0, 0, 194, 0, 31, 0, 0, 0, 0, 0, + 1332, 31, 323, 329, 0, 0, 0, 0, 506, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1332, + 0, 506, 506, 0, 0, 0, 506, 0, 0, 506, + 0, 506, 329, 506, 506, 506, 506, 0, 0, 0, + 0, 506, 0, 0, 0, 506, 0, 0, 0, 506, + 0, 0, 0, 0, 0, 0, 0, 506, 0, 0, + 506, 0, 506, 506, 0, 113, 0, 0, 506, 0, + 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, + 506, 0, 0, 0, 0, 0, 506, 506, 0, 0, + 0, 506, 506, 0, 506, 506, 506, 506, 506, 506, + 506, 862, 506, 506, 0, 506, 506, 506, 506, 506, + 506, 506, 506, 506, 506, 0, 506, 506, 506, 506, + 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, + 506, 506, 506, 506, 506, 506, 506, 506, 0, 0, + 506, 0, 506, 0, 506, 0, 0, 506, 0, 0, + 0, 0, 0, 506, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 32, 0, + 0, 393, 0, 0, 0, 0, 0, 393, 0, 32, + 0, 0, 0, 0, 32, 0, 0, 0, 32, 113, + 0, 32, 0, 113, 0, 0, 113, 0, 0, 0, + 0, 0, 0, 32, 32, 550, 0, 0, 32, 32, + 0, 0, 329, 393, 32, 0, 32, 32, 32, 32, + 113, 0, 0, 0, 32, 113, 0, 0, 32, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 32, 0, 32, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 329, 329, 0, 32, - 0, 0, 0, 0, 329, 32, 32, 0, 785, 785, - 0, 0, 329, 329, 0, 329, 785, 785, 785, 785, - 785, 0, 785, 785, 742, 785, 785, 785, 785, 785, - 785, 785, 0, 0, 0, 329, 0, 785, 329, 785, - 785, 785, 785, 785, 785, 0, 0, 785, 0, 0, - 0, 785, 785, 0, 785, 785, 785, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 785, 0, 785, 0, - 785, 785, 0, 0, 785, 0, 785, 785, 785, 785, - 785, 785, 785, 785, 785, 785, 785, 785, 0, 785, - 0, 0, 785, 785, 0, 0, 785, 785, 0, 0, + 113, 0, 0, 0, 0, 0, 0, 0, 785, 32, + 0, 329, 0, 0, 0, 32, 32, 113, 330, 0, + 0, 0, 0, 393, 330, 0, 393, 393, 393, 393, + 329, 393, 0, 393, 393, 0, 393, 393, 393, 393, + 393, 0, 393, 393, 393, 393, 0, 393, 393, 393, + 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, + 393, 393, 393, 393, 393, 393, 393, 393, 393, 0, + 0, 0, 0, 330, 0, 393, 0, 0, 393, 0, + 0, 0, 0, 0, 393, 329, 329, 0, 0, 0, + 0, 0, 0, 329, 0, 0, 0, 862, 862, 0, + 0, 329, 329, 0, 329, 862, 862, 862, 862, 862, + 0, 862, 862, 0, 862, 862, 862, 862, 862, 862, + 862, 862, 0, 0, 329, 0, 862, 329, 862, 862, + 862, 862, 862, 862, 337, 0, 862, 0, 0, 0, + 862, 862, 0, 862, 862, 862, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 862, 0, 862, 0, 862, + 862, 0, 0, 862, 0, 862, 862, 862, 862, 862, + 862, 862, 862, 862, 862, 862, 862, 0, 862, 0, + 0, 862, 862, 0, 0, 862, 862, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 785, 785, 785, 785, 785, 0, 0, 0, 785, - 785, 0, 0, 785, 0, 0, 0, 0, 785, 785, - 785, 785, 785, 0, 336, 0, 785, 0, 785, 336, - 336, 0, 0, 0, 785, 785, 0, 0, 0, 0, - 0, 0, 0, 0, 329, 0, 0, 0, 0, 0, - 0, 0, 336, 0, 0, 0, 0, 0, 0, 785, - 785, 785, 785, 0, 785, 336, 336, 0, 0, 0, - 336, 785, 0, 336, 0, 336, 0, 336, 336, 336, - 336, 0, 0, 0, 0, 336, 0, 0, 0, 336, - 0, 0, 0, 336, 0, 0, 0, 0, 0, 0, - 0, 336, 0, 0, 336, 0, 336, 336, 0, 0, - 0, 0, 336, 0, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 336, 336, 0, 0, 0, 0, - 336, 336, 0, 0, 0, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 336, 0, 336, 336, 0, 0, - 336, 336, 336, 336, 336, 0, 0, 336, 336, 0, - 0, 0, 336, 336, 336, 336, 336, 336, 336, 336, - 742, 0, 0, 0, 366, 742, 742, 0, 0, 0, - 0, 336, 0, 0, 336, 0, 336, 0, 336, 0, - 0, 336, 0, 0, 0, 0, 0, 336, 742, 0, + 862, 862, 862, 862, 862, 0, 0, 0, 862, 862, + 0, 0, 862, 0, 0, 0, 0, 862, 862, 862, + 862, 862, 0, 0, 0, 862, 0, 862, 0, 0, + 0, 0, 0, 862, 862, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 742, 742, 0, 0, 0, 742, 0, 0, 742, - 0, 742, 0, 742, 742, 742, 742, 0, 0, 0, - 0, 742, 0, 0, 0, 742, 0, 0, 0, 742, - 0, 0, 0, 0, 0, 0, 0, 742, 0, 0, - 742, 0, 742, 742, 0, 0, 0, 0, 742, 0, - 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, - 742, 0, 0, 0, 0, 0, 742, 742, 336, 0, - 0, 742, 742, 742, 742, 742, 742, 0, 742, 742, - 742, 0, 742, 742, 0, 0, 742, 742, 742, 742, - 329, 0, 0, 742, 742, 329, 329, 0, 742, 742, - 742, 742, 742, 742, 742, 742, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 742, 329, 0, - 742, 0, 742, 0, 742, 0, 0, 742, 0, 0, - 0, 329, 329, 742, 0, 0, 329, 0, 0, 329, - 0, 329, 0, 329, 329, 329, 329, 0, 0, 0, - 0, 329, 0, 0, 0, 329, 0, 0, 0, 329, - 0, 0, 0, 0, 0, 0, 0, 329, 0, 0, - 329, 0, 329, 329, 0, 0, 0, 0, 329, 0, - 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, - 329, 0, 0, 0, 0, 0, 329, 329, 0, 0, - 0, 329, 329, 329, 329, 329, 329, 0, 329, 329, - 329, 0, 329, 329, 361, 0, 329, 329, 329, 329, - 366, 0, 0, 329, 329, 366, 366, 0, 329, 329, - 329, 329, 329, 329, 329, 329, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 329, 366, 0, - 329, 0, 329, 0, 329, 0, 0, 329, 0, 0, - 0, 366, 366, 329, 0, 0, 366, 0, 0, 366, - 0, 366, 0, 366, 366, 366, 366, 0, 0, 0, - 0, 366, 0, 0, 0, 366, 0, 0, 0, 366, - 0, 0, 0, 0, 0, 0, 0, 366, 0, 0, - 366, 0, 366, 366, 0, 0, 0, 0, 366, 0, - 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, - 366, 0, 0, 0, 336, 0, 366, 366, 0, 0, - 336, 366, 366, 0, 366, 366, 366, 0, 366, 366, - 366, 0, 366, 366, 0, 0, 366, 366, 366, 366, - 0, 0, 0, 366, 366, 0, 0, 0, 366, 366, - 366, 366, 366, 366, 366, 366, 336, 0, 0, 0, - 0, 0, 27, 0, 0, 0, 0, 366, 0, 0, - 366, 0, 366, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 366, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 336, 0, 0, - 0, 0, 336, 0, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 336, 336, 0, 0, 587, 0, - 0, 336, 0, 0, 0, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 336, 0, 336, 336, 0, 0, - 336, 336, 336, 336, 336, 27, 0, 336, 336, 0, - 0, 0, 336, 336, 336, 336, 336, 336, 336, 336, - 361, 0, 0, 0, 0, 0, 361, 0, 0, 0, - 0, 336, 0, 0, 336, 0, 336, 0, 336, 0, - 0, 336, 0, 0, 0, 0, 0, 336, 31, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 862, 862, + 862, 862, 0, 862, 785, 785, 0, 0, 0, 0, + 862, 0, 785, 785, 785, 785, 785, 0, 785, 785, + 742, 785, 785, 785, 785, 785, 785, 785, 0, 0, + 0, 0, 0, 785, 0, 785, 785, 785, 785, 785, + 785, 0, 0, 785, 0, 0, 0, 785, 785, 0, + 785, 785, 785, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 785, 0, 785, 0, 785, 785, 0, 0, + 785, 0, 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 0, 785, 0, 0, 785, 785, + 0, 0, 785, 785, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 785, 785, 785, + 785, 785, 0, 0, 0, 785, 785, 0, 0, 785, + 0, 0, 0, 0, 785, 785, 785, 785, 785, 0, + 337, 0, 785, 0, 785, 337, 337, 0, 0, 0, + 785, 785, 0, 0, 0, 0, 0, 0, 0, 0, + 330, 0, 0, 0, 0, 0, 0, 0, 337, 0, + 0, 0, 0, 0, 0, 785, 785, 785, 785, 0, + 785, 337, 337, 0, 0, 0, 337, 785, 0, 337, + 0, 337, 0, 337, 337, 337, 337, 0, 0, 0, + 0, 337, 0, 0, 0, 337, 0, 0, 0, 337, + 0, 0, 0, 0, 0, 0, 0, 337, 0, 0, + 337, 0, 337, 337, 0, 0, 0, 0, 337, 0, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 337, 0, 0, 0, 0, 337, 337, 0, 0, + 0, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 0, 337, 337, 0, 0, 337, 337, 337, 337, + 337, 0, 0, 337, 337, 0, 0, 0, 337, 337, + 337, 337, 337, 337, 337, 337, 742, 0, 0, 0, + 367, 742, 742, 0, 0, 0, 0, 337, 0, 0, + 337, 0, 337, 0, 337, 0, 0, 337, 0, 0, + 0, 0, 0, 337, 742, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 742, 742, 0, + 0, 0, 742, 0, 0, 742, 0, 742, 0, 742, + 742, 742, 742, 0, 0, 0, 0, 742, 0, 0, + 0, 742, 0, 0, 0, 742, 0, 0, 0, 0, + 0, 0, 0, 742, 0, 0, 742, 0, 742, 742, + 0, 0, 0, 0, 742, 0, 742, 742, 742, 742, + 742, 742, 742, 742, 742, 742, 742, 0, 0, 0, + 0, 0, 742, 742, 337, 0, 0, 742, 742, 742, + 742, 742, 742, 0, 742, 742, 742, 0, 742, 742, + 0, 0, 742, 742, 742, 742, 330, 0, 0, 742, + 742, 330, 330, 0, 742, 742, 742, 742, 742, 742, + 742, 742, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 742, 330, 0, 742, 0, 742, 0, + 742, 0, 0, 742, 0, 0, 0, 330, 330, 742, + 0, 0, 330, 0, 0, 330, 0, 330, 0, 330, + 330, 330, 330, 0, 0, 0, 0, 330, 0, 0, + 0, 330, 0, 0, 0, 330, 0, 0, 0, 0, + 0, 0, 0, 330, 0, 0, 330, 0, 330, 330, + 0, 0, 0, 0, 330, 0, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 0, 0, 0, + 0, 0, 330, 330, 0, 0, 0, 330, 330, 330, + 330, 330, 330, 0, 330, 330, 330, 0, 330, 330, + 362, 0, 330, 330, 330, 330, 367, 0, 0, 330, + 330, 367, 367, 0, 330, 330, 330, 330, 330, 330, + 330, 330, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 330, 367, 0, 330, 0, 330, 0, + 330, 0, 0, 330, 0, 0, 0, 367, 367, 330, + 0, 0, 367, 0, 0, 367, 0, 367, 0, 367, + 367, 367, 367, 0, 0, 0, 0, 367, 0, 0, + 0, 367, 0, 0, 0, 367, 0, 0, 0, 0, + 0, 0, 0, 367, 0, 0, 367, 0, 367, 367, + 0, 0, 0, 0, 367, 0, 367, 367, 367, 367, + 367, 367, 367, 367, 367, 367, 367, 0, 0, 0, + 337, 0, 367, 367, 0, 0, 337, 367, 367, 0, + 367, 367, 367, 0, 367, 367, 367, 0, 367, 367, + 0, 0, 367, 367, 367, 367, 0, 0, 0, 367, + 367, 0, 0, 0, 367, 367, 367, 367, 367, 367, + 367, 367, 337, 0, 0, 0, 0, 0, 27, 0, + 0, 0, 0, 367, 0, 0, 367, 0, 367, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 367, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 587, 361, 0, 0, 0, 587, 0, 587, 587, - 587, 587, 587, 587, 587, 587, 587, 587, 587, 0, + 0, 0, 0, 337, 0, 0, 0, 0, 337, 0, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 337, 0, 0, 587, 0, 0, 337, 0, 0, + 0, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 0, 337, 337, 0, 0, 337, 337, 337, 337, + 337, 27, 0, 337, 337, 0, 0, 0, 337, 337, + 337, 337, 337, 337, 337, 337, 362, 0, 0, 0, + 0, 0, 362, 0, 0, 0, 0, 337, 0, 0, + 337, 0, 337, 0, 337, 0, 0, 337, 0, 0, + 0, 0, 0, 337, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 587, 362, 0, + 0, 0, 587, 0, 587, 587, 587, 587, 587, 587, + 587, 587, 587, 587, 587, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 587, 957, 587, 0, + 587, 0, 587, 587, 587, 0, 0, 0, 0, 362, + 0, 0, 0, 0, 362, 0, 362, 362, 362, 362, + 362, 362, 362, 362, 362, 362, 362, 0, 0, 0, + 0, 0, 0, 362, 0, 0, 0, 362, 362, 0, + 362, 362, 362, 0, 362, 362, 362, 0, 362, 362, + 0, 0, 362, 362, 362, 362, 0, 587, 0, 362, + 362, 0, 0, 0, 362, 362, 362, 362, 362, 362, + 362, 362, 0, 0, 0, 0, 0, 47, 0, 0, + 0, 0, 0, 362, 27, 27, 362, 0, 362, 27, + 0, 0, 0, 27, 0, 27, 0, 0, 27, 362, + 27, 27, 0, 27, 0, 27, 0, 27, 0, 27, + 27, 27, 27, 0, 0, 27, 27, 0, 0, 0, + 7, 27, 0, 27, 27, 27, 0, 0, 27, 27, + 27, 0, 27, 0, 0, 27, 0, 27, 27, 27, + 27, 0, 0, 0, 27, 27, 27, 0, 0, 27, + 27, 27, 0, 0, 0, 0, 0, 0, 27, 27, + 0, 27, 27, 958, 27, 27, 27, 0, 27, 0, + 27, 0, 27, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 27, 0, 0, 0, 0, 27, 0, + 27, 0, 27, 0, 0, 27, 27, 27, 0, 0, + 0, 0, 0, 0, 0, 27, 48, 27, 27, 0, + 0, 5, 27, 27, 0, 47, 0, 0, 27, 0, + 27, 27, 27, 27, 0, 0, 47, 0, 27, 0, + 0, 47, 27, 0, 27, 47, 0, 0, 47, 0, + 0, 0, 0, 0, 27, 0, 27, 27, 0, 27, + 47, 47, 0, 27, 957, 47, 47, 0, 47, 0, + 0, 47, 0, 47, 47, 47, 47, 0, 0, 47, + 0, 47, 0, 27, 47, 47, 0, 47, 47, 27, + 27, 47, 0, 0, 0, 0, 0, 47, 0, 0, + 47, 0, 47, 47, 47, 0, 47, 0, 47, 47, + 0, 0, 0, 0, 47, 0, 47, 47, 47, 47, + 0, 0, 0, 0, 47, 0, 47, 0, 47, 0, + 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 47, 0, 0, 47, 47, 47, 0, 0, 47, 47, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, + 0, 0, 0, 0, 47, 0, 0, 0, 47, 47, + 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 47, 47, 0, 0, 7, 47, 47, + 0, 48, 0, 0, 47, 0, 47, 47, 47, 47, + 0, 0, 48, 0, 47, 0, 0, 48, 47, 0, + 47, 48, 0, 0, 48, 0, 0, 0, 0, 0, + 47, 0, 0, 47, 0, 47, 48, 48, 0, 47, + 958, 48, 48, 0, 47, 0, 0, 48, 0, 48, + 48, 48, 48, 0, 0, 47, 0, 48, 0, 47, + 47, 48, 0, 48, 47, 0, 0, 47, 0, 0, + 0, 0, 0, 48, 0, 0, 48, 0, 48, 47, + 47, 0, 48, 48, 47, 47, 0, 48, 0, 0, + 47, 0, 47, 47, 47, 47, 0, 0, 48, 0, + 47, 0, 48, 48, 47, 0, 47, 48, 0, 0, + 48, 0, 0, 0, 0, 0, 47, 0, 0, 47, + 0, 47, 48, 48, 0, 47, 0, 48, 48, 0, + 0, 0, 0, 48, 0, 48, 48, 48, 48, 0, + 0, 0, 0, 48, 0, 47, 0, 48, 0, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, + 0, 55, 48, 0, 48, 0, 0, 0, 48, 56, + 24, 57, 25, 0, 0, 26, 58, 0, 59, 60, + 27, 61, 62, 63, 28, 0, 0, 0, 48, 0, + 64, 0, 65, 30, 66, 67, 68, 69, 0, 0, + 32, 0, 0, 0, 70, 33, 0, 71, 72, 34, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, + 0, 36, 0, 37, 74, 0, 0, 38, 0, 75, + 76, 77, 78, 79, 80, 39, 40, 81, 82, 41, + 83, 0, 84, 0, 0, 85, 86, 0, 337, 87, + 88, 0, 0, 0, 337, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 89, 90, 91, 92, 93, 0, + 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, + 0, 96, 97, 98, 99, 100, 0, 0, 0, 101, + 337, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 587, 5, 587, 0, 587, 0, 587, 587, 587, 0, - 0, 0, 0, 361, 0, 0, 0, 0, 361, 0, - 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, - 361, 0, 0, 0, 0, 0, 0, 361, 0, 0, - 0, 361, 361, 0, 361, 361, 361, 0, 361, 361, - 361, 0, 361, 361, 0, 0, 361, 361, 361, 361, - 0, 587, 0, 361, 361, 0, 0, 0, 361, 361, - 361, 361, 361, 361, 361, 361, 0, 0, 0, 0, - 0, 955, 0, 0, 0, 0, 0, 361, 27, 27, - 361, 0, 361, 27, 0, 0, 0, 27, 0, 27, - 0, 0, 27, 361, 27, 27, 0, 27, 0, 27, - 0, 27, 0, 27, 27, 27, 27, 0, 0, 27, - 27, 0, 0, 0, 47, 27, 0, 27, 27, 27, - 0, 0, 27, 27, 27, 0, 27, 0, 0, 27, - 0, 27, 27, 27, 27, 0, 0, 0, 27, 27, - 27, 0, 0, 27, 27, 27, 0, 0, 0, 0, - 0, 0, 27, 27, 0, 27, 27, 7, 27, 27, - 27, 0, 27, 0, 27, 0, 27, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, - 0, 0, 27, 0, 27, 0, 27, 0, 0, 27, - 27, 27, 0, 0, 0, 0, 0, 0, 0, 27, - 956, 27, 27, 0, 0, 31, 27, 27, 0, 31, - 0, 0, 27, 0, 27, 27, 27, 27, 0, 0, - 31, 0, 27, 0, 0, 31, 27, 0, 27, 31, - 0, 0, 31, 0, 0, 0, 0, 0, 27, 0, - 27, 27, 0, 27, 31, 31, 0, 27, 5, 31, - 31, 0, 47, 0, 0, 31, 0, 31, 31, 31, - 31, 0, 0, 47, 0, 31, 0, 27, 47, 31, - 0, 31, 47, 27, 27, 47, 0, 0, 0, 0, - 48, 31, 0, 0, 31, 0, 31, 47, 47, 0, - 31, 0, 47, 47, 0, 0, 0, 0, 47, 0, - 47, 47, 47, 47, 0, 0, 0, 0, 47, 0, - 31, 0, 47, 0, 47, 0, 0, 31, 0, 0, - 0, 0, 0, 0, 47, 0, 0, 47, 955, 47, - 0, 0, 47, 47, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 47, 0, 0, 0, 0, 47, 0, - 0, 0, 47, 47, 0, 47, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 47, 47, 0, - 0, 47, 47, 47, 0, 47, 0, 0, 47, 0, - 47, 47, 47, 47, 0, 0, 47, 0, 47, 0, - 0, 47, 47, 0, 47, 47, 0, 0, 47, 0, - 0, 0, 0, 0, 47, 0, 0, 47, 0, 47, - 47, 47, 0, 47, 7, 47, 47, 0, 48, 0, - 0, 47, 0, 47, 47, 47, 47, 0, 0, 48, - 0, 47, 0, 47, 48, 47, 0, 47, 48, 0, - 0, 48, 0, 0, 0, 0, 0, 47, 0, 0, - 47, 0, 47, 48, 48, 0, 47, 956, 48, 48, - 0, 47, 0, 0, 48, 0, 48, 48, 48, 48, - 0, 0, 47, 0, 48, 0, 47, 47, 48, 0, - 48, 47, 0, 0, 47, 0, 0, 0, 0, 0, - 48, 0, 0, 48, 0, 48, 47, 47, 0, 48, - 0, 47, 47, 0, 0, 0, 0, 47, 0, 47, - 47, 47, 47, 0, 0, 0, 0, 47, 0, 48, - 0, 47, 0, 47, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 47, 0, 0, 47, 48, 47, 0, - 0, 48, 47, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 48, 0, 0, 0, 0, 48, 0, 0, - 0, 48, 47, 0, 48, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 48, 48, 0, 0, - 0, 48, 48, 0, 0, 0, 0, 48, 0, 48, - 48, 48, 48, 0, 0, 0, 0, 48, 0, 0, - 0, 48, 0, 48, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 48, 0, 55, 48, 0, 48, 0, - 0, 0, 48, 56, 24, 57, 25, 0, 0, 26, - 58, 0, 59, 60, 27, 61, 62, 63, 28, 0, - 0, 0, 48, 0, 64, 0, 65, 30, 66, 67, - 68, 69, 0, 0, 32, 0, 0, 0, 70, 33, - 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 73, 0, 36, 0, 37, 74, 0, - 0, 38, 0, 75, 76, 77, 78, 79, 80, 39, - 40, 81, 82, 41, 83, 0, 84, 0, 0, 85, - 86, 0, 336, 87, 88, 0, 0, 0, 336, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, - 91, 92, 93, 0, 0, 0, 94, 0, 0, 0, - 95, 0, 0, 0, 0, 96, 97, 98, 99, 100, - 0, 0, 0, 101, 336, 102, 0, 0, 0, 0, - 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 336, 0, - 0, 0, 0, 0, 336, 0, 105, 106, 107, 108, - 0, 0, 0, 0, 0, 336, 0, 0, 196, 0, - 336, 0, 336, 336, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 0, 0, 0, 0, 0, 336, - 336, 0, 0, 0, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 0, 336, 336, 0, 336, 336, 336, - 336, 336, 336, 336, 336, 336, 336, 0, 336, 336, - 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, - 0, 507, 0, 0, 336, 0, 336, 507, 0, 336, - 0, 0, 0, 0, 0, 336, 0, 0, 0, 0, - 336, 0, 0, 336, 0, 336, 336, 0, 0, 0, - 336, 336, 0, 0, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 507, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 336, 336, 0, 0, 0, 0, - 0, 0, 336, 0, 0, 336, 0, 0, 0, 0, - 0, 336, 0, 0, 507, 0, 0, 0, 0, 507, - 0, 507, 507, 507, 507, 507, 507, 507, 507, 507, - 507, 507, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 507, 507, 507, 507, 507, 507, 507, 507, - 507, 507, 0, 507, 507, 0, 507, 507, 507, 507, - 507, 507, 507, 507, 507, 507, 0, 507, 507, 507, - 507, 507, 507, 507, 507, 507, 507, 507, 507, 507, - 507, 507, 507, 507, 507, 507, 507, 507, 507, 0, - 503, 757, 0, 0, 0, 507, 503, 0, 0, 0, - 24, 0, 25, 0, 507, 26, 0, 0, 0, 0, - 27, 0, 0, 0, 28, 0, 0, 0, 0, 0, - 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, - 32, 0, 503, 0, 0, 33, 0, 0, 0, 34, + 0, 0, 0, 0, 337, 0, 0, 0, 0, 0, + 337, 0, 105, 106, 107, 108, 0, 0, 0, 0, + 0, 337, 0, 0, 196, 0, 337, 0, 337, 337, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 0, 0, 0, 0, 0, 337, 337, 0, 0, 0, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 0, + 337, 337, 0, 337, 337, 337, 337, 337, 337, 337, + 337, 337, 337, 0, 337, 337, 337, 337, 337, 337, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 337, 337, 337, 337, 337, 0, 508, 0, 0, + 337, 0, 337, 508, 0, 337, 0, 0, 0, 0, + 0, 337, 0, 0, 0, 0, 337, 0, 0, 337, + 0, 337, 337, 0, 0, 0, 337, 337, 0, 0, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 508, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 36, 0, 37, 0, 0, 0, 38, 0, 0, - 0, 392, 0, 0, 0, 39, 40, 392, 0, 41, - 0, 0, 758, 503, 0, 0, 0, 0, 503, 0, - 503, 503, 503, 503, 503, 503, 503, 503, 503, 503, - 503, 0, 0, 0, 0, 0, 0, 0, 291, 0, - 0, 503, 503, 392, 503, 503, 503, 503, 503, 503, - 503, 0, 503, 503, 0, 503, 503, 503, 503, 503, - 503, 503, 503, 503, 503, 0, 503, 503, 503, 503, - 503, 503, 503, 503, 503, 503, 503, 503, 503, 503, - 503, 503, 503, 503, 503, 503, 503, 503, 0, 511, - 0, 0, 0, 323, 503, 511, 0, 503, 0, 0, - 0, 0, 0, 503, 0, 0, 0, 0, 329, 0, - 0, 0, 0, 392, 329, 0, 392, 392, 392, 392, - 0, 392, 0, 392, 392, 0, 392, 392, 392, 392, - 392, 511, 392, 392, 392, 392, 0, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, 392, 0, - 0, 0, 0, 329, 0, 392, 0, 0, 392, 0, - 0, 0, 511, 0, 392, 0, 0, 511, 0, 511, - 511, 511, 511, 511, 511, 511, 511, 511, 511, 511, + 337, 337, 0, 0, 0, 0, 0, 0, 337, 0, + 0, 337, 0, 0, 0, 0, 0, 337, 0, 201, + 508, 0, 0, 0, 0, 508, 0, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 949, 508, + 508, 202, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 0, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 0, 504, 0, 0, 0, + 0, 508, 504, 0, 0, 0, 0, 0, 0, 0, + 508, 203, 204, 205, 206, 0, 207, 208, 209, 210, + 211, 212, 213, 214, 0, 0, 215, 216, 217, 218, + 219, 220, 221, 222, 0, 0, 0, 0, 504, 0, + 0, 949, 0, 0, 0, 0, 949, 0, 949, 949, + 949, 949, 949, 949, 949, 949, 949, 949, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 511, 0, 511, 511, 511, 511, 511, 511, 511, - 0, 511, 511, 0, 511, 511, 511, 511, 511, 511, - 511, 511, 511, 511, 0, 511, 511, 511, 511, 511, - 511, 511, 511, 511, 511, 511, 511, 511, 511, 511, - 511, 511, 511, 511, 511, 511, 511, 0, 336, 567, - 0, 0, 0, 511, 336, 0, 511, 0, 24, 0, - 25, 0, 511, 26, 0, 0, 0, 0, 27, 0, + 949, 0, 949, 0, 949, 0, 949, 949, 949, 504, + 0, 0, 0, 0, 504, 0, 504, 504, 504, 504, + 504, 504, 504, 504, 504, 504, 504, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 504, 504, 0, + 504, 504, 504, 504, 504, 504, 504, 0, 504, 504, + 0, 504, 504, 504, 504, 504, 504, 504, 504, 504, + 504, 949, 504, 504, 504, 504, 504, 504, 504, 504, + 504, 504, 504, 504, 504, 504, 504, 504, 504, 504, + 504, 504, 504, 504, 0, 512, 757, 0, 0, 0, + 504, 512, 0, 504, 0, 24, 0, 25, 0, 504, + 26, 0, 0, 0, 0, 27, 0, 0, 0, 28, + 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, + 0, 0, 0, 0, 0, 32, 0, 512, 0, 0, + 33, 0, 0, 0, 34, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 36, 0, 37, 0, + 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, + 39, 40, 0, 0, 41, 0, 0, 758, 512, 0, + 0, 0, 0, 512, 0, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 0, 0, 0, 0, + 0, 0, 0, 290, 0, 0, 0, 512, 0, 512, + 512, 512, 512, 512, 512, 512, 0, 512, 512, 0, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 0, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 0, 337, 567, 0, 0, 323, 512, + 337, 0, 512, 0, 24, 0, 25, 0, 512, 26, + 0, 0, 0, 0, 27, 0, 0, 0, 28, 0, + 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, + 0, 0, 0, 0, 32, 0, 337, 0, 0, 33, + 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 36, 0, 37, 0, 0, + 0, 38, 0, 0, 0, 0, 0, 0, 0, 39, + 40, 0, 0, 41, 0, 0, 322, 337, 0, 0, + 0, 0, 337, 0, 337, 337, 337, 337, 337, 337, + 337, 337, 337, 337, 337, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 337, 0, 337, 337, + 337, 337, 337, 337, 337, 0, 337, 337, 0, 337, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 0, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 337, 0, 437, 906, 0, 0, 355, 337, 437, + 0, 337, 0, 24, 0, 25, 0, 337, 26, 0, + 0, 0, 0, 27, 0, 0, 0, 28, 0, 0, + 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, + 0, 0, 0, 32, 0, 437, 0, 0, 33, 0, + 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 36, 0, 37, 0, 0, 0, + 38, 0, 0, 0, 0, 0, 0, 0, 39, 40, + 0, 0, 41, 0, 0, 322, 437, 0, 0, 0, + 0, 437, 0, 437, 437, 437, 437, 437, 437, 437, + 437, 437, 437, 437, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 437, 0, 437, 437, 437, + 437, 437, 437, 437, 0, 437, 437, 0, 437, 437, + 437, 437, 437, 437, 437, 437, 437, 437, 0, 437, + 437, 437, 437, 437, 437, 437, 437, 437, 437, 437, + 437, 437, 437, 437, 437, 437, 437, 437, 437, 437, + 437, 0, 337, 0, 0, 0, 355, 437, 337, 1052, + 437, 0, 745, 0, 0, 0, 437, 0, 24, 0, + 25, 0, 0, 26, 0, 0, 0, 0, 27, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, - 0, 30, 0, 0, 0, 0, 0, 0, 32, 0, - 336, 0, 0, 33, 0, 0, 0, 34, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, + 0, 30, 0, 0, 337, 0, 0, 0, 32, 0, + 0, 0, 0, 33, 0, 0, 0, 34, 0, 0, + 745, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 37, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 39, 40, 0, 0, 41, 0, 0, - 322, 336, 0, 0, 0, 0, 336, 0, 336, 336, - 336, 336, 336, 336, 336, 336, 336, 336, 336, 0, + 322, 0, 0, 0, 0, 543, 0, 0, 0, 0, + 0, 543, 0, 337, 0, 0, 0, 0, 0, 337, + 0, 0, 0, 0, 337, 337, 337, 337, 337, 337, + 337, 745, 337, 0, 337, 337, 0, 337, 337, 337, + 337, 337, 337, 337, 337, 337, 337, 543, 337, 337, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 0, 0, 0, 0, 337, 0, 337, 0, 0, 337, + 0, 355, 0, 0, 0, 337, 0, 0, 543, 0, + 0, 0, 0, 543, 0, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 543, 0, 543, + 0, 543, 0, 543, 543, 543, 0, 543, 543, 0, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 358, 0, 0, 543, 543, 543, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 543, + 543, 555, 543, 358, 0, 0, 0, 555, 0, 0, + 0, 0, 0, 0, 0, 0, 358, 0, 543, 0, + 0, 358, 0, 0, 231, 0, 358, 0, 358, 358, + 358, 358, 0, 0, 0, 0, 358, 0, 0, 0, + 358, 0, 0, 555, 358, 0, 0, 0, 0, 0, + 0, 0, 358, 0, 0, 358, 0, 358, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 559, + 0, 0, 0, 0, 0, 559, 0, 0, 0, 0, + 0, 358, 0, 0, 555, 0, 0, 0, 0, 555, + 0, 555, 555, 555, 555, 555, 555, 555, 555, 555, + 555, 555, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 559, 0, 555, 0, 555, 0, 555, 0, 555, + 555, 555, 0, 555, 555, 0, 0, 555, 555, 555, + 555, 555, 555, 555, 555, 555, 0, 358, 0, 555, + 555, 555, 555, 555, 555, 555, 555, 0, 0, 0, + 0, 0, 559, 0, 0, 0, 0, 559, 555, 559, + 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + 0, 0, 0, 560, 555, 0, 0, 0, 0, 560, + 0, 559, 0, 559, 0, 559, 0, 559, 559, 559, + 0, 559, 559, 0, 0, 559, 559, 559, 559, 0, + 0, 0, 559, 559, 0, 0, 0, 559, 559, 559, + 559, 559, 559, 559, 559, 560, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 559, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 336, 0, 336, 336, 336, 336, 336, 336, 336, 0, - 336, 336, 0, 336, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 0, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 336, 336, 0, 436, 905, 0, - 0, 355, 336, 436, 0, 336, 0, 24, 0, 25, - 0, 336, 26, 0, 0, 0, 0, 27, 0, 0, - 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, - 30, 0, 0, 0, 0, 0, 0, 32, 0, 436, - 0, 0, 33, 0, 0, 0, 34, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, - 37, 0, 0, 0, 38, 0, 0, 0, 0, 0, - 0, 0, 39, 40, 0, 0, 41, 0, 0, 322, - 436, 0, 0, 0, 0, 436, 0, 436, 436, 436, - 436, 436, 436, 436, 436, 436, 436, 436, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 436, - 0, 436, 436, 436, 436, 436, 436, 436, 0, 436, - 436, 0, 436, 436, 436, 436, 436, 436, 436, 436, - 436, 436, 0, 436, 436, 436, 436, 436, 436, 436, - 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, - 436, 436, 436, 436, 436, 0, 395, 0, 358, 0, - 355, 436, 395, 0, 436, 0, 0, 0, 0, 0, - 436, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 358, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 358, 0, 0, 0, 395, 358, - 0, 0, 232, 0, 358, 0, 358, 358, 358, 358, - 0, 0, 0, 0, 358, 0, 0, 0, 358, 0, - 0, 336, 358, 0, 0, 0, 0, 336, 0, 0, - 358, 745, 0, 358, 0, 358, 0, 0, 0, 395, - 0, 0, 0, 0, 395, 0, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 0, 0, 358, - 0, 0, 0, 336, 0, 0, 0, 0, 395, 0, - 395, 395, 395, 395, 395, 395, 395, 0, 395, 745, - 0, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 0, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 0, 358, 0, 0, 0, 0, - 395, 0, 336, 395, 0, 0, 0, 0, 336, 395, - 0, 0, 0, 336, 336, 336, 336, 336, 336, 336, - 745, 336, 0, 336, 336, 0, 336, 336, 336, 336, - 336, 336, 336, 336, 336, 336, 0, 336, 336, 336, - 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 336, 336, 336, 336, 336, 0, - 542, 0, 501, 336, 0, 336, 542, 0, 336, 0, - 56, 24, 0, 25, 336, 0, 26, 253, 0, 0, - 0, 27, 61, 62, 0, 28, 0, 0, 0, 0, - 0, 64, 0, 0, 30, 0, 0, 0, 0, 0, - 0, 32, 542, 0, 0, 0, 33, 0, 71, 72, - 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 36, 0, 37, 74, 0, 0, 38, 0, - 0, 76, 0, 78, 0, 80, 39, 40, 254, 0, - 41, 0, 0, 542, 0, 0, 0, 0, 542, 0, - 542, 542, 542, 542, 542, 542, 542, 542, 542, 542, - 542, 0, 0, 0, 0, 89, 90, 91, 255, 0, - 0, 0, 542, 0, 542, 0, 542, 95, 542, 542, - 542, 0, 542, 542, 0, 542, 542, 542, 542, 542, - 542, 542, 542, 542, 542, 357, 0, 0, 542, 542, - 542, 542, 542, 542, 542, 542, 542, 542, 542, 542, - 542, 542, 542, 542, 542, 542, 554, 542, 357, 0, - 0, 0, 554, 105, 502, 0, 0, 0, 0, 0, - 0, 357, 0, 542, 0, 0, 357, 0, 0, 231, - 0, 357, 0, 357, 357, 357, 357, 0, 0, 0, - 0, 357, 0, 0, 0, 357, 0, 0, 554, 357, - 0, 0, 0, 0, 0, 0, 0, 357, 0, 0, - 357, 0, 357, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 558, 0, 0, 0, 0, 0, - 558, 0, 0, 0, 0, 0, 357, 0, 0, 554, - 0, 0, 0, 0, 554, 0, 554, 554, 554, 554, - 554, 554, 554, 554, 554, 554, 554, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 558, 0, 554, 0, - 554, 0, 554, 0, 554, 554, 554, 0, 554, 554, - 0, 0, 554, 554, 554, 554, 554, 554, 554, 554, - 554, 0, 357, 0, 554, 554, 554, 554, 554, 554, - 554, 554, 0, 0, 0, 0, 0, 558, 0, 0, - 0, 0, 558, 554, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 0, 0, 0, 561, 554, - 0, 0, 0, 0, 561, 0, 558, 0, 558, 0, - 558, 0, 558, 558, 558, 0, 558, 558, 0, 0, - 558, 558, 558, 558, 0, 0, 0, 558, 558, 0, - 0, 0, 558, 558, 558, 558, 558, 558, 558, 558, - 561, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 558, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 559, 558, 0, 0, - 0, 0, 559, 0, 0, 0, 0, 0, 0, 0, - 0, 561, 0, 0, 0, 0, 561, 0, 561, 561, - 561, 561, 561, 561, 561, 561, 561, 561, 561, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 559, 0, - 561, 0, 561, 0, 561, 0, 561, 561, 561, 0, - 561, 561, 0, 0, 561, 561, 561, 561, 0, 0, - 0, 561, 561, 201, 0, 0, 561, 561, 561, 561, - 561, 561, 561, 561, 0, 0, 0, 0, 0, 559, - 0, 0, 0, 0, 559, 561, 559, 559, 559, 559, - 559, 559, 559, 559, 559, 559, 559, 0, 0, 0, - 560, 561, 0, 0, 0, 202, 560, 0, 559, 0, - 559, 0, 559, 0, 559, 559, 559, 0, 559, 559, - 0, 0, 559, 559, 559, 559, 0, 0, 0, 559, - 559, 0, 0, 0, 559, 559, 559, 559, 559, 559, - 559, 559, 560, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 559, 0, 203, 204, 205, 206, 0, - 207, 208, 209, 210, 211, 212, 213, 214, 565, 559, - 215, 216, 217, 218, 219, 220, 221, 222, 0, 0, - 0, 0, 0, 560, 0, 0, 0, 0, 560, 0, - 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, - 560, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 560, 0, 560, 0, 560, 0, 560, 560, - 560, 0, 560, 560, 0, 0, 560, 560, 560, 560, - 0, 0, 0, 560, 560, 0, 566, 0, 560, 560, - 560, 560, 560, 560, 560, 560, 0, 0, 0, 0, - 0, 565, 0, 0, 0, 0, 565, 560, 565, 565, - 565, 565, 565, 565, 565, 565, 565, 565, 565, 0, - 0, 0, 0, 560, 0, 0, 0, 0, 0, 0, - 565, 0, 565, 0, 565, 0, 565, 565, 565, 0, - 0, 0, 0, 0, 565, 565, 565, 565, 0, 0, - 0, 565, 565, 0, 567, 0, 565, 565, 565, 565, - 565, 565, 565, 565, 0, 0, 0, 0, 0, 566, - 0, 0, 0, 0, 566, 565, 566, 566, 566, 566, - 566, 566, 566, 566, 566, 566, 566, 0, 0, 0, - 0, 565, 0, 0, 0, 0, 0, 0, 566, 0, - 566, 0, 566, 0, 566, 566, 566, 0, 0, 0, - 0, 0, 566, 566, 566, 566, 0, 0, 0, 566, - 566, 0, 568, 0, 566, 566, 566, 566, 566, 566, - 566, 566, 0, 0, 0, 0, 0, 567, 0, 0, - 0, 0, 567, 566, 567, 567, 567, 567, 567, 567, - 567, 567, 567, 567, 567, 0, 0, 0, 0, 566, - 0, 0, 0, 0, 0, 0, 567, 0, 567, 0, - 567, 0, 567, 567, 567, 0, 0, 0, 0, 0, - 567, 567, 567, 567, 0, 0, 0, 567, 567, 0, - 569, 0, 0, 0, 567, 567, 567, 567, 567, 567, - 0, 0, 0, 0, 0, 568, 0, 0, 0, 0, - 568, 567, 568, 568, 568, 568, 568, 568, 568, 568, - 568, 568, 568, 0, 0, 0, 0, 567, 0, 0, - 0, 0, 0, 0, 568, 0, 568, 0, 568, 0, - 568, 568, 568, 0, 0, 0, 0, 0, 568, 568, - 568, 568, 0, 0, 0, 568, 568, 0, 570, 0, - 0, 0, 568, 568, 568, 568, 568, 568, 0, 0, - 0, 0, 0, 569, 0, 0, 0, 0, 569, 568, + 0, 561, 559, 0, 0, 0, 0, 561, 0, 0, + 0, 0, 0, 0, 0, 0, 560, 0, 0, 0, + 0, 560, 0, 560, 560, 560, 560, 560, 560, 560, + 560, 560, 560, 560, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 561, 0, 560, 0, 560, 0, 560, + 0, 560, 560, 560, 0, 560, 560, 0, 0, 560, + 560, 560, 560, 0, 0, 0, 560, 560, 0, 564, + 0, 560, 560, 560, 560, 560, 560, 560, 560, 0, + 0, 0, 0, 0, 561, 0, 0, 0, 0, 561, + 560, 561, 561, 561, 561, 561, 561, 561, 561, 561, + 561, 561, 0, 0, 0, 0, 560, 0, 0, 0, + 0, 0, 0, 561, 0, 561, 0, 561, 0, 561, + 561, 561, 0, 561, 561, 0, 0, 561, 561, 561, + 561, 0, 0, 0, 561, 561, 0, 565, 0, 561, + 561, 561, 561, 561, 561, 561, 561, 0, 0, 0, + 0, 0, 564, 0, 0, 0, 0, 564, 561, 564, + 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, + 0, 0, 0, 0, 561, 0, 0, 0, 0, 0, + 0, 564, 0, 564, 0, 564, 0, 564, 564, 564, + 0, 0, 0, 0, 0, 564, 564, 564, 564, 0, + 0, 0, 564, 564, 0, 566, 0, 564, 564, 564, + 564, 564, 564, 564, 564, 0, 0, 0, 0, 0, + 565, 0, 0, 0, 0, 565, 564, 565, 565, 565, + 565, 565, 565, 565, 565, 565, 565, 565, 0, 0, + 0, 0, 564, 0, 0, 0, 0, 0, 0, 565, + 0, 565, 0, 565, 0, 565, 565, 565, 0, 0, + 0, 0, 0, 565, 565, 565, 565, 0, 0, 0, + 565, 565, 0, 567, 0, 565, 565, 565, 565, 565, + 565, 565, 565, 0, 0, 0, 0, 0, 566, 0, + 0, 0, 0, 566, 565, 566, 566, 566, 566, 566, + 566, 566, 566, 566, 566, 566, 0, 0, 0, 0, + 565, 0, 0, 0, 0, 0, 0, 566, 0, 566, + 0, 566, 0, 566, 566, 566, 0, 0, 0, 0, + 0, 566, 566, 566, 566, 0, 0, 0, 566, 566, + 0, 568, 0, 566, 566, 566, 566, 566, 566, 566, + 566, 0, 0, 0, 0, 0, 567, 0, 0, 0, + 0, 567, 566, 567, 567, 567, 567, 567, 567, 567, + 567, 567, 567, 567, 0, 0, 0, 0, 566, 0, + 0, 0, 0, 0, 0, 567, 0, 567, 0, 567, + 0, 567, 567, 567, 0, 0, 0, 0, 0, 567, + 567, 567, 567, 0, 0, 0, 567, 567, 0, 569, + 0, 0, 0, 567, 567, 567, 567, 567, 567, 0, + 0, 0, 0, 0, 568, 0, 0, 0, 0, 568, + 567, 568, 568, 568, 568, 568, 568, 568, 568, 568, + 568, 568, 0, 0, 0, 0, 567, 0, 0, 0, + 0, 0, 0, 568, 0, 568, 0, 568, 0, 568, + 568, 568, 0, 0, 0, 0, 0, 568, 568, 568, + 568, 0, 0, 0, 568, 568, 0, 570, 0, 0, + 0, 568, 568, 568, 568, 568, 568, 0, 0, 0, + 0, 0, 569, 0, 0, 0, 0, 569, 568, 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, - 569, 0, 0, 0, 0, 568, 0, 0, 0, 0, - 0, 0, 569, 0, 569, 0, 569, 0, 569, 569, - 569, 0, 0, 0, 0, 0, 569, 569, 569, 569, - 0, 0, 0, 569, 569, 0, 571, 0, 0, 0, - 569, 569, 569, 569, 569, 569, 0, 0, 0, 0, - 0, 570, 0, 0, 0, 0, 570, 569, 570, 570, - 570, 570, 570, 570, 570, 570, 570, 570, 570, 0, - 0, 0, 0, 569, 0, 0, 0, 0, 0, 0, - 570, 0, 570, 0, 570, 0, 570, 570, 570, 0, - 0, 0, 0, 0, 570, 570, 570, 570, 0, 0, - 0, 570, 570, 0, 572, 0, 0, 0, 570, 570, - 570, 570, 570, 570, 0, 0, 0, 0, 0, 571, - 0, 0, 0, 0, 571, 570, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 0, 0, 0, - 0, 570, 0, 0, 0, 0, 0, 0, 571, 0, - 571, 0, 571, 0, 571, 571, 571, 0, 0, 0, - 0, 0, 571, 571, 571, 571, 0, 0, 0, 571, - 571, 0, 573, 0, 0, 0, 571, 571, 571, 571, - 571, 571, 0, 0, 0, 0, 0, 572, 0, 0, - 0, 0, 572, 571, 572, 572, 572, 572, 572, 572, - 572, 572, 572, 572, 572, 0, 0, 0, 0, 571, - 0, 0, 0, 0, 0, 0, 572, 0, 572, 0, - 572, 0, 572, 572, 572, 0, 0, 0, 0, 0, - 0, 0, 572, 572, 0, 0, 0, 572, 572, 0, - 574, 0, 0, 0, 0, 0, 572, 572, 572, 572, - 0, 0, 0, 0, 0, 573, 0, 0, 0, 0, - 573, 572, 573, 573, 573, 573, 573, 573, 573, 573, - 573, 573, 573, 0, 0, 0, 0, 572, 0, 0, - 0, 0, 0, 0, 573, 0, 573, 0, 573, 0, - 573, 573, 573, 0, 0, 0, 0, 0, 0, 0, - 573, 573, 0, 0, 0, 573, 573, 0, 576, 0, - 0, 0, 0, 0, 573, 573, 573, 573, 0, 0, - 0, 0, 0, 574, 0, 0, 0, 0, 574, 573, + 0, 0, 0, 0, 568, 0, 0, 0, 0, 0, + 0, 569, 0, 569, 0, 569, 0, 569, 569, 569, + 0, 0, 0, 0, 0, 569, 569, 569, 569, 0, + 0, 0, 569, 569, 0, 571, 0, 0, 0, 569, + 569, 569, 569, 569, 569, 0, 0, 0, 0, 0, + 570, 0, 0, 0, 0, 570, 569, 570, 570, 570, + 570, 570, 570, 570, 570, 570, 570, 570, 0, 0, + 0, 0, 569, 0, 0, 0, 0, 0, 0, 570, + 0, 570, 0, 570, 0, 570, 570, 570, 0, 0, + 0, 0, 0, 570, 570, 570, 570, 0, 0, 0, + 570, 570, 0, 572, 0, 0, 0, 570, 570, 570, + 570, 570, 570, 0, 0, 0, 0, 0, 571, 0, + 0, 0, 0, 571, 570, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 0, 0, 0, 0, + 570, 0, 0, 0, 0, 0, 0, 571, 0, 571, + 0, 571, 0, 571, 571, 571, 0, 0, 0, 0, + 0, 571, 571, 571, 571, 0, 0, 0, 571, 571, + 0, 573, 0, 0, 0, 571, 571, 571, 571, 571, + 571, 0, 0, 0, 0, 0, 572, 0, 0, 0, + 0, 572, 571, 572, 572, 572, 572, 572, 572, 572, + 572, 572, 572, 572, 0, 0, 0, 0, 571, 0, + 0, 0, 0, 0, 0, 572, 0, 572, 0, 572, + 0, 572, 572, 572, 0, 0, 0, 0, 0, 0, + 0, 572, 572, 0, 0, 0, 572, 572, 0, 574, + 0, 0, 0, 0, 0, 572, 572, 572, 572, 0, + 0, 0, 0, 0, 573, 0, 0, 0, 0, 573, + 572, 573, 573, 573, 573, 573, 573, 573, 573, 573, + 573, 573, 0, 0, 0, 0, 572, 0, 0, 0, + 0, 0, 0, 573, 0, 573, 0, 573, 0, 573, + 573, 573, 0, 0, 0, 0, 0, 0, 0, 573, + 573, 0, 0, 0, 573, 573, 0, 575, 0, 0, + 0, 0, 0, 573, 573, 573, 573, 0, 0, 0, + 0, 0, 574, 0, 0, 0, 0, 574, 573, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, - 574, 0, 0, 0, 0, 573, 0, 0, 0, 0, - 0, 0, 574, 0, 574, 0, 574, 0, 574, 574, - 574, 0, 0, 0, 0, 0, 0, 0, 574, 574, - 0, 0, 0, 574, 574, 0, 577, 0, 0, 0, - 0, 0, 574, 574, 574, 574, 0, 0, 0, 0, - 0, 576, 0, 0, 0, 0, 576, 574, 576, 576, - 576, 576, 576, 576, 576, 576, 576, 576, 576, 0, - 0, 0, 0, 574, 0, 0, 0, 0, 0, 0, - 576, 0, 576, 0, 576, 0, 576, 576, 576, 0, - 0, 0, 0, 0, 0, 0, 576, 576, 0, 0, - 0, 576, 576, 0, 578, 0, 0, 0, 0, 0, - 0, 0, 576, 576, 0, 0, 0, 0, 0, 577, - 0, 0, 0, 0, 577, 576, 577, 577, 577, 577, - 577, 577, 577, 577, 577, 577, 577, 0, 0, 0, - 0, 576, 0, 0, 0, 0, 0, 0, 577, 0, - 577, 0, 577, 0, 577, 577, 577, 0, 0, 0, - 0, 0, 0, 0, 0, 577, 0, 0, 0, 577, - 577, 0, 579, 0, 0, 0, 0, 0, 0, 0, - 577, 577, 0, 0, 0, 0, 0, 578, 0, 0, - 0, 0, 578, 577, 578, 578, 578, 578, 578, 578, - 578, 578, 578, 578, 578, 0, 0, 0, 0, 577, - 0, 0, 0, 0, 0, 0, 578, 0, 578, 0, - 578, 0, 578, 578, 578, 0, 0, 0, 0, 0, - 0, 0, 0, 578, 0, 0, 0, 578, 578, 0, - 580, 0, 0, 0, 0, 0, 0, 0, 578, 578, - 0, 0, 0, 0, 0, 579, 0, 0, 0, 0, - 579, 578, 579, 579, 579, 579, 579, 579, 579, 579, - 579, 579, 579, 0, 0, 0, 0, 578, 0, 0, - 0, 0, 0, 0, 579, 0, 579, 0, 579, 0, - 579, 579, 579, 0, 0, 0, 0, 0, 0, 0, - 0, 579, 0, 0, 0, 0, 579, 0, 582, 0, - 0, 0, 0, 0, 0, 0, 579, 579, 0, 0, - 0, 0, 0, 580, 0, 0, 0, 0, 580, 579, - 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, - 580, 0, 0, 0, 0, 579, 0, 0, 0, 0, - 0, 0, 580, 0, 580, 0, 580, 0, 580, 580, - 580, 0, 0, 0, 0, 0, 0, 0, 0, 580, - 0, 0, 0, 0, 580, 0, 583, 0, 0, 0, - 0, 0, 0, 0, 580, 580, 0, 0, 0, 0, - 0, 582, 0, 0, 0, 0, 582, 580, 582, 582, - 582, 582, 582, 582, 582, 582, 582, 582, 582, 0, - 0, 0, 0, 580, 0, 0, 0, 0, 0, 0, - 582, 0, 582, 0, 582, 0, 582, 582, 582, 0, + 0, 0, 0, 0, 573, 0, 0, 0, 0, 0, + 0, 574, 0, 574, 0, 574, 0, 574, 574, 574, + 0, 0, 0, 0, 0, 0, 0, 574, 574, 0, + 0, 0, 574, 574, 0, 576, 0, 0, 0, 0, + 0, 574, 574, 574, 574, 0, 0, 0, 0, 0, + 575, 0, 0, 0, 0, 575, 574, 575, 575, 575, + 575, 575, 575, 575, 575, 575, 575, 575, 0, 0, + 0, 0, 574, 0, 0, 0, 0, 0, 0, 575, + 0, 575, 0, 575, 0, 575, 575, 575, 0, 0, + 0, 0, 0, 0, 0, 575, 575, 0, 0, 0, + 575, 575, 0, 577, 0, 0, 0, 0, 0, 0, + 0, 575, 575, 0, 0, 0, 0, 0, 576, 0, + 0, 0, 0, 576, 575, 576, 576, 576, 576, 576, + 576, 576, 576, 576, 576, 576, 0, 0, 0, 0, + 575, 0, 0, 0, 0, 0, 0, 576, 0, 576, + 0, 576, 0, 576, 576, 576, 0, 0, 0, 0, + 0, 0, 0, 576, 576, 0, 0, 0, 576, 576, + 0, 578, 0, 0, 0, 0, 0, 0, 0, 576, + 576, 0, 0, 0, 0, 0, 577, 0, 0, 0, + 0, 577, 576, 577, 577, 577, 577, 577, 577, 577, + 577, 577, 577, 577, 0, 0, 0, 0, 576, 0, + 0, 0, 0, 0, 0, 577, 0, 577, 0, 577, + 0, 577, 577, 577, 0, 0, 0, 0, 0, 0, + 0, 0, 577, 0, 0, 0, 577, 577, 0, 579, + 0, 0, 0, 0, 0, 0, 0, 577, 577, 0, + 0, 0, 0, 0, 578, 0, 0, 0, 0, 578, + 577, 578, 578, 578, 578, 578, 578, 578, 578, 578, + 578, 578, 0, 0, 0, 0, 577, 0, 0, 0, + 0, 0, 0, 578, 0, 578, 0, 578, 0, 578, + 578, 578, 0, 0, 0, 0, 0, 0, 0, 0, + 578, 0, 0, 0, 578, 578, 0, 580, 0, 0, + 0, 0, 0, 0, 0, 578, 578, 0, 0, 0, + 0, 0, 579, 0, 0, 0, 0, 579, 578, 579, + 579, 579, 579, 579, 579, 579, 579, 579, 579, 579, + 0, 0, 0, 0, 578, 0, 0, 0, 0, 0, + 0, 579, 0, 579, 0, 579, 0, 579, 579, 579, + 0, 0, 0, 0, 0, 0, 0, 0, 579, 0, + 0, 0, 0, 579, 0, 581, 0, 0, 0, 0, + 0, 0, 0, 579, 579, 0, 0, 0, 0, 0, + 580, 0, 0, 0, 0, 580, 579, 580, 580, 580, + 580, 580, 580, 580, 580, 580, 580, 580, 0, 0, + 0, 0, 579, 0, 0, 0, 0, 0, 0, 580, + 0, 580, 0, 580, 0, 580, 580, 580, 0, 0, + 0, 0, 0, 0, 0, 0, 580, 0, 0, 0, + 0, 580, 0, 582, 0, 0, 0, 0, 0, 0, + 0, 580, 580, 0, 0, 0, 0, 0, 581, 0, + 0, 0, 0, 581, 580, 581, 581, 581, 581, 581, + 581, 581, 581, 581, 581, 581, 0, 0, 0, 0, + 580, 0, 0, 0, 0, 0, 0, 581, 0, 581, + 0, 581, 0, 581, 581, 581, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 581, + 0, 583, 0, 0, 0, 0, 0, 0, 0, 581, + 581, 0, 0, 0, 0, 0, 582, 0, 0, 0, + 0, 582, 581, 582, 582, 582, 582, 582, 582, 582, + 582, 582, 582, 582, 0, 0, 0, 0, 581, 0, + 0, 0, 0, 0, 0, 582, 0, 582, 0, 582, + 0, 582, 582, 582, 0, 0, 0, 584, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 582, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 582, 582, 0, + 0, 0, 0, 0, 583, 0, 0, 0, 0, 583, + 582, 583, 583, 583, 583, 583, 583, 583, 583, 583, + 583, 583, 0, 0, 0, 0, 582, 0, 0, 0, + 0, 0, 0, 583, 0, 583, 0, 583, 0, 583, + 583, 583, 0, 0, 0, 0, 337, 0, 0, 0, + 745, 0, 0, 0, 0, 583, 0, 0, 0, 0, + 584, 0, 0, 0, 0, 584, 583, 584, 584, 584, + 584, 584, 584, 584, 584, 584, 584, 584, 583, 0, + 0, 0, 337, 0, 0, 0, 0, 0, 0, 584, + 0, 584, 0, 584, 583, 584, 584, 584, 745, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 584, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 582, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 582, 582, 0, 0, 0, 0, 0, 583, - 0, 0, 0, 0, 583, 582, 583, 583, 583, 583, - 583, 583, 583, 583, 583, 583, 583, 0, 0, 0, - 0, 582, 0, 0, 0, 0, 0, 0, 583, 0, - 583, 0, 583, 0, 583, 583, 583, 0, 0, 0, - 0, 336, 0, 0, 0, 745, 0, 0, 0, 0, - 583, 0, 0, 0, 0, 584, 0, 0, 0, 0, - 584, 583, 584, 584, 584, 584, 584, 584, 584, 584, - 584, 584, 584, 583, 0, 0, 0, 336, 0, 0, - 0, 0, 0, 0, 584, 0, 584, 0, 584, 583, - 584, 584, 584, 745, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, - 0, 0, 0, 0, 0, 0, 336, 0, 0, 0, - 0, 0, 336, 0, 0, 584, 0, 336, 336, 0, - 336, 0, 336, 0, 745, 336, 0, 336, 336, 0, - 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, - 0, 336, 336, 336, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 0, 0, 55, 0, 336, 0, 336, - 0, 0, 336, 56, 24, 57, 25, 0, 336, 26, - 58, 0, 59, 60, 27, 61, 62, 63, 28, 0, - 0, 0, 0, 0, 64, 0, 65, 30, 66, 67, - 68, 69, 0, 0, 32, 0, 0, 0, 70, 33, - 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 73, 0, 36, 0, 37, 74, 0, - 0, 38, 0, 75, 76, 77, 78, 79, 80, 39, - 40, 81, 82, 41, 83, 0, 84, 0, 0, 85, - 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, - 91, 92, 93, 0, 0, 0, 94, 0, 0, 0, - 95, 0, 0, 0, 0, 96, 97, 98, 99, 100, - 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, - 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, + 0, 337, 0, 0, 0, 0, 0, 337, 0, 0, + 584, 0, 337, 337, 0, 337, 0, 337, 0, 745, + 337, 0, 337, 337, 0, 337, 337, 337, 337, 337, + 337, 337, 337, 337, 337, 0, 337, 337, 337, 337, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 337, 337, 337, 337, 337, 337, 337, 0, 0, + 55, 0, 337, 0, 337, 0, 0, 337, 56, 24, + 57, 25, 0, 337, 26, 58, 0, 59, 60, 27, + 61, 62, 63, 28, 0, 0, 0, 0, 0, 64, + 0, 65, 30, 66, 67, 68, 69, 0, 0, 32, + 0, 0, 0, 70, 33, 0, 71, 72, 34, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 73, 0, + 36, 0, 37, 74, 0, 0, 38, 0, 75, 76, + 77, 78, 79, 80, 39, 40, 81, 82, 41, 83, + 0, 84, 0, 0, 85, 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 266, 0, 0, 0, 105, 106, 107, 108, - 56, 24, 57, 25, 0, 0, 26, 58, 0, 59, - 60, 27, 61, 62, 63, 28, 0, 0, 0, 0, - 0, 64, 0, 65, 30, 66, 67, 68, 69, 0, - 0, 32, 0, 0, 0, 70, 33, 0, 71, 72, - 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 73, 0, 36, 0, 37, 74, 0, 0, 38, 0, - 75, 76, 77, 78, 79, 80, 39, 40, 81, 82, - 41, 83, 0, 84, 0, 0, 85, 86, 0, 0, - 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 89, 90, 91, 92, 93, - 0, 0, 0, 94, 0, 0, 0, 95, 0, 0, - 0, 0, 96, 97, 98, 99, 100, 0, 0, 0, - 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, + 0, 0, 0, 89, 90, 91, 92, 93, 0, 0, + 0, 94, 0, 0, 0, 95, 0, 0, 0, 0, + 96, 97, 98, 99, 100, 0, 0, 0, 101, 0, + 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 556, - 0, 0, 0, 105, 106, 107, 108, 56, 24, 57, - 25, 0, 0, 26, 58, 0, 59, 60, 27, 61, - 62, 63, 28, 0, 0, 0, 0, 0, 64, 0, - 65, 30, 66, 67, 68, 69, 0, 0, 32, 0, - 0, 0, 70, 33, 0, 71, 72, 34, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 73, 0, 36, - 0, 37, 74, 0, 0, 38, 0, 75, 76, 77, - 78, 79, 80, 39, 40, 81, 82, 41, 83, 0, - 84, 0, 0, 85, 86, 0, 0, 87, 88, 0, + 0, 0, 0, 0, 0, 0, 0, 265, 0, 0, + 0, 105, 106, 107, 108, 56, 24, 57, 25, 0, + 0, 26, 58, 0, 59, 60, 27, 61, 62, 63, + 28, 0, 0, 0, 0, 0, 64, 0, 65, 30, + 66, 67, 68, 69, 0, 0, 32, 0, 0, 0, + 70, 33, 0, 71, 72, 34, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 73, 0, 36, 0, 37, + 74, 0, 0, 38, 0, 75, 76, 77, 78, 79, + 80, 39, 40, 81, 82, 41, 83, 0, 84, 0, + 0, 85, 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 89, 90, 91, 92, 93, 0, 0, 0, - 94, 0, 0, 0, 95, 0, 0, 0, 0, 96, - 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, - 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, + 89, 90, 91, 92, 93, 0, 0, 0, 94, 0, + 0, 0, 95, 0, 0, 0, 0, 96, 97, 98, + 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, + 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 952, 0, 0, 0, - 105, 557, 107, 108, 952, 952, 952, 952, 0, 0, - 952, 952, 0, 952, 952, 952, 952, 952, 952, 952, - 0, 0, 0, 0, 0, 952, 0, 952, 952, 952, - 952, 952, 952, 0, 0, 952, 0, 0, 0, 952, - 952, 0, 952, 952, 952, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 952, 0, 952, 0, 952, 952, - 0, 0, 952, 0, 952, 952, 952, 952, 952, 952, - 952, 952, 952, 952, 952, 952, 0, 952, 0, 0, - 952, 952, 0, 0, 952, 952, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 952, - 952, 952, 952, 952, 0, 0, 0, 952, 0, 0, - 0, 952, 0, 0, 0, 0, 952, 952, 952, 952, - 952, 0, 0, 0, 952, 0, 952, 0, 0, 0, - 0, 0, 952, 952, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 556, 0, 0, 0, 105, 106, + 107, 108, 56, 24, 57, 25, 0, 0, 26, 58, + 0, 59, 60, 27, 61, 62, 63, 28, 0, 0, + 0, 0, 0, 64, 0, 65, 30, 66, 67, 68, + 69, 0, 0, 32, 0, 0, 0, 70, 33, 0, + 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 73, 0, 36, 0, 37, 74, 0, 0, + 38, 0, 75, 76, 77, 78, 79, 80, 39, 40, + 81, 82, 41, 83, 0, 84, 0, 0, 85, 86, + 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, + 92, 93, 0, 0, 0, 94, 0, 0, 0, 95, + 0, 0, 0, 0, 96, 97, 98, 99, 100, 0, + 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, + 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 796, 0, 0, 0, 952, 952, 952, - 952, 796, 796, 796, 796, 0, 0, 796, 796, 0, - 796, 796, 796, 796, 796, 796, 796, 0, 0, 0, - 0, 0, 796, 0, 796, 796, 796, 796, 796, 796, - 0, 0, 796, 0, 0, 0, 796, 796, 0, 796, - 796, 796, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 796, 0, 796, 0, 796, 796, 0, 0, 796, - 0, 796, 796, 796, 796, 796, 796, 796, 796, 796, - 796, 796, 796, 0, 796, 0, 0, 796, 796, 0, - 0, 796, 796, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 796, 796, 796, 796, - 796, 0, 0, 0, 796, 0, 0, 0, 796, 0, - 0, 0, 0, 796, 796, 796, 796, 796, 0, 0, - 0, 796, 0, 796, 0, 0, 0, 0, 0, 796, - 796, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 954, 0, 0, 0, 105, 557, 107, 108, 954, + 954, 954, 954, 0, 0, 954, 954, 0, 954, 954, + 954, 954, 954, 954, 954, 0, 0, 0, 0, 0, + 954, 0, 954, 954, 954, 954, 954, 954, 0, 0, + 954, 0, 0, 0, 954, 954, 0, 954, 954, 954, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 954, + 0, 954, 0, 954, 954, 0, 0, 954, 0, 954, + 954, 954, 954, 954, 954, 954, 954, 954, 954, 954, + 954, 0, 954, 0, 0, 954, 954, 0, 0, 954, + 954, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 954, 954, 954, 954, 954, 0, + 0, 0, 954, 0, 0, 0, 954, 0, 0, 0, + 0, 954, 954, 954, 954, 954, 0, 0, 0, 954, + 0, 954, 0, 0, 0, 0, 0, 954, 954, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 743, 0, 0, 0, 796, 796, 796, 796, 56, 24, - 0, 25, 0, 0, 26, 253, 0, 1051, 0, 27, - 61, 62, 0, 28, 0, 0, 24, 0, 25, 64, - 0, 26, 30, 0, 0, 0, 27, 0, 0, 32, - 28, 0, 0, 0, 33, 0, 71, 72, 34, 30, - 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, - 36, 33, 37, 74, 0, 34, 38, 0, 0, 76, - 0, 78, 0, 80, 39, 40, 254, 36, 41, 37, - 0, 0, 0, 38, 0, 86, 0, 0, 87, 88, - 0, 39, 40, 0, 0, 41, 0, 0, 322, 0, - 0, 0, 0, 89, 90, 91, 92, 302, 0, 0, - 0, 518, 744, 0, 0, 95, 0, 0, 0, 0, - 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, - 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 796, 0, + 0, 0, 954, 954, 954, 954, 796, 796, 796, 796, + 0, 0, 796, 796, 0, 796, 796, 796, 796, 796, + 796, 796, 0, 0, 0, 0, 0, 796, 0, 796, + 796, 796, 796, 796, 796, 0, 0, 796, 0, 0, + 0, 796, 796, 0, 796, 796, 796, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 796, 0, 796, 0, + 796, 796, 0, 0, 796, 0, 796, 796, 796, 796, + 796, 796, 796, 796, 796, 796, 796, 796, 0, 796, + 0, 0, 796, 796, 0, 0, 796, 796, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 931, 0, 0, - 0, 105, 303, 107, 108, 56, 24, 0, 25, 0, - 0, 26, 253, 0, 0, 0, 27, 61, 62, 355, - 28, 0, 0, 174, 0, 174, 64, 0, 174, 30, - 0, 0, 0, 174, 0, 0, 32, 174, 0, 0, - 0, 33, 0, 71, 72, 34, 174, 593, 0, 0, - 0, 0, 0, 174, 594, 0, 0, 36, 174, 37, - 74, 0, 174, 38, 0, 0, 76, 0, 78, 0, - 80, 39, 40, 254, 174, 41, 174, 0, 0, 0, - 174, 0, 595, 0, 0, 87, 88, 0, 174, 174, - 0, 0, 174, 0, 0, 174, 0, 0, 0, 0, - 89, 90, 91, 92, 93, 0, 0, 0, 0, 0, - 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, - 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, - 976, 0, 0, 103, 104, 0, 0, 0, 0, 0, + 0, 796, 796, 796, 796, 796, 0, 0, 0, 796, + 0, 0, 0, 796, 0, 0, 0, 0, 796, 796, + 796, 796, 796, 0, 0, 0, 796, 0, 796, 0, + 0, 0, 0, 0, 796, 796, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 935, 0, 0, 0, 105, 106, - 107, 108, 56, 24, 0, 25, 0, 0, 26, 253, - 0, 0, 0, 27, 61, 62, 174, 28, 0, 0, - 174, 0, 174, 64, 0, 174, 30, 0, 0, 0, - 174, 0, 0, 32, 174, 0, 0, 0, 33, 0, - 71, 72, 34, 174, 0, 0, 0, 0, 0, 0, - 174, 0, 0, 0, 36, 174, 37, 74, 936, 174, - 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, - 254, 174, 41, 174, 0, 0, 0, 174, 0, 86, - 0, 0, 87, 88, 0, 174, 174, 0, 0, 174, - 0, 0, 174, 0, 0, 0, 0, 89, 90, 91, - 92, 302, 0, 0, 0, 518, 0, 0, 0, 95, - 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, - 0, 0, 101, 0, 102, 976, 0, 0, 0, 0, - 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, - 0, 25, 0, 0, 26, 253, 0, 0, 0, 27, - 61, 62, 0, 28, 0, 105, 303, 107, 108, 64, - 0, 0, 30, 0, 0, 0, 0, 0, 0, 32, - 0, 0, 0, 174, 33, 0, 71, 72, 34, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 36, 0, 37, 74, 0, 0, 38, 0, 0, 76, - 0, 78, 0, 80, 39, 40, 254, 0, 41, 0, - 0, 0, 0, 0, 0, 86, 0, 0, 87, 88, + 0, 0, 0, 0, 0, 743, 0, 0, 0, 796, + 796, 796, 796, 56, 24, 0, 25, 0, 0, 26, + 253, 0, 0, 0, 27, 61, 62, 0, 28, 0, + 0, 174, 0, 174, 64, 0, 174, 30, 0, 0, + 0, 174, 0, 0, 32, 174, 0, 0, 0, 33, + 0, 71, 72, 34, 174, 0, 0, 0, 0, 0, + 0, 174, 0, 0, 0, 36, 174, 37, 74, 0, + 174, 38, 0, 0, 76, 0, 78, 0, 80, 39, + 40, 254, 174, 41, 174, 0, 0, 0, 174, 0, + 86, 0, 0, 87, 88, 0, 174, 174, 0, 0, + 174, 0, 0, 174, 0, 0, 0, 0, 89, 90, + 91, 92, 301, 0, 0, 0, 517, 744, 0, 0, + 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, + 0, 0, 0, 101, 0, 102, 0, 0, 978, 0, + 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 89, 90, 91, 92, 302, 0, 0, - 0, 729, 1003, 0, 0, 95, 0, 0, 0, 0, - 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, - 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, + 0, 0, 932, 0, 0, 0, 105, 302, 107, 108, + 56, 24, 0, 25, 0, 0, 26, 253, 0, 0, + 0, 27, 61, 62, 174, 28, 0, 0, 174, 0, + 174, 64, 0, 174, 30, 0, 0, 0, 174, 0, + 0, 32, 174, 0, 0, 0, 33, 0, 71, 72, + 34, 174, 594, 0, 0, 0, 0, 0, 174, 595, + 0, 0, 36, 174, 37, 74, 0, 174, 38, 0, + 0, 76, 0, 78, 0, 80, 39, 40, 254, 174, + 41, 174, 0, 0, 0, 174, 0, 596, 0, 0, + 87, 88, 0, 174, 174, 0, 0, 174, 0, 0, + 174, 0, 0, 0, 0, 89, 90, 91, 92, 93, + 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, + 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, + 101, 0, 102, 978, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 743, - 0, 105, 730, 107, 108, 0, 0, 56, 24, 0, - 25, 0, 731, 26, 253, 0, 0, 0, 27, 61, - 62, 0, 28, 0, 0, 24, 0, 25, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 936, + 0, 0, 0, 105, 106, 107, 108, 56, 24, 0, + 25, 0, 0, 26, 253, 0, 0, 0, 27, 61, + 62, 174, 28, 0, 0, 24, 0, 25, 64, 0, 26, 30, 0, 0, 0, 27, 0, 0, 32, 28, 0, 0, 0, 33, 0, 71, 72, 34, 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 36, - 33, 37, 74, 936, 34, 38, 0, 0, 76, 0, + 33, 37, 74, 937, 34, 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, 254, 36, 41, 37, 0, 0, 0, 38, 0, 86, 0, 0, 87, 88, 0, 39, 40, 0, 0, 41, 0, 0, 322, 0, 0, - 0, 0, 89, 90, 91, 92, 302, 0, 0, 0, - 518, 0, 0, 0, 95, 0, 0, 0, 0, 0, + 0, 0, 89, 90, 91, 92, 301, 0, 0, 0, + 517, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, 253, 0, 0, 0, 27, 61, 62, 0, 28, 0, - 105, 303, 107, 108, 64, 0, 0, 30, 0, 0, + 105, 302, 107, 108, 64, 0, 0, 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 355, 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 37, 74, 0, @@ -10883,7 +10911,7 @@ void case_980() 40, 254, 0, 41, 0, 0, 0, 0, 0, 0, 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, - 91, 92, 302, 0, 0, 0, 729, 0, 0, 0, + 91, 92, 301, 0, 0, 0, 729, 1004, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, @@ -10894,210 +10922,249 @@ void case_980() 24, 0, 25, 64, 0, 26, 30, 0, 0, 0, 27, 0, 0, 32, 28, 0, 0, 0, 33, 0, 71, 72, 34, 30, 0, 0, 0, 0, 0, 0, - 32, 0, 0, 0, 36, 33, 37, 74, 0, 34, + 32, 0, 0, 0, 36, 33, 37, 74, 937, 34, 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, 254, 36, 41, 37, 0, 0, 0, 38, 0, 86, 0, 0, 87, 88, 0, 39, 40, 0, 0, 41, - 0, 0, 520, 0, 0, 0, 0, 89, 90, 91, - 92, 302, 0, 0, 0, 518, 0, 0, 0, 95, + 0, 0, 519, 0, 0, 0, 0, 89, 90, 91, + 92, 301, 0, 0, 0, 517, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, - 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 301, 0, 0, 0, 105, 303, 107, 108, 56, - 24, 0, 25, 0, 0, 26, 253, 0, 0, 0, - 27, 61, 62, 355, 28, 0, 0, 24, 0, 25, - 64, 0, 26, 30, 0, 0, 0, 27, 0, 0, - 32, 28, 0, 0, 0, 33, 0, 71, 72, 34, - 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, - 0, 36, 33, 37, 74, 0, 34, 38, 0, 0, - 76, 0, 78, 0, 80, 39, 40, 254, 36, 41, - 37, 0, 0, 0, 38, 0, 86, 0, 0, 87, - 88, 0, 39, 40, 0, 0, 41, 0, 0, 573, - 0, 0, 0, 0, 89, 90, 91, 92, 302, 0, - 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, - 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, - 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 310, 0, - 0, 0, 105, 303, 107, 108, 56, 24, 0, 25, - 0, 0, 26, 253, 0, 0, 0, 27, 61, 62, - 355, 28, 0, 0, 24, 0, 25, 64, 0, 26, - 30, 0, 0, 0, 27, 0, 0, 32, 28, 0, - 0, 0, 33, 0, 71, 72, 34, 30, 0, 0, - 0, 0, 0, 0, 32, 0, 0, 0, 36, 33, - 37, 74, 0, 34, 38, 0, 0, 76, 0, 78, - 0, 80, 39, 40, 254, 36, 41, 37, 0, 0, - 0, 38, 0, 86, 0, 0, 87, 88, 0, 39, - 40, 0, 0, 41, 0, 0, 758, 0, 0, 0, - 0, 89, 90, 91, 92, 302, 0, 0, 0, 0, - 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, - 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, - 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, + 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, + 0, 25, 0, 0, 26, 253, 0, 0, 0, 27, + 61, 62, 0, 28, 0, 105, 302, 107, 108, 64, + 0, 0, 30, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 355, 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 591, 0, 0, 0, 105, - 303, 107, 108, 56, 24, 0, 25, 0, 0, 26, - 253, 0, 0, 0, 27, 61, 62, 355, 28, 0, - 0, 490, 0, 490, 64, 0, 490, 30, 0, 0, - 0, 490, 0, 0, 32, 490, 0, 0, 0, 33, - 0, 71, 72, 34, 490, 0, 0, 0, 0, 0, - 0, 490, 0, 0, 0, 36, 490, 37, 74, 0, - 490, 38, 0, 0, 76, 0, 78, 0, 80, 39, - 40, 254, 490, 41, 490, 0, 0, 0, 490, 0, - 86, 0, 0, 87, 88, 0, 490, 490, 0, 0, - 490, 0, 0, 490, 0, 0, 0, 0, 89, 90, - 91, 92, 93, 0, 0, 0, 0, 0, 0, 0, - 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, - 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, - 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 37, 74, 0, 0, 38, 0, 0, 76, + 0, 78, 0, 80, 39, 40, 254, 0, 41, 0, + 0, 0, 0, 0, 0, 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 822, 0, 0, 0, 105, 106, 107, 108, - 56, 24, 0, 25, 0, 0, 26, 253, 0, 0, - 0, 27, 61, 62, 490, 28, 0, 0, 175, 0, - 175, 64, 0, 175, 30, 0, 0, 0, 175, 0, - 0, 32, 175, 0, 0, 0, 33, 0, 71, 72, - 34, 175, 0, 0, 0, 0, 0, 0, 175, 0, - 0, 0, 36, 175, 37, 74, 0, 175, 38, 0, - 0, 76, 0, 78, 0, 80, 39, 40, 254, 175, - 41, 175, 0, 0, 0, 175, 0, 86, 0, 0, - 87, 88, 0, 175, 175, 0, 0, 175, 0, 0, - 175, 0, 0, 0, 0, 89, 90, 91, 92, 302, - 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, - 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, - 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, + 0, 0, 0, 89, 90, 91, 92, 301, 0, 0, + 0, 729, 0, 0, 0, 95, 0, 0, 0, 0, + 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, + 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1188, - 0, 0, 0, 105, 303, 107, 108, 56, 24, 0, - 25, 0, 0, 26, 253, 0, 0, 0, 27, 61, - 62, 175, 28, 0, 0, 174, 0, 174, 64, 0, - 174, 30, 0, 0, 0, 174, 0, 0, 32, 174, - 0, 0, 0, 33, 0, 71, 72, 34, 174, 0, - 0, 0, 0, 0, 0, 174, 0, 0, 0, 36, - 174, 37, 74, 0, 174, 38, 0, 0, 76, 0, - 78, 0, 80, 39, 40, 254, 174, 41, 174, 0, - 0, 0, 174, 0, 86, 0, 0, 87, 88, 0, - 174, 174, 0, 0, 174, 0, 0, 174, 0, 0, - 0, 0, 89, 90, 91, 92, 302, 0, 0, 0, - 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 743, + 0, 105, 730, 107, 108, 0, 0, 56, 24, 0, + 25, 0, 731, 26, 253, 0, 0, 0, 27, 61, + 62, 0, 28, 0, 0, 24, 0, 25, 64, 0, + 26, 30, 0, 0, 0, 27, 0, 0, 32, 28, + 0, 0, 0, 33, 0, 71, 72, 34, 30, 0, + 0, 0, 0, 0, 0, 32, 0, 0, 0, 36, + 33, 37, 74, 0, 34, 38, 0, 0, 76, 0, + 78, 0, 80, 39, 40, 254, 36, 41, 37, 0, + 0, 0, 38, 0, 86, 0, 0, 87, 88, 0, + 39, 40, 0, 0, 41, 0, 0, 573, 0, 0, + 0, 0, 89, 90, 91, 92, 301, 0, 0, 0, + 517, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 300, 0, 0, 0, + 105, 302, 107, 108, 56, 24, 0, 25, 0, 0, + 26, 253, 0, 0, 0, 27, 61, 62, 355, 28, + 0, 0, 24, 0, 25, 64, 0, 26, 30, 0, + 0, 0, 27, 0, 0, 32, 28, 0, 0, 0, + 33, 0, 71, 72, 34, 30, 0, 0, 0, 0, + 0, 0, 32, 0, 0, 0, 36, 33, 37, 74, + 0, 34, 38, 0, 0, 76, 0, 78, 0, 80, + 39, 40, 254, 36, 41, 37, 0, 0, 0, 38, + 0, 86, 0, 0, 87, 88, 0, 39, 40, 0, + 0, 41, 0, 0, 758, 0, 0, 0, 0, 89, + 90, 91, 92, 301, 0, 0, 0, 0, 0, 0, + 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, + 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, + 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 309, 0, 0, 0, 105, 302, 107, + 108, 56, 24, 0, 25, 0, 0, 26, 253, 0, + 0, 0, 27, 61, 62, 355, 28, 0, 0, 491, + 0, 491, 64, 0, 491, 30, 0, 0, 0, 491, + 0, 0, 32, 491, 0, 0, 0, 33, 0, 71, + 72, 34, 491, 0, 0, 0, 0, 0, 0, 491, + 0, 0, 0, 36, 491, 37, 74, 0, 491, 38, + 0, 0, 76, 0, 78, 0, 80, 39, 40, 254, + 491, 41, 491, 0, 0, 0, 491, 0, 86, 0, + 0, 87, 88, 0, 491, 491, 0, 0, 491, 0, + 0, 491, 0, 0, 0, 0, 89, 90, 91, 92, + 301, 0, 0, 0, 0, 0, 0, 0, 95, 0, + 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, + 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, + 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 592, 0, 0, 0, 105, 302, 107, 108, 56, 24, + 0, 25, 0, 0, 26, 253, 0, 0, 0, 27, + 61, 62, 491, 28, 0, 0, 175, 0, 175, 64, + 0, 175, 30, 0, 0, 0, 175, 0, 0, 32, + 175, 0, 0, 0, 33, 0, 71, 72, 34, 175, + 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, + 36, 175, 37, 74, 0, 175, 38, 0, 0, 76, + 0, 78, 0, 80, 39, 40, 254, 175, 41, 175, + 0, 0, 0, 175, 0, 86, 0, 0, 87, 88, + 0, 175, 175, 0, 0, 175, 0, 0, 175, 0, + 0, 0, 0, 89, 90, 91, 92, 93, 0, 0, + 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, + 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, + 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 823, 0, 0, + 0, 105, 106, 107, 108, 56, 24, 0, 25, 0, + 0, 26, 253, 0, 0, 0, 27, 61, 62, 175, + 28, 0, 0, 174, 0, 174, 64, 0, 174, 30, + 0, 0, 0, 174, 0, 0, 32, 174, 0, 0, + 0, 33, 0, 71, 72, 34, 174, 0, 0, 0, + 0, 0, 0, 174, 0, 0, 0, 36, 174, 37, + 74, 0, 174, 38, 0, 0, 76, 0, 78, 0, + 80, 39, 40, 254, 174, 41, 174, 0, 0, 0, + 174, 0, 86, 0, 0, 87, 88, 0, 174, 174, + 0, 0, 174, 0, 0, 174, 0, 0, 0, 0, + 89, 90, 91, 92, 301, 0, 0, 0, 0, 0, + 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, + 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, + 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1189, 0, 0, 0, 105, 302, + 107, 108, 56, 24, 0, 25, 0, 0, 26, 253, + 0, 0, 0, 27, 61, 62, 174, 28, 0, 0, + 184, 0, 184, 64, 0, 184, 30, 0, 0, 0, + 184, 0, 0, 32, 184, 0, 0, 0, 33, 0, + 71, 72, 34, 184, 0, 0, 0, 0, 0, 0, + 184, 0, 0, 0, 36, 184, 37, 74, 0, 184, + 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, + 254, 184, 41, 184, 0, 0, 0, 184, 0, 86, + 0, 0, 87, 88, 0, 184, 184, 0, 0, 184, + 0, 0, 184, 0, 0, 0, 0, 89, 90, 91, + 92, 301, 0, 0, 0, 0, 0, 0, 0, 95, + 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, + 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, + 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 610, 0, 0, 0, 105, 302, 107, 108, 610, + 610, 0, 610, 0, 0, 610, 610, 0, 0, 0, + 610, 610, 610, 184, 610, 0, 0, 0, 0, 0, + 610, 0, 0, 610, 0, 0, 0, 0, 0, 0, + 610, 0, 0, 0, 0, 610, 0, 610, 610, 610, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 610, 0, 610, 610, 0, 0, 610, 0, 0, + 610, 0, 610, 0, 610, 610, 610, 610, 0, 610, + 0, 0, 0, 0, 0, 0, 610, 0, 0, 610, + 610, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 610, 610, 610, 610, 610, 0, 0, 0, 0, 0, 0, 0, 610, 0, 0, 0, - 105, 303, 107, 108, 610, 610, 0, 610, 0, 0, - 610, 610, 0, 0, 0, 610, 610, 610, 174, 610, - 0, 0, 0, 0, 0, 610, 0, 0, 610, 0, - 0, 0, 0, 0, 0, 610, 0, 0, 0, 0, - 610, 0, 610, 610, 610, 0, 0, 0, 0, 0, - 0, 0, 336, 0, 0, 0, 610, 0, 610, 610, - 0, 0, 610, 0, 0, 610, 0, 610, 0, 610, - 610, 610, 610, 0, 610, 0, 0, 0, 0, 0, - 0, 610, 0, 0, 610, 610, 0, 0, 336, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 610, - 610, 610, 610, 610, 0, 0, 0, 0, 0, 0, - 0, 610, 0, 0, 0, 0, 0, 610, 610, 610, - 610, 0, 0, 0, 610, 0, 610, 0, 0, 0, - 0, 0, 610, 610, 0, 0, 0, 0, 0, 0, + 0, 0, 610, 610, 610, 610, 0, 0, 0, 610, + 0, 610, 0, 0, 0, 0, 0, 610, 610, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 610, 610, 610, - 610, 336, 336, 336, 336, 745, 0, 0, 336, 336, - 0, 0, 336, 336, 336, 336, 336, 336, 336, 336, - 336, 0, 336, 336, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, - 336, 336, 336, 336, 0, 48, 0, 48, 0, 48, - 336, 48, 0, 336, 48, 0, 48, 48, 0, 48, - 0, 48, 0, 48, 0, 48, 48, 48, 48, 0, - 0, 48, 48, 0, 0, 0, 0, 48, 48, 48, - 48, 48, 0, 0, 48, 0, 48, 0, 48, 0, - 48, 48, 0, 48, 48, 48, 48, 0, 0, 48, - 48, 48, 48, 0, 0, 48, 48, 48, 0, 0, - 0, 0, 0, 0, 48, 48, 0, 48, 48, 0, - 48, 48, 48, 0, 0, 0, 48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 500, 0, + 0, 0, 610, 610, 610, 610, 56, 24, 0, 25, + 0, 0, 26, 253, 0, 0, 0, 27, 61, 62, + 0, 28, 0, 0, 0, 0, 0, 64, 0, 0, + 30, 0, 0, 0, 27, 0, 0, 32, 0, 0, + 0, 337, 33, 0, 71, 72, 34, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 27, 36, 0, + 37, 74, 0, 0, 38, 0, 0, 76, 0, 78, + 27, 80, 39, 40, 254, 27, 41, 337, 0, 0, + 27, 0, 27, 27, 27, 27, 0, 0, 27, 0, + 27, 0, 0, 0, 27, 0, 0, 0, 0, 0, + 0, 89, 90, 91, 255, 0, 27, 0, 0, 27, + 0, 27, 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 48, 0, 48, 48, - 47, 0, 0, 0, 47, 0, 47, 0, 0, 47, - 0, 47, 47, 0, 47, 0, 47, 0, 47, 0, - 47, 47, 47, 47, 0, 0, 47, 47, 0, 0, - 0, 0, 47, 0, 47, 47, 47, 0, 0, 47, - 0, 47, 0, 47, 0, 0, 47, 0, 47, 47, - 47, 47, 48, 0, 0, 47, 47, 47, 0, 0, - 47, 47, 47, 0, 0, 0, 0, 0, 0, 47, - 47, 0, 47, 47, 0, 47, 47, 47, 0, 0, - 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, - 0, 47, 0, 47, 0, 47, 0, 80, 47, 0, - 47, 47, 0, 47, 0, 47, 47, 47, 0, 47, + 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, + 0, 27, 27, 0, 0, 0, 0, 0, 0, 0, + 337, 337, 337, 337, 745, 0, 0, 337, 337, 105, + 501, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 0, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 337, 337, 0, 48, 0, 48, 0, 48, 337, + 48, 0, 337, 48, 0, 48, 48, 0, 48, 0, + 48, 0, 48, 0, 48, 48, 48, 48, 0, 0, + 48, 48, 0, 0, 0, 0, 48, 48, 48, 48, + 48, 0, 0, 48, 0, 48, 0, 48, 0, 48, + 48, 0, 48, 48, 48, 48, 0, 0, 48, 48, + 48, 48, 0, 0, 48, 48, 48, 0, 0, 0, + 0, 0, 0, 48, 48, 0, 48, 48, 0, 48, + 48, 48, 0, 0, 0, 48, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 48, 0, 48, 48, 47, + 0, 0, 0, 47, 0, 47, 0, 0, 47, 0, + 47, 47, 0, 47, 0, 47, 0, 47, 0, 47, 47, 47, 47, 0, 0, 47, 47, 0, 0, 0, 0, 47, 0, 47, 47, 47, 0, 0, 47, 0, 47, 0, 47, 0, 0, 47, 0, 47, 47, 47, - 47, 0, 0, 0, 47, 47, 47, 47, 0, 47, + 47, 48, 0, 0, 47, 47, 47, 0, 0, 47, 47, 47, 0, 0, 0, 0, 0, 0, 47, 47, 0, 47, 47, 0, 47, 47, 47, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, - 47, 0, 48, 0, 48, 0, 81, 48, 0, 48, - 48, 0, 48, 0, 48, 47, 48, 0, 48, 48, - 48, 48, 0, 0, 48, 48, 0, 0, 0, 0, - 48, 0, 48, 48, 48, 0, 0, 48, 0, 48, - 0, 48, 0, 0, 48, 0, 48, 48, 48, 48, - 0, 0, 0, 48, 48, 48, 47, 0, 48, 48, - 48, 0, 0, 0, 0, 0, 0, 48, 48, 0, - 48, 48, 0, 48, 48, 48, 0, 0, 0, 48, - 0, 0, 0, 0, 47, 0, 0, 0, 47, 0, - 47, 0, 0, 47, 0, 47, 47, 0, 47, 48, - 47, 0, 47, 0, 47, 47, 47, 47, 0, 0, - 47, 47, 0, 0, 48, 0, 47, 0, 47, 47, - 47, 0, 0, 47, 0, 47, 0, 47, 0, 0, - 47, 0, 47, 47, 47, 47, 0, 0, 0, 47, - 47, 47, 0, 0, 47, 47, 47, 0, 0, 0, - 0, 0, 0, 47, 47, 48, 47, 47, 0, 47, - 47, 47, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 0, - 0, 0, 47, 0, 47, 47, 0, 47, 0, 47, - 47, 214, 47, 0, 47, 0, 47, 0, 47, 47, + 47, 0, 47, 0, 47, 0, 80, 47, 0, 47, + 47, 0, 47, 0, 47, 47, 47, 0, 47, 47, 47, 47, 0, 0, 47, 47, 0, 0, 0, 0, 47, 0, 47, 47, 47, 0, 0, 47, 0, 47, - 336, 47, 0, 0, 47, 0, 47, 47, 47, 47, - 0, 0, 0, 47, 47, 47, 0, 0, 47, 47, - 47, 47, 0, 336, 0, 0, 0, 47, 47, 0, - 47, 47, 0, 47, 47, 47, 336, 0, 0, 47, - 0, 336, 0, 0, 336, 0, 336, 0, 336, 336, - 336, 336, 0, 0, 0, 0, 336, 0, 0, 47, - 336, 0, 0, 0, 336, 215, 0, 0, 453, 0, - 0, 0, 336, 0, 0, 336, 0, 336, 0, 0, + 0, 47, 0, 0, 47, 0, 47, 47, 47, 47, + 0, 0, 0, 47, 47, 47, 47, 0, 47, 47, + 47, 0, 0, 0, 0, 0, 0, 47, 47, 0, + 47, 47, 0, 47, 47, 47, 0, 0, 0, 47, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 48, 0, 47, + 0, 48, 0, 48, 0, 81, 48, 0, 48, 48, + 0, 48, 0, 48, 47, 48, 0, 48, 48, 48, + 48, 0, 0, 48, 48, 0, 0, 0, 0, 48, + 0, 48, 48, 48, 0, 0, 48, 0, 48, 0, + 48, 0, 0, 48, 0, 48, 48, 48, 48, 0, + 0, 0, 48, 48, 48, 47, 0, 48, 48, 48, + 0, 0, 0, 0, 0, 0, 48, 48, 0, 48, + 48, 0, 48, 48, 48, 0, 0, 0, 48, 0, + 0, 0, 0, 47, 0, 0, 0, 47, 0, 47, + 0, 0, 47, 0, 47, 47, 0, 47, 48, 47, + 0, 47, 0, 47, 47, 47, 47, 0, 0, 47, + 47, 0, 0, 48, 0, 47, 0, 47, 47, 47, + 0, 0, 47, 0, 47, 0, 47, 0, 0, 47, + 0, 47, 47, 47, 47, 0, 0, 0, 47, 47, + 47, 0, 0, 47, 47, 47, 0, 0, 0, 0, + 0, 0, 47, 47, 48, 47, 47, 0, 47, 47, + 47, 0, 0, 0, 47, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 47, 0, 0, + 0, 47, 0, 47, 47, 0, 47, 0, 47, 47, + 214, 47, 0, 47, 0, 47, 0, 47, 47, 47, + 47, 0, 0, 47, 47, 0, 0, 0, 0, 47, + 0, 47, 47, 47, 0, 0, 47, 0, 47, 337, + 47, 0, 0, 47, 0, 47, 47, 47, 47, 0, + 0, 0, 47, 47, 47, 0, 0, 47, 47, 47, + 47, 0, 337, 0, 0, 0, 47, 47, 0, 47, + 47, 452, 47, 47, 47, 337, 0, 0, 47, 0, + 337, 0, 0, 337, 0, 337, 0, 337, 337, 337, + 337, 0, 0, 0, 453, 337, 0, 0, 47, 337, + 0, 0, 0, 337, 215, 0, 0, 454, 0, 0, + 0, 337, 456, 0, 337, 0, 337, 457, 0, 458, + 459, 460, 461, 0, 0, 0, 0, 462, 0, 0, + 0, 463, 0, 0, 0, 337, 0, 0, 0, 0, + 337, 0, 0, 464, 0, 0, 465, 337, 466, 265, + 0, 337, 0, 0, 47, 56, 24, 0, 25, 0, + 0, 26, 253, 0, 337, 0, 27, 61, 62, 0, + 28, 0, 467, 0, 0, 0, 64, 0, 0, 30, + 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, + 0, 33, 0, 71, 72, 34, 337, 594, 0, 0, + 0, 0, 0, 0, 595, 0, 0, 36, 0, 37, + 74, 0, 0, 38, 0, 0, 76, 0, 78, 0, + 80, 39, 40, 254, 0, 41, 0, 0, 1340, 0, + 0, 0, 596, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 454, 0, 0, 0, 0, 336, 0, 453, 0, - 0, 336, 0, 0, 455, 0, 0, 0, 336, 457, - 265, 0, 336, 0, 458, 47, 459, 460, 461, 462, - 0, 454, 0, 0, 463, 336, 0, 0, 464, 0, - 0, 0, 1323, 0, 455, 0, 0, 0, 0, 457, - 465, 0, 0, 466, 458, 467, 459, 460, 461, 462, - 0, 0, 0, 0, 463, 0, 0, 336, 464, 0, - 0, 0, 0, 0, 0, 56, 24, 0, 25, 468, - 465, 26, 253, 466, 0, 467, 27, 61, 62, 0, - 28, 0, 0, 0, 0, 0, 64, 0, 0, 30, - 0, 0, 0, 0, 0, 0, 32, 0, 0, 468, - 0, 33, 0, 71, 72, 34, 0, 593, 0, 0, - 0, 0, 0, 0, 594, 0, 0, 36, 0, 37, - 74, 0, 0, 38, 0, 1324, 76, 0, 78, 0, - 80, 39, 40, 254, 0, 41, 0, 0, 0, 0, - 0, 0, 595, 0, 0, 87, 88, 0, 0, 0, - 0, 0, 0, 0, 0, 1338, 0, 0, 0, 0, 89, 90, 91, 92, 93, 0, 0, 0, 0, 0, - 0, 0, 95, 929, 0, 596, 0, 0, 97, 98, + 0, 0, 95, 930, 0, 597, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, 253, 0, 0, 0, 27, 61, 62, 0, 28, 0, 105, 106, 107, 108, 64, 0, 0, 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 33, 0, 71, - 72, 34, 0, 593, 0, 0, 0, 0, 0, 0, - 594, 0, 0, 36, 0, 37, 74, 0, 0, 38, + 72, 34, 0, 594, 0, 0, 0, 0, 0, 0, + 595, 0, 0, 36, 0, 37, 74, 0, 0, 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, 254, - 0, 41, 0, 0, 0, 0, 0, 0, 595, 0, + 0, 41, 0, 0, 0, 0, 0, 0, 596, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 92, 93, 0, 0, 0, 0, 0, 0, 0, 95, 0, - 0, 596, 0, 0, 97, 98, 99, 100, 0, 0, + 0, 597, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, 253, 0, 0, 0, 27, 61, @@ -11109,13 +11176,13 @@ void case_980() 78, 0, 80, 39, 40, 254, 0, 41, 0, 0, 84, 0, 0, 0, 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 89, 90, 91, 92, 302, 0, 0, 0, + 0, 0, 89, 90, 91, 92, 301, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, 253, 0, 0, 0, 27, 61, 62, 0, 28, 0, - 105, 303, 107, 108, 64, 0, 0, 30, 0, 0, + 105, 302, 107, 108, 64, 0, 0, 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 37, 74, 0, @@ -11123,12 +11190,12 @@ void case_980() 40, 254, 0, 41, 0, 0, 0, 0, 0, 0, 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, - 91, 92, 302, 0, 0, 0, 0, 888, 0, 0, + 91, 92, 301, 0, 0, 0, 0, 889, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, 253, 0, 0, 0, - 27, 61, 62, 0, 28, 0, 105, 303, 107, 108, + 27, 61, 62, 0, 28, 0, 105, 302, 107, 108, 64, 0, 0, 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -11136,13 +11203,13 @@ void case_980() 76, 0, 78, 0, 80, 39, 40, 254, 0, 41, 0, 0, 0, 0, 0, 0, 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 89, 90, 91, 92, 302, 0, - 0, 0, 518, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 0, 89, 90, 91, 92, 301, 0, + 0, 0, 517, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, 253, 0, 0, 0, 27, 61, 62, 0, - 28, 0, 105, 303, 107, 108, 64, 0, 0, 30, + 28, 0, 105, 302, 107, 108, 64, 0, 0, 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 37, @@ -11150,12 +11217,12 @@ void case_980() 80, 39, 40, 254, 0, 41, 0, 0, 0, 0, 0, 0, 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 89, 90, 91, 92, 302, 0, 0, 0, 512, 0, + 89, 90, 91, 92, 301, 0, 0, 0, 511, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, 253, 0, - 0, 0, 27, 61, 62, 0, 28, 0, 105, 303, + 0, 0, 27, 61, 62, 0, 28, 0, 105, 302, 107, 108, 64, 0, 0, 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, @@ -11164,12 +11231,12 @@ void case_980() 0, 41, 0, 0, 0, 0, 0, 0, 86, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 92, - 302, 0, 0, 0, 0, 0, 0, 0, 95, 0, + 301, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 56, 24, 0, 25, 0, 0, 26, 253, 0, 0, 0, 27, 61, - 62, 0, 28, 0, 105, 303, 107, 108, 64, 0, + 62, 0, 28, 0, 105, 302, 107, 108, 64, 0, 0, 30, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, @@ -11196,7 +11263,7 @@ void case_980() 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 0, 0, 77, 77, 0, 77, 0, 0, 77, 77, 0, 0, 0, - 77, 77, 77, 0, 77, 0, 105, 1043, 107, 108, + 77, 77, 77, 0, 77, 0, 105, 1044, 107, 108, 77, 0, 0, 77, 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 77, 0, 77, 77, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -11225,14 +11292,14 @@ void case_980() 0, 56, 24, 0, 25, 0, 0, 26, 253, 0, 0, 0, 27, 61, 62, 0, 28, 0, 135, 135, 135, 135, 64, 0, 0, 30, 0, 0, 0, 0, - 0, 0, 32, 0, 27, 0, 0, 33, 0, 71, + 0, 0, 32, 0, 27, 0, 27, 33, 0, 71, 72, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 37, 74, 27, 0, 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, 254, 27, 41, 0, 0, 0, 27, 0, 0, 0, 0, - 27, 0, 27, 27, 27, 27, 0, 0, 27, 0, + 27, 0, 27, 27, 27, 27, 0, 0, 0, 0, 27, 0, 0, 0, 27, 0, 89, 90, 91, 255, - 302, 0, 0, 0, 0, 0, 27, 0, 95, 27, + 301, 0, 0, 0, 0, 0, 27, 0, 95, 27, 0, 27, 0, 0, 97, 98, 99, 100, 0, 0, 0, 101, 0, 102, 0, 0, 0, 0, 0, 103, 104, 0, 0, 0, 0, 27, 0, 0, 0, 0, @@ -11252,12 +11319,12 @@ void case_980() 36, 0, 37, 74, 0, 0, 38, 0, 0, 76, 0, 78, 0, 80, 39, 40, 254, 0, 41, 0, 0, 84, 0, 0, 0, 0, 0, 0, 24, 0, - 25, 0, 0, 26, 643, 1233, 0, 0, 27, 0, + 25, 0, 0, 26, 643, 1235, 0, 0, 27, 0, 0, 0, 28, 89, 90, 91, 255, 0, 0, 0, 0, 30, 642, 0, 642, 95, 0, 642, 32, 642, - 642, 0, 642, 33, 642, 1234, 642, 34, 642, 642, + 642, 0, 642, 33, 642, 1236, 642, 34, 642, 642, 642, 0, 0, 0, 642, 642, 0, 0, 0, 36, - 642, 37, 642, 642, 0, 38, 1235, 642, 0, 0, + 642, 37, 642, 642, 0, 38, 1237, 642, 0, 0, 0, 642, 0, 39, 40, 0, 0, 41, 0, 0, 322, 105, 256, 642, 0, 642, 0, 0, 0, 642, 642, 0, 0, 0, 0, 0, 0, 642, 642, 0, @@ -11269,24 +11336,24 @@ void case_980() 0, 642, 0, 642, 0, 0, 0, 642, 642, 0, 0, 355, 0, 0, 0, 642, 642, 0, 0, 642, 0, 0, 642, 0, 24, 0, 25, 642, 0, 26, - 0, 0, 1293, 0, 27, 642, 686, 0, 28, 0, - 687, 1294, 1295, 0, 0, 0, 1296, 30, 0, 0, - 0, 0, 1297, 0, 32, 0, 24, 0, 25, 33, - 0, 26, 0, 34, 1293, 0, 27, 0, 686, 0, - 28, 0, 687, 1294, 1295, 36, 0, 37, 1296, 30, - 0, 38, 0, 0, 1297, 0, 32, 0, 0, 39, - 40, 33, 0, 41, 0, 34, 1298, 0, 0, 0, - 47, 1299, 47, 642, 0, 47, 0, 36, 0, 37, + 0, 0, 1295, 0, 27, 642, 686, 0, 28, 0, + 687, 1296, 1297, 0, 0, 0, 1298, 30, 0, 0, + 0, 0, 1299, 0, 32, 0, 24, 0, 25, 33, + 0, 26, 0, 34, 1295, 0, 27, 0, 686, 0, + 28, 0, 687, 1296, 1297, 36, 0, 37, 1298, 30, + 0, 38, 0, 0, 1299, 0, 32, 0, 0, 39, + 40, 33, 0, 41, 0, 34, 1300, 0, 0, 0, + 47, 1301, 47, 642, 0, 47, 0, 36, 0, 37, 47, 0, 0, 38, 47, 0, 0, 0, 0, 0, - 0, 39, 40, 47, 0, 41, 0, 0, 1298, 0, - 47, 0, 47, 1299, 47, 47, 1300, 47, 0, 47, + 0, 39, 40, 47, 0, 41, 0, 0, 1300, 0, + 47, 0, 47, 1301, 47, 47, 1302, 47, 0, 47, 0, 47, 47, 47, 0, 0, 47, 0, 47, 0, 0, 47, 0, 47, 0, 47, 0, 47, 0, 0, 47, 0, 47, 0, 0, 47, 47, 47, 0, 47, - 0, 47, 47, 47, 0, 47, 48, 1301, 48, 0, + 0, 47, 47, 47, 0, 47, 48, 1303, 48, 0, 47, 48, 0, 47, 0, 47, 48, 0, 0, 47, 48, 0, 47, 0, 0, 0, 0, 47, 47, 48, - 0, 47, 0, 0, 47, 0, 48, 154, 47, 1301, + 0, 47, 0, 0, 47, 0, 48, 154, 47, 1303, 47, 48, 0, 47, 0, 48, 0, 48, 47, 48, 0, 0, 47, 0, 48, 0, 0, 48, 0, 48, 0, 47, 0, 48, 0, 0, 48, 154, 47, 0, @@ -11299,892 +11366,904 @@ void case_980() 571, 0, 26, 36, 0, 37, 0, 27, 0, 38, 0, 28, 572, 0, 0, 29, 0, 39, 40, 0, 30, 41, 0, 0, 573, 31, 0, 32, 0, 48, - 0, 0, 33, 0, 0, 0, 34, 35, 0, 0, - 0, 24, 0, 25, 0, 0, 26, 0, 36, 0, - 37, 27, 0, 0, 38, 28, 0, 0, 0, 0, - 0, 47, 39, 40, 30, 184, 41, 184, 0, 0, - 184, 32, 0, 0, 0, 184, 33, 0, 0, 184, - 34, 0, 0, 0, 0, 0, 0, 0, 184, 0, - 0, 0, 36, 0, 37, 184, 0, 0, 38, 0, - 184, 0, 0, 0, 184, 574, 39, 40, 0, 0, - 41, 0, 33, 322, 0, 0, 184, 0, 184, 0, - 0, 0, 184, 33, 0, 0, 0, 0, 33, 0, - 184, 184, 33, 0, 184, 33, 0, 184, 0, 291, - 0, 0, 0, 0, 0, 0, 0, 33, 33, 0, - 42, 0, 33, 33, 0, 31, 0, 0, 33, 0, - 33, 33, 33, 33, 0, 0, 31, 0, 33, 0, - 0, 31, 33, 0, 33, 31, 0, 0, 31, 0, - 0, 0, 0, 0, 33, 0, 33, 33, 0, 33, - 31, 31, 0, 33, 323, 31, 31, 0, 27, 0, - 27, 31, 0, 31, 31, 31, 31, 0, 0, 0, - 0, 31, 0, 33, 0, 31, 0, 31, 184, 33, - 33, 27, 0, 0, 0, 0, 0, 31, 0, 0, - 31, 0, 31, 0, 27, 0, 31, 0, 0, 27, - 0, 47, 0, 0, 27, 0, 27, 27, 27, 27, - 0, 0, 47, 0, 27, 0, 31, 47, 27, 0, - 0, 47, 31, 31, 47, 0, 0, 0, 0, 0, - 27, 0, 0, 27, 0, 27, 47, 47, 0, 0, - 0, 47, 47, 0, 47, 0, 0, 47, 0, 47, - 47, 47, 47, 0, 0, 47, 0, 47, 0, 27, - 47, 47, 0, 47, 47, 27, 27, 47, 0, 0, - 0, 0, 0, 47, 0, 0, 47, 0, 47, 47, - 47, 0, 47, 0, 47, 47, 47, 0, 0, 0, - 47, 0, 47, 47, 47, 47, 0, 0, 0, 0, - 47, 0, 47, 0, 47, 0, 47, 0, 35, 47, - 0, 0, 0, 0, 0, 0, 47, 0, 0, 47, - 0, 47, 47, 0, 47, 47, 0, 47, 0, 0, - 0, 0, 47, 0, 47, 47, 47, 47, 0, 0, - 0, 0, 47, 0, 0, 47, 47, 47, 0, 0, - 0, 36, 0, 0, 0, 0, 0, 0, 47, 0, - 47, 47, 47, 47, 0, 47, 0, 0, 0, 0, - 47, 0, 47, 47, 47, 47, 0, 0, 0, 0, - 47, 0, 0, 0, 47, 47, 0, 47, 0, 47, - 47, 0, 0, 196, 0, 0, 47, 0, 47, 47, - 47, 47, 47, 47, 0, 0, 0, 0, 47, 0, - 47, 47, 47, 47, 0, 0, 47, 0, 47, 0, - 0, 0, 47, 47, 0, 47, 0, 47, 47, 0, - 0, 198, 0, 0, 47, 0, 47, 47, 47, 47, - 0, 47, 0, 0, 0, 0, 47, 0, 47, 47, - 47, 47, 0, 0, 0, 0, 47, 0, 0, 0, - 47, 47, 0, 47, 0, 0, 0, 0, 47, 299, - 47, 0, 47, 0, 47, 47, 0, 47, 0, 47, - 0, 0, 0, 0, 47, 0, 47, 47, 47, 47, - 0, 47, 0, 0, 47, 0, 0, 0, 47, 0, - 0, 47, 0, 0, 47, 0, 0, 300, 453, 47, - 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, - 0, 0, 47, 0, 47, 0, 0, 0, 47, 0, - 0, 454, 0, 0, 0, 0, 0, 0, 453, 47, - 47, 47, 47, 47, 455, 47, 0, 0, 456, 457, - 0, 0, 0, 0, 458, 0, 459, 460, 461, 462, - 0, 454, 0, 0, 463, 0, 0, 0, 464, 47, - 0, 0, 0, 0, 455, 0, 0, 0, 0, 457, - 465, 0, 0, 466, 458, 467, 459, 460, 461, 462, - 0, 0, 0, 0, 463, 0, 0, 0, 464, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 468, - 465, 0, 0, 466, 0, 467, 0, 0, 0, 0, + 0, 0, 33, 0, 0, 33, 34, 35, 0, 0, + 0, 0, 0, 0, 0, 0, 33, 0, 36, 0, + 37, 33, 0, 0, 38, 33, 0, 0, 33, 0, + 0, 47, 39, 40, 0, 0, 41, 0, 0, 0, + 33, 33, 0, 0, 0, 33, 33, 0, 0, 0, + 0, 33, 0, 33, 33, 33, 33, 0, 0, 0, + 0, 33, 0, 0, 0, 33, 0, 33, 0, 0, + 0, 0, 0, 0, 0, 574, 0, 33, 0, 33, + 33, 31, 33, 0, 0, 0, 33, 0, 0, 0, + 0, 0, 31, 0, 0, 0, 0, 31, 0, 0, + 0, 31, 0, 0, 31, 0, 33, 0, 0, 0, + 0, 0, 33, 33, 0, 0, 31, 31, 0, 0, + 42, 31, 31, 0, 47, 0, 0, 31, 0, 31, + 31, 31, 31, 0, 0, 47, 0, 31, 0, 0, + 47, 31, 0, 31, 47, 0, 0, 47, 0, 0, + 0, 0, 0, 31, 0, 0, 31, 0, 31, 47, + 47, 0, 31, 0, 47, 47, 0, 47, 0, 0, + 47, 0, 47, 47, 47, 47, 0, 0, 47, 0, + 47, 0, 31, 47, 47, 0, 47, 47, 31, 31, + 47, 0, 0, 0, 0, 0, 47, 0, 0, 47, + 0, 47, 47, 47, 0, 47, 0, 47, 47, 47, + 0, 0, 0, 47, 0, 47, 47, 47, 47, 0, + 0, 0, 0, 47, 0, 47, 0, 47, 0, 47, + 0, 35, 47, 0, 0, 0, 0, 0, 0, 47, + 0, 0, 47, 0, 47, 47, 0, 47, 47, 0, + 47, 0, 0, 0, 0, 47, 0, 47, 47, 47, + 47, 0, 0, 0, 0, 47, 0, 0, 47, 47, + 47, 0, 0, 0, 36, 0, 0, 0, 0, 0, + 0, 47, 0, 47, 47, 47, 47, 0, 47, 0, + 0, 0, 0, 47, 0, 47, 47, 47, 47, 0, + 0, 0, 0, 47, 0, 0, 0, 47, 47, 0, + 47, 0, 47, 47, 0, 0, 196, 0, 0, 47, + 0, 47, 47, 47, 47, 47, 47, 0, 0, 0, + 0, 47, 0, 47, 47, 47, 47, 0, 0, 47, + 0, 47, 0, 0, 0, 47, 47, 0, 47, 0, + 47, 47, 0, 0, 198, 0, 0, 47, 0, 47, + 47, 47, 47, 0, 47, 0, 0, 0, 0, 47, + 0, 47, 47, 47, 47, 0, 0, 0, 0, 47, + 0, 0, 0, 47, 47, 0, 47, 0, 0, 0, + 0, 47, 299, 47, 0, 47, 0, 47, 47, 0, + 47, 0, 47, 0, 0, 0, 0, 47, 0, 47, + 47, 47, 47, 0, 47, 0, 0, 47, 0, 0, + 0, 47, 0, 0, 47, 0, 0, 47, 0, 0, + 300, 452, 47, 47, 0, 0, 47, 47, 47, 47, + 47, 47, 47, 0, 0, 47, 0, 47, 0, 0, + 0, 47, 0, 0, 453, 0, 0, 0, 0, 0, + 0, 452, 47, 47, 47, 47, 47, 454, 47, 0, + 0, 455, 456, 0, 0, 0, 0, 457, 0, 458, + 459, 460, 461, 0, 453, 0, 0, 462, 0, 0, + 0, 463, 47, 0, 0, 0, 0, 454, 0, 0, + 0, 0, 456, 464, 0, 0, 465, 457, 466, 458, + 459, 460, 461, 0, 0, 0, 0, 462, 0, 0, + 0, 463, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 467, 464, 0, 0, 465, 0, 466, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 468, + 0, 0, 467, }; protected static readonly short [] yyCheck = { 17, - 516, 18, 4, 17, 300, 518, 299, 189, 51, 51, - 191, 188, 232, 17, 17, 289, 87, 88, 6, 470, - 84, 68, 20, 234, 339, 59, 157, 17, 492, 247, - 321, 298, 559, 332, 370, 296, 354, 108, 936, 47, - 87, 88, 354, 1112, 58, 92, 576, 0, 721, 113, - 723, 115, 1147, 1148, 268, 73, 748, 584, 113, 77, - 115, 328, 781, 256, 256, 79, 59, 81, 59, 59, - 1240, 277, 256, 63, 368, 281, 256, 95, 17, 17, - 368, 256, 941, 256, 268, 256, 256, 1257, 256, 256, - 77, 256, 256, 256, 1224, 768, 256, 335, 771, 368, - 372, 17, 93, 1198, 294, 256, 97, 98, 99, 100, - 101, 102, 103, 104, 256, 256, 306, 17, 282, 1144, - 374, 268, 890, 256, 418, 172, 17, 17, 199, 200, - 17, 256, 268, 901, 357, 665, 342, 257, 1268, 157, - 276, 429, 323, 157, 411, 0, 189, 189, 358, 0, - 314, 369, 17, 157, 157, 645, 646, 429, 17, 339, - 429, 256, 416, 386, 344, 256, 346, 157, 343, 349, - 350, 339, 352, 353, 355, 325, 344, 1202, 346, 360, - 17, 349, 350, 256, 352, 353, 17, 256, 339, 232, - 232, 262, 363, 344, 374, 346, 363, 256, 349, 350, - 247, 352, 353, 370, 256, 372, 374, 374, 422, 1068, - 375, 724, 259, 512, 434, 223, 391, 288, 157, 157, - 532, 368, 515, 256, 435, 418, 418, 363, 418, 247, - 256, 372, 374, 374, 252, 256, 554, 308, 422, 414, - 228, 157, 554, 376, 559, 418, 1416, 418, 418, 429, - 375, 418, 286, 428, 418, 418, 320, 157, 418, 440, - 324, 429, 296, 358, 576, 329, 157, 157, 418, 584, - 157, 289, 256, 1443, 329, 422, 294, 295, 429, 326, - 351, 277, 418, 374, 331, 1455, 256, 1457, 429, 256, - 1107, 309, 157, 286, 475, 286, 286, 315, 157, 317, - 790, 256, 316, 321, 257, 296, 1025, 368, 381, 257, - 256, 302, 381, 372, 256, 333, 334, 388, 389, 371, - 157, 1197, 369, 370, 317, 998, 157, 317, 818, 424, - 425, 426, 427, 418, 367, 339, 339, 256, 256, 869, - 358, 1410, 1218, 376, 376, 416, 417, 262, 666, 339, - 1042, 369, 370, 665, 375, 381, 374, 375, 376, 377, - 378, 379, 380, 381, 382, 383, 384, 363, 429, 416, - 417, 358, 1091, 420, 686, 325, 305, 256, 256, 335, - 263, 1476, 373, 298, 368, 363, 256, 368, 406, 902, - 374, 434, 434, 574, 385, 386, 387, 429, 1296, 390, - 391, 256, 444, 1224, 374, 586, 257, 588, 375, 590, - 256, 1506, 370, 266, 256, 370, 374, 881, 709, 374, - 20, 272, 418, 419, 370, 367, 277, 369, 374, 371, - 281, 1307, 315, 441, 442, 1311, 256, 256, 436, 447, - 418, 484, 256, 256, 491, 296, 493, 1268, 429, 1122, - 369, 662, 450, 943, 372, 945, 1129, 256, 948, 266, - 1336, 314, 363, 378, 379, 726, 256, 256, 418, 516, - 256, 485, 323, 429, 810, 656, 694, 795, 420, 992, - 1153, 423, 368, 795, 339, 532, 912, 87, 88, 536, - 701, 342, 256, 372, 372, 676, 514, 367, 516, 492, - 518, 371, 492, 373, 374, 368, 376, 314, 108, 294, - 368, 381, 367, 376, 528, 529, 371, 418, 373, 374, - 375, 376, 375, 369, 542, 339, 381, 369, 575, 547, - 344, 1348, 346, 256, 532, 349, 350, 1210, 352, 353, - 367, 264, 341, 429, 1034, 256, 1036, 1037, 368, 376, - 868, 340, 566, 372, 374, 559, 559, 869, 363, 372, - 1377, 1378, 372, 1380, 1445, 1446, 429, 1224, 375, 559, - 369, 429, 357, 866, 1391, 593, 594, 1394, 363, 369, - 584, 584, 263, 369, 369, 372, 363, 372, 373, 372, - 581, 1017, 1409, 1019, 584, 642, 895, 644, 816, 199, - 200, 386, 325, 367, 735, 371, 653, 371, 357, 373, - 374, 1268, 376, 418, 367, 429, 1433, 381, 371, 429, - 369, 1502, 640, 372, 373, 372, 391, 645, 646, 363, - 648, 1158, 899, 418, 315, 369, 421, 386, 374, 343, - 936, 418, 429, 1133, 369, 272, 429, 694, 373, 414, - 367, 415, 256, 1224, 420, 343, 367, 368, 369, 376, - 371, 372, 262, 374, 711, 376, 368, 420, 363, 296, - 256, 418, 421, 343, 369, 1165, 694, 381, 272, 418, - 416, 1224, 753, 256, 418, 341, 305, 391, 288, 428, - 1154, 709, 726, 381, 272, 759, 323, 1268, 423, 687, - 300, 305, 296, 391, 995, 776, 724, 418, 308, 420, - 414, 729, 423, 369, 1007, 762, 418, 381, 296, 305, - 791, 391, 1212, 418, 428, 1268, 414, 391, 21, 323, - 911, 721, 256, 723, 993, 726, 256, 394, 395, 1229, - 428, 755, 960, 269, 414, 323, 1224, 794, 1223, 1224, - 414, 351, 1224, 1224, 354, 773, 414, 775, 428, 52, - 286, 256, 1021, 810, 428, 779, 339, 781, 1243, 816, - 428, 344, 790, 346, 294, 952, 349, 350, 768, 352, - 353, 771, 272, 376, 339, 339, 391, 277, 388, 389, - 1268, 281, 810, 1268, 381, 1270, 1268, 1268, 816, 870, - 818, 843, 820, 339, 391, 1079, 296, 256, 369, 414, - 370, 1126, 367, 367, 374, 339, 416, 417, 357, 1112, - 344, 376, 346, 428, 256, 349, 350, 414, 352, 353, - 873, 367, 1314, 323, 373, 1016, 436, 371, 370, 371, - 367, 1115, 374, 1158, 339, 1327, 864, 386, 866, 344, - 450, 346, 342, 851, 349, 350, 429, 352, 353, 906, - 376, 908, 306, 401, 1346, 883, 256, 914, 856, 313, - 357, 294, 890, 357, 414, 413, 1327, 1151, 1193, 269, - 386, 325, 900, 306, 902, 1398, 373, 1105, 428, 373, - 339, 306, 939, 308, 965, 344, 286, 346, 313, 386, - 349, 350, 386, 352, 353, 429, 373, 339, 371, 368, - 325, 368, 344, 960, 346, 374, 369, 349, 350, 376, - 352, 353, 381, 390, 391, 943, 418, 945, 381, 976, - 948, 367, 532, 418, 256, 370, 428, 368, 368, 374, - 376, 371, 960, 373, 374, 376, 306, 1460, 1168, 367, - 371, 379, 373, 313, 554, 382, 383, 1231, 376, 957, - 1142, 1172, 392, 393, 370, 367, 1278, 369, 374, 396, - 397, 392, 393, 1285, 992, 373, 576, 995, 376, 967, - 429, 969, 412, 971, 1497, 367, 368, 367, 368, 367, - 420, 412, 373, 423, 376, 376, 376, 429, 376, 420, - 1296, 368, 423, 1519, 1520, 372, 368, 374, 998, 376, - 372, 1025, 374, 374, 376, 376, 1034, 339, 1036, 1037, - 381, 1039, 344, 389, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 367, 372, 368, 374, 371, - 376, 373, 374, 374, 376, 376, 368, 1049, 370, 381, - 372, 368, 374, 375, 376, 372, 372, 384, 1105, 376, - 376, 1079, 384, 385, 1107, 665, 385, 389, 390, 370, - 371, 400, 373, 374, 375, 1093, 1094, 1091, 400, 401, - 370, 372, 372, 415, 374, 376, 686, 1105, 370, 1106, - 372, 413, 374, 373, 1112, 369, 376, 1115, 372, 1142, - 1142, 1144, 1144, 390, 372, 6, 370, 429, 376, 372, - 374, 369, 357, 376, 418, 1133, 17, 1410, 363, 371, - 1301, 1139, 1126, 1126, 369, 1168, 1168, 372, 373, 374, - 368, 369, 1122, 1151, 415, 371, 1126, 373, 371, 1129, - 373, 386, 418, 1324, 386, 387, 388, 1165, 1166, 256, - 372, 1222, 374, 753, 1158, 1158, 418, 1338, 59, 1202, - 1202, 277, 63, 1153, 372, 376, 374, 256, 1158, 394, - 395, 396, 397, 418, 376, 1356, 776, 1358, 398, 399, - 1223, 1223, 1224, 370, 367, 372, 87, 88, 373, 1193, - 1193, 791, 367, 368, 1212, 795, 374, 370, 376, 372, - 1243, 1243, 370, 1193, 372, 376, 1277, 108, 370, 376, - 372, 1229, 372, 1231, 374, 372, 370, 374, 372, 370, - 1210, 372, 1293, 1294, 1271, 93, 1268, 1270, 1270, 97, - 98, 99, 100, 101, 102, 103, 104, 374, 374, 376, - 376, 374, 374, 376, 376, 1316, 354, 355, 1319, 294, - 339, 851, 354, 355, 294, 344, 157, 346, 347, 348, - 349, 350, 351, 352, 353, 354, 355, 1281, 368, 869, - 870, 371, 343, 373, 374, 368, 369, 364, 365, 368, - 372, 370, 376, 372, 414, 374, 375, 376, 414, 415, - 372, 373, 392, 393, 364, 365, 392, 393, 199, 200, - 0, 418, 61, 398, 399, 1348, 65, 66, 67, 356, - 69, 70, 412, 1110, 1111, 74, 75, 418, 1332, 418, - 420, 369, 81, 423, 83, 375, 85, 256, 372, 372, - 376, 90, 91, 368, 1377, 1378, 936, 1380, 374, 372, - 429, 372, 294, 294, 374, 372, 1388, 372, 1391, 372, - 374, 1394, 371, 256, 376, 114, 294, 957, 294, 372, - 381, 262, 374, 1405, 373, 965, 1409, 375, 374, 373, - 381, 372, 374, 429, 374, 374, 1418, 1419, 374, 418, - 1398, 423, 1396, 372, 374, 286, 374, 288, 367, 421, - 1433, 372, 1410, 373, 372, 343, 294, 374, 294, 300, - 374, 418, 370, 1445, 1446, 371, 367, 308, 418, 1427, - 339, 375, 256, 256, 374, 344, 317, 346, 347, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 256, 256, - 280, 381, 256, 367, 302, 368, 343, 372, 339, 368, - 0, 370, 1460, 372, 370, 374, 375, 376, 371, 351, - 351, 376, 374, 354, 374, 376, 372, 370, 372, 347, - 1502, 390, 372, 381, 332, 423, 381, 367, 256, 381, - 256, 376, 1519, 1520, 368, 372, 347, 372, 370, 1497, - 370, 374, 339, 370, 375, 348, 372, 388, 389, 1503, - 1504, 368, 374, 372, 418, 254, 1510, 1511, 257, 418, - 429, 1519, 1520, 348, 376, 373, 368, 367, 367, 367, - 356, 381, 368, 374, 368, 416, 417, 385, 386, 387, - 371, 376, 390, 391, 392, 393, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 405, 368, 298, - 372, 381, 368, 337, 305, 1145, 371, 369, 367, 418, - 371, 418, 418, 418, 313, 371, 376, 257, 371, 373, - 371, 261, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, 272, 381, 367, 371, 418, 277, 381, 369, - 371, 281, 374, 372, 284, 372, 256, 418, 373, 373, - 315, 492, 374, 374, 374, 372, 296, 297, 376, 372, - 370, 301, 302, 0, 1204, 376, 418, 307, 418, 309, - 310, 311, 312, 376, 372, 381, 418, 317, 372, 376, - 367, 321, 1222, 323, 372, 368, 381, 372, 370, 368, - 263, 532, 368, 333, 371, 335, 336, 371, 338, 372, - 372, 0, 342, 0, 512, 367, 376, 368, 372, 0, - 368, 418, 372, 554, 370, 372, 367, 372, 559, 368, - 368, 373, 362, 367, 370, 372, 418, 418, 368, 369, - 368, 376, 367, 372, 376, 576, 372, 1277, 1278, 376, - 368, 372, 376, 584, 368, 1285, 372, 368, 368, 372, - 367, 376, 315, 1293, 1294, 263, 1296, 257, 256, 12, - 376, 261, 1302, 376, 376, 376, 50, 376, 376, 376, - 376, 5, 272, 581, 1314, 1243, 1316, 277, 957, 1319, - 851, 281, 1105, 1270, 284, 1466, 1105, 1327, 487, 1450, - 1413, 686, 1401, 1430, 1396, 1302, 296, 297, 873, 873, - 868, 301, 302, 700, 873, 1314, 1346, 307, 1511, 309, - 310, 311, 312, 1268, 1333, 1256, 1423, 317, 1419, 1505, - 1504, 321, 1202, 323, 665, 1418, 1358, 1302, 843, 528, - 532, 1204, 895, 333, 369, 335, 336, 594, 338, 816, - 0, 339, 342, 729, 1007, 686, 344, 71, 346, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, 726, - 335, 400, 362, 401, 404, 694, 402, 1182, 405, 369, - 368, 403, 370, 795, 372, 1277, 374, 375, 376, 554, - 721, 1193, 723, 1126, 382, 383, 384, 385, 157, 994, - 1070, 389, 390, 1094, 978, 1021, 394, 395, 396, 397, - 398, 399, 400, 401, 1154, 1082, 425, 916, 530, 1084, - 651, 425, 753, 1273, 1166, 413, 849, 848, -1, 256, - -1, -1, -1, -1, 261, 262, -1, 768, -1, -1, - 771, 429, -1, -1, -1, 776, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 284, -1, -1, - 791, -1, -1, -1, 795, -1, -1, -1, -1, -1, - 297, 298, -1, -1, -1, 302, -1, -1, 305, -1, - 307, -1, 309, 310, 311, 312, -1, -1, -1, -1, - 317, -1, -1, -1, 321, -1, -1, -1, 325, -1, - -1, -1, -1, -1, -1, -1, 333, -1, -1, 336, - -1, 338, 339, -1, -1, -1, -1, 344, -1, 346, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - -1, -1, -1, -1, -1, 362, 363, -1, 869, 870, - 367, 368, -1, 370, 371, 372, 373, 374, 375, 376, - -1, 378, 379, -1, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, -1, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 409, 410, 411, 412, 413, 0, -1, 416, - -1, 418, -1, 420, -1, -1, 423, 895, -1, -1, - -1, -1, 429, -1, -1, 936, 256, 257, -1, -1, - -1, -1, -1, -1, 264, 265, 266, 267, 268, -1, - 270, 271, -1, 273, 274, 275, 276, 277, 278, 279, - 280, -1, -1, -1, 965, 285, -1, 287, 288, 289, - 290, 291, 292, -1, -1, 295, -1, -1, -1, 299, - 300, -1, 302, 303, 304, -1, -1, -1, -1, -1, - -1, -1, 256, -1, 314, -1, 316, 998, 318, 319, - -1, -1, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 334, 335, -1, 337, -1, -1, - 340, 341, -1, -1, 344, 345, -1, -1, -1, -1, - -1, -1, 0, -1, -1, -1, -1, -1, -1, 359, - 360, 361, 362, 363, -1, -1, -1, 367, 368, -1, - -1, 371, -1, -1, -1, -1, 376, 377, 378, 379, - 380, -1, -1, -1, 384, -1, 386, -1, -1, -1, - -1, -1, 392, 393, -1, 339, -1, -1, -1, -1, - 344, -1, 346, 347, 348, 349, 350, 351, 352, 353, - 354, 355, 356, -1, -1, -1, -1, 417, 418, 419, - 420, -1, 422, -1, 368, -1, 370, -1, 372, 429, - 374, 375, 376, -1, -1, -1, -1, -1, -1, -1, - -1, 1122, -1, -1, -1, 1126, 390, -1, 1129, -1, - -1, -1, -1, -1, -1, -1, 400, 401, -1, -1, - -1, -1, -1, -1, 1145, -1, -1, -1, -1, 413, - -1, -1, 1153, -1, -1, -1, -1, 1158, 0, -1, - -1, -1, -1, -1, -1, 429, -1, -1, -1, -1, + 515, 18, 51, 17, 298, 4, 6, 51, 189, 234, + 469, 17, 299, 17, 288, 517, 232, 191, 354, 188, + 247, 68, 321, 20, 559, 339, 17, 84, 59, 491, + 157, 297, 354, 645, 646, 332, 370, 937, 295, 1113, + 87, 88, 87, 88, 58, 92, 721, 576, 723, 77, + 585, 59, 1148, 1149, 748, 73, 113, 0, 115, 77, + 277, 256, 328, 108, 256, 79, 781, 81, 59, 256, + 1242, 256, 63, 113, 256, 115, 256, 95, 942, 256, + 335, 256, 368, 256, 17, 268, 17, 1259, 256, 256, + 17, 256, 256, 768, 256, 268, 771, 282, 368, 256, + 368, 256, 1145, 1199, 256, 374, 256, 341, 376, 269, + 47, 391, 401, 414, 268, 17, 256, 891, 370, 1447, + 1448, 21, 374, 418, 413, 172, 286, 428, 902, 314, + 268, 1108, 418, 428, 414, 369, 665, 256, 276, 157, + 189, 17, 369, 157, 410, 189, 363, 416, 418, 323, + 256, 157, 52, 157, 199, 200, 343, 339, 17, 256, + 1203, 429, 344, 340, 346, 17, 157, 349, 350, 256, + 352, 353, 17, 17, 429, 256, 1504, 1198, 790, 17, + 372, 355, 374, 232, 339, 368, 360, 17, 232, 344, + 358, 346, 374, 256, 349, 350, 532, 352, 353, 1220, + 247, 418, 419, 256, 391, 1069, 363, 819, 256, 434, + 256, 258, 376, 375, 511, 256, 261, 433, 554, 374, + 514, 256, 724, 418, 157, 363, 157, 414, 228, 247, + 157, 381, 554, 418, 252, 375, 0, 429, 418, 422, + 576, 428, 287, 418, 0, 559, 1418, 429, 367, 422, + 369, 418, 371, 418, 285, 157, 424, 425, 426, 427, + 256, 418, 307, 320, 295, 439, 418, 324, 422, 375, + 288, 585, 329, 1445, 429, 293, 294, 285, 375, 326, + 418, 157, 369, 294, 331, 1457, 223, 1459, 1309, 329, + 308, 256, 1313, 374, 285, 306, 256, 315, 157, 317, + 474, 420, 316, 321, 423, 157, 351, 257, 256, 317, + 256, 1026, 157, 157, 257, 333, 334, 1338, 381, 157, + 372, 369, 369, 370, 999, 371, 317, 157, 381, 665, + 358, 372, 944, 339, 946, 339, 256, 949, 1412, 374, + 358, 870, 387, 388, 666, 262, 256, 256, 339, 1043, + 686, 369, 370, 256, 418, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 382, 383, 418, 363, 415, 416, + 415, 416, 419, 1350, 370, 256, 372, 1092, 374, 371, + 368, 298, 1478, 256, 433, 256, 367, 405, 376, 433, + 256, 256, 256, 325, 443, 376, 266, 325, 1298, 256, + 574, 903, 1379, 1380, 374, 1382, 913, 418, 368, 374, + 709, 368, 1508, 587, 374, 589, 1393, 591, 266, 1396, + 882, 367, 418, 1035, 372, 1037, 1038, 61, 420, 358, + 376, 65, 66, 67, 1411, 69, 70, 662, 435, 483, + 74, 75, 335, 490, 314, 492, 416, 81, 1123, 83, + 370, 85, 449, 372, 374, 1130, 90, 91, 1435, 795, + 370, 378, 379, 372, 374, 368, 314, 694, 515, 726, + 484, 374, 429, 795, 277, 343, 701, 811, 281, 1154, + 114, 368, 656, 491, 341, 532, 418, 257, 369, 536, + 418, 993, 256, 343, 372, 513, 369, 515, 369, 517, + 491, 257, 676, 440, 441, 375, 372, 372, 372, 446, + 429, 1018, 369, 1020, 528, 529, 272, 372, 263, 368, + 256, 277, 1134, 391, 542, 281, 256, 375, 575, 547, + 363, 381, 368, 256, 870, 532, 1211, 363, 272, 342, + 296, 391, 429, 368, 368, 372, 414, 869, 305, 256, + 343, 429, 566, 559, 1166, 559, 339, 264, 363, 363, + 428, 363, 296, 373, 414, 369, 376, 323, 559, 305, + 315, 20, 256, 867, 429, 339, 594, 595, 428, 585, + 429, 585, 305, 369, 367, 418, 342, 256, 381, 323, + 817, 272, 418, 429, 585, 642, 277, 644, 391, 896, + 281, 1213, 429, 367, 429, 429, 653, 371, 735, 373, + 374, 375, 376, 418, 418, 296, 418, 381, 325, 1231, + 254, 414, 640, 257, 1159, 376, 306, 645, 646, 256, + 648, 305, 369, 313, 900, 428, 373, 367, 87, 88, + 263, 371, 323, 373, 374, 367, 376, 694, 363, 371, + 937, 381, 1226, 414, 369, 339, 1226, 398, 399, 108, + 344, 342, 346, 297, 711, 349, 350, 428, 352, 353, + 339, 994, 1226, 394, 395, 344, 694, 346, 429, 313, + 349, 350, 256, 352, 353, 415, 423, 687, 371, 357, + 373, 709, 315, 1155, 376, 726, 1270, 996, 420, 1022, + 1270, 369, 759, 418, 372, 373, 724, 339, 753, 392, + 393, 729, 339, 294, 1008, 762, 1270, 344, 386, 346, + 294, 391, 349, 350, 272, 352, 353, 256, 272, 412, + 721, 776, 723, 376, 961, 367, 1316, 420, 912, 256, + 423, 755, 1225, 1226, 414, 429, 791, 794, 296, 1329, + 199, 200, 296, 421, 1226, 773, 1226, 775, 428, 306, + 429, 308, 1245, 1226, 811, 779, 313, 781, 1348, 371, + 817, 256, 790, 418, 294, 323, 357, 768, 325, 323, + 771, 1226, 363, 428, 953, 357, 306, 1270, 369, 1272, + 1226, 372, 373, 811, 373, 844, 369, 376, 1270, 817, + 1270, 819, 429, 821, 386, 386, 1080, 1270, 381, 371, + 339, 373, 261, 1127, 386, 344, 339, 346, 381, 1113, + 349, 350, 339, 352, 353, 1270, 871, 344, 391, 346, + 874, 381, 349, 350, 1270, 352, 353, 418, 287, 256, + 421, 391, 1116, 1017, 367, 1159, 256, 865, 367, 867, + 299, 414, 486, 376, 418, 852, 306, 857, 307, 269, + 907, 357, 909, 313, 414, 428, 884, 374, 915, 376, + 1329, 371, 367, 891, 381, 325, 286, 373, 1152, 1106, + 1194, 376, 367, 901, 373, 903, 371, 376, 373, 374, + 386, 376, 367, 940, 528, 357, 381, 256, 1400, 367, + 429, 376, 351, 370, 368, 354, 384, 374, 376, 367, + 374, 373, 429, 371, 961, 373, 374, 381, 376, 354, + 355, 966, 339, 381, 386, 256, 944, 344, 946, 346, + 977, 949, 349, 350, 368, 352, 353, 367, 387, 388, + 382, 383, 376, 961, 1280, 371, 376, 373, 1173, 367, + 368, 1287, 6, 1169, 396, 397, 389, 415, 376, 1233, + 1462, 958, 1143, 17, 385, 370, 415, 416, 968, 374, + 970, 368, 972, 357, 371, 993, 373, 374, 996, 372, + 339, 374, 369, 376, 370, 344, 435, 346, 374, 373, + 349, 350, 400, 352, 353, 392, 393, 1499, 390, 370, + 449, 372, 386, 374, 418, 59, 1521, 1522, 999, 63, + 368, 1298, 1026, 415, 372, 412, 374, 1035, 376, 1037, + 1038, 368, 1040, 420, 368, 372, 423, 374, 372, 376, + 367, 368, 376, 87, 88, 371, 367, 368, 369, 376, + 371, 372, 368, 374, 369, 376, 418, 372, 374, 256, + 376, 1050, 370, 371, 108, 373, 374, 375, 418, 1106, + 368, 277, 1080, 371, 1108, 373, 374, 370, 371, 370, + 429, 374, 367, 374, 369, 372, 1094, 1095, 1092, 376, + 368, 369, 372, 532, 392, 393, 376, 418, 1106, 420, + 1107, 376, 423, 372, 1143, 1113, 1145, 376, 1116, 1143, + 372, 1145, 374, 157, 412, 554, 370, 372, 372, 376, + 374, 376, 420, 354, 355, 423, 1134, 372, 1412, 374, + 1169, 1127, 1140, 1127, 370, 1169, 372, 576, 370, 1303, + 372, 374, 1123, 376, 1152, 370, 1127, 372, 367, 1130, + 393, 394, 395, 396, 256, 199, 200, 294, 1166, 1167, + 367, 368, 1326, 1159, 1203, 1159, 368, 369, 357, 1203, + 386, 387, 388, 1154, 363, 370, 1340, 372, 1159, 372, + 369, 374, 373, 372, 373, 374, 1225, 1226, 372, 1224, + 374, 1225, 343, 370, 1358, 372, 1360, 386, 1194, 370, + 1194, 372, 374, 376, 376, 1213, 1245, 374, 374, 376, + 376, 1245, 374, 1194, 376, 376, 261, 261, 414, 415, + 364, 365, 294, 1231, 372, 1233, 665, 372, 373, 418, + 1211, 1270, 414, 1272, 364, 365, 1273, 418, 1272, 284, + 356, 285, 376, 287, 1279, 391, 392, 686, 418, 1111, + 1112, 369, 297, 389, 390, 299, 375, 302, 397, 398, + 1295, 1296, 307, 307, 309, 310, 311, 312, 418, 372, + 376, 372, 317, 317, 368, 374, 321, 372, 294, 1283, + 325, 372, 294, 1318, 374, 372, 1321, 372, 333, 372, + 374, 336, 93, 338, 256, 339, 97, 98, 99, 100, + 101, 102, 103, 104, 371, 376, 256, 351, 294, 294, + 354, 381, 372, 374, 753, 373, 1350, 362, 375, 374, + 373, 418, 381, 372, 374, 429, 374, 374, 374, 372, + 1334, 423, 374, 374, 367, 421, 372, 776, 373, 343, + 372, 294, 294, 387, 388, 1379, 1380, 374, 1382, 374, + 0, 1390, 791, 418, 371, 370, 795, 367, 256, 1393, + 256, 375, 1396, 374, 418, 256, 261, 256, 1407, 280, + 256, 415, 416, 418, 381, 367, 372, 1411, 368, 343, + 351, 1420, 1421, 370, 423, 376, 374, 371, 381, 284, + 372, 374, 1400, 370, 1398, 376, 372, 372, 347, 367, + 256, 1435, 297, 381, 1412, 256, 372, 302, 1447, 1448, + 305, 381, 307, 852, 309, 310, 311, 312, 372, 0, + 376, 1429, 317, 368, 347, 339, 321, 370, 374, 370, + 325, 870, 871, 375, 381, 370, 372, 368, 333, 348, + 374, 336, 372, 338, 418, 418, 348, 491, 376, 256, + 368, 367, 256, 368, 1462, 402, 403, 404, 405, 406, + 407, 408, 409, 410, 411, 1504, 367, 362, 367, 381, + 376, 356, 372, 337, 371, 368, 368, 305, 368, 418, + 374, 418, 369, 371, 1521, 1522, 418, 367, 532, 418, + 371, 1499, 418, 376, 371, 371, 371, 381, 937, 373, + 301, 1505, 1506, 371, 367, 371, 373, 369, 1512, 1513, + 554, 381, 372, 1521, 1522, 559, 374, 372, 256, 958, + 373, 367, 0, 418, 374, 374, 374, 966, 372, 376, + 372, 332, 576, 370, 368, 339, 418, 376, 376, 418, + 344, 585, 346, 347, 348, 349, 350, 351, 352, 353, + 354, 355, 356, 418, 372, 376, 372, 418, 381, 372, + 370, 381, 368, 372, 368, 315, 370, 263, 372, 371, + 374, 375, 376, 371, 368, 372, 372, 0, 0, 367, + 372, 376, 368, 384, 385, 386, 390, 376, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 0, 368, 372, 257, 372, 370, + 418, 261, 367, 372, 0, 368, 368, 373, 372, 370, + 367, 665, 272, 368, 372, 429, 368, 277, 418, 372, + 376, 281, 376, 418, 284, 376, 372, 376, 368, 367, + 372, 368, 686, 372, 368, 376, 296, 297, 367, 315, + 376, 301, 302, 376, 376, 376, 376, 307, 376, 309, + 310, 311, 312, 376, 376, 263, 50, 317, 12, 5, + 958, 321, 852, 323, 1272, 1106, 257, 721, 1106, 723, + 261, 1452, 1415, 333, 1245, 335, 336, 686, 338, 1468, + 1432, 272, 342, 1403, 1398, 1304, 277, 700, 874, 874, + 281, 869, 1316, 284, 1513, 874, 1335, 1146, 1258, 753, + 511, 1270, 362, 1421, 1420, 296, 297, 1507, 368, 369, + 301, 302, 1425, 1203, 768, 1506, 307, 771, 309, 310, + 311, 312, 776, 1360, 1304, 844, 317, 896, 1205, 265, + 321, 267, 323, 817, 270, 532, 369, 791, 1008, 275, + 729, 795, 333, 279, 335, 336, 694, 338, 71, 595, + 335, 342, 288, 726, 399, 401, 1205, 400, 402, 295, + 554, 403, 795, 404, 300, 1279, 1194, 1183, 304, 257, + 581, 362, 1127, 261, 157, 1224, 995, 1071, 369, 1095, + 316, 979, 318, 1022, 272, 1085, 322, 0, 1155, 277, + 1083, 1275, 917, 281, 330, 331, 284, 424, 334, 424, + 651, 337, 1167, 530, -1, -1, 850, -1, 296, 297, + 849, -1, -1, 301, 302, -1, 870, 871, -1, 307, + -1, 309, 310, 311, 312, -1, -1, 363, -1, 317, + 1279, 1280, -1, 321, -1, 323, -1, -1, 1287, -1, + -1, -1, -1, -1, -1, 333, 1295, 1296, 336, 1298, + 338, -1, -1, -1, 342, 1304, -1, -1, -1, -1, + 256, -1, -1, -1, -1, 261, 262, 1316, -1, 1318, + -1, -1, 1321, -1, 362, -1, -1, -1, -1, -1, + 1329, 369, 418, 937, -1, -1, -1, -1, 284, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 1348, + -1, 297, 298, -1, -1, -1, 302, -1, -1, 305, + -1, 307, 966, 309, 310, 311, 312, -1, -1, -1, + -1, 317, -1, -1, -1, 321, -1, -1, -1, 325, + -1, -1, -1, -1, -1, -1, -1, 333, -1, -1, + 336, -1, 338, 339, -1, 999, -1, -1, 344, -1, + 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, + 356, -1, -1, -1, -1, -1, 362, 363, -1, -1, + -1, 367, 368, -1, 370, 371, 372, 373, 374, 375, + 376, 0, 378, 379, -1, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, -1, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, -1, -1, + 416, -1, 418, -1, 420, -1, -1, 423, -1, -1, + -1, -1, -1, 429, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 257, -1, -1, -1, 261, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, - -1, -1, 1193, -1, 277, -1, -1, -1, 281, -1, - -1, 284, -1, 1204, -1, -1, -1, -1, -1, 1210, - -1, -1, -1, 296, 297, -1, -1, -1, 301, 302, - -1, 1222, -1, -1, 307, -1, 309, 310, 311, 312, - -1, -1, -1, -1, 317, -1, -1, -1, 321, -1, + -1, 256, -1, -1, -1, -1, -1, 262, -1, 272, + -1, -1, -1, -1, 277, -1, -1, -1, 281, 1123, + -1, 284, -1, 1127, -1, -1, 1130, -1, -1, -1, + -1, -1, -1, 296, 297, 896, -1, -1, 301, 302, + -1, -1, 1146, 298, 307, -1, 309, 310, 311, 312, + 1154, -1, -1, -1, 317, 1159, -1, -1, 321, -1, 323, -1, -1, -1, -1, -1, -1, -1, -1, -1, 333, -1, -1, 336, -1, 338, -1, -1, -1, 342, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 1277, 1278, -1, 362, - -1, -1, -1, -1, 1285, 368, 369, -1, 256, 257, - -1, -1, 1293, 1294, -1, 1296, 264, 265, 266, 267, - 268, -1, 270, 271, 0, 273, 274, 275, 276, 277, - 278, 279, -1, -1, -1, 1316, -1, 285, 1319, 287, - 288, 289, 290, 291, 292, -1, -1, 295, -1, -1, - -1, 299, 300, -1, 302, 303, 304, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 314, -1, 316, -1, - 318, 319, -1, -1, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 334, 335, -1, 337, - -1, -1, 340, 341, -1, -1, 344, 345, -1, -1, + 1194, -1, -1, -1, -1, -1, -1, -1, 0, 362, + -1, 1205, -1, -1, -1, 368, 369, 1211, 363, -1, + -1, -1, -1, 368, 369, -1, 371, 372, 373, 374, + 1224, 376, -1, 378, 379, -1, 381, 382, 383, 384, + 385, -1, 387, 388, 389, 390, -1, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 410, 411, 412, 413, -1, + -1, -1, -1, 418, -1, 420, -1, -1, 423, -1, + -1, -1, -1, -1, 429, 1279, 1280, -1, -1, -1, + -1, -1, -1, 1287, -1, -1, -1, 256, 257, -1, + -1, 1295, 1296, -1, 1298, 264, 265, 266, 267, 268, + -1, 270, 271, -1, 273, 274, 275, 276, 277, 278, + 279, 280, -1, -1, 1318, -1, 285, 1321, 287, 288, + 289, 290, 291, 292, 0, -1, 295, -1, -1, -1, + 299, 300, -1, 302, 303, 304, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 314, -1, 316, -1, 318, + 319, -1, -1, 322, -1, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, -1, 337, -1, + -1, 340, 341, -1, -1, 344, 345, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 359, 360, 361, 362, 363, -1, -1, -1, 367, - 368, -1, -1, 371, -1, -1, -1, -1, 376, 377, - 378, 379, 380, -1, 256, -1, 384, -1, 386, 261, - 262, -1, -1, -1, 392, 393, -1, -1, -1, -1, - -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, - -1, -1, 284, -1, -1, -1, -1, -1, -1, 417, - 418, 419, 420, -1, 422, 297, 298, -1, -1, -1, - 302, 429, -1, 305, -1, 307, -1, 309, 310, 311, - 312, -1, -1, -1, -1, 317, -1, -1, -1, 321, - -1, -1, -1, 325, -1, -1, -1, -1, -1, -1, - -1, 333, -1, -1, 336, -1, 338, 339, -1, -1, - -1, -1, 344, -1, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, -1, -1, -1, -1, - 362, 363, -1, -1, -1, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, -1, 378, 379, -1, -1, - 382, 383, 384, 385, 386, -1, -1, 389, 390, -1, - -1, -1, 394, 395, 396, 397, 398, 399, 400, 401, - 256, -1, -1, -1, 0, 261, 262, -1, -1, -1, - -1, 413, -1, -1, 416, -1, 418, -1, 420, -1, - -1, 423, -1, -1, -1, -1, -1, 429, 284, -1, + 359, 360, 361, 362, 363, -1, -1, -1, 367, 368, + -1, -1, 371, -1, -1, -1, -1, 376, 377, 378, + 379, 380, -1, -1, -1, 384, -1, 386, -1, -1, + -1, -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 297, 298, -1, -1, -1, 302, -1, -1, 305, + -1, -1, -1, -1, -1, -1, -1, -1, 417, 418, + 419, 420, -1, 422, 256, 257, -1, -1, -1, -1, + 429, -1, 264, 265, 266, 267, 268, -1, 270, 271, + 0, 273, 274, 275, 276, 277, 278, 279, -1, -1, + -1, -1, -1, 285, -1, 287, 288, 289, 290, 291, + 292, -1, -1, 295, -1, -1, -1, 299, 300, -1, + 302, 303, 304, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 314, -1, 316, -1, 318, 319, -1, -1, + 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 335, -1, 337, -1, -1, 340, 341, + -1, -1, 344, 345, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, + 362, 363, -1, -1, -1, 367, 368, -1, -1, 371, + -1, -1, -1, -1, 376, 377, 378, 379, 380, -1, + 256, -1, 384, -1, 386, 261, 262, -1, -1, -1, + 392, 393, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, -1, -1, -1, 284, -1, + -1, -1, -1, -1, -1, 417, 418, 419, 420, -1, + 422, 297, 298, -1, -1, -1, 302, 429, -1, 305, -1, 307, -1, 309, 310, 311, 312, -1, -1, -1, -1, 317, -1, -1, -1, 321, -1, -1, -1, 325, -1, -1, -1, -1, -1, -1, -1, 333, -1, -1, 336, -1, 338, 339, -1, -1, -1, -1, 344, -1, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, -1, -1, -1, -1, -1, 362, 363, 0, -1, - -1, 367, 368, 369, 370, 371, 372, -1, 374, 375, + 356, 357, -1, -1, -1, -1, 362, 363, -1, -1, + -1, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, -1, 378, 379, -1, -1, 382, 383, 384, 385, - 256, -1, -1, 389, 390, 261, 262, -1, 394, 395, - 396, 397, 398, 399, 400, 401, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 413, 284, -1, - 416, -1, 418, -1, 420, -1, -1, 423, -1, -1, - -1, 297, 298, 429, -1, -1, 302, -1, -1, 305, - -1, 307, -1, 309, 310, 311, 312, -1, -1, -1, - -1, 317, -1, -1, -1, 321, -1, -1, -1, 325, - -1, -1, -1, -1, -1, -1, -1, 333, -1, -1, - 336, -1, 338, 339, -1, -1, -1, -1, 344, -1, - 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, -1, -1, -1, -1, -1, 362, 363, -1, -1, - -1, 367, 368, 369, 370, 371, 372, -1, 374, 375, - 376, -1, 378, 379, 0, -1, 382, 383, 384, 385, - 256, -1, -1, 389, 390, 261, 262, -1, 394, 395, - 396, 397, 398, 399, 400, 401, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 413, 284, -1, + 386, -1, -1, 389, 390, -1, -1, -1, 394, 395, + 396, 397, 398, 399, 400, 401, 256, -1, -1, -1, + 0, 261, 262, -1, -1, -1, -1, 413, -1, -1, 416, -1, 418, -1, 420, -1, -1, 423, -1, -1, - -1, 297, 298, 429, -1, -1, 302, -1, -1, 305, - -1, 307, -1, 309, 310, 311, 312, -1, -1, -1, - -1, 317, -1, -1, -1, 321, -1, -1, -1, 325, - -1, -1, -1, -1, -1, -1, -1, 333, -1, -1, - 336, -1, 338, 339, -1, -1, -1, -1, 344, -1, - 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, -1, -1, -1, 256, -1, 362, 363, -1, -1, - 262, 367, 368, -1, 370, 371, 372, -1, 374, 375, - 376, -1, 378, 379, -1, -1, 382, 383, 384, 385, - -1, -1, -1, 389, 390, -1, -1, -1, 394, 395, - 396, 397, 398, 399, 400, 401, 298, -1, -1, -1, - -1, -1, 0, -1, -1, -1, -1, 413, -1, -1, - 416, -1, 418, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 429, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 339, -1, -1, - -1, -1, 344, -1, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, -1, -1, 256, -1, - -1, 363, -1, -1, -1, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, -1, 378, 379, -1, -1, - 382, 383, 384, 385, 386, 0, -1, 389, 390, -1, - -1, -1, 394, 395, 396, 397, 398, 399, 400, 401, - 256, -1, -1, -1, -1, -1, 262, -1, -1, -1, - -1, 413, -1, -1, 416, -1, 418, -1, 420, -1, - -1, 423, -1, -1, -1, -1, -1, 429, 0, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 339, 298, -1, -1, -1, 344, -1, 346, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, -1, + -1, -1, -1, 429, 284, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 297, 298, -1, + -1, -1, 302, -1, -1, 305, -1, 307, -1, 309, + 310, 311, 312, -1, -1, -1, -1, 317, -1, -1, + -1, 321, -1, -1, -1, 325, -1, -1, -1, -1, + -1, -1, -1, 333, -1, -1, 336, -1, 338, 339, + -1, -1, -1, -1, 344, -1, 346, 347, 348, 349, + 350, 351, 352, 353, 354, 355, 356, -1, -1, -1, + -1, -1, 362, 363, 0, -1, -1, 367, 368, 369, + 370, 371, 372, -1, 374, 375, 376, -1, 378, 379, + -1, -1, 382, 383, 384, 385, 256, -1, -1, 389, + 390, 261, 262, -1, 394, 395, 396, 397, 398, 399, + 400, 401, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 413, 284, -1, 416, -1, 418, -1, + 420, -1, -1, 423, -1, -1, -1, 297, 298, 429, + -1, -1, 302, -1, -1, 305, -1, 307, -1, 309, + 310, 311, 312, -1, -1, -1, -1, 317, -1, -1, + -1, 321, -1, -1, -1, 325, -1, -1, -1, -1, + -1, -1, -1, 333, -1, -1, 336, -1, 338, 339, + -1, -1, -1, -1, 344, -1, 346, 347, 348, 349, + 350, 351, 352, 353, 354, 355, 356, -1, -1, -1, + -1, -1, 362, 363, -1, -1, -1, 367, 368, 369, + 370, 371, 372, -1, 374, 375, 376, -1, 378, 379, + 0, -1, 382, 383, 384, 385, 256, -1, -1, 389, + 390, 261, 262, -1, 394, 395, 396, 397, 398, 399, + 400, 401, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 413, 284, -1, 416, -1, 418, -1, + 420, -1, -1, 423, -1, -1, -1, 297, 298, 429, + -1, -1, 302, -1, -1, 305, -1, 307, -1, 309, + 310, 311, 312, -1, -1, -1, -1, 317, -1, -1, + -1, 321, -1, -1, -1, 325, -1, -1, -1, -1, + -1, -1, -1, 333, -1, -1, 336, -1, 338, 339, + -1, -1, -1, -1, 344, -1, 346, 347, 348, 349, + 350, 351, 352, 353, 354, 355, 356, -1, -1, -1, + 256, -1, 362, 363, -1, -1, 262, 367, 368, -1, + 370, 371, 372, -1, 374, 375, 376, -1, 378, 379, + -1, -1, 382, 383, 384, 385, -1, -1, -1, 389, + 390, -1, -1, -1, 394, 395, 396, 397, 398, 399, + 400, 401, 298, -1, -1, -1, -1, -1, 0, -1, + -1, -1, -1, 413, -1, -1, 416, -1, 418, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 429, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 368, 0, 370, -1, 372, -1, 374, 375, 376, -1, -1, -1, -1, 339, -1, -1, -1, -1, 344, -1, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, -1, -1, -1, -1, -1, -1, 363, -1, -1, - -1, 367, 368, -1, 370, 371, 372, -1, 374, 375, + 356, 357, -1, -1, 256, -1, -1, 363, -1, -1, + -1, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, -1, 378, 379, -1, -1, 382, 383, 384, 385, - -1, 429, -1, 389, 390, -1, -1, -1, 394, 395, - 396, 397, 398, 399, 400, 401, -1, -1, -1, -1, - -1, 0, -1, -1, -1, -1, -1, 413, 256, 257, - 416, -1, 418, 261, -1, -1, -1, 265, -1, 267, - -1, -1, 270, 429, 272, 273, -1, 275, -1, 277, - -1, 279, -1, 281, 282, 283, 284, -1, -1, 287, - 288, -1, -1, -1, 0, 293, -1, 295, 296, 297, - -1, -1, 300, 301, 302, -1, 304, -1, -1, 307, - -1, 309, 310, 311, 312, -1, -1, -1, 316, 317, - 318, -1, -1, 321, 322, 323, -1, -1, -1, -1, - -1, -1, 330, 331, -1, 333, 334, 0, 336, 337, - 338, -1, 257, -1, 342, -1, 261, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 272, -1, -1, - -1, -1, 277, -1, 362, -1, 281, -1, -1, 284, - 368, 369, -1, -1, -1, -1, -1, -1, -1, 377, - 0, 296, 297, -1, -1, 257, 301, 302, -1, 261, - -1, -1, 307, -1, 309, 310, 311, 312, -1, -1, - 272, -1, 317, -1, -1, 277, 321, -1, 323, 281, - -1, -1, 284, -1, -1, -1, -1, -1, 333, -1, - 418, 336, -1, 338, 296, 297, -1, 342, 257, 301, - 302, -1, 261, -1, -1, 307, -1, 309, 310, 311, - 312, -1, -1, 272, -1, 317, -1, 362, 277, 321, - -1, 323, 281, 368, 369, 284, -1, -1, -1, -1, - 0, 333, -1, -1, 336, -1, 338, 296, 297, -1, - 342, -1, 301, 302, -1, -1, -1, -1, 307, -1, - 309, 310, 311, 312, -1, -1, -1, -1, 317, -1, - 362, -1, 321, -1, 323, -1, -1, 369, -1, -1, - -1, -1, -1, -1, 333, -1, -1, 336, 257, 338, - -1, -1, 261, 342, -1, -1, -1, -1, -1, -1, + 386, 0, -1, 389, 390, -1, -1, -1, 394, 395, + 396, 397, 398, 399, 400, 401, 256, -1, -1, -1, + -1, -1, 262, -1, -1, -1, -1, 413, -1, -1, + 416, -1, 418, -1, 420, -1, -1, 423, -1, -1, + -1, -1, -1, 429, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 339, 298, -1, + -1, -1, 344, -1, 346, 347, 348, 349, 350, 351, + 352, 353, 354, 355, 356, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 368, 0, 370, -1, + 372, -1, 374, 375, 376, -1, -1, -1, -1, 339, + -1, -1, -1, -1, 344, -1, 346, 347, 348, 349, + 350, 351, 352, 353, 354, 355, 356, -1, -1, -1, + -1, -1, -1, 363, -1, -1, -1, 367, 368, -1, + 370, 371, 372, -1, 374, 375, 376, -1, 378, 379, + -1, -1, 382, 383, 384, 385, -1, 429, -1, 389, + 390, -1, -1, -1, 394, 395, 396, 397, 398, 399, + 400, 401, -1, -1, -1, -1, -1, 0, -1, -1, + -1, -1, -1, 413, 256, 257, 416, -1, 418, 261, + -1, -1, -1, 265, -1, 267, -1, -1, 270, 429, + 272, 273, -1, 275, -1, 277, -1, 279, -1, 281, + 282, 283, 284, -1, -1, 287, 288, -1, -1, -1, + 0, 293, -1, 295, 296, 297, -1, -1, 300, 301, + 302, -1, 304, -1, -1, 307, -1, 309, 310, 311, + 312, -1, -1, -1, 316, 317, 318, -1, -1, 321, + 322, 323, -1, -1, -1, -1, -1, -1, 330, 331, + -1, 333, 334, 0, 336, 337, 338, -1, 257, -1, + 342, -1, 261, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, -1, -1, -1, 277, -1, - -1, -1, 281, 362, -1, 284, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 296, 297, -1, + 362, -1, 281, -1, -1, 284, 368, 369, -1, -1, + -1, -1, -1, -1, -1, 377, 0, 296, 297, -1, -1, 257, 301, 302, -1, 261, -1, -1, 307, -1, 309, 310, 311, 312, -1, -1, 272, -1, 317, -1, -1, 277, 321, -1, 323, 281, -1, -1, 284, -1, - -1, -1, -1, -1, 333, -1, -1, 336, -1, 338, + -1, -1, -1, -1, 333, -1, 418, 336, -1, 338, 296, 297, -1, 342, 257, 301, 302, -1, 261, -1, -1, 307, -1, 309, 310, 311, 312, -1, -1, 272, - -1, 317, -1, 362, 277, 321, -1, 323, 281, -1, - -1, 284, -1, -1, -1, -1, -1, 333, -1, -1, - 336, -1, 338, 296, 297, -1, 342, 257, 301, 302, + -1, 317, -1, 362, 277, 321, -1, 323, 281, 368, + 369, 284, -1, -1, -1, -1, -1, 333, -1, -1, + 336, -1, 338, 296, 297, -1, 342, -1, 301, 302, + -1, -1, -1, -1, 307, -1, 309, 310, 311, 312, + -1, -1, -1, -1, 317, -1, 362, -1, 321, -1, + 323, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 333, -1, -1, 336, 257, 338, -1, -1, 261, 342, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, + -1, -1, -1, -1, 277, -1, -1, -1, 281, 362, + -1, 284, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 296, 297, -1, -1, 257, 301, 302, -1, 261, -1, -1, 307, -1, 309, 310, 311, 312, - -1, -1, 272, -1, 317, -1, 362, 277, 321, -1, + -1, -1, 272, -1, 317, -1, -1, 277, 321, -1, 323, 281, -1, -1, 284, -1, -1, -1, -1, -1, 333, -1, -1, 336, -1, 338, 296, 297, -1, 342, - -1, 301, 302, -1, -1, -1, -1, 307, -1, 309, - 310, 311, 312, -1, -1, -1, -1, 317, -1, 362, - -1, 321, -1, 323, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 333, -1, -1, 336, 257, 338, -1, - -1, 261, 342, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 272, -1, -1, -1, -1, 277, -1, -1, - -1, 281, 362, -1, 284, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 296, 297, -1, -1, - -1, 301, 302, -1, -1, -1, -1, 307, -1, 309, - 310, 311, 312, -1, -1, -1, -1, 317, -1, -1, - -1, 321, -1, 323, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 333, -1, 256, 336, -1, 338, -1, - -1, -1, 342, 264, 265, 266, 267, -1, -1, 270, - 271, -1, 273, 274, 275, 276, 277, 278, 279, -1, - -1, -1, 362, -1, 285, -1, 287, 288, 289, 290, - 291, 292, -1, -1, 295, -1, -1, -1, 299, 300, - -1, 302, 303, 304, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 314, -1, 316, -1, 318, 319, -1, - -1, 322, -1, 324, 325, 326, 327, 328, 329, 330, - 331, 332, 333, 334, 335, -1, 337, -1, -1, 340, - 341, -1, 256, 344, 345, -1, -1, -1, 262, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, - 361, 362, 363, -1, -1, -1, 367, -1, -1, -1, - 371, -1, -1, -1, -1, 376, 377, 378, 379, 380, - -1, -1, -1, 384, 298, 386, -1, -1, -1, -1, - -1, 392, 393, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 256, -1, - -1, -1, -1, -1, 262, -1, 417, 418, 419, 420, - -1, -1, -1, -1, -1, 339, -1, -1, 429, -1, - 344, -1, 346, 347, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, -1, -1, -1, -1, -1, 363, - 298, -1, -1, -1, 368, 369, 370, 371, 372, 373, - 374, 375, 376, -1, 378, 379, -1, 381, 382, 383, - 384, 385, 386, 387, 388, 389, 390, -1, 392, 393, - 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, - 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, - -1, 256, -1, -1, 418, -1, 420, 262, -1, 423, - -1, -1, -1, -1, -1, 429, -1, -1, -1, -1, - 368, -1, -1, 371, -1, 373, 374, -1, -1, -1, - 378, 379, -1, -1, 382, 383, 384, 385, 386, 387, - 388, 389, 390, 298, 392, 393, 394, 395, 396, 397, - 398, 399, 400, 401, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 412, 413, -1, -1, -1, -1, - -1, -1, 420, -1, -1, 423, -1, -1, -1, -1, - -1, 429, -1, -1, 339, -1, -1, -1, -1, 344, - -1, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, -1, 378, 379, -1, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, -1, 392, 393, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, -1, - 256, 256, -1, -1, -1, 420, 262, -1, -1, -1, - 265, -1, 267, -1, 429, 270, -1, -1, -1, -1, - 275, -1, -1, -1, 279, -1, -1, -1, -1, -1, - -1, -1, -1, 288, -1, -1, -1, -1, -1, -1, - 295, -1, 298, -1, -1, 300, -1, -1, -1, 304, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 316, -1, 318, -1, -1, -1, 322, -1, -1, - -1, 256, -1, -1, -1, 330, 331, 262, -1, 334, - -1, -1, 337, 339, -1, -1, -1, -1, 344, -1, - 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, -1, -1, -1, -1, -1, -1, -1, 363, -1, - -1, 367, 368, 298, 370, 371, 372, 373, 374, 375, - 376, -1, 378, 379, -1, 381, 382, 383, 384, 385, - 386, 387, 388, 389, 390, -1, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 412, 413, -1, 256, - -1, -1, -1, 418, 420, 262, -1, 423, -1, -1, - -1, -1, -1, 429, -1, -1, -1, -1, 363, -1, - -1, -1, -1, 368, 369, -1, 371, 372, 373, 374, - -1, 376, -1, 378, 379, -1, 381, 382, 383, 384, - 385, 298, 387, 388, 389, 390, -1, 392, 393, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, -1, - -1, -1, -1, 418, -1, 420, -1, -1, 423, -1, - -1, -1, 339, -1, 429, -1, -1, 344, -1, 346, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 368, -1, 370, 371, 372, 373, 374, 375, 376, - -1, 378, 379, -1, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, -1, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 409, 410, 411, 412, 413, -1, 256, 256, - -1, -1, -1, 420, 262, -1, 423, -1, 265, -1, - 267, -1, 429, 270, -1, -1, -1, -1, 275, -1, - -1, -1, 279, -1, -1, -1, -1, -1, -1, -1, - -1, 288, -1, -1, -1, -1, -1, -1, 295, -1, - 298, -1, -1, 300, -1, -1, -1, 304, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 316, - -1, 318, -1, -1, -1, 322, -1, -1, -1, -1, - -1, -1, -1, 330, 331, -1, -1, 334, -1, -1, - 337, 339, -1, -1, -1, -1, 344, -1, 346, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, -1, + 257, 301, 302, -1, 261, -1, -1, 307, -1, 309, + 310, 311, 312, -1, -1, 272, -1, 317, -1, 362, + 277, 321, -1, 323, 281, -1, -1, 284, -1, -1, + -1, -1, -1, 333, -1, -1, 336, -1, 338, 296, + 297, -1, 342, 257, 301, 302, -1, 261, -1, -1, + 307, -1, 309, 310, 311, 312, -1, -1, 272, -1, + 317, -1, 362, 277, 321, -1, 323, 281, -1, -1, + 284, -1, -1, -1, -1, -1, 333, -1, -1, 336, + -1, 338, 296, 297, -1, 342, -1, 301, 302, -1, + -1, -1, -1, 307, -1, 309, 310, 311, 312, -1, + -1, -1, -1, 317, -1, 362, -1, 321, -1, 323, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 333, + -1, 256, 336, -1, 338, -1, -1, -1, 342, 264, + 265, 266, 267, -1, -1, 270, 271, -1, 273, 274, + 275, 276, 277, 278, 279, -1, -1, -1, 362, -1, + 285, -1, 287, 288, 289, 290, 291, 292, -1, -1, + 295, -1, -1, -1, 299, 300, -1, 302, 303, 304, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, + -1, 316, -1, 318, 319, -1, -1, 322, -1, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, -1, 337, -1, -1, 340, 341, -1, 256, 344, + 345, -1, -1, -1, 262, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, + -1, -1, 367, -1, -1, -1, 371, -1, -1, -1, + -1, 376, 377, 378, 379, 380, -1, -1, -1, 384, + 298, 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 368, -1, 370, 371, 372, 373, 374, 375, 376, -1, + -1, -1, -1, -1, 256, -1, -1, -1, -1, -1, + 262, -1, 417, 418, 419, 420, -1, -1, -1, -1, + -1, 339, -1, -1, 429, -1, 344, -1, 346, 347, + 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, + -1, -1, -1, -1, -1, 363, 298, -1, -1, -1, + 368, 369, 370, 371, 372, 373, 374, 375, 376, -1, 378, 379, -1, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, -1, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, - 408, 409, 410, 411, 412, 413, -1, 256, 256, -1, - -1, 418, 420, 262, -1, 423, -1, 265, -1, 267, - -1, 429, 270, -1, -1, -1, -1, 275, -1, -1, - -1, 279, -1, -1, -1, -1, -1, -1, -1, -1, - 288, -1, -1, -1, -1, -1, -1, 295, -1, 298, - -1, -1, 300, -1, -1, -1, 304, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 316, -1, - 318, -1, -1, -1, 322, -1, -1, -1, -1, -1, - -1, -1, 330, 331, -1, -1, 334, -1, -1, 337, + 408, 409, 410, 411, 412, 413, -1, 256, -1, -1, + 418, -1, 420, 262, -1, 423, -1, -1, -1, -1, + -1, 429, -1, -1, -1, -1, 368, -1, -1, 371, + -1, 373, 374, -1, -1, -1, 378, 379, -1, -1, + 382, 383, 384, 385, 386, 387, 388, 389, 390, 298, + 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 412, 413, -1, -1, -1, -1, -1, -1, 420, -1, + -1, 423, -1, -1, -1, -1, -1, 429, -1, 285, 339, -1, -1, -1, -1, 344, -1, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 368, - -1, 370, 371, 372, 373, 374, 375, 376, -1, 378, - 379, -1, 381, 382, 383, 384, 385, 386, 387, 388, + -1, -1, -1, -1, -1, -1, -1, -1, 367, 368, + 369, 370, 371, 372, 373, 374, 375, 376, 256, 378, + 379, 327, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, -1, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 409, 410, 411, 412, 413, -1, 256, -1, 261, -1, - 418, 420, 262, -1, 423, -1, -1, -1, -1, -1, - 429, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 284, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 297, -1, -1, -1, 298, 302, - -1, -1, 305, -1, 307, -1, 309, 310, 311, 312, - -1, -1, -1, -1, 317, -1, -1, -1, 321, -1, - -1, 256, 325, -1, -1, -1, -1, 262, -1, -1, - 333, 266, -1, 336, -1, 338, -1, -1, -1, 339, + 409, 410, 411, 412, 413, -1, 256, -1, -1, -1, + -1, 420, 262, -1, -1, -1, -1, -1, -1, -1, + 429, 377, 378, 379, 380, -1, 382, 383, 384, 385, + 386, 387, 388, 389, -1, -1, 392, 393, 394, 395, + 396, 397, 398, 399, -1, -1, -1, -1, 298, -1, + -1, 339, -1, -1, -1, -1, 344, -1, 346, 347, + 348, 349, 350, 351, 352, 353, 354, 355, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 368, -1, 370, -1, 372, -1, 374, 375, 376, 339, -1, -1, -1, -1, 344, -1, 346, 347, 348, 349, - 350, 351, 352, 353, 354, 355, 356, -1, -1, 362, - -1, -1, -1, 298, -1, -1, -1, -1, 368, -1, - 370, 371, 372, 373, 374, 375, 376, -1, 378, 314, + 350, 351, 352, 353, 354, 355, 356, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 367, 368, -1, + 370, 371, 372, 373, 374, 375, 376, -1, 378, 379, -1, 381, 382, 383, 384, 385, 386, 387, 388, 389, - 390, -1, 392, 393, 394, 395, 396, 397, 398, 399, + 390, 429, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, 412, 413, -1, 418, -1, -1, -1, -1, - 420, -1, 357, 423, -1, -1, -1, -1, 363, 429, - -1, -1, -1, 368, 369, 370, 371, 372, 373, 374, - 375, 376, -1, 378, 379, -1, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, -1, 392, 393, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, -1, - 256, -1, 256, 418, -1, 420, 262, -1, 423, -1, - 264, 265, -1, 267, 429, -1, 270, 271, -1, -1, - -1, 275, 276, 277, -1, 279, -1, -1, -1, -1, - -1, 285, -1, -1, 288, -1, -1, -1, -1, -1, - -1, 295, 298, -1, -1, -1, 300, -1, 302, 303, - 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 316, -1, 318, 319, -1, -1, 322, -1, - -1, 325, -1, 327, -1, 329, 330, 331, 332, -1, - 334, -1, -1, 339, -1, -1, -1, -1, 344, -1, - 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, -1, -1, -1, -1, 359, 360, 361, 362, -1, - -1, -1, 368, -1, 370, -1, 372, 371, 374, 375, - 376, -1, 378, 379, -1, 381, 382, 383, 384, 385, - 386, 387, 388, 389, 390, 261, -1, -1, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 256, 413, 284, -1, - -1, -1, 262, 417, 418, -1, -1, -1, -1, -1, - -1, 297, -1, 429, -1, -1, 302, -1, -1, 305, - -1, 307, -1, 309, 310, 311, 312, -1, -1, -1, - -1, 317, -1, -1, -1, 321, -1, -1, 298, 325, - -1, -1, -1, -1, -1, -1, -1, 333, -1, -1, - 336, -1, 338, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 256, -1, -1, -1, -1, -1, - 262, -1, -1, -1, -1, -1, 362, -1, -1, 339, - -1, -1, -1, -1, 344, -1, 346, 347, 348, 349, - 350, 351, 352, 353, 354, 355, 356, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 298, -1, 368, -1, - 370, -1, 372, -1, 374, 375, 376, -1, 378, 379, - -1, -1, 382, 383, 384, 385, 386, 387, 388, 389, - 390, -1, 418, -1, 394, 395, 396, 397, 398, 399, - 400, 401, -1, -1, -1, -1, -1, 339, -1, -1, - -1, -1, 344, 413, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, -1, -1, -1, 256, 429, - -1, -1, -1, -1, 262, -1, 368, -1, 370, -1, - 372, -1, 374, 375, 376, -1, 378, 379, -1, -1, - 382, 383, 384, 385, -1, -1, -1, 389, 390, -1, - -1, -1, 394, 395, 396, 397, 398, 399, 400, 401, - 298, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 413, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 256, 429, -1, -1, - -1, -1, 262, -1, -1, -1, -1, -1, -1, -1, - -1, 339, -1, -1, -1, -1, 344, -1, 346, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 298, -1, - 368, -1, 370, -1, 372, -1, 374, 375, 376, -1, - 378, 379, -1, -1, 382, 383, 384, 385, -1, -1, - -1, 389, 390, 285, -1, -1, 394, 395, 396, 397, - 398, 399, 400, 401, -1, -1, -1, -1, -1, 339, - -1, -1, -1, -1, 344, 413, 346, 347, 348, 349, - 350, 351, 352, 353, 354, 355, 356, -1, -1, -1, - 256, 429, -1, -1, -1, 327, 262, -1, 368, -1, - 370, -1, 372, -1, 374, 375, 376, -1, 378, 379, - -1, -1, 382, 383, 384, 385, -1, -1, -1, 389, - 390, -1, -1, -1, 394, 395, 396, 397, 398, 399, - 400, 401, 298, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 413, -1, 377, 378, 379, 380, -1, - 382, 383, 384, 385, 386, 387, 388, 389, 256, 429, - 392, 393, 394, 395, 396, 397, 398, 399, -1, -1, - -1, -1, -1, 339, -1, -1, -1, -1, 344, -1, - 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 368, -1, 370, -1, 372, -1, 374, 375, - 376, -1, 378, 379, -1, -1, 382, 383, 384, 385, - -1, -1, -1, 389, 390, -1, 256, -1, 394, 395, - 396, 397, 398, 399, 400, 401, -1, -1, -1, -1, - -1, 339, -1, -1, -1, -1, 344, 413, 346, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, -1, - -1, -1, -1, 429, -1, -1, -1, -1, -1, -1, - 368, -1, 370, -1, 372, -1, 374, 375, 376, -1, - -1, -1, -1, -1, 382, 383, 384, 385, -1, -1, - -1, 389, 390, -1, 256, -1, 394, 395, 396, 397, - 398, 399, 400, 401, -1, -1, -1, -1, -1, 339, - -1, -1, -1, -1, 344, 413, 346, 347, 348, 349, - 350, 351, 352, 353, 354, 355, 356, -1, -1, -1, - -1, 429, -1, -1, -1, -1, -1, -1, 368, -1, - 370, -1, 372, -1, 374, 375, 376, -1, -1, -1, - -1, -1, 382, 383, 384, 385, -1, -1, -1, 389, - 390, -1, 256, -1, 394, 395, 396, 397, 398, 399, - 400, 401, -1, -1, -1, -1, -1, 339, -1, -1, - -1, -1, 344, 413, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, -1, -1, -1, -1, 429, - -1, -1, -1, -1, -1, -1, 368, -1, 370, -1, - 372, -1, 374, 375, 376, -1, -1, -1, -1, -1, - 382, 383, 384, 385, -1, -1, -1, 389, 390, -1, - 256, -1, -1, -1, 396, 397, 398, 399, 400, 401, - -1, -1, -1, -1, -1, 339, -1, -1, -1, -1, - 344, 413, 346, 347, 348, 349, 350, 351, 352, 353, - 354, 355, 356, -1, -1, -1, -1, 429, -1, -1, - -1, -1, -1, -1, 368, -1, 370, -1, 372, -1, - 374, 375, 376, -1, -1, -1, -1, -1, 382, 383, - 384, 385, -1, -1, -1, 389, 390, -1, 256, -1, - -1, -1, 396, 397, 398, 399, 400, 401, -1, -1, - -1, -1, -1, 339, -1, -1, -1, -1, 344, 413, - 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, -1, -1, -1, -1, 429, -1, -1, -1, -1, - -1, -1, 368, -1, 370, -1, 372, -1, 374, 375, - 376, -1, -1, -1, -1, -1, 382, 383, 384, 385, - -1, -1, -1, 389, 390, -1, 256, -1, -1, -1, - 396, 397, 398, 399, 400, 401, -1, -1, -1, -1, - -1, 339, -1, -1, -1, -1, 344, 413, 346, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, -1, - -1, -1, -1, 429, -1, -1, -1, -1, -1, -1, - 368, -1, 370, -1, 372, -1, 374, 375, 376, -1, - -1, -1, -1, -1, 382, 383, 384, 385, -1, -1, - -1, 389, 390, -1, 256, -1, -1, -1, 396, 397, - 398, 399, 400, 401, -1, -1, -1, -1, -1, 339, - -1, -1, -1, -1, 344, 413, 346, 347, 348, 349, - 350, 351, 352, 353, 354, 355, 356, -1, -1, -1, - -1, 429, -1, -1, -1, -1, -1, -1, 368, -1, - 370, -1, 372, -1, 374, 375, 376, -1, -1, -1, - -1, -1, 382, 383, 384, 385, -1, -1, -1, 389, - 390, -1, 256, -1, -1, -1, 396, 397, 398, 399, - 400, 401, -1, -1, -1, -1, -1, 339, -1, -1, - -1, -1, 344, 413, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, -1, -1, -1, -1, 429, - -1, -1, -1, -1, -1, -1, 368, -1, 370, -1, - 372, -1, 374, 375, 376, -1, -1, -1, -1, -1, - -1, -1, 384, 385, -1, -1, -1, 389, 390, -1, - 256, -1, -1, -1, -1, -1, 398, 399, 400, 401, - -1, -1, -1, -1, -1, 339, -1, -1, -1, -1, - 344, 413, 346, 347, 348, 349, 350, 351, 352, 353, - 354, 355, 356, -1, -1, -1, -1, 429, -1, -1, - -1, -1, -1, -1, 368, -1, 370, -1, 372, -1, - 374, 375, 376, -1, -1, -1, -1, -1, -1, -1, - 384, 385, -1, -1, -1, 389, 390, -1, 256, -1, - -1, -1, -1, -1, 398, 399, 400, 401, -1, -1, - -1, -1, -1, 339, -1, -1, -1, -1, 344, 413, - 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, -1, -1, -1, -1, 429, -1, -1, -1, -1, - -1, -1, 368, -1, 370, -1, 372, -1, 374, 375, - 376, -1, -1, -1, -1, -1, -1, -1, 384, 385, - -1, -1, -1, 389, 390, -1, 256, -1, -1, -1, - -1, -1, 398, 399, 400, 401, -1, -1, -1, -1, - -1, 339, -1, -1, -1, -1, 344, 413, 346, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, -1, - -1, -1, -1, 429, -1, -1, -1, -1, -1, -1, - 368, -1, 370, -1, 372, -1, 374, 375, 376, -1, - -1, -1, -1, -1, -1, -1, 384, 385, -1, -1, - -1, 389, 390, -1, 256, -1, -1, -1, -1, -1, - -1, -1, 400, 401, -1, -1, -1, -1, -1, 339, - -1, -1, -1, -1, 344, 413, 346, 347, 348, 349, - 350, 351, 352, 353, 354, 355, 356, -1, -1, -1, - -1, 429, -1, -1, -1, -1, -1, -1, 368, -1, - 370, -1, 372, -1, 374, 375, 376, -1, -1, -1, - -1, -1, -1, -1, -1, 385, -1, -1, -1, 389, - 390, -1, 256, -1, -1, -1, -1, -1, -1, -1, - 400, 401, -1, -1, -1, -1, -1, 339, -1, -1, - -1, -1, 344, 413, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, -1, -1, -1, -1, 429, - -1, -1, -1, -1, -1, -1, 368, -1, 370, -1, - 372, -1, 374, 375, 376, -1, -1, -1, -1, -1, - -1, -1, -1, 385, -1, -1, -1, 389, 390, -1, - 256, -1, -1, -1, -1, -1, -1, -1, 400, 401, - -1, -1, -1, -1, -1, 339, -1, -1, -1, -1, - 344, 413, 346, 347, 348, 349, 350, 351, 352, 353, - 354, 355, 356, -1, -1, -1, -1, 429, -1, -1, - -1, -1, -1, -1, 368, -1, 370, -1, 372, -1, - 374, 375, 376, -1, -1, -1, -1, -1, -1, -1, - -1, 385, -1, -1, -1, -1, 390, -1, 256, -1, - -1, -1, -1, -1, -1, -1, 400, 401, -1, -1, - -1, -1, -1, 339, -1, -1, -1, -1, 344, 413, - 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, -1, -1, -1, -1, 429, -1, -1, -1, -1, - -1, -1, 368, -1, 370, -1, 372, -1, 374, 375, - 376, -1, -1, -1, -1, -1, -1, -1, -1, 385, - -1, -1, -1, -1, 390, -1, 256, -1, -1, -1, - -1, -1, -1, -1, 400, 401, -1, -1, -1, -1, - -1, 339, -1, -1, -1, -1, 344, 413, 346, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, -1, - -1, -1, -1, 429, -1, -1, -1, -1, -1, -1, - 368, -1, 370, -1, 372, -1, 374, 375, 376, -1, - -1, -1, 256, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 390, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 400, 401, -1, -1, -1, -1, -1, 339, - -1, -1, -1, -1, 344, 413, 346, 347, 348, 349, - 350, 351, 352, 353, 354, 355, 356, -1, -1, -1, - -1, 429, -1, -1, -1, -1, -1, -1, 368, -1, - 370, -1, 372, -1, 374, 375, 376, -1, -1, -1, - -1, 262, -1, -1, -1, 266, -1, -1, -1, -1, - 390, -1, -1, -1, -1, 339, -1, -1, -1, -1, - 344, 401, 346, 347, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 413, -1, -1, -1, 298, -1, -1, - -1, -1, -1, -1, 368, -1, 370, -1, 372, 429, - 374, 375, 376, 314, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 390, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 401, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 413, - -1, -1, -1, -1, -1, -1, 357, -1, -1, -1, - -1, -1, 363, -1, -1, 429, -1, 368, 369, -1, - 371, -1, 373, -1, 375, 376, -1, 378, 379, -1, + 410, 411, 412, 413, -1, 256, 256, -1, -1, -1, + 420, 262, -1, 423, -1, 265, -1, 267, -1, 429, + 270, -1, -1, -1, -1, 275, -1, -1, -1, 279, + -1, -1, -1, -1, -1, -1, -1, -1, 288, -1, + -1, -1, -1, -1, -1, 295, -1, 298, -1, -1, + 300, -1, -1, -1, 304, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 316, -1, 318, -1, + -1, -1, 322, -1, -1, -1, -1, -1, -1, -1, + 330, 331, -1, -1, 334, -1, -1, 337, 339, -1, + -1, -1, -1, 344, -1, 346, 347, 348, 349, 350, + 351, 352, 353, 354, 355, 356, -1, -1, -1, -1, + -1, -1, -1, 363, -1, -1, -1, 368, -1, 370, + 371, 372, 373, 374, 375, 376, -1, 378, 379, -1, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, -1, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, - 411, 412, 413, -1, -1, 256, -1, 418, -1, 420, - -1, -1, 423, 264, 265, 266, 267, -1, 429, 270, - 271, -1, 273, 274, 275, 276, 277, 278, 279, -1, - -1, -1, -1, -1, 285, -1, 287, 288, 289, 290, - 291, 292, -1, -1, 295, -1, -1, -1, 299, 300, - -1, 302, 303, 304, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 314, -1, 316, -1, 318, 319, -1, - -1, 322, -1, 324, 325, 326, 327, 328, 329, 330, - 331, 332, 333, 334, 335, -1, 337, -1, -1, 340, - 341, -1, -1, 344, 345, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, - 361, 362, 363, -1, -1, -1, 367, -1, -1, -1, - 371, -1, -1, -1, -1, 376, 377, 378, 379, 380, - -1, -1, -1, 384, -1, 386, -1, -1, -1, -1, + 411, 412, 413, -1, 256, 256, -1, -1, 418, 420, + 262, -1, 423, -1, 265, -1, 267, -1, 429, 270, + -1, -1, -1, -1, 275, -1, -1, -1, 279, -1, + -1, -1, -1, -1, -1, -1, -1, 288, -1, -1, + -1, -1, -1, -1, 295, -1, 298, -1, -1, 300, + -1, -1, -1, 304, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 316, -1, 318, -1, -1, + -1, 322, -1, -1, -1, -1, -1, -1, -1, 330, + 331, -1, -1, 334, -1, -1, 337, 339, -1, -1, + -1, -1, 344, -1, 346, 347, 348, 349, 350, 351, + 352, 353, 354, 355, 356, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 368, -1, 370, 371, + 372, 373, 374, 375, 376, -1, 378, 379, -1, 381, + 382, 383, 384, 385, 386, 387, 388, 389, 390, -1, + 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + 412, 413, -1, 256, 256, -1, -1, 418, 420, 262, + -1, 423, -1, 265, -1, 267, -1, 429, 270, -1, + -1, -1, -1, 275, -1, -1, -1, 279, -1, -1, + -1, -1, -1, -1, -1, -1, 288, -1, -1, -1, + -1, -1, -1, 295, -1, 298, -1, -1, 300, -1, + -1, -1, 304, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 316, -1, 318, -1, -1, -1, + 322, -1, -1, -1, -1, -1, -1, -1, 330, 331, + -1, -1, 334, -1, -1, 337, 339, -1, -1, -1, + -1, 344, -1, 346, 347, 348, 349, 350, 351, 352, + 353, 354, 355, 356, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 368, -1, 370, 371, 372, + 373, 374, 375, 376, -1, 378, 379, -1, 381, 382, + 383, 384, 385, 386, 387, 388, 389, 390, -1, 392, + 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, + 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, + 413, -1, 256, -1, -1, -1, 418, 420, 262, 256, + 423, -1, 266, -1, -1, -1, 429, -1, 265, -1, + 267, -1, -1, 270, -1, -1, -1, -1, 275, -1, + -1, -1, 279, -1, -1, -1, -1, -1, -1, -1, + -1, 288, -1, -1, 298, -1, -1, -1, 295, -1, + -1, -1, -1, 300, -1, -1, -1, 304, -1, -1, + 314, -1, -1, -1, -1, -1, -1, -1, -1, 316, + -1, 318, -1, -1, -1, 322, -1, -1, -1, -1, + -1, -1, -1, 330, 331, -1, -1, 334, -1, -1, + 337, -1, -1, -1, -1, 256, -1, -1, -1, -1, + -1, 262, -1, 357, -1, -1, -1, -1, -1, 363, + -1, -1, -1, -1, 368, 369, 370, 371, 372, 373, + 374, 375, 376, -1, 378, 379, -1, 381, 382, 383, + 384, 385, 386, 387, 388, 389, 390, 298, 392, 393, + 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, + -1, -1, -1, -1, 418, -1, 420, -1, -1, 423, + -1, 418, -1, -1, -1, 429, -1, -1, 339, -1, + -1, -1, -1, 344, -1, 346, 347, 348, 349, 350, + 351, 352, 353, 354, 355, 356, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 368, -1, 370, + -1, 372, -1, 374, 375, 376, -1, 378, 379, -1, + 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, + 261, -1, -1, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, + 411, 256, 413, 284, -1, -1, -1, 262, -1, -1, + -1, -1, -1, -1, -1, -1, 297, -1, 429, -1, + -1, 302, -1, -1, 305, -1, 307, -1, 309, 310, + 311, 312, -1, -1, -1, -1, 317, -1, -1, -1, + 321, -1, -1, 298, 325, -1, -1, -1, -1, -1, + -1, -1, 333, -1, -1, 336, -1, 338, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, + -1, -1, -1, -1, -1, 262, -1, -1, -1, -1, + -1, 362, -1, -1, 339, -1, -1, -1, -1, 344, + -1, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 298, -1, 368, -1, 370, -1, 372, -1, 374, + 375, 376, -1, 378, 379, -1, -1, 382, 383, 384, + 385, 386, 387, 388, 389, 390, -1, 418, -1, 394, + 395, 396, 397, 398, 399, 400, 401, -1, -1, -1, + -1, -1, 339, -1, -1, -1, -1, 344, 413, 346, + 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, + -1, -1, -1, 256, 429, -1, -1, -1, -1, 262, + -1, 368, -1, 370, -1, 372, -1, 374, 375, 376, + -1, 378, 379, -1, -1, 382, 383, 384, 385, -1, + -1, -1, 389, 390, -1, -1, -1, 394, 395, 396, + 397, 398, 399, 400, 401, 298, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 413, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 256, 429, -1, -1, -1, -1, 262, -1, -1, + -1, -1, -1, -1, -1, -1, 339, -1, -1, -1, + -1, 344, -1, 346, 347, 348, 349, 350, 351, 352, + 353, 354, 355, 356, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 298, -1, 368, -1, 370, -1, 372, + -1, 374, 375, 376, -1, 378, 379, -1, -1, 382, + 383, 384, 385, -1, -1, -1, 389, 390, -1, 256, + -1, 394, 395, 396, 397, 398, 399, 400, 401, -1, + -1, -1, -1, -1, 339, -1, -1, -1, -1, 344, + 413, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, -1, -1, -1, -1, 429, -1, -1, -1, + -1, -1, -1, 368, -1, 370, -1, 372, -1, 374, + 375, 376, -1, 378, 379, -1, -1, 382, 383, 384, + 385, -1, -1, -1, 389, 390, -1, 256, -1, 394, + 395, 396, 397, 398, 399, 400, 401, -1, -1, -1, + -1, -1, 339, -1, -1, -1, -1, 344, 413, 346, + 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, + -1, -1, -1, -1, 429, -1, -1, -1, -1, -1, + -1, 368, -1, 370, -1, 372, -1, 374, 375, 376, + -1, -1, -1, -1, -1, 382, 383, 384, 385, -1, + -1, -1, 389, 390, -1, 256, -1, 394, 395, 396, + 397, 398, 399, 400, 401, -1, -1, -1, -1, -1, + 339, -1, -1, -1, -1, 344, 413, 346, 347, 348, + 349, 350, 351, 352, 353, 354, 355, 356, -1, -1, + -1, -1, 429, -1, -1, -1, -1, -1, -1, 368, + -1, 370, -1, 372, -1, 374, 375, 376, -1, -1, + -1, -1, -1, 382, 383, 384, 385, -1, -1, -1, + 389, 390, -1, 256, -1, 394, 395, 396, 397, 398, + 399, 400, 401, -1, -1, -1, -1, -1, 339, -1, + -1, -1, -1, 344, 413, 346, 347, 348, 349, 350, + 351, 352, 353, 354, 355, 356, -1, -1, -1, -1, + 429, -1, -1, -1, -1, -1, -1, 368, -1, 370, + -1, 372, -1, 374, 375, 376, -1, -1, -1, -1, + -1, 382, 383, 384, 385, -1, -1, -1, 389, 390, + -1, 256, -1, 394, 395, 396, 397, 398, 399, 400, + 401, -1, -1, -1, -1, -1, 339, -1, -1, -1, + -1, 344, 413, 346, 347, 348, 349, 350, 351, 352, + 353, 354, 355, 356, -1, -1, -1, -1, 429, -1, + -1, -1, -1, -1, -1, 368, -1, 370, -1, 372, + -1, 374, 375, 376, -1, -1, -1, -1, -1, 382, + 383, 384, 385, -1, -1, -1, 389, 390, -1, 256, + -1, -1, -1, 396, 397, 398, 399, 400, 401, -1, + -1, -1, -1, -1, 339, -1, -1, -1, -1, 344, + 413, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, -1, -1, -1, -1, 429, -1, -1, -1, + -1, -1, -1, 368, -1, 370, -1, 372, -1, 374, + 375, 376, -1, -1, -1, -1, -1, 382, 383, 384, + 385, -1, -1, -1, 389, 390, -1, 256, -1, -1, + -1, 396, 397, 398, 399, 400, 401, -1, -1, -1, + -1, -1, 339, -1, -1, -1, -1, 344, 413, 346, + 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, + -1, -1, -1, -1, 429, -1, -1, -1, -1, -1, + -1, 368, -1, 370, -1, 372, -1, 374, 375, 376, + -1, -1, -1, -1, -1, 382, 383, 384, 385, -1, + -1, -1, 389, 390, -1, 256, -1, -1, -1, 396, + 397, 398, 399, 400, 401, -1, -1, -1, -1, -1, + 339, -1, -1, -1, -1, 344, 413, 346, 347, 348, + 349, 350, 351, 352, 353, 354, 355, 356, -1, -1, + -1, -1, 429, -1, -1, -1, -1, -1, -1, 368, + -1, 370, -1, 372, -1, 374, 375, 376, -1, -1, + -1, -1, -1, 382, 383, 384, 385, -1, -1, -1, + 389, 390, -1, 256, -1, -1, -1, 396, 397, 398, + 399, 400, 401, -1, -1, -1, -1, -1, 339, -1, + -1, -1, -1, 344, 413, 346, 347, 348, 349, 350, + 351, 352, 353, 354, 355, 356, -1, -1, -1, -1, + 429, -1, -1, -1, -1, -1, -1, 368, -1, 370, + -1, 372, -1, 374, 375, 376, -1, -1, -1, -1, + -1, 382, 383, 384, 385, -1, -1, -1, 389, 390, + -1, 256, -1, -1, -1, 396, 397, 398, 399, 400, + 401, -1, -1, -1, -1, -1, 339, -1, -1, -1, + -1, 344, 413, 346, 347, 348, 349, 350, 351, 352, + 353, 354, 355, 356, -1, -1, -1, -1, 429, -1, + -1, -1, -1, -1, -1, 368, -1, 370, -1, 372, + -1, 374, 375, 376, -1, -1, -1, -1, -1, -1, + -1, 384, 385, -1, -1, -1, 389, 390, -1, 256, + -1, -1, -1, -1, -1, 398, 399, 400, 401, -1, + -1, -1, -1, -1, 339, -1, -1, -1, -1, 344, + 413, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, -1, -1, -1, -1, 429, -1, -1, -1, + -1, -1, -1, 368, -1, 370, -1, 372, -1, 374, + 375, 376, -1, -1, -1, -1, -1, -1, -1, 384, + 385, -1, -1, -1, 389, 390, -1, 256, -1, -1, + -1, -1, -1, 398, 399, 400, 401, -1, -1, -1, + -1, -1, 339, -1, -1, -1, -1, 344, 413, 346, + 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, + -1, -1, -1, -1, 429, -1, -1, -1, -1, -1, + -1, 368, -1, 370, -1, 372, -1, 374, 375, 376, + -1, -1, -1, -1, -1, -1, -1, 384, 385, -1, + -1, -1, 389, 390, -1, 256, -1, -1, -1, -1, + -1, 398, 399, 400, 401, -1, -1, -1, -1, -1, + 339, -1, -1, -1, -1, 344, 413, 346, 347, 348, + 349, 350, 351, 352, 353, 354, 355, 356, -1, -1, + -1, -1, 429, -1, -1, -1, -1, -1, -1, 368, + -1, 370, -1, 372, -1, 374, 375, 376, -1, -1, + -1, -1, -1, -1, -1, 384, 385, -1, -1, -1, + 389, 390, -1, 256, -1, -1, -1, -1, -1, -1, + -1, 400, 401, -1, -1, -1, -1, -1, 339, -1, + -1, -1, -1, 344, 413, 346, 347, 348, 349, 350, + 351, 352, 353, 354, 355, 356, -1, -1, -1, -1, + 429, -1, -1, -1, -1, -1, -1, 368, -1, 370, + -1, 372, -1, 374, 375, 376, -1, -1, -1, -1, + -1, -1, -1, 384, 385, -1, -1, -1, 389, 390, + -1, 256, -1, -1, -1, -1, -1, -1, -1, 400, + 401, -1, -1, -1, -1, -1, 339, -1, -1, -1, + -1, 344, 413, 346, 347, 348, 349, 350, 351, 352, + 353, 354, 355, 356, -1, -1, -1, -1, 429, -1, + -1, -1, -1, -1, -1, 368, -1, 370, -1, 372, + -1, 374, 375, 376, -1, -1, -1, -1, -1, -1, + -1, -1, 385, -1, -1, -1, 389, 390, -1, 256, + -1, -1, -1, -1, -1, -1, -1, 400, 401, -1, + -1, -1, -1, -1, 339, -1, -1, -1, -1, 344, + 413, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, -1, -1, -1, -1, 429, -1, -1, -1, + -1, -1, -1, 368, -1, 370, -1, 372, -1, 374, + 375, 376, -1, -1, -1, -1, -1, -1, -1, -1, + 385, -1, -1, -1, 389, 390, -1, 256, -1, -1, + -1, -1, -1, -1, -1, 400, 401, -1, -1, -1, + -1, -1, 339, -1, -1, -1, -1, 344, 413, 346, + 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, + -1, -1, -1, -1, 429, -1, -1, -1, -1, -1, + -1, 368, -1, 370, -1, 372, -1, 374, 375, 376, + -1, -1, -1, -1, -1, -1, -1, -1, 385, -1, + -1, -1, -1, 390, -1, 256, -1, -1, -1, -1, + -1, -1, -1, 400, 401, -1, -1, -1, -1, -1, + 339, -1, -1, -1, -1, 344, 413, 346, 347, 348, + 349, 350, 351, 352, 353, 354, 355, 356, -1, -1, + -1, -1, 429, -1, -1, -1, -1, -1, -1, 368, + -1, 370, -1, 372, -1, 374, 375, 376, -1, -1, + -1, -1, -1, -1, -1, -1, 385, -1, -1, -1, + -1, 390, -1, 256, -1, -1, -1, -1, -1, -1, + -1, 400, 401, -1, -1, -1, -1, -1, 339, -1, + -1, -1, -1, 344, 413, 346, 347, 348, 349, 350, + 351, 352, 353, 354, 355, 356, -1, -1, -1, -1, + 429, -1, -1, -1, -1, -1, -1, 368, -1, 370, + -1, 372, -1, 374, 375, 376, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 390, + -1, 256, -1, -1, -1, -1, -1, -1, -1, 400, + 401, -1, -1, -1, -1, -1, 339, -1, -1, -1, + -1, 344, 413, 346, 347, 348, 349, 350, 351, 352, + 353, 354, 355, 356, -1, -1, -1, -1, 429, -1, + -1, -1, -1, -1, -1, 368, -1, 370, -1, 372, + -1, 374, 375, 376, -1, -1, -1, 256, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 390, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 400, 401, -1, + -1, -1, -1, -1, 339, -1, -1, -1, -1, 344, + 413, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, -1, -1, -1, -1, 429, -1, -1, -1, + -1, -1, -1, 368, -1, 370, -1, 372, -1, 374, + 375, 376, -1, -1, -1, -1, 262, -1, -1, -1, + 266, -1, -1, -1, -1, 390, -1, -1, -1, -1, + 339, -1, -1, -1, -1, 344, 401, 346, 347, 348, + 349, 350, 351, 352, 353, 354, 355, 356, 413, -1, + -1, -1, 298, -1, -1, -1, -1, -1, -1, 368, + -1, 370, -1, 372, 429, 374, 375, 376, 314, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 390, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 401, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 413, -1, -1, -1, -1, -1, + -1, 357, -1, -1, -1, -1, -1, 363, -1, -1, + 429, -1, 368, 369, -1, 371, -1, 373, -1, 375, + 376, -1, 378, 379, -1, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, -1, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, -1, -1, + 256, -1, 418, -1, 420, -1, -1, 423, 264, 265, + 266, 267, -1, 429, 270, 271, -1, 273, 274, 275, + 276, 277, 278, 279, -1, -1, -1, -1, -1, 285, + -1, 287, 288, 289, 290, 291, 292, -1, -1, 295, + -1, -1, -1, 299, 300, -1, 302, 303, 304, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, + 316, -1, 318, 319, -1, -1, 322, -1, 324, 325, + 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, + -1, 337, -1, -1, 340, 341, -1, -1, 344, 345, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, + -1, 367, -1, -1, -1, 371, -1, -1, -1, -1, + 376, 377, 378, 379, 380, -1, -1, -1, 384, -1, + 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 256, -1, -1, + -1, 417, 418, 419, 420, 264, 265, 266, 267, -1, + -1, 270, 271, -1, 273, 274, 275, 276, 277, 278, + 279, -1, -1, -1, -1, -1, 285, -1, 287, 288, + 289, 290, 291, 292, -1, -1, 295, -1, -1, -1, + 299, 300, -1, 302, 303, 304, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 314, -1, 316, -1, 318, + 319, -1, -1, 322, -1, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, -1, 337, -1, + -1, 340, 341, -1, -1, 344, 345, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 359, 360, 361, 362, 363, -1, -1, -1, 367, -1, + -1, -1, 371, -1, -1, -1, -1, 376, 377, 378, + 379, 380, -1, -1, -1, 384, -1, 386, -1, -1, + -1, -1, -1, 392, 393, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 256, -1, -1, -1, 417, 418, + 419, 420, 264, 265, 266, 267, -1, -1, 270, 271, + -1, 273, 274, 275, 276, 277, 278, 279, -1, -1, + -1, -1, -1, 285, -1, 287, 288, 289, 290, 291, + 292, -1, -1, 295, -1, -1, -1, 299, 300, -1, + 302, 303, 304, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 314, -1, 316, -1, 318, 319, -1, -1, + 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 335, -1, 337, -1, -1, 340, 341, + -1, -1, 344, 345, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, + 362, 363, -1, -1, -1, 367, -1, -1, -1, 371, + -1, -1, -1, -1, 376, 377, 378, 379, 380, -1, + -1, -1, 384, -1, 386, -1, -1, -1, -1, -1, + 392, 393, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 256, -1, -1, -1, 417, 418, 419, 420, 264, + 265, 266, 267, -1, -1, 270, 271, -1, 273, 274, + 275, 276, 277, 278, 279, -1, -1, -1, -1, -1, + 285, -1, 287, 288, 289, 290, 291, 292, -1, -1, + 295, -1, -1, -1, 299, 300, -1, 302, 303, 304, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, + -1, 316, -1, 318, 319, -1, -1, 322, -1, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, -1, 337, -1, -1, 340, 341, -1, -1, 344, + 345, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, + -1, -1, 367, -1, -1, -1, 371, -1, -1, -1, + -1, 376, 377, 378, 379, 380, -1, -1, -1, 384, + -1, 386, -1, -1, -1, -1, -1, 392, 393, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 256, -1, + -1, -1, 417, 418, 419, 420, 264, 265, 266, 267, + -1, -1, 270, 271, -1, 273, 274, 275, 276, 277, + 278, 279, -1, -1, -1, -1, -1, 285, -1, 287, + 288, 289, 290, 291, 292, -1, -1, 295, -1, -1, + -1, 299, 300, -1, 302, 303, 304, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 314, -1, 316, -1, + 318, 319, -1, -1, 322, -1, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, 335, -1, 337, + -1, -1, 340, 341, -1, -1, 344, 345, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 359, 360, 361, 362, 363, -1, -1, -1, 367, + -1, -1, -1, 371, -1, -1, -1, -1, 376, 377, + 378, 379, 380, -1, -1, -1, 384, -1, 386, -1, + -1, -1, -1, -1, 392, 393, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 256, -1, -1, -1, 417, + 418, 419, 420, 264, 265, -1, 267, -1, -1, 270, + 271, -1, -1, -1, 275, 276, 277, -1, 279, -1, + -1, 265, -1, 267, 285, -1, 270, 288, -1, -1, + -1, 275, -1, -1, 295, 279, -1, -1, -1, 300, + -1, 302, 303, 304, 288, -1, -1, -1, -1, -1, + -1, 295, -1, -1, -1, 316, 300, 318, 319, -1, + 304, 322, -1, -1, 325, -1, 327, -1, 329, 330, + 331, 332, 316, 334, 318, -1, -1, -1, 322, -1, + 341, -1, -1, 344, 345, -1, 330, 331, -1, -1, + 334, -1, -1, 337, -1, -1, -1, -1, 359, 360, + 361, 362, 363, -1, -1, -1, 367, 368, -1, -1, + 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, + -1, -1, -1, 384, -1, 386, -1, -1, 372, -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, -1, -1, -1, 417, 418, 419, 420, - 264, 265, 266, 267, -1, -1, 270, 271, -1, 273, - 274, 275, 276, 277, 278, 279, -1, -1, -1, -1, - -1, 285, -1, 287, 288, 289, 290, 291, 292, -1, - -1, 295, -1, -1, -1, 299, 300, -1, 302, 303, - 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 314, -1, 316, -1, 318, 319, -1, -1, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 334, 335, -1, 337, -1, -1, 340, 341, -1, -1, - 344, 345, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 359, 360, 361, 362, 363, - -1, -1, -1, 367, -1, -1, -1, 371, -1, -1, - -1, -1, 376, 377, 378, 379, 380, -1, -1, -1, - 384, -1, 386, -1, -1, -1, -1, -1, 392, 393, + 264, 265, -1, 267, -1, -1, 270, 271, -1, -1, + -1, 275, 276, 277, 418, 279, -1, -1, 265, -1, + 267, 285, -1, 270, 288, -1, -1, -1, 275, -1, + -1, 295, 279, -1, -1, -1, 300, -1, 302, 303, + 304, 288, 306, -1, -1, -1, -1, -1, 295, 313, + -1, -1, 316, 300, 318, 319, -1, 304, 322, -1, + -1, 325, -1, 327, -1, 329, 330, 331, 332, 316, + 334, 318, -1, -1, -1, 322, -1, 341, -1, -1, + 344, 345, -1, 330, 331, -1, -1, 334, -1, -1, + 337, -1, -1, -1, -1, 359, 360, 361, 362, 363, + -1, -1, -1, -1, -1, -1, -1, 371, -1, -1, + -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, + 384, -1, 386, 370, -1, -1, -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, - -1, -1, -1, 417, 418, 419, 420, 264, 265, 266, - 267, -1, -1, 270, 271, -1, 273, 274, 275, 276, - 277, 278, 279, -1, -1, -1, -1, -1, 285, -1, - 287, 288, 289, 290, 291, 292, -1, -1, 295, -1, - -1, -1, 299, 300, -1, 302, 303, 304, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 314, -1, 316, - -1, 318, 319, -1, -1, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, 332, 333, 334, 335, -1, - 337, -1, -1, 340, 341, -1, -1, 344, 345, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 417, 418, 419, 420, 264, 265, -1, + 267, -1, -1, 270, 271, -1, -1, -1, 275, 276, + 277, 418, 279, -1, -1, 265, -1, 267, 285, -1, + 270, 288, -1, -1, -1, 275, -1, -1, 295, 279, + -1, -1, -1, 300, -1, 302, 303, 304, 288, -1, + -1, -1, -1, -1, -1, 295, -1, -1, -1, 316, + 300, 318, 319, 320, 304, 322, -1, -1, 325, -1, + 327, -1, 329, 330, 331, 332, 316, 334, 318, -1, + -1, -1, 322, -1, 341, -1, -1, 344, 345, -1, + 330, 331, -1, -1, 334, -1, -1, 337, -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, -1, - 367, -1, -1, -1, 371, -1, -1, -1, -1, 376, + 367, -1, -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, -1, + -1, -1, -1, 264, 265, -1, 267, -1, -1, 270, + 271, -1, -1, -1, 275, 276, 277, -1, 279, -1, + 417, 418, 419, 420, 285, -1, -1, 288, -1, -1, + -1, -1, -1, -1, 295, -1, -1, -1, 418, 300, + -1, 302, 303, 304, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 316, -1, 318, 319, -1, + -1, 322, -1, -1, 325, -1, 327, -1, 329, 330, + 331, 332, -1, 334, -1, -1, -1, -1, -1, -1, + 341, -1, -1, 344, 345, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, + 361, 362, 363, -1, -1, -1, 367, 368, -1, -1, + 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, + -1, -1, -1, 384, -1, 386, -1, -1, -1, -1, + -1, 392, 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 256, -1, -1, -1, - 417, 418, 419, 420, 264, 265, 266, 267, -1, -1, - 270, 271, -1, 273, 274, 275, 276, 277, 278, 279, - -1, -1, -1, -1, -1, 285, -1, 287, 288, 289, - 290, 291, 292, -1, -1, 295, -1, -1, -1, 299, - 300, -1, 302, 303, 304, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 314, -1, 316, -1, 318, 319, - -1, -1, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 334, 335, -1, 337, -1, -1, - 340, 341, -1, -1, 344, 345, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, - 360, 361, 362, 363, -1, -1, -1, 367, -1, -1, - -1, 371, -1, -1, -1, -1, 376, 377, 378, 379, - 380, -1, -1, -1, 384, -1, 386, -1, -1, -1, - -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 256, -1, -1, -1, 417, 418, 419, - 420, 264, 265, 266, 267, -1, -1, 270, 271, -1, - 273, 274, 275, 276, 277, 278, 279, -1, -1, -1, - -1, -1, 285, -1, 287, 288, 289, 290, 291, 292, - -1, -1, 295, -1, -1, -1, 299, 300, -1, 302, - 303, 304, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 314, -1, 316, -1, 318, 319, -1, -1, 322, - -1, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, -1, 337, -1, -1, 340, 341, -1, - -1, 344, 345, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, - 363, -1, -1, -1, 367, -1, -1, -1, 371, -1, - -1, -1, -1, 376, 377, 378, 379, 380, -1, -1, - -1, 384, -1, 386, -1, -1, -1, -1, -1, 392, - 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 256, -1, -1, -1, 417, 418, 419, 420, 264, 265, - -1, 267, -1, -1, 270, 271, -1, 256, -1, 275, - 276, 277, -1, 279, -1, -1, 265, -1, 267, 285, - -1, 270, 288, -1, -1, -1, 275, -1, -1, 295, - 279, -1, -1, -1, 300, -1, 302, 303, 304, 288, - -1, -1, -1, -1, -1, -1, 295, -1, -1, -1, - 316, 300, 318, 319, -1, 304, 322, -1, -1, 325, - -1, 327, -1, 329, 330, 331, 332, 316, 334, 318, - -1, -1, -1, 322, -1, 341, -1, -1, 344, 345, - -1, 330, 331, -1, -1, 334, -1, -1, 337, -1, - -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, - -1, 367, 368, -1, -1, 371, -1, -1, -1, -1, - -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, - 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 256, -1, -1, - -1, 417, 418, 419, 420, 264, 265, -1, 267, -1, - -1, 270, 271, -1, -1, -1, 275, 276, 277, 418, - 279, -1, -1, 265, -1, 267, 285, -1, 270, 288, - -1, -1, -1, 275, -1, -1, 295, 279, -1, -1, - -1, 300, -1, 302, 303, 304, 288, 306, -1, -1, - -1, -1, -1, 295, 313, -1, -1, 316, 300, 318, - 319, -1, 304, 322, -1, -1, 325, -1, 327, -1, - 329, 330, 331, 332, 316, 334, 318, -1, -1, -1, - 322, -1, 341, -1, -1, 344, 345, -1, 330, 331, - -1, -1, 334, -1, -1, 337, -1, -1, -1, -1, - 359, 360, 361, 362, 363, -1, -1, -1, -1, -1, - -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, - 379, 380, -1, -1, -1, 384, -1, 386, -1, -1, - 372, -1, -1, 392, 393, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 256, -1, -1, -1, 417, 418, - 419, 420, 264, 265, -1, 267, -1, -1, 270, 271, - -1, -1, -1, 275, 276, 277, 418, 279, -1, -1, + -1, -1, -1, -1, 256, -1, 417, 418, 419, 420, + -1, -1, 264, 265, -1, 267, -1, 428, 270, 271, + -1, -1, -1, 275, 276, 277, -1, 279, -1, -1, 265, -1, 267, 285, -1, 270, 288, -1, -1, -1, 275, -1, -1, 295, 279, -1, -1, -1, 300, -1, 302, 303, 304, 288, -1, -1, -1, -1, -1, -1, @@ -12195,7 +12274,7 @@ void case_980() -1, -1, 337, -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, -1, 367, -1, -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, -1, - -1, -1, 384, -1, 386, 370, -1, -1, -1, -1, + -1, -1, 384, -1, 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, 264, 265, -1, 267, -1, -1, 270, 271, -1, -1, -1, 275, 276, 277, -1, 279, -1, 417, 418, 419, 420, 285, @@ -12207,7 +12286,7 @@ void case_980() -1, -1, -1, -1, -1, 341, -1, -1, 344, 345, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, - -1, 367, 368, -1, -1, 371, -1, -1, -1, -1, + -1, 367, -1, -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -12218,7 +12297,7 @@ void case_980() 270, 288, -1, -1, -1, 275, -1, -1, 295, 279, -1, -1, -1, 300, -1, 302, 303, 304, 288, -1, -1, -1, -1, -1, -1, 295, -1, -1, -1, 316, - 300, 318, 319, 320, 304, 322, -1, -1, 325, -1, + 300, 318, 319, -1, 304, 322, -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, 316, 334, 318, -1, -1, -1, 322, -1, 341, -1, -1, 344, 345, -1, 330, 331, -1, -1, 334, -1, -1, 337, -1, -1, @@ -12226,24 +12305,73 @@ void case_980() 367, -1, -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, -1, - -1, -1, -1, 264, 265, -1, 267, -1, -1, 270, - 271, -1, -1, -1, 275, 276, 277, -1, 279, -1, - 417, 418, 419, 420, 285, -1, -1, 288, -1, -1, - -1, -1, -1, -1, 295, -1, -1, -1, 418, 300, - -1, 302, 303, 304, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 316, -1, 318, 319, -1, - -1, 322, -1, -1, 325, -1, 327, -1, 329, 330, - 331, 332, -1, 334, -1, -1, -1, -1, -1, -1, - 341, -1, -1, 344, 345, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, - 361, 362, 363, -1, -1, -1, 367, -1, -1, -1, - 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, - -1, -1, -1, 384, -1, 386, -1, -1, -1, -1, - -1, 392, 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 256, -1, 417, 418, 419, 420, - -1, -1, 264, 265, -1, 267, -1, 428, 270, 271, - -1, -1, -1, 275, 276, 277, -1, 279, -1, -1, + -1, -1, -1, -1, -1, -1, 256, -1, -1, -1, + 417, 418, 419, 420, 264, 265, -1, 267, -1, -1, + 270, 271, -1, -1, -1, 275, 276, 277, 418, 279, + -1, -1, 265, -1, 267, 285, -1, 270, 288, -1, + -1, -1, 275, -1, -1, 295, 279, -1, -1, -1, + 300, -1, 302, 303, 304, 288, -1, -1, -1, -1, + -1, -1, 295, -1, -1, -1, 316, 300, 318, 319, + -1, 304, 322, -1, -1, 325, -1, 327, -1, 329, + 330, 331, 332, 316, 334, 318, -1, -1, -1, 322, + -1, 341, -1, -1, 344, 345, -1, 330, 331, -1, + -1, 334, -1, -1, 337, -1, -1, -1, -1, 359, + 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, + -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, + 380, -1, -1, -1, 384, -1, 386, -1, -1, -1, + -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 256, -1, -1, -1, 417, 418, 419, + 420, 264, 265, -1, 267, -1, -1, 270, 271, -1, + -1, -1, 275, 276, 277, 418, 279, -1, -1, 265, + -1, 267, 285, -1, 270, 288, -1, -1, -1, 275, + -1, -1, 295, 279, -1, -1, -1, 300, -1, 302, + 303, 304, 288, -1, -1, -1, -1, -1, -1, 295, + -1, -1, -1, 316, 300, 318, 319, -1, 304, 322, + -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, + 316, 334, 318, -1, -1, -1, 322, -1, 341, -1, + -1, 344, 345, -1, 330, 331, -1, -1, 334, -1, + -1, 337, -1, -1, -1, -1, 359, 360, 361, 362, + 363, -1, -1, -1, -1, -1, -1, -1, 371, -1, + -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, + -1, 384, -1, 386, -1, -1, -1, -1, -1, 392, + 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 256, -1, -1, -1, 417, 418, 419, 420, 264, 265, + -1, 267, -1, -1, 270, 271, -1, -1, -1, 275, + 276, 277, 418, 279, -1, -1, 265, -1, 267, 285, + -1, 270, 288, -1, -1, -1, 275, -1, -1, 295, + 279, -1, -1, -1, 300, -1, 302, 303, 304, 288, + -1, -1, -1, -1, -1, -1, 295, -1, -1, -1, + 316, 300, 318, 319, -1, 304, 322, -1, -1, 325, + -1, 327, -1, 329, 330, 331, 332, 316, 334, 318, + -1, -1, -1, 322, -1, 341, -1, -1, 344, 345, + -1, 330, 331, -1, -1, 334, -1, -1, 337, -1, + -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, + -1, -1, -1, -1, -1, 371, -1, -1, -1, -1, + -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, + 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 256, -1, -1, + -1, 417, 418, 419, 420, 264, 265, -1, 267, -1, + -1, 270, 271, -1, -1, -1, 275, 276, 277, 418, + 279, -1, -1, 265, -1, 267, 285, -1, 270, 288, + -1, -1, -1, 275, -1, -1, 295, 279, -1, -1, + -1, 300, -1, 302, 303, 304, 288, -1, -1, -1, + -1, -1, -1, 295, -1, -1, -1, 316, 300, 318, + 319, -1, 304, 322, -1, -1, 325, -1, 327, -1, + 329, 330, 331, 332, 316, 334, 318, -1, -1, -1, + 322, -1, 341, -1, -1, 344, 345, -1, 330, 331, + -1, -1, 334, -1, -1, 337, -1, -1, -1, -1, + 359, 360, 361, 362, 363, -1, -1, -1, -1, -1, + -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, + 379, 380, -1, -1, -1, 384, -1, 386, -1, -1, + -1, -1, -1, 392, 393, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 256, -1, -1, -1, 417, 418, + 419, 420, 264, 265, -1, 267, -1, -1, 270, 271, + -1, -1, -1, 275, 276, 277, 418, 279, -1, -1, 265, -1, 267, 285, -1, 270, 288, -1, -1, -1, 275, -1, -1, 295, 279, -1, -1, -1, 300, -1, 302, 303, 304, 288, -1, -1, -1, -1, -1, -1, @@ -12252,21 +12380,21 @@ void case_980() 332, 316, 334, 318, -1, -1, -1, 322, -1, 341, -1, -1, 344, 345, -1, 330, 331, -1, -1, 334, -1, -1, 337, -1, -1, -1, -1, 359, 360, 361, - 362, 363, -1, -1, -1, 367, -1, -1, -1, 371, + 362, 363, -1, -1, -1, -1, -1, -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, 386, -1, -1, -1, -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, -1, -1, -1, 417, 418, 419, 420, 264, 265, -1, 267, -1, -1, 270, 271, -1, -1, -1, - 275, 276, 277, 418, 279, -1, -1, 265, -1, 267, - 285, -1, 270, 288, -1, -1, -1, 275, -1, -1, - 295, 279, -1, -1, -1, 300, -1, 302, 303, 304, - 288, -1, -1, -1, -1, -1, -1, 295, -1, -1, - -1, 316, 300, 318, 319, -1, 304, 322, -1, -1, - 325, -1, 327, -1, 329, 330, 331, 332, 316, 334, - 318, -1, -1, -1, 322, -1, 341, -1, -1, 344, - 345, -1, 330, 331, -1, -1, 334, -1, -1, 337, + 275, 276, 277, 418, 279, -1, -1, -1, -1, -1, + 285, -1, -1, 288, -1, -1, -1, -1, -1, -1, + 295, -1, -1, -1, -1, 300, -1, 302, 303, 304, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 316, -1, 318, 319, -1, -1, 322, -1, -1, + 325, -1, 327, -1, 329, 330, 331, 332, -1, 334, + -1, -1, -1, -1, -1, -1, 341, -1, -1, 344, + 345, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, @@ -12275,114 +12403,40 @@ void case_980() -1, -1, -1, -1, -1, -1, -1, -1, 256, -1, -1, -1, 417, 418, 419, 420, 264, 265, -1, 267, -1, -1, 270, 271, -1, -1, -1, 275, 276, 277, - 418, 279, -1, -1, 265, -1, 267, 285, -1, 270, - 288, -1, -1, -1, 275, -1, -1, 295, 279, -1, - -1, -1, 300, -1, 302, 303, 304, 288, -1, -1, - -1, -1, -1, -1, 295, -1, -1, -1, 316, 300, - 318, 319, -1, 304, 322, -1, -1, 325, -1, 327, - -1, 329, 330, 331, 332, 316, 334, 318, -1, -1, - -1, 322, -1, 341, -1, -1, 344, 345, -1, 330, - 331, -1, -1, 334, -1, -1, 337, -1, -1, -1, - -1, 359, 360, 361, 362, 363, -1, -1, -1, -1, - -1, -1, -1, 371, -1, -1, -1, -1, -1, 377, - 378, 379, 380, -1, -1, -1, 384, -1, 386, -1, - -1, -1, -1, -1, 392, 393, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 256, -1, -1, -1, 417, - 418, 419, 420, 264, 265, -1, 267, -1, -1, 270, - 271, -1, -1, -1, 275, 276, 277, 418, 279, -1, - -1, 265, -1, 267, 285, -1, 270, 288, -1, -1, - -1, 275, -1, -1, 295, 279, -1, -1, -1, 300, - -1, 302, 303, 304, 288, -1, -1, -1, -1, -1, - -1, 295, -1, -1, -1, 316, 300, 318, 319, -1, - 304, 322, -1, -1, 325, -1, 327, -1, 329, 330, - 331, 332, 316, 334, 318, -1, -1, -1, 322, -1, - 341, -1, -1, 344, 345, -1, 330, 331, -1, -1, - 334, -1, -1, 337, -1, -1, -1, -1, 359, 360, - 361, 362, 363, -1, -1, -1, -1, -1, -1, -1, - 371, -1, -1, -1, -1, -1, 377, 378, 379, 380, - -1, -1, -1, 384, -1, 386, -1, -1, -1, -1, - -1, 392, 393, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 256, -1, -1, -1, 417, 418, 419, 420, - 264, 265, -1, 267, -1, -1, 270, 271, -1, -1, - -1, 275, 276, 277, 418, 279, -1, -1, 265, -1, - 267, 285, -1, 270, 288, -1, -1, -1, 275, -1, - -1, 295, 279, -1, -1, -1, 300, -1, 302, 303, - 304, 288, -1, -1, -1, -1, -1, -1, 295, -1, - -1, -1, 316, 300, 318, 319, -1, 304, 322, -1, - -1, 325, -1, 327, -1, 329, 330, 331, 332, 316, - 334, 318, -1, -1, -1, 322, -1, 341, -1, -1, - 344, 345, -1, 330, 331, -1, -1, 334, -1, -1, - 337, -1, -1, -1, -1, 359, 360, 361, 362, 363, - -1, -1, -1, -1, -1, -1, -1, 371, -1, -1, - -1, -1, -1, 377, 378, 379, 380, -1, -1, -1, - 384, -1, 386, -1, -1, -1, -1, -1, 392, 393, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, - -1, -1, -1, 417, 418, 419, 420, 264, 265, -1, - 267, -1, -1, 270, 271, -1, -1, -1, 275, 276, - 277, 418, 279, -1, -1, 265, -1, 267, 285, -1, - 270, 288, -1, -1, -1, 275, -1, -1, 295, 279, - -1, -1, -1, 300, -1, 302, 303, 304, 288, -1, - -1, -1, -1, -1, -1, 295, -1, -1, -1, 316, - 300, 318, 319, -1, 304, 322, -1, -1, 325, -1, - 327, -1, 329, 330, 331, 332, 316, 334, 318, -1, - -1, -1, 322, -1, 341, -1, -1, 344, 345, -1, - 330, 331, -1, -1, 334, -1, -1, 337, -1, -1, - -1, -1, 359, 360, 361, 362, 363, -1, -1, -1, - -1, -1, -1, -1, 371, -1, -1, -1, -1, -1, - 377, 378, 379, 380, -1, -1, -1, 384, -1, 386, - -1, -1, -1, -1, -1, 392, 393, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 256, -1, -1, -1, - 417, 418, 419, 420, 264, 265, -1, 267, -1, -1, - 270, 271, -1, -1, -1, 275, 276, 277, 418, 279, - -1, -1, -1, -1, -1, 285, -1, -1, 288, -1, - -1, -1, -1, -1, -1, 295, -1, -1, -1, -1, - 300, -1, 302, 303, 304, -1, -1, -1, -1, -1, - -1, -1, 262, -1, -1, -1, 316, -1, 318, 319, - -1, -1, 322, -1, -1, 325, -1, 327, -1, 329, - 330, 331, 332, -1, 334, -1, -1, -1, -1, -1, - -1, 341, -1, -1, 344, 345, -1, -1, 298, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, - 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, - -1, 371, -1, -1, -1, -1, -1, 377, 378, 379, - 380, -1, -1, -1, 384, -1, 386, -1, -1, -1, - -1, -1, 392, 393, -1, -1, -1, -1, -1, -1, + -1, 279, -1, -1, -1, -1, -1, 285, -1, -1, + 288, -1, -1, -1, 261, -1, -1, 295, -1, -1, + -1, 262, 300, -1, 302, 303, 304, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 284, 316, -1, + 318, 319, -1, -1, 322, -1, -1, 325, -1, 327, + 297, 329, 330, 331, 332, 302, 334, 298, -1, -1, + 307, -1, 309, 310, 311, 312, -1, -1, 315, -1, + 317, -1, -1, -1, 321, -1, -1, -1, -1, -1, + -1, 359, 360, 361, 362, -1, 333, -1, -1, 336, + -1, 338, -1, 371, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 417, 418, 419, - 420, 371, 372, 373, 374, 375, -1, -1, 378, 379, - -1, -1, 382, 383, 384, 385, 386, 387, 388, 389, - 390, -1, 392, 393, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, 412, 413, -1, 261, -1, 263, -1, 265, - 420, 267, -1, 423, 270, -1, 272, 273, -1, 275, - -1, 277, -1, 279, -1, 281, 282, 283, 284, -1, - -1, 287, 288, -1, -1, -1, -1, 293, 294, 295, - 296, 297, -1, -1, 300, -1, 302, -1, 304, -1, - 306, 307, -1, 309, 310, 311, 312, -1, -1, 315, - 316, 317, 318, -1, -1, 321, 322, 323, -1, -1, - -1, -1, -1, -1, 330, 331, -1, 333, 334, -1, - 336, 337, 338, -1, -1, -1, 342, -1, -1, -1, + -1, -1, -1, -1, -1, 362, -1, -1, -1, -1, + -1, 368, 369, -1, -1, -1, -1, -1, -1, -1, + 371, 372, 373, 374, 375, -1, -1, 378, 379, 417, + 418, 382, 383, 384, 385, 386, 387, 388, 389, 390, + -1, 392, 393, 394, 395, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, + 411, 412, 413, -1, 261, -1, 263, -1, 265, 420, + 267, -1, 423, 270, -1, 272, 273, -1, 275, -1, + 277, -1, 279, -1, 281, 282, 283, 284, -1, -1, + 287, 288, -1, -1, -1, -1, 293, 294, 295, 296, + 297, -1, -1, 300, -1, 302, -1, 304, -1, 306, + 307, -1, 309, 310, 311, 312, -1, -1, 315, 316, + 317, 318, -1, -1, 321, 322, 323, -1, -1, -1, + -1, -1, -1, 330, 331, -1, 333, 334, -1, 336, + 337, 338, -1, -1, -1, 342, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 362, -1, 364, 365, - 261, -1, -1, -1, 265, -1, 267, -1, -1, 270, - -1, 272, 273, -1, 275, -1, 277, -1, 279, -1, - 281, 282, 283, 284, -1, -1, 287, 288, -1, -1, - -1, -1, 293, -1, 295, 296, 297, -1, -1, 300, - -1, 302, -1, 304, -1, -1, 307, -1, 309, 310, - 311, 312, 418, -1, -1, 316, 317, 318, -1, -1, - 321, 322, 323, -1, -1, -1, -1, -1, -1, 330, - 331, -1, 333, 334, -1, 336, 337, 338, -1, -1, - -1, 342, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 261, - -1, 362, -1, 265, -1, 267, -1, 368, 270, -1, - 272, 273, -1, 275, -1, 277, 377, 279, -1, 281, + -1, -1, -1, -1, -1, 362, -1, 364, 365, 261, + -1, -1, -1, 265, -1, 267, -1, -1, 270, -1, + 272, 273, -1, 275, -1, 277, -1, 279, -1, 281, 282, 283, 284, -1, -1, 287, 288, -1, -1, -1, -1, 293, -1, 295, 296, 297, -1, -1, 300, -1, 302, -1, 304, -1, -1, 307, -1, 309, 310, 311, - 312, -1, -1, -1, 316, 317, 318, 418, -1, 321, + 312, 418, -1, -1, 316, 317, 318, -1, -1, 321, 322, 323, -1, -1, -1, -1, -1, -1, 330, 331, -1, 333, 334, -1, 336, 337, 338, -1, -1, -1, 342, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -12395,46 +12449,51 @@ void case_980() -1, -1, -1, 316, 317, 318, 418, -1, 321, 322, 323, -1, -1, -1, -1, -1, -1, 330, 331, -1, 333, 334, -1, 336, 337, 338, -1, -1, -1, 342, - -1, -1, -1, -1, 261, -1, -1, -1, 265, -1, - 267, -1, -1, 270, -1, 272, 273, -1, 275, 362, - 277, -1, 279, -1, 281, 282, 283, 284, -1, -1, - 287, 288, -1, -1, 377, -1, 293, -1, 295, 296, - 297, -1, -1, 300, -1, 302, -1, 304, -1, -1, - 307, -1, 309, 310, 311, 312, -1, -1, -1, 316, - 317, 318, -1, -1, 321, 322, 323, -1, -1, -1, - -1, -1, -1, 330, 331, 418, 333, 334, -1, 336, - 337, 338, -1, -1, -1, 342, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 261, -1, - -1, -1, 265, -1, 267, 362, -1, 270, -1, 272, - 273, 368, 275, -1, 277, -1, 279, -1, 281, 282, - 283, 284, -1, -1, 287, 288, -1, -1, -1, -1, - 293, -1, 295, 296, 297, -1, -1, 300, -1, 302, - 261, 304, -1, -1, 307, -1, 309, 310, 311, 312, - -1, -1, -1, 316, 317, 318, -1, -1, 321, 322, - 323, 418, -1, 284, -1, -1, -1, 330, 331, -1, - 333, 334, -1, 336, 337, 338, 297, -1, -1, 342, - -1, 302, -1, -1, 305, -1, 307, -1, 309, 310, - 311, 312, -1, -1, -1, -1, 317, -1, -1, 362, - 321, -1, -1, -1, 325, 368, -1, -1, 261, -1, - -1, -1, 333, -1, -1, 336, -1, 338, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 284, -1, -1, -1, -1, 357, -1, 261, -1, - -1, 362, -1, -1, 297, -1, -1, -1, 369, 302, - 371, -1, 373, -1, 307, 418, 309, 310, 311, 312, - -1, 284, -1, -1, 317, 386, -1, -1, 321, -1, - -1, -1, 325, -1, 297, -1, -1, -1, -1, 302, - 333, -1, -1, 336, 307, 338, 309, 310, 311, 312, - -1, -1, -1, -1, 317, -1, -1, 418, 321, -1, - -1, -1, -1, -1, -1, 264, 265, -1, 267, 362, - 333, 270, 271, 336, -1, 338, 275, 276, 277, -1, - 279, -1, -1, -1, -1, -1, 285, -1, -1, 288, - -1, -1, -1, -1, -1, -1, 295, -1, -1, 362, - -1, 300, -1, 302, 303, 304, -1, 306, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 261, -1, 362, + -1, 265, -1, 267, -1, 368, 270, -1, 272, 273, + -1, 275, -1, 277, 377, 279, -1, 281, 282, 283, + 284, -1, -1, 287, 288, -1, -1, -1, -1, 293, + -1, 295, 296, 297, -1, -1, 300, -1, 302, -1, + 304, -1, -1, 307, -1, 309, 310, 311, 312, -1, + -1, -1, 316, 317, 318, 418, -1, 321, 322, 323, + -1, -1, -1, -1, -1, -1, 330, 331, -1, 333, + 334, -1, 336, 337, 338, -1, -1, -1, 342, -1, + -1, -1, -1, 261, -1, -1, -1, 265, -1, 267, + -1, -1, 270, -1, 272, 273, -1, 275, 362, 277, + -1, 279, -1, 281, 282, 283, 284, -1, -1, 287, + 288, -1, -1, 377, -1, 293, -1, 295, 296, 297, + -1, -1, 300, -1, 302, -1, 304, -1, -1, 307, + -1, 309, 310, 311, 312, -1, -1, -1, 316, 317, + 318, -1, -1, 321, 322, 323, -1, -1, -1, -1, + -1, -1, 330, 331, 418, 333, 334, -1, 336, 337, + 338, -1, -1, -1, 342, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 261, -1, -1, + -1, 265, -1, 267, 362, -1, 270, -1, 272, 273, + 368, 275, -1, 277, -1, 279, -1, 281, 282, 283, + 284, -1, -1, 287, 288, -1, -1, -1, -1, 293, + -1, 295, 296, 297, -1, -1, 300, -1, 302, 261, + 304, -1, -1, 307, -1, 309, 310, 311, 312, -1, + -1, -1, 316, 317, 318, -1, -1, 321, 322, 323, + 418, -1, 284, -1, -1, -1, 330, 331, -1, 333, + 334, 261, 336, 337, 338, 297, -1, -1, 342, -1, + 302, -1, -1, 305, -1, 307, -1, 309, 310, 311, + 312, -1, -1, -1, 284, 317, -1, -1, 362, 321, + -1, -1, -1, 325, 368, -1, -1, 297, -1, -1, + -1, 333, 302, -1, 336, -1, 338, 307, -1, 309, + 310, 311, 312, -1, -1, -1, -1, 317, -1, -1, + -1, 321, -1, -1, -1, 357, -1, -1, -1, -1, + 362, -1, -1, 333, -1, -1, 336, 369, 338, 371, + -1, 373, -1, -1, 418, 264, 265, -1, 267, -1, + -1, 270, 271, -1, 386, -1, 275, 276, 277, -1, + 279, -1, 362, -1, -1, -1, 285, -1, -1, 288, + -1, -1, -1, -1, -1, -1, 295, -1, -1, -1, + -1, 300, -1, 302, 303, 304, 418, 306, -1, -1, -1, -1, -1, -1, 313, -1, -1, 316, -1, 318, - 319, -1, -1, 322, -1, 418, 325, -1, 327, -1, - 329, 330, 331, 332, -1, 334, -1, -1, -1, -1, + 319, -1, -1, 322, -1, -1, 325, -1, 327, -1, + 329, 330, 331, 332, -1, 334, -1, -1, 418, -1, -1, -1, 341, -1, -1, 344, 345, -1, -1, -1, - -1, -1, -1, -1, -1, 418, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, 360, 361, 362, 363, -1, -1, -1, -1, -1, -1, -1, 371, 372, -1, 374, -1, -1, 377, 378, 379, 380, -1, -1, -1, 384, -1, 386, -1, -1, @@ -12578,12 +12637,12 @@ void case_980() -1, 264, 265, -1, 267, -1, -1, 270, 271, -1, -1, -1, 275, 276, 277, -1, 279, -1, 417, 418, 419, 420, 285, -1, -1, 288, -1, -1, -1, -1, - -1, -1, 295, -1, 261, -1, -1, 300, -1, 302, + -1, -1, 295, -1, 261, -1, 263, 300, -1, 302, 303, 304, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 316, -1, 318, 319, 284, -1, 322, -1, -1, 325, -1, 327, -1, 329, 330, 331, 332, 297, 334, -1, -1, -1, 302, -1, -1, -1, -1, - 307, -1, 309, 310, 311, 312, -1, -1, 315, -1, + 307, -1, 309, 310, 311, 312, -1, -1, -1, -1, 317, -1, -1, -1, 321, -1, 359, 360, 361, 362, 363, -1, -1, -1, -1, -1, 333, -1, 371, 336, -1, 338, -1, -1, 377, 378, 379, 380, -1, -1, @@ -12652,74 +12711,66 @@ void case_980() 313, -1, 270, 316, -1, 318, -1, 275, -1, 322, -1, 279, 325, -1, -1, 283, -1, 330, 331, -1, 288, 334, -1, -1, 337, 293, -1, 295, -1, 418, - -1, -1, 300, -1, -1, -1, 304, 305, -1, -1, - -1, 265, -1, 267, -1, -1, 270, -1, 316, -1, - 318, 275, -1, -1, 322, 279, -1, -1, -1, -1, - -1, 418, 330, 331, 288, 265, 334, 267, -1, -1, - 270, 295, -1, -1, -1, 275, 300, -1, -1, 279, - 304, -1, -1, -1, -1, -1, -1, -1, 288, -1, - -1, -1, 316, -1, 318, 295, -1, -1, 322, -1, - 300, -1, -1, -1, 304, 418, 330, 331, -1, -1, - 334, -1, 261, 337, -1, -1, 316, -1, 318, -1, - -1, -1, 322, 272, -1, -1, -1, -1, 277, -1, - 330, 331, 281, -1, 334, 284, -1, 337, -1, 363, - -1, -1, -1, -1, -1, -1, -1, 296, 297, -1, - 418, -1, 301, 302, -1, 261, -1, -1, 307, -1, - 309, 310, 311, 312, -1, -1, 272, -1, 317, -1, - -1, 277, 321, -1, 323, 281, -1, -1, 284, -1, - -1, -1, -1, -1, 333, -1, 335, 336, -1, 338, - 296, 297, -1, 342, 418, 301, 302, -1, 261, -1, - 263, 307, -1, 309, 310, 311, 312, -1, -1, -1, - -1, 317, -1, 362, -1, 321, -1, 323, 418, 368, - 369, 284, -1, -1, -1, -1, -1, 333, -1, -1, - 336, -1, 338, -1, 297, -1, 342, -1, -1, 302, - -1, 261, -1, -1, 307, -1, 309, 310, 311, 312, - -1, -1, 272, -1, 317, -1, 362, 277, 321, -1, - -1, 281, 368, 369, 284, -1, -1, -1, -1, -1, - 333, -1, -1, 336, -1, 338, 296, 297, -1, -1, - -1, 301, 302, -1, 261, -1, -1, 307, -1, 309, - 310, 311, 312, -1, -1, 272, -1, 317, -1, 362, - 277, 321, -1, 323, 281, 368, 369, 284, -1, -1, + -1, -1, 300, -1, -1, 261, 304, 305, -1, -1, + -1, -1, -1, -1, -1, -1, 272, -1, 316, -1, + 318, 277, -1, -1, 322, 281, -1, -1, 284, -1, + -1, 418, 330, 331, -1, -1, 334, -1, -1, -1, + 296, 297, -1, -1, -1, 301, 302, -1, -1, -1, + -1, 307, -1, 309, 310, 311, 312, -1, -1, -1, + -1, 317, -1, -1, -1, 321, -1, 323, -1, -1, + -1, -1, -1, -1, -1, 418, -1, 333, -1, 335, + 336, 261, 338, -1, -1, -1, 342, -1, -1, -1, + -1, -1, 272, -1, -1, -1, -1, 277, -1, -1, + -1, 281, -1, -1, 284, -1, 362, -1, -1, -1, + -1, -1, 368, 369, -1, -1, 296, 297, -1, -1, + 418, 301, 302, -1, 261, -1, -1, 307, -1, 309, + 310, 311, 312, -1, -1, 272, -1, 317, -1, -1, + 277, 321, -1, 323, 281, -1, -1, 284, -1, -1, -1, -1, -1, 333, -1, -1, 336, -1, 338, 296, - 297, -1, 342, -1, 301, 302, 261, -1, -1, -1, - 307, -1, 309, 310, 311, 312, -1, -1, -1, -1, - 317, -1, 362, -1, 321, -1, 323, -1, 368, 284, - -1, -1, -1, -1, -1, -1, 333, -1, -1, 336, - -1, 338, 297, -1, 261, 342, -1, 302, -1, -1, - -1, -1, 307, -1, 309, 310, 311, 312, -1, -1, - -1, -1, 317, -1, -1, 362, 321, 284, -1, -1, - -1, 368, -1, -1, -1, -1, -1, -1, 333, -1, - 297, 336, 261, 338, -1, 302, -1, -1, -1, -1, - 307, -1, 309, 310, 311, 312, -1, -1, -1, -1, - 317, -1, -1, -1, 321, 284, -1, 362, -1, 364, - 365, -1, -1, 368, -1, -1, 333, -1, 297, 336, - 261, 338, 263, 302, -1, -1, -1, -1, 307, -1, - 309, 310, 311, 312, -1, -1, 315, -1, 317, -1, - -1, -1, 321, 284, -1, 362, -1, 364, 365, -1, - -1, 368, -1, -1, 333, -1, 297, 336, 261, 338, - -1, 302, -1, -1, -1, -1, 307, -1, 309, 310, - 311, 312, -1, -1, -1, -1, 317, -1, -1, -1, - 321, 284, -1, 362, -1, -1, -1, -1, 261, 368, - 263, -1, 333, -1, 297, 336, -1, 338, -1, 302, - -1, -1, -1, -1, 307, -1, 309, 310, 311, 312, - -1, 284, -1, -1, 317, -1, -1, -1, 321, -1, - -1, 362, -1, -1, 297, -1, -1, 368, 261, 302, - 333, -1, -1, 336, 307, 338, 309, 310, 311, 312, - -1, -1, 315, -1, 317, -1, -1, -1, 321, -1, - -1, 284, -1, -1, -1, -1, -1, -1, 261, 362, - 333, 364, 365, 336, 297, 338, -1, -1, 301, 302, - -1, -1, -1, -1, 307, -1, 309, 310, 311, 312, - -1, 284, -1, -1, 317, -1, -1, -1, 321, 362, - -1, -1, -1, -1, 297, -1, -1, -1, -1, 302, - 333, -1, -1, 336, 307, 338, 309, 310, 311, 312, - -1, -1, -1, -1, 317, -1, -1, -1, 321, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 362, - 333, -1, -1, 336, -1, 338, -1, -1, -1, -1, + 297, -1, 342, -1, 301, 302, -1, 261, -1, -1, + 307, -1, 309, 310, 311, 312, -1, -1, 272, -1, + 317, -1, 362, 277, 321, -1, 323, 281, 368, 369, + 284, -1, -1, -1, -1, -1, 333, -1, -1, 336, + -1, 338, 296, 297, -1, 342, -1, 301, 302, 261, + -1, -1, -1, 307, -1, 309, 310, 311, 312, -1, + -1, -1, -1, 317, -1, 362, -1, 321, -1, 323, + -1, 368, 284, -1, -1, -1, -1, -1, -1, 333, + -1, -1, 336, -1, 338, 297, -1, 261, 342, -1, + 302, -1, -1, -1, -1, 307, -1, 309, 310, 311, + 312, -1, -1, -1, -1, 317, -1, -1, 362, 321, + 284, -1, -1, -1, 368, -1, -1, -1, -1, -1, + -1, 333, -1, 297, 336, 261, 338, -1, 302, -1, + -1, -1, -1, 307, -1, 309, 310, 311, 312, -1, + -1, -1, -1, 317, -1, -1, -1, 321, 284, -1, + 362, -1, 364, 365, -1, -1, 368, -1, -1, 333, + -1, 297, 336, 261, 338, 263, 302, -1, -1, -1, + -1, 307, -1, 309, 310, 311, 312, -1, -1, 315, + -1, 317, -1, -1, -1, 321, 284, -1, 362, -1, + 364, 365, -1, -1, 368, -1, -1, 333, -1, 297, + 336, 261, 338, -1, 302, -1, -1, -1, -1, 307, + -1, 309, 310, 311, 312, -1, -1, -1, -1, 317, + -1, -1, -1, 321, 284, -1, 362, -1, -1, -1, + -1, 261, 368, 263, -1, 333, -1, 297, 336, -1, + 338, -1, 302, -1, -1, -1, -1, 307, -1, 309, + 310, 311, 312, -1, 284, -1, -1, 317, -1, -1, + -1, 321, -1, -1, 362, -1, -1, 297, -1, -1, + 368, 261, 302, 333, -1, -1, 336, 307, 338, 309, + 310, 311, 312, -1, -1, 315, -1, 317, -1, -1, + -1, 321, -1, -1, 284, -1, -1, -1, -1, -1, + -1, 261, 362, 333, 364, 365, 336, 297, 338, -1, + -1, 301, 302, -1, -1, -1, -1, 307, -1, 309, + 310, 311, 312, -1, 284, -1, -1, 317, -1, -1, + -1, 321, 362, -1, -1, -1, -1, 297, -1, -1, + -1, -1, 302, 333, -1, -1, 336, 307, 338, 309, + 310, 311, 312, -1, -1, -1, -1, 317, -1, -1, + -1, 321, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 362, 333, -1, -1, 336, -1, 338, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 362, + -1, -1, 362, }; -#line 6618 "cs-parser.jay" +#line 6654 "cs-parser.jay" // // A class used to hold info about an operator declarator @@ -12874,17 +12925,12 @@ public Tokenizer Lexer { } } -static CSharpParser () -{ - oob_stack = new Stack (); -} - -public CSharpParser (SeekableStreamReader reader, CompilationSourceFile file) - : this (reader, file, file.Compiler.Report) +public CSharpParser (SeekableStreamReader reader, CompilationSourceFile file, ParserSession session) + : this (reader, file, file.Compiler.Report, session) { } -public CSharpParser (SeekableStreamReader reader, CompilationSourceFile file, Report report) +public CSharpParser (SeekableStreamReader reader, CompilationSourceFile file, Report report, ParserSession session) { this.file = file; current_container = current_namespace = file; @@ -12897,22 +12943,16 @@ public CSharpParser (SeekableStreamReader reader, CompilationSourceFile file, Re lang_version = settings.Version; yacc_verbose_flag = settings.VerboseParserFlag; doc_support = settings.DocumentationFile != null; - oob_stack.Clear (); - lexer = new Tokenizer (reader, file); - -#if FULL_AST - lbag = new LocationsBag (); -#else - lbag = null; -#endif - - use_global_stacks = true; + lexer = new Tokenizer (reader, file, session); + oob_stack = new Stack (); + lbag = session.LocationsBag; + use_global_stacks = session.UseJayGlobalArrays; + parameters_bucket = session.ParametersStack; } public void parse () { eof_token = Token.EOF; - Tokenizer.LocatedToken.Initialize (); try { if (yacc_verbose_flag > 1) @@ -12979,12 +13019,6 @@ Location GetLocation (object obj) return lexer.Location; } -public LocationsBag LocationsBag { - get { - return lbag; - } -} - void start_block (Location loc) { if (current_block == null) { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay index e323e33332..1299f6d93b 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay @@ -76,7 +76,7 @@ namespace Mono.CSharp /// /// An out-of-band stack. /// - static Stack oob_stack; + Stack oob_stack; /// /// Controls the verbosity of the errors produced by the parser @@ -132,7 +132,7 @@ namespace Mono.CSharp // share the bucket for very common constructs which can never // be recursive // - static List parameters_bucket = new List (6); + List parameters_bucket; // // Full AST support members @@ -2662,6 +2662,21 @@ enum_member_declaration if (doc_support) em.DocComment = ConsumeStoredComment (); + $$ = em; + } + | opt_attributes IDENTIFIER error + { + Error_SyntaxError (yyToken); + + var lt = (Tokenizer.LocatedToken) $2; + var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) $1); + ((Enum) current_type).AddEnumMember (em); + + if (doc_support) { + em.DocComment = Lexer.consume_doc_comment (); + Lexer.doc_state = XmlCommentState.Allowed; + } + $$ = em; } | attributes_without_members @@ -3961,18 +3976,18 @@ multiplicative_expression : prefixed_unary_expression | multiplicative_expression STAR prefixed_unary_expression { - $$ = new Binary (Binary.Operator.Multiply, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.Multiply, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | multiplicative_expression DIV prefixed_unary_expression { - $$ = new Binary (Binary.Operator.Division, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.Division, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | multiplicative_expression PERCENT prefixed_unary_expression { - $$ = new Binary (Binary.Operator.Modulus, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.Modulus, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } ; @@ -3980,18 +3995,14 @@ additive_expression : multiplicative_expression | additive_expression PLUS multiplicative_expression { - $$ = new Binary (Binary.Operator.Addition, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.Addition, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | additive_expression MINUS multiplicative_expression { - $$ = new Binary (Binary.Operator.Subtraction, (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.Subtraction, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } - | parenthesized_expression MINUS multiplicative_expression - { - // Shift/Reduce conflict - $$ = new Binary (Binary.Operator.Subtraction, (Expression) $1, (Expression) $3, GetLocation ($2)); - } | additive_expression AS type { $$ = new As ((Expression) $1, (Expression) $3, GetLocation ($2)); @@ -4006,13 +4017,13 @@ shift_expression : additive_expression | shift_expression OP_SHIFT_LEFT additive_expression { - $$ = new Binary (Binary.Operator.LeftShift, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.LeftShift, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | shift_expression OP_SHIFT_RIGHT additive_expression { - $$ = new Binary (Binary.Operator.RightShift, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.RightShift, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } ; @@ -4020,23 +4031,23 @@ relational_expression : shift_expression | relational_expression OP_LT shift_expression { - $$ = new Binary (Binary.Operator.LessThan, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.LessThan, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | relational_expression OP_GT shift_expression { - $$ = new Binary (Binary.Operator.GreaterThan, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.GreaterThan, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | relational_expression OP_LE shift_expression { - $$ = new Binary (Binary.Operator.LessThanOrEqual, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.LessThanOrEqual, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | relational_expression OP_GE shift_expression { - $$ = new Binary (Binary.Operator.GreaterThanOrEqual, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.GreaterThanOrEqual, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } ; @@ -4044,13 +4055,13 @@ equality_expression : relational_expression | equality_expression OP_EQ relational_expression { - $$ = new Binary (Binary.Operator.Equality, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.Equality, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | equality_expression OP_NE relational_expression { - $$ = new Binary (Binary.Operator.Inequality, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.Inequality, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } ; @@ -4058,8 +4069,8 @@ and_expression : equality_expression | and_expression BITWISE_AND equality_expression { - $$ = new Binary (Binary.Operator.BitwiseAnd, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.BitwiseAnd, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } ; @@ -4067,8 +4078,8 @@ exclusive_or_expression : and_expression | exclusive_or_expression CARRET and_expression { - $$ = new Binary (Binary.Operator.ExclusiveOr, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.ExclusiveOr, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } ; @@ -4076,8 +4087,8 @@ inclusive_or_expression : exclusive_or_expression | inclusive_or_expression BITWISE_OR exclusive_or_expression { - $$ = new Binary (Binary.Operator.BitwiseOr, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.BitwiseOr, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } ; @@ -4085,8 +4096,8 @@ conditional_and_expression : inclusive_or_expression | conditional_and_expression OP_AND inclusive_or_expression { - $$ = new Binary (Binary.Operator.LogicalAnd, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.LogicalAnd, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } ; @@ -4094,8 +4105,8 @@ conditional_or_expression : conditional_and_expression | conditional_or_expression OP_OR conditional_and_expression { - $$ = new Binary (Binary.Operator.LogicalOr, - (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Binary (Binary.Operator.LogicalOr, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } ; @@ -4106,7 +4117,8 @@ null_coalescing_expression if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation ($2), "null coalescing operator"); - $$ = new Nullable.NullCoalescingOperator ((Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new Nullable.NullCoalescingOperator ((Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } ; @@ -4127,57 +4139,58 @@ conditional_expression assignment_expression : prefixed_unary_expression ASSIGN expression { - $$ = new SimpleAssign ((Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new SimpleAssign ((Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | prefixed_unary_expression OP_MULT_ASSIGN expression { - $$ = new CompoundAssign ( - Binary.Operator.Multiply, (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new CompoundAssign (Binary.Operator.Multiply, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | prefixed_unary_expression OP_DIV_ASSIGN expression { - $$ = new CompoundAssign ( - Binary.Operator.Division, (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new CompoundAssign (Binary.Operator.Division, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | prefixed_unary_expression OP_MOD_ASSIGN expression { - $$ = new CompoundAssign ( - Binary.Operator.Modulus, (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new CompoundAssign (Binary.Operator.Modulus, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | prefixed_unary_expression OP_ADD_ASSIGN expression { - $$ = new CompoundAssign ( - Binary.Operator.Addition, (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new CompoundAssign (Binary.Operator.Addition, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | prefixed_unary_expression OP_SUB_ASSIGN expression { - $$ = new CompoundAssign ( - Binary.Operator.Subtraction, (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new CompoundAssign (Binary.Operator.Subtraction, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | prefixed_unary_expression OP_SHIFT_LEFT_ASSIGN expression { - $$ = new CompoundAssign ( - Binary.Operator.LeftShift, (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new CompoundAssign (Binary.Operator.LeftShift, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | prefixed_unary_expression OP_SHIFT_RIGHT_ASSIGN expression { - $$ = new CompoundAssign ( - Binary.Operator.RightShift, (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new CompoundAssign (Binary.Operator.RightShift, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | prefixed_unary_expression OP_AND_ASSIGN expression { - $$ = new CompoundAssign ( - Binary.Operator.BitwiseAnd, (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new CompoundAssign (Binary.Operator.BitwiseAnd, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | prefixed_unary_expression OP_OR_ASSIGN expression { - $$ = new CompoundAssign ( - Binary.Operator.BitwiseOr, (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new CompoundAssign (Binary.Operator.BitwiseOr, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } | prefixed_unary_expression OP_XOR_ASSIGN expression { - $$ = new CompoundAssign ( - Binary.Operator.ExclusiveOr, (Expression) $1, (Expression) $3, GetLocation ($2)); + $$ = new CompoundAssign (Binary.Operator.ExclusiveOr, (Expression) $1, (Expression) $3); + lbag.AddLocation ($$, GetLocation ($2)); } ; @@ -4971,7 +4984,7 @@ identifier_inside_body { if (async_block) { report.Error (4003, GetLocation ($1), "`await' cannot be used as an identifier within an async method or lambda expression"); - $$ = Tokenizer.LocatedToken.Create ("await", GetLocation ($1)); + $$ = new Tokenizer.LocatedToken ("await", GetLocation ($1)); } } ; @@ -5353,19 +5366,19 @@ while_statement do_statement : DO embedded_statement WHILE open_parens_any boolean_expression CLOSE_PARENS SEMICOLON { - $$ = new Do ((Statement) $2, (BooleanExpression) $5, GetLocation ($1)); + $$ = new Do ((Statement) $2, (BooleanExpression) $5, GetLocation ($1), GetLocation ($3)); lbag.AddStatement ($$, GetLocation ($3), GetLocation ($4), GetLocation ($6), GetLocation ($7)); } | DO embedded_statement error { Error_SyntaxError (yyToken); - $$ = new Do ((Statement) $2, null, GetLocation ($1)); + $$ = new Do ((Statement) $2, null, GetLocation ($1), Location.Null); } | DO embedded_statement WHILE open_parens_any boolean_expression error { Error_SyntaxError (yyToken); - $$ = new Do ((Statement) $2, (BooleanExpression) $5, GetLocation ($1)); + $$ = new Do ((Statement) $2, (BooleanExpression) $5, GetLocation ($1), GetLocation ($3)); lbag.AddStatement ($$, GetLocation ($3), GetLocation ($4)); } ; @@ -5634,6 +5647,11 @@ return_statement $$ = new Return ((Expression) $2, GetLocation ($1)); lbag.AddStatement ($$, GetLocation ($3)); } + | RETURN expression error + { + Error_SyntaxError (yyToken); + $$ = new Return ((Expression) $2, GetLocation ($1)); + } | RETURN error { Error_SyntaxError (yyToken); @@ -5671,6 +5689,24 @@ yield_statement $$ = new Yield ((Expression) $3, lt.Location); lbag.AddStatement ($$, GetLocation ($2), GetLocation ($4)); } + | identifier_inside_body RETURN expression error + { + Error_SyntaxError (yyToken); + + var lt = (Tokenizer.LocatedToken) $1; + string s = lt.Value; + if (s != "yield"){ + report.Error (1003, lt.Location, "; expected"); + } else if ($3 == null) { + report.Error (1627, GetLocation ($4), "Expression expected after yield return"); + } else if (lang_version == LanguageVersion.ISO_1){ + FeatureIsNotAvailable (lt.Location, "iterators"); + } + + current_block.Explicit.RegisterIteratorYield (); + $$ = new Yield ((Expression) $3, lt.Location); + lbag.AddStatement ($$, GetLocation ($2)); + } | identifier_inside_body BREAK SEMICOLON { var lt = (Tokenizer.LocatedToken) $1; @@ -6769,17 +6805,12 @@ public Tokenizer Lexer { } } -static CSharpParser () +public CSharpParser (SeekableStreamReader reader, CompilationSourceFile file, ParserSession session) + : this (reader, file, file.Compiler.Report, session) { - oob_stack = new Stack (); } -public CSharpParser (SeekableStreamReader reader, CompilationSourceFile file) - : this (reader, file, file.Compiler.Report) -{ -} - -public CSharpParser (SeekableStreamReader reader, CompilationSourceFile file, Report report) +public CSharpParser (SeekableStreamReader reader, CompilationSourceFile file, Report report, ParserSession session) { this.file = file; current_container = current_namespace = file; @@ -6792,22 +6823,16 @@ public CSharpParser (SeekableStreamReader reader, CompilationSourceFile file, Re lang_version = settings.Version; yacc_verbose_flag = settings.VerboseParserFlag; doc_support = settings.DocumentationFile != null; - oob_stack.Clear (); - lexer = new Tokenizer (reader, file); - -#if FULL_AST - lbag = new LocationsBag (); -#else - lbag = null; -#endif - - use_global_stacks = true; + lexer = new Tokenizer (reader, file, session); + oob_stack = new Stack (); + lbag = session.LocationsBag; + use_global_stacks = session.UseJayGlobalArrays; + parameters_bucket = session.ParametersStack; } public void parse () { eof_token = Token.EOF; - Tokenizer.LocatedToken.Initialize (); try { if (yacc_verbose_flag > 1) @@ -6874,12 +6899,6 @@ Location GetLocation (object obj) return lexer.Location; } -public LocationsBag LocationsBag { - get { - return lbag; - } -} - void start_block (Location loc) { if (current_block == null) { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs index 600569edc5..f8926924e7 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs @@ -16,6 +16,7 @@ using System.Text; using System.Collections.Generic; using System.Globalization; using System.Diagnostics; +using System.Collections; namespace Mono.CSharp { @@ -66,32 +67,62 @@ namespace Mono.CSharp } // - // This class has to be used in the parser only, it reuses token - // details after each parse + // This class has to be used by parser only, it reuses token + // details after each file parse completion // public class LocatedToken { - int row, column; - string value; + public int row, column; + public string value; + public SourceFile file; - static LocatedToken[] buffer = new LocatedToken[0]; - static int pos; - - private LocatedToken () + public LocatedToken () { } - public static LocatedToken Create (int row, int column) + public LocatedToken (string value, Location loc) { - return Create (null, row, column); + this.value = value; + file = loc.SourceFile; + row = loc.Row; + column = loc.Column; } - public static LocatedToken Create (string value, Location loc) + public override string ToString () { - return Create (value, loc.Row, loc.Column); + return string.Format ("Token '{0}' at {1},{2}", Value, row, column); } - public static LocatedToken Create (string value, int row, int column) + public Location Location { + get { return new Location (file, row, column); } + } + + public string Value { + get { return value; } + } + } + + public class LocatedTokenBuffer + { + readonly LocatedToken[] buffer; + public int pos; + + public LocatedTokenBuffer () + { + buffer = new LocatedToken[0]; + } + + public LocatedTokenBuffer (LocatedToken[] buffer) + { + this.buffer = buffer ?? new LocatedToken[0]; + } + + public LocatedToken Create (SourceFile file, int row, int column) + { + return Create (null, file, row, column); + } + + public LocatedToken Create (string value, SourceFile file, int row, int column) { // // TODO: I am not very happy about the logic but it's the best @@ -105,15 +136,16 @@ namespace Mono.CSharp if (pos >= buffer.Length) { entry = new LocatedToken (); } else { - entry = buffer [pos]; + entry = buffer[pos]; if (entry == null) { entry = new LocatedToken (); - buffer [pos] = entry; + buffer[pos] = entry; } ++pos; } entry.value = value; + entry.file = file; entry.row = row; entry.column = column; return entry; @@ -123,31 +155,9 @@ namespace Mono.CSharp // Used for token not required by expression evaluator // [Conditional ("FULL_AST")] - public static void CreateOptional (int row, int col, ref object token) + public void CreateOptional (SourceFile file, int row, int col, ref object token) { - token = Create (row, col); - } - - public static void Initialize () - { -#if !FULL_AST - if (buffer.Length == 0) - buffer = new LocatedToken [15000]; -#endif - pos = 0; - } - - public override string ToString () - { - return string.Format ("Token '{0}' at {1},{2}", Value, row, column); - } - - public Location Location { - get { return new Location (row, column); } - } - - public string Value { - get { return value; } + token = Create (file, row, col); } } @@ -174,13 +184,7 @@ namespace Mono.CSharp readonly SeekableStreamReader reader; readonly CompilationSourceFile source_file; - - public CompilationSourceFile SourceFile { - get { - return source_file; - } - } - + public CompilationSourceFile SourceFile { get { return source_file; } } readonly CompilerContext context; SourceFile current_source; @@ -199,6 +203,7 @@ namespace Mono.CSharp List escaped_identifiers; int parsing_generic_less_than; readonly bool doc_processing; + readonly LocatedTokenBuffer ltb; // // Used mainly for parser optimizations. Some expressions for instance @@ -362,27 +367,15 @@ namespace Mono.CSharp // Stack ifstack; - const int max_id_size = 512; - const int max_number_size = 512; + public const int MaxIdentifierLength = 512; + public const int MaxNumberLength = 512; -#if FULL_AST - readonly char [] id_builder = new char [max_id_size]; - - Dictionary[] identifiers = new Dictionary[max_id_size + 1]; - - char [] number_builder = new char [max_number_size]; + readonly char[] id_builder; + readonly Dictionary[] identifiers; + readonly char[] number_builder; int number_pos; - char[] value_builder = new char[256]; -#else - static readonly char [] id_builder = new char [max_id_size]; - - static Dictionary[] identifiers = new Dictionary[max_id_size + 1]; - - static char [] number_builder = new char [max_number_size]; - static int number_pos; - static char[] value_builder = new char[256]; -#endif + char[] value_builder = new char[64]; public int Line { get { @@ -393,6 +386,15 @@ namespace Mono.CSharp } } + public int Column { + get { + return col; + } + set { + col = value; + } + } + // // This is used when the tokenizer needs to save // the current position as it needs to do some parsing @@ -437,11 +439,15 @@ namespace Mono.CSharp } } - public Tokenizer (SeekableStreamReader input, CompilationSourceFile file) + public Tokenizer (SeekableStreamReader input, CompilationSourceFile file, ParserSession session) { this.source_file = file; this.context = file.Compiler; this.current_source = file.SourceFile; + this.identifiers = session.Identifiers; + this.id_builder = session.IDBuilder; + this.number_builder = session.NumberBuilder; + this.ltb = new LocatedTokenBuffer (session.LocatedTokens); reader = input; @@ -451,8 +457,6 @@ namespace Mono.CSharp doc_processing = context.Settings.DocumentationFile != null; tab_size = context.Settings.TabSize; - - Mono.CSharp.Location.Push (current_source); } public void PushPosition () @@ -836,11 +840,13 @@ namespace Mono.CSharp PushPosition (); xtoken (); if (xtoken () != Token.ARROW) - res = -1; + goto default; PopPosition (); break; default: + // peek_token could overwrite id_buffer + id_builder [0] = 'a'; id_builder [1] = 's'; id_builder [2] = 'y'; id_builder [3] = 'n'; id_builder [4] = 'c'; res = -1; break; } @@ -898,7 +904,7 @@ namespace Mono.CSharp public Location Location { get { - return new Location (ref_line, col); + return new Location (current_source, ref_line, col); } } @@ -1111,9 +1117,14 @@ namespace Mono.CSharp start: int the_token = token (); if (the_token == Token.OPEN_BRACKET) { - do { + while (true) { the_token = token (); - } while (the_token != Token.CLOSE_BRACKET); + if (the_token == Token.EOF) + return true; + + if (the_token == Token.CLOSE_BRACKET) + break; + } the_token = token (); } else if (the_token == Token.IN || the_token == Token.OUT) { the_token = token (); @@ -1326,7 +1337,7 @@ namespace Mono.CSharp bool seen_digits = false; if (c != -1){ - if (number_pos == max_number_size) + if (number_pos == MaxNumberLength) Error_NumericConstantTooLong (); number_builder [number_pos++] = (char) c; } @@ -1337,7 +1348,7 @@ namespace Mono.CSharp // while ((d = peek_char2 ()) != -1){ if (d >= '0' && d <= '9'){ - if (number_pos == max_number_size) + if (number_pos == MaxNumberLength) Error_NumericConstantTooLong (); number_builder [number_pos++] = (char) d; get_char (); @@ -1602,23 +1613,23 @@ namespace Mono.CSharp if (c == 'e' || c == 'E'){ is_real = true; - if (number_pos == max_number_size) + if (number_pos == MaxNumberLength) Error_NumericConstantTooLong (); number_builder [number_pos++] = (char) c; c = get_char (); if (c == '+'){ - if (number_pos == max_number_size) + if (number_pos == MaxNumberLength) Error_NumericConstantTooLong (); number_builder [number_pos++] = '+'; c = -1; } else if (c == '-') { - if (number_pos == max_number_size) + if (number_pos == MaxNumberLength) Error_NumericConstantTooLong (); number_builder [number_pos++] = '-'; c = -1; } else { - if (number_pos == max_number_size) + if (number_pos == MaxNumberLength) Error_NumericConstantTooLong (); number_builder [number_pos++] = '+'; } @@ -1787,7 +1798,7 @@ namespace Mono.CSharp if (peek_char () == '\n') { putback_char = -1; } - + x = '\n'; advance_line (); } else if (x == '\n') { @@ -1798,6 +1809,26 @@ namespace Mono.CSharp return x; } + int get_char_withwithoutskippingwindowseol () + { + int x; + if (putback_char != -1) { + x = putback_char; + putback_char = -1; + } else { + x = reader.Read (); + } + + if (x == '\r') { + + } else if (x == '\n') { + advance_line (); + } else { + col++; + } + return x; + } + void advance_line () { line++; @@ -1967,7 +1998,7 @@ namespace Mono.CSharp } if (pos != 0) { - if (pos > max_id_size) + if (pos > MaxIdentifierLength) arg = new string (value_builder, 0, pos); else arg = InternIdentifier (value_builder, pos); @@ -2002,7 +2033,6 @@ namespace Mono.CSharp } //ref_line = line; - Location.Push (current_source); return true; } @@ -2089,7 +2119,6 @@ namespace Mono.CSharp if (new_file_name != null) { current_source = context.LookupFile (source_file, new_file_name); source_file.AddIncludeFile (current_source); - Location.Push (current_source); } if (!hidden_block_start.IsNull) { @@ -2187,6 +2216,8 @@ namespace Mono.CSharp // // The syntax is ` "foo.txt" "{guid}" "hash"' // + // guid is predefined hash algorithm guid {406ea660-64cf-4c82-b6f0-42d48172a799} for md5 + // int c = get_char (); if (c != '"') @@ -2249,6 +2280,7 @@ namespace Mono.CSharp // Any length of checksum List checksum_bytes = new List (16); + var checksum_location = Location; c = peek_char (); while (c != '"' && c != -1) { checksum_bytes.Add (read_hex (out error)); @@ -2264,14 +2296,23 @@ namespace Mono.CSharp return false; } - file.SetChecksum (guid_bytes, checksum_bytes.ToArray ()); - current_source.AutoGenerated = true; + if (context.Settings.GenerateDebugInfo) { + var chsum = checksum_bytes.ToArray (); + + if (file.HasChecksum) { + if (!ArrayComparer.IsEqual (file.Checksum, chsum)) { + // TODO: Report.SymbolRelatedToPreviousError + Report.Warning (1697, 1, checksum_location, "Different checksum values specified for file `{0}'", file.Name); + } + } + + file.SetChecksum (guid_bytes, chsum); + current_source.AutoGenerated = true; + } + return true; } -#if !FULL_AST - static -#endif bool IsTokenIdentifierEqual (char[] identifier) { for (int i = 0; i < identifier.Length; ++i) { @@ -2875,7 +2916,7 @@ namespace Mono.CSharp #endif while (true){ - c = get_char (); + c = get_char_withwithoutskippingwindowseol (); if (c == '"') { if (quoted && peek_char () == '"') { if (pos == value_builder.Length) @@ -3013,7 +3054,7 @@ namespace Mono.CSharp if (id_builder [0] >= '_' && !quoted) { int keyword = GetKeyword (id_builder, pos); if (keyword != -1) { - val = LocatedToken.Create (keyword == Token.AWAIT ? "await" : null, ref_line, column); + val = ltb.Create (keyword == Token.AWAIT ? "await" : null, current_source, ref_line, column); return keyword; } } @@ -3021,12 +3062,12 @@ namespace Mono.CSharp string s = InternIdentifier (id_builder, pos); #if FULL_AST if (quoted) { - val = LocatedToken.Create ("@" + s, ref_line, column - 1); + val = ltb.Create ("@" + s, current_source, ref_line, column - 1); } else { - val = LocatedToken.Create (s, ref_line, column); + val = ltb.Create (s, current_source, ref_line, column); } #else - val = LocatedToken.Create (s, ref_line, column); + val = ltb.Create (s, current_source, ref_line, column); #endif if (quoted && parsing_attribute_section) AddEscapedIdentifier (((LocatedToken) val).Location); @@ -3034,9 +3075,6 @@ namespace Mono.CSharp return Token.IDENTIFIER; } -#if !FULL_AST - static -#endif string InternIdentifier (char[] charBuffer, int length) { // @@ -3102,17 +3140,17 @@ namespace Mono.CSharp return consume_identifier (c); case '{': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); return Token.OPEN_BRACE; case '}': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); return Token.CLOSE_BRACE; case '[': // To block doccomment inside attribute declaration. if (doc_state == XmlCommentState.Allowed) doc_state = XmlCommentState.NotAllowed; - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); if (parsing_block == 0 || lambda_arguments_parsing) return Token.OPEN_BRACKET; @@ -3138,10 +3176,10 @@ namespace Mono.CSharp return Token.OPEN_BRACKET_EXPR; } case ']': - LocatedToken.CreateOptional (ref_line, col, ref val); + ltb.CreateOptional (current_source, ref_line, col, ref val); return Token.CLOSE_BRACKET; case '(': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); // // An expression versions of parens can appear in block context only // @@ -3186,29 +3224,29 @@ namespace Mono.CSharp return Token.OPEN_PARENS; case ')': - LocatedToken.CreateOptional (ref_line, col, ref val); + ltb.CreateOptional (current_source, ref_line, col, ref val); return Token.CLOSE_PARENS; case ',': - LocatedToken.CreateOptional (ref_line, col, ref val); + ltb.CreateOptional (current_source, ref_line, col, ref val); return Token.COMMA; case ';': - LocatedToken.CreateOptional (ref_line, col, ref val); + ltb.CreateOptional (current_source, ref_line, col, ref val); return Token.SEMICOLON; case '~': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); return Token.TILDE; case '?': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); return TokenizePossibleNullableType (); case '<': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); if (parsing_generic_less_than++ > 0) return Token.OP_GENERICS_LT; return TokenizeLessThan (); case '>': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); d = peek_char (); if (d == '=') { @@ -3235,7 +3273,7 @@ namespace Mono.CSharp return Token.OP_GT; case '+': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); d = peek_char (); if (d == '+') { d = Token.OP_INC; @@ -3248,7 +3286,7 @@ namespace Mono.CSharp return d; case '-': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); d = peek_char (); if (d == '-') { d = Token.OP_DEC; @@ -3263,15 +3301,15 @@ namespace Mono.CSharp return d; case '!': - val = LocatedToken.Create (ref_line, col); - if (peek_char () == '=') { + val = ltb.Create (current_source, ref_line, col); + if (peek_char () == '='){ get_char (); return Token.OP_NE; } return Token.BANG; case '=': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); d = peek_char (); if (d == '=') { get_char (); @@ -3285,7 +3323,7 @@ namespace Mono.CSharp return Token.ASSIGN; case '&': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); d = peek_char (); if (d == '&') { get_char (); @@ -3298,7 +3336,7 @@ namespace Mono.CSharp return Token.BITWISE_AND; case '|': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); d = peek_char (); if (d == '|') { get_char (); @@ -3311,8 +3349,8 @@ namespace Mono.CSharp return Token.BITWISE_OR; case '*': - val = LocatedToken.Create (ref_line, col); - if (peek_char () == '=') { + val = ltb.Create (current_source, ref_line, col); + if (peek_char () == '='){ get_char (); return Token.OP_MULT_ASSIGN; } @@ -3320,8 +3358,8 @@ namespace Mono.CSharp case '/': d = peek_char (); - if (d == '=') { - val = LocatedToken.Create (ref_line, col); + if (d == '='){ + val = ltb.Create (current_source, ref_line, col); get_char (); return Token.OP_DIV_ASSIGN; } @@ -3430,11 +3468,11 @@ namespace Mono.CSharp update_formatted_doc_comment (current_comment_start); continue; } - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); return Token.DIV; case '%': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); if (peek_char () == '='){ get_char (); return Token.OP_MOD_ASSIGN; @@ -3442,7 +3480,7 @@ namespace Mono.CSharp return Token.PERCENT; case '^': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); if (peek_char () == '='){ get_char (); return Token.OP_XOR_ASSIGN; @@ -3450,7 +3488,7 @@ namespace Mono.CSharp return Token.CARRET; case ':': - val = LocatedToken.Create (ref_line, col); + val = ltb.Create (current_source, ref_line, col); if (peek_char () == ':') { get_char (); return Token.DOUBLE_COLON; @@ -3474,7 +3512,7 @@ namespace Mono.CSharp if (d >= '0' && d <= '9') return is_number (c); - LocatedToken.CreateOptional (ref_line, col, ref val); + ltb.CreateOptional (current_source, ref_line, col, ref val); return Token.DOT; case '#': diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs index 19c79512f3..11eca1e7e5 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs @@ -608,7 +608,7 @@ namespace Mono.CSharp { if (al == Modifiers.PRIVATE) { var decl = mc.Parent; do { - same_access_restrictions = decl.CurrentType == p_parent; + same_access_restrictions = decl.CurrentType.MemberDefinition == p_parent.MemberDefinition; } while (!same_access_restrictions && !decl.PartialContainer.IsTopLevel && (decl = decl.Parent) != null); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/delegate.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/delegate.cs index f0781401bb..f2923aa5b1 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/delegate.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/delegate.cs @@ -520,8 +520,11 @@ namespace Mono.CSharp { } TypeSpec rt = delegate_method.ReturnType; + if (rt.BuiltinType == BuiltinTypeSpec.Type.Dynamic) + rt = ec.BuiltinTypes.Object; + if (!Delegate.IsTypeCovariant (ec, rt, invoke_method.ReturnType)) { - Expression ret_expr = new TypeExpression (rt, loc); + Expression ret_expr = new TypeExpression (delegate_method.ReturnType, loc); Error_ConversionFailed (ec, delegate_method, ret_expr); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs index 683e4c292b..6cc53d5053 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/doc.cs @@ -47,6 +47,8 @@ namespace Mono.CSharp // Dictionary StoredDocuments = new Dictionary (); + ParserSession session; + public DocumentationBuilder (ModuleContainer module) { doc_module = new ModuleContainer (module.Compiler); @@ -56,11 +58,6 @@ namespace Mono.CSharp XmlDocumentation = new XmlDocument (); XmlDocumentation.PreserveWhitespace = false; } - - internal DocumentationBuilder() - { - // for NRefactory CSharpParser.ParseDocumentationReference - } Report Report { get { @@ -329,12 +326,18 @@ namespace Mono.CSharp var encoding = module.Compiler.Settings.Encoding; var s = new MemoryStream (encoding.GetBytes (cref)); - SeekableStreamReader seekable = new SeekableStreamReader (s, encoding); - var source_file = new CompilationSourceFile (doc_module); + var source_file = new CompilationSourceFile (doc_module, mc.Location.SourceFile); var report = new Report (doc_module.Compiler, new NullReportPrinter ()); - var parser = new CSharpParser (seekable, source_file, report); + if (session == null) + session = new ParserSession () { + UseJayGlobalArrays = true + }; + + SeekableStreamReader seekable = new SeekableStreamReader (s, encoding, session.StreamReaderBuffer); + + var parser = new CSharpParser (seekable, source_file, report, session); ParsedParameters = null; ParsedName = null; ParsedBuiltinType = null; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs index 0baa4833bc..5f2ac1e74d 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/driver.cs @@ -20,6 +20,7 @@ using System.IO; using System.Text; using System.Globalization; using System.Diagnostics; +using System.Threading; namespace Mono.CSharp { @@ -41,7 +42,7 @@ namespace Mono.CSharp } } - void tokenize_file (SourceFile sourceFile, ModuleContainer module) + void tokenize_file (SourceFile sourceFile, ModuleContainer module, ParserSession session) { Stream input; @@ -56,7 +57,7 @@ namespace Mono.CSharp SeekableStreamReader reader = new SeekableStreamReader (input, ctx.Settings.Encoding); var file = new CompilationSourceFile (module, sourceFile); - Tokenizer lexer = new Tokenizer (reader, file); + Tokenizer lexer = new Tokenizer (reader, file, session); int token, tokens = 0, errors = 0; while ((token = lexer.token ()) != Token.EOF){ @@ -77,49 +78,97 @@ namespace Mono.CSharp Location.Initialize (sources); + var session = new ParserSession () { + UseJayGlobalArrays = true, + LocatedTokens = new Tokenizer.LocatedToken[15000] + }; + for (int i = 0; i < sources.Count; ++i) { if (tokenize_only) { - tokenize_file (sources[i], module); + tokenize_file (sources[i], module, session); } else { - Parse (sources[i], module); + Parse (sources[i], module, session, Report); } } } - public void Parse (SourceFile file, ModuleContainer module) +#if false + void ParseParallel (ModuleContainer module) + { + var sources = module.Compiler.SourceFiles; + + Location.Initialize (sources); + + var pcount = Environment.ProcessorCount; + var threads = new Thread[System.Math.Max (2, pcount - 1)]; + + for (int i = 0; i < threads.Length; ++i) { + var t = new Thread (l => { + var session = new ParserSession () { + //UseJayGlobalArrays = true, + }; + + var report = new Report (ctx, Report.Printer); // TODO: Implement flush at once printer + + for (int ii = (int) l; ii < sources.Count; ii += threads.Length) { + Parse (sources[ii], module, session, report); + } + + // TODO: Merge warning regions + }); + + t.Start (i); + threads[i] = t; + } + + for (int t = 0; t < threads.Length; ++t) { + threads[t].Join (); + } + } +#endif + + public void Parse (SourceFile file, ModuleContainer module, ParserSession session, Report report) { Stream input; try { input = File.OpenRead (file.Name); } catch { - Report.Error (2001, "Source file `{0}' could not be found", file.Name); + report.Error (2001, "Source file `{0}' could not be found", file.Name); return; } // Check 'MZ' header if (input.ReadByte () == 77 && input.ReadByte () == 90) { - Report.Error (2015, "Source file `{0}' is a binary file and not a text file", file.Name); + report.Error (2015, "Source file `{0}' is a binary file and not a text file", file.Name); input.Close (); return; } input.Position = 0; - SeekableStreamReader reader = new SeekableStreamReader (input, ctx.Settings.Encoding); + SeekableStreamReader reader = new SeekableStreamReader (input, ctx.Settings.Encoding, session.StreamReaderBuffer); + + Parse (reader, file, module, session, report); + + if (ctx.Settings.GenerateDebugInfo && report.Errors == 0 && !file.HasChecksum) { + input.Position = 0; + var checksum = session.GetChecksumAlgorithm (); + file.SetChecksum (checksum.ComputeHash (input)); + } - Parse (reader, file, module); reader.Dispose (); input.Close (); } - public static CSharpParser Parse(SeekableStreamReader reader, SourceFile sourceFile, ModuleContainer module, int lineModifier = 0) + public static CSharpParser Parse (SeekableStreamReader reader, SourceFile sourceFile, ModuleContainer module, ParserSession session, Report report, int lineModifier = 0, int colModifier = 0) { var file = new CompilationSourceFile (module, sourceFile); module.AddTypeContainer(file); - CSharpParser parser = new CSharpParser (reader, file); + CSharpParser parser = new CSharpParser (reader, file, report, session); parser.Lexer.Line += lineModifier; + parser.Lexer.Column += colModifier; parser.Lexer.sbag = new SpecialsBag (); parser.parse (); return parser; @@ -347,7 +396,8 @@ namespace Mono.CSharp tr.Stop (TimeReporter.TimerType.CloseTypes); tr.Start (TimeReporter.TimerType.Resouces); - assembly.EmbedResources (); + if (!settings.WriteMetadataOnly) + assembly.EmbedResources (); tr.Stop (TimeReporter.TimerType.Resouces); if (Report.Errors > 0) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs index c9cea6927c..b9d6967dcc 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/dynamic.cs @@ -502,7 +502,7 @@ namespace Mono.CSharp using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) { if (s.Resolve (bc)) { - Statement init = new If (new Binary (Binary.Operator.Equality, site_field_expr, new NullLiteral (loc), loc), s, loc); + Statement init = new If (new Binary (Binary.Operator.Equality, site_field_expr, new NullLiteral (loc)), s, loc); init.Emit (ec); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs index 7629e4e8f5..cf1de9483e 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs @@ -2277,9 +2277,11 @@ namespace Mono.CSharp { } } + var report = ctx.Module.Compiler.Report; + var retval = ctx.LookupNamespaceOrType (Name, Arity, LookupMode.IgnoreAccessibility, loc); if (retval != null) { - ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (retval.Type); + report.SymbolRelatedToPreviousError (retval.Type); ErrorIsInaccesible (ctx, retval.GetSignatureForError (), loc); return; } @@ -2290,7 +2292,17 @@ namespace Mono.CSharp { return; } - NamespaceContainer.Error_NamespaceNotFound (loc, Name, ctx.Module.Compiler.Report); + var ns_candidates = ctx.Module.GlobalRootNamespace.FindTypeNamespaces (ctx, Name, Arity); + if (ns_candidates != null) { + string usings = string.Join ("' or `", ns_candidates.ToArray ()); + report.Error (246, loc, + "The type or namespace name `{0}' could not be found. Are you missing `{1}' using directive?", + Name, usings); + } else { + report.Error (246, loc, + "The type or namespace name `{0}' could not be found. Are you missing an assembly reference?", + Name); + } } public override FullNamedExpression ResolveAsTypeOrNamespace (IMemberContext ec) @@ -3176,8 +3188,12 @@ namespace Mono.CSharp { } var me = ExtensionExpression as MemberExpr; - if (me != null) + if (me != null) { me.ResolveInstanceExpression (ec, null); + var fe = me as FieldExpr; + if (fe != null) + fe.Spec.MemberDefinition.SetIsUsed (); + } InstanceExpression = null; return this; @@ -3447,6 +3463,21 @@ namespace Mono.CSharp { best_candidate_return = best_candidate.ReturnType; } + if (best_candidate.IsGeneric && TypeParameterSpec.HasAnyTypeParameterConstrained (best_candidate.GenericDefinition)) { + ConstraintChecker cc = new ConstraintChecker (ec); + cc.CheckAll (best_candidate.GetGenericMethodDefinition (), best_candidate.TypeArguments, best_candidate.Constraints, loc); + } + + // + // Additional check for possible imported base override method which + // could not be done during IsOverrideMethodBaseTypeAccessible + // + if (best_candidate.IsVirtual && (best_candidate.DeclaringType.Modifiers & Modifiers.PROTECTED) != 0 && + best_candidate.MemberDefinition.IsImported && !best_candidate.DeclaringType.IsAccessible (ec)) { + ec.Report.SymbolRelatedToPreviousError (best_candidate); + ErrorIsInaccesible (ec, best_candidate.GetSignatureForError (), loc); + } + return this; } @@ -3738,7 +3769,9 @@ namespace Mono.CSharp { if (!TypeSpecComparer.Equals (p_m.Parameters.Types, q_m.Parameters.Types)) return 0; + var orig_p = p; p = p_m.ReturnType; + var orig_q = q; q = q_m.ReturnType; // @@ -3755,14 +3788,14 @@ namespace Mono.CSharp { return p.Kind != MemberKind.Void ? 1: 0; } + var am = (AnonymousMethodExpression) a.Expr; + // // When anonymous method is an asynchronous, and P has a return type Task, and Q has a return type Task // better conversion is performed between underlying types Y1 and Y2 // if (p.IsGenericTask || q.IsGenericTask) { - var async_am = a.Expr as AnonymousMethodExpression; - if (async_am != null && async_am.Block.IsAsync) { - + if (am.Block.IsAsync) { if (p.IsGenericTask != q.IsGenericTask) { return 0; } @@ -3770,6 +3803,19 @@ namespace Mono.CSharp { q = q.TypeArguments[0]; p = p.TypeArguments[0]; } + } else if (q != p) { + // + // LAMESPEC: Lambda expression returning dynamic type has identity (better) conversion to delegate returning object type + // + if (q.BuiltinType == BuiltinTypeSpec.Type.Object) { + var am_rt = am.InferReturnType (ec, null, orig_q); + if (am_rt != null && am_rt.BuiltinType == BuiltinTypeSpec.Type.Dynamic) + return 2; + } else if (p.BuiltinType == BuiltinTypeSpec.Type.Object) { + var am_rt = am.InferReturnType (ec, null, orig_p); + if (am_rt != null && am_rt.BuiltinType == BuiltinTypeSpec.Type.Dynamic) + return 1; + } } // @@ -4048,6 +4094,32 @@ namespace Mono.CSharp { return false; } + static bool CheckInflatedArguments (MethodSpec ms) + { + if (!TypeParameterSpec.HasAnyTypeParameterTypeConstrained (ms.GenericDefinition)) + return true; + + // Setup constraint checker for probing only + ConstraintChecker cc = new ConstraintChecker (null); + + var mp = ms.Parameters.Types; + for (int i = 0; i < mp.Length; ++i) { + var type = mp[i] as InflatedTypeSpec; + if (type == null) + continue; + + var targs = type.TypeArguments; + if (targs.Length == 0) + continue; + + // TODO: Checking inflated MVAR arguments should be enough + if (!cc.CheckAll (type.GetDefinition (), targs, type.Constraints, Location.Null)) + return false; + } + + return true; + } + public static void Error_ConstructorMismatch (ResolveContext rc, TypeSpec type, int argCount, Location loc) { rc.Report.Error (1729, loc, @@ -4203,9 +4275,6 @@ namespace Mono.CSharp { TypeSpec[] ptypes; var ms = candidate as MethodSpec; if (ms != null && ms.IsGeneric) { - // Setup constraint checker for probing only - ConstraintChecker cc = new ConstraintChecker (null); - if (type_arguments != null) { var g_args_count = ms.Arity; if (g_args_count != type_arguments.Count) @@ -4251,14 +4320,12 @@ namespace Mono.CSharp { if (i_args.Length != 0) { ms = ms.MakeGenericMethod (ec, i_args); } - - cc.IgnoreInferredDynamic = true; } // // Type arguments constraints have to match for the method to be applicable // - if (!cc.CheckAll (ms.GetGenericMethodDefinition (), ms.TypeArguments, ms.Constraints, loc)) { + if (!CheckInflatedArguments (ms)) { candidate = ms; return int.MaxValue - 25000; } @@ -4485,7 +4552,7 @@ namespace Mono.CSharp { return p; if (specific == ac_q.Element) return q; - } else if (TypeManager.IsGenericType (p)) { + } else if (p.IsGeneric && q.IsGeneric) { var pargs = TypeManager.GetTypeArguments (p); var qargs = TypeManager.GetTypeArguments (q); @@ -4721,6 +4788,17 @@ namespace Mono.CSharp { args [0].Type.GetSignatureForError (), best_candidate.Name, best_candidate.GetSignatureForError ()); } + // + // Check type constraints only when explicit type arguments are used + // + if (best_candidate.IsGeneric && type_arguments != null) { + MethodSpec bc = best_candidate as MethodSpec; + if (bc != null && TypeParameterSpec.HasAnyTypeParameterConstrained (bc.GenericDefinition)) { + ConstraintChecker cc = new ConstraintChecker (rc); + cc.CheckAll (bc.GetGenericMethodDefinition (), bc.TypeArguments, bc.Constraints, loc); + } + } + BestCandidateIsDynamic = true; return null; } @@ -5279,6 +5357,8 @@ namespace Mono.CSharp { protected override Expression DoResolve (ResolveContext ec) { + spec.MemberDefinition.SetIsUsed (); + return DoResolve (ec, null); } @@ -5498,8 +5578,6 @@ namespace Mono.CSharp { { bool is_volatile = (spec.Modifiers & Modifiers.VOLATILE) != 0; - spec.MemberDefinition.SetIsUsed (); - if (IsStatic){ if (is_volatile) ec.Emit (OpCodes.Volatile); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/eval.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/eval.cs index 6eb283b4c8..0d1264516c 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/eval.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/eval.cs @@ -79,7 +79,7 @@ namespace Mono.CSharp module = new ModuleContainer (ctx); module.Evaluator = this; - source_file = new CompilationSourceFile (module); + source_file = new CompilationSourceFile (module, null); module.AddTypeContainer (source_file); startup_files = ctx.SourceFiles.Count; @@ -115,9 +115,10 @@ namespace Mono.CSharp Location.Initialize (ctx.SourceFiles); + var parser_session = new ParserSession (); for (int i = 0; i < startup_files; ++i) { var sf = ctx.SourceFiles [i]; - d.Parse (sf, module); + d.Parse (sf, module, parser_session, ctx.Report); } } @@ -442,7 +443,7 @@ namespace Mono.CSharp // InputKind ToplevelOrStatement (SeekableStreamReader seekable) { - Tokenizer tokenizer = new Tokenizer (seekable, source_file); + Tokenizer tokenizer = new Tokenizer (seekable, source_file, new ParserSession ()); int t = tokenizer.token (); switch (t){ @@ -571,7 +572,7 @@ namespace Mono.CSharp seekable.Position = 0; source_file.DeclarationFound = false; - CSharpParser parser = new CSharpParser (seekable, source_file); + CSharpParser parser = new CSharpParser (seekable, source_file, new ParserSession ()); if (kind == InputKind.StatementOrExpression){ parser.Lexer.putback_char = Tokenizer.EvalStatementParserCharacter; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs index f24537f246..458df5c491 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs @@ -1211,7 +1211,7 @@ namespace Mono.CSharp var one = new IntConstant (ec.BuiltinTypes, 1, loc); var op = IsDecrement ? Binary.Operator.Subtraction : Binary.Operator.Addition; - operation = new Binary (op, source, one, loc); + operation = new Binary (op, source, one); operation = operation.Resolve (ec); if (operation == null) throw new NotImplementedException ("should not be reached"); @@ -1527,7 +1527,7 @@ namespace Mono.CSharp // Turn is check into simple null check for implicitly convertible reference types // return ReducedExpression.Create ( - new Binary (Binary.Operator.Inequality, expr, new NullLiteral (loc), loc).Resolve (ec), + new Binary (Binary.Operator.Inequality, expr, new NullLiteral (loc)).Resolve (ec), this).Resolve (ec); } @@ -2014,7 +2014,7 @@ namespace Mono.CSharp // b = b.left >> b.right & (0x1f|0x3f) // b.right = new Binary (Operator.BitwiseAnd, - b.right, new IntConstant (ec.BuiltinTypes, right_mask, b.right.Location), b.loc).Resolve (ec); + b.right, new IntConstant (ec.BuiltinTypes, right_mask, b.right.Location)).Resolve (ec); // // Expression tree representation does not use & mask @@ -2202,19 +2202,19 @@ namespace Mono.CSharp protected State state; Expression enum_conversion; - public Binary (Operator oper, Expression left, Expression right, bool isCompound, Location loc) - : this (oper, left, right, loc) + public Binary (Operator oper, Expression left, Expression right, bool isCompound) + : this (oper, left, right) { if (isCompound) state |= State.Compound; } - public Binary (Operator oper, Expression left, Expression right, Location loc) + public Binary (Operator oper, Expression left, Expression right) { this.oper = oper; this.left = left; this.right = right; - this.loc = loc; + this.loc = left.Location; } #region Properties @@ -2319,7 +2319,7 @@ namespace Mono.CSharp public static void Error_OperatorCannotBeApplied (ResolveContext ec, Expression left, Expression right, Operator oper, Location loc) { - new Binary (oper, left, right, loc).Error_OperatorCannotBeApplied (ec, left, right); + new Binary (oper, left, right).Error_OperatorCannotBeApplied (ec, left, right); } public static void Error_OperatorCannotBeApplied (ResolveContext ec, Expression left, Expression right, string oper, Location loc) @@ -3031,7 +3031,7 @@ namespace Mono.CSharp (TypeSpec.IsValueType (left.Type) && right is NullLiteral) || (right.Type.IsNullableType && (left is NullLiteral || left.Type.IsNullableType || TypeSpec.IsValueType (left.Type))) || (TypeSpec.IsValueType (right.Type) && left is NullLiteral))) { - var lifted = new Nullable.LiftedBinaryOperator (oper, left, right, loc); + var lifted = new Nullable.LiftedBinaryOperator (oper, left, right); lifted.state = state; return lifted.Resolve (ec); } @@ -4409,7 +4409,7 @@ namespace Mono.CSharp // TODO: Should be the checks resolve context sensitive? ResolveContext rc = new ResolveContext (ec.MemberContext, ResolveContext.Options.UnsafeScope); - right = new Binary (Binary.Operator.Multiply, right, right_const, loc).Resolve (rc); + right = new Binary (Binary.Operator.Multiply, right, right_const).Resolve (rc); if (right == null) return; } @@ -5264,8 +5264,10 @@ namespace Mono.CSharp { this.expr = expr; this.arguments = arguments; - if (expr != null) - loc = expr.Location; + if (expr != null) { + var ma = expr as MemberAccess; + loc = ma != null ? ma.GetLeftExpressionLocation () : expr.Location; + } } #region Properties @@ -6154,7 +6156,7 @@ namespace Mono.CSharp { if (initializers != null && bounds == null) { // - // We use this to store all the date values in the order in which we + // We use this to store all the data values in the order in which we // will need to store them in the byte blob later // array_data = new List (); @@ -6212,7 +6214,16 @@ namespace Mono.CSharp ec.Report.Error (623, loc, "Array initializers can only be used in a variable or field initializer. Try using a new expression instead"); return false; } - + + // When we don't have explicitly specified dimensions, record whatever dimension we first encounter at each level + if (!bounds.ContainsKey(idx + 1)) + bounds[idx + 1] = sub_probe.Count; + + if (bounds[idx + 1] != sub_probe.Count) { + ec.Report.Error(847, sub_probe.Location, "An array initializer of length `{0}' was expected", bounds[idx + 1].ToString()); + return false; + } + bool ret = CheckIndices (ec, sub_probe, idx + 1, specified_dims, child_bounds - 1); if (!ret) return false; @@ -7932,6 +7943,18 @@ namespace Mono.CSharp expr.Error_OperatorCannotBeApplied (rc, loc, ".", type); } + public Location GetLeftExpressionLocation () + { + Expression expr = LeftExpression; + MemberAccess ma = expr as MemberAccess; + while (ma != null && ma.LeftExpression != null) { + expr = ma.LeftExpression; + ma = expr as MemberAccess; + } + + return expr == null ? Location : expr.Location; + } + public static bool IsValidDotExpression (TypeSpec type) { const MemberKind dot_kinds = MemberKind.Class | MemberKind.Struct | MemberKind.Delegate | MemberKind.Enum | @@ -8252,9 +8275,19 @@ namespace Mono.CSharp { if (ec.Module.Compiler.Settings.Version > LanguageVersion.ISO_2 && !ec.IsRuntimeBinder && MethodGroupExpr.IsExtensionMethodArgument (expr)) { ec.Report.SymbolRelatedToPreviousError (type); + + var cand = ec.Module.GlobalRootNamespace.FindExtensionMethodNamespaces (ec, type, name, Arity); + string missing; + // a using directive or an assembly reference + if (cand != null) { + missing = "`" + string.Join ("' or `", cand.ToArray ()) + "' using directive"; + } else { + missing = "an assembly reference"; + } + ec.Report.Error (1061, loc, - "Type `{0}' does not contain a definition for `{1}' and no extension method `{1}' of type `{0}' could be found (are you missing a using directive or an assembly reference?)", - type.GetSignatureForError (), name); + "Type `{0}' does not contain a definition for `{1}' and no extension method `{1}' of type `{0}' could be found. Are you missing {2}?", + type.GetSignatureForError (), name, missing); return; } @@ -9461,7 +9494,7 @@ namespace Mono.CSharp this.left = left; this.spec = spec; - this.loc = spec.Location; + this.loc = left.Location; } public override TypeSpec ResolveAsType (IMemberContext ec) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/field.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/field.cs index d38ecc945a..580b192a6f 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/field.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/field.cs @@ -640,13 +640,12 @@ namespace Mono.CSharp } if (initializer != null) { - Parent.RegisterFieldForInitialization (this, - new FieldInitializer (spec, initializer, this)); + Parent.RegisterFieldForInitialization (this, new FieldInitializer (this, initializer, TypeExpression.Location)); } if (declarators != null) { - var t = new TypeExpression (MemberType, TypeExpression.Location); foreach (var d in declarators) { + var t = new TypeExpression (MemberType, d.Name.Location); var f = new Field (Parent, t, ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes); if (d.Initializer != null) f.initializer = d.Initializer; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs index 2922ff5891..9bf70dc768 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs @@ -737,6 +737,12 @@ namespace Mono.CSharp { } } + public bool HasAnyTypeConstraint { + get { + return (spec & (SpecialConstraint.Class | SpecialConstraint.Struct)) != 0 || ifaces != null || targs != null || HasTypeConstraint; + } + } + public bool HasTypeConstraint { get { var bt = BaseType.BuiltinType; @@ -1226,6 +1232,30 @@ namespace Mono.CSharp { return false; } + public static bool HasAnyTypeParameterTypeConstrained (IGenericMethodDefinition md) + { + var tps = md.TypeParameters; + for (int i = 0; i < md.TypeParametersCount; ++i) { + if (tps[i].HasAnyTypeConstraint) { + return true; + } + } + + return false; + } + + public static bool HasAnyTypeParameterConstrained (IGenericMethodDefinition md) + { + var tps = md.TypeParameters; + for (int i = 0; i < md.TypeParametersCount; ++i) { + if (tps[i].IsConstrained) { + return true; + } + } + + return false; + } + public override TypeSpec Mutate (TypeParameterMutator mutator) { return mutator.Mutate (this); @@ -2224,29 +2254,14 @@ namespace Mono.CSharp { struct ConstraintChecker { IMemberContext mc; - bool ignore_inferred_dynamic; bool recursive_checks; public ConstraintChecker (IMemberContext ctx) { this.mc = ctx; - ignore_inferred_dynamic = false; recursive_checks = false; } - #region Properties - - public bool IgnoreInferredDynamic { - get { - return ignore_inferred_dynamic; - } - set { - ignore_inferred_dynamic = value; - } - } - - #endregion - // // Checks the constraints of open generic type against type // arguments. This version is used for types which could not be @@ -2296,9 +2311,6 @@ namespace Mono.CSharp { public bool CheckAll (MemberSpec context, TypeSpec[] targs, TypeParameterSpec[] tparams, Location loc) { for (int i = 0; i < tparams.Length; i++) { - if (ignore_inferred_dynamic && targs[i].BuiltinType == BuiltinTypeSpec.Type.Dynamic) - continue; - var targ = targs[i]; if (!CheckConstraint (context, targ, tparams [i], loc)) return false; @@ -2446,14 +2458,6 @@ namespace Mono.CSharp { return true; } - // - // When partial/full type inference finds a dynamic type argument delay - // the constraint check to runtime, it can succeed for real underlying - // dynamic type - // - if (ignore_inferred_dynamic && HasDynamicTypeArgument (ttype.TypeArguments)) - return true; - if (mc != null) { mc.Module.Compiler.Report.SymbolRelatedToPreviousError (tparam); if (atype.IsGenericParameter) { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs index da3e3d7c70..605db44fb5 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/import.cs @@ -90,7 +90,7 @@ namespace Mono.CSharp if (cad.Count > 0) { foreach (var ca in cad) { var dt = ca.Constructor.DeclaringType; - if (dt.Name != "DynamicAttribute" && dt.Namespace != CompilerServicesNamespace) + if (dt.Name != "DynamicAttribute" || dt.Namespace != CompilerServicesNamespace) continue; if (ca.ConstructorArguments.Count == 0) { @@ -390,18 +390,21 @@ namespace Mono.CSharp if ((mod & Modifiers.OVERRIDE) != 0) { bool is_real_override = false; if (kind == MemberKind.Method && declaringType.BaseType != null) { - var filter = MemberFilter.Method (name, tparams != null ? tparams.Length : 0, parameters, null); - var candidate = MemberCache.FindMember (declaringType.BaseType, filter, BindingRestriction.None); - - // - // For imported class method do additional validation to be sure that metadata - // override flag was correct - // - // Difference between protected internal and protected is ok - // - const Modifiers conflict_mask = Modifiers.AccessibilityMask & ~Modifiers.INTERNAL; - if (candidate != null && (candidate.Modifiers & conflict_mask) == (mod & conflict_mask) && !candidate.IsStatic) { - is_real_override = true; + var btype = declaringType.BaseType; + if (IsOverrideMethodBaseTypeAccessible (btype)) { + var filter = MemberFilter.Method (name, tparams != null ? tparams.Length : 0, parameters, null); + var candidate = MemberCache.FindMember (btype, filter, BindingRestriction.None); + + // + // For imported class method do additional validation to be sure that metadata + // override flag was correct + // + // Difference between protected internal and protected is ok + // + const Modifiers conflict_mask = Modifiers.AccessibilityMask & ~Modifiers.INTERNAL; + if (candidate != null && (candidate.Modifiers & conflict_mask) == (mod & conflict_mask) && !candidate.IsStatic) { + is_real_override = true; + } } } @@ -434,6 +437,30 @@ namespace Mono.CSharp return ms; } + bool IsOverrideMethodBaseTypeAccessible (TypeSpec baseType) + { + switch (baseType.Modifiers & Modifiers.AccessibilityMask) { + case Modifiers.PUBLIC: + return true; + case Modifiers.INTERNAL: + // + // Check whether imported method in base type is accessible from compiled + // context + // + return baseType.MemberDefinition.IsInternalAsPublic (module.DeclaringAssembly); + case Modifiers.PRIVATE: + return false; + default: + // protected + // protected internal + // + // Method accessibility checks will be done later based on context + // where the method is called (CS0122 error will be reported for inaccessible) + // + return true; + } + } + // // Imports System.Reflection parameters // diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs index 337c378e55..e3cbf6dd10 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs @@ -52,13 +52,15 @@ namespace Mono.CSharp } } + static readonly byte[] MD5Algorith = { 96, 166, 110, 64, 207, 100, 130, 76, 182, 240, 66, 212, 129, 114, 167, 153 }; + public readonly string Name; public readonly string FullPathName; public readonly int Index; public bool AutoGenerated; SourceFileEntry file; - byte[] guid, checksum; + byte[] algGuid, checksum; List hidden_lines; public SourceFile (string name, string path, int index) @@ -68,15 +70,32 @@ namespace Mono.CSharp this.FullPathName = path; } + public byte[] Checksum { + get { + return checksum; + } + } + + public bool HasChecksum { + get { + return checksum != null; + } + } + public SourceFileEntry SourceFileEntry { get { return file; } } - public void SetChecksum (byte[] guid, byte[] checksum) + public void SetChecksum (byte[] checksum) { - this.guid = guid; + SetChecksum (MD5Algorith, checksum); + } + + public void SetChecksum (byte[] algorithmGuid, byte[] checksum) + { + this.algGuid = algorithmGuid; this.checksum = checksum; } @@ -85,13 +104,9 @@ namespace Mono.CSharp if (hidden_lines != null) hidden_lines.Sort (); - if (guid != null) { - file = new SourceFileEntry (symwriter, FullPathName, guid, checksum); - } else { - file = new SourceFileEntry (symwriter, FullPathName); - if (AutoGenerated) - file.SetAutoGenerated (); - } + file = new SourceFileEntry (symwriter, FullPathName, algGuid, checksum); + if (AutoGenerated) + file.SetAutoGenerated (); return file; } @@ -177,7 +192,6 @@ namespace Mono.CSharp const int max_column = column_mask; static List source_list; - static int current_source; static Checkpoint [] checkpoints; static int checkpoint_index; @@ -192,7 +206,6 @@ namespace Mono.CSharp public static void Reset () { source_list = new List (); - current_source = 0; checkpoint_index = 0; } @@ -220,13 +233,7 @@ namespace Mono.CSharp checkpoints [0] = new Checkpoint (0, 0); } - static public void Push (SourceFile file) - { - current_source = file != null ? file.Index : -1; - // File is always pushed before being changed. - } - - public Location (int row, int column) + public Location (SourceFile file, int row, int column) { if (row <= 0) token = 0; @@ -237,6 +244,9 @@ namespace Mono.CSharp long target = -1; long delta = 0; + // TODO: For eval only, need better handling of empty + int file_index = file == null ? 0 : file.Index; + // FIXME: This value is certainly wrong but what was the intension int max = checkpoint_index < 10 ? checkpoint_index : 10; @@ -245,13 +255,13 @@ namespace Mono.CSharp delta = row - offset; if (delta >= 0 && delta < (1 << line_delta_bits) && - checkpoints [checkpoint_index - i].File == current_source) { + checkpoints[checkpoint_index - i].File == file_index) { target = checkpoint_index - i; break; } } if (target == -1) { - AddCheckpoint (current_source, row); + AddCheckpoint (file_index, row); target = checkpoint_index; delta = row % (1 << line_delta_bits); } @@ -269,7 +279,7 @@ namespace Mono.CSharp public static Location operator - (Location loc, int columns) { - return new Location (loc.Row, loc.Column - columns); + return new Location (loc.SourceFile, loc.Row, loc.Column - columns); } static void AddCheckpoint (int file, int row) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs index 5374da9db9..9ff3168869 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/membercache.cs @@ -435,12 +435,15 @@ namespace Mono.CSharp { // A special method to work with member lookup only. It returns a list of all members named @name // starting from @container. It's very performance sensitive // - public static IList FindMembers (TypeSpec container, string name, bool declaredOnly) + // declaredOnlyClass cannot be used interfaces. Manual filtering is required because names are + // compacted + // + public static IList FindMembers (TypeSpec container, string name, bool declaredOnlyClass) { IList applicable; do { - if (container.MemberCache.member_hash.TryGetValue (name, out applicable) || declaredOnly) + if (container.MemberCache.member_hash.TryGetValue (name, out applicable) || declaredOnlyClass) return applicable; container = container.BaseType; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs index f704166852..a1560a5086 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs @@ -1213,6 +1213,9 @@ namespace Mono.CSharp { block = (ToplevelBlock) block.ConvertToAsyncTask (this, Parent.PartialContainer, parameters, ReturnType, Location); ModFlags |= Modifiers.DEBUGGER_HIDDEN; } + + if (Compiler.Settings.WriteMetadataOnly) + block = null; } if ((ModFlags & Modifiers.STATIC) == 0) @@ -1301,10 +1304,18 @@ namespace Mono.CSharp { } } - base.Emit (); - + if (block != null && block.StateMachine != null) { + var psm = block.StateMachine is IteratorStorey ? + Module.PredefinedAttributes.IteratorStateMachine : + Module.PredefinedAttributes.AsyncStateMachine; + + psm.EmitAttribute (MethodBuilder, block.StateMachine); + } + if ((ModFlags & Modifiers.METHOD_EXTENSION) != 0) Module.PredefinedAttributes.Extension.EmitAttribute (MethodBuilder); + + base.Emit (); } catch { Console.WriteLine ("Internal compiler error at {0}: exception caught while emitting {1}", Location, MethodBuilder); @@ -1617,10 +1628,15 @@ namespace Mono.CSharp { Parent.MemberCache.AddMember (spec); - // It's here only to report an error - if (block != null && block.IsIterator) { - member_type = Compiler.BuiltinTypes.Void; - Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags); + if (block != null) { + // It's here only to report an error + if (block.IsIterator) { + member_type = Compiler.BuiltinTypes.Void; + Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags); + } + + if (Compiler.Settings.WriteMetadataOnly) + block = null; } return true; @@ -1656,14 +1672,14 @@ namespace Mono.CSharp { BlockContext bc = new BlockContext (this, block, Compiler.BuiltinTypes.Void); bc.Set (ResolveContext.Options.ConstructorScope); - // - // If we use a "this (...)" constructor initializer, then - // do not emit field initializers, they are initialized in the other constructor - // - if (!(Initializer is ConstructorThisInitializer)) - Parent.PartialContainer.ResolveFieldInitializers (bc); - if (block != null) { + // + // If we use a "this (...)" constructor initializer, then + // do not emit field initializers, they are initialized in the other constructor + // + if (!(Initializer is ConstructorThisInitializer)) + Parent.PartialContainer.ResolveFieldInitializers (bc); + if (!IsStatic) { if (Initializer == null) { if (Parent.PartialContainer.Kind == MemberKind.Struct) { @@ -2155,6 +2171,16 @@ namespace Mono.CSharp { return true; } + public override bool Define () + { + base.Define (); + + if (Compiler.Settings.WriteMetadataOnly) + block = null; + + return true; + } + public override void Emit() { var base_type = Parent.PartialContainer.BaseType; @@ -2518,13 +2544,18 @@ namespace Mono.CSharp { if (!base.Define ()) return false; - if (block != null && block.IsIterator) { - // - // Current method is turned into automatically generated - // wrapper which creates an instance of iterator - // - Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags); - ModFlags |= Modifiers.DEBUGGER_HIDDEN; + if (block != null) { + if (block.IsIterator) { + // + // Current method is turned into automatically generated + // wrapper which creates an instance of iterator + // + Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags); + ModFlags |= Modifiers.DEBUGGER_HIDDEN; + } + + if (Compiler.Settings.WriteMetadataOnly) + block = null; } // imlicit and explicit operator of same types are not allowed diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/module.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/module.cs index 3117053fcf..bf36e8f20e 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/module.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/module.cs @@ -429,7 +429,7 @@ namespace Mono.CSharp base.EmitContainer (); - if (Compiler.Report.Errors == 0) + if (Compiler.Report.Errors == 0 && !Compiler.Settings.WriteMetadataOnly) VerifyMembers (); if (anonymous_types != null) { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs index 315aed9808..9f448842fe 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/namespace.cs @@ -41,6 +41,46 @@ namespace Mono.CSharp { report.Error (1681, loc, "The global extern alias cannot be redefined"); } + // + // For better error reporting where we try to guess missing using directive + // + public List FindTypeNamespaces (IMemberContext ctx, string name, int arity) + { + List res = null; + + foreach (var ns in all_namespaces) { + var type = ns.Value.LookupType (ctx, name, arity, LookupMode.Normal, Location.Null); + if (type != null) { + if (res == null) + res = new List (); + + res.Add (ns.Key); + } + } + + return res; + } + + // + // For better error reporting where compiler tries to guess missing using directive + // + public List FindExtensionMethodNamespaces (IMemberContext ctx, TypeSpec extensionType, string name, int arity) + { + List res = null; + + foreach (var ns in all_namespaces) { + var methods = ns.Value.LookupExtensionMethod (ctx, extensionType, name, arity); + if (methods != null) { + if (res == null) + res = new List (); + + res.Add (ns.Key); + } + } + + return res; + } + public void RegisterNamespace (Namespace child) { if (child != this) @@ -181,14 +221,51 @@ namespace Mono.CSharp { return; } + string assembly = null; + string possible_name = fullname + "." + name; + + // Only assembly unique name should be added + switch (possible_name) { + case "System.Drawing": + case "System.Web.Services": + case "System.Web": + case "System.Data": + case "System.Configuration": + case "System.Data.Services": + case "System.DirectoryServices": + case "System.Json": + case "System.Net.Http": + case "System.Numerics": + case "System.Runtime.Caching": + case "System.ServiceModel": + case "System.Transactions": + case "System.Web.Routing": + case "System.Xml.Linq": + case "System.Xml": + assembly = possible_name; + break; + + case "System.Linq": + case "System.Linq.Expressions": + assembly = "System.Core"; + break; + + case "System.Windows.Forms": + case "System.Windows.Forms.Layout": + assembly = "System.Windows.Name"; + break; + } + + assembly = assembly == null ? "an" : "`" + assembly + "'"; + if (this is GlobalRootNamespace) { ctx.Module.Compiler.Report.Error (400, loc, - "The type or namespace name `{0}' could not be found in the global namespace (are you missing an assembly reference?)", - name); + "The type or namespace name `{0}' could not be found in the global namespace. Are you missing {1} assembly reference?", + name, assembly); } else { ctx.Module.Compiler.Report.Error (234, loc, - "The type or namespace name `{0}' does not exist in the namespace `{1}'. Are you missing an assembly reference?", - name, GetSignatureForError ()); + "The type or namespace name `{0}' does not exist in the namespace `{1}'. Are you missing {2} assembly reference?", + name, GetSignatureForError (), assembly); } } @@ -209,10 +286,16 @@ namespace Mono.CSharp { ns_parent = this; } + return ns_parent.TryAddNamespace (name.Basename); + } + + Namespace TryAddNamespace (string name) + { Namespace ns; - if (!ns_parent.namespaces.TryGetValue (name.Basename, out ns)) { - ns = new Namespace (ns_parent, name.Basename); - ns_parent.namespaces.Add (name.Basename, ns); + + if (!namespaces.TryGetValue (name, out ns)) { + ns = new Namespace (this, name); + namespaces.Add (name, ns); } return ns; @@ -1110,44 +1193,6 @@ namespace Mono.CSharp { return match; } - static void MsgtryRef (string s) - { - Console.WriteLine (" Try using -r:" + s); - } - - static void MsgtryPkg (string s) - { - Console.WriteLine (" Try using -pkg:" + s); - } - - public static void Error_NamespaceNotFound (Location loc, string name, Report Report) - { - Report.Error (246, loc, "The type or namespace name `{0}' could not be found. Are you missing a using directive or an assembly reference?", - name); - - switch (name) { - case "Gtk": case "GtkSharp": - MsgtryPkg ("gtk-sharp-2.0"); - break; - - case "Gdk": case "GdkSharp": - MsgtryPkg ("gdk-sharp-2.0"); - break; - - case "Glade": case "GladeSharp": - MsgtryPkg ("glade-sharp-2.0"); - break; - - case "System.Drawing": - case "System.Web.Services": - case "System.Web": - case "System.Data": - case "System.Windows.Forms": - MsgtryRef (name); - break; - } - } - protected override void DefineNamespace () { if (namespace_using_table == null) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs index 1e46767cf1..d7a6c1638d 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/nullable.cs @@ -539,8 +539,8 @@ namespace Mono.CSharp.Nullable Expression user_operator; MethodSpec wrap_ctor; - public LiftedBinaryOperator (Binary.Operator op, Expression left, Expression right, Location loc) - : base (op, left, right, loc) + public LiftedBinaryOperator (Binary.Operator op, Expression left, Expression right) + : base (op, left, right) { } @@ -583,7 +583,7 @@ namespace Mono.CSharp.Nullable Constant c = new BoolConstant (ec.BuiltinTypes, Oper == Operator.Inequality, loc); if ((Oper & Operator.EqualityMask) != 0) { - ec.Report.Warning (472, 2, loc, "The result of comparing value type `{0}' with null is `{1}'", + ec.Report.Warning (472, 2, loc, "The result of comparing value type `{0}' with null is always `{1}'", TypeManager.CSharpName (expr.Type), c.GetValueAsLiteral ()); } else { ec.Report.Warning (464, 2, loc, "The result of comparing type `{0}' with null is always `{1}'", @@ -1000,12 +1000,12 @@ namespace Mono.CSharp.Nullable { Expression left, right; Unwrap unwrap; - - public NullCoalescingOperator (Expression left, Expression right, Location loc) + + public NullCoalescingOperator (Expression left, Expression right) { this.left = left; this.right = right; - this.loc = loc; + this.loc = left.Location; } public Expression LeftExpression { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/outline.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/outline.cs index 63a006ac55..7f21b8c4df 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/outline.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/outline.cs @@ -142,7 +142,6 @@ public class Outline { first = true; foreach (ConstructorInfo ci in t.GetConstructors (DefaultFlags)) { - if (! ShowMember (ci)) continue; @@ -150,6 +149,7 @@ public class Outline { o.WriteLine (); first = false; + OutlineMemberAttribute (ci); OutlineConstructor (ci); o.WriteLine (); @@ -169,7 +169,8 @@ public class Outline { if (first) o.WriteLine (); first = false; - + + OutlineMemberAttribute (m); OutlineMethod (m); o.WriteLine (); @@ -191,6 +192,7 @@ public class Outline { o.WriteLine (); first = false; + OutlineMemberAttribute (m); OutlineOperator (m); o.WriteLine (); @@ -208,6 +210,7 @@ public class Outline { o.WriteLine (); first = false; + OutlineMemberAttribute (pi); OutlineProperty (pi); o.WriteLine (); @@ -224,6 +227,7 @@ public class Outline { o.WriteLine (); first = false; + OutlineMemberAttribute (fi); OutlineField (fi); o.WriteLine (); @@ -240,6 +244,7 @@ public class Outline { o.WriteLine (); first = false; + OutlineMemberAttribute (ei); OutlineEvent (ei); o.WriteLine (); @@ -286,6 +291,15 @@ public class Outline { o.WriteLine ("[Obsolete]"); } + void OutlineMemberAttribute (MemberInfo mi) + { + if (!mi.IsDefined (typeof (System.ObsoleteAttribute), false)) + return; + var oa = mi.GetCustomAttributes (typeof (System.ObsoleteAttribute), false) [0] as ObsoleteAttribute; + var msg = oa.Message; + o.WriteLine ("[Obsolete{0}]", msg == null || msg == "" ? "" : string.Format ("(\"{0}\")", msg)); + } + void OutlineEvent (EventInfo ei) { MethodBase accessor = ei.GetAddMethod (true); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/property.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/property.cs index d53d724fb6..067c0c5f2d 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/property.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/property.cs @@ -362,8 +362,13 @@ namespace Mono.CSharp CheckAbstractAndExtern (block != null); CheckProtectedModifier (); - if (block != null && block.IsIterator) - Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags); + if (block != null) { + if (block.IsIterator) + Iterator.CreateIterator (this, Parent.PartialContainer, ModFlags); + + if (Compiler.Settings.WriteMetadataOnly) + block = null; + } return null; } @@ -906,7 +911,7 @@ namespace Mono.CSharp public override void Emit (TypeDefinition parent) { - if ((method.ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) == 0) { + if ((method.ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) == 0 && !Compiler.Settings.WriteMetadataOnly) { block = new ToplevelBlock (Compiler, ParameterInfo, Location) { IsCompilerGenerated = true }; @@ -938,11 +943,10 @@ namespace Mono.CSharp var cond = new BooleanExpression (new Binary (Binary.Operator.Inequality, new Cast (new TypeExpression (Module.Compiler.BuiltinTypes.Object, Location), new LocalVariableReference (obj1, Location), Location), - new Cast (new TypeExpression (Module.Compiler.BuiltinTypes.Object, Location), new LocalVariableReference (obj2, Location), Location), - Location)); + new Cast (new TypeExpression (Module.Compiler.BuiltinTypes.Object, Location), new LocalVariableReference (obj2, Location), Location))); var body = new ExplicitBlock (block, Location, Location); - block.AddStatement (new Do (body, cond, Location)); + block.AddStatement (new Do (body, cond, Location, Location)); body.AddStatement (new StatementExpression ( new SimpleAssign (new LocalVariableReference (obj2, Location), new LocalVariableReference (obj1, Location)))); @@ -1194,6 +1198,9 @@ namespace Mono.CSharp if (!method_data.Define (parent.PartialContainer, method.GetFullName (MemberName))) return null; + if (Compiler.Settings.WriteMetadataOnly) + block = null; + MethodBuilder mb = method_data.MethodBuilder; Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, mb, ParameterInfo, method.ModFlags); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/report.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/report.cs index 26e3f4101c..b27b9c8a08 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/report.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/report.cs @@ -49,7 +49,7 @@ namespace Mono.CSharp { 809, 824, 1030, 1058, 1060, 1066, 1522, 1570, 1571, 1572, 1573, 1574, 1580, 1581, 1584, 1587, 1589, 1590, 1591, 1592, - 1607, 1616, 1633, 1634, 1635, 1685, 1690, 1691, 1692, 1695, 1696, 1699, + 1607, 1616, 1633, 1634, 1635, 1685, 1690, 1691, 1692, 1695, 1696, 1697, 1699, 1700, 1701, 1702, 1709, 1711, 1717, 1718, 1720, 1735, 1901, 1956, 1981, 1998, 2002, 2023, 2029, diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/settings.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/settings.cs index 214c925591..1556b5ca5f 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/settings.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/settings.cs @@ -159,6 +159,8 @@ namespace Mono.CSharp { public RuntimeVersion StdLibRuntimeVersion; + public bool WriteMetadataOnly; + readonly List conditional_symbols; readonly List source_files; @@ -180,10 +182,8 @@ namespace Mono.CSharp { StdLibRuntimeVersion = RuntimeVersion.v4; WarningLevel = 4; - if (Environment.OSVersion.Platform == PlatformID.Win32NT) - TabSize = 4; - else - TabSize = 8; + // Default to 1 or mdb files would be platform speficic + TabSize = 1; AssemblyReferences = new List (); AssemblyReferencesAliases = new List> (); @@ -224,11 +224,7 @@ namespace Mono.CSharp { return source_files; } } - - public IList ConditionalSymbols { - get { return conditional_symbols; } - } - + #endregion public void AddConditionalSymbol (string symbol) @@ -674,8 +670,9 @@ namespace Mono.CSharp { { output.WriteLine ( "Other flags in the compiler\n" + - " --fatal[=COUNT] Makes errors after COUNT fatal\n" + + " --fatal[=COUNT] Makes error after COUNT fatal\n" + " --lint Enhanced warnings\n" + + " --metadata-only Produced assembly will contain metadata only\n" + " --parse Only parses the source file\n" + " --runtime:VERSION Sets mscorlib.dll metadata version: v1, v2, v4\n" + " --stacktrace Shows stack trace at error location\n" + @@ -937,7 +934,7 @@ namespace Mono.CSharp { return ParseResult.Success; case "/debug": - if (value == "full" || value == "pdbonly" || idx < 0) { + if (value.Equals ("full", StringComparison.OrdinalIgnoreCase) || value.Equals ("pdbonly", StringComparison.OrdinalIgnoreCase) || idx < 0) { settings.GenerateDebugInfo = true; return ParseResult.Success; } @@ -1429,6 +1426,10 @@ namespace Mono.CSharp { settings.LoadDefaultReferences = false; return ParseResult.Success; + case "--metadata-only": + settings.WriteMetadataOnly = true; + return ParseResult.Success; + default: if (arg.StartsWith ("--fatal", StringComparison.Ordinal)){ int fatal = 1; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs index b16e790d9c..46aff2b96b 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs @@ -281,11 +281,16 @@ namespace Mono.CSharp { public Expression expr; public Statement EmbeddedStatement; - public Do (Statement statement, BooleanExpression bool_expr, Location l) + public Do (Statement statement, BooleanExpression bool_expr, Location doLocation, Location whileLocation) { expr = bool_expr; EmbeddedStatement = statement; - loc = l; + loc = doLocation; + WhileLocation = whileLocation; + } + + public Location WhileLocation { + get; private set; } public override bool Resolve (BlockContext ec) @@ -332,7 +337,7 @@ namespace Mono.CSharp { ec.MarkLabel (ec.LoopBegin); // Mark start of while condition - ec.Mark (expr.Location); + ec.Mark (WhileLocation); // // Dead code elimination @@ -461,7 +466,7 @@ namespace Mono.CSharp { ec.MarkLabel (ec.LoopBegin); - ec.Mark (expr.Location); + ec.Mark (loc); expr.EmitBranchable (ec, while_loop, true); ec.MarkLabel (ec.LoopEnd); @@ -878,7 +883,6 @@ namespace Mono.CSharp { return true; } - // TODO: Better error message if (async_type.Kind == MemberKind.Void) { ec.Report.Error (127, loc, "`{0}': A return keyword must not be followed by any expression when method returns void", @@ -909,6 +913,15 @@ namespace Mono.CSharp { } } } else { + // Same error code as .NET but better error message + if (block_return_type.Kind == MemberKind.Void) { + ec.Report.Error (127, loc, + "`{0}': A return keyword must not be followed by any expression when delegate returns void", + am.GetSignatureForError ()); + + return false; + } + var l = am as AnonymousMethodBody; if (l != null && l.ReturnTypeInference != null && expr != null) { l.ReturnTypeInference.AddCommonTypeBound (expr.Type); @@ -1620,8 +1633,10 @@ namespace Mono.CSharp { if (declarators != null) { foreach (var d in declarators) { d.Variable.CreateBuilder (ec); - if (d.Initializer != null) + if (d.Initializer != null) { + ec.Mark (d.Variable.Location); ((ExpressionStatement) d.Initializer).EmitStatement (ec); + } } } } @@ -4236,10 +4251,10 @@ namespace Mono.CSharp { Expression cond = null; for (int ci = 0; ci < s.Labels.Count; ++ci) { - var e = new Binary (Binary.Operator.Equality, value, s.Labels[ci].Converted, loc); + var e = new Binary (Binary.Operator.Equality, value, s.Labels[ci].Converted); if (ci > 0) { - cond = new Binary (Binary.Operator.LogicalOr, cond, e, loc); + cond = new Binary (Binary.Operator.LogicalOr, cond, e); } else { cond = e; } @@ -5130,8 +5145,8 @@ namespace Mono.CSharp { // fixed (T* e_ptr = (e == null || e.Length == 0) ? null : converted [0]) // converted = new Conditional (new BooleanExpression (new Binary (Binary.Operator.LogicalOr, - new Binary (Binary.Operator.Equality, initializer, new NullLiteral (loc), loc), - new Binary (Binary.Operator.Equality, new MemberAccess (initializer, "Length"), new IntConstant (bc.BuiltinTypes, 0, loc), loc), loc)), + new Binary (Binary.Operator.Equality, initializer, new NullLiteral (loc)), + new Binary (Binary.Operator.Equality, new MemberAccess (initializer, "Length"), new IntConstant (bc.BuiltinTypes, 0, loc)))), new NullLiteral (loc), converted, loc); @@ -5697,7 +5712,7 @@ namespace Mono.CSharp { // Add conditional call when disposing possible null variable if (!type.IsStruct || type.IsNullableType) - dispose = new If (new Binary (Binary.Operator.Inequality, lvr, new NullLiteral (loc), loc), dispose, dispose.loc); + dispose = new If (new Binary (Binary.Operator.Inequality, lvr, new NullLiteral (loc)), dispose, dispose.loc); return dispose; } @@ -5711,7 +5726,7 @@ namespace Mono.CSharp { { for (int i = declarators.Count - 1; i >= 0; --i) { var d = declarators [i]; - var vd = new VariableDeclaration (d.Variable, type_expr.Location); + var vd = new VariableDeclaration (d.Variable, d.Variable.Location); vd.Initializer = d.Initializer; vd.IsNested = true; vd.dispose_call = CreateDisposeCall (bc, d.Variable); @@ -5947,7 +5962,7 @@ namespace Mono.CSharp { if (variable_ref == null) return false; - for_each.body.AddScopeStatement (new StatementExpression (new CompilerAssign (variable_ref, access, Location.Null), for_each.variable.Location)); + for_each.body.AddScopeStatement (new StatementExpression (new CompilerAssign (variable_ref, access, Location.Null), for_each.type.Location)); bool ok = true; @@ -6043,7 +6058,7 @@ namespace Mono.CSharp { var idisaposable_test = new Binary (Binary.Operator.Inequality, new CompilerAssign ( dispose_variable.CreateReferenceExpression (bc, loc), new As (lv.CreateReferenceExpression (bc, loc), new TypeExpression (dispose_variable.Type, loc), loc), - loc), new NullLiteral (loc), loc); + loc), new NullLiteral (loc)); var m = bc.Module.PredefinedMembers.IDisposableDispose.Resolve (loc); @@ -6258,7 +6273,7 @@ namespace Mono.CSharp { if (variable_ref == null) return false; - for_each.body.AddScopeStatement (new StatementExpression (new CompilerAssign (variable_ref, current_pe, Location.Null), variable.Location)); + for_each.body.AddScopeStatement (new StatementExpression (new CompilerAssign (variable_ref, current_pe, Location.Null), for_each.type.Location)); var init = new Invocation (get_enumerator_mg, null); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/support.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/support.cs index 35762dfeae..b4ac0c32a2 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/support.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/support.cs @@ -127,7 +127,7 @@ namespace Mono.CSharp { return true; } } - + #if !FULL_AST /// /// This is an arbitrarily seekable StreamReader wrapper. /// @@ -137,21 +137,23 @@ namespace Mono.CSharp { /// public class SeekableStreamReader : IDisposable { + public const int DefaultReadAheadSize = 2048; + StreamReader reader; Stream stream; - static char[] buffer; + char[] buffer; int read_ahead_length; // the length of read buffer int buffer_start; // in chars int char_count; // count of filled characters in buffer[] int pos; // index into buffer[] - public SeekableStreamReader (Stream stream, Encoding encoding) + public SeekableStreamReader (Stream stream, Encoding encoding, char[] sharedBuffer = null) { this.stream = stream; + this.buffer = sharedBuffer; - const int default_read_ahead = 2048; - InitializeStream (default_read_ahead); + InitializeStream (DefaultReadAheadSize); reader = new StreamReader (stream, encoding, true); } @@ -274,7 +276,7 @@ namespace Mono.CSharp { return buffer [pos++]; } } - +#endif public class UnixUtils { [System.Runtime.InteropServices.DllImport ("libc", EntryPoint="isatty")] extern static int _isatty (int fd); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/typemanager.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/typemanager.cs index 6eb3fc6e44..1a2b37eafb 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/typemanager.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/typemanager.cs @@ -144,7 +144,7 @@ namespace Mono.CSharp { var ctx = module.Compiler; foreach (var p in types) { - var found = PredefinedType.Resolve (module, p.Kind, p.Namespace, p.Name, p.Arity); + var found = PredefinedType.Resolve (module, p.Kind, p.Namespace, p.Name, p.Arity, true, true); if (found == null || found == p) continue; @@ -340,6 +340,7 @@ namespace Mono.CSharp public readonly PredefinedMember AsyncVoidMethodBuilderSetStateMachine; public readonly PredefinedMember AsyncVoidMethodBuilderOnCompleted; public readonly PredefinedMember AsyncVoidMethodBuilderOnCompletedUnsafe; + public readonly PredefinedMember AsyncStateMachineAttributeCtor; public readonly PredefinedMember DebuggerBrowsableAttributeCtor; public readonly PredefinedMember DecimalCtor; public readonly PredefinedMember DecimalCtorInt; @@ -357,6 +358,7 @@ namespace Mono.CSharp public readonly PredefinedMember IEnumerableGetEnumerator; public readonly PredefinedMember InterlockedCompareExchange; public readonly PredefinedMember InterlockedCompareExchange_T; + public readonly PredefinedMember IteratorStateMachineAttributeCtor; public readonly PredefinedMember FixedBufferAttributeCtor; public readonly PredefinedMember MethodInfoGetMethodFromHandle; public readonly PredefinedMember MethodInfoGetMethodFromHandle2; @@ -549,6 +551,10 @@ namespace Mono.CSharp }, false), btypes.Void)); + AsyncStateMachineAttributeCtor = new PredefinedMember (module, atypes.AsyncStateMachine, + MemberFilter.Constructor (ParametersCompiled.CreateFullyResolved ( + btypes.Type))); + DebuggerBrowsableAttributeCtor = new PredefinedMember (module, atypes.DebuggerBrowsable, MemberFilter.Constructor (null)); @@ -625,6 +631,10 @@ namespace Mono.CSharp }, false), null)); + IteratorStateMachineAttributeCtor = new PredefinedMember (module, atypes.IteratorStateMachine, + MemberFilter.Constructor (ParametersCompiled.CreateFullyResolved ( + btypes.Type))); + MethodInfoGetMethodFromHandle = new PredefinedMember (module, types.MethodBase, "GetMethodFromHandle", MemberKind.Method, types.RuntimeMethodHandle); @@ -748,7 +758,7 @@ namespace Mono.CSharp if (type != null) return true; - type = Resolve (module, kind, ns, name, arity, false); + type = Resolve (module, kind, ns, name, arity, false, false); return type != null; } @@ -757,17 +767,21 @@ namespace Mono.CSharp return ns + "." + name; } - public static TypeSpec Resolve (ModuleContainer module, MemberKind kind, string ns, string name, int arity) + public static TypeSpec Resolve (ModuleContainer module, MemberKind kind, string ns, string name, int arity, bool required, bool reportErrors) { - return Resolve (module, kind, ns, name, arity, true); - } + // + // Cannot call it with true because it could create non-existent namespaces for + // predefined types. It's set to true only for build-in types which all must + // exist therefore it does not matter, for predefined types we don't want to create + // fake namespaces when type is optional and does not exist (e.g. System.Linq). + // + Namespace type_ns = module.GlobalRootNamespace.GetNamespace (ns, required); + IList found = null; + if (type_ns != null) + found = type_ns.GetAllTypes (name); - public static TypeSpec Resolve (ModuleContainer module, MemberKind kind, string ns, string name, int arity, bool reportErrors) - { - Namespace type_ns = module.GlobalRootNamespace.GetNamespace (ns, true); - var found = type_ns.GetAllTypes (name); if (found == null) { - if (reportErrors) + if (reportErrors ) module.Compiler.Report.Error (518, "The predefined type `{0}.{1}' is not defined or imported", ns, name); return null; @@ -837,13 +851,13 @@ namespace Mono.CSharp public TypeSpec Resolve () { if (type == null) - type = Resolve (module, kind, ns, name, arity); + type = Resolve (module, kind, ns, name, arity, false, true); return type; } } - class PredefinedMember where T : MemberSpec + public class PredefinedMember where T : MemberSpec { readonly ModuleContainer module; T member; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/QueryExpressionExpander.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/QueryExpressionExpander.cs new file mode 100644 index 0000000000..35902a21a2 --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/QueryExpressionExpander.cs @@ -0,0 +1,357 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Linq; +using System.Text; +using ICSharpCode.NRefactory.PatternMatching; + +namespace ICSharpCode.NRefactory.CSharp { + public class QueryExpressionExpansionResult { + public AstNode AstNode { get; private set; } + + /// + /// Maps original range variables to some node in the new tree that represents them. + /// + public IDictionary RangeVariables { get; private set; } + + /// + /// Maps clauses to method calls. The keys will always be either a or a + /// + public IDictionary Expressions { get; private set; } + + public QueryExpressionExpansionResult(AstNode astNode, IDictionary rangeVariables, IDictionary expressions) { + AstNode = astNode; + RangeVariables = rangeVariables; + Expressions = expressions; + } + } + + public class QueryExpressionExpander { + class Visitor : DepthFirstAstVisitor { + int currentTransparentParameter; + const string TransparentParameterNameTemplate = "<>x{0}"; + + protected override AstNode VisitChildren(AstNode node) { + List newChildren = null; + + int i = 0; + foreach (var child in node.Children) { + var newChild = child.AcceptVisitor(this); + if (newChild != null) { + newChildren = newChildren ?? Enumerable.Repeat((AstNode)null, i).ToList(); + newChildren.Add(newChild); + } + else if (newChildren != null) { + newChildren.Add(null); + } + i++; + } + + if (newChildren == null) + return null; + + var result = node.Clone(); + + i = 0; + foreach (var children in result.Children) { + if (newChildren[i] != null) + children.ReplaceWith(newChildren[i]); + i++; + } + + return result; + } + + Expression MakeNestedMemberAccess(Expression target, IEnumerable members) { + return members.Aggregate(target, (current, m) => current.Member(m)); + } + + Expression VisitNested(Expression node, ParameterDeclaration transparentParameter) { + var oldRangeVariableSubstitutions = activeRangeVariableSubstitutions; + try { + if (transparentParameter != null && currentTransparentType.Count > 1) { + activeRangeVariableSubstitutions = new Dictionary(activeRangeVariableSubstitutions); + foreach (var t in currentTransparentType) + activeRangeVariableSubstitutions[t.Item1.Name] = MakeNestedMemberAccess(new IdentifierExpression(transparentParameter.Name), t.Item2); + } + var result = node.AcceptVisitor(this); + return (Expression)(result ?? node.Clone()); + } + finally { + activeRangeVariableSubstitutions = oldRangeVariableSubstitutions; + } + } + + QueryClause GetNextQueryClause(QueryClause clause) { + for (AstNode node = clause.NextSibling; node != null; node = node.NextSibling) { + if (node.Role == QueryExpression.ClauseRole) + return (QueryClause)node; + } + return null; + } + + public IDictionary rangeVariables = new Dictionary(); + public IDictionary expressions = new Dictionary(); + + Dictionary activeRangeVariableSubstitutions = new Dictionary(); + List>> currentTransparentType = new List>>(); + Expression currentResult; + bool eatSelect; + + void MapExpression(AstNode orig, Expression newExpr) { + Debug.Assert(orig is QueryClause || orig is QueryOrdering); + expressions[orig] = newExpr; + } + + ParameterDeclaration CreateParameterForCurrentRangeVariable() { + var param = new ParameterDeclaration(); + + if (currentTransparentType.Count == 1) { + var clonedRangeVariable = (Identifier)currentTransparentType[0].Item1.Clone(); + if (!rangeVariables.ContainsKey(currentTransparentType[0].Item1)) + rangeVariables[currentTransparentType[0].Item1] = param; + param.AddChild(clonedRangeVariable, Roles.Identifier); + } + else { + param.AddChild(Identifier.Create(string.Format(CultureInfo.InvariantCulture, TransparentParameterNameTemplate, currentTransparentParameter++)), Roles.Identifier); + } + return param; + } + + LambdaExpression CreateLambda(IList parameters, Expression body) { + var result = new LambdaExpression(); + if (parameters.Count > 1) + result.AddChild(new CSharpTokenNode(TextLocation.Empty), Roles.LPar); + result.AddChild(parameters[0], Roles.Parameter); + for (int i = 1; i < parameters.Count; i++) { + result.AddChild(new CSharpTokenNode(TextLocation.Empty), Roles.Comma); + result.AddChild(parameters[i], Roles.Parameter); + } + if (parameters.Count > 1) + result.AddChild(new CSharpTokenNode(TextLocation.Empty), Roles.RPar); + result.AddChild(body, LambdaExpression.BodyRole); + + return result; + } + + ParameterDeclaration CreateParameter(Identifier identifier) { + var result = new ParameterDeclaration(); + result.AddChild(identifier, Roles.Identifier); + return result; + } + + Expression AddMemberToCurrentTransparentType(ParameterDeclaration param, Identifier name, Expression value, bool namedExpression) { + Expression newAssignment = VisitNested(value, param); + if (namedExpression) { + newAssignment = new NamedExpression(name.Name, VisitNested(value, param)); + if (!rangeVariables.ContainsKey(name) ) + rangeVariables[name] = ((NamedExpression)newAssignment).NameToken; + } + + foreach (var t in currentTransparentType) + t.Item2.Insert(0, param.Name); + + currentTransparentType.Add(Tuple.Create(name, new List { name.Name })); + return new AnonymousTypeCreateExpression(new[] { new IdentifierExpression(param.Name), newAssignment }); + } + + void AddFirstMemberToCurrentTransparentType(Identifier identifier) { + Debug.Assert(currentTransparentType.Count == 0); + currentTransparentType.Add(Tuple.Create(identifier, new List())); + } + + public override AstNode VisitQueryExpression(QueryExpression queryExpression) { + var oldTransparentType = currentTransparentType; + var oldResult = currentResult; + var oldEatSelect = eatSelect; + try { + currentTransparentType = new List>>(); + currentResult = null; + eatSelect = false; + + foreach (var clause in queryExpression.Clauses) { + var result = (Expression)clause.AcceptVisitor(this); + MapExpression(clause, result ?? currentResult); + currentResult = result; + } + + return currentResult; + } + finally { + currentTransparentType = oldTransparentType; + currentResult = oldResult; + eatSelect = oldEatSelect; + } + } + + public override AstNode VisitQueryContinuationClause(QueryContinuationClause queryContinuationClause) { + var prev = VisitNested(queryContinuationClause.PrecedingQuery, null); + AddFirstMemberToCurrentTransparentType(queryContinuationClause.IdentifierToken); + return prev; + } + + public override AstNode VisitQueryFromClause(QueryFromClause queryFromClause) { + if (currentResult == null) { + AddFirstMemberToCurrentTransparentType(queryFromClause.IdentifierToken); + if (queryFromClause.Type.IsNull) { + return VisitNested(queryFromClause.Expression, null); + } + else { + return VisitNested(queryFromClause.Expression, null).Invoke("Cast", new[] { queryFromClause.Type.Clone() }, new Expression[0]); + } + } + else { + var innerSelectorParam = CreateParameterForCurrentRangeVariable(); + var innerSelector = CreateLambda(new[] { innerSelectorParam }, VisitNested(queryFromClause.Expression, innerSelectorParam)); + + var clonedIdentifier = (Identifier)queryFromClause.IdentifierToken.Clone(); + + var resultParam = CreateParameterForCurrentRangeVariable(); + Expression body; + // Second from clause - SelectMany + var select = GetNextQueryClause(queryFromClause) as QuerySelectClause; + if (select != null) { + body = VisitNested(select.Expression, resultParam); + eatSelect = true; + } + else { + body = AddMemberToCurrentTransparentType(resultParam, queryFromClause.IdentifierToken, new IdentifierExpression(queryFromClause.Identifier), false); + } + + var resultSelectorParam2 = CreateParameter(clonedIdentifier); + var resultSelector = CreateLambda(new[] { resultParam, resultSelectorParam2 }, body); + rangeVariables[queryFromClause.IdentifierToken] = resultSelectorParam2; + + return currentResult.Invoke("SelectMany", innerSelector, resultSelector); + } + } + + public override AstNode VisitQueryLetClause(QueryLetClause queryLetClause) { + var param = CreateParameterForCurrentRangeVariable(); + var body = AddMemberToCurrentTransparentType(param, queryLetClause.IdentifierToken, queryLetClause.Expression, true); + var lambda = CreateLambda(new[] { param }, body); + + return currentResult.Invoke("Select", lambda); + } + + public override AstNode VisitQueryWhereClause(QueryWhereClause queryWhereClause) { + var param = CreateParameterForCurrentRangeVariable(); + return currentResult.Invoke("Where", CreateLambda(new[] { param }, VisitNested(queryWhereClause.Condition, param))); + } + + public override AstNode VisitQueryJoinClause(QueryJoinClause queryJoinClause) { + Expression resultSelectorBody = null; + var inExpression = VisitNested(queryJoinClause.InExpression, null); + var key1SelectorFirstParam = CreateParameterForCurrentRangeVariable(); + var key1Selector = CreateLambda(new[] { key1SelectorFirstParam }, VisitNested(queryJoinClause.OnExpression, key1SelectorFirstParam)); + var key2Param = CreateParameter(Identifier.Create(queryJoinClause.JoinIdentifier)); + var key2Selector = CreateLambda(new[] { key2Param }, VisitNested(queryJoinClause.EqualsExpression, null)); + + var resultSelectorFirstParam = CreateParameterForCurrentRangeVariable(); + + var select = GetNextQueryClause(queryJoinClause) as QuerySelectClause; + if (select != null) { + resultSelectorBody = VisitNested(select.Expression, resultSelectorFirstParam); + eatSelect = true; + } + + if (queryJoinClause.IntoKeyword.IsNull) { + // Normal join + if (resultSelectorBody == null) + resultSelectorBody = AddMemberToCurrentTransparentType(resultSelectorFirstParam, queryJoinClause.JoinIdentifierToken, new IdentifierExpression(queryJoinClause.JoinIdentifier), false); + + var resultSelector = CreateLambda(new[] { resultSelectorFirstParam, CreateParameter(Identifier.Create(queryJoinClause.JoinIdentifier)) }, resultSelectorBody); + rangeVariables[queryJoinClause.JoinIdentifierToken] = key2Param; + return currentResult.Invoke("Join", inExpression, key1Selector, key2Selector, resultSelector); + } + else { + // Group join + if (resultSelectorBody == null) + resultSelectorBody = AddMemberToCurrentTransparentType(resultSelectorFirstParam, queryJoinClause.IntoIdentifierToken, new IdentifierExpression(queryJoinClause.IntoIdentifier), false); + + var intoParam = CreateParameter(Identifier.Create(queryJoinClause.IntoIdentifier)); + var resultSelector = CreateLambda(new[] { resultSelectorFirstParam, intoParam }, resultSelectorBody); + rangeVariables[queryJoinClause.IntoIdentifierToken] = intoParam; + + return currentResult.Invoke("GroupJoin", inExpression, key1Selector, key2Selector, resultSelector); + } + } + + public override AstNode VisitQueryOrderClause(QueryOrderClause queryOrderClause) { + var current = currentResult; + bool first = true; + foreach (var o in queryOrderClause.Orderings) { + string methodName = first ? (o.Direction == QueryOrderingDirection.Descending ? "OrderByDescending" : "OrderBy") + : (o.Direction == QueryOrderingDirection.Descending ? "ThenByDescending" : "ThenBy"); + + var param = CreateParameterForCurrentRangeVariable(); + current = current.Invoke(methodName, CreateLambda(new[] { param }, VisitNested(o.Expression, param))); + MapExpression(o, current); + first = false; + } + return current; + } + + bool IsSingleRangeVariable(Expression expr) { + if (currentTransparentType.Count > 1) + return false; + var unpacked = ParenthesizedExpression.UnpackParenthesizedExpression(expr); + return unpacked is IdentifierExpression && ((IdentifierExpression)unpacked).Identifier == currentTransparentType[0].Item1.Name; + } + + public override AstNode VisitQuerySelectClause(QuerySelectClause querySelectClause) { + if (eatSelect) { + eatSelect = false; + return currentResult; + } + else if (((QueryExpression)querySelectClause.Parent).Clauses.Count > 2 && IsSingleRangeVariable(querySelectClause.Expression)) { + // A simple query that ends with a trivial select should be removed. + return currentResult; + } + + var param = CreateParameterForCurrentRangeVariable(); + var lambda = CreateLambda(new[] { param }, VisitNested(querySelectClause.Expression, param)); + return currentResult.Invoke("Select", lambda); + } + + public override AstNode VisitQueryGroupClause(QueryGroupClause queryGroupClause) { + var param = CreateParameterForCurrentRangeVariable(); + var keyLambda = CreateLambda(new[] { param }, VisitNested(queryGroupClause.Key, param)); + + if (IsSingleRangeVariable(queryGroupClause.Projection)) { + // We are grouping by the single active range variable, so we can use the single argument form of GroupBy + return currentResult.Invoke("GroupBy", keyLambda); + } + else { + var projectionParam = CreateParameterForCurrentRangeVariable(); + var projectionLambda = CreateLambda(new[] { projectionParam }, VisitNested(queryGroupClause.Projection, projectionParam)); + return currentResult.Invoke("GroupBy", keyLambda, projectionLambda); + } + } + + public override AstNode VisitIdentifierExpression(IdentifierExpression identifierExpression) { + Expression subst; + activeRangeVariableSubstitutions.TryGetValue(identifierExpression.Identifier, out subst); + return subst != null ? subst.Clone() : null; + } + } + + /// + /// Expands all occurances of query patterns in the specified node. Returns a clone of the node with all query patterns expanded, or null if there was no query pattern to expand. + /// + /// + /// + public QueryExpressionExpansionResult ExpandQueryExpressions(AstNode node) { + var visitor = new Visitor(); + var astNode = node.AcceptVisitor(visitor); + if (astNode != null) { + astNode.Freeze(); + return new QueryExpressionExpansionResult(astNode, visitor.rangeVariables, visitor.expressions); + } + else { + return null; + } + } + } +} diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/BaseRefactoringContext.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/BaseRefactoringContext.cs index 449be597dc..56c7487a1c 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/BaseRefactoringContext.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/BaseRefactoringContext.cs @@ -72,9 +72,9 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring } } - public virtual CSharpParsedFile ParsedFile { + public virtual CSharpUnresolvedFile UnresolvedFile { get { - return resolver.ParsedFile; + return resolver.UnresolvedFile; } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateBackingStoreAction.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateBackingStoreAction.cs index 9d90ba3380..1c83f09586 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateBackingStoreAction.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateBackingStoreAction.cs @@ -46,6 +46,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring // create field var backingStore = new FieldDeclaration (); + if (property.Modifiers.HasFlag (Modifiers.Static)) + backingStore.Modifiers |= Modifiers.Static; backingStore.ReturnType = property.ReturnType.Clone (); var initializer = new VariableInitializer (backingStoreName); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/GeneratePropertyAction.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/GeneratePropertyAction.cs index 3f40e01725..291b507f75 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/GeneratePropertyAction.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/GeneratePropertyAction.cs @@ -1,4 +1,4 @@ -// +// // GenerateProperty.cs // // Author: @@ -51,7 +51,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring } } var field = initializer.Parent as FieldDeclaration; - if (field == null) { + if (field == null || field.HasModifier(Modifiers.Readonly) || field.HasModifier(Modifiers.Const)) { yield break; } var resolveResult = context.Resolve(initializer) as MemberResolveResult; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/InlineLocalVariableAction.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/InlineLocalVariableAction.cs index d24adf3783..a8bec696c8 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/InlineLocalVariableAction.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/InlineLocalVariableAction.cs @@ -1,4 +1,4 @@ -// +// // InlineLocalVariableAction.cs // // Author: @@ -53,12 +53,12 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring if (resolveResult == null || resolveResult.IsError) { yield break; } - var unit = context.RootNode as CompilationUnit; + var unit = context.RootNode as SyntaxTree; if (unit == null) { yield break; } yield return new CodeAction(context.TranslateString("Inline local variable"), script => { - refFinder.FindLocalReferences(resolveResult.Variable, context.ParsedFile, unit, context.Compilation, (n, r) => script.Replace(n, initializer.Initializer.Clone()), default(CancellationToken)); + refFinder.FindLocalReferences(resolveResult.Variable, context.UnresolvedFile, unit, context.Compilation, (n, r) => script.Replace(n, initializer.Initializer.Clone()), default(CancellationToken)); script.Remove(node); }); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantThisIssue.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantThisIssue.cs index 5a6d538e0a..c3b840d43a 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantThisIssue.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantThisIssue.cs @@ -45,6 +45,21 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring IssueMarker = IssueMarker.GrayOut)] public class RedundantThisIssue : ICodeIssueProvider { + bool ignoreConstructors = true; + + /// + /// Specifies whether to ignore redundant 'this' in constructors. + /// "this.Name = name;" + /// + public bool IgnoreConstructors { + get { + return ignoreConstructors; + } + set { + ignoreConstructors = value; + } + } + public IEnumerable GetIssues(BaseRefactoringContext context) { return new GatherVisitor(context, this).GetIssues(); @@ -69,6 +84,13 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring return null; } + + public override void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration) + { + if (inspector.IgnoreConstructors) + return; + base.VisitConstructorDeclaration(constructorDeclaration); + } public override void VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression) { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/DocumentScript.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/DocumentScript.cs index 157f9f688e..f472880a68 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/DocumentScript.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/DocumentScript.cs @@ -98,9 +98,9 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring public override void FormatText(AstNode node) { var segment = GetSegment(node); - var cu = CompilationUnit.Parse(currentDocument, "dummy.cs"); + var syntaxTree = SyntaxTree.Parse(currentDocument, "dummy.cs"); var formatter = new AstFormattingVisitor(FormattingOptions, currentDocument, Options); - cu.AcceptVisitor(formatter); + syntaxTree.AcceptVisitor(formatter); formatter.ApplyChanges(segment.Offset, segment.Length); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/ICodeIssueProvider.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/ICodeIssueProvider.cs index 45816dfa8c..b16e677c03 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/ICodeIssueProvider.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/ICodeIssueProvider.cs @@ -1,4 +1,4 @@ -// +// // IInspector.cs // // Author: @@ -29,12 +29,12 @@ using System.Collections.Generic; namespace ICSharpCode.NRefactory.CSharp.Refactoring { /// - /// The code issue provider gets a list of all code issues in a compilation unit. + /// The code issue provider gets a list of all code issues in a syntax tree. /// public interface ICodeIssueProvider { /// - /// Gets all code issues inside a compilation unit. + /// Gets all code issues inside a syntax tree. /// /// /// The refactoring context of the issues to get. diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs index 2c29f68842..3f1ea52811 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Refactoring/TypeSystemAstBuilder.cs @@ -593,12 +593,13 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring } } - Accessor ConvertAccessor(IMethod accessor) + Accessor ConvertAccessor(IMethod accessor, Accessibility ownerAccessibility) { if (accessor == null) return Accessor.Null; Accessor decl = new Accessor(); - decl.Modifiers = ModifierFromAccessibility(accessor.Accessibility); + if (accessor.Accessibility != ownerAccessibility) + decl.Modifiers = ModifierFromAccessibility(accessor.Accessibility); decl.Body = GenerateBodyBlock(); return decl; } @@ -609,8 +610,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring decl.Modifiers = GetMemberModifiers(property); decl.ReturnType = ConvertType(property.ReturnType); decl.Name = property.Name; - decl.Getter = ConvertAccessor(property.Getter); - decl.Setter = ConvertAccessor(property.Setter); + decl.Getter = ConvertAccessor(property.Getter, property.Accessibility); + decl.Setter = ConvertAccessor(property.Setter, property.Accessibility); return decl; } @@ -622,8 +623,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring foreach (IParameter p in indexer.Parameters) { decl.Parameters.Add(ConvertParameter(p)); } - decl.Getter = ConvertAccessor(indexer.Getter); - decl.Setter = ConvertAccessor(indexer.Setter); + decl.Getter = ConvertAccessor(indexer.Getter, indexer.Accessibility); + decl.Setter = ConvertAccessor(indexer.Setter, indexer.Accessibility); return decl; } @@ -634,8 +635,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring decl.Modifiers = GetMemberModifiers(ev); decl.ReturnType = ConvertType(ev.ReturnType); decl.Name = ev.Name; - decl.AddAccessor = ConvertAccessor(ev.AddAccessor); - decl.RemoveAccessor = ConvertAccessor(ev.RemoveAccessor); + decl.AddAccessor = ConvertAccessor(ev.AddAccessor, ev.Accessibility); + decl.RemoveAccessor = ConvertAccessor(ev.RemoveAccessor, ev.Accessibility); return decl; } else { EventDeclaration decl = new EventDeclaration(); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpAstResolver.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpAstResolver.cs index 234e17f261..6b33502c70 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpAstResolver.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpAstResolver.cs @@ -33,7 +33,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { readonly CSharpResolver initialResolverState; readonly AstNode rootNode; - readonly CSharpParsedFile parsedFile; + readonly CSharpUnresolvedFile unresolvedFile; readonly ResolveVisitor resolveVisitor; bool resolverInitialized; @@ -42,50 +42,50 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// Use this overload if you are resolving within a complete C# file. /// /// The current compilation. - /// The compilation unit corresponding to the specified parsed file. - /// - /// Optional: Result of the for the file being resolved. + /// The syntax tree to be resolved. + /// + /// Optional: Result of for the file being resolved. /// - /// This is used for setting up the context on the resolver. The parsed file must be registered in the compilation. + /// This is used for setting up the context on the resolver. The unresolved file must be registered in the compilation. /// /// - /// When a parsedFile is specified, the resolver will use the member's StartLocation/EndLocation to identify + /// When a unresolvedFile is specified, the resolver will use the member's StartLocation/EndLocation to identify /// member declarations in the AST with members in the type system. - /// When no parsedFile is specified (null value for this parameter), the resolver will instead compare the + /// When no unresolvedFile is specified (null value for this parameter), the resolver will instead compare the /// member's signature in the AST with the signature in the type system. /// /// - public CSharpAstResolver(ICompilation compilation, CompilationUnit compilationUnit, CSharpParsedFile parsedFile = null) + public CSharpAstResolver(ICompilation compilation, SyntaxTree syntaxTree, CSharpUnresolvedFile unresolvedFile = null) { if (compilation == null) throw new ArgumentNullException("compilation"); - if (compilationUnit == null) - throw new ArgumentNullException("compilationUnit"); + if (syntaxTree == null) + throw new ArgumentNullException("syntaxTree"); this.initialResolverState = new CSharpResolver(compilation); - this.rootNode = compilationUnit; - this.parsedFile = parsedFile; - this.resolveVisitor = new ResolveVisitor(initialResolverState, parsedFile); + this.rootNode = syntaxTree; + this.unresolvedFile = unresolvedFile; + this.resolveVisitor = new ResolveVisitor(initialResolverState, unresolvedFile); } /// /// Creates a new C# AST resolver. /// Use this overload if you are resolving code snippets (not necessarily complete files). /// - /// The resolver state at the root node (to be more precise: outside the root node). - /// The root node of the resolved tree. - /// - /// Optional: Result of the for the file being resolved. + /// The resolver state at the root node (to be more precise: just outside the root node). + /// The root node of the tree to be resolved. + /// + /// Optional: Result of for the file being resolved. /// - /// This is used for setting up the context on the resolver. The parsed file must be registered in the compilation. + /// This is used for setting up the context on the resolver. The unresolved file must be registered in the compilation. /// /// - /// When a parsedFile is specified, the resolver will use the member's StartLocation/EndLocation to identify + /// When a unresolvedFile is specified, the resolver will use the member's StartLocation/EndLocation to identify /// member declarations in the AST with members in the type system. - /// When no parsedFile is specified (null value for this parameter), the resolver will instead compare the + /// When no unresolvedFile is specified (null value for this parameter), the resolver will instead compare the /// member's signature in the AST with the signature in the type system. /// /// - public CSharpAstResolver(CSharpResolver resolver, AstNode rootNode, CSharpParsedFile parsedFile = null) + public CSharpAstResolver(CSharpResolver resolver, AstNode rootNode, CSharpUnresolvedFile unresolvedFile = null) { if (resolver == null) throw new ArgumentNullException("resolver"); @@ -93,8 +93,8 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver throw new ArgumentNullException("rootNode"); this.initialResolverState = resolver; this.rootNode = rootNode; - this.parsedFile = parsedFile; - this.resolveVisitor = new ResolveVisitor(initialResolverState, parsedFile); + this.unresolvedFile = unresolvedFile; + this.resolveVisitor = new ResolveVisitor(initialResolverState, unresolvedFile); } /// @@ -119,11 +119,11 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver } /// - /// Gets the parsed file used by this CSharpAstResolver. + /// Gets the unresolved file used by this CSharpAstResolver. /// Can return null. /// - public CSharpParsedFile ParsedFile { - get { return parsedFile; } + public CSharpUnresolvedFile UnresolvedFile { + get { return unresolvedFile; } } /// @@ -275,7 +275,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver } return true; } - return (node.NodeType == NodeType.Whitespace || node is ArraySpecifier || node is NamedArgumentExpression); + return (node.NodeType == NodeType.Whitespace || node is ArraySpecifier); } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpConversions.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpConversions.cs index d45ba6c7ca..0d62ae1e7a 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpConversions.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpConversions.cs @@ -218,8 +218,6 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver if (toType == null) throw new ArgumentNullException("toType"); - if (fromType.Kind == TypeKind.Dynamic) - return Conversion.ExplicitDynamicConversion; Conversion c = ImplicitConversion(fromType, toType); if (c.IsValid) return c; @@ -236,23 +234,18 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver if (ExplicitEnumerationConversion(fromType, toType)) return Conversion.EnumerationConversion(false, false); Conversion c = ExplicitNullableConversion(fromType, toType); - if (c.IsValid) - return c; - c = UserDefinedExplicitConversion(fromType, toType); if (c.IsValid) return c; if (ExplicitReferenceConversion(fromType, toType)) return Conversion.ExplicitReferenceConversion; if (UnboxingConversion(fromType, toType)) return Conversion.UnboxingConversion; - if (ExplicitTypeParameterConversion(fromType, toType)) { - // Explicit type parameter conversions that aren't also - // reference conversions are considered to be unboxing conversions - return Conversion.UnboxingConversion; - } + c = ExplicitTypeParameterConversion(fromType, toType); + if (c.IsValid) + return c; if (ExplicitPointerConversion(fromType, toType)) return Conversion.ExplicitPointerConversion; - return Conversion.None; + return UserDefinedExplicitConversion(fromType, toType); } #endregion @@ -412,8 +405,11 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { // C# 4.0 spec: §6.1.6 - // reference conversions are possible only if both types are known to be reference types - if (!(fromType.IsReferenceType == true && toType.IsReferenceType == true)) + // reference conversions are possible: + // - if both types are known to be reference types + // - if both types are type parameters and fromType has a class constraint + // (ImplicitTypeParameterConversionWithClassConstraintOnlyOnT) + if (!(fromType.IsReferenceType == true && toType.IsReferenceType != false)) return false; ArrayType fromArray = fromType as ArrayType; @@ -425,24 +421,37 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver && ImplicitReferenceConversion(fromArray.ElementType, toArray.ElementType, subtypeCheckNestingDepth); } // conversion from single-dimensional array S[] to IList: - ParameterizedType toPT = toType as ParameterizedType; - if (fromArray.Dimensions == 1 && toPT != null && toPT.TypeParameterCount == 1 - && toPT.Namespace == "System.Collections.Generic" - && (toPT.Name == "IList" || toPT.Name == "ICollection" || toPT.Name == "IEnumerable" || toPT.Name == "IReadOnlyList")) - { + IType toTypeArgument = UnpackGenericArrayInterface(toType); + if (fromArray.Dimensions == 1 && toTypeArgument != null) { // array covariance plays a part here as well (string[] is IList) - return IdentityConversion(fromArray.ElementType, toPT.GetTypeArgument(0)) - || ImplicitReferenceConversion(fromArray.ElementType, toPT.GetTypeArgument(0), subtypeCheckNestingDepth); + return IdentityConversion(fromArray.ElementType, toTypeArgument) + || ImplicitReferenceConversion(fromArray.ElementType, toTypeArgument, subtypeCheckNestingDepth); } // conversion from any array to System.Array and the interfaces it implements: IType systemArray = compilation.FindType(KnownTypeCode.Array); - return systemArray.Kind != TypeKind.Unknown && (systemArray.Equals(toType) || ImplicitReferenceConversion(systemArray, toType, subtypeCheckNestingDepth)); + return ImplicitReferenceConversion(systemArray, toType, subtypeCheckNestingDepth); } // now comes the hard part: traverse the inheritance chain and figure out generics+variance return IsSubtypeOf(fromType, toType, subtypeCheckNestingDepth); } + /// + /// For IList{T}, ICollection{T}, IEnumerable{T} and IReadOnlyList{T}, returns T. + /// Otherwise, returns null. + /// + IType UnpackGenericArrayInterface(IType interfaceType) + { + ParameterizedType pt = interfaceType as ParameterizedType; + if (pt != null) { + KnownTypeCode tc = pt.GetDefinition().KnownTypeCode; + if (tc == KnownTypeCode.IListOfT || tc == KnownTypeCode.ICollectionOfT || tc == KnownTypeCode.IEnumerableOfT || tc == KnownTypeCode.IReadOnlyListOfT) { + return pt.GetTypeArgument(0); + } + } + return null; + } + // Determines whether s is a subtype of t. // Helper method used for ImplicitReferenceConversion, BoxingConversion and ImplicitTypeParameterConversion @@ -513,13 +522,92 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { // C# 4.0 spec: §6.2.4 - // reference conversions are possible only if both types are known to be reference types - if (!(fromType.IsReferenceType == true && toType.IsReferenceType == true)) + // test that the types are reference types: + if (toType.IsReferenceType != true) return false; + if (fromType.IsReferenceType != true) { + // special case: + // converting from F to T is a reference conversion where T : class, F + // (because F actually must be a reference type as well, even though C# doesn't treat it as one) + if (fromType.Kind == TypeKind.TypeParameter) + return IsSubtypeOf(toType, fromType, 0); + return false; + } - // There's lots of additional rules, but they're not really relevant, - // as they are only used to identify invalid casts, and we currently don't care about reporting those. - return true; + if (toType.Kind == TypeKind.Array) { + ArrayType toArray = (ArrayType)toType; + if (fromType.Kind == TypeKind.Array) { + // Array covariance + ArrayType fromArray = (ArrayType)fromType; + if (fromArray.Dimensions != toArray.Dimensions) + return false; + return ExplicitReferenceConversion(fromArray.ElementType, toArray.ElementType); + } + IType fromTypeArgument = UnpackGenericArrayInterface(fromType); + if (fromTypeArgument != null && toArray.Dimensions == 1) { + return ExplicitReferenceConversion(fromTypeArgument, toArray.ElementType) + || IdentityConversion(fromTypeArgument, toArray.ElementType); + } + // Otherwise treat the array like a sealed class - require implicit conversion in the opposite direction + return IsImplicitReferenceConversion(toType, fromType); + } else if (fromType.Kind == TypeKind.Array) { + ArrayType fromArray = (ArrayType)fromType; + IType toTypeArgument = UnpackGenericArrayInterface(toType); + if (toTypeArgument != null && fromArray.Dimensions == 1) { + return ExplicitReferenceConversion(fromArray.ElementType, toTypeArgument); + } + // Otherwise treat the array like a sealed class + return IsImplicitReferenceConversion(fromType, toType); + } else if (fromType.Kind == TypeKind.Delegate && toType.Kind == TypeKind.Delegate) { + ITypeDefinition def = fromType.GetDefinition(); + if (def == null || !def.Equals(toType.GetDefinition())) + return false; + ParameterizedType ps = fromType as ParameterizedType; + ParameterizedType pt = toType as ParameterizedType; + if (ps == null || pt == null) { + // non-generic delegate - return true for the identity conversion + return ps == null && pt == null; + } + for (int i = 0; i < def.TypeParameters.Count; i++) { + IType si = ps.GetTypeArgument(i); + IType ti = pt.GetTypeArgument(i); + if (IdentityConversion(si, ti)) + continue; + ITypeParameter xi = def.TypeParameters[i]; + switch (xi.Variance) { + case VarianceModifier.Covariant: + if (!ExplicitReferenceConversion(si, ti)) + return false; + break; + case VarianceModifier.Contravariant: + if (!(si.IsReferenceType == true && ti.IsReferenceType == true)) + return false; + break; + default: + return false; + } + } + return true; + } else if (IsSealedReferenceType(fromType)) { + // If the source type is sealed, explicit conversions can't do anything more than implicit ones + return IsImplicitReferenceConversion(fromType, toType); + } else if (IsSealedReferenceType(toType)) { + // The the target type is sealed, there must be an implicit conversion in the opposite direction + return IsImplicitReferenceConversion(toType, fromType); + } else { + if (fromType.Kind == TypeKind.Interface || toType.Kind == TypeKind.Interface) + return true; + else + return IsImplicitReferenceConversion(toType, fromType) + || IsImplicitReferenceConversion(fromType, toType); + } + } + + bool IsSealedReferenceType(IType type) + { + TypeKind kind = type.Kind; + return kind == TypeKind.Class && type.GetDefinition().IsSealed + || kind == TypeKind.Delegate || kind == TypeKind.Anonymous; } #endregion @@ -589,13 +677,18 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver return IsSubtypeOf(fromType, toType, 0); } - bool ExplicitTypeParameterConversion(IType fromType, IType toType) + Conversion ExplicitTypeParameterConversion(IType fromType, IType toType) { if (toType.Kind == TypeKind.TypeParameter) { - return fromType.Kind == TypeKind.TypeParameter || fromType.IsReferenceType == true; + // Explicit type parameter conversions that aren't also + // reference conversions are considered to be unboxing conversions + if (fromType.Kind == TypeKind.Interface || IsSubtypeOf(toType, fromType, 0)) + return Conversion.UnboxingConversion; } else { - return fromType.Kind == TypeKind.TypeParameter && toType.Kind == TypeKind.Interface; + if (fromType.Kind == TypeKind.TypeParameter && toType.Kind == TypeKind.Interface) + return Conversion.BoxingConversion; } + return Conversion.None; } #endregion diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpInvocationResolveResult.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpInvocationResolveResult.cs index 401365a5c9..e1e34a2606 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpInvocationResolveResult.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpInvocationResolveResult.cs @@ -96,10 +96,15 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver mappedTo = IsExpandedForm ? Math.Min(i, results.Length - 1) : i; if (mappedTo >= 0 && mappedTo < results.Length) { - if (IsExpandedForm && mappedTo == results.Length - 1) + if (IsExpandedForm && mappedTo == results.Length - 1) { paramsArguments.Add(Arguments[i]); - else - results[mappedTo] = Arguments[i]; + } else { + var narr = Arguments[i] as NamedArgumentResolveResult; + if (narr != null) + results[mappedTo] = narr.Argument; + else + results[mappedTo] = Arguments[i]; + } } } if (IsExpandedForm) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpResolver.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpResolver.cs index 20d34852fb..5542338aeb 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpResolver.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpResolver.cs @@ -1883,6 +1883,20 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver #endregion #region ResolveInvocation + + IList AddArgumentNamesIfNecessary(ResolveResult[] arguments, string[] argumentNames) { + if (argumentNames == null) { + return arguments; + } + else { + var result = new ResolveResult[arguments.Length]; + for (int i = 0; i < arguments.Length; i++) { + result[i] = (argumentNames[i] != null ? new NamedArgumentResolveResult(argumentNames[i], arguments[i]) : arguments[i]); + } + return result; + } + } + /// /// Resolves an invocation. /// @@ -1900,7 +1914,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver // C# 4.0 spec: §7.6.5 if (target.Type.Kind == TypeKind.Dynamic) { - return new DynamicInvocationResolveResult(target, DynamicInvocationType.Invocation, arguments.Select((a, i) => new DynamicInvocationArgument(argumentNames != null ? argumentNames[i] : null, a)).ToList().AsReadOnly()); + return new DynamicInvocationResolveResult(target, DynamicInvocationType.Invocation, AddArgumentNamesIfNecessary(arguments, argumentNames)); } MethodGroupResolveResult mgrr = target as MethodGroupResolveResult; @@ -1923,7 +1937,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver l.Add(new MethodListWithDeclaringType(m.DeclaringType)); l[l.Count - 1].Add(m.Method); } - return new DynamicInvocationResolveResult(new MethodGroupResolveResult(actualTarget, mgrr.MethodName, l, mgrr.TypeArguments), DynamicInvocationType.Invocation, arguments.Select((a, i) => new DynamicInvocationArgument(argumentNames != null ? argumentNames[i] : null, a)).ToList().AsReadOnly()); + return new DynamicInvocationResolveResult(new MethodGroupResolveResult(actualTarget, mgrr.MethodName, l, mgrr.TypeArguments), DynamicInvocationType.Invocation, AddArgumentNamesIfNecessary(arguments, argumentNames)); } } @@ -1954,7 +1968,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver or.AddCandidate(invokeMethod); return new CSharpInvocationResolveResult( target, invokeMethod, //invokeMethod.ReturnType.Resolve(context), - or.GetArgumentsWithConversions(), or.BestCandidateErrors, + or.GetArgumentsWithConversionsAndNames(), or.BestCandidateErrors, isExpandedForm: or.BestCandidateIsExpandedForm, isDelegateInvocation: true, argumentToParameterMap: or.GetArgumentToParameterMap()); @@ -2065,7 +2079,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { switch (target.Type.Kind) { case TypeKind.Dynamic: - return new DynamicInvocationResolveResult(target, DynamicInvocationType.Indexing, arguments.Select((a, i) => new DynamicInvocationArgument(argumentNames != null ? argumentNames[i] : null, a)).ToList().AsReadOnly()); + return new DynamicInvocationResolveResult(target, DynamicInvocationType.Indexing, AddArgumentNamesIfNecessary(arguments, argumentNames)); case TypeKind.Array: case TypeKind.Pointer: @@ -2085,7 +2099,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver var applicableIndexers = indexers.SelectMany(x => x).Where(m => OverloadResolution.IsApplicable(or2.AddCandidate(m))).ToList(); if (applicableIndexers.Count > 1) { - return new DynamicInvocationResolveResult(target, DynamicInvocationType.Indexing, arguments.Select((a, i) => new DynamicInvocationArgument(argumentNames != null ? argumentNames[i] : null, a)).ToList().AsReadOnly()); + return new DynamicInvocationResolveResult(target, DynamicInvocationType.Indexing, AddArgumentNamesIfNecessary(arguments, argumentNames)); } } @@ -2166,7 +2180,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver if (allApplicable != null && allApplicable.Count > 1) { // If we have dynamic arguments, we need to represent the invocation as a dynamic invocation if there is more than one applicable constructor. - return new DynamicInvocationResolveResult(new MethodGroupResolveResult(null, allApplicable[0].Name, new[] { new MethodListWithDeclaringType(type, allApplicable) }, null), DynamicInvocationType.ObjectCreation, arguments.Select((a, i) => new DynamicInvocationArgument(argumentNames != null ? argumentNames[i] : null, a)).ToList().AsReadOnly(), initializerStatements); + return new DynamicInvocationResolveResult(new MethodGroupResolveResult(null, allApplicable[0].Name, new[] { new MethodListWithDeclaringType(type, allApplicable) }, null), DynamicInvocationType.ObjectCreation, AddArgumentNamesIfNecessary(arguments, argumentNames), initializerStatements); } if (or.BestCandidate != null) { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/DetectSkippableNodesNavigator.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/DetectSkippableNodesNavigator.cs index 454a30bc94..69cab8dcd8 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/DetectSkippableNodesNavigator.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/DetectSkippableNodesNavigator.cs @@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { /// /// When an is searching for specific nodes - /// (e.g. all IdentifierExpressions), it has to scan the whole compilation unit for those nodes. + /// (e.g. all IdentifierExpressions), it has to scan the whole syntax tree for those nodes. /// However, scanning in the ResolveVisitor is expensive (e.g. any lambda that is scanned must be resolved), /// so it makes sense to detect when a whole subtree is scan-only, and skip that tree instead. /// diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/DynamicInvocationResolveResult.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/DynamicInvocationResolveResult.cs index b720d68b74..1f92f608cf 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/DynamicInvocationResolveResult.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/DynamicInvocationResolveResult.cs @@ -25,26 +25,6 @@ using ICSharpCode.NRefactory.TypeSystem; namespace ICSharpCode.NRefactory.CSharp.Resolver { - /// - /// Represents a single argument in a dynamic invocation. - /// - public class DynamicInvocationArgument { - /// - /// Parameter name, if the argument is named. Null otherwise. - /// - public readonly string Name; - - /// - /// Value of the argument. - /// - public readonly ResolveResult Value; - - public DynamicInvocationArgument(string name, ResolveResult value) { - Name = name; - Value = value; - } - } - public enum DynamicInvocationType { /// /// The invocation is a normal invocation ( 'a(b)' ). @@ -78,9 +58,9 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver public readonly DynamicInvocationType InvocationType; /// - /// Arguments for the call. + /// Arguments for the call. Named arguments will be instances of . /// - public readonly IList Arguments; + public readonly IList Arguments; /// /// Gets the list of initializer statements that are appplied to the result of this invocation. @@ -91,10 +71,10 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// public readonly IList InitializerStatements; - public DynamicInvocationResolveResult(ResolveResult target, DynamicInvocationType invocationType, IList arguments, IList initializerStatements = null) : base(SpecialType.Dynamic) { + public DynamicInvocationResolveResult(ResolveResult target, DynamicInvocationType invocationType, IList arguments, IList initializerStatements = null) : base(SpecialType.Dynamic) { this.Target = target; this.InvocationType = invocationType; - this.Arguments = arguments ?? EmptyList.Instance; + this.Arguments = arguments ?? EmptyList.Instance; this.InitializerStatements = initializerStatements ?? EmptyList.Instance; } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/FindReferences.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/FindReferences.cs index ce8201d7f9..c269f581d1 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/FindReferences.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/FindReferences.cs @@ -290,7 +290,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// /// Gets the file names that possibly contain references to the element being searched for. /// - public IEnumerable GetInterestingFiles(IFindReferenceSearchScope searchScope, ICompilation compilation) + public IEnumerable GetInterestingFiles(IFindReferenceSearchScope searchScope, ICompilation compilation) { if (searchScope == null) throw new ArgumentNullException("searchScope"); @@ -303,47 +303,47 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver ITypeDefinition topLevelTypeDef = compilation.Import(searchScope.TopLevelTypeDefinition); if (topLevelTypeDef == null) { // This compilation cannot have references to the target entity. - return EmptyList.Instance; + return EmptyList.Instance; } switch (searchScope.Accessibility) { case Accessibility.None: case Accessibility.Private: if (topLevelTypeDef.ParentAssembly == compilation.MainAssembly) - return topLevelTypeDef.Parts.Select(p => p.ParsedFile).OfType().Distinct(); + return topLevelTypeDef.Parts.Select(p => p.UnresolvedFile).OfType().Distinct(); else - return EmptyList.Instance; + return EmptyList.Instance; case Accessibility.Protected: return GetInterestingFilesProtected(topLevelTypeDef); case Accessibility.Internal: if (topLevelTypeDef.ParentAssembly.InternalsVisibleTo(compilation.MainAssembly)) - return pc.Files.OfType(); + return pc.Files.OfType(); else - return EmptyList.Instance; + return EmptyList.Instance; case Accessibility.ProtectedAndInternal: if (topLevelTypeDef.ParentAssembly.InternalsVisibleTo(compilation.MainAssembly)) return GetInterestingFilesProtected(topLevelTypeDef); else - return EmptyList.Instance; + return EmptyList.Instance; case Accessibility.ProtectedOrInternal: if (topLevelTypeDef.ParentAssembly.InternalsVisibleTo(compilation.MainAssembly)) - return pc.Files.OfType(); + return pc.Files.OfType(); else return GetInterestingFilesProtected(topLevelTypeDef); default: - return pc.Files.OfType(); + return pc.Files.OfType(); } } else { - return pc.Files.OfType(); + return pc.Files.OfType(); } } - IEnumerable GetInterestingFilesProtected(ITypeDefinition referencedTypeDefinition) + IEnumerable GetInterestingFilesProtected(ITypeDefinition referencedTypeDefinition) { return (from typeDef in referencedTypeDefinition.Compilation.MainAssembly.GetAllTypeDefinitions() where typeDef.IsDerivedFrom(referencedTypeDefinition) from part in typeDef.Parts - select part.ParsedFile - ).OfType().Distinct(); + select part.UnresolvedFile + ).OfType().Distinct(); } #endregion @@ -352,37 +352,37 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// Finds all references in the given file. /// /// The search scope for which to look. - /// The type system representation of the file being searched. - /// The compilation unit of the file being searched. + /// The type system representation of the file being searched. + /// The syntax tree of the file being searched. /// The compilation for the project that contains the file. /// Callback used to report the references that were found. /// CancellationToken that may be used to cancel the operation. - public void FindReferencesInFile(IFindReferenceSearchScope searchScope, CSharpParsedFile parsedFile, CompilationUnit compilationUnit, + public void FindReferencesInFile(IFindReferenceSearchScope searchScope, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken) { if (searchScope == null) throw new ArgumentNullException("searchScope"); - FindReferencesInFile(new[] { searchScope }, parsedFile, compilationUnit, compilation, callback, cancellationToken); + FindReferencesInFile(new[] { searchScope }, unresolvedFile, syntaxTree, compilation, callback, cancellationToken); } /// /// Finds all references in the given file. /// /// The search scopes for which to look. - /// The type system representation of the file being searched. - /// The compilation unit of the file being searched. + /// The type system representation of the file being searched. + /// The syntax tree of the file being searched. /// The compilation for the project that contains the file. /// Callback used to report the references that were found. /// CancellationToken that may be used to cancel the operation. - public void FindReferencesInFile(IList searchScopes, CSharpParsedFile parsedFile, CompilationUnit compilationUnit, + public void FindReferencesInFile(IList searchScopes, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken) { if (searchScopes == null) throw new ArgumentNullException("searchScopes"); - if (parsedFile == null) - throw new ArgumentNullException("parsedFile"); - if (compilationUnit == null) - throw new ArgumentNullException("compilationUnit"); + if (unresolvedFile == null) + throw new ArgumentNullException("unresolvedFile"); + if (syntaxTree == null) + throw new ArgumentNullException("syntaxTree"); if (compilation == null) throw new ArgumentNullException("compilation"); if (callback == null) @@ -402,9 +402,9 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver } cancellationToken.ThrowIfCancellationRequested(); - combinedNavigator = new DetectSkippableNodesNavigator(combinedNavigator, compilationUnit); + combinedNavigator = new DetectSkippableNodesNavigator(combinedNavigator, syntaxTree); cancellationToken.ThrowIfCancellationRequested(); - CSharpAstResolver resolver = new CSharpAstResolver(compilation, compilationUnit, parsedFile); + CSharpAstResolver resolver = new CSharpAstResolver(compilation, syntaxTree, unresolvedFile); resolver.ApplyNavigator(combinedNavigator, cancellationToken); foreach (var n in navigators) { var frn = n as FindReferenceNavigator; @@ -1171,19 +1171,19 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// Finds all references of a given variable. /// /// The variable for which to look. - /// The type system representation of the file being searched. - /// The compilation unit of the file being searched. + /// The type system representation of the file being searched. + /// The syntax tree of the file being searched. /// The compilation. /// Callback used to report the references that were found. /// Cancellation token that may be used to cancel the operation. - public void FindLocalReferences(IVariable variable, CSharpParsedFile parsedFile, CompilationUnit compilationUnit, + public void FindLocalReferences(IVariable variable, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken) { if (variable == null) throw new ArgumentNullException("variable"); var searchScope = new SearchScope(c => new FindLocalReferencesNavigator(variable)); searchScope.declarationCompilation = compilation; - FindReferencesInFile(searchScope, parsedFile, compilationUnit, compilation, callback, cancellationToken); + FindReferencesInFile(searchScope, unresolvedFile, syntaxTree, compilation, callback, cancellationToken); } class FindLocalReferencesNavigator : FindReferenceNavigator @@ -1225,12 +1225,12 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// Finds all references of a given type parameter. /// /// The type parameter for which to look. - /// The type system representation of the file being searched. - /// The compilation unit of the file being searched. + /// The type system representation of the file being searched. + /// The syntax tree of the file being searched. /// The compilation. /// Callback used to report the references that were found. /// Cancellation token that may be used to cancel the operation. - public void FindTypeParameterReferences(IType typeParameter, CSharpParsedFile parsedFile, CompilationUnit compilationUnit, + public void FindTypeParameterReferences(IType typeParameter, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken) { if (typeParameter == null) @@ -1240,7 +1240,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver var searchScope = new SearchScope(c => new FindTypeParameterReferencesNavigator((ITypeParameter)typeParameter)); searchScope.declarationCompilation = compilation; searchScope.accessibility = Accessibility.Private; - FindReferencesInFile(searchScope, parsedFile, compilationUnit, compilation, callback, cancellationToken); + FindReferencesInFile(searchScope, unresolvedFile, syntaxTree, compilation, callback, cancellationToken); } class FindTypeParameterReferencesNavigator : FindReferenceNavigator diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/Log.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/Log.cs index a167cd6999..9e85f451f0 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/Log.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/Log.cs @@ -19,12 +19,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Globalization; using System.Linq; -using System.Text; -using System.Threading; -using ICSharpCode.NRefactory.TypeSystem; -using ICSharpCode.NRefactory.TypeSystem.Implementation; namespace ICSharpCode.NRefactory.CSharp.Resolver { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs index d7f8da21a9..ce1ce09570 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolution.cs @@ -118,7 +118,8 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver public void AddError(OverloadResolutionErrors newError) { this.Errors |= newError; - this.ErrorCount++; + if (!IsApplicable(newError)) + this.ErrorCount++; } } @@ -130,6 +131,8 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver Candidate bestCandidate; Candidate bestCandidateAmbiguousWith; IType[] explicitlyGivenTypeArguments; + bool bestCandidateWasValidated; + OverloadResolutionErrors bestCandidateValidationResult; #region Constructor public OverloadResolution(ICompilation compilation, ResolveResult[] arguments, string[] argumentNames = null, IType[] typeArguments = null, CSharpConversions conversions = null) @@ -155,6 +158,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver } #endregion + #region Input Properties /// /// Gets/Sets whether the methods are extension methods that are being called using extension method syntax. /// @@ -183,21 +187,36 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver public IList Arguments { get { return arguments; } } + #endregion #region AddCandidate + /// + /// Adds a candidate to overload resolution. + /// + /// The candidate member to add. + /// The errors that prevent the member from being applicable, if any. + /// Note: this method does not return errors that do not affect applicability. public OverloadResolutionErrors AddCandidate(IParameterizedMember member) { return AddCandidate(member, OverloadResolutionErrors.None); } + /// + /// Adds a candidate to overload resolution. + /// + /// The candidate member to add. + /// Additional errors that apply to the candidate. + /// This is used to represent errors during member lookup (e.g. OverloadResolutionErrors.Inaccessible) + /// in overload resolution. + /// The errors that prevent the member from being applicable, if any. + /// Note: this method does not return errors that do not affect applicability. public OverloadResolutionErrors AddCandidate(IParameterizedMember member, OverloadResolutionErrors additionalErrors) { if (member == null) throw new ArgumentNullException("member"); Candidate c = new Candidate(member, false); - if (additionalErrors != OverloadResolutionErrors.None) - c.AddError(additionalErrors); + c.AddError(additionalErrors); if (CalculateCandidate(c)) { //candidates.Add(c); } @@ -206,8 +225,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver && member.Parameters[member.Parameters.Count - 1].IsParams) { Candidate expandedCandidate = new Candidate(member, true); - if (additionalErrors != OverloadResolutionErrors.None) - expandedCandidate.AddError(additionalErrors); + expandedCandidate.AddError(additionalErrors); // consider expanded form only if it isn't obviously wrong if (CalculateCandidate(expandedCandidate)) { //candidates.Add(expandedCandidate); @@ -219,11 +237,6 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver return c.Errors; } - public static bool IsApplicable(OverloadResolutionErrors errors) - { - return (errors & ~OverloadResolutionErrors.AmbiguousMatch) == OverloadResolutionErrors.None; - } - /// /// Calculates applicability etc. for the candidate. /// @@ -432,20 +445,36 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver #endregion #region Validate Constraints + OverloadResolutionErrors ValidateMethodConstraints(Candidate candidate) + { + // If type inference already failed, we won't check the constraints: + if ((candidate.Errors & OverloadResolutionErrors.TypeInferenceFailed) != 0) + return OverloadResolutionErrors.None; + + IMethod method = candidate.Member as IMethod; + if (method == null || method.TypeParameters.Count == 0) + return OverloadResolutionErrors.None; // the method isn't generic + var substitution = GetSubstitution(candidate); + for (int i = 0; i < method.TypeParameters.Count; i++) { + if (!ValidateConstraints(method.TypeParameters[i], substitution.MethodTypeArguments[i], substitution)) + return OverloadResolutionErrors.MethodConstraintsNotSatisfied; + } + return OverloadResolutionErrors.None; + } + /// /// Validates whether the given type argument satisfies the constraints for the given type parameter. /// /// The type parameter. /// The type argument. /// The substitution that defines how type parameters are replaced with type arguments. - /// The substitution is used to check constraints that depend on other type parameters (or recursively on the same type parameter). + /// The substitution is used to check constraints that depend on other type parameters (or recursively on the same type parameter). + /// May be null if no substitution should be used. /// True if the constraints are satisfied; false otherwise. - public static bool ValidateConstraints(ITypeParameter typeParameter, IType typeArgument, TypeVisitor substitution) + public static bool ValidateConstraints(ITypeParameter typeParameter, IType typeArgument, TypeVisitor substitution = null) { if (typeParameter == null) throw new ArgumentNullException("typeParameter"); - if (typeParameter.Owner == null) - throw new ArgumentNullException("typeParameter.Owner"); if (typeArgument == null) throw new ArgumentNullException("typeArgument"); return ValidateConstraints(typeParameter, typeArgument, substitution, CSharpConversions.Get(typeParameter.Owner.Compilation)); @@ -490,6 +519,16 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver #endregion #region CheckApplicability + /// + /// Returns whether a candidate with the given errors is still considered to be applicable. + /// + public static bool IsApplicable(OverloadResolutionErrors errors) + { + const OverloadResolutionErrors errorsThatDoNotMatterForApplicability = + OverloadResolutionErrors.AmbiguousMatch | OverloadResolutionErrors.MethodConstraintsNotSatisfied; + return (errors & ~errorsThatDoNotMatterForApplicability) == OverloadResolutionErrors.None; + } + void CheckApplicability(Candidate candidate) { // C# 4.0 spec: §7.5.3.1 Applicable function member @@ -697,6 +736,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { if (bestCandidate == null) { bestCandidate = candidate; + bestCandidateWasValidated = false; } else { switch (BetterFunctionMember(candidate, bestCandidate)) { case 0: @@ -707,6 +747,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver break; case 1: bestCandidate = candidate; + bestCandidateWasValidated = false; bestCandidateAmbiguousWith = null; break; // case 2: best candidate stays best @@ -715,15 +756,24 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver } #endregion + #region Output Properties public IParameterizedMember BestCandidate { get { return bestCandidate != null ? bestCandidate.Member : null; } } + /// + /// Returns the errors that apply to the best candidate. + /// This includes additional errors that do not affect applicability (e.g. AmbiguousMatch, MethodConstraintsNotSatisfied) + /// public OverloadResolutionErrors BestCandidateErrors { get { if (bestCandidate == null) return OverloadResolutionErrors.None; - OverloadResolutionErrors err = bestCandidate.Errors; + if (!bestCandidateWasValidated) { + bestCandidateValidationResult = ValidateMethodConstraints(bestCandidate); + bestCandidateWasValidated = true; + } + OverloadResolutionErrors err = bestCandidate.Errors | bestCandidateValidationResult; if (bestCandidateAmbiguousWith != null) err |= OverloadResolutionErrors.AmbiguousMatch; return err; @@ -731,7 +781,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver } public bool FoundApplicableCandidate { - get { return bestCandidate != null && bestCandidate.Errors == OverloadResolutionErrors.None; } + get { return bestCandidate != null && IsApplicable(bestCandidate.Errors); } } public IParameterizedMember BestCandidateAmbiguousWith { @@ -781,15 +831,35 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver return null; } + /// + /// Returns the arguments for the method call in the order they were provided (not in the order of the parameters). + /// Arguments are wrapped in a if an implicit conversion is being applied + /// to them when calling the method. + /// public IList GetArgumentsWithConversions() { if (bestCandidate == null) return arguments; else - return GetArgumentsWithConversions(null); + return GetArgumentsWithConversions(null, null); + } + + /// + /// Returns the arguments for the method call in the order they were provided (not in the order of the parameters). + /// Arguments are wrapped in a if an implicit conversion is being applied + /// to them when calling the method. + /// For arguments where an explicit argument name was provided, the argument will + /// be wrapped in a . + /// + public IList GetArgumentsWithConversionsAndNames() + { + if (bestCandidate == null) + return arguments; + else + return GetArgumentsWithConversions(null, GetBestCandidateWithSubstitutedTypeArguments()); } - IList GetArgumentsWithConversions(ResolveResult targetResolveResult) + IList GetArgumentsWithConversions(ResolveResult targetResolveResult, IParameterizedMember bestCandidateForNamedArguments) { var conversions = this.ArgumentConversions; ResolveResult[] args = new ResolveResult[arguments.Length]; @@ -797,22 +867,27 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver var argument = arguments[i]; if (this.IsExtensionMethodInvocation && i == 0 && targetResolveResult != null) argument = targetResolveResult; - if (conversions[i] == Conversion.IdentityConversion) { - args[i] = argument; - } else { - int parameterIndex = bestCandidate.ArgumentToParameterMap[i]; - IType parameterType; - if (parameterIndex >= 0) { - parameterType = bestCandidate.ParameterTypes[parameterIndex]; - } else { - parameterType = SpecialType.UnknownType; + int parameterIndex = bestCandidate.ArgumentToParameterMap[i]; + if (parameterIndex >= 0 && conversions[i] != Conversion.IdentityConversion) { + // Wrap argument in ConversionResolveResult + IType parameterType = bestCandidate.ParameterTypes[parameterIndex]; + if (parameterType.Kind != TypeKind.Unknown) { + if (arguments[i].IsCompileTimeConstant && conversions[i] != Conversion.None) { + argument = new CSharpResolver(compilation).WithCheckForOverflow(CheckForOverflow).ResolveCast(parameterType, argument); + } else { + argument = new ConversionResolveResult(parameterType, argument, conversions[i], CheckForOverflow); + } } - if (arguments[i].IsCompileTimeConstant && conversions[i] != Conversion.None) { - args[i] = new CSharpResolver(compilation).WithCheckForOverflow(CheckForOverflow).ResolveCast(parameterType, argument); + } + if (bestCandidateForNamedArguments != null && argumentNames[i] != null) { + // Wrap argument in NamedArgumentResolveResult + if (parameterIndex >= 0) { + argument = new NamedArgumentResolveResult(bestCandidateForNamedArguments.Parameters[parameterIndex], argument, bestCandidateForNamedArguments); } else { - args[i] = new ConversionResolveResult(parameterType, argument, conversions[i], CheckForOverflow); + argument = new NamedArgumentResolveResult(argumentNames[i], argument); } } + args[i] = argument; } return args; } @@ -823,21 +898,24 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver return null; IMethod method = bestCandidate.Member as IMethod; if (method != null && method.TypeParameters.Count > 0) { - SpecializedMethod sm = method as SpecializedMethod; - if (sm != null) { - // Do not compose the substitutions, but merge them. - // This is required for InvocationTests.SubstituteClassAndMethodTypeParametersAtOnce - return new SpecializedMethod( - (IMethod)method.MemberDefinition, - new TypeParameterSubstitution(sm.Substitution.ClassTypeArguments, bestCandidate.InferredTypes)); - } else { - return new SpecializedMethod(method, new TypeParameterSubstitution(null, bestCandidate.InferredTypes)); - } + return new SpecializedMethod((IMethod)method.MemberDefinition, GetSubstitution(bestCandidate)); } else { return bestCandidate.Member; } } + TypeParameterSubstitution GetSubstitution(Candidate candidate) + { + SpecializedMethod sm = candidate.Member as SpecializedMethod; + if (sm != null) { + // Do not compose the substitutions, but merge them. + // This is required for InvocationTests.SubstituteClassAndMethodTypeParametersAtOnce + return new TypeParameterSubstitution(sm.Substitution.ClassTypeArguments, candidate.InferredTypes); + } else { + return new TypeParameterSubstitution(null, candidate.InferredTypes); + } + } + /// /// Creates a ResolveResult representing the result of overload resolution. /// @@ -857,7 +935,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver return new CSharpInvocationResolveResult( this.IsExtensionMethodInvocation ? new TypeResolveResult(member.DeclaringType) : targetResolveResult, member, - GetArgumentsWithConversions(targetResolveResult), + GetArgumentsWithConversions(targetResolveResult, member), this.BestCandidateErrors, this.IsExtensionMethodInvocation, this.BestCandidateIsExpandedForm, @@ -865,5 +943,6 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver argumentToParameterMap: this.GetArgumentToParameterMap(), initializerStatements: initializerStatements); } + #endregion } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolutionErrors.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolutionErrors.cs index 1b1ea2c91c..399f2ff091 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolutionErrors.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/OverloadResolutionErrors.cs @@ -65,10 +65,23 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// There is no unique best overload. /// This error does not apply to any single candidate, but only to the overall result of overload resolution. /// + /// + /// This error does not prevent a candidate from being applicable. + /// AmbiguousMatch = 0x0200, /// /// The member is not accessible. /// - Inaccessible = 0x0400 + /// + /// This error is generated by member lookup; not by overload resolution. + /// + Inaccessible = 0x0400, + /// + /// A generic method + /// + /// + /// This error does not prevent a candidate from being applicable. + /// + MethodConstraintsNotSatisfied = 0x0800 } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/ResolveAtLocation.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/ResolveAtLocation.cs index 4ebd96e594..43cc5ff3d7 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/ResolveAtLocation.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/ResolveAtLocation.cs @@ -30,27 +30,27 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// public static class ResolveAtLocation { - public static ResolveResult Resolve (ICompilation compilation, CSharpParsedFile parsedFile, CompilationUnit cu, TextLocation location, + public static ResolveResult Resolve (ICompilation compilation, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, TextLocation location, CancellationToken cancellationToken = default(CancellationToken)) { - return Resolve (new Lazy(() => compilation), parsedFile, cu, location, cancellationToken); + return Resolve (new Lazy(() => compilation), unresolvedFile, syntaxTree, location, cancellationToken); } - public static ResolveResult Resolve(Lazy compilation, CSharpParsedFile parsedFile, CompilationUnit cu, TextLocation location, + public static ResolveResult Resolve(Lazy compilation, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, TextLocation location, CancellationToken cancellationToken = default(CancellationToken)) { AstNode node; - return Resolve(compilation, parsedFile, cu, location, out node, cancellationToken); + return Resolve(compilation, unresolvedFile, syntaxTree, location, out node, cancellationToken); } - public static ResolveResult Resolve (ICompilation compilation, CSharpParsedFile parsedFile, CompilationUnit cu, TextLocation location, out AstNode node, + public static ResolveResult Resolve (ICompilation compilation, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, TextLocation location, out AstNode node, CancellationToken cancellationToken = default(CancellationToken)) { - return Resolve (new Lazy(() => compilation), parsedFile, cu, location, out node, cancellationToken); + return Resolve (new Lazy(() => compilation), unresolvedFile, syntaxTree, location, out node, cancellationToken); } - public static ResolveResult Resolve(Lazy compilation, CSharpParsedFile parsedFile, CompilationUnit cu, TextLocation location, out AstNode node, + public static ResolveResult Resolve(Lazy compilation, CSharpUnresolvedFile unresolvedFile, SyntaxTree syntaxTree, TextLocation location, out AstNode node, CancellationToken cancellationToken = default(CancellationToken)) { - node = cu.GetNodeAt(location); + node = syntaxTree.GetNodeAt(location); if (node == null || node is ArrayInitializerExpression) return null; if (CSharpAstResolver.IsUnresolvableNode(node)) { @@ -96,7 +96,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver } // TODO: I think we should provide an overload so that an existing CSharpAstResolver can be reused - CSharpAstResolver resolver = new CSharpAstResolver(compilation.Value, cu, parsedFile); + CSharpAstResolver resolver = new CSharpAstResolver(compilation.Value, syntaxTree, unresolvedFile); ResolveResult rr = resolver.Resolve(node, cancellationToken); if (rr is MethodGroupResolveResult && parentInvocation != null) return resolver.Resolve(parentInvocation); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs index 0e9bf031eb..c7f82cc8ef 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs @@ -27,7 +27,6 @@ using ICSharpCode.NRefactory.CSharp.TypeSystem; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem.Implementation; -using ICSharpCode.NRefactory.Utils; namespace ICSharpCode.NRefactory.CSharp.Resolver { @@ -65,7 +64,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// We do not have to put this into the stored state (resolver) because /// query expressions are always resolved in a single operation. ResolveResult currentQueryResult; - readonly CSharpParsedFile parsedFile; + readonly CSharpUnresolvedFile unresolvedFile; readonly Dictionary resolveResultCache = new Dictionary(); readonly Dictionary resolverBeforeDict = new Dictionary(); readonly Dictionary resolverAfterDict = new Dictionary(); @@ -94,22 +93,12 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// /// Creates a new ResolveVisitor instance. /// - /// - /// The CSharpResolver, describing the initial resolve context. - /// If you visit a whole CompilationUnit with the resolve visitor, you can simply pass - /// new CSharpResolver(typeResolveContext) without setting up the context. - /// If you only visit a subtree, you need to pass a CSharpResolver initialized to the context for that subtree. - /// - /// - /// Result of the for the file being passed. This is used for setting up the context on the resolver. - /// You may pass null if you are only visiting a part of a method body and have already set up the context in the . - /// - public ResolveVisitor(CSharpResolver resolver, CSharpParsedFile parsedFile) + public ResolveVisitor(CSharpResolver resolver, CSharpUnresolvedFile unresolvedFile) { if (resolver == null) throw new ArgumentNullException("resolver"); this.resolver = resolver; - this.parsedFile = parsedFile; + this.unresolvedFile = unresolvedFile; this.navigator = skipAllNavigator; } @@ -211,7 +200,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver /// Equivalent to 'Scan', but also resolves the node at the same time. /// This method should be only used if the CSharpResolver passed to the ResolveVisitor was manually set /// to the correct state. - /// Otherwise, use resolver.Scan(compilationUnit); var result = resolver.GetResolveResult(node); + /// Otherwise, use resolver.Scan(syntaxTree); var result = resolver.GetResolveResult(node); /// instead. /// -- /// This method now is internal, because it is difficult to use correctly. @@ -265,12 +254,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver if (node.IsNull) return; Log.WriteLine("Resolved '{0}' to {1}", node, result); - // In rare cases, ArraySpecifier and NamedArgumentExpression can get resolved, - // for example in 'new NonExistingType(a: b)' the ScanChildren() call in the object create expression - // will cause the named argument expression to be scanned, which can cause it to be resolved - // (depending on the navigator). - Debug.Assert(!CSharpAstResolver.IsUnresolvableNode(node) || node is ArraySpecifier || node is NamedArgumentExpression); - + Debug.Assert(!CSharpAstResolver.IsUnresolvableNode(node)); // The state should be stored before the result is. Debug.Assert(resolverBeforeDict.ContainsKey(node)); // Don't store results twice. @@ -398,24 +382,50 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver } } - void ProcessConversionsInInvocation(Expression target, IEnumerable arguments, CSharpInvocationResolveResult invocation) + void MarkUnknownNamedArguments(IEnumerable arguments) { - if (invocation == null) - return; - int i = 0; - if (invocation.IsExtensionMethodInvocation) { - Debug.Assert(arguments.Count() + 1 == invocation.Arguments.Count); - ProcessConversionResult(target, invocation.Arguments[0] as ConversionResolveResult); - i = 1; - } else { - Debug.Assert(arguments.Count() == invocation.Arguments.Count); + foreach (var nae in arguments.OfType()) { + StoreCurrentState(nae); + StoreResult(nae, new NamedArgumentResolveResult(nae.Name, resolveResultCache[nae.Expression])); } - foreach (Expression arg in arguments) { - NamedArgumentExpression nae = arg as NamedArgumentExpression; - if (nae != null) - ProcessConversionResult(nae.Expression, invocation.Arguments[i++] as ConversionResolveResult); - else - ProcessConversionResult(arg, invocation.Arguments[i++] as ConversionResolveResult); + } + + void ProcessInvocationResult(Expression target, IEnumerable arguments, ResolveResult invocation) + { + if (invocation is CSharpInvocationResolveResult || invocation is DynamicInvocationResolveResult) { + int i = 0; + IList argumentsRR; + if (invocation is CSharpInvocationResolveResult) { + var csi = (CSharpInvocationResolveResult)invocation; + if (csi.IsExtensionMethodInvocation) { + Debug.Assert(arguments.Count() + 1 == csi.Arguments.Count); + ProcessConversionResult(target, csi.Arguments[0] as ConversionResolveResult); + i = 1; + } else { + Debug.Assert(arguments.Count() == csi.Arguments.Count); + } + argumentsRR = csi.Arguments; + } + else { + argumentsRR = ((DynamicInvocationResolveResult)invocation).Arguments; + } + + foreach (Expression arg in arguments) { + ResolveResult argRR = argumentsRR[i++]; + NamedArgumentExpression nae = arg as NamedArgumentExpression; + NamedArgumentResolveResult nrr = argRR as NamedArgumentResolveResult; + Debug.Assert((nae == null) == (nrr == null)); + if (nae != null && nrr != null) { + StoreCurrentState(nae); + StoreResult(nae, nrr); + ProcessConversionResult(nae.Expression, nrr.Argument as ConversionResolveResult); + } else { + ProcessConversionResult(arg, argRR as ConversionResolveResult); + } + } + } + else { + MarkUnknownNamedArguments(arguments); } } #endregion @@ -520,16 +530,16 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver #endregion #region Track UsingScope - ResolveResult IAstVisitor.VisitCompilationUnit(CompilationUnit unit) + ResolveResult IAstVisitor.VisitSyntaxTree(SyntaxTree unit) { CSharpResolver previousResolver = resolver; try { - if (parsedFile != null) { - resolver = resolver.WithCurrentUsingScope(parsedFile.RootUsingScope.Resolve(resolver.Compilation)); + if (unresolvedFile != null) { + resolver = resolver.WithCurrentUsingScope(unresolvedFile.RootUsingScope.Resolve(resolver.Compilation)); } else { var cv = new TypeSystemConvertVisitor(unit.FileName ?? string.Empty); ApplyVisitorToUsings(cv, unit.Children); - PushUsingScope(cv.ParsedFile.RootUsingScope); + PushUsingScope(cv.UnresolvedFile.RootUsingScope); } ScanChildren(unit); return voidResult; @@ -557,8 +567,8 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { CSharpResolver previousResolver = resolver; try { - if (parsedFile != null) { - resolver = resolver.WithCurrentUsingScope(parsedFile.GetUsingScope(namespaceDeclaration.StartLocation).Resolve(resolver.Compilation)); + if (unresolvedFile != null) { + resolver = resolver.WithCurrentUsingScope(unresolvedFile.GetUsingScope(namespaceDeclaration.StartLocation).Resolve(resolver.Compilation)); } else { string fileName = namespaceDeclaration.GetRegion().FileName ?? string.Empty; // Fetch parent using scope @@ -579,7 +589,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver // Last using scope: usingScope = new UsingScope(resolver.CurrentUsingScope.UnresolvedUsingScope, identifiers.Last().Name); usingScope.Region = region; - var cv = new TypeSystemConvertVisitor(new CSharpParsedFile(region.FileName ?? string.Empty), usingScope); + var cv = new TypeSystemConvertVisitor(new CSharpUnresolvedFile(region.FileName ?? string.Empty), usingScope); ApplyVisitorToUsings(cv, namespaceDeclaration.Children); PushUsingScope(usingScope); } @@ -663,8 +673,8 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver for (AstNode node = fieldOrEventDeclaration.FirstChild; node != null; node = node.NextSibling) { if (node.Role == Roles.Variable) { IMember member; - if (parsedFile != null) { - member = GetMemberFromLocation(node.StartLocation); + if (unresolvedFile != null) { + member = GetMemberFromLocation(node); } else { string name = ((VariableInitializer)node).Name; member = AbstractUnresolvedMember.Resolve(resolver.CurrentTypeResolveContext, entityType, name); @@ -681,14 +691,15 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver return voidResult; } - IMember GetMemberFromLocation(TextLocation location) + IMember GetMemberFromLocation(AstNode node) { ITypeDefinition typeDef = resolver.CurrentTypeDefinition; if (typeDef == null) return null; + TextLocation location = TypeSystemConvertVisitor.GetStartLocationAfterAttributes(node); return typeDef.GetMembers( delegate (IUnresolvedMember m) { - if (m.ParsedFile != parsedFile) + if (m.UnresolvedFile != unresolvedFile) return false; DomRegion region = m.Region; return !region.IsEmpty && region.Begin <= location && region.End > location; @@ -781,8 +792,8 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver CSharpResolver oldResolver = resolver; try { IMember member; - if (parsedFile != null) { - member = GetMemberFromLocation(memberDeclaration.StartLocation); + if (unresolvedFile != null) { + member = GetMemberFromLocation(memberDeclaration); } else { // Re-discover the method: EntityType entityType = memberDeclaration.EntityType; @@ -844,8 +855,8 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver CSharpResolver oldResolver = resolver; try { IMember member; - if (parsedFile != null) { - member = GetMemberFromLocation(propertyOrIndexerDeclaration.StartLocation); + if (unresolvedFile != null) { + member = GetMemberFromLocation(propertyOrIndexerDeclaration); } else { // Re-discover the property: string name = propertyOrIndexerDeclaration.Name; @@ -900,8 +911,8 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver CSharpResolver oldResolver = resolver; try { IMember member; - if (parsedFile != null) { - member = GetMemberFromLocation(eventDeclaration.StartLocation); + if (unresolvedFile != null) { + member = GetMemberFromLocation(eventDeclaration); } else { string name = eventDeclaration.Name; AstType explicitInterfaceAstType = eventDeclaration.PrivateImplementationType; @@ -1023,8 +1034,8 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver Scan(attributeSection); IMember member = null; - if (parsedFile != null) { - member = GetMemberFromLocation(enumMemberDeclaration.StartLocation); + if (unresolvedFile != null) { + member = GetMemberFromLocation(enumMemberDeclaration); } else if (resolver.CurrentTypeDefinition != null) { string name = enumMemberDeclaration.Name; member = resolver.CurrentTypeDefinition.GetFields(f => f.Name == name, GetMemberOptions.IgnoreInheritedMembers).FirstOrDefault(); @@ -1402,7 +1413,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver ResolveResult IAstVisitor.VisitIndexerExpression(IndexerExpression indexerExpression) { - if (resolverEnabled) { + if (resolverEnabled || NeedsResolvingDueToNamedArguments(indexerExpression)) { Expression target = indexerExpression.Target; ResolveResult targetResult = Resolve(target); string[] argumentNames; @@ -1410,9 +1421,10 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver ResolveResult rr = resolver.ResolveIndexer(targetResult, arguments, argumentNames); ArrayAccessResolveResult aarr = rr as ArrayAccessResolveResult; if (aarr != null) { + MarkUnknownNamedArguments(indexerExpression.Arguments); ProcessConversionResults(indexerExpression.Arguments, aarr.Indexes); } else { - ProcessConversionsInInvocation(target, indexerExpression.Arguments, rr as CSharpInvocationResolveResult); + ProcessInvocationResult(target, indexerExpression.Arguments, rr); } return rr; } else { @@ -1441,8 +1453,12 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver // by calling GetArguments(). // This method gets called only when scanning, or when the named argument is used // in an invalid context. - Scan(namedArgumentExpression.Expression); - return null; + if (resolverEnabled) { + return new NamedArgumentResolveResult(namedArgumentExpression.Name, Resolve(namedArgumentExpression.Expression)); + } else { + Scan(namedArgumentExpression.Expression); + return null; + } } // NamedExpression is "identifier = Expression" in object initializers and attributes @@ -1481,48 +1497,44 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver ResolveResult IAstVisitor.VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression) { - if (resolverEnabled || !objectCreateExpression.Initializer.IsNull) { - var typeResolveResult = Resolve(objectCreateExpression.Type); - if (typeResolveResult.IsError) { - ScanChildren (objectCreateExpression); - return typeResolveResult; - } - IType type = typeResolveResult.Type; - - List initializerStatements = null; - var initializer = objectCreateExpression.Initializer; - if (!initializer.IsNull) { - initializerStatements = new List(); - HandleObjectInitializer(new InitializedObjectResolveResult(type), initializer, initializerStatements); - } - - string[] argumentNames; - ResolveResult[] arguments = GetArguments(objectCreateExpression.Arguments, out argumentNames); - - ResolveResult rr = resolver.ResolveObjectCreation(type, arguments, argumentNames, false, initializerStatements); - if (arguments.Length == 1 && rr.Type.Kind == TypeKind.Delegate) { - // Apply conversion to argument if it directly wraps the argument - // (but not when creating a delegate from a delegate, as then there would be a MGRR for .Invoke in between) - // This is necessary for lambda type inference. - var crr = rr as ConversionResolveResult; - if (crr != null && crr.Input == arguments[0]) { - ProcessConversionResult(objectCreateExpression.Arguments.Single(), crr); - - // wrap the result so that the delegate creation is not handled as a reference - // to the target method - otherwise FindReferencedEntities would produce two results for - // the same delegate creation. - return WrapResult(rr); - } else { - return rr; - } + var typeResolveResult = Resolve(objectCreateExpression.Type); + if (typeResolveResult.IsError) { + ScanChildren (objectCreateExpression); + return typeResolveResult; + } + IType type = typeResolveResult.Type; + + List initializerStatements = null; + var initializer = objectCreateExpression.Initializer; + if (!initializer.IsNull) { + initializerStatements = new List(); + HandleObjectInitializer(new InitializedObjectResolveResult(type), initializer, initializerStatements); + } + + string[] argumentNames; + ResolveResult[] arguments = GetArguments(objectCreateExpression.Arguments, out argumentNames); + + ResolveResult rr = resolver.ResolveObjectCreation(type, arguments, argumentNames, false, initializerStatements); + if (arguments.Length == 1 && rr.Type.Kind == TypeKind.Delegate) { + MarkUnknownNamedArguments(objectCreateExpression.Arguments); + // Apply conversion to argument if it directly wraps the argument + // (but not when creating a delegate from a delegate, as then there would be a MGRR for .Invoke in between) + // This is necessary for lambda type inference. + var crr = rr as ConversionResolveResult; + if (crr != null && crr.Input == arguments[0]) { + ProcessConversionResult(objectCreateExpression.Arguments.Single(), crr); + + // wrap the result so that the delegate creation is not handled as a reference + // to the target method - otherwise FindReferencedEntities would produce two results for + // the same delegate creation. + return WrapResult(rr); } else { - // process conversions in all other cases - ProcessConversionsInInvocation(null, objectCreateExpression.Arguments, rr as CSharpInvocationResolveResult); return rr; } } else { - ScanChildren(objectCreateExpression); - return null; + // process conversions in all other cases + ProcessInvocationResult(null, objectCreateExpression.Arguments, rr); + return rr; } } @@ -1547,7 +1559,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver OverloadResolution or = mgrr.PerformOverloadResolution(resolver.Compilation, addArguments, null, false, false, resolver.CheckForOverflow, resolver.conversions); var invocationRR = or.CreateResolveResult(initializedObject); StoreResult(aie, invocationRR); - ProcessConversionsInInvocation(null, aie.Elements, invocationRR); + ProcessInvocationResult(null, aie.Elements, invocationRR); initializerStatements.Add(invocationRR); } else { StoreResult(aie, addRR); @@ -1705,6 +1717,15 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver return result; } + /// + /// Gets and resolves the arguments; unpacking any NamedArgumentExpressions. + /// + /// + /// Callers of GetArguments must also call either ProcessConversionsInInvocation or MarkUnknownNamedArguments + /// to ensure the named arguments get resolved. + /// Also, as named arguments get resolved by the parent node, the parent node must not scan + /// into the argument list without being resolved - see NeedsResolvingDueToNamedArguments(). + /// ResolveResult[] GetArguments(IEnumerable argumentExpressions, out string[] argumentNames) { argumentNames = null; @@ -1726,6 +1747,15 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver return arguments; } + bool NeedsResolvingDueToNamedArguments(Expression nodeWithArguments) + { + for (AstNode child = nodeWithArguments.FirstChild; child != null; child = child.NextSibling) { + if (child is NamedArgumentExpression) + return true; + } + return false; + } + static NameLookupMode GetNameLookupMode(Expression expr) { InvocationExpression ie = expr.Parent as InvocationExpression; @@ -1844,7 +1874,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver } } else { // Regular code path - if (resolverEnabled) { + if (resolverEnabled || NeedsResolvingDueToNamedArguments(invocationExpression)) { ResolveResult target = Resolve(invocationExpression.Target); return ResolveInvocationOnGivenTarget(target, invocationExpression); } else { @@ -1859,7 +1889,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver string[] argumentNames; ResolveResult[] arguments = GetArguments(invocationExpression.Arguments, out argumentNames); ResolveResult rr = resolver.ResolveInvocation(target, arguments, argumentNames); - ProcessConversionsInInvocation(invocationExpression.Target, invocationExpression.Arguments, rr as CSharpInvocationResolveResult); + ProcessInvocationResult(invocationExpression.Target, invocationExpression.Arguments, rr); return rr; } #endregion @@ -1928,8 +1958,8 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver DomRegion MakeRegion(AstNode node) { - if (parsedFile != null) - return new DomRegion(parsedFile.FileName, node.StartLocation, node.EndLocation); + if (unresolvedFile != null) + return new DomRegion(unresolvedFile.FileName, node.StartLocation, node.EndLocation); else return node.GetRegion(); } @@ -2118,7 +2148,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver readonly QuerySelectClause selectClause; readonly CSharpResolver storedContext; - readonly CSharpParsedFile parsedFile; + readonly CSharpUnresolvedFile unresolvedFile; readonly List hypotheses = new List(); internal IList parameters = new List(); @@ -2156,7 +2186,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { this.parentVisitor = parentVisitor; this.storedContext = parentVisitor.resolver; - this.parsedFile = parentVisitor.parsedFile; + this.unresolvedFile = parentVisitor.unresolvedFile; this.bodyResult = parentVisitor.voidResult; } @@ -2224,7 +2254,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver if (ok) return h; } - ResolveVisitor visitor = new ResolveVisitor(storedContext, parsedFile); + ResolveVisitor visitor = new ResolveVisitor(storedContext, unresolvedFile); var newHypothesis = new LambdaTypeHypothesis(this, parameterTypes, visitor, lambda != null ? lambda.Parameters : null); hypotheses.Add(newHypothesis); return newHypothesis; @@ -3151,7 +3181,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver string[] argumentNames; ResolveResult[] arguments = GetArguments(constructorArguments, out argumentNames); ResolveResult rr = resolver.ResolveObjectCreation(type, arguments, argumentNames, false, initializerStatements); - ProcessConversionsInInvocation(null, constructorArguments, rr as CSharpInvocationResolveResult); + ProcessInvocationResult(null, constructorArguments, rr); return rr; } @@ -3783,10 +3813,6 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver #region Constructor Initializer ResolveResult IAstVisitor.VisitConstructorInitializer(ConstructorInitializer constructorInitializer) { - if (!resolverEnabled) { - ScanChildren(constructorInitializer); - return null; - } ResolveResult target; if (constructorInitializer.ConstructorInitializerType == ConstructorInitializerType.Base) { target = resolver.ResolveBaseReference(); @@ -3796,7 +3822,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver string[] argumentNames; ResolveResult[] arguments = GetArguments(constructorInitializer.Arguments, out argumentNames); ResolveResult rr = resolver.ResolveObjectCreation(target.Type, arguments, argumentNames, allowProtectedAccess: true); - ProcessConversionsInInvocation(null, constructorInitializer.Arguments, rr as CSharpInvocationResolveResult); + ProcessInvocationResult(null, constructorInitializer.Arguments, rr); return rr; } #endregion diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAssembly.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAssembly.cs index fe72e9b576..ec9b9cfeb4 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAssembly.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpAssembly.cs @@ -73,9 +73,9 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem return result; } else { result = new List(); - foreach (var parsedFile in projectContent.Files.OfType()) { - var attributes = assemblyAttributes ? parsedFile.AssemblyAttributes : parsedFile.ModuleAttributes; - var context = new CSharpTypeResolveContext(this, parsedFile.RootUsingScope.Resolve(compilation)); + foreach (var unresolvedFile in projectContent.Files.OfType()) { + var attributes = assemblyAttributes ? unresolvedFile.AssemblyAttributes : unresolvedFile.ModuleAttributes; + var context = new CSharpTypeResolveContext(this, unresolvedFile.RootUsingScope.Resolve(compilation)); foreach (var unresolvedAttr in attributes) { result.Add(unresolvedAttr.CreateResolvedAttribute(context)); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpParsedFile.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpUnresolvedFile.cs similarity index 95% rename from src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpParsedFile.cs rename to src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpUnresolvedFile.cs index 186961031f..ac5da75885 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpParsedFile.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpUnresolvedFile.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem /// Represents a file that was parsed and converted for the type system. /// [Serializable] - public sealed class CSharpParsedFile : AbstractFreezable, IParsedFile, IUnresolvedDocumentationProvider + public sealed class CSharpUnresolvedFile : AbstractFreezable, IUnresolvedFile, IUnresolvedDocumentationProvider { readonly string fileName; readonly UsingScope rootUsingScope; @@ -51,7 +51,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem usingScopes = FreezableHelper.FreezeListAndElements(usingScopes); } - public CSharpParsedFile(string fileName) + public CSharpUnresolvedFile(string fileName) { if (fileName == null) throw new ArgumentNullException("fileName"); @@ -59,7 +59,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem this.rootUsingScope = new UsingScope(); } - public CSharpParsedFile(string fileName, UsingScope rootUsingScope) + public CSharpUnresolvedFile(string fileName, UsingScope rootUsingScope) { if (fileName == null) throw new ArgumentNullException("fileName"); @@ -178,7 +178,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem return rctx; } - ITypeResolveContext IParsedFile.GetTypeResolveContext (ICompilation compilation, TextLocation loc) + ITypeResolveContext IUnresolvedFile.GetTypeResolveContext (ICompilation compilation, TextLocation loc) { return GetTypeResolveContext (compilation, loc); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs index bd47e64d1b..98228ac423 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs @@ -22,13 +22,10 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Text; -using ICSharpCode.NRefactory.CSharp.Analysis; -using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.CSharp.TypeSystem; using ICSharpCode.NRefactory.CSharp.TypeSystem.ConstantValues; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem.Implementation; -using ICSharpCode.NRefactory.Utils; namespace ICSharpCode.NRefactory.CSharp.TypeSystem { @@ -37,7 +34,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem /// public class TypeSystemConvertVisitor : DepthFirstAstVisitor { - readonly CSharpParsedFile parsedFile; + readonly CSharpUnresolvedFile unresolvedFile; UsingScope usingScope; CSharpUnresolvedTypeDefinition currentTypeDefinition; DefaultUnresolvedMethod currentMethod; @@ -67,32 +64,32 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem { if (fileName == null) throw new ArgumentNullException("fileName"); - this.parsedFile = new CSharpParsedFile(fileName); - this.usingScope = parsedFile.RootUsingScope; + this.unresolvedFile = new CSharpUnresolvedFile(fileName); + this.usingScope = unresolvedFile.RootUsingScope; } /// /// Creates a new TypeSystemConvertVisitor and initializes it with a given context. /// - /// The parsed file to which members should be added. + /// The parsed file to which members should be added. /// The current using scope. /// The current type definition. - public TypeSystemConvertVisitor(CSharpParsedFile parsedFile, UsingScope currentUsingScope = null, CSharpUnresolvedTypeDefinition currentTypeDefinition = null) + public TypeSystemConvertVisitor(CSharpUnresolvedFile unresolvedFile, UsingScope currentUsingScope = null, CSharpUnresolvedTypeDefinition currentTypeDefinition = null) { - if (parsedFile == null) - throw new ArgumentNullException("parsedFile"); - this.parsedFile = parsedFile; - this.usingScope = currentUsingScope ?? parsedFile.RootUsingScope; + if (unresolvedFile == null) + throw new ArgumentNullException("unresolvedFile"); + this.unresolvedFile = unresolvedFile; + this.usingScope = currentUsingScope ?? unresolvedFile.RootUsingScope; this.currentTypeDefinition = currentTypeDefinition; } - public CSharpParsedFile ParsedFile { - get { return parsedFile; } + public CSharpUnresolvedFile UnresolvedFile { + get { return unresolvedFile; } } DomRegion MakeRegion(TextLocation start, TextLocation end) { - return new DomRegion(parsedFile.FileName, start.Line, start.Column, end.Line, end.Column); + return new DomRegion(unresolvedFile.FileName, start.Line, start.Column, end.Line, end.Column); } DomRegion MakeRegion(AstNode node) @@ -100,7 +97,17 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem if (node == null || node.IsNull) return DomRegion.Empty; else - return MakeRegion(node.StartLocation, node.EndLocation); + return MakeRegion(GetStartLocationAfterAttributes(node), node.EndLocation); + } + + internal static TextLocation GetStartLocationAfterAttributes(AstNode node) + { + AstNode child = node.FirstChild; + // Skip attributes and comments between attributes for the purpose of + // getting a declaration's region. + while (child != null && (child is AttributeSection || child.NodeType == NodeType.Whitespace)) + child = child.NextSibling; + return (child ?? node).StartLocation; } DomRegion MakeBraceRegion(AstNode node) @@ -113,10 +120,10 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem } #region Compilation Unit - public override IUnresolvedEntity VisitCompilationUnit (CompilationUnit unit) + public override IUnresolvedEntity VisitSyntaxTree (SyntaxTree unit) { - parsedFile.Errors = unit.Errors; - return base.VisitCompilationUnit (unit); + unresolvedFile.Errors = unit.Errors; + return base.VisitSyntaxTree (unit); } #endregion @@ -160,7 +167,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem usingScope.Region = region; } base.VisitNamespaceDeclaration(namespaceDeclaration); - parsedFile.UsingScopes.Add(usingScope); // add after visiting children so that nested scopes come first + unresolvedFile.UsingScopes.Add(usingScope); // add after visiting children so that nested scopes come first usingScope = previousUsingScope; return null; } @@ -177,9 +184,9 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem currentTypeDefinition.NestedTypes.Add(newType); } else { newType = new CSharpUnresolvedTypeDefinition(usingScope, name); - parsedFile.TopLevelTypeDefinitions.Add(newType); + unresolvedFile.TopLevelTypeDefinitions.Add(newType); } - newType.ParsedFile = parsedFile; + newType.UnresolvedFile = unresolvedFile; newType.HasExtensionMethods = false; // gets set to true when an extension method is added return newType; } @@ -861,9 +868,9 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem { // non-assembly attributes are handled by their parent entity if (attributeSection.AttributeTarget == "assembly") { - ConvertAttributes(parsedFile.AssemblyAttributes, attributeSection); + ConvertAttributes(unresolvedFile.AssemblyAttributes, attributeSection); } else if (attributeSection.AttributeTarget == "module") { - ConvertAttributes(parsedFile.ModuleAttributes, attributeSection); + ConvertAttributes(unresolvedFile.ModuleAttributes, attributeSection); } return null; } @@ -1190,7 +1197,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem } if (documentation != null) { documentation.Reverse(); // bring documentation in correct order - parsedFile.AddDocumentation(entity, string.Join(Environment.NewLine, documentation)); + unresolvedFile.AddDocumentation(entity, string.Join(Environment.NewLine, documentation)); } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/.gitignore b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/.gitignore deleted file mode 100644 index 9ce745d95d..0000000000 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -bin/ -obj/ \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/CSharpFile.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/CSharpFile.cs new file mode 100644 index 0000000000..addcd9e23a --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/CSharpFile.cs @@ -0,0 +1,68 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using ICSharpCode.NRefactory.CSharp; +using ICSharpCode.NRefactory.CSharp.Resolver; +using ICSharpCode.NRefactory.CSharp.TypeSystem; +using ICSharpCode.NRefactory.Editor; +using ICSharpCode.NRefactory.TypeSystem; + +namespace ICSharpCode.NRefactory.ConsistencyCheck +{ + public class CSharpFile + { + public readonly CSharpProject Project; + public readonly string FileName; + public readonly string OriginalText; + + public SyntaxTree SyntaxTree; + public CSharpUnresolvedFile UnresolvedTypeSystemForFile; + + public CSharpFile(CSharpProject project, string fileName) + { + this.Project = project; + this.FileName = fileName; + + CSharpParser p = new CSharpParser(project.CompilerSettings); +// using (var stream = File.OpenRead(fileName)) { +// this.CompilationUnit = p.Parse(stream, fileName); +// } + + // Keep the original text around; we might use it for a refactoring later + this.OriginalText = File.ReadAllText(fileName); + this.SyntaxTree = p.Parse(this.OriginalText, fileName); + + if (p.HasErrors) { + Console.WriteLine("Error parsing " + fileName + ":"); + foreach (var error in p.ErrorsAndWarnings) { + Console.WriteLine(" " + error.Region + " " + error.Message); + } + } + this.UnresolvedTypeSystemForFile = this.SyntaxTree.ToTypeSystem(); + } + + public CSharpAstResolver CreateResolver() + { + return new CSharpAstResolver(Project.Compilation, SyntaxTree, UnresolvedTypeSystemForFile); + } + } +} diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/CSharpProject.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/CSharpProject.cs index 0507ca395b..d6deadb933 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/CSharpProject.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/CSharpProject.cs @@ -20,163 +20,128 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; + using ICSharpCode.NRefactory.CSharp; -using ICSharpCode.NRefactory.CSharp.TypeSystem; -using ICSharpCode.NRefactory.Editor; using ICSharpCode.NRefactory.TypeSystem; +using Microsoft.Build.Framework; +using Microsoft.Build.Logging; namespace ICSharpCode.NRefactory.ConsistencyCheck { + /// + /// Represents a C# project (.csproj file) + /// public class CSharpProject { + /// + /// Parent solution. + /// public readonly Solution Solution; + + /// + /// Title is the project name as specified in the .sln file. + /// public readonly string Title; + + /// + /// Name of the output assembly. + /// public readonly string AssemblyName; + + /// + /// Full path to the .csproj file. + /// public readonly string FileName; public readonly List Files = new List(); public readonly CompilerSettings CompilerSettings = new CompilerSettings(); - public IProjectContent ProjectContent; + /// + /// The unresolved type system for this project. + /// + public readonly IProjectContent ProjectContent; - public ICompilation Compilation { - get { - return Solution.SolutionSnapshot.GetCompilation(ProjectContent); - } - } + /// + /// The resolved type system for this project. + /// This field is initialized once all projects have been loaded (in Solution constructor). + /// + public ICompilation Compilation; public CSharpProject(Solution solution, string title, string fileName) { + // Normalize the file name + fileName = Path.GetFullPath(fileName); + this.Solution = solution; this.Title = title; this.FileName = fileName; - var p = new Microsoft.Build.Evaluation.Project(fileName); - this.AssemblyName = p.GetPropertyValue("AssemblyName"); - this.CompilerSettings.AllowUnsafeBlocks = GetBoolProperty(p, "AllowUnsafeBlocks") ?? false; - this.CompilerSettings.CheckForOverflow = GetBoolProperty(p, "CheckForOverflowUnderflow") ?? false; - foreach (string symbol in p.GetPropertyValue("DefineConstants").Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { + // Use MSBuild to open the .csproj + var msbuildProject = new Microsoft.Build.Evaluation.Project(fileName); + // Figure out some compiler settings + this.AssemblyName = msbuildProject.GetPropertyValue("AssemblyName"); + this.CompilerSettings.AllowUnsafeBlocks = GetBoolProperty(msbuildProject, "AllowUnsafeBlocks") ?? false; + this.CompilerSettings.CheckForOverflow = GetBoolProperty(msbuildProject, "CheckForOverflowUnderflow") ?? false; + string defineConstants = msbuildProject.GetPropertyValue("DefineConstants"); + foreach (string symbol in defineConstants.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) this.CompilerSettings.ConditionalSymbols.Add(symbol.Trim()); + + // Initialize the unresolved type system + IProjectContent pc = new CSharpProjectContent(); + pc = pc.SetAssemblyName(this.AssemblyName); + pc = pc.SetProjectFileName(fileName); + pc = pc.SetCompilerSettings(this.CompilerSettings); + // Parse the C# code files + foreach (var item in msbuildProject.GetItems("Compile")) { + var file = new CSharpFile(this, Path.Combine(msbuildProject.DirectoryPath, item.EvaluatedInclude)); + Files.Add(file); } - foreach (var item in p.GetItems("Compile")) { - Files.Add(new CSharpFile(this, Path.Combine(p.DirectoryPath, item.EvaluatedInclude))); - } - List references = new List(); - string mscorlib = FindAssembly(Program.AssemblySearchPaths, "mscorlib"); - if (mscorlib != null) { - references.Add(Program.LoadAssembly(mscorlib)); - } else { - Console.WriteLine("Could not find mscorlib"); - } - bool hasSystemCore = false; - foreach (var item in p.GetItems("Reference")) { - string assemblyFileName = null; - if (item.HasMetadata("HintPath")) { - assemblyFileName = Path.Combine(p.DirectoryPath, item.GetMetadataValue("HintPath")); - if (!File.Exists(assemblyFileName)) - assemblyFileName = null; - } - if (assemblyFileName == null) { - assemblyFileName = FindAssembly(Program.AssemblySearchPaths, item.EvaluatedInclude); - } - if (assemblyFileName != null) { - if (Path.GetFileName(assemblyFileName).Equals("System.Core.dll", StringComparison.OrdinalIgnoreCase)) - hasSystemCore = true; - references.Add(Program.LoadAssembly(assemblyFileName)); - } else { - Console.WriteLine("Could not find referenced assembly " + item.EvaluatedInclude); - } + // Add parsed files to the type system + pc = pc.AddOrUpdateFiles(Files.Select(f => f.UnresolvedTypeSystemForFile)); + + // Add referenced assemblies: + foreach (string assemblyFile in ResolveAssemblyReferences(msbuildProject)) { + IUnresolvedAssembly assembly = solution.LoadAssembly(assemblyFile); + pc = pc.AddAssemblyReferences(new [] { assembly }); } - if (!hasSystemCore && FindAssembly(Program.AssemblySearchPaths, "System.Core") != null) - references.Add(Program.LoadAssembly(FindAssembly(Program.AssemblySearchPaths, "System.Core"))); - foreach (var item in p.GetItems("ProjectReference")) { - references.Add(new ProjectReference(solution, item.GetMetadataValue("Name"))); + + // Add project references: + foreach (var item in msbuildProject.GetItems("ProjectReference")) { + string referencedFileName = Path.Combine(msbuildProject.DirectoryPath, item.EvaluatedInclude); + // Normalize the path; this is required to match the name with the referenced project's file name + referencedFileName = Path.GetFullPath(referencedFileName); + pc = pc.AddAssemblyReferences(new[] { new ProjectReference(referencedFileName) }); } - this.ProjectContent = new CSharpProjectContent() - .SetAssemblyName(this.AssemblyName) - .SetCompilerSettings(this.CompilerSettings) - .AddAssemblyReferences(references) - .UpdateProjectContent(null, Files.Select(f => f.ParsedFile)); + this.ProjectContent = pc; } - string FindAssembly(IEnumerable assemblySearchPaths, string evaluatedInclude) + IEnumerable ResolveAssemblyReferences(Microsoft.Build.Evaluation.Project project) { - if (evaluatedInclude.IndexOf(',') >= 0) - evaluatedInclude = evaluatedInclude.Substring(0, evaluatedInclude.IndexOf(',')); - foreach (string searchPath in assemblySearchPaths) { - string assemblyFile = Path.Combine(searchPath, evaluatedInclude + ".dll"); - if (File.Exists(assemblyFile)) - return assemblyFile; - } - return null; + // Use MSBuild to figure out the full path of the referenced assemblies + var projectInstance = project.CreateProjectInstance(); + projectInstance.SetProperty("BuildingProject", "false"); + project.SetProperty("DesignTimeBuild", "true"); + + projectInstance.Build("ResolveAssemblyReferences", new [] { new ConsoleLogger(LoggerVerbosity.Minimal) }); + var items = projectInstance.GetItems("_ResolveAssemblyReferenceResolvedFiles"); + string baseDirectory = Path.GetDirectoryName(this.FileName); + return items.Select(i => Path.Combine(baseDirectory, i.GetMetadataValue("Identity"))); } static bool? GetBoolProperty(Microsoft.Build.Evaluation.Project p, string propertyName) { string val = p.GetPropertyValue(propertyName); - if (val.Equals("true", StringComparison.OrdinalIgnoreCase)) - return true; - if (val.Equals("false", StringComparison.OrdinalIgnoreCase)) - return false; - return null; + bool result; + if (bool.TryParse(val, out result)) + return result; + else + return null; } public override string ToString() { return string.Format("[CSharpProject AssemblyName={0}]", AssemblyName); } - - public CSharpFile GetFile(string fileName) - { - return Files.Single(f => f.FileName == fileName); - } - } - - public class ProjectReference : IAssemblyReference - { - readonly Solution solution; - readonly string projectTitle; - - public ProjectReference(Solution solution, string projectTitle) - { - this.solution = solution; - this.projectTitle = projectTitle; - } - - public IAssembly Resolve(ITypeResolveContext context) - { - var project = solution.Projects.Single(p => string.Equals(p.Title, projectTitle, StringComparison.OrdinalIgnoreCase)); - return project.ProjectContent.Resolve(context); - } - } - - public class CSharpFile - { - public readonly CSharpProject Project; - public readonly string FileName; - - public readonly ITextSource Content; - public readonly int LinesOfCode; - public CompilationUnit CompilationUnit; - public CSharpParsedFile ParsedFile; - - public CSharpFile(CSharpProject project, string fileName) - { - this.Project = project; - this.FileName = fileName; - this.Content = new StringTextSource(File.ReadAllText(FileName)); - this.LinesOfCode = 1 + this.Content.Text.Count(c => c == '\n'); - - CSharpParser p = new CSharpParser(project.CompilerSettings); - this.CompilationUnit = p.Parse(Content.CreateReader(), fileName); - if (p.HasErrors) { - Console.WriteLine("Error parsing " + fileName + ":"); - foreach (var error in p.ErrorsAndWarnings) { - Console.WriteLine(" " + error.Region + " " + error.Message); - } - } - this.ParsedFile = this.CompilationUnit.ToTypeSystem(); - } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/FindReferencesConsistencyCheck.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/FindReferencesConsistencyCheck.cs index 106336d309..839a6c54ff 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/FindReferencesConsistencyCheck.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/FindReferencesConsistencyCheck.cs @@ -59,8 +59,7 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck } } ); - var resolver = new CSharpAstResolver(file.Project.Compilation, file.CompilationUnit, file.ParsedFile); - resolver.ApplyNavigator(navigator); + file.CreateResolver().ApplyNavigator(navigator); } } Console.WriteLine("For each entity, find all references..."); @@ -102,19 +101,19 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck HashSet foundReferences = new HashSet(); var interestingFiles = new HashSet(); foreach (var searchScope in searchScopes) { - foreach (var parsedFile in fr.GetInterestingFiles(searchScope, project.Compilation)) { - var file = project.GetFile(parsedFile.FileName); - Debug.Assert(file.ParsedFile == parsedFile); + foreach (var unresolvedFile in fr.GetInterestingFiles(searchScope, project.Compilation)) { + var file = project.Files.Single(f => f.FileName == unresolvedFile.FileName); + Debug.Assert(file.UnresolvedTypeSystemForFile == unresolvedFile); // Skip file if it doesn't contain the search term - if (searchScope.SearchTerm != null && file.Content.IndexOf(searchScope.SearchTerm, 0, file.Content.TextLength, StringComparison.Ordinal) < 0) + if (searchScope.SearchTerm != null && file.OriginalText.IndexOf(searchScope.SearchTerm, StringComparison.Ordinal) < 0) continue; interestingFiles.Add(file); } } foreach (var file in interestingFiles) { - fr.FindReferencesInFile(searchScopes, file.ParsedFile, file.CompilationUnit, project.Compilation, + fr.FindReferencesInFile(searchScopes, file.UnresolvedTypeSystemForFile, file.SyntaxTree, project.Compilation, delegate(AstNode node, ResolveResult result) { foundReferences.Add(node); }, CancellationToken.None); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj index 0abf5100f1..d1351a7ff5 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj @@ -15,12 +15,12 @@ False 4 false + bin\$(Configuration)\ x86 - bin\Debug\ true Full False @@ -28,9 +28,7 @@ DEBUG;TRACE - bin\Release\ - False - None + PdbOnly True False TRACE @@ -38,8 +36,24 @@ AnyCPU + + true + Full + False + True + DEBUG;TRACE + v4.5 + + + PdbOnly + True + False + TRACE + v4.5 + + 3.5 @@ -57,6 +71,7 @@ Properties\GlobalAssemblyInfo.cs + @@ -66,6 +81,7 @@ + diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/Program.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/Program.cs index 97a7c67849..936edfab6e 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/Program.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/Program.cs @@ -52,16 +52,18 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck } Console.WriteLine("Loaded {0} lines of code ({1:f1} MB) in {2} files in {3} projects.", - solution.AllFiles.Sum(f => f.LinesOfCode), - solution.AllFiles.Sum(f => f.Content.TextLength) / 1024.0 / 1024.0, + solution.AllFiles.Sum(f => 1 + f.OriginalText.Count(c => c == '\n')), + solution.AllFiles.Sum(f => f.OriginalText.Length) / 1024.0 / 1024.0, solution.AllFiles.Count(), solution.Projects.Count); + //VisitorBenchmark.Run(solution.AllFiles.Select(f => f.SyntaxTree)); + using (new Timer("ID String test... ")) TypeSystemTests.IDStringConsistencyCheck(solution); using (new Timer("Resolve unresolved members... ")) TypeSystemTests.ResolvedUnresolvedMembers(solution); //RunTestOnAllFiles("Roundtripping test", RoundtripTest.RunTest); RunTestOnAllFiles("Resolver test", ResolverTest.RunTest); - RunTestOnAllFiles("Resolver test (no parsed file)", ResolverTest.RunTestWithoutParsedFile); + RunTestOnAllFiles("Resolver test (no parsed file)", ResolverTest.RunTestWithoutUnresolvedFile); RunTestOnAllFiles("Resolver test (randomized order)", RandomizedOrderResolverTest.RunTest); new FindReferencesConsistencyCheck(solution).Run(); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/RandomizedOrderResolverTest.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/RandomizedOrderResolverTest.cs index d6f9390bfc..a0610c4b1f 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/RandomizedOrderResolverTest.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/RandomizedOrderResolverTest.cs @@ -45,9 +45,9 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck Random rnd = new Random(seed); var test = new RandomizedOrderResolverTest(); // Resolve all nodes, but in a random order without using a navigator. - test.resolver = new CSharpAstResolver(file.Project.Compilation, file.CompilationUnit, file.ParsedFile); + test.resolver = new CSharpAstResolver(file.Project.Compilation, file.SyntaxTree, file.UnresolvedTypeSystemForFile); // For comparing whether the results are equivalent, we also use a normal 'resolve all' resolver: - test.resolveAllResolver = new CSharpAstResolver(file.Project.Compilation, file.CompilationUnit, file.ParsedFile); + test.resolveAllResolver = new CSharpAstResolver(file.Project.Compilation, file.SyntaxTree, file.UnresolvedTypeSystemForFile); test.resolveAllResolver.ApplyNavigator(new ResolveAllNavigator(), CancellationToken.None); // Prepare list of actions that we need to verify: var actions = new List>(); @@ -56,7 +56,7 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck bool checkStateAfter = rnd.Next(0, 2) == 0; bool checkConversion = rnd.Next(0, 2) == 0; bool checkExpectedType = rnd.Next(0, 2) == 0; - foreach (var _node in file.CompilationUnit.DescendantsAndSelf) { + foreach (var _node in file.SyntaxTree.DescendantsAndSelf) { var node = _node; if (CSharpAstResolver.IsUnresolvableNode(node)) continue; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/ResolverTest.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/ResolverTest.cs index ee367f8a68..be51723e5c 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/ResolverTest.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/ResolverTest.cs @@ -35,10 +35,10 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck { public static void RunTest(CSharpFile file) { - CSharpAstResolver resolver = new CSharpAstResolver(file.Project.Compilation, file.CompilationUnit, file.ParsedFile); + CSharpAstResolver resolver = new CSharpAstResolver(file.Project.Compilation, file.SyntaxTree, file.UnresolvedTypeSystemForFile); var navigator = new ValidatingResolveAllNavigator(file.FileName); resolver.ApplyNavigator(navigator, CancellationToken.None); - navigator.Validate(resolver, file.CompilationUnit); + navigator.Validate(resolver, file.SyntaxTree); } class ValidatingResolveAllNavigator : IResolveVisitorNavigator @@ -88,9 +88,9 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck } } - public virtual void Validate(CSharpAstResolver resolver, CompilationUnit cu) + public virtual void Validate(CSharpAstResolver resolver, SyntaxTree syntaxTree) { - foreach (AstNode node in cu.DescendantsAndSelf.Except(resolvedNodes.Keys)) { + foreach (AstNode node in syntaxTree.DescendantsAndSelf.Except(resolvedNodes.Keys)) { if (!CSharpAstResolver.IsUnresolvableNode(node)) { Console.WriteLine("Forgot to resolve " + node); } @@ -102,19 +102,19 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck } } - public static void RunTestWithoutParsedFile(CSharpFile file) + public static void RunTestWithoutUnresolvedFile(CSharpFile file) { - CSharpAstResolver resolver = new CSharpAstResolver(file.Project.Compilation, file.CompilationUnit); + CSharpAstResolver resolver = new CSharpAstResolver(file.Project.Compilation, file.SyntaxTree); var navigator = new ValidatingResolveAllNavigator(file.FileName); resolver.ApplyNavigator(navigator, CancellationToken.None); - navigator.Validate(resolver, file.CompilationUnit); + navigator.Validate(resolver, file.SyntaxTree); - CSharpAstResolver originalResolver = new CSharpAstResolver(file.Project.Compilation, file.CompilationUnit, file.ParsedFile); - foreach (var node in file.CompilationUnit.DescendantsAndSelf) { + CSharpAstResolver originalResolver = new CSharpAstResolver(file.Project.Compilation, file.SyntaxTree, file.UnresolvedTypeSystemForFile); + foreach (var node in file.SyntaxTree.DescendantsAndSelf) { var originalResult = originalResolver.Resolve(node); var result = resolver.Resolve(node); if (!RandomizedOrderResolverTest.IsEqualResolveResult(result, originalResult)) { - Console.WriteLine("Got different without IParsedFile at " + file.FileName + ":" + node.StartLocation); + Console.WriteLine("Got different without IUnresolvedFile at " + file.FileName + ":" + node.StartLocation); } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/RoundtripTest.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/RoundtripTest.cs index cb3cd6b06f..35f503d5bd 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/RoundtripTest.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/RoundtripTest.cs @@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck { public static void RunTest(CSharpFile file) { - string code = file.Content.Text.Replace("\r\n", "\n"); + string code = file.OriginalText.Replace("\r\n", "\n"); Debug.Assert(code.IndexOf('\r') < 0); if (code.Contains("#pragma")) return; // skip code with preprocessor directives @@ -63,13 +63,13 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck public static void Roundtrip(CSharpParser parser, string fileName, string code) { // 1. Parse - CompilationUnit cu = parser.Parse(code, fileName); + SyntaxTree syntaxTree = parser.Parse(code, fileName); if (parser.HasErrors) throw new InvalidOperationException("There were parse errors."); // 2. Output StringWriter w = new StringWriter(); - cu.AcceptVisitor(new CSharpOutputVisitor(w, FormattingOptionsFactory.CreateMono ())); + syntaxTree.AcceptVisitor(new CSharpOutputVisitor(w, FormattingOptionsFactory.CreateMono ())); string generatedCode = w.ToString().TrimEnd(); // 3. Compare output with original (modulo whitespaces) @@ -94,7 +94,7 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck throw new InvalidOperationException(@"Got lone \r in " + fileName); // 4. Parse generated output - CompilationUnit generatedCU; + SyntaxTree generatedCU; try { generatedCU = parser.Parse(generatedCode, fileName); } catch { @@ -108,7 +108,7 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck } // 5. Compare AST1 with AST2 - if (!cu.IsMatch(generatedCU)) + if (!syntaxTree.IsMatch(generatedCU)) throw new InvalidOperationException("AST match failed for " + fileName + "."); } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/Solution.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/Solution.cs index 279dd81c8f..0cdde17897 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/Solution.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/Solution.cs @@ -17,12 +17,14 @@ // DEALINGS IN THE SOFTWARE. using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; + using ICSharpCode.NRefactory.TypeSystem; -using ICSharpCode.NRefactory.TypeSystem.Implementation; +using ICSharpCode.NRefactory.Utils; namespace ICSharpCode.NRefactory.ConsistencyCheck { @@ -62,6 +64,25 @@ namespace ICSharpCode.NRefactory.ConsistencyCheck } } } + // Create compilations (resolved type systems) after all projects have been loaded. + // (we can't do this earlier because project A might have a reference to project B, where A is loaded before B) + // To allow NRefactory to resolve project references, we need to use a 'DefaultSolutionSnapshot' + // instead of calling CreateCompilation() on each project individually. + var solutionSnapshot = new DefaultSolutionSnapshot(this.Projects.Select(p => p.ProjectContent)); + foreach (CSharpProject project in this.Projects) { + project.Compilation = solutionSnapshot.GetCompilation(project.ProjectContent); + } + } + + ConcurrentDictionary assemblyDict = new ConcurrentDictionary(Platform.FileNameComparer); + + /// + /// Loads a referenced assembly from a .dll. + /// Returns the existing instance if the assembly was already loaded. + /// + public IUnresolvedAssembly LoadAssembly(string assemblyFileName) + { + return assemblyDict.GetOrAdd(assemblyFileName, file => new CecilLoader().LoadAssemblyFile(file)); } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/VisitorBenchmark.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/VisitorBenchmark.cs new file mode 100644 index 0000000000..855f09fea0 --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/VisitorBenchmark.cs @@ -0,0 +1,144 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using ICSharpCode.NRefactory.CSharp; + +namespace ICSharpCode.NRefactory.ConsistencyCheck +{ + /// + /// Determines the fastest way to retrieve a List{IdentifierExpression} of all identifiers + /// in a syntax tree. + /// + public class VisitorBenchmark + { + public static void Run(IEnumerable files) + { + files = files.ToList(); + + RunTest("recursive method using for", files, (syntaxTree, list) => WalkTreeFor(syntaxTree, list)); + RunTest("recursive method using foreach", files, (syntaxTree, list) => WalkTreeForEach(syntaxTree, list)); + RunTest("non-recursive loop", files, (syntaxTree, list) => WalkTreeNonRecursive(syntaxTree, list)); + RunTest("foreach over Descendants.OfType()", files, (syntaxTree, list) => { + foreach (var node in syntaxTree.Descendants.OfType()) { + list.Add(node); + } + }); + RunTest("DepthFirstAstVisitor", files, (syntaxTree, list) => syntaxTree.AcceptVisitor(new DepthFirst(list))); + RunTest("DepthFirstAstVisitor", files, (syntaxTree, list) => syntaxTree.AcceptVisitor(new DepthFirst(list))); + RunTest("DepthFirstAstVisitor", files, (syntaxTree, list) => syntaxTree.AcceptVisitor(new DepthFirst(list), null)); + RunTest("ObservableAstVisitor", files, (syntaxTree, list) => { + var visitor = new ObservableAstVisitor(); + visitor.EnterIdentifierExpression += list.Add; + syntaxTree.AcceptVisitor(visitor); + }); + } + + static void WalkTreeForEach(AstNode node, List list) + { + foreach (AstNode child in node.Children) { + IdentifierExpression id = child as IdentifierExpression; + if (id != null) { + list.Add(id); + } + WalkTreeForEach(child, list); + } + } + + static void WalkTreeFor(AstNode node, List list) + { + for (AstNode child = node.FirstChild; child != null; child = child.NextSibling) { + IdentifierExpression id = child as IdentifierExpression; + if (id != null) { + list.Add(id); + } + WalkTreeFor(child, list); + } + } + + static void WalkTreeNonRecursive(AstNode root, List list) + { + AstNode pos = root; + while (pos != null) { + { + IdentifierExpression id = pos as IdentifierExpression; + if (id != null) { + list.Add(id); + } + } + if (pos.FirstChild != null) { + pos = pos.FirstChild; + } else { + pos = pos.GetNextNode(); + } + } + } + + class DepthFirst : DepthFirstAstVisitor { + readonly List list; + public DepthFirst(List list) { this.list = list; } + public override void VisitIdentifierExpression(IdentifierExpression identifierExpression) + { + list.Add(identifierExpression); + base.VisitIdentifierExpression(identifierExpression); + } + } + class DepthFirst : DepthFirstAstVisitor { + readonly List list; + public DepthFirst(List list) { this.list = list; } + public override T VisitIdentifierExpression(IdentifierExpression identifierExpression) + { + list.Add(identifierExpression); + return base.VisitIdentifierExpression(identifierExpression); + } + } + class DepthFirst : DepthFirstAstVisitor { + readonly List list; + public DepthFirst(List list) { this.list = list; } + public override S VisitIdentifierExpression(IdentifierExpression identifierExpression, T data) + { + list.Add(identifierExpression); + return base.VisitIdentifierExpression(identifierExpression, data); + } + } + + static void RunTest(string text, IEnumerable files, Action> action) + { + // validation: + var list = new List(); + foreach (var file in files) { + list.Clear(); + action(file, list); + if (!list.SequenceEqual(file.Descendants.OfType())) + throw new InvalidOperationException(); + } + Stopwatch w = Stopwatch.StartNew(); + foreach (var file in files) { + for (int i = 0; i < 20; i++) { + list.Clear(); + action(file, list); + } + } + w.Stop(); + Console.WriteLine(text.PadRight(40) + ": " + w.Elapsed); + } + } +} diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Demo/.gitignore b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Demo/.gitignore deleted file mode 100644 index 9ce745d95d..0000000000 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Demo/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -bin/ -obj/ \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Demo/CSDemo.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Demo/CSDemo.cs index f6c76c9af6..9569f3f1d2 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Demo/CSDemo.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Demo/CSDemo.cs @@ -61,14 +61,13 @@ namespace ICSharpCode.NRefactory.Demo } } - CompilationUnit compilationUnit; + SyntaxTree syntaxTree; void CSharpParseButtonClick(object sender, EventArgs e) { - CSharpParser parser = new CSharpParser(); - compilationUnit = parser.Parse(new StringReader(csharpCodeTextBox.Text), "dummy.cs"); + syntaxTree = new CSharpParser().Parse(csharpCodeTextBox.Text, "demo.cs"); csharpTreeView.Nodes.Clear(); - foreach (var element in compilationUnit.Children) { + foreach (var element in syntaxTree.Children) { csharpTreeView.Nodes.Add(MakeTreeNode(element)); } SelectCurrentNode(csharpTreeView.Nodes); @@ -147,7 +146,7 @@ namespace ICSharpCode.NRefactory.Demo void CSharpGenerateCodeButtonClick(object sender, EventArgs e) { - csharpCodeTextBox.Text = compilationUnit.GetText(); + csharpCodeTextBox.Text = syntaxTree.GetText(); } int GetOffset(TextBox textBox, TextLocation location) @@ -205,8 +204,8 @@ namespace ICSharpCode.NRefactory.Demo void ResolveButtonClick(object sender, EventArgs e) { IProjectContent project = new CSharpProjectContent(); - var parsedFile = compilationUnit.ToTypeSystem(); - project = project.UpdateProjectContent(null, parsedFile); + var unresolvedFile = syntaxTree.ToTypeSystem(); + project = project.AddOrUpdateFiles(unresolvedFile); project = project.AddAssemblyReferences(builtInLibs.Value); ICompilation compilation = project.CreateCompilation(); @@ -214,12 +213,12 @@ namespace ICSharpCode.NRefactory.Demo ResolveResult result; if (csharpTreeView.SelectedNode != null) { var selectedNode = (AstNode)csharpTreeView.SelectedNode.Tag; - CSharpAstResolver resolver = new CSharpAstResolver(compilation, compilationUnit, parsedFile); + CSharpAstResolver resolver = new CSharpAstResolver(compilation, syntaxTree, unresolvedFile); result = resolver.Resolve(selectedNode); // CSharpAstResolver.Resolve() never returns null } else { TextLocation location = GetTextLocation(csharpCodeTextBox, csharpCodeTextBox.SelectionStart); - result = ResolveAtLocation.Resolve(compilation, parsedFile, compilationUnit, location); + result = ResolveAtLocation.Resolve(compilation, unresolvedFile, syntaxTree, location); if (result == null) { MessageBox.Show("Could not find a resolvable node at the caret location."); return; @@ -249,12 +248,12 @@ namespace ICSharpCode.NRefactory.Demo return; IProjectContent project = new CSharpProjectContent(); - var parsedFile = compilationUnit.ToTypeSystem(); - project = project.UpdateProjectContent(null, parsedFile); + var unresolvedFile = syntaxTree.ToTypeSystem(); + project = project.AddOrUpdateFiles(unresolvedFile); project = project.AddAssemblyReferences(builtInLibs.Value); ICompilation compilation = project.CreateCompilation(); - CSharpAstResolver resolver = new CSharpAstResolver(compilation, compilationUnit, parsedFile); + CSharpAstResolver resolver = new CSharpAstResolver(compilation, syntaxTree, unresolvedFile); AstNode node = (AstNode)csharpTreeView.SelectedNode.Tag; IEntity entity; @@ -277,7 +276,7 @@ namespace ICSharpCode.NRefactory.Demo var searchScopes = fr.GetSearchScopes(entity); Debug.WriteLine("Find references to " + entity.ReflectionName); - fr.FindReferencesInFile(searchScopes, parsedFile, compilationUnit, compilation, callback, CancellationToken.None); + fr.FindReferencesInFile(searchScopes, unresolvedFile, syntaxTree, compilation, callback, CancellationToken.None); MessageBox.Show("Found " + referenceCount + " references to " + entity.FullName); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj index c302a56ae0..0773ff3946 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj @@ -10,12 +10,12 @@ Properties 10.0.0 2.0 + ..\bin\$(Configuration)\ x86 - bin\Debug\ True Full False @@ -23,9 +23,7 @@ DEBUG;TRACE - bin\Release\ - False - None + PdbOnly True False TRACE @@ -45,6 +43,33 @@ 4 + + True + Full + False + True + DEBUG;TRACE + v4.5 + + + 4 + + + 4 + + + PdbOnly + True + False + TRACE + v4.5 + + + 4 + + + 4 + diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.GtkDemo/.gitignore b/src/Libraries/NRefactory/ICSharpCode.NRefactory.GtkDemo/.gitignore deleted file mode 100644 index 9ce745d95d..0000000000 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.GtkDemo/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -bin/ -obj/ \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.GtkDemo/ICSharpCode.NRefactory.GtkDemo.csproj b/src/Libraries/NRefactory/ICSharpCode.NRefactory.GtkDemo/ICSharpCode.NRefactory.GtkDemo.csproj index a772c27252..6e576fa169 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.GtkDemo/ICSharpCode.NRefactory.GtkDemo.csproj +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.GtkDemo/ICSharpCode.NRefactory.GtkDemo.csproj @@ -1,103 +1,123 @@ - - - - Debug - AnyCPU - 10.0.0 - 2.0 - {A7EEF7F8-238F-459D-95A9-96467539641D} - WinExe - ICSharpCode.NRefactory.GtkDemo - ICSharpCode.NRefactory.GtkDemo - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - none - false - bin\Release - prompt - 4 - false - - - - - gtk-sharp-2.0 - - - gtk-sharp-2.0 - - - glib-sharp-2.0 - - - glade-sharp-2.0 - - - gtk-sharp-2.0 - - - gtk-sharp-2.0 - - - - - - - gui.stetic - - - comment.png - - - class.png - - - expression.png - - - token.png - - - statement.png - - - namespace.png - - - - - - - - - - - - - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} - ICSharpCode.NRefactory - - - {53DCA265-3C3C-42F9-B647-F72BA678122B} - ICSharpCode.NRefactory.CSharp - - - - - PreserveNewest - - - - - + + + + Debug + AnyCPU + 10.0.0 + 2.0 + {A7EEF7F8-238F-459D-95A9-96467539641D} + WinExe + ICSharpCode.NRefactory.GtkDemo + ICSharpCode.NRefactory.GtkDemo + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + none + false + bin\Release + prompt + 4 + false + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + v4.5 + + + none + false + bin\Release + prompt + 4 + false + v4.5 + + + + + gtk-sharp-2.0 + + + gtk-sharp-2.0 + + + glib-sharp-2.0 + + + glade-sharp-2.0 + + + gtk-sharp-2.0 + + + gtk-sharp-2.0 + + + + + + + gui.stetic + + + comment.png + + + class.png + + + expression.png + + + token.png + + + statement.png + + + namespace.png + + + + + + + + + + + + + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} + ICSharpCode.NRefactory + + + {53DCA265-3C3C-42F9-B647-F72BA678122B} + ICSharpCode.NRefactory.CSharp + + + + + PreserveNewest + + + + + \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.GtkDemo/MainWindow.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.GtkDemo/MainWindow.cs index 81b85edbd5..1ac66ac3dd 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.GtkDemo/MainWindow.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.GtkDemo/MainWindow.cs @@ -46,7 +46,7 @@ namespace ICSharpCode.NRefactory.GtkDemo TreeStore store = new TreeStore (typeof (string), typeof (string), typeof (AstNode), typeof (Pixbuf)); Dictionary iterDict = new Dictionary (); // TextEditor editor = new TextEditor (); - CompilationUnit unit; + SyntaxTree unit; Pixbuf comment = new Pixbuf (typeof (MainWindow).Assembly, "comment.png"); Pixbuf classPixbuf = new Pixbuf (typeof (MainWindow).Assembly, "class.png"); @@ -129,7 +129,7 @@ namespace ICSharpCode.NRefactory.GtkDemo } - public void ShowUnit (CompilationUnit unit, CSharpAstResolver visitor) + public void ShowUnit (SyntaxTree unit, CSharpAstResolver visitor) { this.unit = unit; store.Clear (); @@ -223,14 +223,14 @@ namespace ICSharpCode.NRefactory.GtkDemo var parser = new CSharpParser (); var unit = parser.Parse (textview1.Buffer.Text, "dummy.cs"); - var parsedFile = unit.ToTypeSystem(); + var unresolvedFile = unit.ToTypeSystem(); IProjectContent project = new CSharpProjectContent (); - project = project.UpdateProjectContent (null, parsedFile); + project = project.AddOrUpdateFiles (unresolvedFile); project = project.AddAssemblyReferences (builtInLibs.Value); - CSharpAstResolver resolver = new CSharpAstResolver(project.CreateCompilation (), unit, parsedFile); + CSharpAstResolver resolver = new CSharpAstResolver(project.CreateCompilation (), unit, unresolvedFile); ShowUnit (unit, resolver); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/.gitignore b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/.gitignore deleted file mode 100644 index 9ce745d95d..0000000000 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -bin/ -obj/ \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Analysis/DefiniteAssignmentTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Analysis/DefiniteAssignmentTests.cs index 19af6d7310..4858bd5019 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Analysis/DefiniteAssignmentTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Analysis/DefiniteAssignmentTests.cs @@ -295,7 +295,7 @@ namespace ICSharpCode.NRefactory.CSharp.Analysis { string code = "int a; int b = X ? (a = 1) : 0;"; var block = new BlockStatement(); - block.Statements.AddRange(new CSharpParser().ParseStatements(new StringReader(code))); + block.Statements.AddRange(new CSharpParser().ParseStatements(code)); DefiniteAssignmentAnalysis da = CreateDefiniteAssignmentAnalysis(block); da.Analyze("a"); @@ -307,7 +307,7 @@ namespace ICSharpCode.NRefactory.CSharp.Analysis { string code = "int a; int b = X ? (a = 1) : (a = 2);"; var block = new BlockStatement(); - block.Statements.AddRange(new CSharpParser().ParseStatements(new StringReader(code))); + block.Statements.AddRange(new CSharpParser().ParseStatements(code)); DefiniteAssignmentAnalysis da = CreateDefiniteAssignmentAnalysis(block); da.Analyze("a"); @@ -319,7 +319,7 @@ namespace ICSharpCode.NRefactory.CSharp.Analysis { string code = "int a; int b = true ? (a = 1) : 0;"; var block = new BlockStatement(); - block.Statements.AddRange(new CSharpParser().ParseStatements(new StringReader(code))); + block.Statements.AddRange(new CSharpParser().ParseStatements(code)); DefiniteAssignmentAnalysis da = CreateDefiniteAssignmentAnalysis(block); da.Analyze("a"); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs index 824b113e61..8b662c6233 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CSharpOutputVisitorTests.cs @@ -47,7 +47,7 @@ namespace ICSharpCode.NRefactory.CSharp } } "; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); AssertOutput("class Test\n{\n$void Foo ()\n${\n$$Action act = delegate (int testMe) {\n$$};\n$}\n}\n", unit); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ContextActionTestBase.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ContextActionTestBase.cs index a094c3c002..409542ff94 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ContextActionTestBase.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ContextActionTestBase.cs @@ -84,7 +84,11 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions protected static void TestWrongContext (string input) where T : ICodeActionProvider, new () { - ICodeActionProvider action = new T (); + TestWrongContext (new T(), input); + } + + protected static void TestWrongContext (ICodeActionProvider action, string input) + { var context = TestRefactoringContext.Create (input); bool isValid = action.GetActions (context).Any (); if (!isValid) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/CreateBackingStoreTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/CreateBackingStoreTests.cs new file mode 100644 index 0000000000..9a0bb3fc39 --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/CreateBackingStoreTests.cs @@ -0,0 +1,77 @@ +// +// CreateBackingStoreTests.cs +// +// Author: +// Mike Krüger +// +// Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using NUnit.Framework; +using ICSharpCode.NRefactory.CSharp.Refactoring; +using System.Text; + +namespace ICSharpCode.NRefactory.CSharp.CodeActions +{ + [TestFixture] + public class CreateBackingStoreTests : ContextActionTestBase + { + [Test()] + public void TestSimpleStore () + { + Test (@"class TestClass +{ + string $Test { get; set; } +}", @"class TestClass +{ + string test; + string Test { + get { + return test; + } + set { + test = value; + } + } +}"); + } + + [Test()] + public void TestStaticStore () + { + Test (@"class TestClass +{ + public static string $Test { get; set; } +}", @"class TestClass +{ + static string test; + public static string Test { + get { + return test; + } + set { + test = value; + } + } +}"); + } + } +} + diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/GeneratePropertyTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/GeneratePropertyTests.cs index 98de6781c2..509fac1bd9 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/GeneratePropertyTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/GeneratePropertyTests.cs @@ -1,4 +1,4 @@ -// +// // GeneratePropertyTests.cs // // Author: @@ -107,5 +107,31 @@ class TestClass int myField, myOtherField; }"); } + + [Test] + public void CannotGeneratePropertyForReadOnlyField() + { + TestWrongContext ( + new GeneratePropertyAction (), + "using System;" + Environment.NewLine + + "class TestClass" + Environment.NewLine + + "{" + Environment.NewLine + + " readonly int $myField;" + Environment.NewLine + + "}" + ); + } + + [Test] + public void CannotGeneratePropertyForConst() + { + TestWrongContext ( + new GeneratePropertyAction (), + "using System;" + Environment.NewLine + + "class TestClass" + Environment.NewLine + + "{" + Environment.NewLine + + " const int $myField = 0;" + Environment.NewLine + + "}" + ); + } } } \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ImplementInterfaceExplicitTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ImplementInterfaceExplicitTests.cs index 1c0fd677cc..8fcec16c2d 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ImplementInterfaceExplicitTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ImplementInterfaceExplicitTests.cs @@ -1,4 +1,4 @@ -// +// // ImplementInterfaceExplicitTests.cs // // Author: @@ -49,6 +49,33 @@ class Foo : IDisposable } #endregion } +"); + } + + [Test] + public void NestedInterfaceInGenericClass() + { + Test(@"using System; +class TestClass { + public interface INestedInterface { T Prop { get; } } +} +class TargetClass : TestClass.$INestedInterface +{ +} +", @"using System; +class TestClass { + public interface INestedInterface { T Prop { get; } } +} +class TargetClass : TestClass.INestedInterface +{ + #region INestedInterface implementation + string TestClass.INestedInterface.Prop { + get { + throw new NotImplementedException (); + } + } + #endregion +} "); } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/TestRefactoringContext.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/TestRefactoringContext.cs index a3e6bb0ae4..b71740a9e4 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/TestRefactoringContext.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/TestRefactoringContext.cs @@ -158,8 +158,8 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions { FindReferences refFinder = new FindReferences (); refFinder.FindReferencesInFile (refFinder.GetSearchScopes (entity), - context.ParsedFile, - context.RootNode as CompilationUnit, + context.UnresolvedFile, + context.RootNode as SyntaxTree, context.Compilation, (n, r) => Rename (n, name), context.CancellationToken); } @@ -168,8 +168,8 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions { FindReferences refFinder = new FindReferences (); refFinder.FindLocalReferences (variable, - context.ParsedFile, - context.RootNode as CompilationUnit, + context.UnresolvedFile, + context.RootNode as SyntaxTree, context.Compilation, (n, r) => Rename (n, name), context.CancellationToken); } @@ -178,8 +178,8 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions { FindReferences refFinder = new FindReferences (); refFinder.FindTypeParameterReferences (type, - context.ParsedFile, - context.RootNode as CompilationUnit, + context.UnresolvedFile, + context.RootNode as SyntaxTree, context.Compilation, (n, r) => Rename (n, name), context.CancellationToken); } @@ -258,14 +258,14 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions Console.WriteLine (error.Message); Assert.IsFalse (parser.HasErrors, "File contains parsing errors."); unit.Freeze (); - var parsedFile = unit.ToTypeSystem (); + var unresolvedFile = unit.ToTypeSystem (); IProjectContent pc = new CSharpProjectContent (); - pc = pc.UpdateProjectContent (null, parsedFile); + pc = pc.AddOrUpdateFiles (unresolvedFile); pc = pc.AddAssemblyReferences (new[] { CecilLoaderTests.Mscorlib, CecilLoaderTests.SystemCore }); var compilation = pc.CreateCompilation (); - var resolver = new CSharpAstResolver (compilation, unit, parsedFile); + var resolver = new CSharpAstResolver (compilation, unit, unresolvedFile); TextLocation location = TextLocation.Empty; if (idx >= 0) location = doc.GetLocation (idx); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/BrowsableAttributeTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/BrowsableAttributeTests.cs new file mode 100644 index 0000000000..5631ad5a49 --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/BrowsableAttributeTests.cs @@ -0,0 +1,148 @@ +// +// BrowsableAttributeTests.cs +// +// Author: +// Mike Krüger +// +// Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using NUnit.Framework; +using System.Diagnostics; + +namespace ICSharpCode.NRefactory.CSharp.CodeCompletion +{ + [TestFixture] + public class BrowsableAttributeTests : TestBase + { + [Test()] + public void TestEditorBrowsableAttributeClasses () + { + int cp; + var engine1 = CodeCompletionBugTests.CreateEngine ( + @" +using System; +using System.ComponentModel; + +[EditorBrowsable(EditorBrowsableState.Always)] +public class BrowsableTest {} + +[EditorBrowsable(EditorBrowsableState.Never)] +public class NotBrowsableTest {} +", out cp); + CompletionDataList provider = CodeCompletionBugTests.CreateProvider ( + @"class Test +{ + void Test () + { + $B$ + } +}", false, engine1.ctx.CurrentAssembly.UnresolvedAssembly); + Assert.IsNotNull (provider, "provider == null"); + Assert.IsNotNull (provider.Find ("BrowsableTest"), "'BrowsableTest' not found."); + Assert.IsNull (provider.Find ("NotBrowsableTest"), "'NotBrowsableTest' found."); + } + + [Test()] + public void TestEditorBrowsableAttributeClassesSameAssembly () + { + CompletionDataList provider = CodeCompletionBugTests.CreateProvider ( + @" +using System; +using System.ComponentModel; + +[EditorBrowsable(EditorBrowsableState.Always)] +public class BrowsableTest {} + +[EditorBrowsable(EditorBrowsableState.Never)] +public class NotBrowsableTest {} + +class Test +{ + void Test () + { + $B$ + } +}"); + Assert.IsNotNull (provider, "provider == null"); + Assert.IsNotNull (provider.Find ("BrowsableTest"), "'BrowsableTest' not found."); + Assert.IsNotNull (provider.Find ("NotBrowsableTest"), "'NotBrowsableTest' not found."); + } + + [Test()] + public void TestEditorBrowsableAttributeMembers () + { + int cp; + var engine1 = CodeCompletionBugTests.CreateEngine ( + @" +using System; +using System.ComponentModel; +public class FooBar +{ + [EditorBrowsable(EditorBrowsableState.Always)] + public int BrowsableTest { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public int NotBrowsableTest { get; set; } +} +", out cp); + CompletionDataList provider = CodeCompletionBugTests.CreateProvider ( + @"class Test : FooBar +{ + void Test () + { + $B$ + } +}", false, engine1.ctx.CurrentAssembly.UnresolvedAssembly); + Assert.IsNotNull (provider, "provider == null"); + Assert.IsNotNull (provider.Find ("BrowsableTest"), "'BrowsableTest' not found."); + Assert.IsNull (provider.Find ("NotBrowsableTest"), "'NotBrowsableTest' found."); + } + + + [Test()] + public void TestEditorBrowsableAttributeMembersSameAssembly () + { + + CompletionDataList provider = CodeCompletionBugTests.CreateProvider ( + @" +using System; +using System.ComponentModel; + +class Test +{ + [EditorBrowsable(EditorBrowsableState.Always)] + int BrowsableTest { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + int NotBrowsableTest { get; set; } + + void Test () + { + $B$ + } +}"); + Assert.IsNotNull (provider, "provider == null"); + Assert.IsNotNull (provider.Find ("BrowsableTest"), "'BrowsableTest' not found."); + Assert.IsNotNull (provider.Find ("NotBrowsableTest"), "'NotBrowsableTest' not found."); + } + } +} + diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs index 2c07ee42f7..5c340b5e38 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs @@ -1,4 +1,4 @@ -// +// // CodeCompletionBugTests.cs // // Author: @@ -136,15 +136,6 @@ namespace ICSharpCode.NRefactory.CSharp.CodeCompletion return new CompletionData (entity.Name); } - public ICompletionData CreateEntityCompletionData (ICSharpCode.NRefactory.TypeSystem.IUnresolvedEntity entity, string text) - { - return new CompletionData (text); - } - - public ICompletionData CreateTypeCompletionData (ICSharpCode.NRefactory.TypeSystem.IUnresolvedTypeDefinition type, string shortType) - { - return new CompletionData (shortType); - } public ICompletionData CreateTypeCompletionData (ICSharpCode.NRefactory.TypeSystem.IType type, string shortType) { @@ -166,7 +157,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeCompletion return new CompletionData (variable.Name); } - public ICompletionData CreateVariableCompletionData (ICSharpCode.NRefactory.TypeSystem.IUnresolvedTypeParameter parameter) + public ICompletionData CreateVariableCompletionData (ICSharpCode.NRefactory.TypeSystem.ITypeParameter parameter) { return new CompletionData (parameter.Name); } @@ -199,52 +190,72 @@ namespace ICSharpCode.NRefactory.CSharp.CodeCompletion #endregion } - static CompletionDataList CreateProvider(string text, bool isCtrlSpace) + public static IUnresolvedAssembly SystemAssembly { get { return systemAssembly.Value; } } + static readonly Lazy systemAssembly = new Lazy( + delegate { + return new CecilLoader().LoadAssemblyFile(typeof(System.ComponentModel.BrowsableAttribute).Assembly.Location); + }); + + public static CSharpCompletionEngine CreateEngine(string text, out int cursorPosition, params IUnresolvedAssembly[] references) { string parsedText; string editorText; - int cursorPosition = text.IndexOf('$'); + cursorPosition = text.IndexOf('$'); int endPos = text.IndexOf('$', cursorPosition + 1); if (endPos == -1) { - parsedText = editorText = text.Substring(0, cursorPosition) + text.Substring(cursorPosition + 1); + if (cursorPosition < 0) { + parsedText = editorText = text; + } else { + parsedText = editorText = text.Substring(0, cursorPosition) + text.Substring(cursorPosition + 1); + } } else { - parsedText = text.Substring(0, cursorPosition) + new string(' ', endPos - cursorPosition) + text.Substring(endPos + 1); - editorText = text.Substring(0, cursorPosition) + text.Substring(cursorPosition + 1, endPos - cursorPosition - 1) + text.Substring(endPos + 1); - cursorPosition = endPos - 1; + parsedText = text.Substring(0, cursorPosition) + new string(' ', endPos - cursorPosition) + text.Substring(endPos + 1); + editorText = text.Substring(0, cursorPosition) + text.Substring(cursorPosition + 1, endPos - cursorPosition - 1) + text.Substring(endPos + 1); + cursorPosition = endPos - 1; } var doc = new ReadOnlyDocument(editorText); - + IProjectContent pctx = new CSharpProjectContent(); - pctx = pctx.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib, CecilLoaderTests.SystemCore }); - - var compilationUnit = new CSharpParser().Parse(parsedText, "program.cs"); - compilationUnit.Freeze(); - - var parsedFile = compilationUnit.ToTypeSystem(); - pctx = pctx.UpdateProjectContent(null, parsedFile); - + var refs = new List { CecilLoaderTests.Mscorlib, CecilLoaderTests.SystemCore, SystemAssembly }; + if (references != null) + refs.AddRange (references); + + pctx = pctx.AddAssemblyReferences(refs); + + var syntaxTree = new CSharpParser().Parse(parsedText, "program.cs"); + syntaxTree.Freeze(); + + var unresolvedFile = syntaxTree.ToTypeSystem(); + pctx = pctx.AddOrUpdateFiles(unresolvedFile); + var cmp = pctx.CreateCompilation(); - var loc = doc.GetLocation(cursorPosition); - + var loc = cursorPosition > 0 ? doc.GetLocation(cursorPosition) : new TextLocation (1, 1); + var rctx = new CSharpTypeResolveContext(cmp.MainAssembly); - rctx = rctx.WithUsingScope(parsedFile.GetUsingScope(loc).Resolve(cmp)); - + rctx = rctx.WithUsingScope(unresolvedFile.GetUsingScope(loc).Resolve(cmp)); - var curDef = parsedFile.GetInnermostTypeDefinition(loc); + var curDef = unresolvedFile.GetInnermostTypeDefinition(loc); if (curDef != null) { - var resolvedDef = curDef.Resolve(rctx).GetDefinition(); - rctx = rctx.WithCurrentTypeDefinition(resolvedDef); - var curMember = resolvedDef.Members.FirstOrDefault(m => m.Region.Begin <= loc && loc < m.BodyRegion.End); - if (curMember != null) { - rctx = rctx.WithCurrentMember(curMember); - } + var resolvedDef = curDef.Resolve(rctx).GetDefinition(); + rctx = rctx.WithCurrentTypeDefinition(resolvedDef); + var curMember = resolvedDef.Members.FirstOrDefault(m => m.Region.Begin <= loc && loc < m.BodyRegion.End); + if (curMember != null) { + rctx = rctx.WithCurrentMember(curMember); + } } - var mb = new DefaultCompletionContextProvider(doc, parsedFile); - var engine = new CSharpCompletionEngine (doc, mb, new TestFactory (), pctx, rctx); - + var mb = new DefaultCompletionContextProvider(doc, unresolvedFile); + mb.AddSymbol ("TEST"); + var engine = new CSharpCompletionEngine(doc, mb, new TestFactory(), pctx, rctx); + engine.EolMarker = Environment.NewLine; - engine.FormattingPolicy = FormattingOptionsFactory.CreateMono (); - + engine.FormattingPolicy = FormattingOptionsFactory.CreateMono(); + return engine; + } + + public static CompletionDataList CreateProvider(string text, bool isCtrlSpace, params IUnresolvedAssembly[] references) + { + int cursorPosition; + var engine = CreateEngine(text, out cursorPosition, references); var data = engine.GetCompletionData (cursorPosition, isCtrlSpace); return new CompletionDataList () { @@ -255,24 +266,24 @@ namespace ICSharpCode.NRefactory.CSharp.CodeCompletion }; } - Tuple GetContent(string text, CompilationUnit compilationUnit) + Tuple GetContent(string text, SyntaxTree syntaxTree) { var doc = new ReadOnlyDocument(text); IProjectContent pctx = new CSharpProjectContent(); pctx = pctx.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib, CecilLoaderTests.SystemCore }); - var parsedFile = compilationUnit.ToTypeSystem(); + var unresolvedFile = syntaxTree.ToTypeSystem(); - pctx = pctx.UpdateProjectContent(null, parsedFile); + pctx = pctx.AddOrUpdateFiles(unresolvedFile); var cmp = pctx.CreateCompilation(); - var mb = new DefaultCompletionContextProvider(doc, parsedFile); + var mb = new DefaultCompletionContextProvider(doc, unresolvedFile); var engine = new CSharpCompletionEngine (doc, mb, new TestFactory (), pctx, new CSharpTypeResolveContext (cmp.MainAssembly)); engine.EolMarker = Environment.NewLine; engine.FormattingPolicy = FormattingOptionsFactory.CreateMono (); return Tuple.Create (doc, engine); } - static CompletionDataList CreateProvider (string text, CompilationUnit compilationUnit, CSharpCompletionEngine engine, ReadOnlyDocument doc, TextLocation loc) + static CompletionDataList CreateProvider (string text, SyntaxTree syntaxTree, CSharpCompletionEngine engine, ReadOnlyDocument doc, TextLocation loc) { var cursorPosition = doc.GetOffset (loc); @@ -5365,6 +5376,45 @@ public class FooBar }); } + [Test()] + public void TestCompletionInPreprocessorIf() + { + CombinedProviderTest( + @"using System; +public class FooBar +{ + public static void Main (string[] args) + { + #if TEST + $Console.$ + #endif + } +} + +", provider => { + Assert.IsNotNull(provider.Find("WriteLine")); + }); + } + + [Test()] + public void TestCompletionInUndefinedPreprocessorIf() + { + CombinedProviderTest( + @"using System; +public class FooBar +{ + public static void Main (string[] args) + { + #if UNDEFINED + $Console.$ + #endif + } +} + +", provider => { + Assert.IsNull(provider.Find("WriteLine")); + }); + } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/DelegateContextTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/DelegateContextTests.cs index 7a66ddea77..07c5fec923 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/DelegateContextTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/DelegateContextTests.cs @@ -97,6 +97,30 @@ public class Test Assert.IsNotNull(provider.Find("(arg1, arg2)")); }); } + + + [Test()] + public void TestRefOutParams() + { + CodeCompletionBugTests.CombinedProviderTest( + @"using System; +public delegate void FooBar (out int foo, ref int bar, params object[] additional); + +public class Test +{ + FooBar foo; + + void TestFoo() + { + $foo = d$ + } +} +", provider => { + Assert.IsFalse(provider.AutoSelect); + Assert.IsNotNull(provider.Find("(out int foo, ref int bar, object[] additional)")); + Assert.IsNull(provider.Find("(foo, bar, additional)")); + }); + } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/ParameterCompletionTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/ParameterCompletionTests.cs index e414b6bd2b..85bfea561a 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/ParameterCompletionTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/ParameterCompletionTests.cs @@ -1,4 +1,4 @@ -// +// // ParameterCompletionTests.cs // // Author: @@ -272,26 +272,26 @@ namespace ICSharpCode.NRefactory.CSharp.CodeCompletion IProjectContent pctx = new CSharpProjectContent(); pctx = pctx.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib, CecilLoaderTests.SystemCore }); - var compilationUnit = new CSharpParser().Parse(parsedText, "program.cs"); - compilationUnit.Freeze(); + var syntaxTree = new CSharpParser().Parse(parsedText, "program.cs"); + syntaxTree.Freeze(); - var parsedFile = compilationUnit.ToTypeSystem(); - pctx = pctx.UpdateProjectContent(null, parsedFile); + var unresolvedFile = syntaxTree.ToTypeSystem(); + pctx = pctx.AddOrUpdateFiles(unresolvedFile); var cmp = pctx.CreateCompilation(); var loc = doc.GetLocation(cursorPosition); var rctx = new CSharpTypeResolveContext(cmp.MainAssembly); - rctx = rctx.WithUsingScope(parsedFile.GetUsingScope(loc).Resolve(cmp)); - var curDef = parsedFile.GetInnermostTypeDefinition(loc); + rctx = rctx.WithUsingScope(unresolvedFile.GetUsingScope(loc).Resolve(cmp)); + var curDef = unresolvedFile.GetInnermostTypeDefinition(loc); if (curDef != null) { rctx = rctx.WithCurrentTypeDefinition(curDef.Resolve(rctx).GetDefinition()); - var curMember = parsedFile.GetMember(loc); + var curMember = unresolvedFile.GetMember(loc); if (curMember != null) { rctx = rctx.WithCurrentMember(curMember.CreateResolved(rctx)); } } - var mb = new DefaultCompletionContextProvider(doc, parsedFile); + var mb = new DefaultCompletionContextProvider(doc, unresolvedFile); var engine = new CSharpParameterCompletionEngine (doc, mb, new TestFactory (pctx), pctx, rctx); return engine.GetParameterDataProvider (cursorPosition, doc.GetCharAt (cursorPosition - 1)); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeDomConvertVisitorTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeDomConvertVisitorTests.cs index 52d55315bd..77e7246a64 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeDomConvertVisitorTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeDomConvertVisitorTests.cs @@ -34,15 +34,15 @@ namespace ICSharpCode.NRefactory.CSharp public class CodeDomConvertVisitorTests : ResolverTestBase { CodeDomConvertVisitor convertVisitor; - CSharpParsedFile parsedFile; + CSharpUnresolvedFile unresolvedFile; public override void SetUp() { base.SetUp(); - parsedFile = new CSharpParsedFile("test.cs"); - parsedFile.RootUsingScope.Usings.Add(MakeReference("System")); - parsedFile.RootUsingScope.Usings.Add(MakeReference("System.Collections.Generic")); - parsedFile.RootUsingScope.Usings.Add(MakeReference("System.Linq")); + unresolvedFile = new CSharpUnresolvedFile("test.cs"); + unresolvedFile.RootUsingScope.Usings.Add(MakeReference("System")); + unresolvedFile.RootUsingScope.Usings.Add(MakeReference("System.Collections.Generic")); + unresolvedFile.RootUsingScope.Usings.Add(MakeReference("System.Linq")); convertVisitor = new CodeDomConvertVisitor(); convertVisitor.AllowSnippetNodes = false; @@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.CSharp string ConvertHelper(AstNode node, Action action) { CSharpResolver resolver = new CSharpResolver(compilation); - resolver = resolver.WithCurrentUsingScope(parsedFile.RootUsingScope.Resolve(compilation)); + resolver = resolver.WithCurrentUsingScope(unresolvedFile.RootUsingScope.Resolve(compilation)); resolver = resolver.WithCurrentTypeDefinition(compilation.FindType(KnownTypeCode.Object).GetDefinition()); var codeObj = convertVisitor.Convert(node, new CSharpAstResolver(resolver, node)); @@ -71,7 +71,7 @@ namespace ICSharpCode.NRefactory.CSharp string ConvertExpression(string code) { CSharpParser parser = new CSharpParser(); - var expr = parser.ParseExpression(new StringReader(code)); + var expr = parser.ParseExpression(code); Assert.IsFalse(parser.HasErrors); return ConvertExpression(expr); } @@ -84,7 +84,7 @@ namespace ICSharpCode.NRefactory.CSharp string ConvertStatement(string code) { CSharpParser parser = new CSharpParser(); - var expr = parser.ParseStatements(new StringReader(code)).Single(); + var expr = parser.ParseStatements(code).Single(); Assert.IsFalse(parser.HasErrors); return ConvertStatement(expr); } @@ -97,7 +97,7 @@ namespace ICSharpCode.NRefactory.CSharp string ConvertMember(string code) { CSharpParser parser = new CSharpParser(); - var expr = parser.ParseTypeMembers(new StringReader(code)).Single(); + var expr = parser.ParseTypeMembers(code).Single(); Assert.IsFalse(parser.HasErrors); return ConvertMember(expr); } @@ -110,9 +110,9 @@ namespace ICSharpCode.NRefactory.CSharp string ConvertTypeDeclaration(string code) { CSharpParser parser = new CSharpParser(); - var cu = parser.Parse(new StringReader(code), "program.cs"); + var syntaxTree = parser.Parse(code, "program.cs"); Assert.IsFalse(parser.HasErrors); - return ConvertTypeDeclaration((EntityDeclaration)cu.Children.Single()); + return ConvertTypeDeclaration((EntityDeclaration)syntaxTree.Children.Single()); } #endregion diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs index 0646aa5a78..3a795ef73e 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs @@ -1,4 +1,4 @@ -// +// // ParserBugTests.cs // // Author: @@ -53,7 +53,7 @@ class Foo { } }"; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); var type = unit.Members.First() as TypeDeclaration; var constructor = type.Members.Skip(1).First() as ConstructorDeclaration; var passed = !constructor.HasModifier(Modifiers.Override); @@ -78,7 +78,7 @@ class Stub return new Test () } }"; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); var type = unit.Members.First() as TypeDeclaration; var method = type.Members.First() as MethodDeclaration; bool passed = method.Body.Statements.FirstOrDefault() is ReturnStatement; @@ -102,7 +102,7 @@ class TestClass { } }"; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); var type = unit.Members.First() as TypeDeclaration; var constructor = type.Members.First() as ConstructorDeclaration; @@ -131,7 +131,7 @@ class Foo Test(new Foo ( } }"; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); var type = unit.Members.First() as TypeDeclaration; var method = type.Members.First() as MethodDeclaration; @@ -157,7 +157,7 @@ class Foo for (int i = 0; i < foo.bar) } }"; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); bool passed = @"class Foo { @@ -187,7 +187,7 @@ class Foo a = cond ? expr } }"; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); var type = unit.Members.First() as TypeDeclaration; var method = type.Members.First() as MethodDeclaration; @@ -213,7 +213,7 @@ class Foo a = cond ? expr : } }"; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); var type = unit.Members.First() as TypeDeclaration; var method = type.Members.First() as MethodDeclaration; @@ -242,7 +242,7 @@ class Foo string str = } }"; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); var type = unit.Members.First() as TypeDeclaration; var method = type.Members.First() as MethodDeclaration; @@ -269,7 +269,7 @@ class Foo } catch (Exception name) } }"; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); var type = unit.Members.First() as TypeDeclaration; var method = type.Members.First() as MethodDeclaration; @@ -300,7 +300,7 @@ class Test } } "; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); bool passed = unit.GetText().Trim() == @"using System; class Test @@ -336,7 +336,7 @@ class Foo } } "; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); var type = unit.Members.First() as TypeDeclaration; var method = type.Members.First() as MethodDeclaration; @@ -363,7 +363,7 @@ class Foo yield return new Foo { } } }"; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); bool passed = unit.GetText().Trim() == @"public class Bar { @@ -398,7 +398,7 @@ class Foo } } "; - var unit = CompilationUnit.Parse(code); + var unit = SyntaxTree.Parse(code); var type = unit.Members.First() as TypeDeclaration; var method = type.Members.First() as MethodDeclaration; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/ArrayCreateExpressionTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/ArrayCreateExpressionTests.cs index 7e52a53d6a..4efc4309a2 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/ArrayCreateExpressionTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/ArrayCreateExpressionTests.cs @@ -158,7 +158,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression }, ace.Initializer.Children.Select(c => c.Role).ToArray()); } - [Test, Ignore("Parser bug")] + [Test] public void ArrayInitializerWithCommaAtEnd() { var ace = ParseUtilCSharp.ParseExpression("new [] { 1, }"); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/PrimitiveExpressionTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/PrimitiveExpressionTests.cs index 74579ddce9..d6667e53a7 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/PrimitiveExpressionTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/PrimitiveExpressionTests.cs @@ -237,7 +237,14 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression } [Test] - [Ignore("Mono parser crash")] + public void InvalidUnicodeEscapeSequence() + { + string code = @"""\u{0}"""; + var pe = ParseUtilCSharp.ParseExpression(code, expectErrors: true); + Assert.AreEqual(code, pe.LiteralValue); + } + + [Test] public void LargeVerbatimString() { StringBuilder b = new StringBuilder(); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/QueryExpressionTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/QueryExpressionTests.cs index b22860100a..fb863b074e 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/QueryExpressionTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/QueryExpressionTests.cs @@ -17,6 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; +using System.Linq; using NUnit.Framework; namespace ICSharpCode.NRefactory.CSharp.Parser.Expression @@ -180,7 +181,127 @@ select new { c.Name, o.OrderID, o.Total }", } }}); } + + [Test] + public void ExpressionWithOrderByWithTwoOrderings() + { + ParseUtilCSharp.AssertExpression( + "from c in customers orderby c.Name, c.Address select c", + new QueryExpression { + Clauses = { + new QueryFromClause { + Identifier = "c", + Expression = new IdentifierExpression("customers") + }, + new QueryOrderClause { + Orderings = { + new QueryOrdering { + Expression = new IdentifierExpression("c").Member("Name") + }, + new QueryOrdering { + Expression = new IdentifierExpression("c").Member("Address") + } + } + }, + new QuerySelectClause { + Expression = new IdentifierExpression("c") + } + }}); + } + + [Test] + public void ExpressionWithOrderByWithTwoOrderBys() + { + ParseUtilCSharp.AssertExpression( + "from c in customers orderby c.Name orderby c.Address select c", + new QueryExpression { + Clauses = { + new QueryFromClause { + Identifier = "c", + Expression = new IdentifierExpression("customers") + }, + new QueryOrderClause { + Orderings = { + new QueryOrdering { + Expression = new IdentifierExpression("c").Member("Name") + } + } + }, + new QueryOrderClause { + Orderings = { + new QueryOrdering { + Expression = new IdentifierExpression("c").Member("Address") + } + } + }, + new QuerySelectClause { + Expression = new IdentifierExpression("c") + } + }}); + } + [Test] + public void ExpressionWithOrderByWithTwoOrderingsDescending() + { + ParseUtilCSharp.AssertExpression( + "from c in customers orderby c.Name descending, c.Address descending select c", + new QueryExpression { + Clauses = { + new QueryFromClause { + Identifier = "c", + Expression = new IdentifierExpression("customers") + }, + new QueryOrderClause { + Orderings = { + new QueryOrdering { + Expression = new IdentifierExpression("c").Member("Name"), + Direction = QueryOrderingDirection.Descending + }, + new QueryOrdering { + Expression = new IdentifierExpression("c").Member("Address"), + Direction = QueryOrderingDirection.Descending + } + } + }, + new QuerySelectClause { + Expression = new IdentifierExpression("c") + } + }}); + } + + [Test] + public void ExpressionWithOrderByWithTwoOrderByDecendings() + { + ParseUtilCSharp.AssertExpression( + "from c in customers orderby c.Name descending orderby c.Address descending select c", + new QueryExpression { + Clauses = { + new QueryFromClause { + Identifier = "c", + Expression = new IdentifierExpression("customers") + }, + new QueryOrderClause { + Orderings = { + new QueryOrdering { + Expression = new IdentifierExpression("c").Member("Name"), + Direction = QueryOrderingDirection.Descending + } + } + }, + new QueryOrderClause { + Orderings = { + new QueryOrdering { + Expression = new IdentifierExpression("c").Member("Address"), + Direction = QueryOrderingDirection.Descending + } + } + }, + new QuerySelectClause { + Expression = new IdentifierExpression("c") + } + }}); + } + [Test] public void ExpressionWithOrderByAndLet() { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/UnaryOperatorExpressionTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/UnaryOperatorExpressionTests.cs index 026db6bc68..6aca231cf6 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/UnaryOperatorExpressionTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/UnaryOperatorExpressionTests.cs @@ -134,5 +134,22 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression UnaryOperatorExpression adrOf = (UnaryOperatorExpression)ce.Expression; Assert.AreEqual(UnaryOperatorType.AddressOf, adrOf.Operator); } + + [Test] + public void AwaitStaticMethodCall() + { + var uoe = ParseUtilCSharp.ParseExpression("await Task.WhenAll(a, b)"); + Assert.AreEqual(UnaryOperatorType.Await, uoe.Operator); + Assert.IsInstanceOf(uoe.Expression); + } + + [Test] + public void AwaitStaticMethodCallStatement() + { + var es = ParseUtilCSharp.ParseStatement("await Task.WhenAll(a, b);"); + UnaryOperatorExpression uoe = (UnaryOperatorExpression)es.Expression; + Assert.AreEqual(UnaryOperatorType.Await, uoe.Operator); + Assert.IsInstanceOf(uoe.Expression); + } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/AttributeSectionTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/AttributeSectionTests.cs index 5cced86459..f89af54481 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/AttributeSectionTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/AttributeSectionTests.cs @@ -108,6 +108,44 @@ public class Form1 { } }}}); } + + [Test] + public void TwoAttributesInSameSectionLocations() + { + string program = @"[A, B] class Test {}"; + TypeDeclaration type = ParseUtilCSharp.ParseGlobal(program); + var attributeSection = type.Attributes.Single(); + + var firstAttribute = attributeSection.Attributes.First(); + Assert.AreEqual(2, firstAttribute.StartLocation.Column); + Assert.AreEqual(3, firstAttribute.EndLocation.Column); + + var lastAttribute = attributeSection.Attributes.Last(); + Assert.AreEqual(5, lastAttribute.StartLocation.Column); + Assert.AreEqual(6, lastAttribute.EndLocation.Column); + + Assert.AreEqual(1, attributeSection.StartLocation.Column); + Assert.AreEqual(7, attributeSection.EndLocation.Column); + } + + [Test] + public void TwoAttributesWithOptionalCommaInSameSectionLocations() + { + string program = @"[A, B,] class Test {}"; + TypeDeclaration type = ParseUtilCSharp.ParseGlobal(program); + var attributeSection = type.Attributes.Single(); + + var firstAttribute = attributeSection.Attributes.First(); + Assert.AreEqual(2, firstAttribute.StartLocation.Column); + Assert.AreEqual(3, firstAttribute.EndLocation.Column); + + var lastAttribute = attributeSection.Attributes.Last(); + Assert.AreEqual(5, lastAttribute.StartLocation.Column); + Assert.AreEqual(6, lastAttribute.EndLocation.Column); + + Assert.AreEqual(1, attributeSection.StartLocation.Column); + Assert.AreEqual(8, attributeSection.EndLocation.Column); + } [Test] public void AttributesOnTypeParameter() @@ -197,27 +235,27 @@ public class Form1 { [Test] public void AssemblyAttributeBeforeNamespace() { - var cu = new CSharpParser().Parse(new StringReader("using System; [assembly: Attr] namespace X {}"), "code.cs"); + var syntaxTree = SyntaxTree.Parse("using System; [assembly: Attr] namespace X {}"); Assert.AreEqual( new Type[] { typeof(UsingDeclaration), typeof(AttributeSection), typeof(NamespaceDeclaration) - }, cu.Children.Select(c => c.GetType()).ToArray()); + }, syntaxTree.Children.Select(c => c.GetType()).ToArray()); } [Ignore("Fixme!")] [Test] public void AssemblyAttributeBeforeClass() { - var cu = new CSharpParser().Parse(new StringReader("using System; [assembly: Attr] class X {}"), "code.cs"); + var syntaxTree = SyntaxTree.Parse("using System; [assembly: Attr] class X {}"); Assert.AreEqual( new Type[] { typeof(UsingDeclaration), typeof(AttributeSection), typeof(TypeDeclaration) - }, cu.Children.Select(c => c.GetType()).ToArray()); - Assert.That(((TypeDeclaration)cu.LastChild).Attributes, Is.Empty); + }, syntaxTree.Children.Select(c => c.GetType()).ToArray()); + Assert.That(((TypeDeclaration)syntaxTree.LastChild).Attributes, Is.Empty); } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/NamespaceDeclarationTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/NamespaceDeclarationTests.cs index 845faad74b..7ae3731ee0 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/NamespaceDeclarationTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/NamespaceDeclarationTests.cs @@ -53,15 +53,15 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope public void ExternAliasTest() { string program = "extern alias X; extern alias Y; using X::System; namespace TestNamespace { extern alias Z; using Y::System; }"; - var cu = new CSharpParser().Parse(new StringReader(program), "code.cs"); + var syntaxTree = new CSharpParser().Parse(program, "code.cs"); Assert.AreEqual( new Type[] { typeof(ExternAliasDeclaration), typeof(ExternAliasDeclaration), typeof(UsingDeclaration), typeof(NamespaceDeclaration) - }, cu.Children.Select(c => c.GetType()).ToArray()); - var namespaceMembers = ((NamespaceDeclaration)cu.LastChild).Members; + }, syntaxTree.Children.Select(c => c.GetType()).ToArray()); + var namespaceMembers = ((NamespaceDeclaration)syntaxTree.LastChild).Members; Assert.AreEqual( new Type[] { typeof(ExternAliasDeclaration), diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs index 28b522fc6c..6a76173ceb 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/PreprocessorDirectiveTests.cs @@ -145,7 +145,7 @@ class B { } public void ElifBothFalse() { CSharpParser parser = new CSharpParser(); - var cu = parser.Parse(elifProgram, "elif.cs"); + var syntaxTree = parser.Parse(elifProgram, "elif.cs"); Assert.IsFalse(parser.HasErrors); Assert.AreEqual(new Role[] { @@ -154,13 +154,13 @@ class B { } Roles.PreProcessorDirective, Roles.Comment, Roles.PreProcessorDirective - }, cu.Children.Select(c => c.Role).ToArray()); - var aaa = cu.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(0); + }, syntaxTree.Children.Select(c => c.Role).ToArray()); + var aaa = syntaxTree.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(0); Assert.IsFalse(aaa.Take); Assert.AreEqual(PreProcessorDirectiveType.If, aaa.Type); Assert.AreEqual("AAA", aaa.Argument); - var bbb = cu.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(1); + var bbb = syntaxTree.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(1); Assert.IsFalse(bbb.Take); Assert.AreEqual(PreProcessorDirectiveType.Elif, bbb.Type); Assert.AreEqual("BBB", bbb.Argument); @@ -172,7 +172,7 @@ class B { } { CSharpParser parser = new CSharpParser(); parser.CompilerSettings.ConditionalSymbols.Add("AAA"); - var cu = parser.Parse(elifProgram, "elif.cs"); + var syntaxTree = parser.Parse(elifProgram, "elif.cs"); Assert.IsFalse(parser.HasErrors); Assert.AreEqual(new Role[] { @@ -181,13 +181,13 @@ class B { } Roles.PreProcessorDirective, Roles.Comment, Roles.PreProcessorDirective - }, cu.Children.Select(c => c.Role).ToArray()); - var aaa = cu.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(0); + }, syntaxTree.Children.Select(c => c.Role).ToArray()); + var aaa = syntaxTree.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(0); Assert.IsTrue(aaa.Take); Assert.AreEqual(PreProcessorDirectiveType.If, aaa.Type); Assert.AreEqual("AAA", aaa.Argument); - var bbb = cu.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(1); + var bbb = syntaxTree.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(1); Assert.IsFalse(bbb.Take); Assert.AreEqual(PreProcessorDirectiveType.Elif, bbb.Type); Assert.AreEqual("BBB", bbb.Argument); @@ -199,7 +199,7 @@ class B { } { CSharpParser parser = new CSharpParser(); parser.CompilerSettings.ConditionalSymbols.Add("AAA"); - var cu = parser.Parse(elifProgram, "elif.cs"); + var syntaxTree = parser.Parse(elifProgram, "elif.cs"); Assert.IsFalse(parser.HasErrors); Assert.AreEqual(new Role[] { @@ -208,13 +208,13 @@ class B { } Roles.PreProcessorDirective, Roles.Comment, Roles.PreProcessorDirective - }, cu.Children.Select(c => c.Role).ToArray()); - var aaa = cu.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(0); + }, syntaxTree.Children.Select(c => c.Role).ToArray()); + var aaa = syntaxTree.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(0); Assert.IsTrue(aaa.Take); Assert.AreEqual(PreProcessorDirectiveType.If, aaa.Type); Assert.AreEqual("AAA", aaa.Argument); - var bbb = cu.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(1); + var bbb = syntaxTree.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(1); Assert.IsFalse(bbb.Take); Assert.AreEqual(PreProcessorDirectiveType.Elif, bbb.Type); Assert.AreEqual("BBB", bbb.Argument); @@ -225,7 +225,7 @@ class B { } { CSharpParser parser = new CSharpParser(); parser.CompilerSettings.ConditionalSymbols.Add("BBB"); - var cu = parser.Parse(elifProgram, "elif.cs"); + var syntaxTree = parser.Parse(elifProgram, "elif.cs"); Assert.IsFalse(parser.HasErrors); Assert.AreEqual(new Role[] { @@ -234,16 +234,35 @@ class B { } Roles.PreProcessorDirective, NamespaceDeclaration.MemberRole, Roles.PreProcessorDirective - }, cu.Children.Select(c => c.Role).ToArray()); - var aaa = cu.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(0); + }, syntaxTree.Children.Select(c => c.Role).ToArray()); + var aaa = syntaxTree.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(0); Assert.IsFalse(aaa.Take); Assert.AreEqual(PreProcessorDirectiveType.If, aaa.Type); Assert.AreEqual("AAA", aaa.Argument); - var bbb = cu.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(1); + var bbb = syntaxTree.GetChildrenByRole(Roles.PreProcessorDirective).ElementAt(1); Assert.IsTrue(bbb.Take); Assert.AreEqual(PreProcessorDirectiveType.Elif, bbb.Type); Assert.AreEqual("BBB", bbb.Argument); } + + [Test] + [Ignore("parser bug (BBB is missing)")] + public void ConditionalSymbolTest() + { + const string program = @"// Test +#if AAA +#undef AAA +#define CCC +#else +#define DDD +#endif +class C {}"; + CSharpParser parser = new CSharpParser(); + parser.CompilerSettings.ConditionalSymbols.Add("AAA"); + parser.CompilerSettings.ConditionalSymbols.Add("BBB"); + var syntaxTree = parser.Parse(program, "elif.cs"); + Assert.AreEqual(new[] { "BBB", "CCC" }, syntaxTree.ConditionalSymbols); + } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/UsingDeclarationTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/UsingDeclarationTests.cs index 966b5867d3..6c19bcb601 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/UsingDeclarationTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/UsingDeclarationTests.cs @@ -31,8 +31,8 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope { string program = "using\n"; CSharpParser parser = new CSharpParser(); - CompilationUnit cu = parser.Parse (program, "parsed.cs"); - Assert.AreEqual(0, cu.Children.Count()); + SyntaxTree syntaxTree = parser.Parse (program); + Assert.AreEqual(0, syntaxTree.Children.Count()); Assert.IsTrue(parser.HasErrors); } @@ -42,18 +42,18 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope string program = "using System;\n" + "using My.Name.Space;\n"; CSharpParser parser = new CSharpParser(); - CompilationUnit cu = parser.Parse(new StringReader(program), "parsed.cs"); + SyntaxTree syntaxTree = parser.Parse(program); Assert.IsFalse(parser.HasErrors); - Assert.AreEqual(2, cu.Children.Count()); - Assert.IsTrue(cu.Children.ElementAt(0) is UsingDeclaration); - Assert.IsFalse(cu.Children.ElementAt(0) is UsingAliasDeclaration); - UsingDeclaration ud = (UsingDeclaration)cu.Children.ElementAt(0); + Assert.AreEqual(2, syntaxTree.Children.Count()); + Assert.IsTrue(syntaxTree.Children.ElementAt(0) is UsingDeclaration); + Assert.IsFalse(syntaxTree.Children.ElementAt(0) is UsingAliasDeclaration); + UsingDeclaration ud = (UsingDeclaration)syntaxTree.Children.ElementAt(0); Assert.AreEqual("System", ud.Namespace); - Assert.IsTrue(cu.Children.ElementAt(1) is UsingDeclaration); - Assert.IsFalse(cu.Children.ElementAt(1) is UsingAliasDeclaration); - ud = (UsingDeclaration)cu.Children.ElementAt(1); + Assert.IsTrue(syntaxTree.Children.ElementAt(1) is UsingDeclaration); + Assert.IsFalse(syntaxTree.Children.ElementAt(1) is UsingAliasDeclaration); + ud = (UsingDeclaration)syntaxTree.Children.ElementAt(1); Assert.AreEqual("My.Name.Space", ud.Namespace); } @@ -64,23 +64,23 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope "using myAlias=My.Name.Space;\n" + "using StringCollection = System.Collections.Generic.List;\n"; CSharpParser parser = new CSharpParser(); - CompilationUnit cu = parser.Parse(new StringReader(program), "parsed.cs"); + SyntaxTree syntaxTree = parser.Parse(program); Assert.IsFalse(parser.HasErrors); - Assert.AreEqual(3, cu.Children.Count()); + Assert.AreEqual(3, syntaxTree.Children.Count()); - Assert.IsTrue(cu.Children.ElementAt(0) is UsingAliasDeclaration); - UsingAliasDeclaration ud = (UsingAliasDeclaration)cu.Children.ElementAt(0); + Assert.IsTrue(syntaxTree.Children.ElementAt(0) is UsingAliasDeclaration); + UsingAliasDeclaration ud = (UsingAliasDeclaration)syntaxTree.Children.ElementAt(0); Assert.AreEqual("TESTME", ud.Alias); Assert.AreEqual("System", ud.Import.ToString()); - Assert.IsTrue(cu.Children.ElementAt(1) is UsingAliasDeclaration); - ud = (UsingAliasDeclaration)cu.Children.ElementAt(1); + Assert.IsTrue(syntaxTree.Children.ElementAt(1) is UsingAliasDeclaration); + ud = (UsingAliasDeclaration)syntaxTree.Children.ElementAt(1); Assert.AreEqual("myAlias", ud.Alias); Assert.AreEqual("My.Name.Space", ud.Import.ToString()); - Assert.IsTrue(cu.Children.ElementAt(2) is UsingAliasDeclaration); - ud = (UsingAliasDeclaration)cu.Children.ElementAt(2); + Assert.IsTrue(syntaxTree.Children.ElementAt(2) is UsingAliasDeclaration); + ud = (UsingAliasDeclaration)syntaxTree.Children.ElementAt(2); Assert.AreEqual("StringCollection", ud.Alias); Assert.AreEqual("System.Collections.Generic.List", ud.Import.ToString()); } @@ -92,24 +92,24 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.GeneralScope "using myAlias=global::My.Name.Space;\n" + "using a::b.c;\n"; CSharpParser parser = new CSharpParser(); - CompilationUnit cu = parser.Parse(new StringReader(program), "parsed.cs"); + SyntaxTree syntaxTree = parser.Parse(program); Assert.IsFalse(parser.HasErrors); - Assert.AreEqual(3, cu.Children.Count()); + Assert.AreEqual(3, syntaxTree.Children.Count()); - Assert.IsTrue(cu.Children.ElementAt(0) is UsingDeclaration); - Assert.IsFalse(cu.Children.ElementAt(0) is UsingAliasDeclaration); - UsingDeclaration ud = (UsingDeclaration)cu.Children.ElementAt(0); + Assert.IsTrue(syntaxTree.Children.ElementAt(0) is UsingDeclaration); + Assert.IsFalse(syntaxTree.Children.ElementAt(0) is UsingAliasDeclaration); + UsingDeclaration ud = (UsingDeclaration)syntaxTree.Children.ElementAt(0); Assert.AreEqual("global::System", ud.Namespace); - Assert.IsTrue(cu.Children.ElementAt(1) is UsingAliasDeclaration); - UsingAliasDeclaration uad = (UsingAliasDeclaration)cu.Children.ElementAt(1); + Assert.IsTrue(syntaxTree.Children.ElementAt(1) is UsingAliasDeclaration); + UsingAliasDeclaration uad = (UsingAliasDeclaration)syntaxTree.Children.ElementAt(1); Assert.AreEqual("myAlias", uad.Alias); Assert.AreEqual("global::My.Name.Space", uad.Import.ToString()); - Assert.IsTrue(cu.Children.ElementAt(2) is UsingDeclaration); - Assert.IsFalse(cu.Children.ElementAt(2) is UsingAliasDeclaration); - ud = (UsingDeclaration)cu.Children.ElementAt(2); + Assert.IsTrue(syntaxTree.Children.ElementAt(2) is UsingDeclaration); + Assert.IsFalse(syntaxTree.Children.ElementAt(2) is UsingAliasDeclaration); + ud = (UsingDeclaration)syntaxTree.Children.ElementAt(2); Assert.AreEqual("a::b.c", ud.Namespace); } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseSelfTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseSelfTests.cs index fabf1c15c7..54abb3fb5d 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseSelfTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseSelfTests.cs @@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser [TestFixtureSetUp] public void SetUp() { - string path = Path.GetFullPath (Path.Combine ("..", "..", "..")); + string path = Path.GetFullPath (Path.Combine ("..", "..")); if (!File.Exists(Path.Combine(path, "NRefactory.sln"))) throw new InvalidOperationException("Test cannot find the NRefactory source code in " + path); fileNames = Directory.GetFiles(path, "*.cs", SearchOption.AllDirectories); @@ -50,19 +50,19 @@ namespace ICSharpCode.NRefactory.CSharp.Parser CSharpParser parser = new CSharpParser(); parser.GenerateTypeSystemMode = true; foreach (string fileName in fileNames) { - CompilationUnit cu; + SyntaxTree syntaxTree; using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, FileOptions.SequentialScan)) { - cu = parser.Parse(fs, fileName); + syntaxTree = parser.Parse(fs, fileName); } - var parsedFile = cu.ToTypeSystem(); - foreach (var td in parsedFile.GetAllTypeDefinitions()) { - Assert.AreSame(parsedFile, td.ParsedFile); + var unresolvedFile = syntaxTree.ToTypeSystem(); + foreach (var td in unresolvedFile.GetAllTypeDefinitions()) { + Assert.AreSame(unresolvedFile, td.UnresolvedFile); foreach (var member in td.Members) { - Assert.AreSame(parsedFile, member.ParsedFile); + Assert.AreSame(unresolvedFile, member.UnresolvedFile); Assert.AreSame(td, member.DeclaringTypeDefinition); } } - pc = pc.UpdateProjectContent(null, parsedFile); + pc = pc.AddOrUpdateFiles(unresolvedFile); } } @@ -76,12 +76,12 @@ namespace ICSharpCode.NRefactory.CSharp.Parser CSharpParser parser = new CSharpParser(); foreach (string fileName in fileNames) { this.currentDocument = new ReadOnlyDocument(File.ReadAllText(fileName)); - CompilationUnit cu = parser.Parse(currentDocument.CreateReader(), fileName); + SyntaxTree syntaxTree = parser.Parse(currentDocument, fileName); if (parser.HasErrors) continue; this.currentFileName = fileName; - CheckPositionConsistency(cu); - CheckMissingTokens(cu); + CheckPositionConsistency(syntaxTree); + CheckMissingTokens(syntaxTree); } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseUtil.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseUtil.cs index 33fa90ccf4..24ee8d4286 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseUtil.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/ParseUtil.cs @@ -33,13 +33,13 @@ namespace ICSharpCode.NRefactory.CSharp.Parser public static T ParseGlobal(string code, bool expectErrors = false) where T : AstNode { CSharpParser parser = new CSharpParser(); - CompilationUnit cu = parser.Parse(new StringReader(code), "parsed.cs"); + SyntaxTree syntaxTree = parser.Parse(code); foreach (var error in parser.Errors) Console.WriteLine (error.Message); Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors"); - AstNode node = cu.Children.Single(); + AstNode node = syntaxTree.Children.Single(); Type type = typeof(T); Assert.IsTrue(type.IsAssignableFrom(node.GetType()), String.Format("Parsed node was {0} instead of {1} ({2})", node.GetType(), type, node)); return (T)node; @@ -56,7 +56,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser public static T ParseStatement(string stmt, bool expectErrors = false) where T : AstNode { CSharpParser parser = new CSharpParser(); - var statements = parser.ParseStatements(new StringReader(stmt)); + var statements = parser.ParseStatements(stmt); foreach (var error in parser.Errors) Console.WriteLine (error.Message); @@ -79,7 +79,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser public static T ParseExpression(string expr, bool expectErrors = false) where T : AstNode { CSharpParser parser = new CSharpParser(); - AstNode parsedExpression = parser.ParseExpression(new StringReader(expr)); + AstNode parsedExpression = parser.ParseExpression(expr); foreach (var error in parser.Errors) Console.WriteLine (error.Message); @@ -102,7 +102,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser public static T ParseTypeMember(string expr, bool expectErrors = false) where T : EntityDeclaration { CSharpParser parser = new CSharpParser(); - var members = parser.ParseTypeMembers(new StringReader(expr)); + var members = parser.ParseTypeMembers(expr); foreach (var error in parser.Errors) Console.WriteLine (error.Message); Assert.AreEqual(expectErrors, parser.HasErrors, "HasErrors"); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/MethodDeclarationTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/MethodDeclarationTests.cs index 0bd880be62..6dcfa66053 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/MethodDeclarationTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/MethodDeclarationTests.cs @@ -332,6 +332,19 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.TypeMembers Assert.IsTrue(md.IsExtensionMethod); } + [Test] + public void ExtensionMethodWithAttributeTest() + { + MethodDeclaration md = ParseUtilCSharp.ParseTypeMember( + "public static int ToInt32([Attr] this string s) { return int.Parse(s); }" + ); + Assert.AreEqual("ToInt32", md.Name); + Assert.IsTrue(md.IsExtensionMethod); + Assert.AreEqual("s", md.Parameters.Single().Name); + Assert.AreEqual(KnownTypeCode.String, ((PrimitiveType)md.Parameters.Single().Type).KnownTypeCode); + Assert.AreEqual(1, md.Parameters.Single().Attributes.Count); + } + [Test] public void VoidExtensionMethodTest() { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/PropertyDeclarationTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/PropertyDeclarationTests.cs index cdce97c4f7..c2bc2b513b 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/PropertyDeclarationTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/PropertyDeclarationTests.cs @@ -72,8 +72,8 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.TypeMembers int line4Pos = code.IndexOf("\t\tset"); CSharpParser parser = new CSharpParser(); - CompilationUnit cu = parser.Parse(new StringReader(code), "parsed.cs"); - PropertyDeclaration pd = (PropertyDeclaration)cu.Children.Single().GetChildByRole(Roles.TypeMemberRole); + SyntaxTree syntaxTree = parser.Parse(code); + PropertyDeclaration pd = (PropertyDeclaration)syntaxTree.Children.Single().GetChildByRole(Roles.TypeMemberRole); Assert.AreEqual(new TextLocation(2, code.IndexOf("{\n\t\tget") - line2Pos + 1), pd.GetChildByRole(Roles.LBrace).StartLocation); Assert.AreEqual(new TextLocation(5, 3), pd.EndLocation); Assert.AreEqual(new TextLocation(3, code.IndexOf("{ return") - line3Pos + 1), pd.Getter.Body.StartLocation); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs index a95b19bbcd..2f1d58eb09 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeSystemConvertVisitorTests.cs @@ -42,14 +42,14 @@ namespace ICSharpCode.NRefactory.CSharp.Parser const string fileName = "TypeSystemTests.TestCase.cs"; CSharpParser parser = new CSharpParser(); - CompilationUnit cu; + SyntaxTree syntaxTree; using (Stream s = typeof(TypeSystemTests).Assembly.GetManifestResourceStream(typeof(TypeSystemTests), fileName)) { - cu = parser.Parse(s, fileName); + syntaxTree = parser.Parse(s, fileName); } - var parsedFile = cu.ToTypeSystem(); + var unresolvedFile = syntaxTree.ToTypeSystem(); return new CSharpProjectContent() - .UpdateProjectContent(null, parsedFile) + .AddOrUpdateFiles(unresolvedFile) .AddAssemblyReferences(new[] { CecilLoaderTests.Mscorlib }) .SetAssemblyName(typeof(TypeSystemTests).Assembly.GetName().Name); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/QueryExpressionExpanderTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/QueryExpressionExpanderTests.cs new file mode 100644 index 0000000000..75bc603ef5 --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/QueryExpressionExpanderTests.cs @@ -0,0 +1,541 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Text.RegularExpressions; +using ICSharpCode.NRefactory.CSharp.Parser; +using ICSharpCode.NRefactory.CSharp.Resolver; +using NUnit.Framework; + +namespace ICSharpCode.NRefactory.CSharp { + [TestFixture] + public class QueryExpressionExpanderTests { + private dynamic ElementAt(dynamic d, int index) { + int i = 0; + foreach (var o in d) { + if (i++ == index) + return o; + } + throw new ArgumentException(); + } + + private void AssertCorrect(AstNode actual, string expected) { + Assert.That(Regex.Replace(actual.GetText(), @"\s+", "").Replace("<>", ""), Is.EqualTo(Regex.Replace(expected, @"\s+", ""))); + } + + private void AssertLookupCorrect(IEnumerable> actual, IList> expected) where T : AstNode where U : AstNode { + var actualList = actual.OrderBy(x => x.Key.StartLocation).ThenBy(x => x.Key.GetType().ToString()).ToList(); + Assert.That(actualList.Select(x => x.Key.StartLocation).ToList(), Is.EqualTo(expected.Select(x => x.Item1).ToList())); + for (int i = 0; i < actualList.Count; i++) { + Assert.That(actualList[i].Value, Is.Not.SameAs(actualList[i].Key)); + Assert.That(actualList[i].Value, Is.SameAs(expected[i].Item2)); + } + } + + [Test] + public void QueryExpressionWithFromAndSelectWorks() { + var node = ParseUtilCSharp.ParseExpression("from a in args select int.Parse(a)"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "args.Select(a => int.Parse(a))"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Arguments, 0).Parameters, 0)) }); + AssertLookupCorrect(actual.Expressions, new[] { Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target), Tuple.Create(new TextLocation(1, 16), actual.AstNode) }); + } + + [Test] + public void QueryExpressionWithSingleFromAndExplicitTypeWorks() { + var node = ParseUtilCSharp.ParseExpression("from object a in args select int.Parse(a)"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "args.Cast().Select(a => int.Parse(a))"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { Tuple.Create(new TextLocation(1, 13), (AstNode)ElementAt(ElementAt(astNode.Arguments, 0).Parameters, 0)) }); + AssertLookupCorrect(actual.Expressions, new[] { Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target), Tuple.Create(new TextLocation(1, 23), actual.AstNode) }); + } + + [Test] + public void QueryExpressionWithLetWorks() { + var node = ParseUtilCSharp.ParseExpression("from a in args let b = int.Parse(a) select a + b.ToString()"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "args.Select(a => new { a, b = int.Parse(a) }).Select(x0 => x0.a + x0.b.ToString())"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 20), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 37), actual.AstNode), + }); + } + + [Test] + public void QueryExpressionWithTwoLetsWorks() { + var node = ParseUtilCSharp.ParseExpression("from a in args let b = int.Parse(a) let c = b + 1 select a + b.ToString() + c.ToString()"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "args.Select(a => new { a, b = int.Parse(a) }).Select(x0 => new { x0, c = x0.b + 1 }).Select(x1 => x1.x0.a + x1.x0.b.ToString() + x1.c.ToString())"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 20), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + Tuple.Create(new TextLocation(1, 41), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 37), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 51), actual.AstNode), + }); + } + + [Test] + public void TwoFromClausesFollowedBySelectWorks() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 from j in arr2 select i + j"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.SelectMany(i => arr2, (i, j) => i + j)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 21), (AstNode)ElementAt(ElementAt(astNode.Arguments, 1).Parameters, 1)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 16), actual.AstNode), + Tuple.Create(new TextLocation(1, 31), actual.AstNode), + }); + } + + [Test] + public void SelectManyFollowedBySelectWorksWhenTheTargetIsTransparentAndTheCollectionsAreCorrelated() { + var node = ParseUtilCSharp.ParseExpression("from i in outer let j = F(i) from k in j.Result select i + j + k"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "outer.Select(i => new { i, j = F(i) }).SelectMany(x0 => x0.j.Result, (x1, k) => x1.i + x1.j + k)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 21), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + Tuple.Create(new TextLocation(1, 35), (AstNode)ElementAt(ElementAt(astNode.Arguments, 1).Parameters, 1)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 17), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 30), actual.AstNode), + Tuple.Create(new TextLocation(1, 49), actual.AstNode), + }); + } + + [Test] + public void SelectManyFollowedByLetWorksWhenTheTargetIsTransparentAndTheCollectionsAreCorrelated() { + var node = ParseUtilCSharp.ParseExpression("from i in outer let j = F(i) from k in j.Result let l = i + j + k select i + j + k + l"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "outer.Select(i => new { i, j = F(i) }).SelectMany(x0 => x0.j.Result, (x1, k) => new { x1, k }).Select(x2 => new { x2, l = x2.x1.i + x2.x1.j + x2.k }).Select(x3 => x3.x2.x1.i + x3.x2.x1.j + x3.x2.k + x3.l)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 21), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + Tuple.Create(new TextLocation(1, 35), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 1).Parameters, 1)), + Tuple.Create(new TextLocation(1, 53), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 17), (AstNode)astNode.Target.Target.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 30), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 49), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 67), (AstNode)astNode), + }); + } + + [Test] + public void TwoFromClausesFollowedByLetWorks() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 from j in arr2 let k = i + j select i + j + k"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.SelectMany(i => arr2, (i, j) => new { i, j }).Select(x0 => new { x0, k = x0.i + x0.j }).Select(x1 => x1.x0.i + x1.x0.j + x1.k)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 21), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 1).Parameters, 1)), + Tuple.Create(new TextLocation(1, 35), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 31), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 45), actual.AstNode), + }); + } + + [Test] + public void ThreeFromClausesFollowedBySelectWorks() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 from j in arr2 from k in arr3 select i + j + k"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.SelectMany(i => arr2, (i, j) => new { i, j }).SelectMany(x0 => arr3, (x1, k) => x1.i + x1.j + k)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 21), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 1).Parameters, 1)), + Tuple.Create(new TextLocation(1, 36), (AstNode)ElementAt(ElementAt(astNode.Arguments, 1).Parameters, 1)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 31), (AstNode)astNode), + Tuple.Create(new TextLocation(1, 46), (AstNode)astNode), + }); + } + + [Test] + public void GroupByWithSimpleValue() { + var node = ParseUtilCSharp.ParseExpression("from i in arr group i by i.field"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr.GroupBy(i => i.field)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Arguments, 0).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 15), (AstNode)astNode), + }); + } + + [Test] + public void GroupByWithProjectedValue() { + var node = ParseUtilCSharp.ParseExpression("from i in arr group i.something by i.field"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr.GroupBy(i => i.field, i => i.something)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Arguments, 0).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 15), (AstNode)astNode), + }); + } + + [Test] + public void GroupByWhenThereIsATransparentIdentifer() { + var node = ParseUtilCSharp.ParseExpression("from i in arr let j = F(i) group i by i.field"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr.Select(i => new { i, j = F(i) }).GroupBy(x0 => x0.i.field, x1 => x1.i)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 19), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 15), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 28), (AstNode)astNode), + }); + } + + [Test] + public void JoinFollowedBySelect() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 join j in arr2 on i.keyi equals j.keyj select i + j"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.Join(arr2, i => i.keyi, j => j.keyj, (i, j) => i + j)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Arguments, 1).Parameters, 0)), + Tuple.Create(new TextLocation(1, 21), (AstNode)ElementAt(ElementAt(astNode.Arguments, 2).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode), + Tuple.Create(new TextLocation(1, 55), (AstNode)astNode), + }); + } + + [Test] + public void JoinFollowedByLet() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 join j in arr2 on i.keyi equals j.keyj let k = i + j select i + j + k"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.Join(arr2, i => i.keyi, j => j.keyj, (i, j) => new { i, j }).Select(x0 => new { x0, k = x0.i + x0.j }).Select(x1 => x1.x0.i + x1.x0.j + x1.k)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 1).Parameters, 0)), + Tuple.Create(new TextLocation(1, 21), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 2).Parameters, 0)), + Tuple.Create(new TextLocation(1, 59), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 55), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 69), (AstNode)astNode), + }); + } + + [Test] + public void JoinFollowedBySelectWhenThereIsATransparentIdentifier() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 let j = F(i) join k in arr2 on j.keyj equals k.keyk select i + j + k"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.Select(i => new { i, j = F(i) }).Join(arr2, x0 => x0.j.keyj, k => k.keyk, (x1, k) => x1.i + x1.j + k)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 20), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + Tuple.Create(new TextLocation(1, 34), (AstNode)ElementAt(ElementAt(astNode.Arguments, 2).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 29), (AstNode)astNode), + Tuple.Create(new TextLocation(1, 68), (AstNode)astNode), + }); + } + + [Test] + public void GroupJoinFollowedBySelect() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 join j in arr2 on i.keyi equals j.keyj into g select F(i, g)"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.GroupJoin(arr2, i => i.keyi, j => j.keyj, (i, g) => F(i, g))"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Arguments, 1).Parameters, 0)), + Tuple.Create(new TextLocation(1, 60), (AstNode)ElementAt(ElementAt(astNode.Arguments, 3).Parameters, 1)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode), + Tuple.Create(new TextLocation(1, 62), (AstNode)astNode), + }); + } + + [Test] + public void GroupJoinFollowedByLet() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 join j in arr2 on i.keyi equals j.keyj into g let k = i + g select i + g + k"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.GroupJoin(arr2, i => i.keyi, j => j.keyj, (i, g) => new { i, g }).Select(x0 => new { x0, k = x0.i + x0.g }).Select(x1 => x1.x0.i + x1.x0.g + x1.k)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 1).Parameters, 0)), + Tuple.Create(new TextLocation(1, 60), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 3).Parameters, 1)), + Tuple.Create(new TextLocation(1, 66), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 62), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 76), (AstNode)astNode), + }); + } + + [Test] + public void GroupJoinFollowedBySelectWhenThereIsATransparentIdentifier() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 let j = F(i) join k in arr2 on j.keyj equals k.keyk into g select F(i, j, g)"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.Select(i => new { i, j = F(i) }).GroupJoin(arr2, x0 => x0.j.keyj, k => k.keyk, (x1, g) => F(x1.i, x1.j, g))"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 20), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + Tuple.Create(new TextLocation(1, 73), (AstNode)ElementAt(ElementAt(astNode.Arguments, 3).Parameters, 1)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 29), (AstNode)astNode), + Tuple.Create(new TextLocation(1, 75), (AstNode)astNode), + }); + } + + [Test] + public void WhereWorks() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 where i > 5 select i + 1"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.Where(i => i > 5).Select(i => i + 1)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 22), (AstNode)astNode.Target.Target), // This should be the where at location 16, but a parser bug causes 22 to be returned. change this to 16 after fixing the parser bug. + Tuple.Create(new TextLocation(1, 28), (AstNode)astNode), + }); + } + + [Test] + public void WhereWorksWhenThereIsATransparentIdentifier() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 let j = i + 1 where i > j select i + j"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.Select(i => new { i, j = i + 1 }).Where(x0 => x0.i > x0.j).Select(x1 => x1.i + x1.j)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 20), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 36), (AstNode)astNode.Target.Target), // This should be the orderby at location 30, but a parser bug causes 36 to be returned. change this to 30 after fixing the parser bug. + Tuple.Create(new TextLocation(1, 42), (AstNode)astNode), + }); + } + + [Test] + public void TrivialSelectIsEliminatedAfterWhere() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 where i > 5 select i"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.Where(i => i > 5)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Arguments, 0).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 22), (AstNode)astNode), + Tuple.Create(new TextLocation(1, 28), (AstNode)astNode), + }); + } + + [Test] + public void TrivialSelectIsEliminatedAfterWhereEvenWhenParenthesized() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 where i > 5 select (i)"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.Where(i => i > 5)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Arguments, 0).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 22), (AstNode)astNode), + Tuple.Create(new TextLocation(1, 28), (AstNode)astNode), + }); + } + + [Test] + public void TrivialSelectIsNotEliminatingWhenTheOnlyOperation() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 select i"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.Select(i => i)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Arguments, 0).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode), + }); + } + + [Test] + public void OrderingWorks() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 orderby i.field1 select i"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.OrderBy(i => i.field1)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Arguments, 0).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 24), (AstNode)astNode), // This should be the orderby at location 16, but a parser bug causes 24 to be returned. change this to 16 after fixing the parser bug. + Tuple.Create(new TextLocation(1, 24), (AstNode)astNode), + Tuple.Create(new TextLocation(1, 33), (AstNode)astNode), + }); + } + + [Test] + public void OrderingWorksWhenThereIsATransparentIdentifier() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 let j = i + 1 orderby i + j select i"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.Select(i => new { i, j = i + 1 }).OrderBy(x0 => x0.i + x0.j).Select(x1 => x1.i)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 20), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 0).Body.Initializers, 1).NameToken), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 38), (AstNode)astNode.Target.Target), // This should be the orderby at location 30, but a parser bug causes 38 to be returned. change this to 30 after fixing the parser bug. + Tuple.Create(new TextLocation(1, 38), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 44), (AstNode)astNode), + }); + } + + [Test] + public void ThenByWorks() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 orderby i.field1, i.field2 select i"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.OrderBy(i => i.field1).ThenBy(i => i.field2)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 24), (AstNode)astNode), // This should be the orderby at location 16, but a parser bug causes 24 to be returned. change this to 16 after fixing the parser bug. + Tuple.Create(new TextLocation(1, 24), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 34), (AstNode)astNode), + Tuple.Create(new TextLocation(1, 43), (AstNode)astNode), + }); + } + + [Test] + public void OrderingDescendingWorks() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 orderby i.field1 descending, i.field2 descending select i"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + + AssertCorrect(actual.AstNode, "arr1.OrderByDescending(i => i.field1).ThenByDescending(i => i.field2)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 24), (AstNode)astNode), // This should be the orderby at location 16, but a parser bug causes 24 to be returned. change this to 16 after fixing the parser bug. + Tuple.Create(new TextLocation(1, 24), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 45), (AstNode)astNode), + Tuple.Create(new TextLocation(1, 65), (AstNode)astNode), + }); + } + + [Test] + public void QueryContinuation() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 from j in arr2 select i + j into a where a > 5 select a + 1"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.SelectMany(i => arr2, (i, j) => i + j).Where(a => a > 5).Select(a => a + 1)"); + dynamic astNode = actual.AstNode; + AssertLookupCorrect(actual.RangeVariables, new[] { + Tuple.Create(new TextLocation(1, 6), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 0).Parameters, 0)), + Tuple.Create(new TextLocation(1, 21), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Target.Target.Arguments, 1).Parameters, 1)), + Tuple.Create(new TextLocation(1, 49), (AstNode)ElementAt(ElementAt(astNode.Target.Target.Arguments, 0).Parameters, 0)), + }); + AssertLookupCorrect(actual.Expressions, new[] { + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 1), (AstNode)astNode.Target.Target.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 16), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 31), (AstNode)astNode.Target.Target.Target.Target), + Tuple.Create(new TextLocation(1, 57), (AstNode)astNode.Target.Target), + Tuple.Create(new TextLocation(1, 63), (AstNode)astNode), + }); + } + + [Test] + public void NestedQueries() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 from j in arr2 let l = new { i, j } group l by l.i into g select new { g.Key, a = from q in g select new { q.i, q.j } }"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.SelectMany(i => arr2, (i, j) => new { i, j }).Select(x0 => new { x0, l = new { x0.i, x0.j } }).GroupBy(x1 => x1.l.i, x2 => x2.l).Select(g => new { g.Key, a = g.Select(q => new { q.i, q.j }) })"); + } + + [Test] + public void NestedQueryUsingRangeVariableFromOuter() { + var node = ParseUtilCSharp.ParseExpression("from i in arr1 from j in arr2 let k = new[] { i, j } select (from l in k let m = l + 1 select l + m + i)"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "arr1.SelectMany(i => arr2, (i, j) => new { i, j }).Select(x0 => new { x0, k = new[] { x0.i, x0.j } }).Select(x1 => (x1.k.Select(l => new { l, m = l + 1 }).Select(x2 => x2.l + x2.m + x1.x0.i)))"); + } + + [Test] + public void RangeVariablesAreNotInScopeInJoinEquals() { + var node = ParseUtilCSharp.ParseExpression("from a in args let a2 = a select (from b in args let b2 = b join c in args on b[0] equals b + a into g select g)"); + var actual = new QueryExpressionExpander().ExpandQueryExpressions(node); + AssertCorrect(actual.AstNode, "args.Select(a => new { a, a2 = a }).Select(x0 => (args.Select(b => new { b, b2 = b }).GroupJoin(args, x1 => x1.b[0], c => b + x0.a, (x2, g) => g)))"); + } + } +} diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Refactoring/TypeSystemAstBuilderTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Refactoring/TypeSystemAstBuilderTests.cs index 9594f3bb73..5f02fda804 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Refactoring/TypeSystemAstBuilderTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Refactoring/TypeSystemAstBuilderTests.cs @@ -56,15 +56,15 @@ namespace OtherNS { IProjectContent pc; ICompilation compilation; ITypeDefinition baseClass, derivedClass, nestedClass, systemClass; - CSharpParsedFile parsedFile; + CSharpUnresolvedFile unresolvedFile; [SetUp] public void SetUp() { pc = new CSharpProjectContent(); pc = pc.SetAssemblyName("MyAssembly"); - parsedFile = new CSharpParser().Parse(new StringReader(program), "program.cs").ToTypeSystem(); - pc = pc.UpdateProjectContent(null, parsedFile); + unresolvedFile = SyntaxTree.Parse(program, "program.cs").ToTypeSystem(); + pc = pc.AddOrUpdateFiles(unresolvedFile); pc = pc.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib }); compilation = pc.CreateCompilation(); @@ -77,7 +77,7 @@ namespace OtherNS { TypeSystemAstBuilder CreateBuilder(ITypeDefinition currentTypeDef = null) { - UsingScope usingScope = currentTypeDef != null ? parsedFile.GetUsingScope(currentTypeDef.Region.Begin) : parsedFile.RootUsingScope; + UsingScope usingScope = currentTypeDef != null ? unresolvedFile.GetUsingScope(currentTypeDef.Region.Begin) : unresolvedFile.RootUsingScope; return new TypeSystemAstBuilder(new CSharpResolver( new CSharpTypeResolveContext(compilation.MainAssembly, usingScope.Resolve(compilation), currentTypeDef))); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ConversionsTest.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ConversionsTest.cs index 6bfc82c647..4702395891 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ConversionsTest.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ConversionsTest.cs @@ -50,13 +50,6 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver return conversions.ImplicitConversion(from2, to2); } - Conversion ExplicitConversion(Type from, Type to) - { - IType from2 = compilation.FindType(from); - IType to2 = compilation.FindType(to); - return conversions.ExplicitConversion(from2, to2); - } - [Test] public void IdentityConversions() { @@ -105,6 +98,16 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver Assert.AreEqual(C.ImplicitNumericConversion, ImplicitConversion(typeof(uint), typeof(long))); } + [Test] + public void EnumerationConversion() + { + ResolveResult zero = new ConstantResolveResult(compilation.FindType(KnownTypeCode.Int32), 0); + ResolveResult one = new ConstantResolveResult(compilation.FindType(KnownTypeCode.Int32), 1); + C implicitEnumerationConversion = C.EnumerationConversion(true, false); + Assert.AreEqual(implicitEnumerationConversion, conversions.ImplicitConversion(zero, compilation.FindType(typeof(StringComparison)))); + Assert.AreEqual(C.None, conversions.ImplicitConversion(one, compilation.FindType(typeof(StringComparison)))); + } + [Test] public void NullableConversions() { @@ -164,7 +167,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver [Test] public void ConversionFromDynamic() { - // There is no conversion from the type 'dynamic' to other types (except object). + // There is no conversion from the type 'dynamic' to other types (except the identity conversion to object). // Such conversions only exists from dynamic expression. // This is an important distinction for type inference (see TypeInferenceTests.IEnumerableCovarianceWithDynamic) Assert.AreEqual(C.None, ImplicitConversion(typeof(dynamic), typeof(string))); @@ -243,16 +246,6 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver Assert.AreEqual(C.ImplicitPointerConversion, ImplicitConversion(typeof(int*), typeof(void*))); } - [Test] - public void ExplicitPointerConversion() - { - Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(int*), typeof(short))); - Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(short), typeof(void*))); - - Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(void*), typeof(int*))); - Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(long*), typeof(byte*))); - } - [Test] public void NoConversionFromPointerTypeToObject() { @@ -523,26 +516,6 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver Assert.IsFalse(conversions.ImplicitConversion(type1, type2).IsValid); } - [Test] - public void ExplicitUserDefinedConversion() - { - var rr = Resolve(@" -class C1 {} -class C2 { - public static explicit operator C1(C2 c2) { - return null; - } -} -class C { - public void M() { - var c2 = new C2(); - C1 c1 = $(C1)c2$; - } -}"); - Assert.IsTrue(rr.Conversion.IsUserDefined); - Assert.AreEqual("op_Explicit", rr.Conversion.Method.Name); - } - [Test] public void ImplicitTypeParameterConversion() { @@ -566,5 +539,67 @@ class Test { }"; Assert.AreEqual(C.None, GetConversion(program)); } + + [Test] + public void ImplicitTypeParameterArrayConversion() + { + string program = @"using System; +class Test { + public void M(T[] t) where T : U { + U[] u = $t$; + } +}"; + // invalid, e.g. T=int[], U=object[] + Assert.AreEqual(C.None, GetConversion(program)); + } + + [Test] + public void ImplicitTypeParameterConversionWithClassConstraint() + { + string program = @"using System; +class Test { + public void M(T t) where T : class, U where U : class { + U u = $t$; + } +}"; + Assert.AreEqual(C.ImplicitReferenceConversion, GetConversion(program)); + } + + [Test] + public void ImplicitTypeParameterArrayConversionWithClassConstraint() + { + string program = @"using System; +class Test { + public void M(T[] t) where T : class, U where U : class { + U[] u = $t$; + } +}"; + Assert.AreEqual(C.ImplicitReferenceConversion, GetConversion(program)); + } + + [Test] + public void ImplicitTypeParameterConversionWithClassConstraintOnlyOnT() + { + string program = @"using System; +class Test { + public void M(T t) where T : class, U { + U u = $t$; + } +}"; + Assert.AreEqual(C.ImplicitReferenceConversion, GetConversion(program)); + } + + [Test] + public void ImplicitTypeParameterArrayConversionWithClassConstraintOnlyOnT() + { + string program = @"using System; +class Test { + public void M(T[] t) where T : class, U { + U[] u = $t$; + } +}"; + Assert.AreEqual(C.ImplicitReferenceConversion, GetConversion(program)); + } + } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/DynamicTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/DynamicTests.cs index 1c02f6c114..44f7daf1ab 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/DynamicTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/DynamicTests.cs @@ -10,6 +10,14 @@ using NUnit.Framework; namespace ICSharpCode.NRefactory.CSharp.Resolver { [TestFixture] public class DynamicTests : ResolverTestBase { + private void AssertNamedArgument(ResolveResult rr, string parameterName, Func verifier) where T : ResolveResult { + var narr = rr as NamedArgumentResolveResult; + Assert.That(narr, Is.Not.Null); + Assert.That(narr.ParameterName, Is.EqualTo(parameterName)); + Assert.That(narr.Argument, Is.InstanceOf()); + Assert.That(verifier((T)narr.Argument), Is.True); + } + [Test] public void AccessToDynamicMember() { string program = @"using System; @@ -44,10 +52,8 @@ class TestClass { Assert.That(dynamicMember.Target is LocalResolveResult && ((LocalResolveResult)dynamicMember.Target).Variable.Name == "obj"); Assert.That(dynamicMember.Member, Is.EqualTo("SomeMethod")); Assert.That(rr.Arguments.Count, Is.EqualTo(2)); - Assert.That(rr.Arguments[0].Name, Is.Null); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "a"); - Assert.That(rr.Arguments[1].Name, Is.Null); - Assert.That(rr.Arguments[1].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[1].Value).Variable.Name == "b"); + Assert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "a"); + Assert.That(rr.Arguments[1] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[1]).Variable.Name == "b"); } [Test] @@ -69,12 +75,9 @@ class TestClass { Assert.That(dynamicMember.Target is LocalResolveResult && ((LocalResolveResult)dynamicMember.Target).Variable.Name == "obj"); Assert.That(dynamicMember.Member, Is.EqualTo("SomeMethod")); Assert.That(rr.Arguments.Count, Is.EqualTo(3)); - Assert.That(rr.Arguments[0].Name, Is.Null); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "x"); - Assert.That(rr.Arguments[1].Name, Is.EqualTo("param1")); - Assert.That(rr.Arguments[1].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[1].Value).Variable.Name == "a"); - Assert.That(rr.Arguments[2].Name, Is.EqualTo("param2")); - Assert.That(rr.Arguments[2].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[2].Value).Variable.Name == "b"); + Assert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "x"); + AssertNamedArgument(rr.Arguments[1], "param1", lrr => lrr.Variable.Name == "a"); + AssertNamedArgument(rr.Arguments[2], "param2", lrr => lrr.Variable.Name == "b"); } [Test] @@ -98,11 +101,9 @@ class TestClass { Assert.That(dynamicMember.Member, Is.EqualTo("SomeMethod")); Assert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Invocation)); Assert.That(innerInvocation.Arguments.Count, Is.EqualTo(1)); - Assert.That(innerInvocation.Arguments[0].Name, Is.Null); - Assert.That(innerInvocation.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)innerInvocation.Arguments[0].Value).Variable.Name == "a"); + Assert.That(innerInvocation.Arguments[0] is LocalResolveResult && ((LocalResolveResult)innerInvocation.Arguments[0]).Variable.Name == "a"); Assert.That(rr.Arguments.Count, Is.EqualTo(1)); - Assert.That(rr.Arguments[0].Name, Is.Null); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "b"); + Assert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "b"); } [Test] @@ -156,7 +157,7 @@ class TestClass : TestBase { Assert.That(mg.Methods.Any(m => m.Parameters.Count == 1 && m.DeclaringType.Name == "TestClass" && m.Name == "SomeMethod" && m.Parameters[0].Type.Name == "String")); Assert.That(rr.Arguments.Count, Is.EqualTo(1)); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "obj"); + Assert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj"); } [Test, Ignore("Fails")] @@ -212,7 +213,7 @@ class TestClass { Assert.That(mg.Methods.All(m => m.Name == "SomeMethod" && m.DeclaringType.Name == "TestClass")); Assert.That(rr.Arguments.Count, Is.EqualTo(1)); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "obj"); + Assert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj"); } [Test] @@ -240,7 +241,7 @@ class TestClass { Assert.That(mg.Methods.All(m => m.Name == "SomeMethod" && m.DeclaringType.Name == "TestClass")); Assert.That(rr.Arguments.Count, Is.EqualTo(1)); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "obj"); + Assert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj"); } [Test] @@ -268,7 +269,7 @@ class TestClass { Assert.That(mg.Methods.All(m => m.Name == "SomeMethod" && m.DeclaringType.Name == "TestClass")); Assert.That(rr.Arguments.Count, Is.EqualTo(1)); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "obj"); + Assert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj"); } [Test] @@ -315,10 +316,8 @@ class TestClass { Assert.That(mg.Methods.All(m => m.Name == "SomeMethod" && m.DeclaringType.Name == "TestClass")); Assert.That(rr.Arguments.Count, Is.EqualTo(2)); - Assert.That(rr.Arguments[0].Name, Is.EqualTo("a")); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "obj"); - Assert.That(rr.Arguments[1].Name, Is.EqualTo("i")); - Assert.That(rr.Arguments[1].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[1].Value).Variable.Name == "idx"); + AssertNamedArgument(rr.Arguments[0], "a", lrr => lrr.Variable.Name == "obj"); + AssertNamedArgument(rr.Arguments[1], "i", lrr => lrr.Variable.Name == "idx"); } [Test] @@ -336,8 +335,7 @@ class TestClass { Assert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Indexing)); Assert.That(rr.Target is LocalResolveResult && ((LocalResolveResult)rr.Target).Variable.Name == "obj"); Assert.That(rr.Arguments.Count, Is.EqualTo(1)); - Assert.That(rr.Arguments[0].Name, Is.Null); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "a"); + Assert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "a"); } [Test] @@ -355,10 +353,8 @@ class TestClass { Assert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Indexing)); Assert.That(rr.Target is LocalResolveResult && ((LocalResolveResult)rr.Target).Variable.Name == "obj"); Assert.That(rr.Arguments.Count, Is.EqualTo(2)); - Assert.That(rr.Arguments[0].Name, Is.EqualTo("arg1")); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "a"); - Assert.That(rr.Arguments[1].Name, Is.EqualTo("arg2")); - Assert.That(rr.Arguments[1].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[1].Value).Variable.Name == "b"); + AssertNamedArgument(rr.Arguments[0], "arg1", lrr => lrr.Variable.Name == "a"); + AssertNamedArgument(rr.Arguments[1], "arg2", lrr => lrr.Variable.Name == "b"); } [Test] @@ -400,8 +396,7 @@ class TestClass { Assert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Indexing)); Assert.That(rr.Target, Is.InstanceOf()); Assert.That(rr.Arguments.Count, Is.EqualTo(1)); - Assert.That(rr.Arguments[0].Name, Is.Null); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "obj"); + Assert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj"); } [Test] @@ -424,8 +419,7 @@ class TestClass : TestBase { Assert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Indexing)); Assert.That(rr.Target, Is.InstanceOf()); Assert.That(rr.Arguments.Count, Is.EqualTo(1)); - Assert.That(rr.Arguments[0].Name, Is.Null); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "obj"); + Assert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj"); } [Test, Ignore("Fails")] @@ -472,10 +466,8 @@ class TestClass { Assert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Indexing)); Assert.That(rr.Target, Is.InstanceOf()); Assert.That(rr.Arguments.Count, Is.EqualTo(2)); - Assert.That(rr.Arguments[0].Name, Is.EqualTo("a")); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "obj"); - Assert.That(rr.Arguments[1].Name, Is.EqualTo("i")); - Assert.That(rr.Arguments[1].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[1].Value).Variable.Name == "idx"); + AssertNamedArgument(rr.Arguments[0], "a", lrr => lrr.Variable.Name == "obj"); + AssertNamedArgument(rr.Arguments[1], "i", lrr => lrr.Variable.Name == "idx"); } [Test] @@ -526,8 +518,8 @@ class TestClass { Assert.That(mg.Methods.All(m => m.Name == ".ctor" && m.DeclaringType.Name == "TestClass")); Assert.That(rr.Arguments.Count, Is.EqualTo(2)); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "obj"); - Assert.That(rr.Arguments[1].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[1].Value).Variable.Name == "i"); + Assert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj"); + Assert.That(rr.Arguments[1] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[1]).Variable.Name == "i"); } [Test] @@ -556,10 +548,8 @@ class TestClass { Assert.That(mg.Methods.All(m => m.Name == ".ctor" && m.DeclaringType.Name == "TestClass")); Assert.That(rr.Arguments.Count, Is.EqualTo(2)); - Assert.That(rr.Arguments[0].Name, Is.EqualTo("arg1")); - Assert.That(rr.Arguments[0].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0].Value).Variable.Name == "obj"); - Assert.That(rr.Arguments[1].Name, Is.EqualTo("arg2")); - Assert.That(rr.Arguments[1].Value is LocalResolveResult && ((LocalResolveResult)rr.Arguments[1].Value).Variable.Name == "i"); + AssertNamedArgument(rr.Arguments[0], "arg1", lrr => lrr.Variable.Name == "obj"); + AssertNamedArgument(rr.Arguments[1], "arg2", lrr => lrr.Variable.Name == "i"); } [Test] @@ -649,8 +639,8 @@ class TestClass : TestBase { Assert.That(mg.Methods.All(m => m.Name == ".ctor" && m.DeclaringType.Name == "TestBase")); Assert.That(rr.Arguments.Count, Is.EqualTo(2)); - Assert.That(rr.Arguments[0].Value is MemberResolveResult && ((MemberResolveResult)rr.Arguments[0].Value).Member.Name == "d"); - Assert.That(rr.Arguments[1].Value is MemberResolveResult && ((MemberResolveResult)rr.Arguments[1].Value).Member.Name == "i"); + Assert.That(rr.Arguments[0] is MemberResolveResult && ((MemberResolveResult)rr.Arguments[0]).Member.Name == "d"); + Assert.That(rr.Arguments[1] is MemberResolveResult && ((MemberResolveResult)rr.Arguments[1]).Member.Name == "i"); } [Test] @@ -708,8 +698,8 @@ class TestClass { Assert.That(mg.Methods.All(m => m.Name == ".ctor" && m.DeclaringType.Name == "TestClass")); Assert.That(rr.Arguments.Count, Is.EqualTo(2)); - Assert.That(rr.Arguments[0].Value is MemberResolveResult && ((MemberResolveResult)rr.Arguments[0].Value).Member.Name == "d"); - Assert.That(rr.Arguments[1].Value is MemberResolveResult && ((MemberResolveResult)rr.Arguments[1].Value).Member.Name == "i"); + Assert.That(rr.Arguments[0] is MemberResolveResult && ((MemberResolveResult)rr.Arguments[0]).Member.Name == "d"); + Assert.That(rr.Arguments[1] is MemberResolveResult && ((MemberResolveResult)rr.Arguments[1]).Member.Name == "i"); } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ExplicitConversionsTest.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ExplicitConversionsTest.cs new file mode 100644 index 0000000000..f8395cdabf --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ExplicitConversionsTest.cs @@ -0,0 +1,514 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.Semantics; + +namespace ICSharpCode.NRefactory.CSharp.Resolver +{ + using dynamic = ICSharpCode.NRefactory.TypeSystem.ReflectionHelper.Dynamic; + using C = Conversion; + + [TestFixture] + public class ExplicitConversionsTest : ResolverTestBase + { + CSharpConversions conversions; + + public override void SetUp() + { + base.SetUp(); + conversions = new CSharpConversions(compilation); + } + + Conversion ExplicitConversion(Type from, Type to) + { + IType from2 = compilation.FindType(from); + IType to2 = compilation.FindType(to); + return conversions.ExplicitConversion(from2, to2); + } + + [Test] + public void PointerConversion() + { + Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(int*), typeof(short))); + Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(short), typeof(void*))); + + Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(void*), typeof(int*))); + Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(long*), typeof(byte*))); + } + + [Test] + public void ConversionFromDynamic() + { + // Explicit dynamic conversion is for resolve results only; + // otherwise it's an explicit reference / unboxing conversion + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(dynamic), typeof(string))); + Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(dynamic), typeof(int))); + + var dynamicRR = new ResolveResult(SpecialType.Dynamic); + Assert.AreEqual(C.ExplicitDynamicConversion, conversions.ExplicitConversion(dynamicRR, compilation.FindType(typeof(string)))); + Assert.AreEqual(C.ExplicitDynamicConversion, conversions.ExplicitConversion(dynamicRR, compilation.FindType(typeof(int)))); + } + + [Test] + public void NumericConversions() + { + Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(sbyte), typeof(uint))); + Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(sbyte), typeof(char))); + Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(byte), typeof(char))); + Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(byte), typeof(sbyte))); + // if an implicit conversion exists, ExplicitConversion() should return that + Assert.AreEqual(C.ImplicitNumericConversion, ExplicitConversion(typeof(byte), typeof(int))); + Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(double), typeof(float))); + Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(double), typeof(decimal))); + Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(decimal), typeof(double))); + Assert.AreEqual(C.ImplicitNumericConversion, ExplicitConversion(typeof(int), typeof(decimal))); + + Assert.AreEqual(C.None, ExplicitConversion(typeof(bool), typeof(int))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(int), typeof(bool))); + } + + [Test] + public void EnumerationConversions() + { + var explicitEnumerationConversion = C.EnumerationConversion(false, false); + Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(sbyte), typeof(StringComparison))); + Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(char), typeof(StringComparison))); + Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(int), typeof(StringComparison))); + Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(decimal), typeof(StringComparison))); + Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(char))); + Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(int))); + Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(decimal))); + Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(StringSplitOptions))); + } + + [Test] + public void NullableConversion_BasedOnIdentityConversion() + { + Assert.AreEqual(C.IdentityConversion, ExplicitConversion(typeof(ArraySegment?), typeof(ArraySegment?))); + Assert.AreEqual(C.ImplicitNullableConversion, ExplicitConversion(typeof(ArraySegment), typeof(ArraySegment?))); + Assert.AreEqual(C.ExplicitNullableConversion, ExplicitConversion(typeof(ArraySegment?), typeof(ArraySegment))); + } + + [Test] + public void NullableConversion_BasedOnImplicitNumericConversion() + { + Assert.AreEqual(C.ImplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(long?))); + Assert.AreEqual(C.ImplicitLiftedNumericConversion, ExplicitConversion(typeof(int), typeof(long?))); + Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(long))); + } + + [Test] + public void NullableConversion_BasedOnImplicitEnumerationConversion() + { + ResolveResult zero = new ConstantResolveResult(compilation.FindType(KnownTypeCode.Int32), 0); + ResolveResult one = new ConstantResolveResult(compilation.FindType(KnownTypeCode.Int32), 1); + Assert.AreEqual(C.EnumerationConversion(true, true), conversions.ExplicitConversion(zero, compilation.FindType(typeof(StringComparison?)))); + Assert.AreEqual(C.EnumerationConversion(false, true), conversions.ExplicitConversion(one, compilation.FindType(typeof(StringComparison?)))); + } + + [Test] + public void NullableConversion_BasedOnExplicitNumericConversion() + { + Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(short?))); + Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int), typeof(short?))); + Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(short))); + } + + [Test] + public void NullableConversion_BasedOnExplicitEnumerationConversion() + { + C c = C.EnumerationConversion(false, true); // c = explicit lifted enumeration conversion + Assert.AreEqual(c, ExplicitConversion(typeof(int?), typeof(StringComparison?))); + Assert.AreEqual(c, ExplicitConversion(typeof(int), typeof(StringComparison?))); + Assert.AreEqual(c, ExplicitConversion(typeof(int?), typeof(StringComparison))); + + Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(int?))); + Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison), typeof(int?))); + Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(int))); + + Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(StringSplitOptions?))); + Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison), typeof(StringSplitOptions?))); + Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(StringSplitOptions))); + } + + [Test] + public void ExplicitReferenceConversion_SealedClass() + { + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object), typeof(string))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(string))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable), typeof(string))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable), typeof(string))); + Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(string), typeof(IEnumerable))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(string), typeof(IEnumerable))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(string), typeof(IEnumerable))); + } + + [Test] + public void ExplicitReferenceConversion_NonSealedClass() + { + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object), typeof(List))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(List))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(List))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(List))); + + Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(List), typeof(IEnumerable))); + Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(List), typeof(IEnumerable))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(List), typeof(IEnumerable))); + + Assert.AreEqual(C.None, ExplicitConversion(typeof(List), typeof(List))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(List), typeof(List))); + } + + [Test] + public void ExplicitReferenceConversion_Interfaces() + { + Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(IEnumerable))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(IEnumerable))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(IEnumerable))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(IEnumerable))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(IConvertible))); + } + + [Test] + public void ExplicitReferenceConversion_Arrays() + { + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object[]), typeof(string[]))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(dynamic[]), typeof(string[]))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(object[]), typeof(object[,]))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(object[]), typeof(int[]))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(short[]), typeof(int[]))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Array), typeof(int[]))); + } + + [Test] + public void ExplicitReferenceConversion_InterfaceToArray() + { + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(ICloneable), typeof(int[]))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(string[]))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(string[]))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(object[]))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(dynamic[]))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable), typeof(int[]))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable), typeof(object[,]))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable), typeof(object[]))); + } + + [Test] + public void ExplicitReferenceConversion_ArrayToInterface() + { + Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(int[]), typeof(ICloneable))); + Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(string[]), typeof(IEnumerable))); + Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(string[]), typeof(IEnumerable))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object[]), typeof(IEnumerable))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(dynamic[]), typeof(IEnumerable))); + Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(int[]), typeof(IEnumerable))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(object[,]), typeof(IEnumerable))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(object[]), typeof(IEnumerable))); + } + + [Test] + public void ExplicitReferenceConversion_Delegates() + { + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(MulticastDelegate), typeof(Action))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Delegate), typeof(Action))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(ICloneable), typeof(Action))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(System.Threading.ThreadStart), typeof(Action))); + } + + [Test] + public void ExplicitReferenceConversion_GenericDelegates() + { + Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(Action), typeof(Action))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Action), typeof(Action))); + + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Func), typeof(Func))); + Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(Func), typeof(Func))); + + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Action), typeof(Action))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(Action), typeof(Action))); + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Action), typeof(Action>))); + + Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Func), typeof(Func))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(Func), typeof(Func))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(Func), typeof(Func>))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(Func), typeof(Func>))); + } + + [Test] + public void UnboxingConversion() + { + Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(int))); + Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(decimal))); + Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(ValueType), typeof(int))); + Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(IFormattable), typeof(int))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable), typeof(int))); + Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(Enum), typeof(StringComparison))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(Enum), typeof(int))); + } + + [Test] + public void LiftedUnboxingConversion() + { + Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(int?))); + Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(decimal?))); + Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(ValueType), typeof(int?))); + Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(IFormattable), typeof(int?))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable), typeof(int?))); + Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(Enum), typeof(StringComparison?))); + Assert.AreEqual(C.None, ExplicitConversion(typeof(Enum), typeof(int?))); + } + Conversion ResolveCast(string program) + { + return Resolve(program).Conversion; + } + + [Test] + public void ObjectToTypeParameter() + { + string program = @"using System; +class Test { + public void M(object o) { + T t = $(T)o$; + } +}"; + Assert.AreEqual(C.UnboxingConversion, ResolveCast(program)); + } + + [Test] + public void UnrelatedClassToTypeParameter() + { + string program = @"using System; +class Test { + public void M(string o) { + T t = $(T)o$; + } +}"; + Assert.AreEqual(C.None, ResolveCast(program)); + } + + [Test] + public void IntefaceToTypeParameter() + { + string program = @"using System; +class Test { + public void M(IDisposable o) { + T t = $(T)o$; + } +}"; + Assert.AreEqual(C.UnboxingConversion, ResolveCast(program)); + } + + [Test] + public void TypeParameterToInterface() + { + string program = @"using System; +class Test { + public void M(T t) { + IDisposable d = $(IDisposable)t$; + } +}"; + Assert.AreEqual(C.BoxingConversion, ResolveCast(program)); + } + + [Test] + public void ValueTypeToTypeParameter() + { + string program = @"using System; +class Test { + public void M(ValueType o) where T : struct { + T t = $(T)o$; + } +}"; + Assert.AreEqual(C.UnboxingConversion, ResolveCast(program)); + } + + [Test] + public void InvalidTypeParameterConversion() + { + string program = @"using System; +class Test { + public void M(T t) { + U u = $(U)t$; + } +}"; + Assert.AreEqual(C.None, ResolveCast(program)); + } + + [Test] + public void TypeParameterConversion1() + { + string program = @"using System; +class Test { + public void M(T t) where T : U { + U u = $(U)t$; + } +}"; + Assert.AreEqual(C.BoxingConversion, ResolveCast(program)); + } + + [Test] + public void TypeParameterConversion1Array() + { + string program = @"using System; +class Test { + public void M(T[] t) where T : U { + U[] u = $(U[])t$; + } +}"; + Assert.AreEqual(C.None, ResolveCast(program)); + } + + [Test] + public void TypeParameterConversion2() + { + string program = @"using System; +class Test { + public void M(T t) where U : T { + U u = $(U)t$; + } +}"; + Assert.AreEqual(C.UnboxingConversion, ResolveCast(program)); + } + + [Test] + public void TypeParameterConversion2Array() + { + string program = @"using System; +class Test { + public void M(T[] t) where U : T { + U[] u = $(U[])t$; + } +}"; + Assert.AreEqual(C.None, ResolveCast(program)); + } + + [Test] + public void ImplicitTypeParameterConversionWithClassConstraint() + { + string program = @"using System; +class Test { + public void M(T t) where T : class where U : class, T { + U u = $(U)t$; + } +}"; + Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program)); + } + + [Test] + public void ImplicitTypeParameterArrayConversionWithClassConstraint() + { + string program = @"using System; +class Test { + public void M(T[] t) where T : class where U : class, T { + U[] u = $(U[])t$; + } +}"; + Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program)); + } + + [Test] + public void ImplicitTypeParameterConversionWithClassConstraintOnlyOnT() + { + string program = @"using System; +class Test { + public void M(T t) where U : class, T { + U u = $(U)t$; + } +}"; + Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program)); + } + + [Test] + public void ImplicitTypeParameterArrayConversionWithClassConstraintOnlyOnT() + { + string program = @"using System; +class Test { + public void M(T[] t) where U : class, T { + U[] u = $(U[])t$; + } +}"; + Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program)); + } + + [Test] + public void SimpleUserDefinedConversion() + { + var rr = Resolve(@" +class C1 {} +class C2 { + public static explicit operator C1(C2 c2) { + return null; + } +} +class C { + public void M() { + var c2 = new C2(); + C1 c1 = $(C1)c2$; + } +}"); + Assert.IsTrue(rr.Conversion.IsValid); + Assert.IsTrue(rr.Conversion.IsUserDefined); + Assert.AreEqual("op_Explicit", rr.Conversion.Method.Name); + } + + [Test] + public void ExplicitReferenceConversionFollowedByUserDefinedConversion() + { + var rr = Resolve(@" + class B {} + class S : B {} + class T { + public static explicit operator T(S s) { return null; } + } + class Test { + void Run(B b) { + T t = $(T)b$; + } + }"); + Assert.IsTrue(rr.Conversion.IsValid); + Assert.IsTrue(rr.Conversion.IsUserDefined); + Assert.AreEqual("B", rr.Input.Type.Name); + } + + [Test] + [Ignore("Not implemented yet.")] + public void BothDirectConversionAndBaseClassConversionAvailable() + { + var rr = Resolve(@" + class B {} + class S : B {} + class T { + public static explicit operator T(S s) { return null; } + public static explicit operator T(B b) { return null; } + } + class Test { + void Run(B b) { + T t = $(T)b$; + } + }"); + Assert.IsTrue(rr.Conversion.IsValid); + Assert.IsTrue(rr.Conversion.IsUserDefined); + Assert.AreEqual("b", rr.Conversion.Method.Parameters.Single().Name); + } + } +} diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/FindReferencesTest.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/FindReferencesTest.cs index 1e38e226d5..87cf3cc3cf 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/FindReferencesTest.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/FindReferencesTest.cs @@ -30,16 +30,16 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver [TestFixture] public class FindReferencesTest { - CompilationUnit compilationUnit; - CSharpParsedFile parsedFile; + SyntaxTree syntaxTree; + CSharpUnresolvedFile unresolvedFile; ICompilation compilation; FindReferences findReferences; void Init(string code) { - compilationUnit = new CSharpParser().Parse(new StringReader(code), "test.cs"); - parsedFile = compilationUnit.ToTypeSystem(); - compilation = TypeSystemHelper.CreateCompilation(parsedFile); + syntaxTree = SyntaxTree.Parse(code, "test.cs"); + unresolvedFile = syntaxTree.ToTypeSystem(); + compilation = TypeSystemHelper.CreateCompilation(unresolvedFile); findReferences = new FindReferences(); } @@ -47,7 +47,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { var result = new List(); var searchScopes = findReferences.GetSearchScopes(entity); - findReferences.FindReferencesInFile(searchScopes, parsedFile, compilationUnit, compilation, + findReferences.FindReferencesInFile(searchScopes, unresolvedFile, syntaxTree, compilation, (node, rr) => result.Add(node), CancellationToken.None); return result.OrderBy(n => n.StartLocation).ToArray(); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/InvocationTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/InvocationTests.cs index 6dd3b80762..5814490df3 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/InvocationTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/InvocationTests.cs @@ -539,5 +539,101 @@ class D : B { Assert.IsFalse(rr.IsError); Assert.IsFalse(rr.IsVirtualCall); } + + [Test] + public void NamedArgument() + { + string program = @" +class Test { + public void F(int x) {} + public void Test() { + F($x: 0$); + } +}"; + var narr = Resolve(program); + Assert.IsInstanceOf(narr.Argument); + Assert.AreEqual("x", narr.ParameterName); + Assert.AreEqual("Test.F", narr.Member.FullName); + Assert.AreSame(narr.Member.Parameters.Single(), narr.Parameter); + } + + [Test] + public void NamedArgumentInInvocation() + { + string program = @" +class Test { + public void F(int x) {} + public void Test() { + $F(x: 0)$; + } +}"; + var rr = Resolve(program); + Assert.IsInstanceOf(rr.Arguments.Single()); + var narr = (NamedArgumentResolveResult)rr.Arguments.Single(); + Assert.IsInstanceOf(narr.Argument); + Assert.AreEqual("x", narr.ParameterName); + Assert.AreEqual("Test.F", narr.Member.FullName); + Assert.AreSame(narr.Member.Parameters.Single(), narr.Parameter); + + // but GetArgumentsForCall() should directly return the constant: + Assert.IsInstanceOf(rr.GetArgumentsForCall().Single()); + } + + [Test] + public void UnknownNamedArgument() + { + string program = @" +class Test { + public void F(int x) {} + public void Test() { + F($y: 0$); + } +}"; + var narr = Resolve(program); + Assert.IsInstanceOf(narr.Argument); + Assert.AreEqual("y", narr.ParameterName); + Assert.IsNull(narr.Parameter); + } + + [Test] + public void NamedArgumentInMissingMethod() + { + string program = @" +class Test { + public void Test() { + Missing($x: 0$); + } +}"; + var narr = Resolve(program); + Assert.IsInstanceOf(narr.Argument); + Assert.AreEqual("x", narr.ParameterName); + Assert.IsNull(narr.Parameter); + } + + [Test] + public void GenericMethodInvocationWithConstraintMismatch() + { + string program = @" +interface IA +{ +} +class Test +{ + void F() + { + string o = null; + $M(o)$; + } + + void M(T arg) where T : IA + { + } + void M(object arg) { + } +}"; + var rr = Resolve(program); + Assert.AreEqual(OverloadResolutionErrors.MethodConstraintsNotSatisfied, rr.OverloadResolutionErrors); + Assert.IsTrue(rr.IsError); + } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/LambdaTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/LambdaTests.cs index 734aab3bf2..1b6d8ecd7d 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/LambdaTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/LambdaTests.cs @@ -587,5 +587,53 @@ class TestClass { Assert.AreSame(resolvedParameter, parameterInResolveResult); Assert.AreSame(resolvedParameter, referencedParameter); } + + [Test] + public void MultipleOverloadsWithImplicitLambda() + { + string program = @"class MainClass { + void Main() { + $M(x=>x.ToUpper())$; + } + delegate R Func(T arg); + int M(Func f){ } + string M(Func f){ } +}"; + var mrr = Resolve(program); + Assert.IsFalse(mrr.IsError); + Assert.AreEqual("System.String", mrr.Type.ReflectionName); + } + + [Test] + public void MultipleOverloadsWithImplicitLambda2() + { + string program = @"class MainClass { + void Main() { + $M(x=>x.Length)$; + } + delegate R Func(T arg); + int M(Func f){ } + string M(Func f){ } +}"; + var mrr = Resolve(program); + Assert.IsFalse(mrr.IsError); + Assert.AreEqual("System.String", mrr.Type.ReflectionName); + } + + [Test] + public void MultipleOverloadsWithImplicitLambda3() + { + string program = @"class MainClass { + void Main() { + $M(x=>x+x)$; + } + delegate R Func(T arg); + string M(Func f){ } + int M(Func f){ } +}"; + var mrr = Resolve(program); + Assert.IsFalse(mrr.IsError); + Assert.AreEqual("System.Int32", mrr.Type.ReflectionName); + } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MemberLookupTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MemberLookupTests.cs index 0027f02f55..882273873d 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MemberLookupTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MemberLookupTests.cs @@ -38,13 +38,13 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver lookup = new MemberLookup(null, compilation.MainAssembly); } - CSharpParsedFile Parse(string program) + CSharpUnresolvedFile Parse(string program) { - CompilationUnit cu = new CSharpParser().Parse(new StringReader(program), "test.cs"); - CSharpParsedFile parsedFile = cu.ToTypeSystem(); - project = project.UpdateProjectContent(null, parsedFile); + SyntaxTree syntaxTree = SyntaxTree.Parse(program, "test.cs"); + CSharpUnresolvedFile unresolvedFile = syntaxTree.ToTypeSystem(); + project = project.AddOrUpdateFiles(unresolvedFile); compilation = project.CreateCompilation(); - return parsedFile; + return unresolvedFile; } [Test] @@ -60,8 +60,8 @@ class Middle : Base { class Derived : Middle { public override void Method() {} }"; - var parsedFile = Parse(program); - ITypeDefinition derived = compilation.MainAssembly.GetTypeDefinition(parsedFile.TopLevelTypeDefinitions[2]); + var unresolvedFile = Parse(program); + ITypeDefinition derived = compilation.MainAssembly.GetTypeDefinition(unresolvedFile.TopLevelTypeDefinitions[2]); var rr = lookup.Lookup(new ResolveResult(derived), "Method", EmptyList.Instance, true) as MethodGroupResolveResult; Assert.AreEqual(2, rr.MethodsGroupedByDeclaringType.Count()); @@ -87,8 +87,8 @@ class Derived : Base { public override void Method(int a) {} public override void Method(string a) {} }"; - var parsedFile = Parse(program); - ITypeDefinition derived = compilation.MainAssembly.GetTypeDefinition(parsedFile.TopLevelTypeDefinitions[1]); + var unresolvedFile = Parse(program); + ITypeDefinition derived = compilation.MainAssembly.GetTypeDefinition(unresolvedFile.TopLevelTypeDefinitions[1]); var rr = lookup.Lookup(new ResolveResult(derived), "Method", EmptyList.Instance, true) as MethodGroupResolveResult; Assert.AreEqual(2, rr.MethodsGroupedByDeclaringType.Count()); @@ -115,8 +115,8 @@ class Base { class Derived : Base { public override void Method(S a) {} }"; - var parsedFile = Parse(program); - ITypeDefinition derived = compilation.MainAssembly.GetTypeDefinition(parsedFile.TopLevelTypeDefinitions[1]); + var unresolvedFile = Parse(program); + ITypeDefinition derived = compilation.MainAssembly.GetTypeDefinition(unresolvedFile.TopLevelTypeDefinitions[1]); var rr = lookup.Lookup(new ResolveResult(derived), "Method", EmptyList.Instance, true) as MethodGroupResolveResult; Assert.AreEqual(1, rr.MethodsGroupedByDeclaringType.Count()); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MethodTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MethodTests.cs index eb997bcac5..0e26185351 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MethodTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MethodTests.cs @@ -1,14 +1,45 @@ -using System; -using System.Collections.Generic; +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; using System.Linq; -using System.Text; using ICSharpCode.NRefactory.Semantics; using ICSharpCode.NRefactory.TypeSystem; using NUnit.Framework; -namespace ICSharpCode.NRefactory.CSharp.Resolver { +namespace ICSharpCode.NRefactory.CSharp.Resolver +{ [TestFixture] - public class MethodTests : ResolverTestBase { + public class MethodTests : ResolverTestBase + { + [Test] + public void MethodDeclarationWithAttribute() + { + string code = @"using System; +class TestClass { + $[Obsolete(""test"")] + public void M() { + }$ +}"; + var mrr = Resolve(code); + Assert.AreEqual("TestClass.M", mrr.Member.FullName); + } + [Test] public void ParameterIdentityInNormalMethod() { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs index 39db5d1399..f42a9e7457 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs @@ -161,19 +161,19 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver protected Tuple PrepareResolver(string code) { - CompilationUnit cu = new CSharpParser().Parse(new StringReader(code.Replace("$", "")), "code.cs"); + SyntaxTree syntaxTree = new CSharpParser().Parse(code.Replace("$", ""), "code.cs"); TextLocation[] dollars = FindDollarSigns(code).ToArray(); Assert.AreEqual(2, dollars.Length, "Expected 2 dollar signs marking start+end of desired node"); SetUp(); - CSharpParsedFile parsedFile = cu.ToTypeSystem(); - project = project.UpdateProjectContent(null, parsedFile); + CSharpUnresolvedFile unresolvedFile = syntaxTree.ToTypeSystem(); + project = project.AddOrUpdateFiles(unresolvedFile); compilation = project.CreateCompilation(); - CSharpAstResolver resolver = new CSharpAstResolver(compilation, cu, parsedFile); - return Tuple.Create(resolver, FindNode(cu, dollars[0], dollars[1])); + CSharpAstResolver resolver = new CSharpAstResolver(compilation, syntaxTree, unresolvedFile); + return Tuple.Create(resolver, FindNode(syntaxTree, dollars[0], dollars[1])); } protected ResolveResult Resolve(string code) @@ -212,10 +212,10 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver return (T)rr; } - protected AstNode FindNode(CompilationUnit cu, TextLocation start, TextLocation end) + protected AstNode FindNode(SyntaxTree syntaxTree, TextLocation start, TextLocation end) { FindNodeVisitor fnv = new FindNodeVisitor(start, end); - cu.AcceptVisitor(fnv); + syntaxTree.AcceptVisitor(fnv); Assert.IsNotNull(fnv.ResultNode, "Did not find DOM node at the specified location"); return fnv.ResultNode; } @@ -246,18 +246,18 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver protected ResolveResult ResolveAtLocation(string code) { - CompilationUnit cu = new CSharpParser().Parse(new StringReader(code.Replace("$", "")), "test.cs"); + SyntaxTree syntaxTree = SyntaxTree.Parse(code.Replace("$", ""), "test.cs"); TextLocation[] dollars = FindDollarSigns(code).ToArray(); Assert.AreEqual(1, dollars.Length, "Expected 1 dollar signs marking the location"); SetUp(); - CSharpParsedFile parsedFile = cu.ToTypeSystem(); - project = project.UpdateProjectContent(null, parsedFile); + CSharpUnresolvedFile unresolvedFile = syntaxTree.ToTypeSystem(); + project = project.AddOrUpdateFiles(unresolvedFile); compilation = project.CreateCompilation(); - ResolveResult rr = Resolver.ResolveAtLocation.Resolve(compilation, parsedFile, cu, dollars[0]); + ResolveResult rr = Resolver.ResolveAtLocation.Resolve(compilation, unresolvedFile, syntaxTree, dollars[0]); return rr; } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefLookupTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefLookupTests.cs index 26de3ca22d..71141ae2b7 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefLookupTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefLookupTests.cs @@ -55,8 +55,8 @@ class Impl : IGeneric[,], T> { }"; var pc = new CSharpProjectContent().AddAssemblyReferences(new[] { CecilLoaderTests.Mscorlib }); - var cu = new CSharpParser().Parse(new StringReader(program), "program.cs"); - var compilation = pc.UpdateProjectContent(null, cu.ToTypeSystem()).CreateCompilation(); + var syntaxTree = SyntaxTree.Parse(program, "program.cs"); + var compilation = pc.AddOrUpdateFiles(syntaxTree.ToTypeSystem()).CreateCompilation(); var typeDefinition = compilation.MainAssembly.TopLevelTypeDefinitions.First(); IEntity entity = typeDefinition.Documentation.ResolveCref(cref); Assert.IsNotNull(entity, "ResolveCref() returned null."); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/CSharpDocumentationTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/CSharpDocumentationTests.cs index b628d82bcc..08673dd0c2 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/CSharpDocumentationTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/CSharpDocumentationTests.cs @@ -35,8 +35,8 @@ namespace ICSharpCode.NRefactory.Documentation void Init(string program) { var pc = new CSharpProjectContent().AddAssemblyReferences(new[] { CecilLoaderTests.Mscorlib }); - var cu = new CSharpParser().Parse(new StringReader(program), "program.cs"); - compilation = pc.UpdateProjectContent(null, cu.ToTypeSystem()).CreateCompilation(); + var syntaxTree = SyntaxTree.Parse(program, "program.cs"); + compilation = pc.AddOrUpdateFiles(syntaxTree.ToTypeSystem()).CreateCompilation(); typeDefinition = compilation.MainAssembly.TopLevelTypeDefinitions.FirstOrDefault(); } @@ -137,5 +137,37 @@ class Base { Assert.AreEqual("Overridden summary", element.Children[0].TextContent); Assert.AreEqual("Base remarks", element.Children[1].TextContent); } + + [Test] + public void DocumentationAboveAttribute() + { + Init(@"using System; +/// +[SomeAttribute] +class Test { }"); + Assert.AreEqual("", typeDefinition.Documentation.ToString()); + } + + [Test] + public void DocumentationAboveAttribute2() + { + Init(@"using System; +/// +[SomeAttribute] // a comment on the attribute +class Test { }"); + Assert.AreEqual("", typeDefinition.Documentation.ToString()); + } + + [Test] + public void DocumentationAboveAttributeInRegion() + { + Init(@"using System; +/// +#region R +[SomeAttribute] +#endregion +class Test { }"); + Assert.AreEqual("", typeDefinition.Documentation.ToString()); + } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/IDStringTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/IDStringTests.cs index aeb471af52..5d30b6e403 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/IDStringTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Documentation/IDStringTests.cs @@ -50,8 +50,8 @@ namespace ICSharpCode.NRefactory.Documentation { pc = new IDStringTestProjectContent(); - var cu = new CSharpParser().Parse(new StringReader(program), "program.cs"); - foreach (var type in cu.ToTypeSystem().TopLevelTypeDefinitions) { + var syntaxTree = SyntaxTree.Parse(program, "program.cs"); + foreach (var type in syntaxTree.ToTypeSystem().TopLevelTypeDefinitions) { pc.AddTypeDefinition(type); } compilation = new SimpleCompilation(pc, CecilLoaderTests.Mscorlib); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Editor/ReadOnlyDocumentTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Editor/ReadOnlyDocumentTests.cs new file mode 100644 index 0000000000..1f56e3ed86 --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/Editor/ReadOnlyDocumentTests.cs @@ -0,0 +1,75 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; +using NUnit.Framework; + +namespace ICSharpCode.NRefactory.Editor +{ + [TestFixture] + public class ReadOnlyDocumentTests + { + [Test] + public void EmptyReadOnlyDocument() + { + IDocument document = new ReadOnlyDocument(string.Empty); + Assert.AreEqual(string.Empty, document.Text); + Assert.AreEqual(0, document.TextLength); + Assert.AreEqual(1, document.LineCount); + Assert.AreEqual(0, document.GetOffset(1, 1)); + Assert.AreEqual(new TextLocation(1, 1), document.GetLocation(0)); + + Assert.AreEqual(0, document.GetLineByNumber(1).Offset); + Assert.AreEqual(0, document.GetLineByNumber(1).EndOffset); + Assert.AreEqual(0, document.GetLineByNumber(1).Length); + Assert.AreEqual(0, document.GetLineByNumber(1).TotalLength); + Assert.AreEqual(0, document.GetLineByNumber(1).DelimiterLength); + Assert.AreEqual(1, document.GetLineByNumber(1).LineNumber); + } + + [Test] + public void SimpleDocument() + { + string text = "Hello\nWorld!\r\n"; + IDocument document = new ReadOnlyDocument(text); + Assert.AreEqual(text, document.Text); + Assert.AreEqual(3, document.LineCount); + + Assert.AreEqual(0, document.GetLineByNumber(1).Offset); + Assert.AreEqual(5, document.GetLineByNumber(1).EndOffset); + Assert.AreEqual(5, document.GetLineByNumber(1).Length); + Assert.AreEqual(6, document.GetLineByNumber(1).TotalLength); + Assert.AreEqual(1, document.GetLineByNumber(1).DelimiterLength); + Assert.AreEqual(1, document.GetLineByNumber(1).LineNumber); + + Assert.AreEqual(6, document.GetLineByNumber(2).Offset); + Assert.AreEqual(12, document.GetLineByNumber(2).EndOffset); + Assert.AreEqual(6, document.GetLineByNumber(2).Length); + Assert.AreEqual(8, document.GetLineByNumber(2).TotalLength); + Assert.AreEqual(2, document.GetLineByNumber(2).DelimiterLength); + Assert.AreEqual(2, document.GetLineByNumber(2).LineNumber); + + Assert.AreEqual(14, document.GetLineByNumber(3).Offset); + Assert.AreEqual(14, document.GetLineByNumber(3).EndOffset); + Assert.AreEqual(0, document.GetLineByNumber(3).Length); + Assert.AreEqual(0, document.GetLineByNumber(3).TotalLength); + Assert.AreEqual(0, document.GetLineByNumber(3).DelimiterLength); + Assert.AreEqual(3, document.GetLineByNumber(3).LineNumber); + } + } +} diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs index 2e62278f83..ad256d7b6b 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs @@ -37,8 +37,8 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests options.WrapLineLength = 80; var visitor = new AstFormattingVisitor (policy, document, options); visitor.FormattingMode = mode; - var compilationUnit = new CSharpParser ().Parse (document, "test.cs"); - compilationUnit.AcceptVisitor (visitor); + var syntaxTree = new CSharpParser ().Parse (document, "test.cs"); + syntaxTree.AcceptVisitor (visitor); visitor.ApplyChanges(); return document; } @@ -66,8 +66,8 @@ namespace ICSharpCode.NRefactory.CSharp.FormattingTests options.EolMarker = "\n"; var visitior = new AstFormattingVisitor (policy, document, options); visitior.FormattingMode = formattingMode; - var compilationUnit = new CSharpParser ().Parse (document, "test.cs"); - compilationUnit.AcceptVisitor (visitior); + var syntaxTree = new CSharpParser ().Parse (document, "test.cs"); + syntaxTree.AcceptVisitor (visitior); visitior.ApplyChanges(); string newText = document.Text; if (expectedOutput != newText) { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj index 9b68806161..1dfae72049 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj @@ -14,9 +14,9 @@ False 4 false + ..\bin\$(Configuration)\ - bin\Debug\ true Full False @@ -24,46 +24,39 @@ DEBUG;TRACE - bin\Release\ - False - None + PdbOnly True False TRACE - - ..\ICSharpCode.NRefactory\bin\Debug\ - False - Auto - 4194304 - 4096 - AnyCPU - - - ..\ICSharpCode.NRefactory\bin\Release\ + False Auto 4194304 4096 AnyCPU - - AnyCPU + False Auto 4194304 4096 - - - ..\ICSharpCode.NRefactory\bin\Debug\ x86 - - ..\ICSharpCode.NRefactory\bin\Release\ - x86 + + true + Full + False + True + DEBUG;TRACE;NET45 + v4.5 - - x86 + + PdbOnly + True + False + TRACE;NET45 + v4.5 @@ -151,6 +144,7 @@ + @@ -160,6 +154,7 @@ + @@ -181,6 +176,7 @@ + @@ -189,6 +185,7 @@ + @@ -274,6 +271,8 @@ + + @@ -302,6 +301,7 @@ + diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/CecilLoaderTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/CecilLoaderTests.cs index fbb9540539..a649f89f45 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/CecilLoaderTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/CecilLoaderTests.cs @@ -35,12 +35,12 @@ namespace ICSharpCode.NRefactory.TypeSystem static readonly Lazy systemCore = new Lazy( delegate { - return new CecilLoader().LoadAssemblyFile(typeof(System.Linq.Enumerable).Assembly.Location); - }); - + return new CecilLoader().LoadAssemblyFile(typeof(System.Linq.Enumerable).Assembly.Location); + }); + public static IUnresolvedAssembly Mscorlib { get { return mscorlib.Value; } } public static IUnresolvedAssembly SystemCore { get { return systemCore.Value; } } - + [TestFixtureSetUp] public void FixtureSetUp() { @@ -307,5 +307,19 @@ namespace ICSharpCode.NRefactory.TypeSystem Assert.IsNotNull(c, "System.Func<,> not found"); Assert.AreEqual("mscorlib", c.ParentAssembly.AssemblyName); } + + public void DelegateIsClass() + { + var @delegate = compilation.FindType(KnownTypeCode.Delegate).GetDefinition(); + Assert.AreEqual(TypeKind.Class, @delegate); + Assert.IsFalse(@delegate.IsSealed); + } + + public void MulticastDelegateIsClass() + { + var multicastDelegate = compilation.FindType(KnownTypeCode.MulticastDelegate).GetDefinition(); + Assert.AreEqual(TypeKind.Class, multicastDelegate); + Assert.IsFalse(multicastDelegate.IsSealed); + } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/CyclicProjectDependency.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/CyclicProjectDependency.cs new file mode 100644 index 0000000000..f734002859 --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/CyclicProjectDependency.cs @@ -0,0 +1,64 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; +using System.Linq; +using ICSharpCode.NRefactory.CSharp; +using ICSharpCode.NRefactory.TypeSystem.Implementation; +using NUnit.Framework; + +namespace ICSharpCode.NRefactory.TypeSystem +{ + [TestFixture] + public class CyclicProjectDependency + { + IProjectContent pc1; + IProjectContent pc2; + ISolutionSnapshot solution; + + [SetUp] + public void Setup() + { + pc1 = new CSharpProjectContent() + .SetAssemblyName("PC1") + .SetProjectFileName("PC1.csproj") + .AddAssemblyReferences(new IAssemblyReference[] { CecilLoaderTests.Mscorlib, new ProjectReference("PC2.csproj") }); + + pc2 = new CSharpProjectContent() + .SetAssemblyName("PC2") + .SetProjectFileName("PC2.csproj") + .AddAssemblyReferences(new IAssemblyReference[] { CecilLoaderTests.Mscorlib, new ProjectReference("PC1.csproj") }); + + solution = new DefaultSolutionSnapshot(new[] { pc1, pc2 }); + } + + [Test] + public void CreateCompilation1() + { + ICompilation c = solution.GetCompilation(pc1); + Assert.AreEqual(new string[] { "PC1", "mscorlib", "PC2" }, c.Assemblies.Select(asm => asm.AssemblyName).ToArray()); + } + + [Test] + public void CreateCompilation2() + { + ICompilation c = solution.GetCompilation(pc2); + Assert.AreEqual(new string[] { "PC2", "mscorlib", "PC1" }, c.Assemblies.Select(asm => asm.AssemblyName).ToArray()); + } + } +} diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/GetAllBaseTypesTest.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/GetAllBaseTypesTest.cs index 1600e5372a..b53ef9d30f 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/GetAllBaseTypesTest.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/GetAllBaseTypesTest.cs @@ -67,8 +67,8 @@ namespace System.Collections.Generic { [SetUp] public void SetUp() { - var parsedFile = new CSharpParser().Parse(corlib, "corlib.cs").ToTypeSystem(); - compilation = new CSharpProjectContent().SetAssemblyName("mscorlib").UpdateProjectContent(null, parsedFile).CreateCompilation(); + var unresolvedFile = new CSharpParser().Parse(corlib, "corlib.cs").ToTypeSystem(); + compilation = new CSharpProjectContent().SetAssemblyName("mscorlib").AddOrUpdateFiles(unresolvedFile).CreateCompilation(); } IType[] GetAllBaseTypes(Type type) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemHelper.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemHelper.cs index 24bbd57ba7..d5c94561e4 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemHelper.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemHelper.cs @@ -27,20 +27,20 @@ namespace ICSharpCode.NRefactory.TypeSystem { public static ICompilation CreateCompilation() { - return CreateCompilation(new IParsedFile[0]); + return CreateCompilation(new IUnresolvedFile[0]); } public static ICompilation CreateCompilation(params IUnresolvedTypeDefinition[] unresolvedTypeDefinitions) { - var parsedFile = new CSharpParsedFile("dummy.cs"); + var unresolvedFile = new CSharpUnresolvedFile("dummy.cs"); foreach (var typeDef in unresolvedTypeDefinitions) - parsedFile.TopLevelTypeDefinitions.Add(typeDef); - return CreateCompilation(parsedFile); + unresolvedFile.TopLevelTypeDefinitions.Add(typeDef); + return CreateCompilation(unresolvedFile); } - public static ICompilation CreateCompilation(params IParsedFile[] parsedFiles) + public static ICompilation CreateCompilation(params IUnresolvedFile[] unresolvedFiles) { - var pc = new CSharpProjectContent().UpdateProjectContent(null, parsedFiles); + var pc = new CSharpProjectContent().AddOrUpdateFiles(unresolvedFiles); pc = pc.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib, CecilLoaderTests.SystemCore }); return pc.CreateCompilation(); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs index f95b5a5d3f..6849a73c43 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs @@ -118,6 +118,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.TestCase public MyStructWithCtor(int a) {} } + public class MyClassWithCtor + { + private MyClassWithCtor(int a) {} + } + [Serializable] public class NonCustomAttributes { @@ -247,6 +252,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.TestCase public class ClassWithVirtualProperty { public virtual int Prop { get; set; } } + + public class ClassThatOverridesAndSealsVirtualProperty : ClassWithVirtualProperty { + public sealed override int Prop { get; set; } + } public class ClassThatImplementsProperty : IInterfaceWithProperty { public int Prop { get; set; } @@ -308,4 +317,14 @@ namespace ICSharpCode.NRefactory.TypeSystem.TestCase new int Prop { get; set; } new event EventHandler Evt; } + + public static class StaticClass {} + public abstract class AbstractClass {} + + public class IndexerNonDefaultName { + [IndexerName("Foo")] + public int this[int index] { + get { return 0; } + } + } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs index f8e41711f0..3f10d3a2ed 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs @@ -466,6 +466,23 @@ namespace ICSharpCode.NRefactory.TypeSystem Assert.AreEqual(2, ctors.Count()); Assert.IsFalse(ctors.Any(c => c.IsStatic)); Assert.IsTrue(ctors.All(c => c.ReturnType.Kind == TypeKind.Void)); + Assert.IsTrue(ctors.All(c => c.Accessibility == Accessibility.Public)); + } + + [Test] + public void NoDefaultConstructorAddedToClass() + { + var ctors = compilation.FindType(typeof(MyClassWithCtor)).GetConstructors(); + Assert.AreEqual(Accessibility.Private, ctors.Single().Accessibility); + Assert.AreEqual(1, ctors.Single().Parameters.Count); + } + + [Test] + public void DefaultConstructorOnAbstractClassIsProtected() + { + var ctors = compilation.FindType(typeof(AbstractClass)).GetConstructors(); + Assert.AreEqual(0, ctors.Single().Parameters.Count); + Assert.AreEqual(Accessibility.Protected, ctors.Single().Accessibility); } [Test] @@ -637,6 +654,7 @@ namespace ICSharpCode.NRefactory.TypeSystem Assert.AreEqual(Accessibility.Public, m.Accessibility); Assert.IsTrue(m.IsAbstract); Assert.IsFalse(m.IsVirtual); + Assert.IsFalse(m.IsSealed); } [Test] @@ -952,7 +970,28 @@ namespace ICSharpCode.NRefactory.TypeSystem Assert.That(prop.Getter.ImplementedInterfaceMembers.Select(p => p.ReflectionName).ToList(), Is.EqualTo(new[] { "ICSharpCode.NRefactory.TypeSystem.TestCase.IInterfaceWithProperty.get_Prop" })); Assert.That(prop.Setter.ImplementedInterfaceMembers.Select(p => p.ReflectionName).ToList(), Is.EqualTo(new[] { "ICSharpCode.NRefactory.TypeSystem.TestCase.IInterfaceWithProperty.set_Prop" })); } + + [Test] + public void PropertyThatImplementsInterfaceIsNotVirtual() + { + ITypeDefinition type = GetTypeDefinition(typeof(ClassThatImplementsProperty)); + var prop = type.Properties.Single(p => p.Name == "Prop"); + Assert.IsFalse(prop.IsVirtual); + Assert.IsFalse(prop.IsOverridable); + Assert.IsFalse(prop.IsSealed); + } + [Test] + public void Property_SealedOverride() + { + ITypeDefinition type = GetTypeDefinition(typeof(ClassThatOverridesAndSealsVirtualProperty)); + var prop = type.Properties.Single(p => p.Name == "Prop"); + Assert.IsFalse(prop.IsVirtual); + Assert.IsTrue(prop.IsOverride); + Assert.IsTrue(prop.IsSealed); + Assert.IsFalse(prop.IsOverridable); + } + [Test] public void PropertyAccessorsShouldSupportToMemberReference() { @@ -1104,7 +1143,7 @@ namespace ICSharpCode.NRefactory.TypeSystem } [Test] - public void ExplicitlyImplementedEventsShouldBeReportedAsBeingImplemented() + public void ExplicitlyImplementedEventsShouldBeReportedAsBeingImplemented() { ITypeDefinition type = GetTypeDefinition(typeof(ClassThatImplementsEventExplicitly)); var evt = type.Events.Single(); @@ -1132,5 +1171,30 @@ namespace ICSharpCode.NRefactory.TypeSystem Assert.That(evt.AddAccessor.ImplementedInterfaceMembers, Is.Empty); Assert.That(evt.RemoveAccessor.ImplementedInterfaceMembers, Is.Empty); } + + [Test] + public void StaticClassTest() + { + ITypeDefinition type = GetTypeDefinition(typeof(StaticClass)); + Assert.IsTrue(type.IsAbstract); + Assert.IsTrue(type.IsSealed); + Assert.IsTrue(type.IsStatic); + } + + [Test] + public void NoDefaultConstructorOnStaticClassTest() + { + ITypeDefinition type = GetTypeDefinition(typeof(StaticClass)); + Assert.AreEqual(0, type.GetConstructors().Count()); + } + + [Test] + [Ignore("not yet implemented in C# TypeSystemConvertVisitor")] + public void IndexerNonDefaultName() + { + ITypeDefinition type = GetTypeDefinition(typeof(IndexerNonDefaultName)); + var indexer = type.GetProperties(p => p.IsIndexer).Single(); + Assert.AreEqual("Foo", indexer.Name); + } } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.VB.Tests/.gitignore b/src/Libraries/NRefactory/ICSharpCode.NRefactory.VB.Tests/.gitignore deleted file mode 100644 index 9ce745d95d..0000000000 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.VB.Tests/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -bin/ -obj/ \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.VB/.gitignore b/src/Libraries/NRefactory/ICSharpCode.NRefactory.VB/.gitignore deleted file mode 100644 index 9ce745d95d..0000000000 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.VB/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -bin/ -obj/ \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/.gitignore b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/.gitignore deleted file mode 100644 index 9ce745d95d..0000000000 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -bin/ -obj/ \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/AXmlObject.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/AXmlObject.cs index 743a96e510..5bde059bec 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/AXmlObject.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/AXmlObject.cs @@ -111,7 +111,7 @@ namespace ICSharpCode.NRefactory.Xml return child.GetChildAtOffset(offset); } } - return this; // No childs at offset + return this; // No children at offset } /// diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/ICSharpCode.NRefactory.Xml.csproj b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/ICSharpCode.NRefactory.Xml.csproj index e98d2e0a8d..bd4cc4b338 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/ICSharpCode.NRefactory.Xml.csproj +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.Xml/ICSharpCode.NRefactory.Xml.csproj @@ -12,13 +12,14 @@ False 4 false - ..\ICSharpCode.NRefactory\bin\$(Configuration)\ICSharpCode.NRefactory.Xml.xml true ..\ICSharpCode.NRefactory.snk False File 10.0.0 2.0 + ..\bin\$(Configuration)\ + ..\bin\$(Configuration)\ICSharpCode.NRefactory.Xml.xml AnyCPU @@ -28,13 +29,11 @@ 4096 - ..\ICSharpCode.NRefactory\bin\Debug\ False True DEBUG;TRACE - ..\ICSharpCode.NRefactory\bin\Release\ True False TRACE @@ -47,6 +46,26 @@ PdbOnly false + + False + True + DEBUG;TRACE;NET45 + v4.5 + + + full + true + + + True + False + TRACE;NET45 + v4.5 + + + PdbOnly + false + diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/.gitignore b/src/Libraries/NRefactory/ICSharpCode.NRefactory/.gitignore deleted file mode 100644 index 9ce745d95d..0000000000 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -bin/ -obj/ \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Completion/CompletionExtensionMethods.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Completion/CompletionExtensionMethods.cs new file mode 100644 index 0000000000..a5a88689b6 --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Completion/CompletionExtensionMethods.cs @@ -0,0 +1,73 @@ +// +// CompletionExtensionMethods.cs +// +// Author: +// Mike Krüger +// +// Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using ICSharpCode.NRefactory.TypeSystem; +using System.Linq; + +namespace ICSharpCode.NRefactory.Completion +{ + public static class CompletionExtensionMethods + { + /// + /// Gets the EditorBrowsableState of an entity. + /// + /// + /// The editor browsable state. + /// + /// + /// Entity. + /// + public static System.ComponentModel.EditorBrowsableState GetEditorBrowsableState(this IEntity entity) + { + if (entity == null) + throw new ArgumentNullException ("entity"); + + var browsableState = entity.Attributes.FirstOrDefault(attr => attr.AttributeType.Name == "EditorBrowsableAttribute" && attr.AttributeType.Namespace == "System.ComponentModel"); + if (browsableState != null && browsableState.PositionalArguments.Count == 1) { + try { + return (System.ComponentModel.EditorBrowsableState)browsableState.PositionalArguments [0].ConstantValue; + } catch (Exception) {} + } + return System.ComponentModel.EditorBrowsableState.Always; + } + + /// + /// Determines if an entity should be shown in the code completion window. This is the same as: + /// GetEditorBrowsableState (entity) != System.ComponentModel.EditorBrowsableState.Never + /// + /// + /// true if the entity should be shown; otherwise, false. + /// + /// + /// The entity. + /// + public static bool IsBrowsable(this IEntity entity) + { + return GetEditorBrowsableState (entity) != System.ComponentModel.EditorBrowsableState.Never; + } + } +} + diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ITextSource.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ITextSource.cs index c8810571de..148aee0d29 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ITextSource.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ITextSource.cs @@ -94,6 +94,16 @@ namespace ICSharpCode.NRefactory.Editor /// offset or length is outside the valid range. string GetText(ISegment segment); + /// + /// Writes the text from this document into the TextWriter. + /// + void WriteTextTo(TextWriter writer); + + /// + /// Writes the text from this document into the TextWriter. + /// + void WriteTextTo(TextWriter writer, int offset, int length); + /// /// Gets the index of the first occurrence of the character in the specified array. /// diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ReadOnlyDocument.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ReadOnlyDocument.cs index 2a36ccda33..0cc4b68dc5 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ReadOnlyDocument.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/ReadOnlyDocument.cs @@ -359,6 +359,18 @@ namespace ICSharpCode.NRefactory.Editor return textSource.CreateReader(offset, length); } + /// + public void WriteTextTo(System.IO.TextWriter writer) + { + textSource.WriteTextTo(writer); + } + + /// + public void WriteTextTo(System.IO.TextWriter writer, int offset, int length) + { + textSource.WriteTextTo(writer, offset, length); + } + /// public char GetCharAt(int offset) { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/StringBuilderDocument.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/StringBuilderDocument.cs index f69070a196..d310f34c4a 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/StringBuilderDocument.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/StringBuilderDocument.cs @@ -41,11 +41,27 @@ namespace ICSharpCode.NRefactory.Editor b = new StringBuilder(); } + /// + /// Creates a new StringBuilderDocument with the specified initial text. + /// public StringBuilderDocument(string text) { + if (text == null) + throw new ArgumentNullException("text"); b = new StringBuilder(text); } + /// + /// Creates a new StringBuilderDocument with the initial text copied from the specified text source. + /// + public StringBuilderDocument(ITextSource textSource) + { + if (textSource == null) + throw new ArgumentNullException("textSource"); + b = new StringBuilder(textSource.TextLength); + textSource.WriteTextTo(new StringWriter(b)); + } + /// public event EventHandler TextChanging; @@ -273,6 +289,22 @@ namespace ICSharpCode.NRefactory.Editor { return new StringReader(GetText(offset, length)); } + + /// + public void WriteTextTo(TextWriter writer) + { + if (writer == null) + throw new ArgumentNullException("writer"); + writer.Write(this.Text); + } + + /// + public void WriteTextTo(TextWriter writer, int offset, int length) + { + if (writer == null) + throw new ArgumentNullException("writer"); + writer.Write(GetText(offset, length)); + } #endregion #region GetText / IndexOf @@ -310,6 +342,8 @@ namespace ICSharpCode.NRefactory.Editor /// public string GetText(ISegment segment) { + if (segment == null) + throw new ArgumentNullException("segment"); return b.ToString(segment.Offset, segment.Length); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/StringTextSource.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/StringTextSource.cs index 36780954bd..99a81f02a7 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/StringTextSource.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Editor/StringTextSource.cs @@ -95,6 +95,18 @@ namespace ICSharpCode.NRefactory.Editor return new StringReader(text.Substring(offset, length)); } + /// + public void WriteTextTo(TextWriter writer) + { + writer.Write(text); + } + + /// + public void WriteTextTo(TextWriter writer, int offset, int length) + { + writer.Write(text.Substring(offset, length)); + } + /// public char GetCharAt(int offset) { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/IAnnotatable.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/IAnnotatable.cs index 07c82b734e..74c596dcf3 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/IAnnotatable.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/IAnnotatable.cs @@ -78,6 +78,10 @@ namespace ICSharpCode.NRefactory void RemoveAnnotations(Type type); } + /// + /// Base class used to implement the IAnnotatable interface. + /// This implementation is thread-safe. + /// [Serializable] public abstract class AbstractAnnotatable : IAnnotatable { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj b/src/Libraries/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj index 4e09de2114..34b8e4d855 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj @@ -15,15 +15,14 @@ false False -Microsoft.Design#CA1000;-Microsoft.Design#CA1004;-Microsoft.Design#CA1005;-Microsoft.Design#CA1006;-Microsoft.Design#CA1026;-Microsoft.Design#CA1033;-Microsoft.Design#CA1051;-Microsoft.Design#CA1063;-Microsoft.Naming#CA1702;-Microsoft.Naming#CA1704;-Microsoft.Naming#CA1710;-Microsoft.Naming#CA1716;-Microsoft.Naming#CA1720;-Microsoft.Performance#CA1800;-Microsoft.Security#CA2104 - true + True ..\ICSharpCode.NRefactory.snk False File - bin\$(Configuration)\ICSharpCode.NRefactory.xml 4 1591 - - v4.5 + ..\bin\$(Configuration)\ + ..\bin\$(Configuration)\ICSharpCode.NRefactory.xml AnyCPU @@ -33,25 +32,42 @@ 4096 - bin\Debug\ False - DEBUG;TRACE;NET45 + DEBUG;TRACE True Project - bin\Release\ True - TRACE;NET45 + TRACE False - Full - true + full + True PdbOnly - false + + + False + DEBUG;TRACE;NET45 + True + Project + v4.5 + + + full + True + + + True + TRACE;NET45 + False + v4.5 + + + PdbOnly @@ -101,6 +117,7 @@ + @@ -116,6 +133,7 @@ + @@ -141,6 +159,7 @@ + @@ -149,7 +168,6 @@ - @@ -188,7 +206,7 @@ - + @@ -201,6 +219,7 @@ + @@ -222,6 +241,7 @@ + @@ -235,6 +255,7 @@ + diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Semantics/NamedArgumentResolveResult.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Semantics/NamedArgumentResolveResult.cs new file mode 100644 index 0000000000..7a69afebf8 --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Semantics/NamedArgumentResolveResult.cs @@ -0,0 +1,81 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; +using System.Collections.Generic; +using ICSharpCode.NRefactory.TypeSystem; + +namespace ICSharpCode.NRefactory.Semantics +{ + /// + /// Represents a named argument. + /// + public class NamedArgumentResolveResult : ResolveResult + { + /// + /// Gets the member to which the parameter belongs. + /// This field can be null. + /// + public readonly IParameterizedMember Member; + + /// + /// Gets the parameter. + /// This field can be null. + /// + public readonly IParameter Parameter; + + /// + /// Gets the parameter name. + /// + public readonly string ParameterName; + + /// + /// Gets the argument passed to the parameter. + /// + public readonly ResolveResult Argument; + + public NamedArgumentResolveResult(IParameter parameter, ResolveResult argument, IParameterizedMember member = null) + : base(argument.Type) + { + if (parameter == null) + throw new ArgumentNullException("parameter"); + if (argument == null) + throw new ArgumentNullException("argument"); + this.Member = member; + this.Parameter = parameter; + this.ParameterName = parameter.Name; + this.Argument = argument; + } + + public NamedArgumentResolveResult(string parameterName, ResolveResult argument) + : base(argument.Type) + { + if (parameterName == null) + throw new ArgumentNullException("parameterName"); + if (argument == null) + throw new ArgumentNullException("argument"); + this.ParameterName = parameterName; + this.Argument = argument; + } + + public override IEnumerable GetChildResults() + { + return new [] { Argument }; + } + } +} diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs index 0eb735a759..9a98ed520c 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs @@ -967,7 +967,16 @@ namespace ICSharpCode.NRefactory.TypeSystem return; } foreach (var ctorParameter in ctorParameterTypes.Resolve(context)) { - positionalArguments.Add(reader.ReadFixedArg(ctorParameter)); + ResolveResult arg = reader.ReadFixedArg(ctorParameter); + positionalArguments.Add(arg); + if (arg.IsError) { + // After a decoding error, we must stop decoding the blob because + // we might have read too few bytes due to the error. + // Just fill up the remaining arguments with ErrorResolveResult: + while (positionalArguments.Count < ctorParameterTypes.Count) + positionalArguments.Add(ErrorResolveResult.UnknownError); + return; + } } ushort numNamed = reader.ReadUInt16(); for (int i = 0; i < numNamed; i++) { @@ -1131,6 +1140,9 @@ namespace ICSharpCode.NRefactory.TypeSystem ResolveResult[] elements = new ResolveResult[numElem]; for (int i = 0; i < elements.Length; i++) { elements[i] = ReadElem(elementType); + // Stop decoding when encountering an error: + if (elements[i].IsError) + return ErrorResolveResult.UnknownError; } return new ArrayCreateResolveResult(argType, null, elements); } @@ -1421,11 +1433,10 @@ namespace ICSharpCode.NRefactory.TypeSystem namedArgs.Add(namedArg); } - attributes[i] = new ResolvedSecurityAttribute { - AttributeType = attributeType, - NamedArguments = namedArgs, - PositionalArguments = new ResolveResult[] { securityActionRR } - }; + attributes[i] = new DefaultAttribute( + attributeType, + positionalArguments: new ResolveResult[] { securityActionRR }, + namedArguments: namedArgs); } } @@ -1468,37 +1479,6 @@ namespace ICSharpCode.NRefactory.TypeSystem return secDecl.Resolve(context.CurrentAssembly)[index]; } } - - sealed class ResolvedSecurityAttribute : IAttribute - { - public IType AttributeType { get; internal set; } - - DomRegion IAttribute.Region { - get { return DomRegion.Empty; } - } - - volatile IMethod constructor; - - public IMethod Constructor { - get { - IMethod ctor = this.constructor; - if (ctor == null) { - foreach (IMethod candidate in this.AttributeType.GetConstructors(m => m.Parameters.Count == 1)) { - if (candidate.Parameters[0].Type.Equals(this.PositionalArguments[0].Type)) { - ctor = candidate; - break; - } - } - this.constructor = ctor; - } - return ctor; - } - } - - public IList PositionalArguments { get; internal set; } - - public IList> NamedArguments { get; internal set; } - } #endregion #endregion @@ -1647,11 +1627,13 @@ namespace ICSharpCode.NRefactory.TypeSystem static bool IsDelegate(TypeDefinition type) { - if (type.BaseType == null) - return false; - else - return type.BaseType.FullName == "System.Delegate" - || type.BaseType.FullName == "System.MulticastDelegate"; + if (type.BaseType != null && type.BaseType.Namespace == "System") { + if (type.BaseType.Name == "MulticastDelegate") + return true; + if (type.BaseType.Name == "Delegate" && type.Name != "MulticastDelegate") + return true; + } + return false; } static bool IsModule(TypeDefinition type) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultSolutionSnapshot.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/DefaultSolutionSnapshot.cs similarity index 67% rename from src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultSolutionSnapshot.cs rename to src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/DefaultSolutionSnapshot.cs index f32676c220..16d07a08dc 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultSolutionSnapshot.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/DefaultSolutionSnapshot.cs @@ -18,16 +18,47 @@ using System; using System.Collections.Concurrent; +using System.Collections.Generic; -namespace ICSharpCode.NRefactory.TypeSystem.Implementation +using ICSharpCode.NRefactory.Utils; + +namespace ICSharpCode.NRefactory.TypeSystem { /// /// Default implementation of ISolutionSnapshot. /// public class DefaultSolutionSnapshot : ISolutionSnapshot { + readonly Dictionary projectDictionary = new Dictionary(Platform.FileNameComparer); ConcurrentDictionary dictionary = new ConcurrentDictionary(); + /// + /// Creates a new DefaultSolutionSnapshot with the specified projects. + /// + public DefaultSolutionSnapshot(IEnumerable projects) + { + foreach (var project in projects) { + if (project.ProjectFileName != null) + projectDictionary.Add(project.ProjectFileName, project); + } + } + + /// + /// Creates a new DefaultSolutionSnapshot that does not support s. + /// + public DefaultSolutionSnapshot() + { + } + + public IProjectContent GetProjectContent(string projectFileName) + { + IProjectContent pc; + if (projectDictionary.TryGetValue(projectFileName, out pc)) + return pc; + else + return null; + } + public ICompilation GetCompilation(IProjectContent project) { if (project == null) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs index 0f02617087..f15885817c 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ExtensionMethods.cs @@ -268,7 +268,7 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Gets all unresolved type definitions from the file. /// For partial classes, each part is returned. /// - public static IEnumerable GetAllTypeDefinitions (this IParsedFile file) + public static IEnumerable GetAllTypeDefinitions (this IUnresolvedFile file) { return TreeTraversal.PreOrder(file.TopLevelTypeDefinitions, t => t.NestedTypes); } @@ -300,7 +300,7 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Gets the type (potentially a nested type) defined at the specified location. /// Returns null if no type is defined at that location. /// - public static IUnresolvedTypeDefinition GetInnermostTypeDefinition (this IParsedFile file, int line, int column) + public static IUnresolvedTypeDefinition GetInnermostTypeDefinition (this IUnresolvedFile file, int line, int column) { return file.GetInnermostTypeDefinition (new TextLocation (line, column)); } @@ -309,7 +309,7 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Gets the member defined at the specified location. /// Returns null if no member is defined at that location. /// - public static IUnresolvedMember GetMember (this IParsedFile file, int line, int column) + public static IUnresolvedMember GetMember (this IUnresolvedFile file, int line, int column) { return file.GetMember (new TextLocation (line, column)); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs index ef9adf7f48..184de64784 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IAttribute.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics.Contracts; using ICSharpCode.NRefactory.Semantics; @@ -27,9 +26,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// /// Represents an unresolved attribute. /// - #if WITH_CONTRACTS - [ContractClass(typeof(IUnresolvedAttributeContract))] - #endif [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] public interface IUnresolvedAttribute { @@ -38,8 +34,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// DomRegion Region { get; } - //ITypeReference AttributeType { get; } - /// /// Resolves the attribute. /// @@ -49,9 +43,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// /// Represents an attribute. /// - #if WITH_CONTRACTS - [ContractClass(typeof(IAttributeContract))] - #endif [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] public interface IAttribute { @@ -81,41 +72,4 @@ namespace ICSharpCode.NRefactory.TypeSystem /// IList> NamedArguments { get; } } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(IAttribute))] - abstract class IAttributeContract : IFreezableContract, IAttribute - { - DomRegion IAttribute.Region { - get { return DomRegion.Empty; } - } - - ITypeReference IAttribute.AttributeType { - get { - Contract.Ensures(Contract.Result() != null); - return null; - } - } - - IList IAttribute.GetPositionalArguments(ITypeResolveContext context) - { - Contract.Requires(context != null); - Contract.Ensures(Contract.Result>() != null); - return null; - } - - IList> IAttribute.GetNamedArguments(ITypeResolveContext context) - { - Contract.Requires(context != null); - Contract.Ensures(Contract.Result>>() != null); - return null; - } - - IMethod IAttribute.ResolveConstructor(ITypeResolveContext context) - { - Contract.Requires(context != null); - return null; - } - } - #endif } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IEntity.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IEntity.cs index 192f77be39..236ad4b944 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IEntity.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IEntity.cs @@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Gets the parsed file in which this entity is defined. /// Returns null if this entity wasn't parsed from source code (e.g. loaded from a .dll with CecilLoader). /// - IParsedFile ParsedFile { get; } + IUnresolvedFile UnresolvedFile { get; } /// /// Gets the attributes on this entity. diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IFreezable.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IFreezable.cs index e0b63a28ad..050d09e099 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IFreezable.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IFreezable.cs @@ -17,13 +17,9 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Diagnostics.Contracts; namespace ICSharpCode.NRefactory.TypeSystem { - #if WITH_CONTRACTS - [ContractClass(typeof(IFreezableContract))] - #endif public interface IFreezable { /// @@ -36,20 +32,4 @@ namespace ICSharpCode.NRefactory.TypeSystem /// void Freeze(); } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(IFreezable))] - abstract class IFreezableContract : IFreezable - { - bool IFreezable.IsFrozen { - get { return default(bool); } - } - - void IFreezable.Freeze() - { - IFreezable self = this; - Contract.Ensures(self.IsFrozen); - } - } - #endif } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IInterningProvider.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IInterningProvider.cs index dc20e18ef8..89edd7f9f4 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IInterningProvider.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IInterningProvider.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics.Contracts; namespace ICSharpCode.NRefactory.TypeSystem { @@ -40,9 +39,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// and which are used only within a single type definition. Then a persistent file format could be organized so /// that shared objects are loaded only once, yet non-shared objects get loaded lazily together with the class. /// - #if WITH_CONTRACTS - [ContractClass(typeof(IInterningProviderContract))] - #endif public interface IInterningProvider { /// @@ -55,22 +51,4 @@ namespace ICSharpCode.NRefactory.TypeSystem IList InternList(IList list) where T : class; } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(IInterningProvider))] - abstract class IInterningProviderContract : IInterningProvider - { - T IInterningProvider.Intern(T obj) - { - Contract.Ensures((Contract.Result() == null) == (obj == null)); - return obj; - } - - IList IInterningProvider.InternList(IList list) - { - Contract.Ensures((Contract.Result>() == null) == (list == null)); - return list; - } - } - #endif } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IProjectContent.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IProjectContent.cs index 4a731c42ce..6987d780ae 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IProjectContent.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IProjectContent.cs @@ -27,15 +27,20 @@ namespace ICSharpCode.NRefactory.TypeSystem /// public interface IProjectContent : IUnresolvedAssembly { + /// + /// Gets the path to the project file (e.g. .csproj). + /// + string ProjectFileName { get; } + /// /// Gets a parsed file by its file name. /// - IParsedFile GetFile(string fileName); + IUnresolvedFile GetFile(string fileName); /// - /// Gets the list of all parsed files in the project content. + /// Gets the list of all files in the project content. /// - IEnumerable Files { get; } + IEnumerable Files { get; } /// /// Gets the referenced assemblies. @@ -52,7 +57,8 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Creates a new that allows resolving within this project. /// /// - /// An ICompilation is immutable, it operates on a snapshot of this project. + /// This method does not support s. When dealing with a solution + /// containing multiple projects, consider using instead. /// ICompilation CreateCompilation(); @@ -61,7 +67,10 @@ namespace ICSharpCode.NRefactory.TypeSystem /// /// The parent solution snapshot to use for the compilation. /// - /// An ICompilation is immutable, it operates on a snapshot of this project. + /// This method is intended to be called by ISolutionSnapshot implementations. Other code should + /// call instead. + /// This method always creates a new compilation, even if the solution snapshot already contains + /// one for this project. /// ICompilation CreateCompilation(ISolutionSnapshot solutionSnapshot); @@ -71,7 +80,12 @@ namespace ICSharpCode.NRefactory.TypeSystem IProjectContent SetAssemblyName(string newAssemblyName); /// - /// Changes the location of this project content. + /// Changes the project file name of this project content. + /// + IProjectContent SetProjectFileName(string newProjectFileName); + + /// + /// Changes the path to the assembly location (the output path where the project compiles to). /// IProjectContent SetLocation(string newLocation); @@ -80,20 +94,60 @@ namespace ICSharpCode.NRefactory.TypeSystem /// IProjectContent AddAssemblyReferences(IEnumerable references); + /// + /// Add assembly references to this project content. + /// + IProjectContent AddAssemblyReferences(params IAssemblyReference[] references); + /// /// Removes assembly references from this project content. /// IProjectContent RemoveAssemblyReferences(IEnumerable references); + /// + /// Removes assembly references from this project content. + /// + IProjectContent RemoveAssemblyReferences(params IAssemblyReference[] references); + + /// + /// Adds the specified files to the project content. + /// If a file with the same name already exists, updated the existing file. + /// + /// + /// You can create an unresolved file by calling ToTypeSystem() on a syntax tree. + /// + IProjectContent AddOrUpdateFiles(IEnumerable newFiles); + + /// + /// Adds the specified files to the project content. + /// If a file with the same name already exists, this method updates the existing file. + /// + /// + /// You can create an unresolved file by calling ToTypeSystem() on a syntax tree. + /// + IProjectContent AddOrUpdateFiles(params IUnresolvedFile[] newFiles); + + /// + /// Removes the files with the specified names. + /// + IProjectContent RemoveFiles(IEnumerable fileNames); + + /// + /// Removes the files with the specified names. + /// + IProjectContent RemoveFiles(params string[] fileNames); + /// /// Removes types and attributes from oldFile from the project, and adds those from newFile. /// - IProjectContent UpdateProjectContent(IParsedFile oldFile, IParsedFile newFile); + [Obsolete("Use RemoveFiles()/AddOrUpdateFiles() instead")] + IProjectContent UpdateProjectContent(IUnresolvedFile oldFile, IUnresolvedFile newFile); /// /// Removes types and attributes from oldFiles from the project, and adds those from newFiles. /// - IProjectContent UpdateProjectContent(IEnumerable oldFiles, IEnumerable newFiles); + [Obsolete("Use RemoveFiles()/AddOrUpdateFiles() instead")] + IProjectContent UpdateProjectContent(IEnumerable oldFiles, IEnumerable newFiles); /// /// Sets the compiler settings object. diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ISolutionSnapshot.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ISolutionSnapshot.cs index 052dc1a798..888233d0e0 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ISolutionSnapshot.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ISolutionSnapshot.cs @@ -25,8 +25,18 @@ namespace ICSharpCode.NRefactory.TypeSystem /// public interface ISolutionSnapshot { + /// + /// Gets the project content with the specified file name. + /// Returns null if no such project exists in the solution. + /// + /// + /// This method is used by the class. + /// + IProjectContent GetProjectContent(string projectFileName); + /// /// Gets the compilation for the specified project. + /// The project must be a part of the solution (passed to the solution snapshot's constructor). /// ICompilation GetCompilation(IProjectContent project); } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ISupportsInterning.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ISupportsInterning.cs index 43573ade47..0832e33e90 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ISupportsInterning.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ISupportsInterning.cs @@ -17,8 +17,6 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; namespace ICSharpCode.NRefactory.TypeSystem { @@ -26,9 +24,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Interface for TypeSystem objects that support interning. /// See for more information. /// - #if WITH_CONTRACTS - [ContractClass(typeof(ISupportsInterningContract))] - #endif public interface ISupportsInterning { /// @@ -46,25 +41,4 @@ namespace ICSharpCode.NRefactory.TypeSystem /// bool EqualsForInterning(ISupportsInterning other); } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(ISupportsInterning))] - abstract class ISupportsInterningContract : ISupportsInterning - { - void ISupportsInterning.PrepareForInterning(IInterningProvider provider) - { - Contract.Requires(provider != null); - } - - int ISupportsInterning.GetHashCodeForInterning() - { - return 0; - } - - bool ISupportsInterning.EqualsForInterning(ISupportsInterning other) - { - return false; - } - } - #endif } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IType.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IType.cs index a6a4892f4c..2d010e22b9 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IType.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IType.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics.Contracts; namespace ICSharpCode.NRefactory.TypeSystem { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ITypeDefinition.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ITypeDefinition.cs index 1438505d8b..7cd98c8d23 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ITypeDefinition.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ITypeDefinition.cs @@ -130,5 +130,25 @@ namespace ICSharpCode.NRefactory.TypeSystem /// /// This property is used to speed up the search for extension methods. bool HasExtensionMethods { get; } + + /// + /// Determines how this type is implementing the specified interface member. + /// + /// + /// The method on this type that implements the interface member; + /// or null if the type does not implement the interface. + /// + IMember GetInterfaceImplementation(IMember interfaceMember); + + /// + /// Determines how this type is implementing the specified interface members. + /// + /// + /// For each interface member, this method returns the class member + /// that implements the interface member. + /// For interface members that are missing an implementation, the + /// result collection will contain a null element. + /// + IList GetInterfaceImplementation(IList interfaceMembers); } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ITypeReference.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ITypeReference.cs index efad8e983c..fc22826c37 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ITypeReference.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ITypeReference.cs @@ -17,8 +17,6 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; namespace ICSharpCode.NRefactory.TypeSystem { @@ -26,9 +24,6 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Represents a reference to a type. /// Must be resolved before it can be used as type. /// - #if WITH_CONTRACTS - [ContractClass(typeof(ITypeReferenceContract))] - #endif public interface ITypeReference { // Keep this interface simple: I decided against having GetMethods/GetEvents etc. here, @@ -81,17 +76,4 @@ namespace ICSharpCode.NRefactory.TypeSystem ITypeResolveContext WithCurrentTypeDefinition(ITypeDefinition typeDefinition); ITypeResolveContext WithCurrentMember(IMember member); } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(ITypeReference))] - abstract class ITypeReferenceContract : ITypeReference - { - IType ITypeReference.Resolve(ITypeResolveContext context) - { - Contract.Requires(context != null); - Contract.Ensures(Contract.Result() != null); - return null; - } - } - #endif } \ No newline at end of file diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IParsedFile.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IUnresolvedFile.cs similarity index 95% rename from src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IParsedFile.cs rename to src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IUnresolvedFile.cs index 0a9a04f83e..98dbaf96a3 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IParsedFile.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IUnresolvedFile.cs @@ -21,10 +21,13 @@ using System.Collections.Generic; namespace ICSharpCode.NRefactory.TypeSystem { + [Obsolete("IParsedFile was renamed to IUnresolvedFile", true)] + public interface IParsedFile {} + /// /// Represents a single file that was parsed. /// - public interface IParsedFile + public interface IUnresolvedFile { /// /// Returns the full path of the file. diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IVariable.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IVariable.cs index e185247707..9e4d45835e 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IVariable.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/IVariable.cs @@ -17,16 +17,12 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Diagnostics.Contracts; namespace ICSharpCode.NRefactory.TypeSystem { /// /// Represents a variable (name/type pair). /// - #if WITH_CONTRACTS - [ContractClass(typeof(IVariableContract))] - #endif public interface IVariable { /// @@ -55,36 +51,4 @@ namespace ICSharpCode.NRefactory.TypeSystem /// object ConstantValue { get; } } - - #if WITH_CONTRACTS - [ContractClassFor(typeof(IVariable))] - abstract class IVariableContract : IVariable - { - string IVariable.Name { - get { - Contract.Ensures(Contract.Result() != null); - return null; - } - } - - ITypeReference IVariable.Type { - get { - Contract.Ensures(Contract.Result() != null); - return null; - } - } - - bool IVariable.IsConst { - get { - IVariable @this = this; - Contract.Ensures(Contract.Result() == (@this.ConstantValue != null)); - return false; - } - } - - object IVariable.ConstantValue { - get { return null; } - } - } - #endif } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractFreezable.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractFreezable.cs index 97f33cc2e2..79f2bcf90c 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractFreezable.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractFreezable.cs @@ -87,14 +87,5 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation protected virtual void FreezeInternal() { } - - /* - protected static IList CopyList(IList inputList) - { - if (inputList == null || inputList.Count == 0) - return null; - else - return new List(inputList); - }*/ } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedMember.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedMember.cs index 0ff0b25a58..47ea6e407c 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedMember.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedMember.cs @@ -92,7 +92,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation public override DocumentationComment Documentation { get { - IUnresolvedDocumentationProvider docProvider = unresolved.ParsedFile as IUnresolvedDocumentationProvider; + IUnresolvedDocumentationProvider docProvider = unresolved.UnresolvedFile as IUnresolvedDocumentationProvider; if (docProvider != null) { var doc = docProvider.GetDocumentation(unresolved, this); if (doc != null) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractUnresolvedEntity.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractUnresolvedEntity.cs index 66d29b8c0c..da96ec4233 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractUnresolvedEntity.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractUnresolvedEntity.cs @@ -101,7 +101,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation { internal DomRegion region; internal DomRegion bodyRegion; - internal IParsedFile parsedFile; + internal IUnresolvedFile unresolvedFile; protected internal virtual void FreezeInternal() { @@ -148,11 +148,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation } } - public IParsedFile ParsedFile { - get { return rareFields != null ? rareFields.parsedFile : null; } + public IUnresolvedFile UnresolvedFile { + get { return rareFields != null ? rareFields.unresolvedFile : null; } set { if (value != null || rareFields != null) - WriteRareFields().parsedFile = value; + WriteRareFields().unresolvedFile = value; } } diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultAssemblyReference.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultAssemblyReference.cs index 8987e65bf2..eb4795cac5 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultAssemblyReference.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultAssemblyReference.cs @@ -33,7 +33,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation public DefaultAssemblyReference(string assemblyName) { - int pos = assemblyName.IndexOf(','); + int pos = assemblyName != null ? assemblyName.IndexOf(',') : -1; if (pos >= 0) shortName = assemblyName.Substring(0, pos); else diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultAttribute.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultAttribute.cs new file mode 100644 index 0000000000..79df0167a6 --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultAttribute.cs @@ -0,0 +1,97 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.Linq; +using ICSharpCode.NRefactory.Semantics; + +namespace ICSharpCode.NRefactory.TypeSystem.Implementation +{ + /// + /// IAttribute implementation for already-resolved attributes. + /// + public class DefaultAttribute : IAttribute + { + readonly IType attributeType; + readonly IList positionalArguments; + readonly IList> namedArguments; + readonly DomRegion region; + volatile IMethod constructor; + + public DefaultAttribute(IType attributeType, IList positionalArguments = null, + IList> namedArguments = null, + DomRegion region = default(DomRegion)) + { + if (attributeType == null) + throw new ArgumentNullException("attributeType"); + this.attributeType = attributeType; + this.positionalArguments = positionalArguments ?? EmptyList.Instance; + this.namedArguments = namedArguments ?? EmptyList>.Instance; + this.region = region; + } + + public DefaultAttribute(IMethod constructor, IList positionalArguments = null, + IList> namedArguments = null, + DomRegion region = default(DomRegion)) + { + if (constructor == null) + throw new ArgumentNullException("constructor"); + this.constructor = constructor; + this.attributeType = constructor.DeclaringType; + this.positionalArguments = positionalArguments ?? EmptyList.Instance; + this.namedArguments = namedArguments ?? EmptyList>.Instance; + this.region = region; + if (this.positionalArguments.Count != constructor.Parameters.Count) { + throw new ArgumentException("Positional argument count must match the constructor's parameter count"); + } + } + + public IType AttributeType { + get { return attributeType; } + } + + public DomRegion Region { + get { return region; } + } + + public IMethod Constructor { + get { + IMethod ctor = this.constructor; + if (ctor == null) { + foreach (IMethod candidate in this.AttributeType.GetConstructors(m => m.Parameters.Count == positionalArguments.Count)) { + if (candidate.Parameters.Select(p => p.Type).SequenceEqual(this.PositionalArguments.Select(a => a.Type))) { + ctor = candidate; + break; + } + } + this.constructor = ctor; + } + return ctor; + } + } + + public IList PositionalArguments { + get { return positionalArguments; } + } + + public IList> NamedArguments { + get { return namedArguments; } + } + } +} diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedTypeDefinition.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedTypeDefinition.cs index 4ea28dbe69..84580ae2ff 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedTypeDefinition.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedTypeDefinition.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Linq; using ICSharpCode.NRefactory.Documentation; using ICSharpCode.NRefactory.Utils; @@ -590,7 +589,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation public virtual DocumentationComment Documentation { get { foreach (var part in parts) { - var unresolvedProvider = part.ParsedFile as IUnresolvedDocumentationProvider; + var unresolvedProvider = part.UnresolvedFile as IUnresolvedDocumentationProvider; if (unresolvedProvider != null) { var doc = unresolvedProvider.GetDocumentation(part, this); if (doc != null) @@ -861,6 +860,46 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation } #endregion + #region GetInterfaceImplementation + public IMember GetInterfaceImplementation(IMember interfaceMember) + { + return GetInterfaceImplementation(new[] { interfaceMember })[0]; + } + + public IList GetInterfaceImplementation(IList interfaceMembers) + { + // TODO: review the subtle rules for interface reimplementation, + // write tests and fix this method. + // Also virtual/override is going to be tricky - + // I think we'll need to consider the 'virtual' method first for + // reimplemenatation purposes, but then actually return the 'override' + // (as that's the method that ends up getting called) + + interfaceMembers = interfaceMembers.ToList(); // avoid evaluating more than once + + var result = new IMember[interfaceMembers.Count]; + var signatureToIndexDict = new MultiDictionary(SignatureComparer.Ordinal); + for (int i = 0; i < interfaceMembers.Count; i++) { + signatureToIndexDict.Add(interfaceMembers[i], i); + } + foreach (var member in GetMembers(m => !m.IsExplicitInterfaceImplementation)) { + foreach (int interfaceMemberIndex in signatureToIndexDict[member]) { + result[interfaceMemberIndex] = member; + } + } + foreach (var explicitImpl in GetMembers(m => m.IsExplicitInterfaceImplementation)) { + foreach (var interfaceMember in explicitImpl.ImplementedInterfaceMembers) { + foreach (int potentialMatchingIndex in signatureToIndexDict[interfaceMember]) { + if (interfaceMember.Equals(interfaceMembers[potentialMatchingIndex])) { + result[potentialMatchingIndex] = explicitImpl; + } + } + } + } + return result; + } + #endregion + public bool Equals(IType other) { return this == other; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedEvent.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedEvent.cs index 64d940f9fe..6ffc9d7635 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedEvent.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedEvent.cs @@ -55,7 +55,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation this.DeclaringTypeDefinition = declaringType; this.Name = name; if (declaringType != null) - this.ParsedFile = declaringType.ParsedFile; + this.UnresolvedFile = declaringType.UnresolvedFile; } public bool CanAdd { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedField.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedField.cs index 850ffe3937..3e6406e27d 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedField.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedField.cs @@ -51,7 +51,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation this.DeclaringTypeDefinition = declaringType; this.Name = name; if (declaringType != null) - this.ParsedFile = declaringType.ParsedFile; + this.UnresolvedFile = declaringType.UnresolvedFile; } public bool IsConst { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedMethod.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedMethod.cs index 8b0e16d345..f10dd086ba 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedMethod.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedMethod.cs @@ -63,7 +63,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation this.DeclaringTypeDefinition = declaringType; this.Name = name; if (declaringType != null) - this.ParsedFile = declaringType.ParsedFile; + this.UnresolvedFile = declaringType.UnresolvedFile; } public IList ReturnTypeAttributes { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedProperty.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedProperty.cs index aa86d31145..998d462955 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedProperty.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedProperty.cs @@ -58,7 +58,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation this.DeclaringTypeDefinition = declaringType; this.Name = name; if (declaringType != null) - this.ParsedFile = declaringType.ParsedFile; + this.UnresolvedFile = declaringType.UnresolvedFile; } public bool IsIndexer { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedTypeDefinition.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedTypeDefinition.cs index d719372f6c..66658ea91e 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedTypeDefinition.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedTypeDefinition.cs @@ -72,7 +72,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation this.DeclaringTypeDefinition = declaringTypeDefinition; this.namespaceName = declaringTypeDefinition.Namespace; this.Name = name; - this.ParsedFile = declaringTypeDefinition.ParsedFile; + this.UnresolvedFile = declaringTypeDefinition.UnresolvedFile; } public TypeKind Kind { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/MinimalCorlib.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/MinimalCorlib.cs index a6c90a6e88..0c019b06ac 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/MinimalCorlib.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/MinimalCorlib.cs @@ -17,9 +17,6 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; namespace ICSharpCode.NRefactory.TypeSystem.Implementation { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleCompilation.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleCompilation.cs index 08c5eb6d8b..cfff5fae10 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleCompilation.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/SimpleCompilation.cs @@ -18,8 +18,6 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; using ICSharpCode.NRefactory.Utils; namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -95,7 +93,6 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation } } - [ObsoleteAttribute("Use compilation.Assemblies.Where(asm != compilation.MainAssembly) instead.")] public IList ReferencedAssemblies { get { if (referencedAssemblies == null) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs index ad84d1218a..e42af1af1f 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs @@ -151,6 +151,10 @@ namespace ICSharpCode.NRefactory.TypeSystem return typeArguments[index]; } + /// + /// Gets the definition of the generic type. + /// For ParameterizedType, this method never returns null. + /// public ITypeDefinition GetDefinition() { return genericType; diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ProjectReference.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ProjectReference.cs new file mode 100644 index 0000000000..928ec796de --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/ProjectReference.cs @@ -0,0 +1,56 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; + +namespace ICSharpCode.NRefactory.TypeSystem +{ + /// + /// References another project content in the same solution. + /// Using the class requires that you + /// + [Serializable] + public class ProjectReference : IAssemblyReference + { + readonly string projectFileName; + + /// + /// Creates a new reference to the specified project (must be part of the same solution). + /// + /// Full path to the file name. Must be identical to of the target project; do not use a relative path. + public ProjectReference(string projectFileName) + { + this.projectFileName = projectFileName; + } + + public IAssembly Resolve(ITypeResolveContext context) + { + var solution = context.Compilation.SolutionSnapshot; + var pc = solution.GetProjectContent(projectFileName); + if (pc != null) + return pc.Resolve(context); + else + return null; + } + + public override string ToString() + { + return string.Format("[ProjectReference {0}]", projectFileName); + } + } +} diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Utils/LazyInit.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Utils/LazyInit.cs index 94c08bbea4..467a8daa35 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Utils/LazyInit.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Utils/LazyInit.cs @@ -17,10 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Diagnostics; using System.Threading; -using ICSharpCode.NRefactory.TypeSystem; namespace ICSharpCode.NRefactory.Utils { diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory/Utils/MultiDictionary.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Utils/MultiDictionary.cs new file mode 100644 index 0000000000..496b66ba9e --- /dev/null +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory/Utils/MultiDictionary.cs @@ -0,0 +1,134 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ICSharpCode.NRefactory.Utils +{ + /// + /// A dictionary that allows multiple pairs with the same key. + /// + public class MultiDictionary : ILookup + { + readonly Dictionary> dict; + + public MultiDictionary() + { + dict = new Dictionary>(); + } + + public MultiDictionary(IEqualityComparer comparer) + { + dict = new Dictionary>(comparer); + } + + public void Add(TKey key, TValue value) + { + List valueList; + if (!dict.TryGetValue(key, out valueList)) { + valueList = new List(); + dict.Add(key, valueList); + } + valueList.Add(value); + } + + public bool Remove(TKey key, TValue value) + { + List valueList; + if (dict.TryGetValue(key, out valueList)) { + if (valueList.Remove(value)) { + if (valueList.Count == 0) + dict.Remove(key); + return true; + } + } + return false; + } + + public void Clear() + { + dict.Clear(); + } + + #if NET45 + public IReadOnlyList this[TKey key] { + #else + public IList this[TKey key] { + #endif + get { + List list; + if (dict.TryGetValue(key, out list)) + return list; + else + return EmptyList.Instance; + } + } + + public int Count { + get { return dict.Count; } + } + + IEnumerable ILookup.this[TKey key] { + get { return this[key]; } + } + + bool ILookup.Contains(TKey key) + { + return dict.ContainsKey(key); + } + + public IEnumerator> GetEnumerator() + { + foreach (var pair in dict) + yield return new Grouping(pair.Key, pair.Value); + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + sealed class Grouping : IGrouping + { + readonly TKey key; + readonly List values; + + public Grouping(TKey key, List values) + { + this.key = key; + this.values = values; + } + + public TKey Key { + get { return key; } + } + + public IEnumerator GetEnumerator() + { + return values.GetEnumerator(); + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return values.GetEnumerator(); + } + } + } +} diff --git a/src/Libraries/NRefactory/NRefactory.sln b/src/Libraries/NRefactory/NRefactory.sln index 94451e3646..cc76ba1a42 100644 --- a/src/Libraries/NRefactory/NRefactory.sln +++ b/src/Libraries/NRefactory/NRefactory.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -# SharpDevelop 4.2.0.8783 +# SharpDevelop 4.3 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DC98210E-1646-483B-819A-2BB8272461E4}" ProjectSection(SolutionItems) = preProject Packages\ICSharpCode.NRefactory.nuspec = Packages\ICSharpCode.NRefactory.nuspec @@ -34,6 +34,10 @@ Global Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|x86 = Release|x86 + net_4_5_Debug|Any CPU = net_4_5_Debug|Any CPU + net_4_5_Debug|x86 = net_4_5_Debug|x86 + net_4_5_Release|Any CPU = net_4_5_Release|Any CPU + net_4_5_Release|x86 = net_4_5_Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -108,6 +112,78 @@ Global {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D}.Release|Any CPU.ActiveCfg = Release|Any CPU {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D}.Release|x86.Build.0 = Release|x86 {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D}.Release|x86.ActiveCfg = Release|x86 + {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D}.net_4_5_Debug|Any CPU.Build.0 = net_4_5_Debug|Any CPU + {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D}.net_4_5_Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU + {961DADFA-7CE6-429F-BC22-47630D6DB826}.net_4_5_Debug|Any CPU.Build.0 = net_4_5_Debug|Any CPU + {961DADFA-7CE6-429F-BC22-47630D6DB826}.net_4_5_Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.net_4_5_Debug|Any CPU.Build.0 = net_4_5_Debug|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.net_4_5_Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU + {D81206EF-3DCA-4A30-897B-E262A2AD9EE3}.net_4_5_Debug|Any CPU.Build.0 = net_4_5_Debug|Any CPU + {D81206EF-3DCA-4A30-897B-E262A2AD9EE3}.net_4_5_Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU + {A7EEF7F8-238F-459D-95A9-96467539641D}.net_4_5_Debug|Any CPU.Build.0 = net_4_5_Debug|Any CPU + {A7EEF7F8-238F-459D-95A9-96467539641D}.net_4_5_Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.net_4_5_Debug|Any CPU.Build.0 = net_4_5_Debug|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.net_4_5_Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU + {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_5_Debug|Any CPU.Build.0 = winphone_Release|Any CPU + {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_5_Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU + {63D3B27A-D966-4902-90B3-30290E1692F1}.net_4_5_Debug|Any CPU.Build.0 = net_4_5_Debug|Any CPU + {63D3B27A-D966-4902-90B3-30290E1692F1}.net_4_5_Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.net_4_5_Debug|Any CPU.Build.0 = net_4_5_Debug|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.net_4_5_Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU + {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D}.net_4_5_Debug|x86.Build.0 = net_4_5_Debug|x86 + {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D}.net_4_5_Debug|x86.ActiveCfg = net_4_5_Debug|x86 + {961DADFA-7CE6-429F-BC22-47630D6DB826}.net_4_5_Debug|x86.Build.0 = net_4_5_Debug|Any CPU + {961DADFA-7CE6-429F-BC22-47630D6DB826}.net_4_5_Debug|x86.ActiveCfg = net_4_5_Debug|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.net_4_5_Debug|x86.Build.0 = net_4_5_Debug|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.net_4_5_Debug|x86.ActiveCfg = net_4_5_Debug|Any CPU + {D81206EF-3DCA-4A30-897B-E262A2AD9EE3}.net_4_5_Debug|x86.Build.0 = net_4_5_Debug|x86 + {D81206EF-3DCA-4A30-897B-E262A2AD9EE3}.net_4_5_Debug|x86.ActiveCfg = net_4_5_Debug|x86 + {A7EEF7F8-238F-459D-95A9-96467539641D}.net_4_5_Debug|x86.Build.0 = net_4_5_Debug|Any CPU + {A7EEF7F8-238F-459D-95A9-96467539641D}.net_4_5_Debug|x86.ActiveCfg = net_4_5_Debug|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.net_4_5_Debug|x86.Build.0 = net_4_5_Debug|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.net_4_5_Debug|x86.ActiveCfg = net_4_5_Debug|Any CPU + {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_5_Debug|x86.Build.0 = winphone_Release|Any CPU + {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_5_Debug|x86.ActiveCfg = net_4_0_Debug|Any CPU + {63D3B27A-D966-4902-90B3-30290E1692F1}.net_4_5_Debug|x86.Build.0 = net_4_5_Debug|x86 + {63D3B27A-D966-4902-90B3-30290E1692F1}.net_4_5_Debug|x86.ActiveCfg = net_4_5_Debug|x86 + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.net_4_5_Debug|x86.Build.0 = net_4_5_Debug|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.net_4_5_Debug|x86.ActiveCfg = net_4_5_Debug|Any CPU + {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D}.net_4_5_Release|Any CPU.Build.0 = net_4_5_Release|Any CPU + {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D}.net_4_5_Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU + {961DADFA-7CE6-429F-BC22-47630D6DB826}.net_4_5_Release|Any CPU.Build.0 = net_4_5_Release|Any CPU + {961DADFA-7CE6-429F-BC22-47630D6DB826}.net_4_5_Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.net_4_5_Release|Any CPU.Build.0 = net_4_5_Release|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.net_4_5_Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU + {D81206EF-3DCA-4A30-897B-E262A2AD9EE3}.net_4_5_Release|Any CPU.Build.0 = net_4_5_Release|Any CPU + {D81206EF-3DCA-4A30-897B-E262A2AD9EE3}.net_4_5_Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU + {A7EEF7F8-238F-459D-95A9-96467539641D}.net_4_5_Release|Any CPU.Build.0 = net_4_5_Release|Any CPU + {A7EEF7F8-238F-459D-95A9-96467539641D}.net_4_5_Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.net_4_5_Release|Any CPU.Build.0 = net_4_5_Release|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.net_4_5_Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU + {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_5_Release|Any CPU.Build.0 = winphone_Release|Any CPU + {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_5_Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU + {63D3B27A-D966-4902-90B3-30290E1692F1}.net_4_5_Release|Any CPU.Build.0 = net_4_5_Release|Any CPU + {63D3B27A-D966-4902-90B3-30290E1692F1}.net_4_5_Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.net_4_5_Release|Any CPU.Build.0 = net_4_5_Release|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.net_4_5_Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU + {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D}.net_4_5_Release|x86.Build.0 = net_4_5_Release|x86 + {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D}.net_4_5_Release|x86.ActiveCfg = net_4_5_Release|x86 + {961DADFA-7CE6-429F-BC22-47630D6DB826}.net_4_5_Release|x86.Build.0 = net_4_5_Release|Any CPU + {961DADFA-7CE6-429F-BC22-47630D6DB826}.net_4_5_Release|x86.ActiveCfg = net_4_5_Release|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.net_4_5_Release|x86.Build.0 = net_4_5_Release|Any CPU + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}.net_4_5_Release|x86.ActiveCfg = net_4_5_Release|Any CPU + {D81206EF-3DCA-4A30-897B-E262A2AD9EE3}.net_4_5_Release|x86.Build.0 = net_4_5_Release|x86 + {D81206EF-3DCA-4A30-897B-E262A2AD9EE3}.net_4_5_Release|x86.ActiveCfg = net_4_5_Release|x86 + {A7EEF7F8-238F-459D-95A9-96467539641D}.net_4_5_Release|x86.Build.0 = net_4_5_Release|Any CPU + {A7EEF7F8-238F-459D-95A9-96467539641D}.net_4_5_Release|x86.ActiveCfg = net_4_5_Release|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.net_4_5_Release|x86.Build.0 = net_4_5_Release|Any CPU + {53DCA265-3C3C-42F9-B647-F72BA678122B}.net_4_5_Release|x86.ActiveCfg = net_4_5_Release|Any CPU + {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_5_Release|x86.Build.0 = winphone_Release|Any CPU + {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_5_Release|x86.ActiveCfg = net_4_0_Release|Any CPU + {63D3B27A-D966-4902-90B3-30290E1692F1}.net_4_5_Release|x86.Build.0 = net_4_5_Release|x86 + {63D3B27A-D966-4902-90B3-30290E1692F1}.net_4_5_Release|x86.ActiveCfg = net_4_5_Release|x86 + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.net_4_5_Release|x86.Build.0 = net_4_5_Release|Any CPU + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.net_4_5_Release|x86.ActiveCfg = net_4_5_Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Libraries/NRefactory/doc/XML Documentation.html b/src/Libraries/NRefactory/doc/XML Documentation.html index c3cae8ba0c..889866ff76 100644 --- a/src/Libraries/NRefactory/doc/XML Documentation.html +++ b/src/Libraries/NRefactory/doc/XML Documentation.html @@ -20,7 +20,7 @@ property is accessed.
For this purpose, the type system casts the parsed file to IUnresolvedDocumentationProvider and tries to get the documentation. - This way, the CSharpParsedFile can provide the documentation from the XML comments.
+ This way, the CSharpUnresolvedFile can provide the documentation from the XML comments.
If this fails, the type system casts the unresolved assembly/project content to IDocumentationProvider. This is the way the request for documentation gets to the CecilLoader, which in turn forwards it to the user-provided IDocumentationProvider. diff --git a/src/Main/Base/Project/Src/Commands/VBConverter/CSharpConvertBuffer.cs b/src/Main/Base/Project/Src/Commands/VBConverter/CSharpConvertBuffer.cs index 5cddefac17..9c7c278b8c 100644 --- a/src/Main/Base/Project/Src/Commands/VBConverter/CSharpConvertBuffer.cs +++ b/src/Main/Base/Project/Src/Commands/VBConverter/CSharpConvertBuffer.cs @@ -35,9 +35,9 @@ namespace ICSharpCode.SharpDevelop.Commands PreprocessingDirective.VBToCSharp(specials); IAstVisitor v = new VBNetToCSharpConvertVisitor(ParserService.CurrentProjectContent, ParserService.GetParseInformation(content.PrimaryFileName)); - v.VisitCompilationUnit(p.CompilationUnit, null); + v.VisitSyntaxTree(p.SyntaxTree, null); using (SpecialNodesInserter.Install(specials, output)) { - output.VisitCompilationUnit(p.CompilationUnit, null); + output.VisitSyntaxTree(p.SyntaxTree, null); } FileService.NewFile("Generated.cs", output.Text); diff --git a/src/Main/Base/Project/Src/Commands/VBConverter/ConvertBuffer.cs b/src/Main/Base/Project/Src/Commands/VBConverter/ConvertBuffer.cs index 214b32dfd2..f0cb45badd 100644 --- a/src/Main/Base/Project/Src/Commands/VBConverter/ConvertBuffer.cs +++ b/src/Main/Base/Project/Src/Commands/VBConverter/ConvertBuffer.cs @@ -35,9 +35,9 @@ namespace ICSharpCode.SharpDevelop.Commands PreprocessingDirective.CSharpToVB(specials); IAstVisitor v = new CSharpToVBNetConvertVisitor(ParserService.CurrentProjectContent, ParserService.GetParseInformation(content.PrimaryFileName)); - v.VisitCompilationUnit(p.CompilationUnit, null); + v.VisitSyntaxTree(p.SyntaxTree, null); using (SpecialNodesInserter.Install(specials, vbv)) { - vbv.VisitCompilationUnit(p.CompilationUnit, null); + vbv.VisitSyntaxTree(p.SyntaxTree, null); } FileService.NewFile("Generated.vb", vbv.Text); diff --git a/src/Main/Base/Project/Src/Editor/CodeCompletion/CodeCompletionItemProvider.cs b/src/Main/Base/Project/Src/Editor/CodeCompletion/CodeCompletionItemProvider.cs index 64f6c1e2e7..e7428682f5 100644 --- a/src/Main/Base/Project/Src/Editor/CodeCompletion/CodeCompletionItemProvider.cs +++ b/src/Main/Base/Project/Src/Editor/CodeCompletion/CodeCompletionItemProvider.cs @@ -292,7 +292,7 @@ namespace ICSharpCode.SharpDevelop.Editor.CodeCompletion context.EndOffset = context.StartOffset + insertedText.Length; if (addUsing && nameResult != null && nameResult.CallingClass != null) { - var cu = nameResult.CallingClass.CompilationUnit; + var cu = nameResult.CallingClass.SyntaxTree; NamespaceRefactoringService.AddUsingDeclaration(cu, document, selectedClass.Namespace, false); ParserService.BeginParse(editor.FileName, document); } diff --git a/src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightProvider.cs b/src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightProvider.cs index 05aa1be826..1b71e5acaf 100644 --- a/src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightProvider.cs +++ b/src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightProvider.cs @@ -72,7 +72,7 @@ namespace ICSharpCode.SharpDevelop.Editor.CodeCompletion LanguageProperties language; if (result.CallingClass != null) - language = result.CallingClass.CompilationUnit.Language; + language = result.CallingClass.SyntaxTree.Language; else language = ParserService.CurrentProjectContent.Language; diff --git a/src/Main/Base/Project/Src/Editor/CodeCompletion/OverrideCompletionItemProvider.cs b/src/Main/Base/Project/Src/Editor/CodeCompletion/OverrideCompletionItemProvider.cs index 59a03d0c37..1e82e48b88 100644 --- a/src/Main/Base/Project/Src/Editor/CodeCompletion/OverrideCompletionItemProvider.cs +++ b/src/Main/Base/Project/Src/Editor/CodeCompletion/OverrideCompletionItemProvider.cs @@ -43,7 +43,7 @@ namespace ICSharpCode.SharpDevelop.Editor.CodeCompletion { ParseInformation parseInfo = ParserService.GetParseInformation(editor.FileName); if (parseInfo == null) return null; - IClass c = parseInfo.CompilationUnit.GetInnermostClass(editor.Caret.Line, editor.Caret.Column); + IClass c = parseInfo.SyntaxTree.GetInnermostClass(editor.Caret.Line, editor.Caret.Column); if (c == null) return null; LanguageProperties language = c.ProjectContent.Language; OverrideCompletionItemList result = new OverrideCompletionItemList(); diff --git a/src/Main/Base/Project/Src/Editor/Commands/ClassBookmarkSubmenuBuilder.cs b/src/Main/Base/Project/Src/Editor/Commands/ClassBookmarkSubmenuBuilder.cs index b2a859ead3..3dc7944f25 100644 --- a/src/Main/Base/Project/Src/Editor/Commands/ClassBookmarkSubmenuBuilder.cs +++ b/src/Main/Base/Project/Src/Editor/Commands/ClassBookmarkSubmenuBuilder.cs @@ -109,7 +109,7 @@ namespace ICSharpCode.SharpDevelop.Editor.Commands // IClass c = (IClass)item.Tag; // IClass baseClass = c.BaseClass; // if (baseClass != null) { -// string fileName = baseClass.CompilationUnit.FileName; +// string fileName = baseClass.SyntaxTree.FileName; // if (fileName != null) { // FileService.JumpToFilePosition(fileName, baseClass.Region.BeginLine, baseClass.Region.BeginColumn); // } @@ -153,7 +153,7 @@ namespace ICSharpCode.SharpDevelop.Editor.Commands if (!string.IsNullOrEmpty(fileName)) { // get the part with the requested file name foreach (IClass part in parts) { - if (FileUtility.IsEqualFileName(fileName, part.CompilationUnit.FileName)) + if (FileUtility.IsEqualFileName(fileName, part.SyntaxTree.FileName)) return part; } } @@ -162,7 +162,7 @@ namespace ICSharpCode.SharpDevelop.Editor.Commands // This should prefer non-designer files over designer files. IClass preferredClass = parts[0]; for (int i = 1; i < parts.Count; i++) { - if (IsShorterFileName(parts[i].CompilationUnit.FileName, preferredClass.CompilationUnit.FileName)) + if (IsShorterFileName(parts[i].SyntaxTree.FileName, preferredClass.SyntaxTree.FileName)) preferredClass = parts[i]; } return preferredClass; diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/GotoDialog.cs b/src/Main/Base/Project/Src/Gui/Dialogs/GotoDialog.cs index 4f7e2811f9..c5a2290c0d 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/GotoDialog.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/GotoDialog.cs @@ -172,7 +172,7 @@ namespace ICSharpCode.SharpDevelop.Gui { ITextEditor editor = GetEditor(); if (editor != null) { - IParsedFile parseInfo = SD.ParserService.GetExistingParsedFile(editor.FileName); + IUnresolvedFile parseInfo = SD.ParserService.GetExistingUnresolvedFile(editor.FileName); if (parseInfo != null) { foreach (IUnresolvedTypeDefinition c in parseInfo.TopLevelTypeDefinitions) { AddAllMembersMatchingText(c, text, true); diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs index c636588e0a..7a8a761553 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs @@ -368,7 +368,7 @@ namespace ICSharpCode.SharpDevelop.Gui public void SaveFile(FileDescriptionTemplate newfile, string content, string binaryFileName) { - string parsedFileName = StringParser.Parse(newfile.Name); + string unresolvedFileName = StringParser.Parse(newfile.Name); // Parse twice so that tags used in included standard header are parsed string parsedContent = StringParser.Parse(StringParser.Parse(content)); @@ -382,33 +382,33 @@ namespace ICSharpCode.SharpDevelop.Gui // when newFile.Name is "${Path}/${FileName}", there might be a useless '/' in front of the file name // if the file is created when no project is opened. So we remove single '/' or '\', but not double // '\\' (project is saved on network share). - if (parsedFileName.StartsWith("/") && !parsedFileName.StartsWith("//") - || parsedFileName.StartsWith("\\") && !parsedFileName.StartsWith("\\\\")) + if (unresolvedFileName.StartsWith("/") && !unresolvedFileName.StartsWith("//") + || unresolvedFileName.StartsWith("\\") && !unresolvedFileName.StartsWith("\\\\")) { - parsedFileName = parsedFileName.Substring(1); + unresolvedFileName = unresolvedFileName.Substring(1); } - if (newfile.IsDependentFile && Path.IsPathRooted(parsedFileName)) { - Directory.CreateDirectory(Path.GetDirectoryName(parsedFileName)); + if (newfile.IsDependentFile && Path.IsPathRooted(unresolvedFileName)) { + Directory.CreateDirectory(Path.GetDirectoryName(unresolvedFileName)); if (!String.IsNullOrEmpty(binaryFileName)) - File.Copy(binaryFileName, parsedFileName); + File.Copy(binaryFileName, unresolvedFileName); else - File.WriteAllText(parsedFileName, parsedContent, SD.FileService.DefaultFileEncoding); + File.WriteAllText(unresolvedFileName, parsedContent, SD.FileService.DefaultFileEncoding); } else { if (!String.IsNullOrEmpty(binaryFileName)) { LoggingService.Warn("binary file was skipped"); return; } - IViewContent viewContent = FileService.NewFile(Path.GetFileName(parsedFileName), parsedContent); + IViewContent viewContent = FileService.NewFile(Path.GetFileName(unresolvedFileName), parsedContent); if (viewContent == null) { return; } - if (Path.IsPathRooted(parsedFileName)) { - Directory.CreateDirectory(Path.GetDirectoryName(parsedFileName)); - viewContent.PrimaryFile.SaveToDisk(parsedFileName); + if (Path.IsPathRooted(unresolvedFileName)) { + Directory.CreateDirectory(Path.GetDirectoryName(unresolvedFileName)); + viewContent.PrimaryFile.SaveToDisk(unresolvedFileName); } } - createdFiles.Add(new KeyValuePair(parsedFileName, newfile)); + createdFiles.Add(new KeyValuePair(unresolvedFileName, newfile)); } internal static string GenerateValidClassOrNamespaceName(string className, bool allowDot) diff --git a/src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskListPad.cs b/src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskListPad.cs index 8c66d2bfd7..d39819bb73 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskListPad.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskListPad.cs @@ -219,7 +219,7 @@ namespace ICSharpCode.SharpDevelop.Gui if (WorkbenchSingleton.Workbench.ActiveViewContent == null) return null; - IParsedFile parseInfo = SD.ParserService.GetExistingParsedFile(WorkbenchSingleton.Workbench.ActiveViewContent.PrimaryFileName); + IUnresolvedFile parseInfo = SD.ParserService.GetExistingUnresolvedFile(WorkbenchSingleton.Workbench.ActiveViewContent.PrimaryFileName); if (parseInfo != null) { IPositionable positionable = WorkbenchSingleton.Workbench.ActiveViewContent as IPositionable; if (positionable != null) { @@ -236,7 +236,7 @@ namespace ICSharpCode.SharpDevelop.Gui // Tasks are created by parsing, so the parse information for item.FileName should already be present. // If they aren't, that's because the file might have been deleted/renamed in the meantime. // We use GetExistingParseInformation to avoid trying to parse a file that might have been deleted/renamed. - IParsedFile parseInfo = SD.ParserService.GetExistingParsedFile(item.FileName); + IUnresolvedFile parseInfo = SD.ParserService.GetExistingUnresolvedFile(item.FileName); if (parseInfo != null) { var c = parseInfo.GetInnermostTypeDefinition(item.Line, item.Column); if (c != null) return c; diff --git a/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectTemplate.cs b/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectTemplate.cs index 8423d7e1c5..3e3af21843 100644 --- a/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectTemplate.cs +++ b/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectTemplate.cs @@ -244,8 +244,8 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates if (el.HasAttribute("filename")) { string fileName = el.GetAttribute("filename"); return projectCreateInformation => { - string parsedFileName = StringParser.Parse(fileName, new StringTagPair("ProjectName", projectCreateInformation.ProjectName)); - string path = Path.Combine(projectCreateInformation.ProjectBasePath, parsedFileName); + string unresolvedFileName = StringParser.Parse(fileName, new StringTagPair("ProjectName", projectCreateInformation.ProjectName)); + string path = Path.Combine(projectCreateInformation.ProjectBasePath, unresolvedFileName); FileService.OpenFile(path); }; } else { diff --git a/src/Main/Base/Project/Src/Project/CompilableProject.cs b/src/Main/Base/Project/Src/Project/CompilableProject.cs index 0b24daf567..4e98666fef 100644 --- a/src/Main/Base/Project/Src/Project/CompilableProject.cs +++ b/src/Main/Base/Project/Src/Project/CompilableProject.cs @@ -372,7 +372,7 @@ namespace ICSharpCode.SharpDevelop.Project { var c = parseProjectContentContainer; if (c != null) - c.ParseInformationUpdated(args.OldParsedFile, args.NewParsedFile); + c.ParseInformationUpdated(args.OldUnresolvedFile, args.NewUnresolvedFile); // OnParseInformationUpdated is called inside a lock, but we don't want to raise the event inside that lock. // To ensure events are raised in the same order, we always invoke on the main thread. SD.MainThread.InvokeAsync( diff --git a/src/Main/Base/Project/Src/Project/Converter/LanguageConverter.cs b/src/Main/Base/Project/Src/Project/Converter/LanguageConverter.cs index c71729ec27..bf1fdd7390 100644 --- a/src/Main/Base/Project/Src/Project/Converter/LanguageConverter.cs +++ b/src/Main/Base/Project/Src/Project/Converter/LanguageConverter.cs @@ -213,7 +213,7 @@ namespace ICSharpCode.SharpDevelop.Project.Converter /* public abstract class NRefactoryLanguageConverter : LanguageConverter { - protected abstract void ConvertAst(CompilationUnit compilationUnit, List specials, + protected abstract void ConvertAst(SyntaxTree compilationUnit, List specials, FileProjectItem sourceItem); protected void ConvertFile(FileProjectItem sourceItem, FileProjectItem targetItem, @@ -238,10 +238,10 @@ namespace ICSharpCode.SharpDevelop.Project.Converter List specials = p.Lexer.SpecialTracker.CurrentSpecials; - ConvertAst(p.CompilationUnit, specials, sourceItem); + ConvertAst(p.SyntaxTree, specials, sourceItem); using (SpecialNodesInserter.Install(specials, outputVisitor)) { - outputVisitor.VisitCompilationUnit(p.CompilationUnit, null); + outputVisitor.VisitSyntaxTree(p.SyntaxTree, null); } p.Dispose(); diff --git a/src/Main/Base/Project/Src/Services/ParserService/IParser.cs b/src/Main/Base/Project/Src/Services/ParserService/IParser.cs index 0a91153363..6f3c7d1478 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/IParser.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/IParser.cs @@ -17,7 +17,7 @@ namespace ICSharpCode.SharpDevelop.Parser { /// /// Represents a language parser that produces ParseInformation - /// and IParsedFile instances for code files. + /// and IUnresolvedFile instances for code files. /// public interface IParser { @@ -41,7 +41,7 @@ namespace ICSharpCode.SharpDevelop.Parser /// The content of the file. /// /// Specifies whether full parse information were requested for this file. - /// If this parameter is false, only the ParsedFile and TagComments on the parse information need to be set. + /// If this parameter is false, only the UnresolvedFile and TagComments on the parse information need to be set. /// /// The parent project for this parse run. /// Cancellation Token. @@ -69,6 +69,6 @@ namespace ICSharpCode.SharpDevelop.Parser /// Used by . /// May return null if this operation is not supported. ///
- ICompilation CreateCompilationForSingleFile(FileName fileName, IParsedFile parsedFile); + ICompilation CreateCompilationForSingleFile(FileName fileName, IUnresolvedFile unresolvedFile); } } diff --git a/src/Main/Base/Project/Src/Services/ParserService/IParserService.cs b/src/Main/Base/Project/Src/Services/ParserService/IParserService.cs index 9eb9792413..7257389ffc 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/IParserService.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/IParserService.cs @@ -72,7 +72,7 @@ namespace ICSharpCode.SharpDevelop.Parser void InvalidateCurrentSolutionSnapshot(); #endregion - #region GetExistingParsedFile + #region GetExistingUnresolvedFile /// /// Gets the unresolved type system for the specified file. /// @@ -88,11 +88,11 @@ namespace ICSharpCode.SharpDevelop.Parser /// can cause the file to be parsed differently). /// /// - /// Returns the IParsedFile for the specified file, + /// Returns the IUnresolvedFile for the specified file, /// or null if the file has not been parsed yet. /// /// This method is thread-safe. - IParsedFile GetExistingParsedFile(FileName fileName, ITextSourceVersion version = null, IProject parentProject = null); + IUnresolvedFile GetExistingUnresolvedFile(FileName fileName, ITextSourceVersion version = null, IProject parentProject = null); /// /// Gets full parse information for the specified file, if it is available. @@ -109,7 +109,7 @@ namespace ICSharpCode.SharpDevelop.Parser /// can cause the file to be parsed differently). /// /// - /// If only the IParsedFile is available (non-full parse information), this method returns null. + /// If only the IUnresolvedFile is available (non-full parse information), this method returns null. /// ParseInformation GetCachedParseInformation(FileName fileName, ITextSourceVersion version = null, IProject parentProject = null); #endregion @@ -159,12 +159,12 @@ namespace ICSharpCode.SharpDevelop.Parser /// can cause the file to be parsed differently). /// /// - /// Returns the IParsedFile for the specified file, or null if the file cannot be parsed. + /// Returns the IUnresolvedFile for the specified file, or null if the file cannot be parsed. /// For files currently open in an editor, this method does not necessarily reparse, but may return - /// the existing IParsedFile (but only if it's still up-to-date). + /// the existing IUnresolvedFile (but only if it's still up-to-date). /// /// - IParsedFile ParseFile(FileName fileName, ITextSource fileContent = null, IProject parentProject = null, + IUnresolvedFile ParseFile(FileName fileName, ITextSource fileContent = null, IProject parentProject = null, CancellationToken cancellationToken = default(CancellationToken)); /// @@ -209,7 +209,7 @@ namespace ICSharpCode.SharpDevelop.Parser /// /// /// - Task ParseFileAsync(FileName fileName, ITextSource fileContent = null, IProject parentProject = null, + Task ParseFileAsync(FileName fileName, ITextSource fileContent = null, IProject parentProject = null, CancellationToken cancellationToken = default(CancellationToken)); #endregion @@ -264,8 +264,8 @@ namespace ICSharpCode.SharpDevelop.Parser /// /// Removes a project from the owners of the file. - /// This method invokes project.UpdateParseInformation(existingParsedFile, null);. - /// (unless existingParsedFile==null) + /// This method invokes project.UpdateParseInformation(existingUnresolvedFile, null);. + /// (unless existingUnresolvedFile==null) /// void RemoveOwnerProject(FileName fileName, IProject project); @@ -280,7 +280,7 @@ namespace ICSharpCode.SharpDevelop.Parser /// The file must belong to the specified project, otherwise this method does nothing. /// /// This method is intended for restoring parse information cached on disk. - void RegisterParsedFile(FileName fileName, IProject project, IParsedFile parsedFile); + void RegisterUnresolvedFile(FileName fileName, IProject project, IUnresolvedFile unresolvedFile); } public interface ILoadSolutionProjectsThread diff --git a/src/Main/Base/Project/Src/Services/ParserService/ParseInformation.cs b/src/Main/Base/Project/Src/Services/ParserService/ParseInformation.cs index 123b6ae675..ef937a26fe 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/ParseInformation.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/ParseInformation.cs @@ -11,39 +11,39 @@ namespace ICSharpCode.SharpDevelop.Parser { /// /// Represents the result of a parser operation. - /// Note: the parser service only stores the IParsedFile, not any of the extra information. + /// Note: the parser service only stores the IUnresolvedFile, not any of the extra information. /// The extra information is only provided to listeners of the ParseInformationUpdated event. /// Those listeners may then decide to store the extra information (e.g. the TaskService stores TagComments). /// public class ParseInformation { - readonly IParsedFile parsedFile; + readonly IUnresolvedFile unresolvedFile; IList tagComments = new List(); readonly bool isFullParseInformation; - public ParseInformation(IParsedFile parsedFile, bool isFullParseInformation) + public ParseInformation(IUnresolvedFile unresolvedFile, bool isFullParseInformation) { - if (parsedFile == null) - throw new ArgumentNullException("parsedFile"); - this.parsedFile = parsedFile; + if (unresolvedFile == null) + throw new ArgumentNullException("unresolvedFile"); + this.unresolvedFile = unresolvedFile; this.isFullParseInformation = isFullParseInformation; } /// /// Gets whether this parse information contains 'extra' data. /// True = extra data is provided (e.g. folding information). - /// False = Only ParsedFile and TagComments are provided. + /// False = Only UnresolvedFile and TagComments are provided. /// public bool IsFullParseInformation { get { return isFullParseInformation; } } - public IParsedFile ParsedFile { - get { return parsedFile; } + public IUnresolvedFile UnresolvedFile { + get { return unresolvedFile; } } public FileName FileName { - get { return FileName.Create(parsedFile.FileName); } + get { return FileName.Create(unresolvedFile.FileName); } } public IList TagComments { diff --git a/src/Main/Base/Project/Src/Services/ParserService/ParseInformationEventArgs.cs b/src/Main/Base/Project/Src/Services/ParserService/ParseInformationEventArgs.cs index d77b5df8ec..e16b300429 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/ParseInformationEventArgs.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/ParseInformationEventArgs.cs @@ -13,7 +13,7 @@ namespace ICSharpCode.SharpDevelop.Parser public class ParseInformationEventArgs : EventArgs { IProject parentProject; - IParsedFile oldParsedFile; + IUnresolvedFile oldUnresolvedFile; ParseInformation newParseInformation; public FileName FileName { @@ -21,7 +21,7 @@ namespace ICSharpCode.SharpDevelop.Parser if (newParseInformation != null) return newParseInformation.FileName; else - return FileName.Create(oldParsedFile.FileName); + return FileName.Create(oldUnresolvedFile.FileName); } } @@ -37,16 +37,16 @@ namespace ICSharpCode.SharpDevelop.Parser /// The old parsed file. /// Returns null if no old parse information exists (first parse run). /// - public IParsedFile OldParsedFile { - get { return oldParsedFile; } + public IUnresolvedFile OldUnresolvedFile { + get { return oldUnresolvedFile; } } /// /// The new parsed file. /// Returns null if no new parse information exists (file was removed from project). /// - public IParsedFile NewParsedFile { - get { return newParseInformation != null ? newParseInformation.ParsedFile : null; } + public IUnresolvedFile NewUnresolvedFile { + get { return newParseInformation != null ? newParseInformation.UnresolvedFile : null; } } /// @@ -58,24 +58,24 @@ namespace ICSharpCode.SharpDevelop.Parser } [Obsolete] - public IParsedFile OldCompilationUnit { - get { return this.OldParsedFile; } + public IUnresolvedFile OldSyntaxTree { + get { return this.OldUnresolvedFile; } } [Obsolete] - public IParsedFile NewCompilationUnit { - get { return this.NewParsedFile; } + public IUnresolvedFile NewSyntaxTree { + get { return this.NewUnresolvedFile; } } - public ParseInformationEventArgs(IProject parentProject, IParsedFile oldParsedFile, ParseInformation newParseInformation) + public ParseInformationEventArgs(IProject parentProject, IUnresolvedFile oldUnresolvedFile, ParseInformation newParseInformation) { - if (oldParsedFile == null && newParseInformation == null) + if (oldUnresolvedFile == null && newParseInformation == null) throw new ArgumentNullException(); - if (oldParsedFile != null && newParseInformation != null) { - Debug.Assert(FileUtility.IsEqualFileName(oldParsedFile.FileName, newParseInformation.FileName)); + if (oldUnresolvedFile != null && newParseInformation != null) { + Debug.Assert(FileUtility.IsEqualFileName(oldUnresolvedFile.FileName, newParseInformation.FileName)); } this.parentProject = parentProject; - this.oldParsedFile = oldParsedFile; + this.oldUnresolvedFile = oldUnresolvedFile; this.newParseInformation = newParseInformation; } } @@ -117,9 +117,9 @@ namespace ICSharpCode.SharpDevelop.Parser } } - public IParsedFile ParsedFile { + public IUnresolvedFile UnresolvedFile { get { - return parseInformation.ParsedFile; + return parseInformation.UnresolvedFile; } } } diff --git a/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs b/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs index 10079d074c..1fa30a4636 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs @@ -87,8 +87,8 @@ namespace ICSharpCode.SharpDevelop.Parser pc = this.projectContent; serializeOnDispose = !this.serializedProjectContentIsUpToDate; } - foreach (var parsedFile in pc.Files) { - SD.ParserService.RemoveOwnerProject(FileName.Create(parsedFile.FileName), project); + foreach (var unresolvedFile in pc.Files) { + SD.ParserService.RemoveOwnerProject(FileName.Create(unresolvedFile.FileName), project); } if (serializeOnDispose) SerializeAsync(cacheFileName, pc).FireAndForget(); @@ -105,16 +105,16 @@ namespace ICSharpCode.SharpDevelop.Parser delegate { pc = pc.RemoveAssemblyReferences(pc.AssemblyReferences); int serializableFileCount = 0; - List nonSerializableParsedFiles = new List(); - foreach (var parsedFile in pc.Files) { - if (IsSerializable(parsedFile)) + List nonSerializableUnresolvedFiles = new List(); + foreach (var unresolvedFile in pc.Files) { + if (IsSerializable(unresolvedFile)) serializableFileCount++; else - nonSerializableParsedFiles.Add(parsedFile); + nonSerializableUnresolvedFiles.Add(unresolvedFile); } // remove non-serializable parsed files - if (nonSerializableParsedFiles.Count > 0) - pc = pc.UpdateProjectContent(nonSerializableParsedFiles, null); + if (nonSerializableUnresolvedFiles.Count > 0) + pc = pc.UpdateProjectContent(nonSerializableUnresolvedFiles, null); if (serializableFileCount > 3) { LoggingService.Debug("Serializing " + serializableFileCount + " files to " + cacheFileName); SaveToCache(cacheFileName, pc); @@ -124,9 +124,9 @@ namespace ICSharpCode.SharpDevelop.Parser }); } - static bool IsSerializable(IParsedFile parsedFile) + static bool IsSerializable(IUnresolvedFile unresolvedFile) { - return parsedFile != null && parsedFile.GetType().IsSerializable && parsedFile.LastWriteTime != default(DateTime); + return unresolvedFile != null && unresolvedFile.GetType().IsSerializable && unresolvedFile.LastWriteTime != default(DateTime); } static string GetCacheFileName(FileName projectFileName) @@ -211,7 +211,7 @@ namespace ICSharpCode.SharpDevelop.Parser } } - public void ParseInformationUpdated(IParsedFile oldFile, IParsedFile newFile) + public void ParseInformationUpdated(IUnresolvedFile oldFile, IUnresolvedFile newFile) { // This method is called by the parser service within the parser service (per-file) lock. lock (lockObj) { @@ -287,11 +287,11 @@ namespace ICSharpCode.SharpDevelop.Parser fileName => { ITextSource content = finder.CreateForOpenFile(fileName); bool wasLoadedFromCache = false; - IParsedFile parsedFile = null; + IUnresolvedFile unresolvedFile = null; if (content == null && cachedPC != null) { - parsedFile = cachedPC.GetFile(fileName); - if (parsedFile != null && parsedFile.LastWriteTime == File.GetLastWriteTimeUtc(fileName)) { - parserService.RegisterParsedFile(fileName, project, parsedFile); + unresolvedFile = cachedPC.GetFile(fileName); + if (unresolvedFile != null && unresolvedFile.LastWriteTime == File.GetLastWriteTimeUtc(fileName)) { + parserService.RegisterUnresolvedFile(fileName, project, unresolvedFile); wasLoadedFromCache = true; } } @@ -304,7 +304,7 @@ namespace ICSharpCode.SharpDevelop.Parser } } if (content != null) { - parsedFile = parserService.ParseFile(fileName, content, project); + unresolvedFile = parserService.ParseFile(fileName, content, project); } } lock (progressLock) { @@ -312,7 +312,7 @@ namespace ICSharpCode.SharpDevelop.Parser fileCountLoadedFromCache++; } else { fileCountParsed++; - if (IsSerializable(parsedFile)) + if (IsSerializable(unresolvedFile)) fileCountParsedAndSerializable++; } progressMonitor.Progress += fileCountInverse; diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/FindReferencesAndRenameHelper.cs b/src/Main/Base/Project/Src/Services/RefactoringService/FindReferencesAndRenameHelper.cs index 5538c5b46d..151f20af3e 100644 --- a/src/Main/Base/Project/Src/Services/RefactoringService/FindReferencesAndRenameHelper.cs +++ b/src/Main/Base/Project/Src/Services/RefactoringService/FindReferencesAndRenameHelper.cs @@ -42,7 +42,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring // ); } - string newInterfaceFileName = Path.Combine(Path.GetDirectoryName(c.CompilationUnit.FileName), + string newInterfaceFileName = Path.Combine(Path.GetDirectoryName(c.SyntaxTree.FileName), extractInterface.NewFileName); if (File.Exists(newInterfaceFileName)) { int confirmReplace = MessageService.ShowCustomDialog("Extract Interface", @@ -57,7 +57,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring } LanguageProperties language = c.ProjectContent.Language; - string classFileName = c.CompilationUnit.FileName; + string classFileName = c.SyntaxTree.FileName; string existingClassCode = ParserService.GetParseableFileContent(classFileName).Text; // build the new interface... @@ -93,8 +93,8 @@ namespace ICSharpCode.SharpDevelop.Refactoring } } - ICompilationUnit newCompilationUnit = ParserService.ParseFile(newInterfaceFileName).CompilationUnit; - IClass newInterfaceDef = newCompilationUnit.Classes[0]; + ISyntaxTree newSyntaxTree = ParserService.ParseFile(newInterfaceFileName).SyntaxTree; + IClass newInterfaceDef = newSyntaxTree.Classes[0]; // finally, add the interface to the base types of the class that we're extracting from if (extractInterface.AddInterfaceToClass) { @@ -141,13 +141,13 @@ namespace ICSharpCode.SharpDevelop.Refactoring // Add the class declaration(s) foreach (ITypeDefinition part in c.GetParts()) { - AddDeclarationAsReference(list, part.CompilationUnit.FileName, part.Region, part.Name); + AddDeclarationAsReference(list, part.SyntaxTree.FileName, part.Region, part.Name); } // Add the constructors foreach (IMethod m in c.Methods) { if (m.IsConstructor || (m.Name == "#dtor")) { - AddDeclarationAsReference(list, m.DeclaringType.CompilationUnit.FileName, m.Region, c.Name); + AddDeclarationAsReference(list, m.DeclaringType.SyntaxTree.FileName, m.Region, c.Name); } } @@ -253,7 +253,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring public static bool IsReadOnly(ITypeDefinition c) { - return c.IsSynthetic || c.Parts.All(p => p.ParsedFile == null); + return c.IsSynthetic || c.Parts.All(p => p.UnresolvedFile == null); } [Obsolete("Use NavigationService.NavigateTo() instead")] @@ -266,7 +266,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring public static ITextEditor OpenDefinitionFile(IMember member, bool switchTo) { IViewContent viewContent = null; - ICompilationUnit cu = member.DeclaringType.CompilationUnit; + ISyntaxTree cu = member.DeclaringType.SyntaxTree; if (cu != null) { string fileName = cu.FileName; if (fileName != null) { @@ -280,7 +280,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring public static ITextEditor JumpBehindDefinition(IMember member) { IViewContent viewContent = null; - ICompilationUnit cu = member.DeclaringType.CompilationUnit; + ISyntaxTree cu = member.DeclaringType.SyntaxTree; if (cu != null) { string fileName = cu.FileName; if (fileName != null) { @@ -442,7 +442,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring public static void MoveClassToFile(IClass c, string newFileName) { LanguageProperties language = c.ProjectContent.Language; - string existingCode = ParserService.GetParseableFileContent(c.CompilationUnit.FileName).Text; + string existingCode = ParserService.GetParseableFileContent(c.SyntaxTree.FileName).Text; DomRegion fullRegion = language.RefactoringProvider.GetFullCodeRangeForType(existingCode, c); if (fullRegion.IsEmpty) return; @@ -518,7 +518,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring if (c is CompoundClass) throw new ArgumentException("Cannot get document from compound class - must pass a specific class part"); - ITextEditorProvider tecp = FileService.OpenFile(c.CompilationUnit.FileName) as ITextEditorProvider; + ITextEditorProvider tecp = FileService.OpenFile(c.SyntaxTree.FileName) as ITextEditorProvider; if (tecp == null) return null; return tecp.TextEditor.Document; } diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/NamespaceRefactoringService.cs b/src/Main/Base/Project/Src/Services/RefactoringService/NamespaceRefactoringService.cs index 1ef916da2b..25c1ce854f 100644 --- a/src/Main/Base/Project/Src/Services/RefactoringService/NamespaceRefactoringService.cs +++ b/src/Main/Base/Project/Src/Services/RefactoringService/NamespaceRefactoringService.cs @@ -41,7 +41,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring { ParseInformation info = ParserService.ParseFile(fileName, document); if (info == null) return; - ICompilationUnit cu = info.CompilationUnit; + ISyntaxTree cu = info.SyntaxTree; List newUsings = new List(cu.UsingScope.Usings); if (sort) { @@ -90,7 +90,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring } } - public static void AddUsingDeclaration(ICompilationUnit cu, IDocument document, string newNamespace, bool sortExistingUsings) + public static void AddUsingDeclaration(ISyntaxTree cu, IDocument document, string newNamespace, bool sortExistingUsings) { if (cu == null) throw new ArgumentNullException("cu"); @@ -101,7 +101,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring ParseInformation info = ParserService.ParseFile(cu.FileName, document); if (info != null) - cu = info.CompilationUnit; + cu = info.SyntaxTree; IUsing newUsingDecl = new DefaultUsing(cu.ProjectContent); newUsingDecl.Usings.Add(newNamespace); diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/RefactorMenu.cs b/src/Main/Base/Project/Src/Services/RefactoringService/RefactorMenu.cs index 5f076855c1..48503f92d9 100644 --- a/src/Main/Base/Project/Src/Services/RefactoringService/RefactorMenu.cs +++ b/src/Main/Base/Project/Src/Services/RefactoringService/RefactorMenu.cs @@ -134,7 +134,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring { if (member == null) { ShowUnknownSymbolError(); - } else if (member.DeclaringType.CompilationUnit.FileName == null) { + } else if (member.DeclaringType.SyntaxTree.FileName == null) { ShowNoUserCodeError(); } else { IMethod method = member as IMethod; @@ -150,7 +150,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring { if (c == null) { ShowUnknownSymbolError(); - } else if (c.CompilationUnit.FileName == null) { + } else if (c.SyntaxTree.FileName == null) { ShowNoUserCodeError(); } else { FindReferencesAndRenameHelper.RenameClass(c); diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs index 691f7fb05b..f574e89067 100644 --- a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs +++ b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs @@ -37,18 +37,18 @@ namespace ICSharpCode.SharpDevelop.Refactoring public readonly bool IsDefinition; /// Can be null. public readonly IProjectContent ProjectContent; - public readonly ICompilationUnit CompilationUnit; + public readonly ISyntaxTree SyntaxTree; public RefactoringMenuContext(ITextEditor editor, ExpressionResult expressionResult, ResolveResult resolveResult, bool isDefinition, - IProjectContent projectContent, ICompilationUnit compilationUnit) + IProjectContent projectContent, ISyntaxTree compilationUnit) { this.Editor = editor; this.ExpressionResult = expressionResult; this.ResolveResult = resolveResult; this.IsDefinition = isDefinition; this.ProjectContent = projectContent; - this.CompilationUnit = compilationUnit; + this.SyntaxTree = compilationUnit; } } @@ -117,8 +117,8 @@ namespace ICSharpCode.SharpDevelop.Refactoring ParseInformation pi = ParserService.GetParseInformation(textEditor.FileName); IProjectContent pc = null; if (pi != null) - pc = pi.CompilationUnit.ProjectContent; - RefactoringMenuContext context = new RefactoringMenuContext(textEditor, expressionResult, rr, isDefinition, pc, pi.CompilationUnit); + pc = pi.SyntaxTree.ProjectContent; + RefactoringMenuContext context = new RefactoringMenuContext(textEditor, expressionResult, rr, isDefinition, pc, pi.SyntaxTree); item = MakeItem((LocalResolveResult)rr, context); insertIndex = 0; // Insert local variable menu item at the topmost position. } @@ -140,14 +140,14 @@ namespace ICSharpCode.SharpDevelop.Refactoring MenuItem item = null; int caretLine = textEditor.Caret.Line; // Include menu for current class and method - ICompilationUnit cu = null; + ISyntaxTree cu = null; IMember callingMember = null; if (rr != null && rr.CallingMember != null) { callingMember = rr.CallingMember; } else { ParseInformation parseInfo = ParserService.GetParseInformation(textEditor.FileName); if (parseInfo != null) { - cu = parseInfo.CompilationUnit; + cu = parseInfo.SyntaxTree; if (cu != null) { IClass callingClass = cu.GetInnermostClass(caretLine, textEditor.Caret.Column); callingMember = GetCallingMember(callingClass, caretLine, textEditor.Caret.Column); @@ -186,7 +186,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring Debug.Assert(local == context.ResolveResult); MenuItem item = MakeItemWithGoToDefinition(local.VariableName, local.IsParameter ? ClassBrowserIconService.Parameter : ClassBrowserIconService.LocalVariable, - local.CallingClass.CompilationUnit, + local.CallingClass.SyntaxTree, context.IsDefinition ? DomRegion.Empty : local.VariableDefinitionRegion); string treePath = "/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/"; treePath += local.IsParameter ? "Parameter" : "LocalVariable"; @@ -201,7 +201,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring if (member == null) return null; if (definitions.Contains(member.DotNetName)) return null; definitions.Add(member.DotNetName); - MenuItem item = MakeItem(MemberNode.Create(member), member.DeclaringType.CompilationUnit, member.Region); + MenuItem item = MakeItem(MemberNode.Create(member), member.DeclaringType.SyntaxTree, member.Region); MenuItem declaringType = MakeItem(null, member.DeclaringType); if (declaringType != null) { declaringType.Header = StringParser.Parse("${res:SharpDevelop.Refactoring.DeclaringType}: ") + declaringType.Header; @@ -217,10 +217,10 @@ namespace ICSharpCode.SharpDevelop.Refactoring if (definitions.Contains(c.DotNetName)) return null; definitions.Add(c.DotNetName); } - return MakeItem(new ClassNode((IProject)c.ProjectContent.Project, c), c.CompilationUnit, c.Region); + return MakeItem(new ClassNode((IProject)c.ProjectContent.Project, c), c.SyntaxTree, c.Region); } - MenuItem MakeItemWithGoToDefinition(string title, IImage image, ICompilationUnit cu, DomRegion region) + MenuItem MakeItemWithGoToDefinition(string title, IImage image, ISyntaxTree cu, DomRegion region) { MenuItem item = new MenuItem(); item.Header = title; @@ -238,7 +238,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring return item; } - MenuItem MakeItem(ExtTreeNode classBrowserTreeNode, ICompilationUnit cu, DomRegion region) + MenuItem MakeItem(ExtTreeNode classBrowserTreeNode, ISyntaxTree cu, DomRegion region) { MenuItem item = MakeItemWithGoToDefinition(classBrowserTreeNode.Text, ClassBrowserIconService.GetImageByIndex(classBrowserTreeNode.ImageIndex), cu, region); foreach (object obj in MenuService.CreateMenuItems(null, classBrowserTreeNode, classBrowserTreeNode.ContextmenuAddinTreePath)) diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs index 3711c4ec24..e38cb27ead 100644 --- a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs +++ b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs @@ -194,7 +194,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring throw new ArgumentNullException("entity"); if (entity is LocalResolveResult) { return RunFindReferences(entity.CallingClass, (entity as LocalResolveResult).Field, - entity.CallingClass.CompilationUnit.FileName, progressMonitor); + entity.CallingClass.SyntaxTree.FileName, progressMonitor); } else if (entity is TypeResolveResult) { TypeResolveResult trr = (TypeResolveResult)entity; if (trr.ResolvedClass != null) { @@ -217,7 +217,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring /// This method can be used in three modes: /// 1. Find references to classes (parentClass = targetClass, member = null, fileName = null) /// 2. Find references to members (parentClass = parent, member = member, fileName = null) - /// 3. Find references to local variables (parentClass = parent, member = local var as field, fileName = parent.CompilationUnit.FileName) + /// 3. Find references to local variables (parentClass = parent, member = local var as field, fileName = parent.SyntaxTree.FileName) /// static List RunFindReferences(IClass ownerClass, IMember member, string fileName, @@ -389,12 +389,12 @@ namespace ICSharpCode.SharpDevelop.Refactoring CompoundClass cc = c as CompoundClass; if (cc != null) { foreach (IClass part in cc.Parts) { - string fileName = part.CompilationUnit.FileName; + string fileName = part.SyntaxTree.FileName; if (fileName != null) list.Add(fileName); } } else { - string fileName = c.CompilationUnit.FileName; + string fileName = c.SyntaxTree.FileName; if (fileName != null) list.Add(fileName); } @@ -639,7 +639,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring if (callingClass == null) yield break; IProjectContent pc = callingClass.ProjectContent; - if (!pc.Language.RefactoringProvider.IsEnabledForFile(callingClass.CompilationUnit.FileName)) + if (!pc.Language.RefactoringProvider.IsEnabledForFile(callingClass.SyntaxTree.FileName)) yield break; List searchResults = new List(); SearchAllClassesWithName(searchResults, pc, unknownClassName, pc.Language); @@ -648,7 +648,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring } foreach (IClass c in searchResults) { string newNamespace = c.Namespace; - yield return new AddUsingAction(callingClass.CompilationUnit, editor, newNamespace); + yield return new AddUsingAction(callingClass.SyntaxTree, editor, newNamespace); } } @@ -663,11 +663,11 @@ namespace ICSharpCode.SharpDevelop.Refactoring public class AddUsingAction : IContextAction { - public ICompilationUnit CompilationUnit { get; private set; } + public ISyntaxTree SyntaxTree { get; private set; } public ITextEditor Editor { get; private set; } public string NewNamespace { get; private set; } - public AddUsingAction(ICompilationUnit compilationUnit, ITextEditor editor, string newNamespace) + public AddUsingAction(ISyntaxTree compilationUnit, ITextEditor editor, string newNamespace) { if (compilationUnit == null) throw new ArgumentNullException("compilationUnit"); @@ -675,14 +675,14 @@ namespace ICSharpCode.SharpDevelop.Refactoring throw new ArgumentNullException("editor"); if (newNamespace == null) throw new ArgumentNullException("newNamespace"); - this.CompilationUnit = compilationUnit; + this.SyntaxTree = compilationUnit; this.Editor = editor; this.NewNamespace = newNamespace; } public void Execute() { - NamespaceRefactoringService.AddUsingDeclaration(CompilationUnit, Editor.Document, NewNamespace, true); + NamespaceRefactoringService.AddUsingDeclaration(SyntaxTree, Editor.Document, NewNamespace, true); ParserService.BeginParse(Editor.FileName, Editor.Document); } diff --git a/src/Main/Base/Project/Src/Services/Tasks/TaskService.cs b/src/Main/Base/Project/Src/Services/Tasks/TaskService.cs index f88de90baa..0ccae06d2a 100644 --- a/src/Main/Base/Project/Src/Services/Tasks/TaskService.cs +++ b/src/Main/Base/Project/Src/Services/Tasks/TaskService.cs @@ -85,7 +85,7 @@ namespace ICSharpCode.SharpDevelop static void ParserService_ParseInformationUpdated(object sender, ParseInformationEventArgs e) { - if (e.NewParsedFile == SD.ParserService.GetExistingParsedFile(e.FileName)) { + if (e.NewUnresolvedFile == SD.ParserService.GetExistingUnresolvedFile(e.FileName)) { // Call UpdateCommentTags only for the main parse information (if a file is in multiple projects), // and only if the results haven't already been replaced with a more recent ParseInformation. if (e.NewParseInformation != null) { diff --git a/src/Main/Base/Test/CodeConverterTests.cs b/src/Main/Base/Test/CodeConverterTests.cs index 90799a980c..a605966e6c 100644 --- a/src/Main/Base/Test/CodeConverterTests.cs +++ b/src/Main/Base/Test/CodeConverterTests.cs @@ -49,7 +49,7 @@ namespace ICSharpCode.SharpDevelop.Tests Assert.AreEqual("", parser.Errors.ErrorOutput); NRefactoryASTConvertVisitor visitor = new NRefactoryASTConvertVisitor(pc, sourceLanguage); - visitor.VisitCompilationUnit(parser.CompilationUnit, null); + visitor.VisitSyntaxTree(parser.SyntaxTree, null); visitor.Cu.FileName = sourceLanguage == SupportedLanguage.CSharp ? "a.cs" : "a.vb"; foreach (IClass c in visitor.Cu.Classes) { pc.AddClassToNamespaceList(c); @@ -60,10 +60,10 @@ namespace ICSharpCode.SharpDevelop.Tests if (sourceLanguage == SupportedLanguage.CSharp) { CSharpToVBNetConvertVisitor convertVisitor = new CSharpToVBNetConvertVisitor(pc, parseInfo); convertVisitor.RootNamespaceToRemove = "RootNamespace"; - parser.CompilationUnit.AcceptVisitor(convertVisitor, null); + parser.SyntaxTree.AcceptVisitor(convertVisitor, null); } else { VBNetToCSharpConvertVisitor convertVisitor = new VBNetToCSharpConvertVisitor(pc, parseInfo); - parser.CompilationUnit.AcceptVisitor(convertVisitor, null); + parser.SyntaxTree.AcceptVisitor(convertVisitor, null); } IOutputAstVisitor outputVisitor = sourceLanguage == SupportedLanguage.CSharp ? (IOutputAstVisitor)new VBNetOutputVisitor() : new CSharpOutputVisitor(); @@ -71,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Tests outputVisitor.Options.IndentSize = 2; using (SpecialNodesInserter.Install(parser.Lexer.SpecialTracker.RetrieveSpecials(), outputVisitor)) { - outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null); + outputVisitor.VisitSyntaxTree(parser.SyntaxTree, null); } Assert.AreEqual("", outputVisitor.Errors.ErrorOutput); Assert.AreEqual(expectedOutput.Replace("\r", ""), outputVisitor.Text.Trim().Replace("\r", "")); diff --git a/src/Main/Base/Test/GenerateOverrideMethodTests.cs b/src/Main/Base/Test/GenerateOverrideMethodTests.cs index ff24ba5571..e05ba85a70 100644 --- a/src/Main/Base/Test/GenerateOverrideMethodTests.cs +++ b/src/Main/Base/Test/GenerateOverrideMethodTests.cs @@ -22,7 +22,7 @@ // // void Run(string input, string expectedOutput) // { -// ICompilationUnit cu = helper.Parse("a.cs", input + "\nclass DerivedClass {\n \n}"); +// ISyntaxTree cu = helper.Parse("a.cs", input + "\nclass DerivedClass {\n \n}"); // Assert.AreEqual(2, cu.Classes.Count); // Assert.AreEqual(1, cu.Classes[0].Methods.Count + cu.Classes[0].Properties.Count); // IMember virtualMember; diff --git a/src/Main/Base/Test/ReflectionLayerTests.cs b/src/Main/Base/Test/ReflectionLayerTests.cs index 738c8b66eb..8ff637c81f 100644 --- a/src/Main/Base/Test/ReflectionLayerTests.cs +++ b/src/Main/Base/Test/ReflectionLayerTests.cs @@ -34,7 +34,7 @@ // // protected override IClass GetClass(Type type) // { -// ICompilationUnit cu = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry).AssemblyCompilationUnit; +// ISyntaxTree cu = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry).AssemblySyntaxTree; // ((ReflectionProjectContent)cu.ProjectContent).AddReferencedContent(mscorlib); // IClass c = new ReflectionClass(cu, type, type.FullName, null); // cu.ProjectContent.AddClassToNamespaceList(c); @@ -64,7 +64,7 @@ // // protected override IClass GetClass(Type type) // { -// ICompilationUnit cu = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry).AssemblyCompilationUnit; +// ISyntaxTree cu = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry).AssemblySyntaxTree; // IClass c = new ReflectionClass(cu, type, type.FullName, null); // cu.ProjectContent.AddClassToNamespaceList(c); // diff --git a/src/Main/Base/Test/SearchClassTests.cs b/src/Main/Base/Test/SearchClassTests.cs index 5facda0892..ac88704bde 100644 --- a/src/Main/Base/Test/SearchClassTests.cs +++ b/src/Main/Base/Test/SearchClassTests.cs @@ -14,12 +14,12 @@ // ProjectContentRegistry projectContentRegistry = AssemblyParserService.DefaultProjectContentRegistry; // // #region Helper methods -// ICompilationUnit Prepare(LanguageProperties language) +// ISyntaxTree Prepare(LanguageProperties language) // { // DefaultProjectContent pc = new DefaultProjectContent(); // pc.ReferencedContents.Add(projectContentRegistry.Mscorlib); // pc.Language = language; -// DefaultCompilationUnit cu = new DefaultCompilationUnit(pc); +// DefaultSyntaxTree cu = new DefaultSyntaxTree(pc); // if (language == LanguageProperties.VBNet) // cu.UsingScope.Usings.Add(CreateUsing(pc, "syStEm")); // else @@ -36,7 +36,7 @@ // // IReturnType SearchType(string type) // { -// ICompilationUnit cu = Prepare(LanguageProperties.CSharp); +// ISyntaxTree cu = Prepare(LanguageProperties.CSharp); // IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest(type, 0, null, cu, 1, 1)).Result; // Assert.IsNotNull(c, type + "not found"); // return c; @@ -44,7 +44,7 @@ // // IReturnType SearchTypeVB(string type) // { -// ICompilationUnit cu = Prepare(LanguageProperties.VBNet); +// ISyntaxTree cu = Prepare(LanguageProperties.VBNet); // IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest(type, 0, null, cu, 1, 1)).Result; // Assert.IsNotNull(c, type + "not found"); // return c; @@ -62,7 +62,7 @@ // // void CheckNamespace(string @namespace, string className, LanguageProperties language) // { -// ICompilationUnit cu = Prepare(language); +// ISyntaxTree cu = Prepare(language); // string ns = cu.ProjectContent.SearchType(new SearchTypeRequest(@namespace, 0, null, cu, 1, 1)).NamespaceResult; // Assert.IsNotNull(ns, @namespace + " not found"); // foreach (object o in cu.ProjectContent.GetNamespaceContents(ns)) { @@ -112,7 +112,7 @@ // [Test] // public void SearchArrayList() // { -// ICompilationUnit cu = Prepare(LanguageProperties.CSharp); +// ISyntaxTree cu = Prepare(LanguageProperties.CSharp); // IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest("Collections.ArrayList", 0, null, cu, 1, 1)).Result; // Assert.IsNull(c, "Namespaces should not be imported in C#"); // } @@ -126,7 +126,7 @@ // [Test] // public void SearchNestedNamespace() // { -// ICompilationUnit cu = Prepare(LanguageProperties.CSharp); +// ISyntaxTree cu = Prepare(LanguageProperties.CSharp); // string ns = cu.ProjectContent.SearchType(new SearchTypeRequest("Collections.Generic", 0, null, cu, 1, 1)).NamespaceResult; // Assert.IsNull(ns, "Nested namespaces should not be found in C#"); // } @@ -140,12 +140,12 @@ // [Test] // public void SearchClassPreferVisible() // { -// ICompilationUnit ref1 = Prepare(LanguageProperties.CSharp); +// ISyntaxTree ref1 = Prepare(LanguageProperties.CSharp); // ref1.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref1, "ClassName") { Modifiers = ModifierEnum.Internal }); -// ICompilationUnit ref2 = Prepare(LanguageProperties.CSharp); +// ISyntaxTree ref2 = Prepare(LanguageProperties.CSharp); // ref2.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref2, "ClassName") { Modifiers = ModifierEnum.Public }); // -// ICompilationUnit cu = Prepare(LanguageProperties.CSharp); +// ISyntaxTree cu = Prepare(LanguageProperties.CSharp); // cu.ProjectContent.ReferencedContents.Add(ref1.ProjectContent); // cu.ProjectContent.ReferencedContents.Add(ref2.ProjectContent); // @@ -156,12 +156,12 @@ // [Test] // public void SearchClassDifferentNamespacePreferVisible() // { -// ICompilationUnit ref1 = Prepare(LanguageProperties.CSharp); +// ISyntaxTree ref1 = Prepare(LanguageProperties.CSharp); // ref1.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref1, "NS1.ClassName") { Modifiers = ModifierEnum.Internal }); -// ICompilationUnit ref2 = Prepare(LanguageProperties.CSharp); +// ISyntaxTree ref2 = Prepare(LanguageProperties.CSharp); // ref2.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref2, "NS2.ClassName") { Modifiers = ModifierEnum.Public }); // -// ICompilationUnit cu = Prepare(LanguageProperties.CSharp); +// ISyntaxTree cu = Prepare(LanguageProperties.CSharp); // cu.ProjectContent.ReferencedContents.Add(ref1.ProjectContent); // cu.ProjectContent.ReferencedContents.Add(ref2.ProjectContent); // cu.UsingScope.Usings.Add(new DefaultUsing(cu.ProjectContent) { Usings = { "NS1", "NS2" } }); diff --git a/src/Main/Base/Test/SearchGenericClassTests.cs b/src/Main/Base/Test/SearchGenericClassTests.cs index 13e4ccde6f..a575eec775 100644 --- a/src/Main/Base/Test/SearchGenericClassTests.cs +++ b/src/Main/Base/Test/SearchGenericClassTests.cs @@ -19,12 +19,12 @@ // // usingMode: 0 = one using-statement for each namespace (correctly cased) // // 1 = mixture of using statements and default imports (incorrectly cased) // // 2 = all default imports (incorrectly cased) -// ICompilationUnit Prepare(LanguageProperties language, int usingMode) +// ISyntaxTree Prepare(LanguageProperties language, int usingMode) // { // DefaultProjectContent pc = new DefaultProjectContent(); // pc.ReferencedContents.Add(projectContentRegistry.Mscorlib); // pc.Language = language; -// DefaultCompilationUnit cu = new DefaultCompilationUnit(pc); +// DefaultSyntaxTree cu = new DefaultSyntaxTree(pc); // if (usingMode == 1) { // cu.UsingScope.Usings.Add(CreateUsing(pc, "syStEm.coLLectIons")); // pc.DefaultImports = new DefaultUsing(pc); @@ -52,7 +52,7 @@ // // IReturnType SearchType(string type, int typeParameterCount) // { -// ICompilationUnit cu = Prepare(LanguageProperties.CSharp, 0); +// ISyntaxTree cu = Prepare(LanguageProperties.CSharp, 0); // IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest(type, typeParameterCount, null, cu, 1, 1)).Result; // Assert.IsNotNull(c, type + "not found"); // return c; @@ -60,7 +60,7 @@ // // IReturnType SearchTypeVB(string type, int typeParameterCount) // { -// ICompilationUnit cu; +// ISyntaxTree cu; // cu = Prepare(LanguageProperties.VBNet, 0); // IReturnType c0 = cu.ProjectContent.SearchType(new SearchTypeRequest(type, typeParameterCount, null, cu, 1, 1)).Result; // Assert.IsNotNull(c0, type + "not found for mode=0"); diff --git a/src/Main/Base/Test/Utils/MockClass.cs b/src/Main/Base/Test/Utils/MockClass.cs index c4a37350d5..339c1a124f 100644 --- a/src/Main/Base/Test/Utils/MockClass.cs +++ b/src/Main/Base/Test/Utils/MockClass.cs @@ -52,7 +52,7 @@ // } // } // -// public ICompilationUnit CompilationUnit { +// public ISyntaxTree SyntaxTree { // get { // throw new NotImplementedException(); // } diff --git a/src/Main/Base/Test/Utils/MockEntity.cs b/src/Main/Base/Test/Utils/MockEntity.cs index 9a94230286..cb97b0fa2e 100644 --- a/src/Main/Base/Test/Utils/MockEntity.cs +++ b/src/Main/Base/Test/Utils/MockEntity.cs @@ -19,7 +19,7 @@ // } // } // -// public override ICompilationUnit CompilationUnit { +// public override ISyntaxTree SyntaxTree { // get { // throw new NotImplementedException(); // } diff --git a/src/Main/Base/Test/Utils/MockMethod.cs b/src/Main/Base/Test/Utils/MockMethod.cs index cf6a2e238b..79db3c4b50 100644 --- a/src/Main/Base/Test/Utils/MockMethod.cs +++ b/src/Main/Base/Test/Utils/MockMethod.cs @@ -260,7 +260,7 @@ // throw new NotImplementedException(); // } // -// public ICompilationUnit CompilationUnit { +// public ISyntaxTree SyntaxTree { // get { // throw new NotImplementedException(); // } diff --git a/src/Main/Base/Test/Utils/MockProperty.cs b/src/Main/Base/Test/Utils/MockProperty.cs index bcbbd2a352..35068670bf 100644 --- a/src/Main/Base/Test/Utils/MockProperty.cs +++ b/src/Main/Base/Test/Utils/MockProperty.cs @@ -278,7 +278,7 @@ // throw new NotImplementedException(); // } // -// public ICompilationUnit CompilationUnit { +// public ISyntaxTree SyntaxTree { // get { // throw new NotImplementedException(); // } diff --git a/src/Main/SharpDevelop/Parser/ParserService.cs b/src/Main/SharpDevelop/Parser/ParserService.cs index 6cea8f5350..5060d0759b 100644 --- a/src/Main/SharpDevelop/Parser/ParserService.cs +++ b/src/Main/SharpDevelop/Parser/ParserService.cs @@ -44,9 +44,9 @@ namespace ICSharpCode.SharpDevelop.Parser delegate { if (!LoadSolutionProjectsThread.IsRunning) { string addition; - if (e.OldParsedFile == null) + if (e.OldUnresolvedFile == null) addition = " (new)"; - else if (e.NewParsedFile == null) + else if (e.NewUnresolvedFile == null) addition = " (removed)"; else addition = " (updated)"; @@ -96,9 +96,9 @@ namespace ICSharpCode.SharpDevelop.Parser var entry = GetFileEntry(fileName, false); if (entry != null && entry.parser != null) { - var parsedFile = entry.GetExistingParsedFile(null, null); - if (parsedFile != null) { - ICompilation compilation = entry.parser.CreateCompilationForSingleFile(fileName, parsedFile); + var unresolvedFile = entry.GetExistingUnresolvedFile(null, null); + if (unresolvedFile != null) { + ICompilation compilation = entry.parser.CreateCompilationForSingleFile(fileName, unresolvedFile); if (compilation != null) return compilation; } @@ -207,11 +207,11 @@ namespace ICSharpCode.SharpDevelop.Parser #endregion #region Forward Parse() calls to entry - public IParsedFile GetExistingParsedFile(FileName fileName, ITextSourceVersion version, IProject parentProject) + public IUnresolvedFile GetExistingUnresolvedFile(FileName fileName, ITextSourceVersion version, IProject parentProject) { var entry = GetFileEntry(fileName, false); if (entry != null) - return entry.GetExistingParsedFile(version, parentProject); + return entry.GetExistingUnresolvedFile(version, parentProject); else return null; } @@ -230,7 +230,7 @@ namespace ICSharpCode.SharpDevelop.Parser return GetFileEntry(fileName, true).Parse(fileContent, parentProject, cancellationToken); } - public IParsedFile ParseFile(FileName fileName, ITextSource fileContent, IProject parentProject, CancellationToken cancellationToken) + public IUnresolvedFile ParseFile(FileName fileName, ITextSource fileContent, IProject parentProject, CancellationToken cancellationToken) { return GetFileEntry(fileName, true).ParseFile(fileContent, parentProject, cancellationToken); } @@ -240,7 +240,7 @@ namespace ICSharpCode.SharpDevelop.Parser return GetFileEntry(fileName, true).ParseAsync(fileContent, parentProject, cancellationToken); } - public Task ParseFileAsync(FileName fileName, ITextSource fileContent, IProject parentProject, CancellationToken cancellationToken) + public Task ParseFileAsync(FileName fileName, ITextSource fileContent, IProject parentProject, CancellationToken cancellationToken) { return GetFileEntry(fileName, true).ParseFileAsync(fileContent, parentProject, cancellationToken); } @@ -369,9 +369,9 @@ namespace ICSharpCode.SharpDevelop.Parser // TODO } - public void RegisterParsedFile(FileName fileName, IProject project, IParsedFile parsedFile) + public void RegisterUnresolvedFile(FileName fileName, IProject project, IUnresolvedFile unresolvedFile) { - GetFileEntry(fileName, true).RegisterParsedFile(project, parsedFile); + GetFileEntry(fileName, true).RegisterUnresolvedFile(project, unresolvedFile); } } } diff --git a/src/Main/SharpDevelop/Parser/ParserServiceEntry.cs b/src/Main/SharpDevelop/Parser/ParserServiceEntry.cs index d95d701d09..5f8e6454ed 100644 --- a/src/Main/SharpDevelop/Parser/ParserServiceEntry.cs +++ b/src/Main/SharpDevelop/Parser/ParserServiceEntry.cs @@ -21,13 +21,13 @@ namespace ICSharpCode.SharpDevelop.Parser struct ProjectEntry { public readonly IProject Project; - public readonly IParsedFile ParsedFile; + public readonly IUnresolvedFile UnresolvedFile; public readonly ParseInformation CachedParseInformation; - public ProjectEntry(IProject project, IParsedFile parsedFile, ParseInformation cachedParseInformation) + public ProjectEntry(IProject project, IUnresolvedFile unresolvedFile, ParseInformation cachedParseInformation) { this.Project = project; - this.ParsedFile = parsedFile; + this.UnresolvedFile = unresolvedFile; this.CachedParseInformation = cachedParseInformation; } } @@ -107,7 +107,7 @@ namespace ICSharpCode.SharpDevelop.Parser return -1; } - #region Expire Cache + GetExistingParsedFile + GetCachedParseInformation + #region Expire Cache + GetExistingUnresolvedFile + GetCachedParseInformation public void ExpireCache() { lock (this) { @@ -116,13 +116,13 @@ namespace ICSharpCode.SharpDevelop.Parser } else { for (int i = 0; i < entries.Count; i++) { var oldEntry = entries[i]; - entries[i] = new ProjectEntry(oldEntry.Project, oldEntry.ParsedFile, null); + entries[i] = new ProjectEntry(oldEntry.Project, oldEntry.UnresolvedFile, null); } } } } - public IParsedFile GetExistingParsedFile(ITextSourceVersion version, IProject parentProject) + public IUnresolvedFile GetExistingUnresolvedFile(ITextSourceVersion version, IProject parentProject) { lock (this) { if (version != null && CompareVersions(version) != 0) { @@ -131,7 +131,7 @@ namespace ICSharpCode.SharpDevelop.Parser int index = FindIndexForProject(parentProject); if (index < 0) return null; - return entries[index].ParsedFile; + return entries[index].UnresolvedFile; } } @@ -159,13 +159,13 @@ namespace ICSharpCode.SharpDevelop.Parser return DoParse(fileContent, parentProject, true, cancellationToken).CachedParseInformation; } - public IParsedFile ParseFile(ITextSource fileContent, IProject parentProject, CancellationToken cancellationToken) + public IUnresolvedFile ParseFile(ITextSource fileContent, IProject parentProject, CancellationToken cancellationToken) { if (fileContent == null) { fileContent = SD.FileService.GetFileContent(fileName); } - return DoParse(fileContent, parentProject, false, cancellationToken).ParsedFile; + return DoParse(fileContent, parentProject, false, cancellationToken).UnresolvedFile; } ProjectEntry DoParse(ITextSource fileContent, IProject parentProject, bool fullParseInformationRequested, @@ -196,8 +196,8 @@ namespace ICSharpCode.SharpDevelop.Parser // We're going backwards in time, or are requesting a project that is not an owner // for this entry. var parseInfo = ParseWithExceptionHandling(fileContent, fullParseInformationRequested, parentProject, cancellationToken); - FreezableHelper.Freeze(parseInfo.ParsedFile); - return new ProjectEntry(parentProject, parseInfo.ParsedFile, parseInfo); + FreezableHelper.Freeze(parseInfo.UnresolvedFile); + return new ProjectEntry(parentProject, parseInfo.UnresolvedFile, parseInfo); } else { if (versionComparison == 0 && index >= 0) { // If full parse info is requested, ensure we have full parse info. @@ -217,18 +217,18 @@ namespace ICSharpCode.SharpDevelop.Parser throw new InvalidOperationException(parser.GetType().Name + ".Parse() did not return full parse info as requested."); OnDiskTextSourceVersion onDiskVersion = fileContent.Version as OnDiskTextSourceVersion; if (onDiskVersion != null) - parseInfo.ParsedFile.LastWriteTime = onDiskVersion.LastWriteTime; - FreezableHelper.Freeze(parseInfo.ParsedFile); - results[i] = new ParseInformationEventArgs(entries[i].Project, entries[i].ParsedFile, parseInfo); + parseInfo.UnresolvedFile.LastWriteTime = onDiskVersion.LastWriteTime; + FreezableHelper.Freeze(parseInfo.UnresolvedFile); + results[i] = new ParseInformationEventArgs(entries[i].Project, entries[i].UnresolvedFile, parseInfo); } // Only if all parse runs succeeded, register the parse information. currentVersion = fileContent.Version; for (int i = 0; i < entries.Count; i++) { if (fullParseInformationRequested || (entries[i].CachedParseInformation != null && results[i].NewParseInformation.IsFullParseInformation)) - entries[i] = new ProjectEntry(entries[i].Project, results[i].NewParsedFile, results[i].NewParseInformation); + entries[i] = new ProjectEntry(entries[i].Project, results[i].NewUnresolvedFile, results[i].NewParseInformation); else - entries[i] = new ProjectEntry(entries[i].Project, results[i].NewParsedFile, null); + entries[i] = new ProjectEntry(entries[i].Project, results[i].NewUnresolvedFile, null); if (entries[i].Project != null) entries[i].Project.OnParseInformationUpdated(results[i]); parserService.RaiseParseInformationUpdated(results[i]); @@ -264,9 +264,9 @@ namespace ICSharpCode.SharpDevelop.Parser return (await DoParseAsync(fileContent, parentProject, true, cancellationToken)).CachedParseInformation; } - public async Task ParseFileAsync(ITextSource fileContent, IProject parentProject, CancellationToken cancellationToken) + public async Task ParseFileAsync(ITextSource fileContent, IProject parentProject, CancellationToken cancellationToken) { - return (await DoParseAsync(fileContent, parentProject, false, cancellationToken)).ParsedFile; + return (await DoParseAsync(fileContent, parentProject, false, cancellationToken)).UnresolvedFile; } Task DoParseAsync(ITextSource fileContent, IProject parentProject, bool requestFullParseInformation, CancellationToken cancellationToken) @@ -338,20 +338,20 @@ namespace ICSharpCode.SharpDevelop.Parser } #endregion - public void RegisterParsedFile(IProject project, IParsedFile parsedFile) + public void RegisterUnresolvedFile(IProject project, IUnresolvedFile unresolvedFile) { if (project == null) throw new ArgumentNullException("project"); - if (parsedFile == null) - throw new ArgumentNullException("parsedFile"); - FreezableHelper.Freeze(parsedFile); - var newParseInfo = new ParseInformation(parsedFile, false); + if (unresolvedFile == null) + throw new ArgumentNullException("unresolvedFile"); + FreezableHelper.Freeze(unresolvedFile); + var newParseInfo = new ParseInformation(unresolvedFile, false); lock (this) { int index = FindIndexForProject(project); if (index >= 0) { currentVersion = null; - var args = new ParseInformationEventArgs(project, entries[index].ParsedFile, newParseInfo); - entries[index] = new ProjectEntry(project, parsedFile, null); + var args = new ParseInformationEventArgs(project, entries[index].UnresolvedFile, newParseInfo); + entries[index] = new ProjectEntry(project, unresolvedFile, null); project.OnParseInformationUpdated(args); parserService.RaiseParseInformationUpdated(args); } diff --git a/src/Main/SharpDevelop/Workbench/WorkbenchStartup.cs b/src/Main/SharpDevelop/Workbench/WorkbenchStartup.cs index d4ae37afcd..70818736d7 100644 --- a/src/Main/SharpDevelop/Workbench/WorkbenchStartup.cs +++ b/src/Main/SharpDevelop/Workbench/WorkbenchStartup.cs @@ -144,12 +144,12 @@ class Test { } }"), "test.cs"); // warm up the type system - var parsedFile = cu.ToTypeSystem(); - var pc = new ICSharpCode.NRefactory.CSharp.CSharpProjectContent().UpdateProjectContent(null, parsedFile); + var unresolvedFile = cu.ToTypeSystem(); + var pc = new ICSharpCode.NRefactory.CSharp.CSharpProjectContent().UpdateProjectContent(null, unresolvedFile); pc = pc.AddAssemblyReferences(new[] { ICSharpCode.NRefactory.TypeSystem.Implementation.MinimalCorlib.Instance }); var compilation = pc.CreateCompilation(); // warm up the resolver - var resolver = new ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver(compilation, cu, parsedFile); + var resolver = new ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver(compilation, cu, unresolvedFile); foreach (var node in cu.Descendants) { resolver.Resolve(node); }