From 4c0afbad86f969acda6947ef07e464995ac74987 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Sun, 2 Apr 2017 22:17:48 -0700 Subject: [PATCH] Generate line mappings for empty expressions. - At design time we weren't generating line mappings when a user would type `@` or `@(`. This results in no C# IntelliSense being provided to the user because the editor hasn't mapped any of Razor to the C# buffer. - Updated the design time renderer and design time writer to account for empty expressions. - Modified the `DefaultIRLoweringPhase` to set source locations on empty expression nodes. - Re-generated test files to account for 0 length line mappings on empty expression nodes. #1155 --- .../CodeGeneration/DesignTimeBasicWriter.cs | 33 +++++++++++-------- .../DesignTimeCSharpRenderer.cs | 32 ++++++++++-------- .../DefaultRazorIRLoweringPhase.cs | 12 +++++++ ...tyExplicitExpression_DesignTime.codegen.cs | 5 +++ .../EmptyExplicitExpression_DesignTime.ir.txt | 2 +- ...ExplicitExpression_DesignTime.mappings.txt | 5 +++ ...EmptyExplicitExpression_Runtime.codegen.cs | 6 +++- .../EmptyExplicitExpression_Runtime.ir.txt | 2 +- ...icitExpressionInCode_DesignTime.codegen.cs | 5 +++ ...ImplicitExpressionInCode_DesignTime.ir.txt | 2 +- ...itExpressionInCode_DesignTime.mappings.txt | 7 +++- ...mplicitExpressionInCode_Runtime.codegen.cs | 6 +++- ...ptyImplicitExpressionInCode_Runtime.ir.txt | 2 +- ...tyImplicitExpression_DesignTime.codegen.cs | 5 +++ .../EmptyImplicitExpression_DesignTime.ir.txt | 2 +- ...ImplicitExpression_DesignTime.mappings.txt | 5 +++ ...EmptyImplicitExpression_Runtime.codegen.cs | 6 +++- .../EmptyImplicitExpression_Runtime.ir.txt | 2 +- ...licitExpressionAtEOF_DesignTime.codegen.cs | 5 +++ .../ExplicitExpressionAtEOF_DesignTime.ir.txt | 2 +- ...citExpressionAtEOF_DesignTime.mappings.txt | 5 +++ ...ExplicitExpressionAtEOF_Runtime.codegen.cs | 6 +++- .../ExplicitExpressionAtEOF_Runtime.ir.txt | 2 +- ...licitExpressionAtEOF_DesignTime.codegen.cs | 5 +++ .../ImplicitExpressionAtEOF_DesignTime.ir.txt | 2 +- ...citExpressionAtEOF_DesignTime.mappings.txt | 5 +++ ...ImplicitExpressionAtEOF_Runtime.codegen.cs | 6 +++- .../ImplicitExpressionAtEOF_Runtime.ir.txt | 2 +- 28 files changed, 136 insertions(+), 43 deletions(-) diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/DesignTimeBasicWriter.cs b/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/DesignTimeBasicWriter.cs index 589fc4e97d..f0638ba6de 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/DesignTimeBasicWriter.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/DesignTimeBasicWriter.cs @@ -21,11 +21,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.CodeGeneration throw new ArgumentNullException(nameof(node)); } - if (node.Children.Count == 0) - { - return; - } - if (node.Source != null) { using (context.Writer.BuildLinePragma(node.Source.Value)) @@ -34,19 +29,29 @@ namespace Microsoft.AspNetCore.Razor.Evolution.CodeGeneration context.Writer.WritePadding(offset, node.Source, context); context.Writer.WriteStartAssignment(RazorDesignTimeIRPass.DesignTimeVariable); - for (var i = 0; i < node.Children.Count; i++) + if (node.Children.Count > 0) { - if (node.Children[i] is RazorIRToken token && token.IsCSharp) + for (var i = 0; i < node.Children.Count; i++) { - context.AddLineMappingFor(token); - context.Writer.Write(token.Content); - } - else - { - // There may be something else inside the expression like a Template or another extension node. - context.RenderNode(node.Children[i]); + if (node.Children[i] is RazorIRToken token && token.IsCSharp) + { + context.AddLineMappingFor(token); + context.Writer.Write(token.Content); + } + else + { + // There may be something else inside the expression like a Template or another extension node. + context.RenderNode(node.Children[i]); + } } } + else + { + // When typing "@" / "@(" we still need to provide IntelliSense. This is taken care of by creating a 0 length + // line mapping. It's also important that this 0 length line mapping exists in a line pragma so when a user + // starts typing additional characters following their "@" they get appropriately located errors. + context.AddLineMappingFor(node); + } context.Writer.WriteLine(";"); } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/DesignTimeCSharpRenderer.cs b/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/DesignTimeCSharpRenderer.cs index 5645ae5aa7..123f8d99ab 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/DesignTimeCSharpRenderer.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/DesignTimeCSharpRenderer.cs @@ -19,10 +19,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.CodeGeneration public override void VisitCSharpExpression(CSharpExpressionIRNode node) { // We can't remove this yet, because it's still used recursively in a few places. - if (node.Children.Count == 0) - { - return; - } if (node.Source != null) { @@ -35,20 +31,30 @@ namespace Microsoft.AspNetCore.Razor.Evolution.CodeGeneration .Write(padding) .WriteStartAssignment(RazorDesignTimeIRPass.DesignTimeVariable); - for (var i = 0; i < node.Children.Count; i++) + if (node.Children.Count > 0) { + for (var i = 0; i < node.Children.Count; i++) + { var token = node.Children[i] as RazorIRToken; if (token != null && token.IsCSharp) - { - Context.AddLineMappingFor(token); - Context.Writer.Write(token.Content); - } - else - { - // There may be something else inside the expression like a Template or another extension node. - Visit(node.Children[i]); + { + Context.AddLineMappingFor(token); + Context.Writer.Write(token.Content); + } + else + { + // There may be something else inside the expression like a Template or another extension node. + Visit(node.Children[i]); + } } } + else + { + // When typing "@" / "@(" we still need to provide IntelliSense. This is taken care of by creating a 0 length + // line mapping. It's also important that this 0 length line mapping exists in a line pragma so when a user + // starts typing additional characters following their "@" they get appropriately located errors. + Context.AddLineMappingFor(node); + } Context.Writer.WriteLine(";"); } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorIRLoweringPhase.cs b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorIRLoweringPhase.cs index f5c159b29a..50c90af872 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorIRLoweringPhase.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorIRLoweringPhase.cs @@ -344,6 +344,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution _builder.Pop(); + var emptyExpression = true; if (expressionNode.Children.Count > 0) { var sourceRangeStart = expressionNode @@ -361,8 +362,19 @@ namespace Microsoft.AspNetCore.Razor.Evolution sourceRangeStart.Value.LineIndex, sourceRangeStart.Value.CharacterIndex, contentLength); + emptyExpression = false; } } + + if (emptyExpression) + { + expressionNode.Source = new SourceSpan( + block.Start.FilePath ?? FileName, + block.Start.AbsoluteIndex, + block.Start.LineIndex, + block.Start.CharacterIndex, + length: 0); + } } public override void VisitExpressionSpan(ExpressionChunkGenerator chunkGenerator, Span span) diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs index 3c6860c0da..773618c89c 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs @@ -13,6 +13,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles #pragma warning disable 1998 public async System.Threading.Tasks.Task ExecuteAsync() { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml" +__o = ; + +#line default +#line hidden } #pragma warning restore 1998 } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt index 925e948724..1b396c044f 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt @@ -17,4 +17,4 @@ Document - RazorIRToken - - CSharp - private static System.Object __o = null; RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] EmptyExplicitExpression.cshtml) - This is markup\n\n - CSharpExpression - + CSharpExpression - (18:2,0 [0] EmptyExplicitExpression.cshtml) diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt index e69de29bb2..6602518d8d 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt @@ -0,0 +1,5 @@ +Source Location: (18:2,0 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml) +|| +Generated Location: (678:16,6 [0] ) +|| + diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs index 4a984ff0fc..cd82f1a76b 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs @@ -10,7 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles public async System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("This is markup\r\n\r\n"); - Write(); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml" +Write(); + +#line default +#line hidden } #pragma warning restore 1998 } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt index 1672d1a28c..3dd0b1689a 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt @@ -6,4 +6,4 @@ Document - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression_Runtime - - RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] EmptyExplicitExpression.cshtml) - This is markup\n\n - CSharpExpression - + CSharpExpression - (18:2,0 [0] EmptyExplicitExpression.cshtml) diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs index 81cf07a02b..e120fcf4bd 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs @@ -15,6 +15,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml" +__o = ; + +#line default +#line hidden } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt index 2ea75162db..61a8dcc94b 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt @@ -18,6 +18,6 @@ Document - RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync CSharpStatement - (2:0,2 [6] EmptyImplicitExpressionInCode.cshtml) RazorIRToken - (2:0,2 [6] EmptyImplicitExpressionInCode.cshtml) - CSharp - \n - CSharpExpression - + CSharpExpression - (8:1,4 [0] EmptyImplicitExpressionInCode.cshtml) CSharpStatement - (9:1,5 [2] EmptyImplicitExpressionInCode.cshtml) RazorIRToken - (9:1,5 [2] EmptyImplicitExpressionInCode.cshtml) - CSharp - \n diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt index 140241e479..60153f956d 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt @@ -5,10 +5,15 @@ Generated Location: (593:15,14 [6] ) | | +Source Location: (8:1,4 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml) +|| +Generated Location: (712:18,6 [0] ) +|| + Source Location: (9:1,5 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml) | | -Generated Location: (618:17,17 [2] ) +Generated Location: (763:22,17 [2] ) | | diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs index 80478506d0..63b6e1c6bd 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs @@ -9,7 +9,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles #pragma warning disable 1998 public async System.Threading.Tasks.Task ExecuteAsync() { - Write(); +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml" +Write(); + +#line default +#line hidden } #pragma warning restore 1998 } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt index bc09e5ea09..e16d9e07d3 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt @@ -7,6 +7,6 @@ Document - RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync CSharpStatement - (2:0,2 [6] EmptyImplicitExpressionInCode.cshtml) RazorIRToken - (2:0,2 [6] EmptyImplicitExpressionInCode.cshtml) - CSharp - \n - CSharpExpression - + CSharpExpression - (8:1,4 [0] EmptyImplicitExpressionInCode.cshtml) CSharpStatement - (9:1,5 [2] EmptyImplicitExpressionInCode.cshtml) RazorIRToken - (9:1,5 [2] EmptyImplicitExpressionInCode.cshtml) - CSharp - \n diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs index 082f2d3dc1..cad4262f4b 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs @@ -13,6 +13,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles #pragma warning disable 1998 public async System.Threading.Tasks.Task ExecuteAsync() { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml" +__o = ; + +#line default +#line hidden } #pragma warning restore 1998 } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt index 45f9461905..4f59166635 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt @@ -17,5 +17,5 @@ Document - RazorIRToken - - CSharp - private static System.Object __o = null; RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] EmptyImplicitExpression.cshtml) - This is markup\n\n - CSharpExpression - + CSharpExpression - (18:2,0 [0] EmptyImplicitExpression.cshtml) HtmlContent - (19:2,1 [1] EmptyImplicitExpression.cshtml) - ! diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt index e69de29bb2..76c9a38517 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt @@ -0,0 +1,5 @@ +Source Location: (18:2,0 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml) +|| +Generated Location: (678:16,6 [0] ) +|| + diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs index f9c0c03ea9..2e32e425e2 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs @@ -10,7 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles public async System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("This is markup\r\n\r\n"); - Write(); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml" +Write(); + +#line default +#line hidden WriteLiteral("!"); } #pragma warning restore 1998 diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt index b30f9e8e51..123625eccd 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt @@ -6,5 +6,5 @@ Document - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression_Runtime - - RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] EmptyImplicitExpression.cshtml) - This is markup\n\n - CSharpExpression - + CSharpExpression - (18:2,0 [0] EmptyImplicitExpression.cshtml) HtmlContent - (19:2,1 [1] EmptyImplicitExpression.cshtml) - ! diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs index a2946f3345..8f4ae0f904 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs @@ -13,6 +13,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles #pragma warning disable 1998 public async System.Threading.Tasks.Task ExecuteAsync() { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml" +__o = ; + +#line default +#line hidden } #pragma warning restore 1998 } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt index ac0f573a83..5c63044269 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt @@ -17,4 +17,4 @@ Document - RazorIRToken - - CSharp - private static System.Object __o = null; RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] ExplicitExpressionAtEOF.cshtml) - This is markup\n\n - CSharpExpression - + CSharpExpression - (18:2,0 [0] ExplicitExpressionAtEOF.cshtml) diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt index e69de29bb2..61b61756f0 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt @@ -0,0 +1,5 @@ +Source Location: (18:2,0 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml) +|| +Generated Location: (678:16,6 [0] ) +|| + diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs index b0ff36425a..8ce77390b3 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs @@ -10,7 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles public async System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("This is markup\r\n\r\n"); - Write(); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml" +Write(); + +#line default +#line hidden } #pragma warning restore 1998 } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt index f186f40886..6dfdff3bd0 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt @@ -6,4 +6,4 @@ Document - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF_Runtime - - RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] ExplicitExpressionAtEOF.cshtml) - This is markup\n\n - CSharpExpression - + CSharpExpression - (18:2,0 [0] ExplicitExpressionAtEOF.cshtml) diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs index ec82fe56ab..7535874d7f 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs @@ -13,6 +13,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles #pragma warning disable 1998 public async System.Threading.Tasks.Task ExecuteAsync() { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml" +__o = ; + +#line default +#line hidden } #pragma warning restore 1998 } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt index b19b703b54..9081a833b0 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt @@ -17,4 +17,4 @@ Document - RazorIRToken - - CSharp - private static System.Object __o = null; RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] ImplicitExpressionAtEOF.cshtml) - This is markup\n\n - CSharpExpression - + CSharpExpression - (18:2,0 [0] ImplicitExpressionAtEOF.cshtml) diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt index e69de29bb2..5a4496890a 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt @@ -0,0 +1,5 @@ +Source Location: (18:2,0 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml) +|| +Generated Location: (678:16,6 [0] ) +|| + diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs index 5402342e93..86b3ba8bc5 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs @@ -10,7 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles public async System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("This is markup\r\n\r\n"); - Write(); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml" +Write(); + +#line default +#line hidden } #pragma warning restore 1998 } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt index dd5f61fc3c..6ff391a2e4 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt @@ -6,4 +6,4 @@ Document - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF_Runtime - - RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] ImplicitExpressionAtEOF.cshtml) - This is markup\n\n - CSharpExpression - + CSharpExpression - (18:2,0 [0] ImplicitExpressionAtEOF.cshtml)