* Correctly stitch `@` characters to following identifiers when rewriting tag helpers (#10331)

Because of how we were rewriting tag helper attribute values, we didn't output a single, unified token when moving an implicit C# transition back to standard C#. This meant that, when we emit `#line` directives, we considered the `@` and the identifier that followed it to be separate tokens; when we added more precise info for FUSE, this then meant that they were emitted on separate lines during runtime codegen and everything fell apart. To fix this, we now unify those implicit transition tokens, rather than trying to keep them as separate tokens. Fixes https://github.com/dotnet/razor/issues/10186, for real this time.

(cherry picked from commit 26ce354a9f)

* Update baseline for 17.10 code.
This commit is contained in:
Fred Silberberg 2024-05-21 09:31:18 -07:00 коммит произвёл GitHub
Родитель bf7698527c
Коммит 5affb9ba2f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
52 изменённых файлов: 895 добавлений и 115 удалений

Просмотреть файл

@ -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] )

Просмотреть файл

@ -22,10 +22,8 @@
Transition;[<Missing>];
CSharpImplicitExpressionBody - [17..22)::5
CSharpCodeBlock - [17..22)::5
CSharpExpressionLiteral - [17..18)::1 - [@] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Transition;[@];
CSharpExpressionLiteral - [18..22)::4 - [true] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Keyword;[true];
CSharpExpressionLiteral - [17..22)::5 - [@true] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Keyword;[@true];
CSharpExpressionLiteral - [22..24)::2 - [ ] - Gen<None> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Whitespace;[ ];
MarkupTextLiteral - [24..25)::1 - ['] - Gen<Markup> - SpanEditHandler;Accepts:Any

Просмотреть файл

@ -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] )

Просмотреть файл

@ -22,10 +22,8 @@
Transition;[<Missing>];
CSharpImplicitExpressionBody - [14..32)::18
CSharpCodeBlock - [14..32)::18
CSharpExpressionLiteral - [14..15)::1 - [@] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Transition;[@];
CSharpExpressionLiteral - [15..32)::17 - [DateTime.Now.Year] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Identifier;[DateTime];
CSharpExpressionLiteral - [14..32)::18 - [@DateTime.Now.Year] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Identifier;[@DateTime];
Dot;[.];
Identifier;[Now];
Dot;[.];

Просмотреть файл

@ -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] )

Просмотреть файл

