From f47a40a4a7f1ce51e0f9689e3810360cb332419f Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 22 Dec 2016 15:36:17 -0800 Subject: [PATCH] Add Razor design time code generation. - Added a common csharp rendering phase base to put shared assets of runtime and design time code gen. - Added a new `DesignTimeIRPass` to setup the IR bits to provide accurate intellisense. - Added a `CodeGenerationIntegrationTest` and moved the RuntimeCodeGenerationTests into it. This way we can re-use the cshtml files and it makes searching/running the tests easy.. - Updated how line mappings are calculated for some nodes. #848 --- ...faultRazorDesignTimeCSharpLoweringPhase.cs | 197 ++- .../DefaultRazorRuntimeCSharpLoweringPhase.cs | 286 +--- .../Legacy/CSharpCodeWriter.cs | 7 - .../Legacy/LineMappingManager.cs | 22 - .../RazorCSharpLoweringPhaseBase.cs | 289 +++++ .../RazorDesignTimeIRPass.cs | 106 ++ .../RazorEngine.cs | 1 + .../CodeGenerationIntegrationTest.cs | 1155 +++++++++++++++++ .../IntegrationTests/IntegrationTestBase.cs | 47 +- .../LineMappingsSerializer.cs | 48 + .../RuntimeCodeGenerationIntegrationTest.cs | 599 --------- .../RazorEngineTest.cs | 3 +- .../Await.cshtml | 0 .../Await_DesignTime.codegen.cs | 108 ++ .../Await_DesignTime.mappings.txt | 95 ++ .../Await_Runtime.codegen.cs} | 30 +- .../Blocks.cshtml | 0 .../Blocks_DesignTime.codegen.cs | 135 ++ .../Blocks_DesignTime.mappings.txt | 139 ++ .../Blocks_Runtime.codegen.cs} | 42 +- .../CodeBlock.cshtml | 0 .../CodeBlockAtEOF.cshtml | 0 .../CodeBlockAtEOF_DesignTime.codegen.cs | 24 + .../CodeBlockAtEOF_DesignTime.mappings.txt | 5 + .../CodeBlockAtEOF_Runtime.codegen.cs} | 4 +- .../CodeBlockWithTextElement.cshtml | 0 ...BlockWithTextElement_DesignTime.codegen.cs | 41 + ...ockWithTextElement_DesignTime.mappings.txt | 26 + ...odeBlockWithTextElement_Runtime.codegen.cs | 34 + .../CodeBlock_DesignTime.codegen.cs | 27 + .../CodeBlock_DesignTime.mappings.txt | 13 + .../CodeBlock_Runtime.codegen.cs} | 6 +- .../ConditionalAttributes.cshtml | 0 ...onditionalAttributes_DesignTime.codegen.cs | 142 ++ ...ditionalAttributes_DesignTime.mappings.txt | 138 ++ .../ConditionalAttributes_Runtime.codegen.cs} | 26 +- .../DesignTime.cshtml | 0 .../DesignTime_DesignTime.codegen.cs | 64 + .../DesignTime_DesignTime.mappings.txt | 49 + .../EmptyCodeBlock.cshtml | 0 .../EmptyCodeBlock_DesignTime.codegen.cs | 24 + .../EmptyCodeBlock_DesignTime.mappings.txt | 5 + .../EmptyCodeBlock_Runtime.codegen.cs} | 4 +- .../EmptyExplicitExpression.cshtml | 0 ...tyExplicitExpression_DesignTime.codegen.cs | 19 + ...ExplicitExpression_DesignTime.mappings.txt | 0 ...mptyExplicitExpression_Runtime.codegen.cs} | 4 +- .../EmptyImplicitExpression.cshtml | 0 .../EmptyImplicitExpressionInCode.cshtml | 0 ...icitExpressionInCode_DesignTime.codegen.cs | 30 + ...itExpressionInCode_DesignTime.mappings.txt | 14 + ...plicitExpressionInCode_Runtime.codegen.cs} | 4 +- ...tyImplicitExpression_DesignTime.codegen.cs | 19 + ...ImplicitExpression_DesignTime.mappings.txt | 0 ...mptyImplicitExpression_Runtime.codegen.cs} | 4 +- .../ExplicitExpression.cshtml | 0 .../ExplicitExpressionAtEOF.cshtml | 0 ...licitExpressionAtEOF_DesignTime.codegen.cs | 19 + ...citExpressionAtEOF_DesignTime.mappings.txt | 0 ...xplicitExpressionAtEOF_Runtime.codegen.cs} | 4 +- .../ExplicitExpressionWithMarkup.cshtml | 0 ...ExpressionWithMarkup_DesignTime.codegen.cs | 26 + ...pressionWithMarkup_DesignTime.mappings.txt | 0 ...itExpressionWithMarkup_Runtime.codegen.cs} | 6 +- .../ExplicitExpression_DesignTime.codegen.cs | 24 + ...ExplicitExpression_DesignTime.mappings.txt | 5 + .../ExplicitExpression_Runtime.codegen.cs} | 6 +- .../ExpressionsInCode.cshtml | 0 .../ExpressionsInCode_DesignTime.codegen.cs | 67 + .../ExpressionsInCode_DesignTime.mappings.txt | 58 + .../ExpressionsInCode_Runtime.codegen.cs | 69 + .../FunctionsBlock.cshtml | 0 .../FunctionsBlockMinimal.cshtml | 0 ...unctionsBlockMinimal_DesignTime.codegen.cs | 27 + ...ctionsBlockMinimal_DesignTime.mappings.txt | 13 + .../FunctionsBlockMinimal_Runtime.codegen.cs} | 6 +- .../FunctionsBlock_DesignTime.codegen.cs | 39 + .../FunctionsBlock_DesignTime.mappings.txt | 29 + .../FunctionsBlock_Runtime.codegen.cs} | 8 +- .../HiddenSpansInCode.cshtml | 0 .../HiddenSpansInCode_DesignTime.codegen.cs | 30 + .../HiddenSpansInCode_DesignTime.mappings.txt | 14 + .../HiddenSpansInCode_Runtime.codegen.cs | 21 + .../HtmlCommentWithQuote_Double.cshtml | 0 ...mentWithQuote_Double_DesignTime.codegen.cs | 19 + ...ntWithQuote_Double_DesignTime.mappings.txt | 0 ...ommentWithQuote_Double_Runtime.codegen.cs} | 4 +- .../HtmlCommentWithQuote_Single.cshtml | 0 ...mentWithQuote_Single_DesignTime.codegen.cs | 19 + ...ntWithQuote_Single_DesignTime.mappings.txt | 0 ...ommentWithQuote_Single_Runtime.codegen.cs} | 4 +- .../ImplicitExpression.cshtml | 0 .../ImplicitExpressionAtEOF.cshtml | 0 ...licitExpressionAtEOF_DesignTime.codegen.cs | 19 + ...citExpressionAtEOF_DesignTime.mappings.txt | 0 ...mplicitExpressionAtEOF_Runtime.codegen.cs} | 4 +- .../ImplicitExpression_DesignTime.codegen.cs | 36 + ...ImplicitExpression_DesignTime.mappings.txt | 19 + .../ImplicitExpression_Runtime.codegen.cs | 33 + .../Imports.cshtml | 0 .../Imports_DesignTime.codegen.cs | 34 + .../Imports_DesignTime.mappings.txt | 10 + .../Imports_Runtime.codegen.cs} | 8 +- .../Inherits.cshtml | 0 .../Inherits_DesignTime.codegen.cs | 28 + .../Inherits_DesignTime.mappings.txt | 10 + .../Inherits_Runtime.codegen.cs} | 6 +- .../InlineBlocks.cshtml | 0 .../InlineBlocks_DesignTime.codegen.cs | 45 + .../InlineBlocks_DesignTime.mappings.txt | 25 + .../InlineBlocks_Runtime.codegen.cs} | 12 +- .../Instrumented.cshtml | 0 .../Instrumented_DesignTime.codegen.cs | 150 +++ .../Instrumented_DesignTime.mappings.txt | 153 +++ .../Instrumented_Runtime.codegen.cs} | 42 +- .../MarkupInCodeBlock.cshtml | 0 .../MarkupInCodeBlock_DesignTime.codegen.cs | 37 + .../MarkupInCodeBlock_DesignTime.mappings.txt | 23 + .../MarkupInCodeBlock_Runtime.codegen.cs | 35 + .../NestedCSharp.cshtml | 0 .../NestedCSharp_DesignTime.codegen.cs | 48 + .../NestedCSharp_DesignTime.mappings.txt | 35 + .../NestedCSharp_Runtime.codegen.cs} | 10 +- .../NestedCodeBlocks.cshtml | 0 .../NestedCodeBlocks_DesignTime.codegen.cs | 37 + .../NestedCodeBlocks_DesignTime.mappings.txt | 21 + .../NestedCodeBlocks_Runtime.codegen.cs | 33 + .../NoLinePragmas.cshtml | 0 .../NoLinePragmas_DesignTime.codegen.cs | 141 ++ .../NoLinePragmas_DesignTime.mappings.txt | 148 +++ .../NoLinePragmas_Runtime.codegen.cs} | 42 +- .../NullConditionalExpressions.cshtml | 0 ...nditionalExpressions_DesignTime.codegen.cs | 88 ++ ...itionalExpressions_DesignTime.mappings.txt | 75 ++ ...lConditionalExpressions_Runtime.codegen.cs | 59 + .../OpenedIf.cshtml | 0 .../OpenedIf_DesignTime.codegen.cs | 34 + .../OpenedIf_DesignTime.mappings.txt | 19 + .../OpenedIf_Runtime.codegen.cs} | 6 +- .../ParserError.cshtml | 0 .../ParserError_DesignTime.codegen.cs} | 10 +- .../ParserError_DesignTime.mappings.txt | 13 + .../ParserError_Runtime.codegen.cs | 24 + .../RazorComments.cshtml | 0 .../RazorComments_DesignTime.codegen.cs | 54 + .../RazorComments_DesignTime.mappings.txt | 47 + .../RazorComments_Runtime.codegen.cs} | 14 +- .../Sections.cshtml | 0 .../Sections_DesignTime.codegen.cs | 66 + .../Sections_DesignTime.mappings.txt | 44 + .../Sections_Runtime.codegen.cs} | 14 +- .../SimpleUnspacedIf.cshtml | 0 .../SimpleUnspacedIf_DesignTime.codegen.cs | 32 + .../SimpleUnspacedIf_DesignTime.mappings.txt | 16 + .../SimpleUnspacedIf_Runtime.codegen.cs | 28 + .../StringLiterals.cshtml | 0 .../StringLiterals_DesignTime.codegen.cs | 31 + .../StringLiterals_DesignTime.mappings.txt | 10 + .../StringLiterals_Runtime.codegen.cs} | 4 +- .../Templates.cshtml | 0 .../Templates_DesignTime.codegen.cs | 129 ++ .../Templates_DesignTime.mappings.txt | 138 ++ .../Templates_Runtime.codegen.cs} | 36 +- .../UnfinishedExpressionInCode.cshtml | 0 ...shedExpressionInCode_DesignTime.codegen.cs | 34 + ...edExpressionInCode_DesignTime.mappings.txt | 19 + ...inishedExpressionInCode_Runtime.codegen.cs | 20 + .../CodeBlockWithTextElement.codegen.cs | 34 - .../DesignTime.codegen.cs | 66 - .../ExpressionsInCode.codegen.cs | 69 - .../HiddenSpansInCode.codegen.cs | 21 - .../ImplicitExpression.codegen.cs | 33 - .../MarkupInCodeBlock.codegen.cs | 35 - .../NestedCodeBlocks.codegen.cs | 33 - .../NullConditionalExpressions.codegen.cs | 59 - .../SimpleUnspacedIf.codegen.cs | 28 - .../UnfinishedExpressionInCode.codegen.cs | 20 - 177 files changed, 5765 insertions(+), 1493 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.Razor.Evolution/Legacy/LineMappingManager.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpLoweringPhaseBase.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Evolution/RazorDesignTimeIRPass.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/LineMappingsSerializer.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/RuntimeCodeGenerationIntegrationTest.cs rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/Await.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/Await.codegen.cs => CodeGenerationIntegrationTest/Await_Runtime.codegen.cs} (66%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/Blocks.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/Blocks.codegen.cs => CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs} (52%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/CodeBlock.cshtml (100%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/CodeBlockAtEOF.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.codegen.cs => CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs} (52%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/CodeBlockWithTextElement.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/CodeBlock.codegen.cs => CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs} (55%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/ConditionalAttributes.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.codegen.cs => CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs} (68%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/DesignTime.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/EmptyCodeBlock.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/EmptyCodeBlock.codegen.cs => CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.codegen.cs} (56%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/EmptyExplicitExpression.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/ImplicitExpressionAtEOF.codegen.cs => CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs} (56%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/EmptyImplicitExpression.cshtml (100%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/EmptyImplicitExpressionInCode.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.codegen.cs => CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs} (51%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/EmptyImplicitExpression.codegen.cs => CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs} (58%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/ExplicitExpression.cshtml (100%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/ExplicitExpressionAtEOF.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/ExplicitExpressionAtEOF.codegen.cs => CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs} (56%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/ExplicitExpressionWithMarkup.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.codegen.cs => CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs} (54%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/ExplicitExpression.codegen.cs => CodeGenerationIntegrationTest/ExplicitExpression_Runtime.codegen.cs} (50%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/ExpressionsInCode.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.mappings.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.codegen.cs rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/FunctionsBlock.cshtml (100%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/FunctionsBlockMinimal.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/FunctionsBlockMinimal.codegen.cs => CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.codegen.cs} (52%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/FunctionsBlock.codegen.cs => CodeGenerationIntegrationTest/FunctionsBlock_Runtime.codegen.cs} (56%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/HiddenSpansInCode.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.mappings.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.codegen.cs rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/HtmlCommentWithQuote_Double.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.codegen.cs => CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs} (56%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/HtmlCommentWithQuote_Single.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.codegen.cs => CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs} (56%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/ImplicitExpression.cshtml (100%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/ImplicitExpressionAtEOF.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/EmptyExplicitExpression.codegen.cs => CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs} (56%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.mappings.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.codegen.cs rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/Imports.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Imports_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Imports_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/Imports.codegen.cs => CodeGenerationIntegrationTest/Imports_Runtime.codegen.cs} (64%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/Inherits.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/Inherits.codegen.cs => CodeGenerationIntegrationTest/Inherits_Runtime.codegen.cs} (52%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/InlineBlocks.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/InlineBlocks.codegen.cs => CodeGenerationIntegrationTest/InlineBlocks_Runtime.codegen.cs} (62%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/Instrumented.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/Instrumented.codegen.cs => CodeGenerationIntegrationTest/Instrumented_Runtime.codegen.cs} (53%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/MarkupInCodeBlock.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.mappings.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.codegen.cs rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/NestedCSharp.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/NestedCSharp.codegen.cs => CodeGenerationIntegrationTest/NestedCSharp_Runtime.codegen.cs} (51%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/NestedCodeBlocks.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.mappings.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.codegen.cs rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/NoLinePragmas.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/NoLinePragmas.codegen.cs => CodeGenerationIntegrationTest/NoLinePragmas_Runtime.codegen.cs} (50%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/NullConditionalExpressions.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.mappings.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_Runtime.codegen.cs rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/OpenedIf.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/OpenedIf.codegen.cs => CodeGenerationIntegrationTest/OpenedIf_Runtime.codegen.cs} (55%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/ParserError.cshtml (100%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/ParserError.codegen.cs => CodeGenerationIntegrationTest/ParserError_DesignTime.codegen.cs} (50%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.mappings.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_Runtime.codegen.cs rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/RazorComments.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/RazorComments.codegen.cs => CodeGenerationIntegrationTest/RazorComments_Runtime.codegen.cs} (55%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/Sections.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/Sections.codegen.cs => CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs} (69%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/SimpleUnspacedIf.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.mappings.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_Runtime.codegen.cs rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/StringLiterals.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/StringLiterals.codegen.cs => CodeGenerationIntegrationTest/StringLiterals_Runtime.codegen.cs} (96%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/Templates.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.mappings.txt rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest/Templates.codegen.cs => CodeGenerationIntegrationTest/Templates_Runtime.codegen.cs} (64%) rename test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/{RuntimeCodeGenerationIntegrationTest => CodeGenerationIntegrationTest}/UnfinishedExpressionInCode.cshtml (100%) create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.mappings.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_Runtime.codegen.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.codegen.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/DesignTime.codegen.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ExpressionsInCode.codegen.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/HiddenSpansInCode.codegen.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ImplicitExpression.codegen.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/MarkupInCodeBlock.codegen.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NestedCodeBlocks.codegen.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/NullConditionalExpressions.codegen.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/SimpleUnspacedIf.codegen.cs delete mode 100644 test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/UnfinishedExpressionInCode.codegen.cs diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorDesignTimeCSharpLoweringPhase.cs b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorDesignTimeCSharpLoweringPhase.cs index 121148ea09..2406ba43ba 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorDesignTimeCSharpLoweringPhase.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorDesignTimeCSharpLoweringPhase.cs @@ -1,9 +1,13 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; +using Microsoft.AspNetCore.Razor.Evolution.Intermediate; +using Microsoft.AspNetCore.Razor.Evolution.Legacy; + namespace Microsoft.AspNetCore.Razor.Evolution { - internal class DefaultRazorDesignTimeCSharpLoweringPhase : RazorEnginePhaseBase, IRazorCSharpLoweringPhase + internal class DefaultRazorDesignTimeCSharpLoweringPhase : RazorCSharpLoweringPhaseBase { protected override void ExecuteCore(RazorCodeDocument codeDocument) { @@ -13,7 +17,196 @@ namespace Microsoft.AspNetCore.Razor.Evolution var syntaxTree = codeDocument.GetSyntaxTree(); ThrowForMissingDependency(syntaxTree); - // Render design time CSharp + var renderingContext = new CSharpRenderingContext() + { + Writer = new CSharpCodeWriter(), + SourceDocument = codeDocument.Source, + Options = syntaxTree.Options, + }; + var visitor = new CSharpRenderer(renderingContext); + visitor.VisitDocument(irDocument); + var csharpDocument = new RazorCSharpDocument() + { + GeneratedCode = renderingContext.Writer.GenerateCode(), + LineMappings = renderingContext.LineMappings, + }; + + codeDocument.SetCSharpDocument(csharpDocument); + } + + private class CSharpRenderer : PageStructureCSharpRenderer + { + public CSharpRenderer(CSharpRenderingContext context) : base(context) + { + } + + public override void VisitCSharpToken(CSharpTokenIRNode node) + { + Context.Writer.Write(node.Content); + } + + public override void VisitCSharpExpression(CSharpExpressionIRNode node) + { + if (node.Children.Count == 0) + { + return; + } + + if (node.SourceRange != null) + { + using (new LinePragmaWriter(Context.Writer, node.SourceRange)) + { + var padding = BuildOffsetPadding(RazorDesignTimeIRPass.DesignTimeVariable.Length, node.SourceRange, Context); + + Context.Writer + .Write(padding) + .WriteStartAssignment(RazorDesignTimeIRPass.DesignTimeVariable); + + for (var i = 0; i < node.Children.Count; i++) + { + var childNode = node.Children[i]; + + if (childNode is CSharpTokenIRNode) + { + AddLineMappingFor(childNode); + } + + childNode.Accept(this); + } + + Context.Writer.WriteLine(";"); + } + } + else + { + Context.Writer.WriteStartAssignment(RazorDesignTimeIRPass.DesignTimeVariable); + VisitDefault(node); + Context.Writer.WriteLine(";"); + } + } + + public override void VisitUsingStatement(UsingStatementIRNode node) + { + Context.Writer.WriteUsing(node.Content); + } + + public override void VisitCSharpStatement(CSharpStatementIRNode node) + { + if (node.SourceRange != null) + { + using (new LinePragmaWriter(Context.Writer, node.SourceRange)) + { + var padding = BuildOffsetPadding(0, node.SourceRange, Context); + Context.Writer.Write(padding); + + AddLineMappingFor(node); + Context.Writer.Write(node.Content); + } + } + else + { + Context.Writer.WriteLine(node.Content); + } + } + + public override void VisitDirectiveToken(DirectiveTokenIRNode node) + { + const string TypeHelper = "__typeHelper"; + + var tokenKind = node.Descriptor.Kind; + if (node.SourceRange == null || node.Descriptor.Kind == DirectiveTokenKind.Literal) + { + return; + } + + // Wrap the directive token in a lambda to isolate variable names. + Context.Writer + .Write("((") + .Write(typeof(Action).FullName) + .Write(")("); + using (Context.Writer.BuildLambda(endLine: false)) + { + var originalIndent = Context.Writer.CurrentIndent; + Context.Writer.ResetIndent(); + switch (tokenKind) + { + case DirectiveTokenKind.Type: + + AddLineMappingFor(node); + Context.Writer + .Write(node.Content) + .Write(" ") + .WriteStartAssignment(TypeHelper) + .WriteLine("null;"); + break; + case DirectiveTokenKind.Member: + Context.Writer + .Write(typeof(object).FullName) + .Write(" "); + + AddLineMappingFor(node); + Context.Writer + .Write(node.Content) + .WriteLine(" = null;"); + break; + case DirectiveTokenKind.String: + Context.Writer + .Write(typeof(object).FullName) + .Write(" ") + .WriteStartAssignment(TypeHelper); + + if (node.Content.StartsWith("\"", StringComparison.Ordinal)) + { + AddLineMappingFor(node); + Context.Writer.Write(node.Content); + } + else + { + Context.Writer.Write("\""); + AddLineMappingFor(node); + Context.Writer + .Write(node.Content) + .Write("\""); + } + + Context.Writer.WriteLine(";"); + break; + } + Context.Writer.SetIndent(originalIndent); + } + Context.Writer.WriteLine("))();"); + + } + + public override void VisitTemplate(TemplateIRNode node) + { + const string ItemParameterName = "item"; + const string TemplateWriterName = "__razor_template_writer"; + + Context.Writer + .Write(ItemParameterName).Write(" => ") + .WriteStartNewObject("HelperResult" /* ORIGINAL: TemplateTypeName */); + + var initialRenderingConventions = Context.RenderingConventions; + var redirectConventions = new CSharpRedirectRenderingConventions(TemplateWriterName, Context.Writer); + Context.RenderingConventions = redirectConventions; + using (Context.Writer.BuildAsyncLambda(endLine: false, parameterNames: TemplateWriterName)) + { + VisitDefault(node); + } + Context.RenderingConventions = initialRenderingConventions; + + Context.Writer.WriteEndMethodInvocation(endLine: false); + } + + private void AddLineMappingFor(RazorIRNode node) + { + var sourceLocation = node.SourceRange; + var generatedLocation = new MappingLocation(Context.Writer.GetCurrentSourceLocation(), node.SourceRange.ContentLength); + var lineMapping = new LineMapping(sourceLocation, generatedLocation); + + Context.LineMappings.Add(lineMapping); + } } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorRuntimeCSharpLoweringPhase.cs b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorRuntimeCSharpLoweringPhase.cs index d85e3dca05..28f9796e20 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorRuntimeCSharpLoweringPhase.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorRuntimeCSharpLoweringPhase.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; @@ -11,7 +10,7 @@ using Microsoft.AspNetCore.Razor.Evolution.Legacy; namespace Microsoft.AspNetCore.Razor.Evolution { - internal class DefaultRazorRuntimeCSharpLoweringPhase : RazorEnginePhaseBase, IRazorCSharpLoweringPhase + internal class DefaultRazorRuntimeCSharpLoweringPhase : RazorCSharpLoweringPhaseBase { protected override void ExecuteCore(RazorCodeDocument codeDocument) { @@ -28,234 +27,17 @@ namespace Microsoft.AspNetCore.Razor.Evolution Options = syntaxTree.Options, }; var visitor = new CSharpRenderer(renderingContext); - visitor.VisitDefault(irDocument); + visitor.VisitDocument(irDocument); var csharpDocument = new RazorCSharpDocument() { GeneratedCode = renderingContext.Writer.GenerateCode(), - LineMappings = renderingContext.Writer.LineMappingManager.Mappings, + LineMappings = renderingContext.LineMappings, }; codeDocument.SetCSharpDocument(csharpDocument); } - public class CSharpRedirectRenderingConventions : CSharpRenderingConventions - { - private readonly string _redirectWriter; - - public CSharpRedirectRenderingConventions(string redirectWriter, CSharpCodeWriter writer) : base(writer) - { - _redirectWriter = redirectWriter; - } - - public override string StartWriteMethod => "WriteTo(" + _redirectWriter + ", " /* ORIGINAL: WriteToMethodName */; - - public override string StartWriteLiteralMethod => "WriteLiteralTo(" + _redirectWriter + ", " /* ORIGINAL: WriteLiteralToMethodName */; - - - public override string StartBeginWriteAttributeMethod => "BeginWriteAttributeTo(" + _redirectWriter + ", " /* ORIGINAL: BeginWriteAttributeToMethodName */; - - - public override string StartWriteAttributeValueMethod => "WriteAttributeValueTo(" + _redirectWriter + ", " /* ORIGINAL: WriteAttributeValueToMethodName */; - - - public override string StartEndWriteAttributeMethod => "EndWriteAttributeTo(" + _redirectWriter /* ORIGINAL: EndWriteAttributeToMethodName */; - } - - public class CSharpRenderingConventions - { - public CSharpRenderingConventions(CSharpCodeWriter writer) - { - Writer = writer; - } - - protected CSharpCodeWriter Writer { get; } - - public virtual string StartWriteMethod => "Write(" /* ORIGINAL: WriteMethodName */; - - public virtual string StartWriteLiteralMethod => "WriteLiteral(" /* ORIGINAL: WriteLiteralMethodName */; - - public virtual string StartBeginWriteAttributeMethod => "BeginWriteAttribute(" /* ORIGINAL: BeginWriteAttributeMethodName */; - - public virtual string StartWriteAttributeValueMethod => "WriteAttributeValue(" /* ORIGINAL: WriteAttributeValueMethodName */; - - public virtual string StartEndWriteAttributeMethod => "EndWriteAttribute(" /* ORIGINAL: EndWriteAttributeMethodName */; - } - - public class CSharpRenderingContext - { - private CSharpRenderingConventions _renderingConventions; - - public ICollection Directives { get; set; } - - public CSharpCodeWriter Writer { get; set; } - - public CSharpRenderingConventions RenderingConventions - { - get - { - if (_renderingConventions == null) - { - _renderingConventions = new CSharpRenderingConventions(Writer); - } - - return _renderingConventions; - } - set - { - _renderingConventions = value; - } - } - - public ICollection Errors { get; } = new List(); - - public RazorSourceDocument SourceDocument { get; set; } - - public RazorParserOptions Options { get; set; } - } - - public class LinePragmaWriter : IDisposable - { - private readonly CSharpCodeWriter _writer; - private readonly int _startIndent; - - public LinePragmaWriter(CSharpCodeWriter writer, MappingLocation documentLocation) - { - if (writer == null) - { - throw new ArgumentNullException(nameof(writer)); - } - - _writer = writer; - _startIndent = _writer.CurrentIndent; - _writer.ResetIndent(); - _writer.WriteLineNumberDirective(documentLocation, documentLocation.FilePath); - } - - public void Dispose() - { - // Need to add an additional line at the end IF there wasn't one already written. - // This is needed to work with the C# editor's handling of #line ... - var builder = _writer.Builder; - var endsWithNewline = builder.Length > 0 && builder[builder.Length - 1] == '\n'; - - // Always write at least 1 empty line to potentially separate code from pragmas. - _writer.WriteLine(); - - // Check if the previous empty line wasn't enough to separate code from pragmas. - if (!endsWithNewline) - { - _writer.WriteLine(); - } - - _writer - .WriteLineDefaultDirective() - .WriteLineHiddenDirective() - .SetIndent(_startIndent); - } - } - - public class PageStructureCSharpRenderer : RazorIRNodeWalker - { - protected readonly CSharpRenderingContext Context; - - public PageStructureCSharpRenderer(CSharpRenderingContext context) - { - Context = context; - } - - public override void VisitNamespace(NamespaceDeclarationIRNode node) - { - Context.Writer - .Write("namespace ") - .WriteLine(node.Content); - - using (Context.Writer.BuildScope()) - { - Context.Writer.WriteLineHiddenDirective(); - VisitDefault(node); - } - } - - public override void VisitRazorMethodDeclaration(RazorMethodDeclarationIRNode node) - { - Context.Writer - .WriteLine("#pragma warning disable 1998") - .Write(node.AccessModifier) - .Write(" "); - - if (node.Modifiers != null) - { - for (var i = 0; i < node.Modifiers.Count; i++) - { - Context.Writer.Write(node.Modifiers[i]); - - if (i + 1 < node.Modifiers.Count) - { - Context.Writer.Write(" "); - } - } - } - - Context.Writer - .Write(" ") - .Write(node.ReturnType) - .Write(" ") - .Write(node.Name) - .WriteLine("()"); - - using (Context.Writer.BuildScope()) - { - VisitDefault(node); - } - - Context.Writer.WriteLine("#pragma warning restore 1998"); - } - - public override void VisitClass(ClassDeclarationIRNode node) - { - Context.Writer - .Write(node.AccessModifier) - .Write(" class ") - .Write(node.Name); - - if (node.BaseType != null || node.Interfaces != null) - { - Context.Writer.Write(" : "); - } - - if (node.BaseType != null) - { - Context.Writer.Write(node.BaseType); - - if (node.Interfaces != null) - { - Context.Writer.WriteParameterSeparator(); - } - } - - if (node.Interfaces != null) - { - for (var i = 0; i < node.Interfaces.Count; i++) - { - Context.Writer.Write(node.Interfaces[i]); - - if (i + 1 < node.Interfaces.Count) - { - Context.Writer.WriteParameterSeparator(); - } - } - } - - Context.Writer.WriteLine(); - - using (Context.Writer.BuildScope()) - { - VisitDefault(node); - } - } - } - - public class CSharpRenderer : PageStructureCSharpRenderer + private class CSharpRenderer : PageStructureCSharpRenderer { public CSharpRenderer(CSharpRenderingContext context) : base(context) { @@ -316,7 +98,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution if (node.SourceRange != null) { linePragmaScope = new LinePragmaWriter(Context.Writer, node.SourceRange); - var padding = BuildOffsetPadding(Context.RenderingConventions.StartWriteMethod.Length, node.SourceRange); + var padding = BuildOffsetPadding(Context.RenderingConventions.StartWriteMethod.Length, node.SourceRange, Context); Context.Writer.Write(padding); } @@ -446,7 +228,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution { using (new LinePragmaWriter(Context.Writer, node.SourceRange)) { - var padding = BuildOffsetPadding(0, node.SourceRange); + var padding = BuildOffsetPadding(0, node.SourceRange, Context); Context.Writer .Write(padding) .WriteLine(node.Content); @@ -478,62 +260,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution Context.Writer.WriteEndMethodInvocation(endLine: false); } - - private static int CalculateExpressionPadding(MappingLocation sourceRange, CSharpRenderingContext context) - { - var spaceCount = 0; - for (var i = sourceRange.AbsoluteIndex - 1; i >= 0; i--) - { - var @char = context.SourceDocument[i]; - if (@char == '\n' || @char == '\r') - { - break; - } - else if (@char == '\t') - { - spaceCount += context.Options.TabSize; - } - else - { - spaceCount++; - } - } - - return spaceCount; - } - - private string BuildOffsetPadding(int generatedOffset, MappingLocation sourceRange) - { - var basePadding = CalculateExpressionPadding(sourceRange, Context); - var resolvedPadding = Math.Max(basePadding - generatedOffset, 0); - - if (Context.Options.IsIndentingWithTabs) - { - var spaces = resolvedPadding % Context.Options.TabSize; - var tabs = resolvedPadding / Context.Options.TabSize; - - return new string('\t', tabs) + new string(' ', spaces); - } - else - { - return new string(' ', resolvedPadding); - } - } - - private static void RenderExpressionInline(RazorIRNode node, CSharpRenderingContext context) - { - if (node is CSharpTokenIRNode) - { - context.Writer.Write(((CSharpTokenIRNode)node).Content); - } - else - { - for (var i = 0; i < node.Children.Count; i++) - { - RenderExpressionInline(node.Children[i], context); - } - } - } } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/CSharpCodeWriter.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/CSharpCodeWriter.cs index 3adf902dc7..a508043c4b 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/CSharpCodeWriter.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/CSharpCodeWriter.cs @@ -25,13 +25,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Legacy '\u2029', }; - public CSharpCodeWriter() - { - LineMappingManager = new LineMappingManager(); - } - - public LineMappingManager LineMappingManager { get; private set; } - public new CSharpCodeWriter Write(string data) { return (CSharpCodeWriter)base.Write(data); diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/LineMappingManager.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/LineMappingManager.cs deleted file mode 100644 index 7302ed738a..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Legacy/LineMappingManager.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; - -namespace Microsoft.AspNetCore.Razor.Evolution.Legacy -{ - internal class LineMappingManager - { - public LineMappingManager() - { - Mappings = new List(); - } - - public List Mappings { get; } - - public void AddMapping(MappingLocation documentLocation, MappingLocation generatedLocation) - { - Mappings.Add(new LineMapping(documentLocation, generatedLocation)); - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpLoweringPhaseBase.cs b/src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpLoweringPhaseBase.cs new file mode 100644 index 0000000000..c58f17475d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpLoweringPhaseBase.cs @@ -0,0 +1,289 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using Microsoft.AspNetCore.Razor.Evolution.Intermediate; +using Microsoft.AspNetCore.Razor.Evolution.Legacy; + +namespace Microsoft.AspNetCore.Razor.Evolution +{ + internal abstract class RazorCSharpLoweringPhaseBase : RazorEnginePhaseBase, IRazorCSharpLoweringPhase + { + protected static void RenderExpressionInline(RazorIRNode node, CSharpRenderingContext context) + { + if (node is CSharpTokenIRNode) + { + context.Writer.Write(((CSharpTokenIRNode)node).Content); + } + else + { + for (var i = 0; i < node.Children.Count; i++) + { + RenderExpressionInline(node.Children[i], context); + } + } + } + + protected static int CalculateExpressionPadding(MappingLocation sourceRange, CSharpRenderingContext context) + { + var spaceCount = 0; + for (var i = sourceRange.AbsoluteIndex - 1; i >= 0; i--) + { + var @char = context.SourceDocument[i]; + if (@char == '\n' || @char == '\r') + { + break; + } + else if (@char == '\t') + { + spaceCount += context.Options.TabSize; + } + else + { + spaceCount++; + } + } + + return spaceCount; + } + + protected static string BuildOffsetPadding(int generatedOffset, MappingLocation sourceRange, CSharpRenderingContext context) + { + var basePadding = CalculateExpressionPadding(sourceRange, context); + var resolvedPadding = Math.Max(basePadding - generatedOffset, 0); + + if (context.Options.IsIndentingWithTabs) + { + var spaces = resolvedPadding % context.Options.TabSize; + var tabs = resolvedPadding / context.Options.TabSize; + + return new string('\t', tabs) + new string(' ', spaces); + } + else + { + return new string(' ', resolvedPadding); + } + } + + protected class LinePragmaWriter : IDisposable + { + private readonly CSharpCodeWriter _writer; + private readonly int _startIndent; + + public LinePragmaWriter(CSharpCodeWriter writer, MappingLocation documentLocation) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + _writer = writer; + _startIndent = _writer.CurrentIndent; + _writer.ResetIndent(); + _writer.WriteLineNumberDirective(documentLocation, documentLocation.FilePath); + } + + public void Dispose() + { + // Need to add an additional line at the end IF there wasn't one already written. + // This is needed to work with the C# editor's handling of #line ... + var builder = _writer.Builder; + var endsWithNewline = builder.Length > 0 && builder[builder.Length - 1] == '\n'; + + // Always write at least 1 empty line to potentially separate code from pragmas. + _writer.WriteLine(); + + // Check if the previous empty line wasn't enough to separate code from pragmas. + if (!endsWithNewline) + { + _writer.WriteLine(); + } + + _writer + .WriteLineDefaultDirective() + .WriteLineHiddenDirective() + .SetIndent(_startIndent); + } + } + + protected class CSharpRedirectRenderingConventions : CSharpRenderingConventions + { + private readonly string _redirectWriter; + + public CSharpRedirectRenderingConventions(string redirectWriter, CSharpCodeWriter writer) : base(writer) + { + _redirectWriter = redirectWriter; + } + + public override string StartWriteMethod => "WriteTo(" + _redirectWriter + ", " /* ORIGINAL: WriteToMethodName */; + + public override string StartWriteLiteralMethod => "WriteLiteralTo(" + _redirectWriter + ", " /* ORIGINAL: WriteLiteralToMethodName */; + + + public override string StartBeginWriteAttributeMethod => "BeginWriteAttributeTo(" + _redirectWriter + ", " /* ORIGINAL: BeginWriteAttributeToMethodName */; + + + public override string StartWriteAttributeValueMethod => "WriteAttributeValueTo(" + _redirectWriter + ", " /* ORIGINAL: WriteAttributeValueToMethodName */; + + + public override string StartEndWriteAttributeMethod => "EndWriteAttributeTo(" + _redirectWriter /* ORIGINAL: EndWriteAttributeToMethodName */; + } + + protected class CSharpRenderingConventions + { + public CSharpRenderingConventions(CSharpCodeWriter writer) + { + Writer = writer; + } + + protected CSharpCodeWriter Writer { get; } + + public virtual string StartWriteMethod => "Write(" /* ORIGINAL: WriteMethodName */; + + public virtual string StartWriteLiteralMethod => "WriteLiteral(" /* ORIGINAL: WriteLiteralMethodName */; + + public virtual string StartBeginWriteAttributeMethod => "BeginWriteAttribute(" /* ORIGINAL: BeginWriteAttributeMethodName */; + + public virtual string StartWriteAttributeValueMethod => "WriteAttributeValue(" /* ORIGINAL: WriteAttributeValueMethodName */; + + public virtual string StartEndWriteAttributeMethod => "EndWriteAttribute(" /* ORIGINAL: EndWriteAttributeMethodName */; + } + + protected class CSharpRenderingContext + { + private CSharpRenderingConventions _renderingConventions; + + public ICollection Directives { get; set; } + + public List LineMappings { get; } = new List(); + + public CSharpCodeWriter Writer { get; set; } + + public CSharpRenderingConventions RenderingConventions + { + get + { + if (_renderingConventions == null) + { + _renderingConventions = new CSharpRenderingConventions(Writer); + } + + return _renderingConventions; + } + set + { + _renderingConventions = value; + } + } + + public ICollection Errors { get; } = new List(); + + public RazorSourceDocument SourceDocument { get; set; } + + public RazorParserOptions Options { get; set; } + } + + protected class PageStructureCSharpRenderer : RazorIRNodeWalker + { + protected readonly CSharpRenderingContext Context; + + public PageStructureCSharpRenderer(CSharpRenderingContext context) + { + Context = context; + } + + public override void VisitNamespace(NamespaceDeclarationIRNode node) + { + Context.Writer + .Write("namespace ") + .WriteLine(node.Content); + + using (Context.Writer.BuildScope()) + { + Context.Writer.WriteLineHiddenDirective(); + VisitDefault(node); + } + } + + public override void VisitRazorMethodDeclaration(RazorMethodDeclarationIRNode node) + { + Context.Writer.WriteLine("#pragma warning disable 1998"); + + Context.Writer + .Write(node.AccessModifier) + .Write(" "); + + if (node.Modifiers != null) + { + for (var i = 0; i < node.Modifiers.Count; i++) + { + Context.Writer.Write(node.Modifiers[i]); + + if (i + 1 < node.Modifiers.Count) + { + Context.Writer.Write(" "); + } + } + } + + Context.Writer + .Write(" ") + .Write(node.ReturnType) + .Write(" ") + .Write(node.Name) + .WriteLine("()"); + + using (Context.Writer.BuildScope()) + { + VisitDefault(node); + } + + Context.Writer.WriteLine("#pragma warning restore 1998"); + } + + public override void VisitClass(ClassDeclarationIRNode node) + { + Context.Writer + .Write(node.AccessModifier) + .Write(" class ") + .Write(node.Name); + + if (node.BaseType != null || node.Interfaces != null) + { + Context.Writer.Write(" : "); + } + + if (node.BaseType != null) + { + Context.Writer.Write(node.BaseType); + + if (node.Interfaces != null) + { + Context.Writer.WriteParameterSeparator(); + } + } + + if (node.Interfaces != null) + { + for (var i = 0; i < node.Interfaces.Count; i++) + { + Context.Writer.Write(node.Interfaces[i]); + + if (i + 1 < node.Interfaces.Count) + { + Context.Writer.WriteParameterSeparator(); + } + } + } + + Context.Writer.WriteLine(); + + using (Context.Writer.BuildScope()) + { + VisitDefault(node); + } + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/RazorDesignTimeIRPass.cs b/src/Microsoft.AspNetCore.Razor.Evolution/RazorDesignTimeIRPass.cs new file mode 100644 index 0000000000..edb0de9e12 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Evolution/RazorDesignTimeIRPass.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Razor.Evolution.Intermediate; +using Microsoft.AspNetCore.Razor.Evolution.Legacy; + +namespace Microsoft.AspNetCore.Razor.Evolution +{ + internal class RazorDesignTimeIRPass : RazorIRPassBase + { + internal const string DesignTimeVariable = "__o"; + + public override int Order => 25; + + public override DocumentIRNode ExecuteCore(DocumentIRNode irDocument) + { + var walker = new DesignTimeHelperWalker(); + walker.VisitDocument(irDocument); + + return irDocument; + } + + internal class DesignTimeHelperWalker : RazorIRNodeWalker + { + private DirectiveTokenHelperIRNode _directiveTokenHelper; + + public override void VisitClass(ClassDeclarationIRNode node) + { + + var designTimeHelperDeclaration = new CSharpStatementIRNode() + { + Content = $"private static {typeof(object).FullName} {DesignTimeVariable} = null;", + }; + + node.Children.Insert(0, designTimeHelperDeclaration); + + _directiveTokenHelper = new DirectiveTokenHelperIRNode(); + + VisitDefault(node); + + node.Children.Insert(0, _directiveTokenHelper); + } + + public override void VisitDirectiveToken(DirectiveTokenIRNode node) + { + _directiveTokenHelper.AddToMethodBody(node); + } + + private class DirectiveTokenHelperIRNode : RazorIRNode + { + private const string DirectiveTokenHelperMethodName = "__RazorDirectiveTokenHelpers__"; + private int _methodBodyIndex = 2; + + public DirectiveTokenHelperIRNode() + { + var disableWarningPragma = new CSharpStatementIRNode() + { + Content = "#pragma warning disable 219", + }; + Children.Add(disableWarningPragma); + + var methodStartNode = new CSharpStatementIRNode() + { + Content = "private void " + DirectiveTokenHelperMethodName + "() {" + }; + Children.Add(methodStartNode); + + var methodEndNode = new CSharpStatementIRNode() + { + Content = "}" + }; + Children.Add(methodEndNode); + + var restoreWarningPragma = new CSharpStatementIRNode() + { + Content = "#pragma warning restore 219", + }; + Children.Add(restoreWarningPragma); + } + + public override IList Children { get; } = new List(); + + public override RazorIRNode Parent { get; set; } + + internal override MappingLocation SourceRange { get; set; } + + public void AddToMethodBody(RazorIRNode node) + { + Children.Insert(_methodBodyIndex++, node); + } + + public override void Accept(RazorIRNodeVisitor visitor) + { + visitor.VisitDefault(this); + } + + public override TResult Accept(RazorIRNodeVisitor visitor) + { + return visitor.VisitDefault(this); + } + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/RazorEngine.cs b/src/Microsoft.AspNetCore.Razor.Evolution/RazorEngine.cs index 49de266da2..65577123b8 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/RazorEngine.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/RazorEngine.cs @@ -72,6 +72,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution builder.Phases.Add(new DefaultRazorDesignTimeCSharpLoweringPhase()); builder.Features.Add(new ConfigureDesignTimeOptions()); + builder.Features.Add(new RazorDesignTimeIRPass()); } public abstract IReadOnlyList Features { get; } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs new file mode 100644 index 0000000000..8e78a92715 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -0,0 +1,1155 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.IO; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Evolution.Intermediate; +using Xunit; +using Xunit.Sdk; + +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests +{ + public class CodeGenerationIntegrationTest : IntegrationTestBase + { + #region Runtime + [Fact] + public void UnfinishedExpressionInCode_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Templates_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void StringLiterals_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void SimpleUnspacedIf_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Sections_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void RazorComments_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ParserError_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void OpenedIf_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void NullConditionalExpressions_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void NoLinePragmas_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void NestedCSharp_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void NestedCodeBlocks_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void MarkupInCodeBlock_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Instrumented_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void InlineBlocks_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Inherits_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Imports_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ImplicitExpressionAtEOF_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ImplicitExpression_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void HtmlCommentWithQuote_Double_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void HtmlCommentWithQuote_Single_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void HiddenSpansInCode_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void FunctionsBlock_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void FunctionsBlockMinimal_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ExpressionsInCode_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ExplicitExpressionWithMarkup_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ExplicitExpressionAtEOF_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ExplicitExpression_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void EmptyImplicitExpressionInCode_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void EmptyImplicitExpression_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void EmptyExplicitExpression_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void EmptyCodeBlock_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ConditionalAttributes_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void CodeBlockWithTextElement_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void CodeBlockAtEOF_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void CodeBlock_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Blocks_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Await_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + #endregion + + #region DesignTime + [Fact] + public void UnfinishedExpressionInCode_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void Templates_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void StringLiterals_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void SimpleUnspacedIf_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void Sections_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void RazorComments_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void ParserError_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void OpenedIf_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void NullConditionalExpressions_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void NoLinePragmas_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void NestedCSharp_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void NestedCodeBlocks_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void MarkupInCodeBlock_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void Instrumented_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void InlineBlocks_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void Inherits_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void Imports_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void ImplicitExpressionAtEOF_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void ImplicitExpression_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void HtmlCommentWithQuote_Double_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void HtmlCommentWithQuote_Single_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void HiddenSpansInCode_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void FunctionsBlock_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void FunctionsBlockMinimal_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void ExpressionsInCode_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void ExplicitExpressionWithMarkup_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void ExplicitExpressionAtEOF_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void ExplicitExpression_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void EmptyImplicitExpressionInCode_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void EmptyImplicitExpression_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void EmptyExplicitExpression_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void EmptyCodeBlock_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void DesignTime_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void ConditionalAttributes_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void CodeBlockWithTextElement_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void CodeBlockAtEOF_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void CodeBlock_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void Blocks_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + + [Fact] + public void Await_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertDesignTimeDocumentMatchBaseline(document); + } + #endregion + + protected override RazorCodeDocument CreateCodeDocument() + { + if (Filename == null) + { + var message = $"{nameof(CreateCodeDocument)} should only be called from an integration test ({nameof(Filename)} is null)."; + throw new InvalidOperationException(message); + } + + var normalizedFileName = Filename.Substring(0, Filename.LastIndexOf("_")); + var sourceFilename = Path.ChangeExtension(normalizedFileName, ".cshtml"); + var testFile = TestFile.Create(sourceFilename); + if (!testFile.Exists()) + { + throw new XunitException($"The resource {sourceFilename} was not found."); + } + + return RazorCodeDocument.Create(TestRazorSourceDocument.CreateResource(sourceFilename)); + } + + private class ApiSetsIRTestAdapter : RazorIRPassBase + { + public override DocumentIRNode ExecuteCore(DocumentIRNode irDocument) + { + var walker = new ApiSetsIRWalker(); + walker.Visit(irDocument); + + return irDocument; + } + + private class ApiSetsIRWalker : RazorIRNodeWalker + { + public override void VisitClass(ClassDeclarationIRNode node) + { + node.Name = Filename.Replace('/', '_'); + node.AccessModifier = "public"; + + VisitDefault(node); + } + + public override void VisitNamespace(NamespaceDeclarationIRNode node) + { + node.Content = typeof(CodeGenerationIntegrationTest).Namespace + ".TestFiles"; + + VisitDefault(node); + } + + public override void VisitRazorMethodDeclaration(RazorMethodDeclarationIRNode node) + { + node.AccessModifier = "public"; + node.Modifiers = new[] { "async" }; + node.ReturnType = typeof(Task).FullName; + node.Name = "ExecuteAsync"; + + VisitDefault(node); + } + } + } + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/IntegrationTestBase.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/IntegrationTestBase.cs index b1e8e6e35a..3e0aa9dcd3 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/IntegrationTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/IntegrationTestBase.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.IO; using System.Reflection; #if NET451 @@ -10,7 +11,9 @@ using System.Runtime.Remoting.Messaging; #else using System.Threading; #endif +using System.Text; using Microsoft.AspNetCore.Razor.Evolution.Intermediate; +using Microsoft.AspNetCore.Razor.Evolution.Legacy; using Xunit; using Xunit.Sdk; using System.Runtime.InteropServices; @@ -70,7 +73,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests #endif } - protected RazorCodeDocument CreateCodeDocument() + protected virtual RazorCodeDocument CreateCodeDocument() { if (Filename == null) { @@ -155,5 +158,47 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests Assert.Equal(baseline, actual); } + + protected void AssertDesignTimeDocumentMatchBaseline(RazorCodeDocument document) + { + if (Filename == null) + { + var message = $"{nameof(AssertDesignTimeDocumentMatchBaseline)} should only be called from an integration test ({nameof(Filename)} is null)."; + throw new InvalidOperationException(message); + } + + var csharpDocument = document.GetCSharpDocument(); + Assert.NotNull(csharpDocument); + + var syntaxTree = document.GetSyntaxTree(); + Assert.NotNull(syntaxTree); + Assert.True(syntaxTree.Options.DesignTimeMode); + + // Validate generated code. + AssertCSharpDocumentMatchesBaseline(csharpDocument); + + var baselineFilename = Path.ChangeExtension(Filename, ".mappings.txt"); + var serializedMappings = LineMappingsSerializer.Serialize(csharpDocument, document.Source); + + if (GenerateBaselines) + { + var baselineFullPath = Path.Combine(TestProjectRoot, baselineFilename); + File.WriteAllText(baselineFullPath, serializedMappings); + return; + } + + var testFile = TestFile.Create(baselineFilename); + if (!testFile.Exists()) + { + throw new XunitException($"The resource {baselineFilename} was not found."); + } + + var baseline = testFile.ReadAllText(); + + // Normalize newlines to match those in the baseline. + var actual = serializedMappings.Replace("\r", "").Replace("\n", "\r\n"); + + Assert.Equal(baseline, actual); + } } } diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/LineMappingsSerializer.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/LineMappingsSerializer.cs new file mode 100644 index 0000000000..5e70d58498 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/LineMappingsSerializer.cs @@ -0,0 +1,48 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Text; +using Microsoft.AspNetCore.Razor.Evolution.Legacy; + +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests +{ + public static class LineMappingsSerializer + { + public static string Serialize(RazorCSharpDocument csharpDocument, RazorSourceDocument sourceDocument) + { + var builder = new StringBuilder(); + var charBuffer = new char[sourceDocument.Length]; + sourceDocument.CopyTo(0, charBuffer, 0, sourceDocument.Length); + var sourceContent = new string(charBuffer); + + for (var i = 0; i < csharpDocument.LineMappings.Count; i++) + { + var lineMapping = csharpDocument.LineMappings[i]; + + builder.Append("Source Location: "); + AppendMappingLocation(builder, lineMapping.DocumentLocation, sourceContent); + + builder.Append("Generated Location: "); + AppendMappingLocation(builder, lineMapping.GeneratedLocation, csharpDocument.GeneratedCode); + + builder.AppendLine(); + } + + return builder.ToString(); + } + + private static void AppendMappingLocation(StringBuilder builder, MappingLocation location, string content) + { + builder + .AppendLine(location.ToString()) + .Append("|"); + + for (var i = 0; i < location.ContentLength; i++) + { + builder.Append(content[location.AbsoluteIndex + i]); + } + + builder.AppendLine("|"); + } + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/RuntimeCodeGenerationIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/RuntimeCodeGenerationIntegrationTest.cs deleted file mode 100644 index 29a69bfe17..0000000000 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/RuntimeCodeGenerationIntegrationTest.cs +++ /dev/null @@ -1,599 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Evolution.Intermediate; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; - -namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests -{ - public class RuntimeCodeGenerationIntegrationTest : IntegrationTestBase - { - [Fact] - public void UnfinishedExpressionInCode() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void Templates() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void StringLiterals() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void SimpleUnspacedIf() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void Sections() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void RazorComments() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void ParserError() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void OpenedIf() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void NullConditionalExpressions() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void NoLinePragmas() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void NestedCSharp() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void NestedCodeBlocks() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void MarkupInCodeBlock() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void Instrumented() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void InlineBlocks() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void Inherits() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void Imports() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void ImplicitExpressionAtEOF() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void ImplicitExpression() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void HtmlCommentWithQuote_Double() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void HtmlCommentWithQuote_Single() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void HiddenSpansInCode() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void FunctionsBlock() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void FunctionsBlockMinimal() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void ExpressionsInCode() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void ExplicitExpressionWithMarkup() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void ExplicitExpressionAtEOF() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void ExplicitExpression() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void EmptyImplicitExpressionInCode() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void EmptyImplicitExpression() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void EmptyExplicitExpression() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void EmptyCodeBlock() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void DesignTime() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void ConditionalAttributes() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void CodeBlockWithTextElement() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void CodeBlockAtEOF() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void CodeBlock() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void Blocks() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - [Fact] - public void Await() - { - // Arrange - var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); - var document = CreateCodeDocument(); - - // Act - engine.Process(document); - - // Assert - AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); - } - - private class ApiSetsIRTestAdapter : RazorIRPassBase - { - public override DocumentIRNode ExecuteCore(DocumentIRNode irDocument) - { - var walker = new ApiSetsIRWalker(); - walker.Visit(irDocument); - - return irDocument; - } - - private class ApiSetsIRWalker : RazorIRNodeWalker - { - public override void VisitClass(ClassDeclarationIRNode node) - { - node.Name = Filename.Replace('/', '_'); - node.AccessModifier = "public"; - - VisitDefault(node); - } - - public override void VisitNamespace(NamespaceDeclarationIRNode node) - { - node.Content = typeof(RuntimeCodeGenerationIntegrationTest).Namespace + ".TestFiles"; - - VisitDefault(node); - } - - public override void VisitRazorMethodDeclaration(RazorMethodDeclarationIRNode node) - { - node.AccessModifier = "public"; - node.Modifiers = new[] { "async" }; - node.ReturnType = typeof(Task).FullName; - node.Name = "ExecuteAsync"; - - VisitDefault(node); - } - } - } - } -} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineTest.cs index 553712d4b0..342efc7172 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/RazorEngineTest.cs @@ -161,7 +161,8 @@ namespace Microsoft.AspNetCore.Razor.Evolution feature => Assert.IsType(feature), feature => Assert.IsType(feature), feature => Assert.IsType(feature), - feature => Assert.IsType(feature)); + feature => Assert.IsType(feature), + feature => Assert.IsType(feature)); } private static void AssertDefaultDesignTimePhases(IReadOnlyList phases) diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml rename to test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs new file mode 100644 index 0000000000..7b6baf9b8d --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs @@ -0,0 +1,108 @@ +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await_DesignTime + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + private static System.Object __o = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + __o = await Foo(); + +#line default +#line hidden +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + __o = await Foo(); + +#line default +#line hidden +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + await Foo(); + +#line default +#line hidden +#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + + +#line default +#line hidden +#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + __o = await Foo(); + +#line default +#line hidden +#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + + +#line default +#line hidden +#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + __o = await; + +#line default +#line hidden +#line 19 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + __o = await Foo(1, 2); + +#line default +#line hidden +#line 20 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + __o = await Foo.Bar(1, 2); + +#line default +#line hidden +#line 21 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + __o = await Foo("bob", true); + +#line default +#line hidden +#line 22 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + await Foo(something, hello: "world"); + +#line default +#line hidden +#line 23 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + await Foo.Bar(1, 2) + +#line default +#line hidden +#line 24 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + + +#line default +#line hidden +#line 24 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + __o = await Foo(boolValue: false); + +#line default +#line hidden +#line 24 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + + +#line default +#line hidden +#line 25 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + __o = await ("wrrronggg"); + +#line default +#line hidden + } + #pragma warning restore 1998 +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" + + public async Task Foo() + { + return "Bar"; + } + +#line default +#line hidden + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt new file mode 100644 index 0000000000..67a63f7639 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt @@ -0,0 +1,95 @@ +Source Location: (192:9,39 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +|await Foo()| +Generated Location: (679:16,42 [11] ) +|await Foo()| + +Source Location: (247:10,38 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +|await Foo()| +Generated Location: (847:21,41 [11] ) +|await Foo()| + +Source Location: (304:11,39 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +| await Foo(); | +Generated Location: (1013:26,39 [14] ) +| await Foo(); | + +Source Location: (371:12,46 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +| | +Generated Location: (1188:31,46 [1] ) +| | + +Source Location: (376:12,51 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +|await Foo()| +Generated Location: (1358:36,54 [11] ) +|await Foo()| + +Source Location: (391:12,66 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +| | +Generated Location: (1551:41,66 [1] ) +| | + +Source Location: (448:13,49 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +|await| +Generated Location: (1719:46,52 [5] ) +|await| + +Source Location: (578:18,42 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +|await Foo(1, 2)| +Generated Location: (1885:51,45 [15] ) +|await Foo(1, 2)| + +Source Location: (650:19,51 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +|await Foo.Bar(1, 2)| +Generated Location: (2070:56,54 [19] ) +|await Foo.Bar(1, 2)| + +Source Location: (716:20,41 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +|await Foo("bob", true)| +Generated Location: (2249:61,44 [22] ) +|await Foo("bob", true)| + +Source Location: (787:21,42 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +| await Foo(something, hello: "world"); | +Generated Location: (2429:66,42 [39] ) +| await Foo(something, hello: "world"); | + +Source Location: (884:22,51 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +| await Foo.Bar(1, 2) | +Generated Location: (2634:71,51 [21] ) +| await Foo.Bar(1, 2) | + +Source Location: (961:23,49 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +| | +Generated Location: (2819:76,49 [1] ) +| | + +Source Location: (966:23,54 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +|await Foo(boolValue: false)| +Generated Location: (2992:81,57 [27] ) +|await Foo(boolValue: false)| + +Source Location: (997:23,85 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +| | +Generated Location: (3220:86,85 [1] ) +| | + +Source Location: (1057:24,52 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +|await ("wrrronggg")| +Generated Location: (3391:91,55 [19] ) +|await ("wrrronggg")| + +Source Location: (12:0,12 [76] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) +| + public async Task Foo() + { + return "Bar"; + } +| +Generated Location: (3586:98,12 [76] ) +| + public async Task Foo() + { + return "Bar"; + } +| + diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.codegen.cs similarity index 66% rename from test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.codegen.cs rename to test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.codegen.cs index ba09e1e112..d975175ede 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.codegen.cs @@ -1,84 +1,84 @@ -#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "00b5e01b7a405dcfde7e4d512ee930daaa1778b5" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "00b5e01b7a405dcfde7e4d512ee930daaa1778b5" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden using System; using System.Threading.Tasks; - public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Await + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await_Runtime { #pragma warning disable 1998 public async System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n
\r\n

