Update codegen to be compatible with MVC

This commit is contained in:
Ryan Nowak 2017-01-27 16:47:33 -08:00
parent 25831260f7
commit 93981ab13e
4 changed files with 32 additions and 32 deletions

View File

@ -28,8 +28,8 @@ namespace Microsoft.AspNetCore.Razor.Evolution
private static void AddInstrumentation(InstrumentationItem item) private static void AddInstrumentation(InstrumentationItem item)
{ {
var beginContextMethodName = "Instrumentation.BeginContext"; /* ORIGINAL: BeginContextMethodName */ var beginContextMethodName = "BeginContext"; /* ORIGINAL: BeginContextMethodName */
var endContextMethodName = "Instrumentation.EndContext"; /* ORIGINAL: EndContextMethodName */ var endContextMethodName = "EndContext"; /* ORIGINAL: EndContextMethodName */
var beginNode = new CSharpStatementIRNode() var beginNode = new CSharpStatementIRNode()
{ {

View File

@ -219,7 +219,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate
try try
{ {
var beginNode = Assert.IsType<CSharpStatementIRNode>(node); var beginNode = Assert.IsType<CSharpStatementIRNode>(node);
Assert.Equal($"Instrumentation.BeginContext({expected});", beginNode.Content); Assert.Equal($"BeginContext({expected});", beginNode.Content);
} }
catch (XunitException e) catch (XunitException e)
{ {
@ -232,7 +232,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate
try try
{ {
var endNode = Assert.IsType<CSharpStatementIRNode>(node); var endNode = Assert.IsType<CSharpStatementIRNode>(node);
Assert.Equal("Instrumentation.EndContext();", endNode.Content); Assert.Equal("EndContext();", endNode.Content);
} }
catch (XunitException e) catch (XunitException e)
{ {

View File

@ -32,23 +32,23 @@ namespace
#pragma warning disable 1998 #pragma warning disable 1998
() ()
{ {
Instrumentation.BeginContext(31, 28, true); BeginContext(31, 28, true);
WriteLiteral("<span someattr>Hola</span>\r\n"); WriteLiteral("<span someattr>Hola</span>\r\n");
Instrumentation.EndContext(); EndContext();
Instrumentation.BeginContext(61, 7, false); BeginContext(61, 7, false);
#line 3 "TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.cshtml" #line 3 "TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.cshtml"
Write("Hello"); Write("Hello");
#line default #line default
#line hidden #line hidden
Instrumentation.EndContext(); EndContext();
Instrumentation.BeginContext(69, 2, true); BeginContext(69, 2, true);
WriteLiteral("\r\n"); WriteLiteral("\r\n");
Instrumentation.EndContext(); EndContext();
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => {
Instrumentation.BeginContext(91, 6, true); BeginContext(91, 6, true);
WriteLiteral("\r\n "); WriteLiteral("\r\n ");
Instrumentation.EndContext(); EndContext();
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => {
} }
); );
@ -57,7 +57,7 @@ Write("Hello");
__InputTagHelper.FooProp = (string)__tagHelperAttribute_0.Value; __InputTagHelper.FooProp = (string)__tagHelperAttribute_0.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
Instrumentation.BeginContext(97, 33, false); BeginContext(97, 33, false);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified) if (!__tagHelperExecutionContext.Output.IsContentModified)
{ {
@ -65,16 +65,16 @@ Write("Hello");
} }
Write(__tagHelperExecutionContext.Output); Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End(); __tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.EndContext(); EndContext();
Instrumentation.BeginContext(130, 2, true); BeginContext(130, 2, true);
WriteLiteral("\r\n"); WriteLiteral("\r\n");
Instrumentation.EndContext(); EndContext();
} }
); );
__FormTagHelper = CreateTagHelper<global::FormTagHelper>(); __FormTagHelper = CreateTagHelper<global::FormTagHelper>();
__tagHelperExecutionContext.Add(__FormTagHelper); __tagHelperExecutionContext.Add(__FormTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
Instrumentation.BeginContext(71, 68, false); BeginContext(71, 68, false);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified) if (!__tagHelperExecutionContext.Output.IsContentModified)
{ {
@ -82,7 +82,7 @@ Write("Hello");
} }
Write(__tagHelperExecutionContext.Output); Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End(); __tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.EndContext(); EndContext();
} }
#pragma warning restore 1998 #pragma warning restore 1998
} }