@ -27,10 +27,8 @@
Transition;[<Missing>];
CSharpImplicitExpressionBody - [17..23)::6
CSharpCodeBlock - [17..23)::6
CSharpExpressionLiteral - [17..18)::1 - [@] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Transition;[@];
CSharpExpressionLiteral - [18..23)::5 - [value] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Identifier;[value];
CSharpExpressionLiteral - [17..23)::6 - [@value] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Identifier;[@value];
CSharpExpressionLiteral - [23..25)::2 - [ +] - Gen<None> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Whitespace;[ ];
Text;[+];
@ -57,10 +55,8 @@
Transition;[<Missing>];
CSharpImplicitExpressionBody - [45..56)::11
CSharpCodeBlock - [45..56)::11
CSharpExpressionLiteral - [45..46)::1 - [@] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Transition;[@];
CSharpExpressionLiteral - [46..56)::10 - [Bag["val"]] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Identifier;[Bag];
CSharpExpressionLiteral - [45..56)::11 - [@Bag["val"]] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Identifier;[@Bag];
LeftBracket;[[];
StringLiteral;["val"];
RightBracket;[]];
@ -87,10 +83,8 @@
Transition;[<Missing>];
CSharpImplicitExpressionBody - [72..85)::13
CSharpCodeBlock - [72..85)::13
CSharpExpressionLiteral - [72..73)::1 - [@] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Transition;[@];
CSharpExpressionLiteral - [73..85)::12 - [DateTime.Now] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Identifier;[DateTime];
CSharpExpressionLiteral - [72..85)::13 - [@DateTime.Now] - Gen<Expr> - ImplicitExpressionEditHandler;Accepts:AnyExceptNewline;ImplicitExpression[ATD];K15
Identifier;[@DateTime];
Dot;[.];
Identifier;[Now];
MarkupTextLiteral - [85..86)::1 - ['] - Gen<Markup> - SpanEditHandler;Accepts:Any

Просмотреть файл

@ -9,6 +9,7 @@ using System.Linq;
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");

Просмотреть файл

@ -8,6 +8,7 @@ using System.Collections.Generic;
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 class TagHelperBlockRewriterTest : TagHelperRewritingTestBase
EvaluateData(CodeTagHelperAttributes_Descriptors, "<person age=\"@{flag == 0 ? 11 : 12}\" />");
}
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")]
public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes13()
{
EvaluateData(CodeTagHelperAttributes_Descriptors, """
@{
var count = "1";
}
<person age="Convert.ToInt32(@count)" />
""");
}
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")]
public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes14()
{
EvaluateData(CodeTagHelperAttributes_Descriptors, """
@{
var @string = "1";
}
<person age="Convert.ToInt32(@string)" />
""");
}
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")]
public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes15()
{
EvaluateData(CodeTagHelperAttributes_Descriptors, """
@{
var count = "1";
}
<person age=Convert.ToInt32(@count) />
""");
}
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")]
public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes16()
{
EvaluateData(CodeTagHelperAttributes_Descriptors, """
@{
var count = "1";
}
<person age='Convert.ToInt32(@count + "2")' />
""");
}
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")]
public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes17()
{
EvaluateData(CodeTagHelperAttributes_Descriptors, """
@{
var count = 1;
}
<person age='@@count' />
""");
}
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")]
public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes18()
{
EvaluateData(CodeTagHelperAttributes_Descriptors, """
@{
var count = 1;
}
<person age="@@count" />
""");
}
[Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")]
public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes19()
{
EvaluateData(CodeTagHelperAttributes_Descriptors, """
@{
var count = 1;
}
<person age=@@count />
""");
}
[Fact]
public void TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper1()
{

Просмотреть файл

@ -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

Просмотреть файл

@ -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|

Просмотреть файл

@ -493,15 +493,8 @@ DateTimeOffset.Now.Year > 2014
#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

Просмотреть файл

@ -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

Просмотреть файл

@ -0,0 +1,6 @@
@addTagHelper "*, TestAssembly"
@{
var count = "1";
}
<input age="Convert.ToInt32(@count)" />

Просмотреть файл

@ -0,0 +1,55 @@
// <auto-generated/>
#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<global::InputTagHelper>();
#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

Просмотреть файл

@ -0,0 +1,6 @@
~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~
~~
~~~ ~~~~~ ~ ~~~~
~
<input age="~~~~~~~~~~~~~~~~~~~~~~~" />

Просмотреть файл

@ -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)
|
<input age="|
Generated Location: (62:4,1 [14] )
|
<input age="|
Source Location: (99:5,35 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml)
|" />
|
Generated Location: (99:5,35 [6] )
|" />
|

Просмотреть файл

@ -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

Просмотреть файл

@ -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] )
|)|

Просмотреть файл

@ -0,0 +1,86 @@
#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "56fbfd01b420ab12628e8f5c23b2e88ef109db5398f18d87931cf424410b93c8"
// <auto-generated/>
#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<global::InputTagHelper>();
__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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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|

Просмотреть файл

@ -138,15 +138,8 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
#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

Просмотреть файл

@ -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

Просмотреть файл

@ -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] )

Просмотреть файл

@ -22,10 +22,8 @@
Transition;[<Missing>];
CSharpImplicitExpressionBody - [17..22)::5
CSharpCodeBlock - [17..22)::5
CSharpExpressionLiteral - [17..18)::1 - [@] - Gen<Expr>
Transition;[@];
CSharpExpressionLiteral - [18..22)::4 - [true] - Gen<Expr>
Keyword;[true];
CSharpExpressionLiteral - [17..22)::5 - [@true] - Gen<Expr>
Keyword;[@true];
CSharpExpressionLiteral - [22..24)::2 - [ ] - Gen<None>
Whitespace;[ ];
MarkupTextLiteral - [24..25)::1 - ['] - Gen<Markup>

Просмотреть файл

@ -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] )

Просмотреть файл