Basic Asynchronous Expression Test

\r\n

Basic Asynchronous Expression: "); -#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" Write(await Foo()); #line default #line hidden WriteLiteral("

\r\n

Basic Asynchronous Template: "); -#line 11 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" Write(await Foo()); #line default #line hidden WriteLiteral("

\r\n

Basic Asynchronous Statement: "); -#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" await Foo(); #line default #line hidden WriteLiteral("

\r\n

Basic Asynchronous Statement Nested: "); -#line 13 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" Write(await Foo()); #line default #line hidden WriteLiteral(" "); WriteLiteral("

\r\n

Basic Incomplete Asynchronous Statement: "); -#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" Write(await); #line default #line hidden WriteLiteral("

\r\n
\r\n\r\n
\r\n

Advanced Asynchronous Expression Test

\r\n

Advanced Asynchronous Expression: "); -#line 19 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 19 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" Write(await Foo(1, 2)); #line default #line hidden WriteLiteral("

\r\n

Advanced Asynchronous Expression Extended: "); -#line 20 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 20 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" Write(await Foo.Bar(1, 2)); #line default #line hidden WriteLiteral("

\r\n

Advanced Asynchronous Template: "); -#line 21 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 21 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" Write(await Foo("bob", true)); #line default #line hidden WriteLiteral("