View File

@ -9,34 +9,34 @@ Document -
DeclarePreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 - unbound - foo - HtmlAttributeValueStyle.DoubleQuotes DeclarePreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 - unbound - foo - HtmlAttributeValueStyle.DoubleQuotes
DeclareTagHelperFields - - FormTagHelper - InputTagHelper DeclareTagHelperFields - - FormTagHelper - InputTagHelper
RazorMethodDeclaration - - - - - RazorMethodDeclaration - - - - -
CSharpStatement - - Instrumentation.BeginContext(31, 28, true); CSharpStatement - - BeginContext(31, 28, true);
HtmlContent - (31:1,0 [28] BasicTest.cshtml) - <span someattr>Hola</span>\n HtmlContent - (31:1,0 [28] BasicTest.cshtml) - <span someattr>Hola</span>\n
CSharpStatement - - Instrumentation.EndContext(); CSharpStatement - - EndContext();
CSharpStatement - - Instrumentation.BeginContext(61, 7, false); CSharpStatement - - BeginContext(61, 7, false);
CSharpExpression - (61:2,2 [7] BasicTest.cshtml) CSharpExpression - (61:2,2 [7] BasicTest.cshtml)
CSharpToken - (61:2,2 [7] BasicTest.cshtml) - "Hello" CSharpToken - (61:2,2 [7] BasicTest.cshtml) - "Hello"
CSharpStatement - - Instrumentation.EndContext(); CSharpStatement - - EndContext();
CSharpStatement - - Instrumentation.BeginContext(69, 2, true); CSharpStatement - - BeginContext(69, 2, true);
HtmlContent - (69:2,10 [2] BasicTest.cshtml) - \n HtmlContent - (69:2,10 [2] BasicTest.cshtml) - \n
CSharpStatement - - Instrumentation.EndContext(); CSharpStatement - - EndContext();
TagHelper - (71:3,0 [68] BasicTest.cshtml) TagHelper - (71:3,0 [68] BasicTest.cshtml)
InitializeTagHelperStructure - - form - TagMode.StartTagAndEndTag InitializeTagHelperStructure - - form - TagMode.StartTagAndEndTag
CSharpStatement - - Instrumentation.BeginContext(91, 6, true); CSharpStatement - - BeginContext(91, 6, true);
HtmlContent - (91:3,20 [6] BasicTest.cshtml) - \n HtmlContent - (91:3,20 [6] BasicTest.cshtml) - \n
CSharpStatement - - Instrumentation.EndContext(); CSharpStatement - - EndContext();
TagHelper - (97:4,4 [33] BasicTest.cshtml) TagHelper - (97:4,4 [33] BasicTest.cshtml)
InitializeTagHelperStructure - - input - TagMode.SelfClosing InitializeTagHelperStructure - - input - TagMode.SelfClosing
CreateTagHelper - - InputTagHelper CreateTagHelper - - InputTagHelper
SetPreallocatedTagHelperProperty - - __tagHelperAttribute_0 - value - FooProp SetPreallocatedTagHelperProperty - - __tagHelperAttribute_0 - value - FooProp
AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_1 AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_1
CSharpStatement - - Instrumentation.BeginContext(97, 33, false); CSharpStatement - - BeginContext(97, 33, false);
ExecuteTagHelpers - ExecuteTagHelpers -
CSharpStatement - - Instrumentation.EndContext(); CSharpStatement - - EndContext();
CSharpStatement - - Instrumentation.BeginContext(130, 2, true); CSharpStatement - - BeginContext(130, 2, true);
HtmlContent - (130:4,37 [2] BasicTest.cshtml) - \n HtmlContent - (130:4,37 [2] BasicTest.cshtml) - \n
CSharpStatement - - Instrumentation.EndContext(); CSharpStatement - - EndContext();
CreateTagHelper - - FormTagHelper CreateTagHelper - - FormTagHelper
AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2
CSharpStatement - - Instrumentation.BeginContext(71, 68, false); CSharpStatement - - BeginContext(71, 68, false);
ExecuteTagHelpers - ExecuteTagHelpers -
CSharpStatement - - Instrumentation.EndContext(); CSharpStatement - - EndContext();