@ -0,0 +1,63 @@
RazorDocument - [0..70)::70 - [@{ LF var count = "1";LF}LF<person age="Convert.ToInt32(@count)" />]
MarkupBlock - [0..70)::70
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..28)::28
CSharpStatement - [0..28)::28
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..28)::27
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..27)::25
CSharpStatementLiteral - [2..27)::25 - [ LF var count = "1";LF] - Gen<Stmt>
Whitespace;[ ];
NewLine;[LF];
Whitespace;[ ];
Identifier;[var];
Whitespace;[ ];
Identifier;[count];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
StringLiteral;["1"];
Semicolon;[;];
NewLine;[LF];
RazorMetaCode - [27..28)::1 - Gen<None>
RightBrace;[}];
MarkupEphemeralTextLiteral - [28..30)::2 - [LF] - Gen<None>
NewLine;[LF];
MarkupTagHelperElement - [30..70)::40 - person[SelfClosing] - PersonTagHelper
MarkupTagHelperStartTag - [30..70)::40 - [<person age="Convert.ToInt32(@count)" />] - Gen<Markup>
OpenAngle;[<];
Text;[person];
MarkupTagHelperAttribute - [37..67)::30 - age - DoubleQuotes - Bound - [ age="Convert.ToInt32(@count)"]
MarkupTextLiteral - [37..38)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
MarkupTextLiteral - [38..41)::3 - [age] - Gen<Markup>
Text;[age];
Equals;[=];
MarkupTextLiteral - [42..43)::1 - ["] - Gen<Markup>
DoubleQuote;["];
MarkupTagHelperAttributeValue - [43..66)::23
CSharpExpressionLiteral - [43..59)::16 - [Convert.ToInt32(] - Gen<None>
Text;[Convert.ToInt32(];
MarkupBlock - [59..65)::6
CSharpCodeBlock - [59..65)::6
CSharpImplicitExpression - [59..65)::6
CSharpTransition - [59..59)::0
Transition;[<Missing>];
CSharpImplicitExpressionBody - [59..65)::6
CSharpCodeBlock - [59..65)::6
CSharpExpressionLiteral - [59..65)::6 - [@count] - Gen<Expr>
Identifier;[@count];
CSharpExpressionLiteral - [65..66)::1 - [)] - Gen<None>
Text;[)];
MarkupTextLiteral - [66..67)::1 - ["] - Gen<Markup>
DoubleQuote;["];
MarkupMiscAttributeContent - [67..68)::1
MarkupTextLiteral - [67..68)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
ForwardSlash;[/];
CloseAngle;[>];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1 @@
TagHelper span at (30:3,0 [40] ) - PersonTagHelper

Просмотреть файл

@ -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] )

Просмотреть файл

@ -0,0 +1,64 @@
RazorDocument - [0..73)::73 - [@{ LF var @string = "1";LF}LF<person age="Convert.ToInt32(@string)" />]
MarkupBlock - [0..73)::73
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..30)::30
CSharpStatement - [0..30)::30
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..30)::29
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..29)::27
CSharpStatementLiteral - [2..29)::27 - [ LF var @string = "1";LF] - Gen<Stmt>
Whitespace;[ ];
NewLine;[LF];
Whitespace;[ ];
Identifier;[var];
Whitespace;[ ];
Transition;[@];
Keyword;[string];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
StringLiteral;["1"];
Semicolon;[;];
NewLine;[LF];
RazorMetaCode - [29..30)::1 - Gen<None>
RightBrace;[}];
MarkupEphemeralTextLiteral - [30..32)::2 - [LF] - Gen<None>
NewLine;[LF];
MarkupTagHelperElement - [32..73)::41 - person[SelfClosing] - PersonTagHelper
MarkupTagHelperStartTag - [32..73)::41 - [<person age="Convert.ToInt32(@string)" />] - Gen<Markup>
OpenAngle;[<];
Text;[person];
MarkupTagHelperAttribute - [39..70)::31 - age - DoubleQuotes - Bound - [ age="Convert.ToInt32(@string)"]
MarkupTextLiteral - [39..40)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
MarkupTextLiteral - [40..43)::3 - [age] - Gen<Markup>
Text;[age];
Equals;[=];
MarkupTextLiteral - [44..45)::1 - ["] - Gen<Markup>
DoubleQuote;["];
MarkupTagHelperAttributeValue - [45..69)::24
CSharpExpressionLiteral - [45..61)::16 - [Convert.ToInt32(] - Gen<None>
Text;[Convert.ToInt32(];
MarkupBlock - [61..68)::7
CSharpCodeBlock - [61..68)::7
CSharpImplicitExpression - [61..68)::7
CSharpTransition - [61..61)::0
Transition;[<Missing>];
CSharpImplicitExpressionBody - [61..68)::7
CSharpCodeBlock - [61..68)::7
CSharpExpressionLiteral - [61..68)::7 - [@string] - Gen<Expr>
Keyword;[@string];
CSharpExpressionLiteral - [68..69)::1 - [)] - Gen<None>
Text;[)];
MarkupTextLiteral - [69..70)::1 - ["] - Gen<Markup>
DoubleQuote;["];
MarkupMiscAttributeContent - [70..71)::1
MarkupTextLiteral - [70..71)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
ForwardSlash;[/];
CloseAngle;[>];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1 @@
TagHelper span at (32:3,0 [41] ) - PersonTagHelper

Просмотреть файл

@ -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] )

Просмотреть файл

@ -0,0 +1,59 @@
RazorDocument - [0..68)::68 - [@{ LF var count = "1";LF}LF<person age=Convert.ToInt32(@count) />]
MarkupBlock - [0..68)::68
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..28)::28
CSharpStatement - [0..28)::28
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..28)::27
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..27)::25
CSharpStatementLiteral - [2..27)::25 - [ LF var count = "1";LF] - Gen<Stmt>
Whitespace;[ ];
NewLine;[LF];
Whitespace;[ ];
Identifier;[var];
Whitespace;[ ];
Identifier;[count];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
StringLiteral;["1"];
Semicolon;[;];
NewLine;[LF];
RazorMetaCode - [27..28)::1 - Gen<None>
RightBrace;[}];
MarkupEphemeralTextLiteral - [28..30)::2 - [LF] - Gen<None>
NewLine;[LF];
MarkupTagHelperElement - [30..68)::38 - person[SelfClosing] - PersonTagHelper
MarkupTagHelperStartTag - [30..68)::38 - [<person age=Convert.ToInt32(@count) />] - Gen<Markup>
OpenAngle;[<];
Text;[person];
MarkupTagHelperAttribute - [37..65)::28 - age - DoubleQuotes - Bound - [ age=Convert.ToInt32(@count)]
MarkupTextLiteral - [37..38)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
MarkupTextLiteral - [38..41)::3 - [age] - Gen<Markup>
Text;[age];
Equals;[=];
MarkupTagHelperAttributeValue - [42..65)::23
CSharpExpressionLiteral - [42..58)::16 - [Convert.ToInt32(] - Gen<None>
Text;[Convert.ToInt32(];
MarkupBlock - [58..64)::6
CSharpCodeBlock - [58..64)::6
CSharpImplicitExpression - [58..64)::6
CSharpTransition - [58..58)::0
Transition;[<Missing>];
CSharpImplicitExpressionBody - [58..64)::6
CSharpCodeBlock - [58..64)::6
CSharpExpressionLiteral - [58..64)::6 - [@count] - Gen<Expr>
Identifier;[@count];
CSharpExpressionLiteral - [64..65)::1 - [)] - Gen<None>
Text;[)];
MarkupMiscAttributeContent - [65..66)::1
MarkupTextLiteral - [65..66)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
ForwardSlash;[/];
CloseAngle;[>];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1 @@
TagHelper span at (30:3,0 [38] ) - PersonTagHelper

