diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.cspans.txt index 04c285faf65..be4de9bffad 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.cspans.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.cspans.txt @@ -1,4 +1,3 @@ Code span at (13:0,13 [4] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (13:0,13 [9] ) -Code span at (17:0,17 [1] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (17:0,17 [5] ) -Code span at (18:0,18 [4] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (17:0,17 [5] ) +Code span at (17:0,17 [5] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (17:0,17 [5] ) Code span at (22:0,22 [2] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (13:0,13 [11] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.stree.txt index b5ee3f29fa3..1463d4b1d7b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.stree.txt @@ -22,10 +22,8 @@ Transition;[]; CSharpImplicitExpressionBody - [17..22)::5 CSharpCodeBlock - [17..22)::5 - CSharpExpressionLiteral - [17..18)::1 - [@] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 - Transition;[@]; - CSharpExpressionLiteral - [18..22)::4 - [true] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 - Keyword;[true]; + CSharpExpressionLiteral - [17..22)::5 - [@true] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 + Keyword;[@true]; CSharpExpressionLiteral - [22..24)::2 - [ ] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 Whitespace;[ ]; MarkupTextLiteral - [24..25)::1 - ['] - Gen - SpanEditHandler;Accepts:Any diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.cspans.txt index bb3ae2834eb..976c481ed1c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.cspans.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.cspans.txt @@ -1,3 +1,2 @@ Code span at (13:0,13 [1] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (13:0,13 [19] ) -Code span at (14:0,14 [1] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (14:0,14 [18] ) -Code span at (15:0,15 [17] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (14:0,14 [18] ) +Code span at (14:0,14 [18] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (14:0,14 [18] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.stree.txt index bb6abb04d25..a118e4058c0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.stree.txt @@ -22,10 +22,8 @@ Transition;[]; CSharpImplicitExpressionBody - [14..32)::18 CSharpCodeBlock - [14..32)::18 - CSharpExpressionLiteral - [14..15)::1 - [@] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 - Transition;[@]; - CSharpExpressionLiteral - [15..32)::17 - [DateTime.Now.Year] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 - Identifier;[DateTime]; + CSharpExpressionLiteral - [14..32)::18 - [@DateTime.Now.Year] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 + Identifier;[@DateTime]; Dot;[.]; Identifier;[Now]; Dot;[.]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.cspans.txt index c6c5eef25aa..e1e6c02b4c8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.cspans.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.cspans.txt @@ -1,18 +1,15 @@ Code span at (13:0,13 [1] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (13:0,13 [14] ) Code span at (14:0,14 [2] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (13:0,13 [14] ) Code span at (16:0,16 [1] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (16:0,16 [7] ) -Code span at (17:0,17 [1] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (17:0,17 [6] ) -Code span at (18:0,18 [5] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (17:0,17 [6] ) +Code span at (17:0,17 [6] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (17:0,17 [6] ) Code span at (23:0,23 [2] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (13:0,13 [14] ) Code span at (25:0,25 [2] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (13:0,13 [14] ) Code span at (39:0,39 [6] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (39:0,39 [46] ) -Code span at (45:0,45 [1] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (45:0,45 [11] ) -Code span at (46:0,46 [10] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (45:0,45 [11] ) +Code span at (45:0,45 [11] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (45:0,45 [11] ) Code span at (56:0,56 [2] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (39:0,39 [46] ) Code span at (58:0,58 [2] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (58:0,58 [3] ) Code span at (60:0,60 [1] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (58:0,58 [3] ) Code span at (61:0,61 [8] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (39:0,39 [46] ) Code span at (69:0,69 [2] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (39:0,39 [46] ) Code span at (71:0,71 [1] ) (Accepts:AnyExceptNewline) - Parent: Markup block at (71:0,71 [14] ) -Code span at (72:0,72 [1] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (72:0,72 [13] ) -Code span at (73:0,73 [12] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (72:0,72 [13] ) +Code span at (72:0,72 [13] ) (Accepts:AnyExceptNewline) - Parent: Expression block at (72:0,72 [13] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.stree.txt index 60c2c0b4118..a8f30e2e75e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.stree.txt @@ -27,10 +27,8 @@ Transition;[]; CSharpImplicitExpressionBody - [17..23)::6 CSharpCodeBlock - [17..23)::6 - CSharpExpressionLiteral - [17..18)::1 - [@] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 - Transition;[@]; - CSharpExpressionLiteral - [18..23)::5 - [value] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 - Identifier;[value]; + CSharpExpressionLiteral - [17..23)::6 - [@value] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 + Identifier;[@value]; CSharpExpressionLiteral - [23..25)::2 - [ +] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 Whitespace;[ ]; Text;[+]; @@ -57,10 +55,8 @@ Transition;[]; CSharpImplicitExpressionBody - [45..56)::11 CSharpCodeBlock - [45..56)::11 - CSharpExpressionLiteral - [45..46)::1 - [@] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 - Transition;[@]; - CSharpExpressionLiteral - [46..56)::10 - [Bag["val"]] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 - Identifier;[Bag]; + CSharpExpressionLiteral - [45..56)::11 - [@Bag["val"]] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 + Identifier;[@Bag]; LeftBracket;[[]; StringLiteral;["val"]; RightBracket;[]]; @@ -87,10 +83,8 @@ Transition;[]; CSharpImplicitExpressionBody - [72..85)::13 CSharpCodeBlock - [72..85)::13 - CSharpExpressionLiteral - [72..73)::1 - [@] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 - Transition;[@]; - CSharpExpressionLiteral - [73..85)::12 - [DateTime.Now] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 - Identifier;[DateTime]; + CSharpExpressionLiteral - [72..85)::13 - [@DateTime.Now] - Gen - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15 + Identifier;[@DateTime]; Dot;[.]; Identifier;[Now]; MarkupTextLiteral - [85..86)::1 - ['] - Gen - SpanEditHandler;Accepts:Any diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs index 10a38aed0b9..b154ab5ad1b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -9,6 +9,7 @@ using System.Runtime.CompilerServices; using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Test.Common; +using Roslyn.Test.Utilities; namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests; @@ -255,6 +256,9 @@ public class CodeGenerationIntegrationTest(bool designTime = false) [IntegrationTestFact] public void AddTagHelperDirective() => RunTest(); + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10186")] + public void EscapedIdentifier() => RunTagHelpersTest(TestTagHelperDescriptors.SimpleTagHelperDescriptors); + public override string GetTestFileName(string testName) { return base.GetTestFileName(testName) + (designTime ? "_DesignTime" : "_Runtime"); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TagHelperBlockRewriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TagHelperBlockRewriterTest.cs index a62c56279c8..710c9d28c75 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TagHelperBlockRewriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TagHelperBlockRewriterTest.cs @@ -8,6 +8,7 @@ using System.Collections.Immutable; using System.Globalization; using Microsoft.AspNetCore.Razor.Language.Components; +using Roslyn.Test.Utilities; using Xunit; using static Microsoft.AspNetCore.Razor.Language.CommonMetadata; @@ -555,6 +556,83 @@ public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes12() EvaluateData(CodeTagHelperAttributes_Descriptors, ""); } + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes13() + { + EvaluateData(CodeTagHelperAttributes_Descriptors, """ + @{ + var count = "1"; + } + + """); + } + + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes14() + { + EvaluateData(CodeTagHelperAttributes_Descriptors, """ + @{ + var @string = "1"; + } + + """); + } + + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes15() + { + EvaluateData(CodeTagHelperAttributes_Descriptors, """ + @{ + var count = "1"; + } + + """); + } + + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes16() + { + EvaluateData(CodeTagHelperAttributes_Descriptors, """ + @{ + var count = "1"; + } + + """); + } + + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes17() + { + EvaluateData(CodeTagHelperAttributes_Descriptors, """ + @{ + var count = 1; + } + + """); + } + + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes18() + { + EvaluateData(CodeTagHelperAttributes_Descriptors, """ + @{ + var count = 1; + } + + """); + } + + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes19() + { + EvaluateData(CodeTagHelperAttributes_Descriptors, """ + @{ + var count = 1; + } + + """); + } + [Fact] public void TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper1() { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt index 75f2323857f..49ef9b53415 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt @@ -217,8 +217,7 @@ LazyIntermediateToken - (933:25,21 [2] ComplexTagHelpers.cshtml) - CSharp - + LazyIntermediateToken - (935:25,23 [1] ComplexTagHelpers.cshtml) - CSharp - CSharpExpression - (936:25,24 [24] ComplexTagHelpers.cshtml) - LazyIntermediateToken - (936:25,24 [1] ComplexTagHelpers.cshtml) - CSharp - @ - LazyIntermediateToken - (937:25,25 [23] ComplexTagHelpers.cshtml) - CSharp - DateTimeOffset.Now.Year + LazyIntermediateToken - (936:25,24 [24] ComplexTagHelpers.cshtml) - CSharp - @DateTimeOffset.Now.Year DefaultTagHelperExecute - HtmlContent - (1075:27,12 [10] ComplexTagHelpers.cshtml) LazyIntermediateToken - (1075:27,12 [10] ComplexTagHelpers.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt index 69b2fcd869c..1753f191cb9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt @@ -189,15 +189,10 @@ Source Location: (935:25,23 [1] TestFiles/IntegrationTests/CodeGenerationIntegra Generated Location: (9254:213,40 [1] ) | | -Source Location: (936:25,24 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) -|@| -Generated Location: (9255:213,41 [1] ) -|@| - -Source Location: (937:25,25 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) -|DateTimeOffset.Now.Year| -Generated Location: (9256:213,42 [23] ) -|DateTimeOffset.Now.Year| +Source Location: (936:25,24 [24] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) +|@DateTimeOffset.Now.Year| +Generated Location: (9255:213,41 [24] ) +|@DateTimeOffset.Now.Year| Source Location: (1155:29,28 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year > 2014| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs index 7ddd0b5bbed..576e3cb9927 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs @@ -493,15 +493,8 @@ public async System.Threading.Tasks.Task ExecuteAsync() #line hidden #nullable disable #nullable restore -#line (26,25)-(26,26) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" -@ - -#line default -#line hidden -#nullable disable -#nullable restore -#line (26,26)-(26,49) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" -DateTimeOffset.Now.Year +#line (26,25)-(26,49) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +@DateTimeOffset.Now.Year #line default #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt index f85ae9b9afa..6ec69ab733c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt @@ -218,8 +218,7 @@ LazyIntermediateToken - (933:25,21 [2] ComplexTagHelpers.cshtml) - CSharp - + LazyIntermediateToken - (935:25,23 [1] ComplexTagHelpers.cshtml) - CSharp - CSharpExpression - (936:25,24 [24] ComplexTagHelpers.cshtml) - LazyIntermediateToken - (936:25,24 [1] ComplexTagHelpers.cshtml) - CSharp - @ - LazyIntermediateToken - (937:25,25 [23] ComplexTagHelpers.cshtml) - CSharp - DateTimeOffset.Now.Year + LazyIntermediateToken - (936:25,24 [24] ComplexTagHelpers.cshtml) - CSharp - @DateTimeOffset.Now.Year DefaultTagHelperExecute - HtmlContent - (1075:27,12 [10] ComplexTagHelpers.cshtml) LazyIntermediateToken - (1075:27,12 [10] ComplexTagHelpers.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml new file mode 100644 index 00000000000..63881d007d3 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml @@ -0,0 +1,6 @@ +@addTagHelper "*, TestAssembly" + +@{ + var count = "1"; +} + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs new file mode 100644 index 00000000000..4ae6d9ea6bf --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs @@ -0,0 +1,55 @@ +// +#pragma warning disable 1591 +namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles +{ + #line hidden + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier_DesignTime + { + #line hidden + #pragma warning disable 0649 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext; + #pragma warning restore 0649 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::InputTagHelper __InputTagHelper; + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((global::System.Action)(() => { +#nullable restore +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml" +global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#nullable restore +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml" + + var count = "1"; + +#line default +#line hidden +#nullable disable + __InputTagHelper = CreateTagHelper(); +#nullable restore +#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml" +__InputTagHelper.AgeProp = Convert.ToInt32(@count); + +#line default +#line hidden +#nullable disable + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + } + #pragma warning restore 1998 + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html new file mode 100644 index 00000000000..6c2660fba59 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html @@ -0,0 +1,6 @@ +~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ + +~~ + ~~~ ~~~~~ ~ ~~~~ +~ + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.html.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.html.mappings.txt new file mode 100644 index 00000000000..9de1e59b353 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.html.mappings.txt @@ -0,0 +1,28 @@ +Source Location: (13:0,13 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) +| | +Generated Location: (13:0,13 [1] ) +| | + +Source Location: (31:0,31 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) +| + +| +Generated Location: (31:0,31 [4] ) +| + +| + +Source Location: (62:4,1 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) +| + +| +Generated Location: (99:5,35 [6] ) +|" /> +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt new file mode 100644 index 00000000000..67b3ed6b587 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt @@ -0,0 +1,29 @@ +Document - + NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier_DesignTime - - + DefaultTagHelperRuntime - + FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper + DesignTimeDirective - + DirectiveToken - (14:0,14 [17] EscapedIdentifier.cshtml) - "*, TestAssembly" + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync + HtmlContent - (31:0,31 [4] EscapedIdentifier.cshtml) + LazyIntermediateToken - (31:0,31 [4] EscapedIdentifier.cshtml) - Html - \n\n + CSharpCode - (37:2,2 [24] EscapedIdentifier.cshtml) + LazyIntermediateToken - (37:2,2 [24] EscapedIdentifier.cshtml) - CSharp - \n var count = "1";\n + TagHelper - (64:5,0 [39] EscapedIdentifier.cshtml) - input - TagMode.SelfClosing + DefaultTagHelperBody - + DefaultTagHelperCreate - - InputTagHelper + DefaultTagHelperProperty - (76:5,12 [23] EscapedIdentifier.cshtml) - age - int InputTagHelper.AgeProp - HtmlAttributeValueStyle.DoubleQuotes + LazyIntermediateToken - (76:5,12 [16] EscapedIdentifier.cshtml) - CSharp - Convert.ToInt32( + CSharpExpression - (92:5,28 [6] EscapedIdentifier.cshtml) + LazyIntermediateToken - (92:5,28 [6] EscapedIdentifier.cshtml) - CSharp - @count + LazyIntermediateToken - (98:5,34 [1] EscapedIdentifier.cshtml) - CSharp - ) + DefaultTagHelperExecute - + HtmlContent - (103:5,39 [2] EscapedIdentifier.cshtml) + LazyIntermediateToken - (103:5,39 [2] EscapedIdentifier.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt new file mode 100644 index 00000000000..797b371ec92 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt @@ -0,0 +1,29 @@ +Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) +|"*, TestAssembly"| +Generated Location: (1009:18,37 [17] ) +|"*, TestAssembly"| + +Source Location: (37:2,2 [24] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) +| + var count = "1"; +| +Generated Location: (1500:35,2 [24] ) +| + var count = "1"; +| + +Source Location: (76:5,12 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) +|Convert.ToInt32(| +Generated Location: (1788:44,27 [16] ) +|Convert.ToInt32(| + +Source Location: (92:5,28 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) +|@count| +Generated Location: (1804:44,43 [6] ) +|@count| + +Source Location: (98:5,34 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) +|)| +Generated Location: (1810:44,49 [1] ) +|)| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs new file mode 100644 index 00000000000..2ff6d49f793 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs @@ -0,0 +1,86 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "56fbfd01b420ab12628e8f5c23b2e88ef109db5398f18d87931cf424410b93c8" +// +#pragma warning disable 1591 +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier_Runtime), @"default", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml")] +namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles +{ + #line hidden + [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"Sha256", @"56fbfd01b420ab12628e8f5c23b2e88ef109db5398f18d87931cf424410b93c8", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml")] + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier_Runtime + { + #line hidden + #pragma warning disable 0649 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext; + #pragma warning restore 0649 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + #pragma warning disable 0169 + private string __tagHelperStringValueBuffer; + #pragma warning restore 0169 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::InputTagHelper __InputTagHelper; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); +#nullable restore +#line (3,3)-(5,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml" + + var count = "1"; + +#line default +#line hidden +#nullable disable + + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + } + ); + __InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper); + __InputTagHelper.AgeProp = +#nullable restore +#line (6,13)-(6,29) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml" +Convert.ToInt32( + +#line default +#line hidden +#nullable disable +#nullable restore +#line (6,29)-(6,35) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml" +@count + +#line default +#line hidden +#nullable disable +#nullable restore +#line (6,35)-(6,36) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml" +) + +#line default +#line hidden +#nullable disable + ; + __tagHelperExecutionContext.AddTagHelperAttribute("age", __InputTagHelper.AgeProp, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + } + #pragma warning restore 1998 + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.ir.txt new file mode 100644 index 00000000000..111d78acbd5 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.ir.txt @@ -0,0 +1,23 @@ +Document - + RazorCompiledItemAttribute - + NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles + RazorSourceChecksumAttribute - + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier_Runtime - - + DefaultTagHelperRuntime - + FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper + MethodDeclaration - - public async - System.Threading.Tasks.Task - ExecuteAsync + HtmlContent - (33:1,0 [2] EscapedIdentifier.cshtml) + LazyIntermediateToken - (33:1,0 [2] EscapedIdentifier.cshtml) - Html - \n + CSharpCode - (37:2,2 [24] EscapedIdentifier.cshtml) + LazyIntermediateToken - (37:2,2 [24] EscapedIdentifier.cshtml) - CSharp - \n var count = "1";\n + TagHelper - (64:5,0 [39] EscapedIdentifier.cshtml) - input - TagMode.SelfClosing + DefaultTagHelperBody - + DefaultTagHelperCreate - - InputTagHelper + DefaultTagHelperProperty - (76:5,12 [23] EscapedIdentifier.cshtml) - age - int InputTagHelper.AgeProp - HtmlAttributeValueStyle.DoubleQuotes + LazyIntermediateToken - (76:5,12 [16] EscapedIdentifier.cshtml) - CSharp - Convert.ToInt32( + CSharpExpression - (92:5,28 [6] EscapedIdentifier.cshtml) + LazyIntermediateToken - (92:5,28 [6] EscapedIdentifier.cshtml) - CSharp - @count + LazyIntermediateToken - (98:5,34 [1] EscapedIdentifier.cshtml) - CSharp - ) + DefaultTagHelperExecute - + HtmlContent - (103:5,39 [2] EscapedIdentifier.cshtml) + LazyIntermediateToken - (103:5,39 [2] EscapedIdentifier.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.ir.txt index 6468ffb04f2..fdfa2131a35 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.ir.txt @@ -52,8 +52,7 @@ LazyIntermediateToken - (204:8,23 [2] TransitionsInTagHelperAttributes.cshtml) - CSharp - + LazyIntermediateToken - (206:8,25 [1] TransitionsInTagHelperAttributes.cshtml) - CSharp - CSharpExpression - (207:8,26 [4] TransitionsInTagHelperAttributes.cshtml) - LazyIntermediateToken - (207:8,26 [1] TransitionsInTagHelperAttributes.cshtml) - CSharp - @ - LazyIntermediateToken - (208:8,27 [3] TransitionsInTagHelperAttributes.cshtml) - CSharp - int + LazyIntermediateToken - (207:8,26 [4] TransitionsInTagHelperAttributes.cshtml) - CSharp - @int DefaultTagHelperExecute - HtmlContent - (217:8,36 [2] TransitionsInTagHelperAttributes.cshtml) LazyIntermediateToken - (217:8,36 [2] TransitionsInTagHelperAttributes.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt index bd2f5151d1b..40af3feea2e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt @@ -44,15 +44,10 @@ Source Location: (206:8,25 [1] TestFiles/IntegrationTests/CodeGenerationIntegrat Generated Location: (2905:70,37 [1] ) | | -Source Location: (207:8,26 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) -|@| -Generated Location: (2906:70,38 [1] ) -|@| - -Source Location: (208:8,27 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) -|int| -Generated Location: (2907:70,39 [3] ) -|int| +Source Location: (207:8,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) +|@int| +Generated Location: (2906:70,38 [4] ) +|@int| Source Location: (241:9,22 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |int| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.codegen.cs index 639833e3f12..368bd4c5846 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.codegen.cs @@ -138,15 +138,8 @@ public async System.Threading.Tasks.Task ExecuteAsync() #line hidden #nullable disable #nullable restore -#line (9,27)-(9,28) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" -@ - -#line default -#line hidden -#nullable disable -#nullable restore -#line (9,28)-(9,31) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" -int +#line (9,27)-(9,31) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" +@int #line default #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.ir.txt index 98aa2038f18..4a1117d64a9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.ir.txt @@ -43,8 +43,7 @@ LazyIntermediateToken - (204:8,23 [2] TransitionsInTagHelperAttributes.cshtml) - CSharp - + LazyIntermediateToken - (206:8,25 [1] TransitionsInTagHelperAttributes.cshtml) - CSharp - CSharpExpression - (207:8,26 [4] TransitionsInTagHelperAttributes.cshtml) - LazyIntermediateToken - (207:8,26 [1] TransitionsInTagHelperAttributes.cshtml) - CSharp - @ - LazyIntermediateToken - (208:8,27 [3] TransitionsInTagHelperAttributes.cshtml) - CSharp - int + LazyIntermediateToken - (207:8,26 [4] TransitionsInTagHelperAttributes.cshtml) - CSharp - @int DefaultTagHelperExecute - HtmlContent - (217:8,36 [2] TransitionsInTagHelperAttributes.cshtml) LazyIntermediateToken - (217:8,36 [2] TransitionsInTagHelperAttributes.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.cspans.txt index dc253a80d0e..e15ca49722e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.cspans.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.cspans.txt @@ -1,4 +1,3 @@ Code span at (13:0,13 [4] ) - Parent: Markup block at (13:0,13 [9] ) -Code span at (17:0,17 [1] ) - Parent: Expression block at (17:0,17 [5] ) -Code span at (18:0,18 [4] ) - Parent: Expression block at (17:0,17 [5] ) +Code span at (17:0,17 [5] ) - Parent: Expression block at (17:0,17 [5] ) Code span at (22:0,22 [2] ) - Parent: Markup block at (13:0,13 [11] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.stree.txt index 5cb13d37dc4..f13e8a99981 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesErrorForEmptyTagHelperBoundAttributes13.stree.txt @@ -22,10 +22,8 @@ Transition;[]; CSharpImplicitExpressionBody - [17..22)::5 CSharpCodeBlock - [17..22)::5 - CSharpExpressionLiteral - [17..18)::1 - [@] - Gen - Transition;[@]; - CSharpExpressionLiteral - [18..22)::4 - [true] - Gen - Keyword;[true]; + CSharpExpressionLiteral - [17..22)::5 - [@true] - Gen + Keyword;[@true]; CSharpExpressionLiteral - [22..24)::2 - [ ] - Gen Whitespace;[ ]; MarkupTextLiteral - [24..25)::1 - ['] - Gen diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes13.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes13.cspans.txt new file mode 100644 index 00000000000..a3de0853320 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes13.cspans.txt @@ -0,0 +1,9 @@ +Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [70] ) +Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [28] ) +MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [28] ) +Code span at (2:0,2 [25] ) - Parent: Statement block at (0:0,0 [28] ) +MetaCode span at (27:2,0 [1] ) - Parent: Statement block at (0:0,0 [28] ) +Markup span at (28:2,1 [2] ) - Parent: Markup block at (0:0,0 [70] ) +Code span at (43:3,13 [16] ) - Parent: Markup block at (43:3,13 [23] ) +Code span at (59:3,29 [6] ) - Parent: Expression block at (59:3,29 [6] ) +Code span at (65:3,35 [1] ) - Parent: Markup block at (43:3,13 [23] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes13.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes13.stree.txt new file mode 100644 index 00000000000..bcb58149679 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes13.stree.txt @@ -0,0 +1,63 @@ +RazorDocument - [0..70)::70 - [@{ LF var count = "1";LF}LF] + MarkupBlock - [0..70)::70 + MarkupTextLiteral - [0..0)::0 - [] - Gen + Marker;[]; + CSharpCodeBlock - [0..28)::28 + CSharpStatement - [0..28)::28 + CSharpTransition - [0..1)::1 - Gen + Transition;[@]; + CSharpStatementBody - [1..28)::27 + RazorMetaCode - [1..2)::1 - Gen + LeftBrace;[{]; + CSharpCodeBlock - [2..27)::25 + CSharpStatementLiteral - [2..27)::25 - [ LF var count = "1";LF] - Gen + Whitespace;[ ]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[count]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["1"]; + Semicolon;[;]; + NewLine;[LF]; + RazorMetaCode - [27..28)::1 - Gen + RightBrace;[}]; + MarkupEphemeralTextLiteral - [28..30)::2 - [LF] - Gen + NewLine;[LF]; + MarkupTagHelperElement - [30..70)::40 - person[SelfClosing] - PersonTagHelper + MarkupTagHelperStartTag - [30..70)::40 - [] - Gen + OpenAngle;[<]; + Text;[person]; + MarkupTagHelperAttribute - [37..67)::30 - age - DoubleQuotes - Bound - [ age="Convert.ToInt32(@count)"] + MarkupTextLiteral - [37..38)::1 - [ ] - Gen + Whitespace;[ ]; + MarkupTextLiteral - [38..41)::3 - [age] - Gen + Text;[age]; + Equals;[=]; + MarkupTextLiteral - [42..43)::1 - ["] - Gen + DoubleQuote;["]; + MarkupTagHelperAttributeValue - [43..66)::23 + CSharpExpressionLiteral - [43..59)::16 - [Convert.ToInt32(] - Gen + Text;[Convert.ToInt32(]; + MarkupBlock - [59..65)::6 + CSharpCodeBlock - [59..65)::6 + CSharpImplicitExpression - [59..65)::6 + CSharpTransition - [59..59)::0 + Transition;[]; + CSharpImplicitExpressionBody - [59..65)::6 + CSharpCodeBlock - [59..65)::6 + CSharpExpressionLiteral - [59..65)::6 - [@count] - Gen + Identifier;[@count]; + CSharpExpressionLiteral - [65..66)::1 - [)] - Gen + Text;[)]; + MarkupTextLiteral - [66..67)::1 - ["] - Gen + DoubleQuote;["]; + MarkupMiscAttributeContent - [67..68)::1 + MarkupTextLiteral - [67..68)::1 - [ ] - Gen + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes13.tspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes13.tspans.txt new file mode 100644 index 00000000000..e57fad2a1f0 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes13.tspans.txt @@ -0,0 +1 @@ +TagHelper span at (30:3,0 [40] ) - PersonTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes14.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes14.cspans.txt new file mode 100644 index 00000000000..c52d148ceed --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes14.cspans.txt @@ -0,0 +1,9 @@ +Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [73] ) +Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [30] ) +MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [30] ) +Code span at (2:0,2 [27] ) - Parent: Statement block at (0:0,0 [30] ) +MetaCode span at (29:2,0 [1] ) - Parent: Statement block at (0:0,0 [30] ) +Markup span at (30:2,1 [2] ) - Parent: Markup block at (0:0,0 [73] ) +Code span at (45:3,13 [16] ) - Parent: Markup block at (45:3,13 [24] ) +Code span at (61:3,29 [7] ) - Parent: Expression block at (61:3,29 [7] ) +Code span at (68:3,36 [1] ) - Parent: Markup block at (45:3,13 [24] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes14.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes14.stree.txt new file mode 100644 index 00000000000..1e6894dc5a2 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes14.stree.txt @@ -0,0 +1,63 @@ +RazorDocument - [0..73)::73 - [@{ LF var @string = "1";LF}LF] + MarkupBlock - [0..73)::73 + MarkupTextLiteral - [0..0)::0 - [] - Gen + Marker;[]; + CSharpCodeBlock - [0..30)::30 + CSharpStatement - [0..30)::30 + CSharpTransition - [0..1)::1 - Gen + Transition;[@]; + CSharpStatementBody - [1..30)::29 + RazorMetaCode - [1..2)::1 - Gen + LeftBrace;[{]; + CSharpCodeBlock - [2..29)::27 + CSharpStatementLiteral - [2..29)::27 - [ LF var @string = "1";LF] - Gen + Whitespace;[ ]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[@string]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["1"]; + Semicolon;[;]; + NewLine;[LF]; + RazorMetaCode - [29..30)::1 - Gen + RightBrace;[}]; + MarkupEphemeralTextLiteral - [30..32)::2 - [LF] - Gen + NewLine;[LF]; + MarkupTagHelperElement - [32..73)::41 - person[SelfClosing] - PersonTagHelper + MarkupTagHelperStartTag - [32..73)::41 - [] - Gen + OpenAngle;[<]; + Text;[person]; + MarkupTagHelperAttribute - [39..70)::31 - age - DoubleQuotes - Bound - [ age="Convert.ToInt32(@string)"] + MarkupTextLiteral - [39..40)::1 - [ ] - Gen + Whitespace;[ ]; + MarkupTextLiteral - [40..43)::3 - [age] - Gen + Text;[age]; + Equals;[=]; + MarkupTextLiteral - [44..45)::1 - ["] - Gen + DoubleQuote;["]; + MarkupTagHelperAttributeValue - [45..69)::24 + CSharpExpressionLiteral - [45..61)::16 - [Convert.ToInt32(] - Gen + Text;[Convert.ToInt32(]; + MarkupBlock - [61..68)::7 + CSharpCodeBlock - [61..68)::7 + CSharpImplicitExpression - [61..68)::7 + CSharpTransition - [61..61)::0 + Transition;[]; + CSharpImplicitExpressionBody - [61..68)::7 + CSharpCodeBlock - [61..68)::7 + CSharpExpressionLiteral - [61..68)::7 - [@string] - Gen + Keyword;[@string]; + CSharpExpressionLiteral - [68..69)::1 - [)] - Gen + Text;[)]; + MarkupTextLiteral - [69..70)::1 - ["] - Gen + DoubleQuote;["]; + MarkupMiscAttributeContent - [70..71)::1 + MarkupTextLiteral - [70..71)::1 - [ ] - Gen + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes14.tspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes14.tspans.txt new file mode 100644 index 00000000000..9c3fcfcaf37 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes14.tspans.txt @@ -0,0 +1 @@ +TagHelper span at (32:3,0 [41] ) - PersonTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes15.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes15.cspans.txt new file mode 100644 index 00000000000..f65ca9d6df0 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes15.cspans.txt @@ -0,0 +1,9 @@ +Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [68] ) +Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [28] ) +MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [28] ) +Code span at (2:0,2 [25] ) - Parent: Statement block at (0:0,0 [28] ) +MetaCode span at (27:2,0 [1] ) - Parent: Statement block at (0:0,0 [28] ) +Markup span at (28:2,1 [2] ) - Parent: Markup block at (0:0,0 [68] ) +Code span at (42:3,12 [16] ) - Parent: Markup block at (42:3,12 [23] ) +Code span at (58:3,28 [6] ) - Parent: Expression block at (58:3,28 [6] ) +Code span at (64:3,34 [1] ) - Parent: Markup block at (42:3,12 [23] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes15.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes15.stree.txt new file mode 100644 index 00000000000..42cdcb73409 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes15.stree.txt @@ -0,0 +1,59 @@ +RazorDocument - [0..68)::68 - [@{ LF var count = "1";LF}LF] + MarkupBlock - [0..68)::68 + MarkupTextLiteral - [0..0)::0 - [] - Gen + Marker;[]; + CSharpCodeBlock - [0..28)::28 + CSharpStatement - [0..28)::28 + CSharpTransition - [0..1)::1 - Gen + Transition;[@]; + CSharpStatementBody - [1..28)::27 + RazorMetaCode - [1..2)::1 - Gen + LeftBrace;[{]; + CSharpCodeBlock - [2..27)::25 + CSharpStatementLiteral - [2..27)::25 - [ LF var count = "1";LF] - Gen + Whitespace;[ ]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[count]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["1"]; + Semicolon;[;]; + NewLine;[LF]; + RazorMetaCode - [27..28)::1 - Gen + RightBrace;[}]; + MarkupEphemeralTextLiteral - [28..30)::2 - [LF] - Gen + NewLine;[LF]; + MarkupTagHelperElement - [30..68)::38 - person[SelfClosing] - PersonTagHelper + MarkupTagHelperStartTag - [30..68)::38 - [] - Gen + OpenAngle;[<]; + Text;[person]; + MarkupTagHelperAttribute - [37..65)::28 - age - DoubleQuotes - Bound - [ age=Convert.ToInt32(@count)] + MarkupTextLiteral - [37..38)::1 - [ ] - Gen + Whitespace;[ ]; + MarkupTextLiteral - [38..41)::3 - [age] - Gen + Text;[age]; + Equals;[=]; + MarkupTagHelperAttributeValue - [42..65)::23 + CSharpExpressionLiteral - [42..58)::16 - [Convert.ToInt32(] - Gen + Text;[Convert.ToInt32(]; + MarkupBlock - [58..64)::6 + CSharpCodeBlock - [58..64)::6 + CSharpImplicitExpression - [58..64)::6 + CSharpTransition - [58..58)::0 + Transition;[]; + CSharpImplicitExpressionBody - [58..64)::6 + CSharpCodeBlock - [58..64)::6 + CSharpExpressionLiteral - [58..64)::6 - [@count] - Gen + Identifier;[@count]; + CSharpExpressionLiteral - [64..65)::1 - [)] - Gen + Text;[)]; + MarkupMiscAttributeContent - [65..66)::1 + MarkupTextLiteral - [65..66)::1 - [ ] - Gen + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes15.tspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes15.tspans.txt new file mode 100644 index 00000000000..4beb02afaaf --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes15.tspans.txt @@ -0,0 +1 @@ +TagHelper span at (30:3,0 [38] ) - PersonTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes16.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes16.cspans.txt new file mode 100644 index 00000000000..5a26217d950 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes16.cspans.txt @@ -0,0 +1,10 @@ +Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [76] ) +Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [28] ) +MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [28] ) +Code span at (2:0,2 [25] ) - Parent: Statement block at (0:0,0 [28] ) +MetaCode span at (27:2,0 [1] ) - Parent: Statement block at (0:0,0 [28] ) +Markup span at (28:2,1 [2] ) - Parent: Markup block at (0:0,0 [76] ) +Code span at (43:3,13 [16] ) - Parent: Markup block at (43:3,13 [29] ) +Code span at (59:3,29 [6] ) - Parent: Expression block at (59:3,29 [6] ) +Code span at (65:3,35 [2] ) - Parent: Markup block at (43:3,13 [29] ) +Code span at (67:3,37 [5] ) - Parent: Markup block at (43:3,13 [29] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes16.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes16.stree.txt new file mode 100644 index 00000000000..f920ab4702b --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes16.stree.txt @@ -0,0 +1,70 @@ +RazorDocument - [0..76)::76 - [@{ LF var count = "1";LF}LF] + MarkupBlock - [0..76)::76 + MarkupTextLiteral - [0..0)::0 - [] - Gen + Marker;[]; + CSharpCodeBlock - [0..28)::28 + CSharpStatement - [0..28)::28 + CSharpTransition - [0..1)::1 - Gen + Transition;[@]; + CSharpStatementBody - [1..28)::27 + RazorMetaCode - [1..2)::1 - Gen + LeftBrace;[{]; + CSharpCodeBlock - [2..27)::25 + CSharpStatementLiteral - [2..27)::25 - [ LF var count = "1";LF] - Gen + Whitespace;[ ]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[count]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["1"]; + Semicolon;[;]; + NewLine;[LF]; + RazorMetaCode - [27..28)::1 - Gen + RightBrace;[}]; + MarkupEphemeralTextLiteral - [28..30)::2 - [LF] - Gen + NewLine;[LF]; + MarkupTagHelperElement - [30..76)::46 - person[SelfClosing] - PersonTagHelper + MarkupTagHelperStartTag - [30..76)::46 - [] - Gen + OpenAngle;[<]; + Text;[person]; + MarkupTagHelperAttribute - [37..73)::36 - age - SingleQuotes - Bound - [ age='Convert.ToInt32(@count + "2")'] + MarkupTextLiteral - [37..38)::1 - [ ] - Gen + Whitespace;[ ]; + MarkupTextLiteral - [38..41)::3 - [age] - Gen + Text;[age]; + Equals;[=]; + MarkupTextLiteral - [42..43)::1 - ['] - Gen + SingleQuote;[']; + MarkupTagHelperAttributeValue - [43..72)::29 + CSharpExpressionLiteral - [43..59)::16 - [Convert.ToInt32(] - Gen + Text;[Convert.ToInt32(]; + MarkupBlock - [59..65)::6 + CSharpCodeBlock - [59..65)::6 + CSharpImplicitExpression - [59..65)::6 + CSharpTransition - [59..59)::0 + Transition;[]; + CSharpImplicitExpressionBody - [59..65)::6 + CSharpCodeBlock - [59..65)::6 + CSharpExpressionLiteral - [59..65)::6 - [@count] - Gen + Identifier;[@count]; + CSharpExpressionLiteral - [65..67)::2 - [ +] - Gen + Whitespace;[ ]; + Text;[+]; + CSharpExpressionLiteral - [67..72)::5 - [ "2")] - Gen + Whitespace;[ ]; + DoubleQuote;["]; + Text;[2]; + DoubleQuote;["]; + Text;[)]; + MarkupTextLiteral - [72..73)::1 - ['] - Gen + SingleQuote;[']; + MarkupMiscAttributeContent - [73..74)::1 + MarkupTextLiteral - [73..74)::1 - [ ] - Gen + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes16.tspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes16.tspans.txt new file mode 100644 index 00000000000..b90741a921f --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes16.tspans.txt @@ -0,0 +1 @@ +TagHelper span at (30:3,0 [46] ) - PersonTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes17.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes17.cspans.txt new file mode 100644 index 00000000000..b41a30f0b3e --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes17.cspans.txt @@ -0,0 +1,9 @@ +Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [52] ) +Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [26] ) +MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [26] ) +Code span at (2:0,2 [23] ) - Parent: Statement block at (0:0,0 [26] ) +MetaCode span at (25:2,0 [1] ) - Parent: Statement block at (0:0,0 [26] ) +Markup span at (26:2,1 [2] ) - Parent: Markup block at (0:0,0 [52] ) +Code span at (41:3,13 [1] ) - Parent: Markup block at (41:3,13 [2] ) +Code span at (42:3,14 [1] ) - Parent: Markup block at (41:3,13 [2] ) +Code span at (43:3,15 [5] ) - Parent: Markup block at (41:3,13 [7] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes17.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes17.stree.txt new file mode 100644 index 00000000000..d448015f5ff --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes17.stree.txt @@ -0,0 +1,57 @@ +RazorDocument - [0..52)::52 - [@{ LF var count = 1;LF}LF] + MarkupBlock - [0..52)::52 + MarkupTextLiteral - [0..0)::0 - [] - Gen + Marker;[]; + CSharpCodeBlock - [0..26)::26 + CSharpStatement - [0..26)::26 + CSharpTransition - [0..1)::1 - Gen + Transition;[@]; + CSharpStatementBody - [1..26)::25 + RazorMetaCode - [1..2)::1 - Gen + LeftBrace;[{]; + CSharpCodeBlock - [2..25)::23 + CSharpStatementLiteral - [2..25)::23 - [ LF var count = 1;LF] - Gen + Whitespace;[ ]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[count]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[1]; + Semicolon;[;]; + NewLine;[LF]; + RazorMetaCode - [25..26)::1 - Gen + RightBrace;[}]; + MarkupEphemeralTextLiteral - [26..28)::2 - [LF] - Gen + NewLine;[LF]; + MarkupTagHelperElement - [28..52)::24 - person[SelfClosing] - PersonTagHelper + MarkupTagHelperStartTag - [28..52)::24 - [] - Gen + OpenAngle;[<]; + Text;[person]; + MarkupTagHelperAttribute - [35..49)::14 - age - SingleQuotes - Bound - [ age='@@count'] + MarkupTextLiteral - [35..36)::1 - [ ] - Gen + Whitespace;[ ]; + MarkupTextLiteral - [36..39)::3 - [age] - Gen + Text;[age]; + Equals;[=]; + MarkupTextLiteral - [40..41)::1 - ['] - Gen + SingleQuote;[']; + MarkupTagHelperAttributeValue - [41..48)::7 + MarkupBlock - [41..43)::2 + CSharpExpressionLiteral - [41..42)::1 - [@] - Gen + Transition;[@]; + CSharpEphemeralTextLiteral - [42..43)::1 - [@] - Gen + Transition;[@]; + CSharpExpressionLiteral - [43..48)::5 - [count] - Gen + Text;[count]; + MarkupTextLiteral - [48..49)::1 - ['] - Gen + SingleQuote;[']; + MarkupMiscAttributeContent - [49..50)::1 + MarkupTextLiteral - [49..50)::1 - [ ] - Gen + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes17.tspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes17.tspans.txt new file mode 100644 index 00000000000..f5c491a22d4 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes17.tspans.txt @@ -0,0 +1 @@ +TagHelper span at (28:3,0 [24] ) - PersonTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes18.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes18.cspans.txt new file mode 100644 index 00000000000..b41a30f0b3e --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes18.cspans.txt @@ -0,0 +1,9 @@ +Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [52] ) +Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [26] ) +MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [26] ) +Code span at (2:0,2 [23] ) - Parent: Statement block at (0:0,0 [26] ) +MetaCode span at (25:2,0 [1] ) - Parent: Statement block at (0:0,0 [26] ) +Markup span at (26:2,1 [2] ) - Parent: Markup block at (0:0,0 [52] ) +Code span at (41:3,13 [1] ) - Parent: Markup block at (41:3,13 [2] ) +Code span at (42:3,14 [1] ) - Parent: Markup block at (41:3,13 [2] ) +Code span at (43:3,15 [5] ) - Parent: Markup block at (41:3,13 [7] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes18.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes18.stree.txt new file mode 100644 index 00000000000..6e2629e042e --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes18.stree.txt @@ -0,0 +1,57 @@ +RazorDocument - [0..52)::52 - [@{ LF var count = 1;LF}LF] + MarkupBlock - [0..52)::52 + MarkupTextLiteral - [0..0)::0 - [] - Gen + Marker;[]; + CSharpCodeBlock - [0..26)::26 + CSharpStatement - [0..26)::26 + CSharpTransition - [0..1)::1 - Gen + Transition;[@]; + CSharpStatementBody - [1..26)::25 + RazorMetaCode - [1..2)::1 - Gen + LeftBrace;[{]; + CSharpCodeBlock - [2..25)::23 + CSharpStatementLiteral - [2..25)::23 - [ LF var count = 1;LF] - Gen + Whitespace;[ ]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[count]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[1]; + Semicolon;[;]; + NewLine;[LF]; + RazorMetaCode - [25..26)::1 - Gen + RightBrace;[}]; + MarkupEphemeralTextLiteral - [26..28)::2 - [LF] - Gen + NewLine;[LF]; + MarkupTagHelperElement - [28..52)::24 - person[SelfClosing] - PersonTagHelper + MarkupTagHelperStartTag - [28..52)::24 - [] - Gen + OpenAngle;[<]; + Text;[person]; + MarkupTagHelperAttribute - [35..49)::14 - age - DoubleQuotes - Bound - [ age="@@count"] + MarkupTextLiteral - [35..36)::1 - [ ] - Gen + Whitespace;[ ]; + MarkupTextLiteral - [36..39)::3 - [age] - Gen + Text;[age]; + Equals;[=]; + MarkupTextLiteral - [40..41)::1 - ["] - Gen + DoubleQuote;["]; + MarkupTagHelperAttributeValue - [41..48)::7 + MarkupBlock - [41..43)::2 + CSharpExpressionLiteral - [41..42)::1 - [@] - Gen + Transition;[@]; + CSharpEphemeralTextLiteral - [42..43)::1 - [@] - Gen + Transition;[@]; + CSharpExpressionLiteral - [43..48)::5 - [count] - Gen + Text;[count]; + MarkupTextLiteral - [48..49)::1 - ["] - Gen + DoubleQuote;["]; + MarkupMiscAttributeContent - [49..50)::1 + MarkupTextLiteral - [49..50)::1 - [ ] - Gen + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes18.tspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes18.tspans.txt new file mode 100644 index 00000000000..f5c491a22d4 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes18.tspans.txt @@ -0,0 +1 @@ +TagHelper span at (28:3,0 [24] ) - PersonTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes19.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes19.cspans.txt new file mode 100644 index 00000000000..bb8b8e48d36 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes19.cspans.txt @@ -0,0 +1,9 @@ +Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [50] ) +Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [26] ) +MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [26] ) +Code span at (2:0,2 [23] ) - Parent: Statement block at (0:0,0 [26] ) +MetaCode span at (25:2,0 [1] ) - Parent: Statement block at (0:0,0 [26] ) +Markup span at (26:2,1 [2] ) - Parent: Markup block at (0:0,0 [50] ) +Code span at (40:3,12 [1] ) - Parent: Markup block at (40:3,12 [2] ) +Code span at (41:3,13 [1] ) - Parent: Markup block at (40:3,12 [2] ) +Code span at (42:3,14 [5] ) - Parent: Markup block at (40:3,12 [7] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes19.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes19.stree.txt new file mode 100644 index 00000000000..8222a2cd8b5 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes19.stree.txt @@ -0,0 +1,53 @@ +RazorDocument - [0..50)::50 - [@{ LF var count = 1;LF}LF] + MarkupBlock - [0..50)::50 + MarkupTextLiteral - [0..0)::0 - [] - Gen + Marker;[]; + CSharpCodeBlock - [0..26)::26 + CSharpStatement - [0..26)::26 + CSharpTransition - [0..1)::1 - Gen + Transition;[@]; + CSharpStatementBody - [1..26)::25 + RazorMetaCode - [1..2)::1 - Gen + LeftBrace;[{]; + CSharpCodeBlock - [2..25)::23 + CSharpStatementLiteral - [2..25)::23 - [ LF var count = 1;LF] - Gen + Whitespace;[ ]; + NewLine;[LF]; + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[count]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + IntegerLiteral;[1]; + Semicolon;[;]; + NewLine;[LF]; + RazorMetaCode - [25..26)::1 - Gen + RightBrace;[}]; + MarkupEphemeralTextLiteral - [26..28)::2 - [LF] - Gen + NewLine;[LF]; + MarkupTagHelperElement - [28..50)::22 - person[SelfClosing] - PersonTagHelper + MarkupTagHelperStartTag - [28..50)::22 - [] - Gen + OpenAngle;[<]; + Text;[person]; + MarkupTagHelperAttribute - [35..47)::12 - age - DoubleQuotes - Bound - [ age=@@count] + MarkupTextLiteral - [35..36)::1 - [ ] - Gen + Whitespace;[ ]; + MarkupTextLiteral - [36..39)::3 - [age] - Gen + Text;[age]; + Equals;[=]; + MarkupTagHelperAttributeValue - [40..47)::7 + MarkupBlock - [40..42)::2 + CSharpExpressionLiteral - [40..41)::1 - [@] - Gen + Transition;[@]; + CSharpEphemeralTextLiteral - [41..42)::1 - [@] - Gen + Transition;[@]; + CSharpExpressionLiteral - [42..47)::5 - [count] - Gen + Text;[count]; + MarkupMiscAttributeContent - [47..48)::1 + MarkupTextLiteral - [47..48)::1 - [ ] - Gen + Whitespace;[ ]; + ForwardSlash;[/]; + CloseAngle;[>]; + EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes19.tspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes19.tspans.txt new file mode 100644 index 00000000000..4dd4489984e --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes19.tspans.txt @@ -0,0 +1 @@ +TagHelper span at (28:3,0 [22] ) - PersonTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.cspans.txt index 170a9370f9a..989e22b8439 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.cspans.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.cspans.txt @@ -1,3 +1,2 @@ Code span at (13:0,13 [1] ) - Parent: Markup block at (13:0,13 [19] ) -Code span at (14:0,14 [1] ) - Parent: Expression block at (14:0,14 [18] ) -Code span at (15:0,15 [17] ) - Parent: Expression block at (14:0,14 [18] ) +Code span at (14:0,14 [18] ) - Parent: Expression block at (14:0,14 [18] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.stree.txt index 3920cf28e70..ce2dfb933a6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes4.stree.txt @@ -22,10 +22,8 @@ Transition;[]; CSharpImplicitExpressionBody - [14..32)::18 CSharpCodeBlock - [14..32)::18 - CSharpExpressionLiteral - [14..15)::1 - [@] - Gen - Transition;[@]; - CSharpExpressionLiteral - [15..32)::17 - [DateTime.Now.Year] - Gen - Identifier;[DateTime]; + CSharpExpressionLiteral - [14..32)::18 - [@DateTime.Now.Year] - Gen + Identifier;[@DateTime]; Dot;[.]; Identifier;[Now]; Dot;[.]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.cspans.txt index 926714f45e7..8c42b37fbf6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.cspans.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.cspans.txt @@ -1,18 +1,15 @@ Code span at (13:0,13 [1] ) - Parent: Markup block at (13:0,13 [14] ) Code span at (14:0,14 [2] ) - Parent: Markup block at (13:0,13 [14] ) Code span at (16:0,16 [1] ) - Parent: Markup block at (16:0,16 [7] ) -Code span at (17:0,17 [1] ) - Parent: Expression block at (17:0,17 [6] ) -Code span at (18:0,18 [5] ) - Parent: Expression block at (17:0,17 [6] ) +Code span at (17:0,17 [6] ) - Parent: Expression block at (17:0,17 [6] ) Code span at (23:0,23 [2] ) - Parent: Markup block at (13:0,13 [14] ) Code span at (25:0,25 [2] ) - Parent: Markup block at (13:0,13 [14] ) Code span at (39:0,39 [6] ) - Parent: Markup block at (39:0,39 [46] ) -Code span at (45:0,45 [1] ) - Parent: Expression block at (45:0,45 [11] ) -Code span at (46:0,46 [10] ) - Parent: Expression block at (45:0,45 [11] ) +Code span at (45:0,45 [11] ) - Parent: Expression block at (45:0,45 [11] ) Code span at (56:0,56 [2] ) - Parent: Markup block at (39:0,39 [46] ) Code span at (58:0,58 [2] ) - Parent: Markup block at (58:0,58 [3] ) Code span at (60:0,60 [1] ) - Parent: Markup block at (58:0,58 [3] ) Code span at (61:0,61 [8] ) - Parent: Markup block at (39:0,39 [46] ) Code span at (69:0,69 [2] ) - Parent: Markup block at (39:0,39 [46] ) Code span at (71:0,71 [1] ) - Parent: Markup block at (71:0,71 [14] ) -Code span at (72:0,72 [1] ) - Parent: Expression block at (72:0,72 [13] ) -Code span at (73:0,73 [12] ) - Parent: Expression block at (72:0,72 [13] ) +Code span at (72:0,72 [13] ) - Parent: Expression block at (72:0,72 [13] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.stree.txt index a068fee75af..2353aee2b72 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpansForNonStringTagHelperAttributes7.stree.txt @@ -27,10 +27,8 @@ Transition;[]; CSharpImplicitExpressionBody - [17..23)::6 CSharpCodeBlock - [17..23)::6 - CSharpExpressionLiteral - [17..18)::1 - [@] - Gen - Transition;[@]; - CSharpExpressionLiteral - [18..23)::5 - [value] - Gen - Identifier;[value]; + CSharpExpressionLiteral - [17..23)::6 - [@value] - Gen + Identifier;[@value]; CSharpExpressionLiteral - [23..25)::2 - [ +] - Gen Whitespace;[ ]; Text;[+]; @@ -57,10 +55,8 @@ Transition;[]; CSharpImplicitExpressionBody - [45..56)::11 CSharpCodeBlock - [45..56)::11 - CSharpExpressionLiteral - [45..46)::1 - [@] - Gen - Transition;[@]; - CSharpExpressionLiteral - [46..56)::10 - [Bag["val"]] - Gen - Identifier;[Bag]; + CSharpExpressionLiteral - [45..56)::11 - [@Bag["val"]] - Gen + Identifier;[@Bag]; LeftBracket;[[]; StringLiteral;["val"]; RightBracket;[]]; @@ -87,10 +83,8 @@ Transition;[]; CSharpImplicitExpressionBody - [72..85)::13 CSharpCodeBlock - [72..85)::13 - CSharpExpressionLiteral - [72..73)::1 - [@] - Gen - Transition;[@]; - CSharpExpressionLiteral - [73..85)::12 - [DateTime.Now] - Gen - Identifier;[DateTime]; + CSharpExpressionLiteral - [72..85)::13 - [@DateTime.Now] - Gen + Identifier;[@DateTime]; Dot;[.]; Identifier;[Now]; MarkupTextLiteral - [85..86)::1 - ['] - Gen diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs index a062c60e3ba..ddf2fea390f 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs @@ -595,18 +595,17 @@ public override SyntaxNode VisitCSharpImplicitExpression(CSharpImplicitExpressio { using var _ = SyntaxListBuilderPool.GetPooledBuilder(out var builder); - // Convert transition. - // Change to a MarkupChunkGenerator so that the '@' \ parenthesis is generated as part of the output. - var editHandler = _enableSpanEditHandlers - ? node.GetEditHandler() ?? SpanEditHandler.CreateDefault((content) => Enumerable.Empty(), AcceptedCharactersInternal.Any) - : null; + var rewrittenBody = (CSharpCodeBlockSyntax)VisitCSharpCodeBlock(((CSharpImplicitExpressionBodySyntax)node.Body).CSharpCode); - var expression = SyntaxFactory.CSharpExpressionLiteral(new SyntaxList(node.Transition.Transition), MarkupChunkGenerator.Instance).WithEditHandler(editHandler); - expression = (CSharpExpressionLiteralSyntax)VisitCSharpExpressionLiteral(expression); - builder.Add(expression); + // The transition needs to be considered part of the first token in the rewritten body, so we update the first child to include it. + // This ensures that, when we create tracking spans and write out the final C# code, the `@` is not treated as a separate, separable + // token from the content that follows it. + var firstChild = rewrittenBody.Children[0]; + var firstToken = firstChild.GetFirstToken(); + var newFirstToken = SyntaxFactory.Token(firstToken.Kind, node.Transition.Transition.Content + firstToken.Content).WithAnnotations(firstToken.GetAnnotations()); - var rewrittenBody = (CSharpCodeBlockSyntax)VisitCSharpCodeBlock(((CSharpImplicitExpressionBodySyntax)node.Body).CSharpCode); - builder.AddRange(rewrittenBody.Children); + var newFirstChild = firstChild.ReplaceNode(firstToken, newFirstToken); + builder.AddRange(rewrittenBody.Children.Replace(firstChild, newFirstChild)); // Since the original transition is part of the body, we need something to take it's place. var transition = SyntaxFactory.CSharpTransition(SyntaxFactory.MissingToken(SyntaxKind.Transition), chunkGenerator: null); @@ -627,6 +626,7 @@ public override SyntaxNode VisitCSharpExplicitExpression(CSharpExplicitExpressio { // Convert transition. // Change to a MarkupChunkGenerator so that the '@' \ parenthesis is generated as part of the output. + // This is bad code, since @( is never valid C#, so we don't worry about trying to stitch the @ and the ( together. var editHandler = _enableSpanEditHandlers ? node.GetEditHandler() ?? SpanEditHandler.CreateDefault((content) => Enumerable.Empty(), AcceptedCharactersInternal.Any) : null;