\r\n

Advanced Asynchronous Statement: "); -#line 22 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 22 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" await Foo(something, hello: "world"); #line default #line hidden WriteLiteral("

\r\n

Advanced Asynchronous Statement Extended: "); -#line 23 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 23 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" await Foo.Bar(1, 2) #line default #line hidden WriteLiteral("

\r\n

Advanced Asynchronous Statement Nested: "); -#line 24 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 24 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" Write(await Foo(boolValue: false)); #line default #line hidden WriteLiteral(" "); WriteLiteral("

\r\n

Advanced Incomplete Asynchronous Statement: "); -#line 25 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 25 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" Write(await ("wrrronggg")); #line default @@ -86,7 +86,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles WriteLiteral("

\r\n
"); } #pragma warning restore 1998 -#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Await.cshtml" +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" public async Task Foo() { diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml rename to test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs new file mode 100644 index 0000000000..7adb8e37c2 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs @@ -0,0 +1,135 @@ +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks_DesignTime + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + private static System.Object __o = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + + int i = 1; + +#line default +#line hidden +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + while(i <= 10) { + + +#line default +#line hidden +#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + __o = i; + +#line default +#line hidden +#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + + i += 1; +} + +#line default +#line hidden +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + if(i == 11) { + + +#line default +#line hidden +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + +} + +#line default +#line hidden +#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + switch(i) { + case 11: + + +#line default +#line hidden +#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + + break; + default: + + +#line default +#line hidden +#line 19 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + + break; +} + +#line default +#line hidden +#line 23 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + for(int j = 1; j <= 10; j += 2) { + + +#line default +#line hidden +#line 24 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + __o = j; + +#line default +#line hidden +#line 24 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + +} + +#line default +#line hidden +#line 27 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + try { + + +#line default +#line hidden +#line 28 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + +} catch(Exception ex) { + + +#line default +#line hidden +#line 30 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + __o = ex.Message; + +#line default +#line hidden +#line 30 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + +} + +#line default +#line hidden +#line 33 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + __o = i; + +#line default +#line hidden +#line 35 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + lock(new object()) { + + +#line default +#line hidden +#line 36 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" + +} + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt new file mode 100644 index 0000000000..62acf3343e --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt @@ -0,0 +1,139 @@ +Source Location: (2:0,2 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +| + int i = 1; +| +Generated Location: (640:16,2 [18] ) +| + int i = 1; +| + +Source Location: (26:4,1 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +|while(i <= 10) { + | +Generated Location: (772:22,1 [22] ) +|while(i <= 10) { + | + +Source Location: (69:5,25 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +|i| +Generated Location: (937:28,28 [1] ) +|i| + +Source Location: (75:5,31 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +| + i += 1; +}| +Generated Location: (1085:33,31 [16] ) +| + i += 1; +}| + +Source Location: (96:9,1 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +|if(i == 11) { + | +Generated Location: (1218:40,1 [19] ) +|if(i == 11) { + | + +Source Location: (140:10,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +| +}| +Generated Location: (1382:46,29 [3] ) +| +}| + +Source Location: (148:13,1 [35] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +|switch(i) { + case 11: + | +Generated Location: (1502:52,1 [35] ) +|switch(i) { + case 11: + | + +Source Location: (219:15,44 [40] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +| + break; + default: + | +Generated Location: (1697:59,44 [40] ) +| + break; + default: + | + +Source Location: (288:18,37 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +| + break; +}| +Generated Location: (1890:67,37 [19] ) +| + break; +}| + +Source Location: (312:22,1 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +|for(int j = 1; j <= 10; j += 2) { + | +Generated Location: (2026:74,1 [39] ) +|for(int j = 1; j <= 10; j += 2) { + | + +Source Location: (378:23,31 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +|j| +Generated Location: (2215:80,34 [1] ) +|j| + +Source Location: (384:23,37 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +| +}| +Generated Location: (2370:85,37 [3] ) +| +}| + +Source Location: (392:26,1 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +|try { + | +Generated Location: (2490:91,1 [11] ) +|try { + | + +Source Location: (438:27,39 [31] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +| +} catch(Exception ex) { + | +Generated Location: (2656:97,39 [31] ) +| +} catch(Exception ex) { + | + +Source Location: (500:29,35 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +|ex.Message| +Generated Location: (2841:104,38 [10] ) +|ex.Message| + +Source Location: (515:29,50 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +| +}| +Generated Location: (3018:109,50 [3] ) +| +}| + +Source Location: (535:32,13 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +|i| +Generated Location: (3153:115,16 [1] ) +|i| + +Source Location: (545:34,1 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +|lock(new object()) { + | +Generated Location: (3272:120,1 [26] ) +|lock(new object()) { + | + +Source Location: (618:35,51 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) +| +}| +Generated Location: (3465:126,51 [3] ) +| +}| + diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs similarity index 52% rename from test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.codegen.cs rename to test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs index 36233ed55d..7ebecb26ee 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs @@ -1,15 +1,15 @@ -#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ba7d8f5f5159a2389c780aa606885ef6c917a45a" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ba7d8f5f5159a2389c780aa606885ef6c917a45a" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden using System; using System.Threading.Tasks; - public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_Blocks + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks_Runtime { #pragma warning disable 1998 public async System.Threading.Tasks.Task ExecuteAsync() { -#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" int i = 1; @@ -17,20 +17,20 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles #line default #line hidden WriteLiteral("\r\n"); -#line 5 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" while(i <= 10) { #line default #line hidden WriteLiteral("

Hello from C#, #"); -#line 6 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" Write(i); #line default #line hidden WriteLiteral("

\r\n"); -#line 7 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" i += 1; } @@ -38,21 +38,21 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles #line default #line hidden WriteLiteral("\r\n"); -#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" if(i == 11) { #line default #line hidden WriteLiteral("

We wrote 10 lines!

\r\n"); -#line 12 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" } #line default #line hidden WriteLiteral("\r\n"); -#line 14 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" switch(i) { case 11: @@ -60,7 +60,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles #line default #line hidden WriteLiteral("

No really, we wrote 10 lines!

\r\n"); -#line 17 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 17 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" break; default: @@ -68,7 +68,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles #line default #line hidden WriteLiteral("

Actually, we didn\'t...

\r\n"); -#line 20 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 20 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" break; } @@ -76,67 +76,67 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles #line default #line hidden WriteLiteral("\r\n"); -#line 23 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 23 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" for(int j = 1; j <= 10; j += 2) { #line default #line hidden WriteLiteral("

Hello again from C#, #"); -#line 24 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 24 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" Write(j); #line default #line hidden WriteLiteral("

\r\n"); -#line 25 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 25 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" } #line default #line hidden WriteLiteral("\r\n"); -#line 27 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 27 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" try { #line default #line hidden WriteLiteral("

That time, we wrote 5 lines!

\r\n"); -#line 29 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 29 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" } catch(Exception ex) { #line default #line hidden WriteLiteral("

Oh no! An error occurred: "); -#line 30 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 30 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" Write(ex.Message); #line default #line hidden WriteLiteral("

\r\n"); -#line 31 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 31 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" } #line default #line hidden WriteLiteral("\r\n

i is now "); -#line 33 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 33 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" Write(i); #line default #line hidden WriteLiteral("

\r\n\r\n"); -#line 35 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 35 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" lock(new object()) { #line default #line hidden WriteLiteral("

This block is locked, for your security!

\r\n"); -#line 37 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/Blocks.cshtml" +#line 37 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" } #line default diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.cshtml rename to test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml rename to test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs new file mode 100644 index 0000000000..db360b37d0 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs @@ -0,0 +1,24 @@ +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF_DesignTime + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + private static System.Object __o = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml" + + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt new file mode 100644 index 0000000000..c672f85882 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt @@ -0,0 +1,5 @@ +Source Location: (2:0,2 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml) +|| +Generated Location: (656:16,2 [0] ) +|| + diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs similarity index 52% rename from test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.codegen.cs rename to test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs index 959a3cc74b..6df7bb5f1e 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs @@ -1,10 +1,10 @@ -#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5f82673b13daf5e28291f3bfb58df5e3a94e13cc" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5f82673b13daf5e28291f3bfb58df5e3a94e13cc" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden using System; using System.Threading.Tasks; - public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_CodeBlockAtEOF + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF_Runtime { #pragma warning disable 1998 public async System.Threading.Tasks.Task ExecuteAsync() diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml rename to test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs new file mode 100644 index 0000000000..bc239c17b0 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs @@ -0,0 +1,41 @@ +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement_DesignTime + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + private static System.Object __o = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" + + var a = 1; + +#line default +#line hidden +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" + + var b = 1; + +#line default +#line hidden +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" + __o = a+b; + +#line default +#line hidden +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" + + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt new file mode 100644 index 0000000000..fb76c94560 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt @@ -0,0 +1,26 @@ +Source Location: (2:0,2 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) +| + var a = 1; | +Generated Location: (676:16,2 [17] ) +| + var a = 1; | + +Source Location: (35:1,31 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) +| + var b = 1; | +Generated Location: (857:22,31 [22] ) +| + var b = 1; | + +Source Location: (69:2,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) +|a+b| +Generated Location: (1053:28,41 [3] ) +|a+b| + +Source Location: (80:2,40 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) +| +| +Generated Location: (1239:33,49 [2] ) +| +| + diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs new file mode 100644 index 0000000000..d558cb7591 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs @@ -0,0 +1,34 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "13e48ff59aab8106ceb68dd4a10b0bdf10c322fc" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement_Runtime + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" + + var a = 1; + +#line default +#line hidden + WriteLiteral("foo"); +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" + + var b = 1; + +#line default +#line hidden + WriteLiteral("bar "); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" + Write(a+b); + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs new file mode 100644 index 0000000000..586b44cdfc --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs @@ -0,0 +1,27 @@ +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock_DesignTime + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + private static System.Object __o = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml" + + for(int i = 1; i <= 10; i++) { + Output.Write("

Hello from C#, #" + i.ToString() + "

"); + } + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt new file mode 100644 index 0000000000..c503c5b073 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (2:0,2 [115] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml) +| + for(int i = 1; i <= 10; i++) { + Output.Write("

Hello from C#, #" + i.ToString() + "

"); + } +| +Generated Location: (646:16,2 [115] ) +| + for(int i = 1; i <= 10; i++) { + Output.Write("

Hello from C#, #" + i.ToString() + "

"); + } +| + diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs similarity index 55% rename from test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.codegen.cs rename to test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs index 8e917bebc8..f0a975184d 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs @@ -1,15 +1,15 @@ -#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "019ce8023d064d08ca88c597b764aea895ec5841" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "019ce8023d064d08ca88c597b764aea895ec5841" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden using System; using System.Threading.Tasks; - public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_CodeBlock + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock_Runtime { #pragma warning disable 1998 public async System.Threading.Tasks.Task ExecuteAsync() { -#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/CodeBlock.cshtml" +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml" for(int i = 1; i <= 10; i++) { Output.Write("

Hello from C#, #" + i.ToString() + "

"); diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml rename to test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs new file mode 100644 index 0000000000..417c57e3f0 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs @@ -0,0 +1,142 @@ +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes_DesignTime + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + private static System.Object __o = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + var ch = true; + var cls = "bar"; + + +#line default +#line hidden +#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + + +#line default +#line hidden +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + __o = cls; + +#line default +#line hidden +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + + +#line default +#line hidden +#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + __o = cls; + +#line default +#line hidden +#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + + +#line default +#line hidden +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + __o = cls; + +#line default +#line hidden +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + + +#line default +#line hidden +#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + __o = ch; + +#line default +#line hidden +#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + + +#line default +#line hidden +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + __o = ch; + +#line default +#line hidden +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + + +#line default +#line hidden +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + if(cls != null) { + +#line default +#line hidden +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + __o = cls; + +#line default +#line hidden +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + } + +#line default +#line hidden +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + + +#line default +#line hidden +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + + +#line default +#line hidden +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + __o = Url.Content("~/Scripts/jquery-1.6.2.min.js"); + +#line default +#line hidden +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + + +#line default +#line hidden +#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + __o = Url.Content("~/Scripts/modernizr-2.0.6-development-only.js"); + +#line default +#line hidden +#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + + +#line default +#line hidden +#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" + + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt new file mode 100644 index 0000000000..34f0862e29 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt @@ -0,0 +1,138 @@ +Source Location: (2:0,2 [48] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| + var ch = true; + var cls = "bar"; + | +Generated Location: (670:16,2 [48] ) +| + var ch = true; + var cls = "bar"; + | + +Source Location: (66:3,20 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| + | +Generated Location: (868:24,20 [6] ) +| + | + +Source Location: (83:4,15 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +|cls| +Generated Location: (1022:30,18 [3] ) +|cls| + +Source Location: (90:4,22 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| + | +Generated Location: (1178:35,22 [6] ) +| + | + +Source Location: (111:5,19 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +|cls| +Generated Location: (1336:41,22 [3] ) +|cls| + +Source Location: (118:5,26 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| + | +Generated Location: (1496:46,26 [6] ) +| + | + +Source Location: (135:6,15 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +|cls| +Generated Location: (1650:52,18 [3] ) +|cls| + +Source Location: (146:6,26 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| + | +Generated Location: (1810:57,26 [6] ) +| + | + +Source Location: (185:7,37 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +|ch| +Generated Location: (1986:63,40 [2] ) +|ch| + +Source Location: (191:7,43 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| + | +Generated Location: (2162:68,43 [6] ) +| + | + +Source Location: (234:8,41 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +|ch| +Generated Location: (2342:74,44 [2] ) +|ch| + +Source Location: (240:8,47 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| + | +Generated Location: (2522:79,47 [6] ) +| + | + +Source Location: (257:9,15 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +|if(cls != null) { | +Generated Location: (2674:85,15 [18] ) +|if(cls != null) { | + +Source Location: (276:9,34 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +|cls| +Generated Location: (2860:90,37 [3] ) +|cls| + +Source Location: (279:9,37 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| }| +Generated Location: (3032:95,37 [2] ) +| }| + +Source Location: (285:9,43 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| + | +Generated Location: (3208:100,43 [6] ) +| + | + +Source Location: (309:10,22 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| + | +Generated Location: (3367:106,22 [6] ) +| + | + +Source Location: (329:11,18 [44] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +|Url.Content("~/Scripts/jquery-1.6.2.min.js")| +Generated Location: (3525:112,21 [44] ) +|Url.Content("~/Scripts/jquery-1.6.2.min.js")| + +Source Location: (407:11,96 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| + | +Generated Location: (3797:117,96 [6] ) +| + | + +Source Location: (427:12,18 [60] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +|Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")| +Generated Location: (3955:123,21 [60] ) +|Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")| + +Source Location: (521:12,112 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| + | +Generated Location: (4259:128,112 [6] ) +| + | + +Source Location: (638:13,115 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) +| +| +Generated Location: (4511:134,115 [2] ) +| +| + diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs similarity index 68% rename from test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.codegen.cs rename to test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs index 33b1e6cb50..350396d06d 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs @@ -1,15 +1,15 @@ -#pragma checksum "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "088be4e50958bcab0f1d1ac04d2c28dcd8049bf5" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "088be4e50958bcab0f1d1ac04d2c28dcd8049bf5" namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles { #line hidden using System; using System.Threading.Tasks; - public class TestFiles_IntegrationTests_RuntimeCodeGenerationIntegrationTest_ConditionalAttributes + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes_Runtime { #pragma warning disable 1998 public async System.Threading.Tasks.Task ExecuteAsync() { -#line 1 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml" +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" var ch = true; var cls = "bar"; @@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles #line hidden WriteLiteral(" \r\n \r\n \r\n \r\n \r\n \r\n { -#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml" +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" if(cls != null) { #line default #line hidden -#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml" +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" WriteTo(__razor_attribute_value_writer, cls); #line default #line hidden -#line 10 "TestFiles/IntegrationTests/RuntimeCodeGenerationIntegrationTest/ConditionalAttributes.cshtml" +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" } #line default @@ -83,7 +83,7 @@ WriteTo(__razor_attribute_value_writer, cls); EndWriteAttribute(); WriteLiteral(" />\r\n \r\n \r\n