Просмотреть файл

@ -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] )

Просмотреть файл

@ -0,0 +1,70 @@
RazorDocument - [0..76)::76 - [@{ LF var count = "1";LF}LF<person age='Convert.ToInt32(@count + "2")' />]
MarkupBlock - [0..76)::76
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..28)::28
CSharpStatement - [0..28)::28
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..28)::27
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..27)::25
CSharpStatementLiteral - [2..27)::25 - [ LF var count = "1";LF] - Gen<Stmt>
Whitespace;[ ];
NewLine;[LF];
Whitespace;[ ];
Identifier;[var];
Whitespace;[ ];
Identifier;[count];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
StringLiteral;["1"];
Semicolon;[;];
NewLine;[LF];
RazorMetaCode - [27..28)::1 - Gen<None>
RightBrace;[}];
MarkupEphemeralTextLiteral - [28..30)::2 - [LF] - Gen<None>
NewLine;[LF];
MarkupTagHelperElement - [30..76)::46 - person[SelfClosing] - PersonTagHelper
MarkupTagHelperStartTag - [30..76)::46 - [<person age='Convert.ToInt32(@count + "2")' />] - Gen<Markup>
OpenAngle;[<];
Text;[person];
MarkupTagHelperAttribute - [37..73)::36 - age - SingleQuotes - Bound - [ age='Convert.ToInt32(@count + "2")']
MarkupTextLiteral - [37..38)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
MarkupTextLiteral - [38..41)::3 - [age] - Gen<Markup>
Text;[age];
Equals;[=];
MarkupTextLiteral - [42..43)::1 - ['] - Gen<Markup>
SingleQuote;['];
MarkupTagHelperAttributeValue - [43..72)::29
CSharpExpressionLiteral - [43..59)::16 - [Convert.ToInt32(] - Gen<None>
Text;[Convert.ToInt32(];
MarkupBlock - [59..65)::6
CSharpCodeBlock - [59..65)::6
CSharpImplicitExpression - [59..65)::6
CSharpTransition - [59..59)::0
Transition;[<Missing>];
CSharpImplicitExpressionBody - [59..65)::6
CSharpCodeBlock - [59..65)::6
CSharpExpressionLiteral - [59..65)::6 - [@count] - Gen<Expr>
Identifier;[@count];
CSharpExpressionLiteral - [65..67)::2 - [ +] - Gen<None>
Whitespace;[ ];
Text;[+];
CSharpExpressionLiteral - [67..72)::5 - [ "2")] - Gen<None>
Whitespace;[ ];
DoubleQuote;["];
Text;[2];
DoubleQuote;["];
Text;[)];
MarkupTextLiteral - [72..73)::1 - ['] - Gen<Markup>
SingleQuote;['];
MarkupMiscAttributeContent - [73..74)::1
MarkupTextLiteral - [73..74)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
ForwardSlash;[/];
CloseAngle;[>];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1 @@
TagHelper span at (30:3,0 [46] ) - PersonTagHelper

Просмотреть файл

@ -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] )

Просмотреть файл

@ -0,0 +1,57 @@
RazorDocument - [0..52)::52 - [@{ LF var count = 1;LF}LF<person age='@@count' />]
MarkupBlock - [0..52)::52
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..26)::26
CSharpStatement - [0..26)::26
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..26)::25
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..25)::23
CSharpStatementLiteral - [2..25)::23 - [ LF var count = 1;LF] - Gen<Stmt>
Whitespace;[ ];
NewLine;[LF];
Whitespace;[ ];
Identifier;[var];
Whitespace;[ ];
Identifier;[count];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
IntegerLiteral;[1];
Semicolon;[;];
NewLine;[LF];
RazorMetaCode - [25..26)::1 - Gen<None>
RightBrace;[}];
MarkupEphemeralTextLiteral - [26..28)::2 - [LF] - Gen<None>
NewLine;[LF];
MarkupTagHelperElement - [28..52)::24 - person[SelfClosing] - PersonTagHelper
MarkupTagHelperStartTag - [28..52)::24 - [<person age='@@count' />] - Gen<Markup>
OpenAngle;[<];
Text;[person];
MarkupTagHelperAttribute - [35..49)::14 - age - SingleQuotes - Bound - [ age='@@count']
MarkupTextLiteral - [35..36)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
MarkupTextLiteral - [36..39)::3 - [age] - Gen<Markup>
Text;[age];
Equals;[=];
MarkupTextLiteral - [40..41)::1 - ['] - Gen<Markup>
SingleQuote;['];
MarkupTagHelperAttributeValue - [41..48)::7
MarkupBlock - [41..43)::2
CSharpExpressionLiteral - [41..42)::1 - [@] - Gen<Expr>
Transition;[@];
CSharpEphemeralTextLiteral - [42..43)::1 - [@] - Gen<None>
Transition;[@];
CSharpExpressionLiteral - [43..48)::5 - [count] - Gen<None>
Text;[count];
MarkupTextLiteral - [48..49)::1 - ['] - Gen<Markup>
SingleQuote;['];
MarkupMiscAttributeContent - [49..50)::1
MarkupTextLiteral - [49..50)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
ForwardSlash;[/];
CloseAngle;[>];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1 @@
TagHelper span at (28:3,0 [24] ) - PersonTagHelper

Просмотреть файл

@ -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] )

Просмотреть файл

@ -0,0 +1,57 @@
RazorDocument - [0..52)::52 - [@{ LF var count = 1;LF}LF<person age="@@count" />]
MarkupBlock - [0..52)::52
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..26)::26
CSharpStatement - [0..26)::26
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..26)::25
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..25)::23
CSharpStatementLiteral - [2..25)::23 - [ LF var count = 1;LF] - Gen<Stmt>
Whitespace;[ ];
NewLine;[LF];
Whitespace;[ ];
Identifier;[var];
Whitespace;[ ];
Identifier;[count];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
IntegerLiteral;[1];
Semicolon;[;];
NewLine;[LF];
RazorMetaCode - [25..26)::1 - Gen<None>
RightBrace;[}];
MarkupEphemeralTextLiteral - [26..28)::2 - [LF] - Gen<None>
NewLine;[LF];
MarkupTagHelperElement - [28..52)::24 - person[SelfClosing] - PersonTagHelper
MarkupTagHelperStartTag - [28..52)::24 - [<person age="@@count" />] - Gen<Markup>
OpenAngle;[<];
Text;[person];
MarkupTagHelperAttribute - [35..49)::14 - age - DoubleQuotes - Bound - [ age="@@count"]
MarkupTextLiteral - [35..36)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
MarkupTextLiteral - [36..39)::3 - [age] - Gen<Markup>
Text;[age];
Equals;[=];
MarkupTextLiteral - [40..41)::1 - ["] - Gen<Markup>
DoubleQuote;["];
MarkupTagHelperAttributeValue - [41..48)::7
MarkupBlock - [41..43)::2
CSharpExpressionLiteral - [41..42)::1 - [@] - Gen<Expr>
Transition;[@];
CSharpEphemeralTextLiteral - [42..43)::1 - [@] - Gen<None>
Transition;[@];
CSharpExpressionLiteral - [43..48)::5 - [count] - Gen<None>
Text;[count];
MarkupTextLiteral - [48..49)::1 - ["] - Gen<Markup>
DoubleQuote;["];
MarkupMiscAttributeContent - [49..50)::1
MarkupTextLiteral - [49..50)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
ForwardSlash;[/];
CloseAngle;[>];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1 @@
TagHelper span at (28:3,0 [24] ) - PersonTagHelper

Просмотреть файл

@ -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] )

Просмотреть файл

@ -0,0 +1,53 @@
RazorDocument - [0..50)::50 - [@{ LF var count = 1;LF}LF<person age=@@count />]
MarkupBlock - [0..50)::50
MarkupTextLiteral - [0..0)::0 - [] - Gen<Markup>
Marker;[];
CSharpCodeBlock - [0..26)::26
CSharpStatement - [0..26)::26
CSharpTransition - [0..1)::1 - Gen<None>
Transition;[@];
CSharpStatementBody - [1..26)::25
RazorMetaCode - [1..2)::1 - Gen<None>
LeftBrace;[{];
CSharpCodeBlock - [2..25)::23
CSharpStatementLiteral - [2..25)::23 - [ LF var count = 1;LF] - Gen<Stmt>
Whitespace;[ ];
NewLine;[LF];
Whitespace;[ ];
Identifier;[var];
Whitespace;[ ];
Identifier;[count];
Whitespace;[ ];
Assign;[=];
Whitespace;[ ];
IntegerLiteral;[1];
Semicolon;[;];
NewLine;[LF];
RazorMetaCode - [25..26)::1 - Gen<None>
RightBrace;[}];
MarkupEphemeralTextLiteral - [26..28)::2 - [LF] - Gen<None>
NewLine;[LF];
MarkupTagHelperElement - [28..50)::22 - person[SelfClosing] - PersonTagHelper
MarkupTagHelperStartTag - [28..50)::22 - [<person age=@@count />] - Gen<Markup>
OpenAngle;[<];
Text;[person];
MarkupTagHelperAttribute - [35..47)::12 - age - DoubleQuotes - Bound - [ age=@@count]
MarkupTextLiteral - [35..36)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
MarkupTextLiteral - [36..39)::3 - [age] - Gen<Markup>
Text;[age];
Equals;[=];
MarkupTagHelperAttributeValue - [40..47)::7
MarkupBlock - [40..42)::2
CSharpExpressionLiteral - [40..41)::1 - [@] - Gen<Expr>
Transition;[@];
CSharpEphemeralTextLiteral - [41..42)::1 - [@] - Gen<None>
Transition;[@];
CSharpExpressionLiteral - [42..47)::5 - [count] - Gen<None>
Text;[count];
MarkupMiscAttributeContent - [47..48)::1
MarkupTextLiteral - [47..48)::1 - [ ] - Gen<Markup>
Whitespace;[ ];
ForwardSlash;[/];
CloseAngle;[>];
EndOfFile;[];

Просмотреть файл

@ -0,0 +1 @@
TagHelper span at (28:3,0 [22] ) - PersonTagHelper

Просмотреть файл

@ -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] )

