diff --git a/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj b/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj index 7ea57afe2..890b6c12f 100644 --- a/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj +++ b/ICSharpCode.NRefactory.CSharp/ICSharpCode.NRefactory.CSharp.csproj @@ -56,6 +56,9 @@ + + Properties\GlobalAssemblyInfo.cs + diff --git a/ICSharpCode.NRefactory.CSharp/Properties/AssemblyInfo.cs b/ICSharpCode.NRefactory.CSharp/Properties/AssemblyInfo.cs index b1c65a5a1..88b738ea9 100644 --- a/ICSharpCode.NRefactory.CSharp/Properties/AssemblyInfo.cs +++ b/ICSharpCode.NRefactory.CSharp/Properties/AssemblyInfo.cs @@ -10,22 +10,4 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ICSharpCode.NRefactory.CSharp")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("ICSharpCode")] -[assembly: AssemblyProduct("SharpDevelop/MonoDevelop")] -[assembly: AssemblyCopyright("Copyright 2010-2012 AlphaSierraPapa")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all the values or you can use the default the Revision and -// Build Numbers by using the '*' as shown below: -[assembly: AssemblyVersion("5.0.0.4")] +[assembly: AssemblyDescription("C# parser and semantic analysis")] diff --git a/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpDocumentationComment.cs b/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpDocumentationComment.cs index 07b75dd8d..5ca58078c 100644 --- a/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpDocumentationComment.cs +++ b/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpDocumentationComment.cs @@ -18,6 +18,7 @@ using System; using ICSharpCode.NRefactory.Documentation; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.NRefactory.TypeSystem; namespace ICSharpCode.NRefactory.CSharp.TypeSystem @@ -27,7 +28,7 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem /// sealed class CSharpDocumentationComment : DocumentationComment { - public CSharpDocumentationComment(string xmlDoc, ITypeResolveContext context) : base(xmlDoc, context) + public CSharpDocumentationComment(ITextSource xmlDoc, ITypeResolveContext context) : base(xmlDoc, context) { } diff --git a/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpParsedFile.cs b/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpParsedFile.cs index 2cd886049..d02861fd9 100644 --- a/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpParsedFile.cs +++ b/ICSharpCode.NRefactory.CSharp/TypeSystem/CSharpParsedFile.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; using ICSharpCode.NRefactory.Documentation; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem.Implementation; using System.Linq; @@ -215,9 +216,9 @@ public DocumentationComment GetDocumentation(IUnresolvedEntity entity, IEntity r var context = unresolvedTypeDef.CreateResolveContext(new SimpleTypeResolveContext(resolvedTypeDef)); if (resolvedEntity is IMember) context = context.WithCurrentMember((IMember)resolvedEntity); - return new CSharpDocumentationComment(xmlDoc, context); + return new CSharpDocumentationComment(new StringTextSource(xmlDoc), context); } else { - return new DocumentationComment(xmlDoc, new SimpleTypeResolveContext(resolvedEntity)); + return new DocumentationComment(new StringTextSource(xmlDoc), new SimpleTypeResolveContext(resolvedEntity)); } } } diff --git a/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs b/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs index b405ed0e0..de4296858 100644 --- a/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs +++ b/ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs @@ -52,6 +52,12 @@ public IInterningProvider InterningProvider { set { interningProvider = value; } } + /// + /// Gets/Sets whether to ignore XML documentation. + /// The default value is false. + /// + public bool SkipXmlDocumentation { get; set; } + /// /// Creates a new TypeSystemConvertVisitor. /// @@ -1117,6 +1123,8 @@ void ConvertParameters(IList outputList, IEnumerable documentation = null; for (AstNode node = entityDeclaration.PrevSibling; node != null && node.NodeType == NodeType.Whitespace; node = node.PrevSibling) { Comment c = node as Comment; diff --git a/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj b/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj index 0b17f39c1..7e7857d49 100644 --- a/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj +++ b/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj @@ -11,13 +11,17 @@ Properties + False + False + 4 + false x86 bin\Debug\ - True + true Full False True @@ -31,6 +35,9 @@ False TRACE + + AnyCPU + @@ -47,6 +54,9 @@ + + Properties\GlobalAssemblyInfo.cs + diff --git a/ICSharpCode.NRefactory.ConsistencyCheck/IDStringConsistencyCheck.cs b/ICSharpCode.NRefactory.ConsistencyCheck/IDStringConsistencyCheck.cs index fd14075cb..e506e8229 100644 --- a/ICSharpCode.NRefactory.ConsistencyCheck/IDStringConsistencyCheck.cs +++ b/ICSharpCode.NRefactory.ConsistencyCheck/IDStringConsistencyCheck.cs @@ -17,6 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; +using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.Documentation; using ICSharpCode.NRefactory.TypeSystem; @@ -30,19 +31,22 @@ public static void Run(Solution solution) { foreach (var project in solution.Projects) { var compilation = project.Compilation; + HashSet idStrings = new HashSet(); var context = compilation.TypeResolveContext; foreach (var typeDef in compilation.MainAssembly.GetAllTypeDefinitions()) { - Check(typeDef, context); + Check(typeDef, context, idStrings); foreach (var member in typeDef.Members) { - Check(member, context); + Check(member, context, idStrings); } } } } - static void Check(IEntity entity, ITypeResolveContext context) + static void Check(IEntity entity, ITypeResolveContext context, HashSet idStrings) { string id = IDStringProvider.GetIDString(entity); + if (!idStrings.Add(id)) + throw new InvalidOperationException("Duplicate ID string " + id); IEntity resolvedEntity = IDStringProvider.FindEntity(id, context); if (resolvedEntity != entity) throw new InvalidOperationException(id); diff --git a/ICSharpCode.NRefactory.ConsistencyCheck/Properties/AssemblyInfo.cs b/ICSharpCode.NRefactory.ConsistencyCheck/Properties/AssemblyInfo.cs index feefce17f..3df988876 100644 --- a/ICSharpCode.NRefactory.ConsistencyCheck/Properties/AssemblyInfo.cs +++ b/ICSharpCode.NRefactory.ConsistencyCheck/Properties/AssemblyInfo.cs @@ -10,22 +10,4 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ICSharpCode.NRefactory.ConsistencyCheck")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ICSharpCode.NRefactory.ConsistencyCheck")] -[assembly: AssemblyCopyright("Copyright 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all the values or you can use the default the Revision and -// Build Numbers by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyDescription("Loads a solution and performs various self-tests using the parsed code.")] diff --git a/ICSharpCode.NRefactory.ConsistencyCheck/Readme.txt b/ICSharpCode.NRefactory.ConsistencyCheck/Readme.txt index d94af06e4..a34b7f0f1 100644 --- a/ICSharpCode.NRefactory.ConsistencyCheck/Readme.txt +++ b/ICSharpCode.NRefactory.ConsistencyCheck/Readme.txt @@ -5,5 +5,7 @@ These checks assume that the code is valid C# without any compilation errors, so make sure to only pass in compilable source code. Checks currently being performed: + - Checks that ID strings are unique and refer back to the correct entity - Roundtripping test: parses C# code and outputs it again using CSharpOutputVisitor, checking that only whitespace is changing - ResolverTest: fully resolves all ASTs and validates that no errors are detected (no false positives in semantic error checking) + - RandomizedOrderResolverTest: checks that the order of Resolve()/GetResolverState() calls has no effect on the result diff --git a/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj b/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj index fff9e7796..1ca8a56b7 100644 --- a/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj +++ b/ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj @@ -1,4 +1,4 @@ - + {9C19E629-C93E-4ACB-9A4B-13072B5AEF9D} @@ -55,6 +55,9 @@ + + Properties\GlobalAssemblyInfo.cs + CSDemo.cs diff --git a/ICSharpCode.NRefactory.Demo/Properties/AssemblyInfo.cs b/ICSharpCode.NRefactory.Demo/Properties/AssemblyInfo.cs index 2027632f7..6ee3f9e88 100644 --- a/ICSharpCode.NRefactory.Demo/Properties/AssemblyInfo.cs +++ b/ICSharpCode.NRefactory.Demo/Properties/AssemblyInfo.cs @@ -10,22 +10,4 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ICSharpCode.NRefactory.Demo")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ICSharpCode.NRefactory.Demo")] -[assembly: AssemblyCopyright("Copyright 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all the values or you can use the default the Revision and -// Build Numbers by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyDescription("WinForms-based demo application for NRefactory")] diff --git a/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefParserTests.cs b/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefParserTests.cs index b848c4c23..505c7b83c 100644 --- a/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefParserTests.cs +++ b/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefParserTests.cs @@ -126,6 +126,17 @@ public void Generic() }); } + [Test] + public void MixedGeneric() + { + ParseUtilCSharp.AssertDocumentationReference( + "IGeneric class Test { }"); - Assert.AreEqual(" ", typeDefinition.Documentation.Xml); + Assert.AreEqual("", typeDefinition.Documentation.Xml); } [Test] - public void MultilineTypeDocumentationLookup() + public void TypeDocumentationLookup2() { Init(@"using System; /// /// Documentation /// class Test { }"); - Assert.AreEqual(" " + Environment.NewLine + " Documentation" + Environment.NewLine + " ", typeDefinition.Documentation.Xml); + Assert.AreEqual("" + Environment.NewLine + "Documentation" + Environment.NewLine + "", typeDefinition.Documentation.Xml); + } + + [Test] + public void TypeDocumentationLookupWithIndentation() + { + Init(@"using System; +/// +/// Documentation +/// +class Test { }"); + Assert.AreEqual("" + Environment.NewLine + " Documentation" + Environment.NewLine + "", typeDefinition.Documentation.Xml); + } + + [Test] + public void MultilineDocumentation() + { + Init(@"using System; +/** Documentation */ +class Test { }"); + Assert.AreEqual("Documentation", typeDefinition.Documentation.Xml); + } + + [Test] + public void MultilineDocumentation2() + { + Init(@"using System; +/** + + Documentation + +*/ +class Test { }"); + Assert.AreEqual("" + Environment.NewLine + " Documentation" + Environment.NewLine + "", typeDefinition.Documentation.Xml); + } + + [Test] + public void MultilineDocumentationCommonPattern() + { + Init(@"using System; +/** + * + * Documentation + * */ +class Test { }"); + Assert.AreEqual("" + Environment.NewLine + " Documentation" + Environment.NewLine + "", typeDefinition.Documentation.Xml); } } } diff --git a/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj b/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj index ef415a51a..6bc780251 100644 --- a/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj +++ b/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj @@ -76,6 +76,9 @@ + + Properties\GlobalAssemblyInfo.cs + diff --git a/ICSharpCode.NRefactory.Tests/Properties/AssemblyInfo.cs b/ICSharpCode.NRefactory.Tests/Properties/AssemblyInfo.cs index 4d1c47558..e4cbfb96b 100644 --- a/ICSharpCode.NRefactory.Tests/Properties/AssemblyInfo.cs +++ b/ICSharpCode.NRefactory.Tests/Properties/AssemblyInfo.cs @@ -10,20 +10,4 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ICSharpCode.NRefactory.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all the values or you can use the default the Revision and -// Build Numbers by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyDescription("NRefactory unit tests")] diff --git a/ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj b/ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj index f8ac60fb0..cc8a37d55 100644 --- a/ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj +++ b/ICSharpCode.NRefactory.VB/ICSharpCode.NRefactory.VB.csproj @@ -47,6 +47,9 @@ + + Properties\GlobalAssemblyInfo.cs + diff --git a/ICSharpCode.NRefactory.VB/Properties/AssemblyInfo.cs b/ICSharpCode.NRefactory.VB/Properties/AssemblyInfo.cs index a75d2a04f..98785222b 100644 --- a/ICSharpCode.NRefactory.VB/Properties/AssemblyInfo.cs +++ b/ICSharpCode.NRefactory.VB/Properties/AssemblyInfo.cs @@ -10,24 +10,4 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ICSharpCode.NRefactory.VB")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ICSharpCode.NRefactory.VB")] -[assembly: AssemblyCopyright("Copyright 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -//[assembly: CLSCompliant(true)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all the values or you can use the default the Revision and -// Build Numbers by using the '*' as shown below: -[assembly: AssemblyVersion("5.0.0.4")] +[assembly: AssemblyDescription("VB syntax tree")] diff --git a/ICSharpCode.NRefactory/Documentation/DocumentationComment.cs b/ICSharpCode.NRefactory/Documentation/DocumentationComment.cs index 9f4b8f176..44c9382c2 100644 --- a/ICSharpCode.NRefactory/Documentation/DocumentationComment.cs +++ b/ICSharpCode.NRefactory/Documentation/DocumentationComment.cs @@ -17,6 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.NRefactory.TypeSystem; namespace ICSharpCode.NRefactory.Documentation @@ -26,13 +27,13 @@ namespace ICSharpCode.NRefactory.Documentation /// public class DocumentationComment { - string xml; + ITextSource xml; protected readonly ITypeResolveContext context; /// /// Gets the XML code for this documentation comment. /// - public string Xml { + public ITextSource Xml { get { return xml; } } @@ -41,7 +42,7 @@ public string Xml { /// /// The XML text. /// Context for resolving cref attributes. - public DocumentationComment(string xml, ITypeResolveContext context) + public DocumentationComment(ITextSource xml, ITypeResolveContext context) { if (xml == null) throw new ArgumentNullException("xml"); @@ -51,6 +52,21 @@ public DocumentationComment(string xml, ITypeResolveContext context) this.context = context; } + /// + /// Creates a new DocumentationComment. + /// + /// The XML text. + /// Context for resolving cref attributes. + public DocumentationComment(string xml, ITypeResolveContext context) + { + if (xml == null) + throw new ArgumentNullException("xml"); + if (context == null) + throw new ArgumentNullException("context"); + this.xml = new StringTextSource(xml); + this.context = context; + } + /// /// Resolves the given cref value to an entity. /// Returns null if the entity is not found, or if the cref attribute is syntactically invalid. diff --git a/ICSharpCode.NRefactory/Documentation/XmlDocumentationProvider.cs b/ICSharpCode.NRefactory/Documentation/XmlDocumentationProvider.cs index ac62686ef..e28f2acf5 100644 --- a/ICSharpCode.NRefactory/Documentation/XmlDocumentationProvider.cs +++ b/ICSharpCode.NRefactory/Documentation/XmlDocumentationProvider.cs @@ -22,6 +22,7 @@ using System.IO; using System.Runtime.Serialization; using System.Xml; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem.Implementation; @@ -307,7 +308,7 @@ public DocumentationComment GetDocumentation(IEntity entity) { string xmlDoc = GetDocumentation(IDStringProvider.GetIDString(entity)); if (xmlDoc != null) { - return new DocumentationComment(xmlDoc, new SimpleTypeResolveContext(entity)); + return new DocumentationComment(new StringTextSource(xmlDoc), new SimpleTypeResolveContext(entity)); } else { return null; }