From 4b0a7506929d4e50e3c1293449b1988b466edbb7 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Sun, 12 Aug 2018 19:26:09 +0000 Subject: [PATCH 1/3] Update dependencies.props [auto-updated: dependencies] --- build/dependencies.props | 16 ++++++++-------- korebuild-lock.txt | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 4a9c30fb59..a81f4a3dec 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,20 +4,20 @@ 0.10.13 - 2.2.0-preview1-20180731.1 - 2.2.0-preview1-34896 - 2.2.0-preview1-34896 - 2.2.0-preview1-34896 + 2.2.0-preview1-20180807.2 + 2.2.0-preview1-34967 + 2.2.0-preview1-34967 + 2.2.0-preview1-34967 15.6.82 15.6.82 15.6.82 2.8.0 2.8.0 - 2.2.0-preview1-34896 - 2.2.0-preview1-34896 + 2.2.0-preview1-34967 + 2.2.0-preview1-34967 2.1.0 - 2.2.0-preview1-34896 - 2.2.0-preview1-34896 + 2.2.0-preview1-34967 + 2.2.0-preview1-34967 2.0.9 2.1.2 2.2.0-preview1-26618-02 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index b6efc7cfcb..29a57027f1 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.2.0-preview1-20180731.1 -commithash:29fde58465439f4bb9df40830635ed758e063daf +version:2.2.0-preview1-20180807.2 +commithash:11495dbd236104434e08cb1152fcb58cf2a20923 From 585e6cd3fe4b50a1f99b3aa74889c989485f3255 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Fri, 10 Aug 2018 23:23:15 -0700 Subject: [PATCH 2/3] Introduces a 'formatter' for formatting the IR The new Formatter is used in debugger display, to resolve #2264 The next iteration (assuming we like this) will be to replat our testing baseline infrastructure on top of this, and then start sharing that with Blazor - related to #2265. I found when implementing debugger display that I was duplicating a lot of details between testing and this. I also want to convert the Blazor tests to use shared infrastructure. Right now the Blazor tests use a modified version of the Razor infrastructure that has different features. --- Directory.Build.props | 1 + .../InjectIntermediateNode.cs | 8 + .../ViewComponentTagHelperIntermediateNode.cs | 8 + .../InjectIntermediateNode.cs | 9 +- .../ViewComponentTagHelperIntermediateNode.cs | 8 + .../DefaultTagHelperCreateIntermediateNode.cs | 9 + ...tTagHelperHtmlAttributeIntermediateNode.cs | 8 + ...efaultTagHelperPropertyIntermediateNode.cs | 13 ++ .../DesignTimeDirectiveIntermediateNode.cs | 1 + ...dTagHelperHtmlAttributeIntermediateNode.cs | 7 + ...elperHtmlAttributeValueIntermediateNode.cs | 10 + ...ocatedTagHelperPropertyIntermediateNode.cs | 14 ++ ...dTagHelperPropertyValueIntermediateNode.cs | 10 + ...orCompiledItemAttributeIntermediateNode.cs | 7 + ...edItemMetadataAttributeIntermediateNode.cs | 6 + .../Extensions/SectionIntermediateNode.cs | 7 + ...SharpCodeAttributeValueIntermediateNode.cs | 7 + .../CSharpCodeIntermediateNode.cs | 5 + ...xpressionAttributeValueIntermediateNode.cs | 7 + .../CSharpExpressionIntermediateNode.cs | 5 + .../ClassDeclarationIntermediateNode.cs | 12 ++ .../Intermediate/DebuggerDisplayFormatter.cs | 21 ++ .../Intermediate/DirectiveIntermediateNode.cs | 8 + .../DirectiveTokenIntermediateNode.cs | 9 + .../Intermediate/DocumentIntermediateNode.cs | 7 + .../FieldDeclarationIntermediateNode.cs | 9 + .../HtmlAttributeIntermediateNode.cs | 9 + .../HtmlAttributeValueIntermediateNode.cs | 7 + .../HtmlContentIntermediateNode.cs | 5 + .../Intermediate/IntermediateNode.cs | 28 ++- .../Intermediate/IntermediateNodeFormatter.cs | 16 ++ .../IntermediateNodeFormatterBase.cs | 180 ++++++++++++++++++ .../Intermediate/IntermediateToken.cs | 11 +- .../MalformedDirectiveIntermediateNode.cs | 8 + .../MethodDeclarationIntermediateNode.cs | 28 +++ .../NamespaceDeclarationIntermediateNode.cs | 7 + .../TagHelperHtmlAttributeIntermediateNode.cs | 8 + .../Intermediate/TagHelperIntermediateNode.cs | 9 + .../TagHelperPropertyIntermediateNode.cs | 11 ++ .../UsingDirectiveIntermediateNode.cs | 7 + 40 files changed, 545 insertions(+), 5 deletions(-) create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Intermediate/DebuggerDisplayFormatter.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNodeFormatter.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNodeFormatterBase.cs diff --git a/Directory.Build.props b/Directory.Build.props index 71517b7fe5..5e4bd6b937 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -18,6 +18,7 @@ true true Microsoft + 7.3 diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/InjectIntermediateNode.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/InjectIntermediateNode.cs index 4405aea120..8325c2b7a1 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/InjectIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/InjectIntermediateNode.cs @@ -47,5 +47,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X extension.WriteInjectProperty(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(MemberName); + + formatter.WriteProperty(nameof(MemberName), MemberName); + formatter.WriteProperty(nameof(TypeName), TypeName); + } } } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/ViewComponentTagHelperIntermediateNode.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/ViewComponentTagHelperIntermediateNode.cs index bfe937aaa8..b1399ffbea 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/ViewComponentTagHelperIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/ViewComponentTagHelperIntermediateNode.cs @@ -47,5 +47,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X extension.WriteViewComponentTagHelper(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(ClassName); + + formatter.WriteProperty(nameof(ClassName), ClassName); + formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName); + } } } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InjectIntermediateNode.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InjectIntermediateNode.cs index e1dfe9cf15..572d8bb1dc 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InjectIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InjectIntermediateNode.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.Language.Intermediate; @@ -47,5 +46,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions extension.WriteInjectProperty(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(MemberName); + + formatter.WriteProperty(nameof(MemberName), MemberName); + formatter.WriteProperty(nameof(TypeName), TypeName); + } } } diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ViewComponentTagHelperIntermediateNode.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ViewComponentTagHelperIntermediateNode.cs index 09b124970e..9283b2c092 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ViewComponentTagHelperIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ViewComponentTagHelperIntermediateNode.cs @@ -47,5 +47,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions extension.WriteViewComponentTagHelper(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(ClassName); + + formatter.WriteProperty(nameof(ClassName), ClassName); + formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperCreateIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperCreateIntermediateNode.cs index 92aa2e3038..0ef75f1b7a 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperCreateIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperCreateIntermediateNode.cs @@ -48,5 +48,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions extension.WriteTagHelperCreate(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(TypeName); + + formatter.WriteProperty(nameof(FieldName), FieldName); + formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName); + formatter.WriteProperty(nameof(TypeName), TypeName); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperHtmlAttributeIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperHtmlAttributeIntermediateNode.cs index 4122f66ef2..0290be8323 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperHtmlAttributeIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperHtmlAttributeIntermediateNode.cs @@ -72,5 +72,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions extension.WriteTagHelperHtmlAttribute(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(AttributeName); + + formatter.WriteProperty(nameof(AttributeName), AttributeName); + formatter.WriteProperty(nameof(AttributeStructure), AttributeStructure.ToString()); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperPropertyIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperPropertyIntermediateNode.cs index 083d84f32e..c0362f0d60 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperPropertyIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DefaultTagHelperPropertyIntermediateNode.cs @@ -85,5 +85,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions extension.WriteTagHelperProperty(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(AttributeName); + + formatter.WriteProperty(nameof(AttributeName), AttributeName); + formatter.WriteProperty(nameof(AttributeStructure), AttributeStructure.ToString()); + formatter.WriteProperty(nameof(BoundAttribute), BoundAttribute?.DisplayName); + formatter.WriteProperty(nameof(FieldName), FieldName); + formatter.WriteProperty(nameof(IsIndexerNameMatch), IsIndexerNameMatch.ToString()); + formatter.WriteProperty(nameof(PropertyName), PropertyName); + formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectiveIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectiveIntermediateNode.cs index ef1e971584..957e73a17d 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectiveIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectiveIntermediateNode.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Text; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.Language.Intermediate; diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperHtmlAttributeIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperHtmlAttributeIntermediateNode.cs index 11501c1a26..70a9c61fa6 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperHtmlAttributeIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperHtmlAttributeIntermediateNode.cs @@ -44,5 +44,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions extension.WriteTagHelperHtmlAttribute(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(VariableName); + + formatter.WriteProperty(nameof(VariableName), VariableName); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperHtmlAttributeValueIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperHtmlAttributeValueIntermediateNode.cs index 03bb175094..5faed5344b 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperHtmlAttributeValueIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperHtmlAttributeValueIntermediateNode.cs @@ -74,5 +74,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions extension.WriteTagHelperHtmlAttributeValue(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(AttributeName); + + formatter.WriteProperty(nameof(AttributeName), AttributeName); + formatter.WriteProperty(nameof(AttributeStructure), AttributeStructure.ToString()); + formatter.WriteProperty(nameof(Value), Value); + formatter.WriteProperty(nameof(VariableName), VariableName); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperPropertyIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperPropertyIntermediateNode.cs index d062328cb3..7db273a1d6 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperPropertyIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperPropertyIntermediateNode.cs @@ -79,5 +79,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions extension.WriteTagHelperProperty(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(AttributeName); + + formatter.WriteProperty(nameof(AttributeName), AttributeName); + formatter.WriteProperty(nameof(AttributeStructure), AttributeStructure.ToString()); + formatter.WriteProperty(nameof(BoundAttribute), BoundAttribute?.DisplayName); + formatter.WriteProperty(nameof(FieldName), FieldName); + formatter.WriteProperty(nameof(IsIndexerNameMatch), IsIndexerNameMatch.ToString()); + formatter.WriteProperty(nameof(PropertyName), PropertyName); + formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName); + formatter.WriteProperty(nameof(VariableName), VariableName); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperPropertyValueIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperPropertyValueIntermediateNode.cs index d769905ff4..6516a22133 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperPropertyValueIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/PreallocatedTagHelperPropertyValueIntermediateNode.cs @@ -50,5 +50,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions extension.WriteTagHelperPropertyValue(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(AttributeName); + + formatter.WriteProperty(nameof(AttributeName), AttributeName); + formatter.WriteProperty(nameof(AttributeStructure), AttributeStructure.ToString()); + formatter.WriteProperty(nameof(Value), Value); + formatter.WriteProperty(nameof(VariableName), VariableName); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/RazorCompiledItemAttributeIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/RazorCompiledItemAttributeIntermediateNode.cs index 792fb4ecc1..ee82fca81a 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/RazorCompiledItemAttributeIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/RazorCompiledItemAttributeIntermediateNode.cs @@ -48,5 +48,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions extension.WriteRazorCompiledItemAttribute(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteProperty(nameof(Identifier), Identifier); + formatter.WriteProperty(nameof(Kind), Kind); + formatter.WriteProperty(nameof(TypeName), TypeName); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/RazorCompiledItemMetadataAttributeIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/RazorCompiledItemMetadataAttributeIntermediateNode.cs index 0c05523028..52f7b92012 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/RazorCompiledItemMetadataAttributeIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/RazorCompiledItemMetadataAttributeIntermediateNode.cs @@ -55,5 +55,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions extension.WriteRazorCompiledItemMetadataAttribute(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteProperty(nameof(Key), Key); + formatter.WriteProperty(nameof(Value), Value); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/SectionIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/SectionIntermediateNode.cs index 7076e3df06..d3d4c10557 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/SectionIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/SectionIntermediateNode.cs @@ -44,5 +44,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions extension.WriteSection(context, this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(SectionName); + + formatter.WriteProperty(nameof(SectionName), SectionName); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpCodeAttributeValueIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpCodeAttributeValueIntermediateNode.cs index 23eff1efda..4a9ce5d1a9 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpCodeAttributeValueIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpCodeAttributeValueIntermediateNode.cs @@ -20,5 +20,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitCSharpCodeAttributeValue(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteChildren(Children); + + formatter.WriteProperty(nameof(Prefix), Prefix); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpCodeIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpCodeIntermediateNode.cs index f15ce8b067..f888a561f8 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpCodeIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpCodeIntermediateNode.cs @@ -18,5 +18,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitCSharpCode(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteChildren(Children); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpExpressionAttributeValueIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpExpressionAttributeValueIntermediateNode.cs index 6cc7a837e4..c058b67acc 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpExpressionAttributeValueIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpExpressionAttributeValueIntermediateNode.cs @@ -20,5 +20,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitCSharpExpressionAttributeValue(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteChildren(Children); + + formatter.WriteProperty(nameof(Prefix), Prefix); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpExpressionIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpExpressionIntermediateNode.cs index 42b25a8df3..c4c9e02962 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpExpressionIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/CSharpExpressionIntermediateNode.cs @@ -18,5 +18,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitCSharpExpression(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteChildren(Children); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/ClassDeclarationIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/ClassDeclarationIntermediateNode.cs index cf923eb429..ea178228c3 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/ClassDeclarationIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/ClassDeclarationIntermediateNode.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Microsoft.AspNetCore.Razor.Language.Intermediate { @@ -29,5 +30,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitClassDeclaration(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(ClassName); + + formatter.WriteProperty(nameof(BaseType), BaseType); + formatter.WriteProperty(nameof(ClassName), ClassName); + formatter.WriteProperty(nameof(Interfaces), string.Join(", ", Interfaces)); + formatter.WriteProperty(nameof(Modifiers), string.Join(", ", Modifiers)); + formatter.WriteProperty(nameof(TypeParameters), string.Join(", ", TypeParameters.Select(t => t.ParameterName))); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DebuggerDisplayFormatter.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DebuggerDisplayFormatter.cs new file mode 100644 index 0000000000..705148b8ab --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DebuggerDisplayFormatter.cs @@ -0,0 +1,21 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.IO; + +namespace Microsoft.AspNetCore.Razor.Language.Intermediate +{ + internal class DebuggerDisplayFormatter : IntermediateNodeFormatterBase + { + public DebuggerDisplayFormatter() + { + Writer = new StringWriter(); + ContentMode = FormatterContentMode.PreferContent; + } + + public override string ToString() + { + return Writer.ToString(); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DirectiveIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DirectiveIntermediateNode.cs index abb3a933de..6f954a89f8 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DirectiveIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DirectiveIntermediateNode.cs @@ -20,5 +20,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate { visitor.VisitDirective(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(DirectiveName); + + formatter.WriteProperty(nameof(Directive), Directive?.DisplayName); + formatter.WriteProperty(nameof(DirectiveName), DirectiveName); + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DirectiveTokenIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DirectiveTokenIntermediateNode.cs index 7db3769a08..a01ed25b80 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DirectiveTokenIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DirectiveTokenIntermediateNode.cs @@ -1,6 +1,8 @@ // Copyright(c) .NET Foundation.All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System.Text; + namespace Microsoft.AspNetCore.Razor.Language.Intermediate { public sealed class DirectiveTokenIntermediateNode : IntermediateNode @@ -15,5 +17,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate { visitor.VisitDirectiveToken(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(Content); + + formatter.WriteProperty(nameof(Content), Content); + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DocumentIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DocumentIntermediateNode.cs index af071a7488..9570092e46 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DocumentIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/DocumentIntermediateNode.cs @@ -25,5 +25,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitDocument(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(DocumentKind); + + formatter.WriteProperty(nameof(DocumentKind), DocumentKind); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/FieldDeclarationIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/FieldDeclarationIntermediateNode.cs index 6719f0768e..0d6b731390 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/FieldDeclarationIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/FieldDeclarationIntermediateNode.cs @@ -25,5 +25,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitFieldDeclaration(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(FieldName); + + formatter.WriteProperty(nameof(FieldName), FieldName); + formatter.WriteProperty(nameof(FieldType), FieldType); + formatter.WriteProperty(nameof(Modifiers), string.Join(" ", Modifiers)); + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlAttributeIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlAttributeIntermediateNode.cs index 46f772fce9..861b14b227 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlAttributeIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlAttributeIntermediateNode.cs @@ -24,5 +24,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitHtmlAttribute(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(AttributeName); + + formatter.WriteProperty(nameof(AttributeName), AttributeName); + formatter.WriteProperty(nameof(Prefix), Prefix); + formatter.WriteProperty(nameof(Suffix), Suffix); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlAttributeValueIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlAttributeValueIntermediateNode.cs index d22eaa78aa..6fdc5247a3 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlAttributeValueIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlAttributeValueIntermediateNode.cs @@ -20,5 +20,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitHtmlAttributeValue(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteChildren(Children); + + formatter.WriteProperty(nameof(Prefix), Prefix); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlContentIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlContentIntermediateNode.cs index d41b8a6a47..3a213fe460 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlContentIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/HtmlContentIntermediateNode.cs @@ -18,5 +18,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitHtml(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteChildren(Children); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNode.cs index f8970d23f6..02c2976c55 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNode.cs @@ -1,8 +1,11 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System.Diagnostics; + namespace Microsoft.AspNetCore.Razor.Language.Intermediate { + [DebuggerDisplay("{DebuggerToString(),nq}")] public abstract class IntermediateNode { private ItemCollection _annotations; @@ -39,7 +42,30 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate public bool HasDiagnostics => _diagnostics != null && _diagnostics.Count > 0; public SourceSpan? Source { get; set; } - + public abstract void Accept(IntermediateNodeVisitor visitor); + + [DebuggerBrowsable(DebuggerBrowsableState.Collapsed)] + private string Tree + { + get + { + var formatter = new DebuggerDisplayFormatter(); + formatter.FormatTree(this); + return formatter.ToString(); + } + } + + private string DebuggerToString() + { + var formatter = new DebuggerDisplayFormatter(); + formatter.FormatNode(this); + return formatter.ToString(); + } + + + public virtual void FormatNode(IntermediateNodeFormatter formatter) + { + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNodeFormatter.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNodeFormatter.cs new file mode 100644 index 0000000000..c453dbe6e9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNodeFormatter.cs @@ -0,0 +1,16 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; + +namespace Microsoft.AspNetCore.Razor.Language.Intermediate +{ + public abstract class IntermediateNodeFormatter + { + public abstract void WriteChildren(IntermediateNodeCollection children); + + public abstract void WriteContent(string content); + + public abstract void WriteProperty(string key, string value); + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNodeFormatterBase.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNodeFormatterBase.cs new file mode 100644 index 0000000000..54846acaaf --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateNodeFormatterBase.cs @@ -0,0 +1,180 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace Microsoft.AspNetCore.Razor.Language.Intermediate +{ + internal class IntermediateNodeFormatterBase : IntermediateNodeFormatter + { + private string _content; + private Dictionary _properties = new Dictionary(StringComparer.Ordinal); + + protected FormatterContentMode ContentMode { get; set; } + + protected bool IncludeSource { get; set; } + + protected TextWriter Writer { get; set; } + + public override void WriteChildren(IntermediateNodeCollection children) + { + if (children == null) + { + throw new ArgumentNullException(nameof(children)); + } + + Writer.Write(" "); + Writer.Write("\""); + for (var i = 0; i < children.Count; i++) + { + var child = children[i] as IntermediateToken; + if (child != null) + { + Writer.Write(EscapeNewlines(child.Content)); + } + } + Writer.Write("\""); + } + + public override void WriteContent(string content) + { + if (content == null) + { + return; + } + + _content = EscapeNewlines(content); + } + + public override void WriteProperty(string key, string value) + { + if (key == null) + { + throw new ArgumentNullException(nameof(key)); + } + + if (value == null) + { + return; + } + + _properties.Add(key, EscapeNewlines(value)); + } + + public void FormatNode(IntermediateNode node) + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + BeginNode(node); + node.FormatNode(this); + EndNode(node); + } + + public void FormatTree(IntermediateNode node) + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + var visitor = new FormatterVisitor(this); + visitor.Visit(node); + } + + private void BeginNode(IntermediateNode node) + { + Writer.Write(GetShortName(node)); + + if (IncludeSource) + { + Writer.Write(" "); + Writer.Write(node.Source?.ToString() ?? "(n/a)"); + } + } + + private void EndNode(IntermediateNode node) + { + if (_content != null && (_properties.Count == 0 || ContentMode == FormatterContentMode.PreferContent)) + { + Writer.Write(" "); + Writer.Write("\""); + Writer.Write(EscapeNewlines(_content)); + Writer.Write("\""); + } + + if (_properties.Count > 0 && (_content == null || ContentMode == FormatterContentMode.PreferProperties)) + { + Writer.Write(" "); + Writer.Write("{ "); + Writer.Write(string.Join(", ", _properties.Select(kvp => $"{kvp.Key}: \"{kvp.Value}\""))); + Writer.Write(" }"); + } + + _content = null; + _properties.Clear(); + } + + private string GetShortName(IntermediateNode node) + { + var typeName = node.GetType().Name; + return + typeName.EndsWith(nameof(IntermediateNode), StringComparison.Ordinal) ? + typeName.Substring(0, typeName.Length - nameof(IntermediateNode).Length) : + typeName; + } + + private string EscapeNewlines(string content) + { + return content.Replace("\r", "\\r").Replace("\n", "\\n").Replace("\t", "\\t"); + } + + // Depending on the usage of the formatter we might prefer thoroughness (properties) + // or brevity (content). Generally if a node has a single string that provides value + // it has content. + // + // Some nodes have neither: TagHelperBody + // Some nodes have content: HtmlContent + // Some nodes have properties: Document + // Some nodes have both: TagHelperProperty + protected enum FormatterContentMode + { + PreferContent, + PreferProperties, + } + + protected class FormatterVisitor : IntermediateNodeWalker + { + private const int IndentSize = 2; + + private readonly IntermediateNodeFormatterBase _formatter; + private int _indent = 0; + + public FormatterVisitor(IntermediateNodeFormatterBase formatter) + { + _formatter = formatter; + } + + public override void VisitDefault(IntermediateNode node) + { + // Indent + for (var i = 0; i < _indent; i++) + { + _formatter.Writer.Write(' '); + } + _formatter.FormatNode(node); + _formatter.Writer.WriteLine(); + + // Process children + _indent += IndentSize; + base.VisitDefault(node); + _indent -= IndentSize; + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateToken.cs index d2da5fae18..d60643d24a 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateToken.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/IntermediateToken.cs @@ -26,7 +26,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitToken(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(Content); + + formatter.WriteProperty(nameof(Content), Content); + } } -} - - +} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/MalformedDirectiveIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/MalformedDirectiveIntermediateNode.cs index 22d23927ca..d37a2316a5 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/MalformedDirectiveIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/MalformedDirectiveIntermediateNode.cs @@ -20,5 +20,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate { visitor.VisitMalformedDirective(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(DirectiveName); + + formatter.WriteProperty(nameof(Directive), Directive?.DisplayName); + formatter.WriteProperty(nameof(DirectiveName), DirectiveName); + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/MethodDeclarationIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/MethodDeclarationIntermediateNode.cs index e1a039c5e0..ad15636824 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/MethodDeclarationIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/MethodDeclarationIntermediateNode.cs @@ -3,6 +3,8 @@ using System; using System.Collections.Generic; +using System.Linq; +using System.Text; namespace Microsoft.AspNetCore.Razor.Language.Intermediate { @@ -28,5 +30,31 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitMethodDeclaration(this); } + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(MethodName); + + formatter.WriteProperty(nameof(MethodName), MethodName); + formatter.WriteProperty(nameof(Modifiers), string.Join(", ", Modifiers)); + formatter.WriteProperty(nameof(Parameters), string.Join(", ", Parameters.Select(FormatMethodParameter))); + formatter.WriteProperty(nameof(ReturnType), ReturnType); + } + + private static string FormatMethodParameter(MethodParameter parameter) + { + var builder = new StringBuilder(); + for (var i = 0; i t.DisplayName))); + formatter.WriteProperty(nameof(TagMode), TagMode.ToString()); + formatter.WriteProperty(nameof(TagName), TagName); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/TagHelperPropertyIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/TagHelperPropertyIntermediateNode.cs index 073571b185..1a755fe6f9 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/TagHelperPropertyIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/TagHelperPropertyIntermediateNode.cs @@ -28,5 +28,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitTagHelperProperty(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(AttributeName); + + formatter.WriteProperty(nameof(AttributeName), AttributeName); + formatter.WriteProperty(nameof(AttributeStructure), AttributeStructure.ToString()); + formatter.WriteProperty(nameof(BoundAttribute), BoundAttribute?.DisplayName); + formatter.WriteProperty(nameof(IsIndexerNameMatch), IsIndexerNameMatch.ToString()); + formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName); + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/UsingDirectiveIntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/UsingDirectiveIntermediateNode.cs index 4199c95e97..67c64f79e7 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Intermediate/UsingDirectiveIntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Intermediate/UsingDirectiveIntermediateNode.cs @@ -20,5 +20,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate visitor.VisitUsingDirective(this); } + + public override void FormatNode(IntermediateNodeFormatter formatter) + { + formatter.WriteContent(Content); + + formatter.WriteProperty(nameof(Content), Content); + } } } From 04e58d6ee4d304b2f9ba5773c9a84a6925ca87fe Mon Sep 17 00:00:00 2001 From: Marcin Burak Date: Tue, 14 Aug 2018 11:00:41 +0200 Subject: [PATCH 3/3] Changed /* */ style comments to // style comments --- .../InstrumentationPass.cs | 4 +-- .../Legacy/HtmlMarkupParser.cs | 27 +++++++++---------- .../RazorDiagnosticFactory.cs | 24 +++++------------ 3 files changed, 21 insertions(+), 34 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InstrumentationPass.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InstrumentationPass.cs index 1ae0a72210..d80c2b9b68 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InstrumentationPass.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/InstrumentationPass.cs @@ -33,8 +33,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions private static void AddInstrumentation(InstrumentationItem item) { - var beginContextMethodName = "BeginContext"; /* ORIGINAL: BeginContextMethodName */ - var endContextMethodName = "EndContext"; /* ORIGINAL: EndContextMethodName */ + var beginContextMethodName = "BeginContext"; // ORIGINAL: BeginContextMethodName + var endContextMethodName = "EndContext"; // ORIGINAL: EndContextMethodName var beginNode = new CSharpCodeIntermediateNode(); beginNode.Children.Add(new IntermediateToken() diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs index cbf0c1021a..2408c552dd 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs @@ -582,21 +582,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy protected bool IsHtmlCommentAhead() { - /* - * From HTML5 Specification, available at http://www.w3.org/TR/html52/syntax.html#comments - * - * Comments must have the following format: - * 1. The string "" // As we will be treating this as a comment ending, there is no need to handle this case at all. - * 2.2.3 "--!>" - * 2.3 nor end with the string "" - * - * */ + // From HTML5 Specification, available at http://www.w3.org/TR/html52/syntax.html#comments + + // Comments must have the following format: + // 1. The string "" As we will be treating this as a comment ending, there is no need to handle this case at all. + // 2.2.3 "--!>" + // 2.3 nor end with the string "" if (CurrentToken.Type != HtmlTokenType.DoubleHyphen) { diff --git a/src/Microsoft.CodeAnalysis.Razor/RazorDiagnosticFactory.cs b/src/Microsoft.CodeAnalysis.Razor/RazorDiagnosticFactory.cs index 12fa708189..55705b5eac 100644 --- a/src/Microsoft.CodeAnalysis.Razor/RazorDiagnosticFactory.cs +++ b/src/Microsoft.CodeAnalysis.Razor/RazorDiagnosticFactory.cs @@ -9,40 +9,30 @@ namespace Microsoft.CodeAnalysis.Razor { private const string DiagnosticPrefix = "RZ"; - /* - * Razor.Language starts at 0, 1000, 2000, 3000. Therefore, we should offset by 500 to ensure we can easily - * maintain this list of diagnostic descriptors in conjunction with the one in Razor.Language. - */ - + // Razor.Language starts at 0, 1000, 2000, 3000. Therefore, we should offset by 500 to ensure we can easily + // maintain this list of diagnostic descriptors in conjunction with the one in Razor.Language. + #region General Errors - /* - * General Errors ID Offset = 500 - */ + // General Errors ID Offset = 500 #endregion #region Language Errors - /* - * Language Errors ID Offset = 1500 - */ + // Language Errors ID Offset = 1500 #endregion #region Semantic Errors - /* - * Semantic Errors ID Offset = 2500 - */ + // Semantic Errors ID Offset = 2500 #endregion #region TagHelper Errors - /* - * TagHelper Errors ID Offset = 3500 - */ + // TagHelper Errors ID Offset = 3500 internal static readonly RazorDiagnosticDescriptor TagHelper_InvalidAttributeNameNullOrEmpty = new RazorDiagnosticDescriptor(