Просмотреть файл

@ -22,10 +22,8 @@
Transition;[<Missing>];
CSharpImplicitExpressionBody - [14..32)::18
CSharpCodeBlock - [14..32)::18
CSharpExpressionLiteral - [14..15)::1 - [@] - Gen<Expr>
Transition;[@];
CSharpExpressionLiteral - [15..32)::17 - [DateTime.Now.Year] - Gen<Expr>
Identifier;[DateTime];
CSharpExpressionLiteral - [14..32)::18 - [@DateTime.Now.Year] - Gen<Expr>
Identifier;[@DateTime];
Dot;[.];
Identifier;[Now];
Dot;[.];

Просмотреть файл

@ -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] )

Просмотреть файл

@ -27,10 +27,8 @@
Transition;[<Missing>];
CSharpImplicitExpressionBody - [17..23)::6
CSharpCodeBlock - [17..23)::6
CSharpExpressionLiteral - [17..18)::1 - [@] - Gen<Expr>
Transition;[@];
CSharpExpressionLiteral - [18..23)::5 - [value] - Gen<Expr>
Identifier;[value];
CSharpExpressionLiteral - [17..23)::6 - [@value] - Gen<Expr>
Identifier;[@value];
CSharpExpressionLiteral - [23..25)::2 - [ +] - Gen<None>
Whitespace;[ ];
Text;[+];
@ -57,10 +55,8 @@
Transition;[<Missing>];
CSharpImplicitExpressionBody - [45..56)::11
CSharpCodeBlock - [45..56)::11
CSharpExpressionLiteral - [45..46)::1 - [@] - Gen<Expr>
Transition;[@];
CSharpExpressionLiteral - [46..56)::10 - [Bag["val"]] - Gen<Expr>
Identifier;[Bag];
CSharpExpressionLiteral - [45..56)::11 - [@Bag["val"]] - Gen<Expr>
Identifier;[@Bag];
LeftBracket;[[];
StringLiteral;["val"];
RightBracket;[]];
@ -87,10 +83,8 @@
Transition;[<Missing>];
CSharpImplicitExpressionBody - [72..85)::13
CSharpCodeBlock - [72..85)::13
CSharpExpressionLiteral - [72..73)::1 - [@] - Gen<Expr>
Transition;[@];
CSharpExpressionLiteral - [73..85)::12 - [DateTime.Now] - Gen<Expr>
Identifier;[DateTime];
CSharpExpressionLiteral - [72..85)::13 - [@DateTime.Now] - Gen<Expr>
Identifier;[@DateTime];
Dot;[.];
Identifier;[Now];
MarkupTextLiteral - [85..86)::1 - ['] - Gen<Markup>

Просмотреть файл

@ -595,18 +595,17 @@ internal static class TagHelperBlockRewriter
{
using var _ = SyntaxListBuilderPool.GetPooledBuilder<RazorSyntaxNode>(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<Syntax.InternalSyntax.SyntaxToken>(), AcceptedCharactersInternal.Any)
: null;
var expression = SyntaxFactory.CSharpExpressionLiteral(new SyntaxList<SyntaxToken>(node.Transition.Transition), MarkupChunkGenerator.Instance).WithEditHandler(editHandler);
expression = (CSharpExpressionLiteralSyntax)VisitCSharpExpressionLiteral(expression);
builder.Add(expression);
var rewrittenBody = (CSharpCodeBlockSyntax)VisitCSharpCodeBlock(((CSharpImplicitExpressionBodySyntax)node.Body).CSharpCode);
builder.AddRange(rewrittenBody.Children);
// 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 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 @@ internal static class TagHelperBlockRewriter
{
// 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<Syntax.InternalSyntax.SyntaxToken>(), AcceptedCharactersInternal.Any)
: null;