Make section an extension node
This commit is contained in:
parent
132c8c7a7e
commit
062d7561ae
|
|
@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Razor.Language.Intermediate;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
{
|
{
|
||||||
public class FunctionsDirectivePass : RazorIRPassBase, IRazorDirectiveClassifierPass
|
public sealed class FunctionsDirectivePass : RazorIRPassBase, IRazorDirectiveClassifierPass
|
||||||
{
|
{
|
||||||
protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIRNode irDocument)
|
protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIRNode irDocument)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// 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.Language.CodeGeneration;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
|
{
|
||||||
|
public interface ISectionTargetExtension : ICodeTargetExtension
|
||||||
|
{
|
||||||
|
void WriteSection(CSharpRenderingContext context, SectionIRNode node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Razor.Language.Intermediate;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
{
|
{
|
||||||
public class InheritsDirectivePass : RazorIRPassBase, IRazorDirectiveClassifierPass
|
public sealed class InheritsDirectivePass : RazorIRPassBase, IRazorDirectiveClassifierPass
|
||||||
{
|
{
|
||||||
protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIRNode irDocument)
|
protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIRNode irDocument)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
{
|
{
|
||||||
builder.AddDirective(Directive);
|
builder.AddDirective(Directive);
|
||||||
builder.Features.Add(new SectionDirectivePass());
|
builder.Features.Add(new SectionDirectivePass());
|
||||||
|
builder.AddTargetExtension(new SectionTargetExtension());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Razor.Language.Intermediate;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
{
|
{
|
||||||
public class SectionDirectivePass : RazorIRPassBase, IRazorDirectiveClassifierPass
|
public sealed class SectionDirectivePass : RazorIRPassBase, IRazorDirectiveClassifierPass
|
||||||
{
|
{
|
||||||
protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIRNode irDocument)
|
protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIRNode irDocument)
|
||||||
{
|
{
|
||||||
|
|
@ -17,30 +17,30 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var section in irDocument.FindDirectiveReferences(SectionDirective.Directive))
|
foreach (var directive in irDocument.FindDirectiveReferences(SectionDirective.Directive))
|
||||||
{
|
{
|
||||||
var lambdaContent = irDocument.Options.DesignTime ? "__razor_section_writer" : string.Empty;
|
var sectionName = ((DirectiveIRNode)directive.Node).Tokens.FirstOrDefault()?.Content;
|
||||||
var sectionName = ((DirectiveIRNode)section.Node).Tokens.FirstOrDefault()?.Content;
|
|
||||||
|
|
||||||
var builder = RazorIRBuilder.Create(new CSharpCodeIRNode());
|
var section = new SectionIRNode()
|
||||||
builder.Add(new RazorIRToken()
|
|
||||||
{
|
{
|
||||||
Kind = RazorIRToken.TokenKind.CSharp,
|
Name = sectionName,
|
||||||
Content = $"DefineSection(\"{sectionName}\", async ({lambdaContent}) => {{"
|
};
|
||||||
});
|
|
||||||
section.InsertBefore(builder.Build());
|
|
||||||
|
|
||||||
section.InsertBefore(section.Node.Children.Except(((DirectiveIRNode)section.Node).Tokens));
|
var i = 0;
|
||||||
|
for (; i < directive.Node.Children.Count; i++)
|
||||||
builder = RazorIRBuilder.Create(new CSharpCodeIRNode());
|
|
||||||
builder.Add(new RazorIRToken()
|
|
||||||
{
|
{
|
||||||
Kind = RazorIRToken.TokenKind.CSharp,
|
if (!(directive.Node.Children[i] is DirectiveTokenIRNode))
|
||||||
Content = "});"
|
{
|
||||||
});
|
break;
|
||||||
section.InsertAfter(builder.Build());
|
}
|
||||||
|
}
|
||||||
|
|
||||||
section.Remove();
|
for (; i < directive.Node.Children.Count; i++)
|
||||||
|
{
|
||||||
|
section.Children.Add(directive.Node.Children[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
directive.Replace(section);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
// 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.Language.CodeGeneration;
|
||||||
|
using Microsoft.AspNetCore.Razor.Language.Intermediate;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
|
{
|
||||||
|
public sealed class SectionIRNode : ExtensionIRNode
|
||||||
|
{
|
||||||
|
public override RazorIRNodeCollection Children { get; } = new DefaultIRNodeCollection();
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public override SourceSpan? Source { get; set; }
|
||||||
|
|
||||||
|
public override void Accept(RazorIRNodeVisitor visitor)
|
||||||
|
{
|
||||||
|
if (visitor == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(visitor));
|
||||||
|
}
|
||||||
|
|
||||||
|
AcceptExtensionNode<SectionIRNode>(this, visitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
||||||
|
{
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(target));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(context));
|
||||||
|
}
|
||||||
|
|
||||||
|
var extension = target.GetExtension<ISectionTargetExtension>();
|
||||||
|
if (extension == null)
|
||||||
|
{
|
||||||
|
context.ReportMissingExtension<ISectionTargetExtension>();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
extension.WriteSection(context, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
// 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.Language.CodeGeneration;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
|
{
|
||||||
|
public sealed class SectionTargetExtension : ISectionTargetExtension
|
||||||
|
{
|
||||||
|
private static readonly string DefaultWriterName = "__razor_section_writer";
|
||||||
|
|
||||||
|
public static readonly string DefaultSectionMethodName = "DefineSection";
|
||||||
|
|
||||||
|
public string SectionMethodName { get; set; } = DefaultSectionMethodName;
|
||||||
|
|
||||||
|
public void WriteSection(CSharpRenderingContext context, SectionIRNode node)
|
||||||
|
{
|
||||||
|
// Quirk Alert!
|
||||||
|
//
|
||||||
|
// In 1.0.0 Razor/MVC the define section method took a parameter for a TextWriter
|
||||||
|
// that would be used for all of the output in the section. We simplified this API for
|
||||||
|
// 2.0.0 of MVC, but our design time codegen still needs to target 1.0.0.
|
||||||
|
//
|
||||||
|
// So the workaround is MVC 2.0.0 will define these methods with the TextWriter, but
|
||||||
|
// that method is never called. We still generate the call *with* the TextWriter for
|
||||||
|
// design time, at least until we have multi-targeting.
|
||||||
|
var writerName = context.Options.DesignTime ? DefaultWriterName : string.Empty;
|
||||||
|
|
||||||
|
context.Writer
|
||||||
|
.WriteStartMethodInvocation(SectionMethodName)
|
||||||
|
.Write("\"")
|
||||||
|
.Write(node.Name)
|
||||||
|
.Write("\", ");
|
||||||
|
|
||||||
|
using (context.Writer.BuildAsyncLambda(endLine: false, parameterNames: writerName))
|
||||||
|
{
|
||||||
|
context.RenderChildren(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Writer.WriteEndMethodInvocation(endLine: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Razor.Language.CodeGeneration;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
{
|
{
|
||||||
public class TemplateTargetExtension : ITemplateTargetExtension
|
public sealed class TemplateTargetExtension : ITemplateTargetExtension
|
||||||
{
|
{
|
||||||
public static readonly string DefaultTemplateTypeName = "Template";
|
public static readonly string DefaultTemplateTypeName = "Template";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Execute_WrapsStatementInDefineSection()
|
public void Execute_WrapsStatementInSectionNode()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var engine = CreateEngine();
|
var engine = CreateEngine();
|
||||||
|
|
@ -65,49 +65,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
|
|
||||||
var @class = @namespace.Children[0];
|
var @class = @namespace.Children[0];
|
||||||
var method = SingleChild<MethodDeclarationIRNode>(@class);
|
var method = SingleChild<MethodDeclarationIRNode>(@class);
|
||||||
Children(
|
|
||||||
method,
|
|
||||||
node => CSharpCode("DefineSection(\"Header\", async () => {", node),
|
|
||||||
node => Html(" <p>Hello World</p> ", node),
|
|
||||||
node => CSharpCode("});", node));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
var section = SingleChild<SectionIRNode>(method);
|
||||||
public void Execute_DesignTime_WrapsStatementInBackwardsCompatibleDefineSection()
|
Assert.Equal("Header", section.Name);
|
||||||
{
|
Children(section, c => Html(" <p>Hello World</p> ", c));
|
||||||
// Arrange
|
|
||||||
var engine = CreateDesignTimeEngine();
|
|
||||||
var pass = new SectionDirectivePass()
|
|
||||||
{
|
|
||||||
Engine = engine,
|
|
||||||
};
|
|
||||||
|
|
||||||
var content = "@section Header { <p>Hello World</p> }";
|
|
||||||
var sourceDocument = TestRazorSourceDocument.Create(content);
|
|
||||||
var codeDocument = RazorCodeDocument.Create(sourceDocument);
|
|
||||||
|
|
||||||
var irDocument = Lower(codeDocument, engine);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
pass.Execute(codeDocument, irDocument);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Children(
|
|
||||||
irDocument,
|
|
||||||
node => Assert.IsType<NamespaceDeclarationIRNode>(node));
|
|
||||||
|
|
||||||
var @namespace = irDocument.Children[0];
|
|
||||||
Children(
|
|
||||||
@namespace,
|
|
||||||
node => Assert.IsType<ClassDeclarationIRNode>(node));
|
|
||||||
|
|
||||||
var @class = @namespace.Children[0];
|
|
||||||
var method = SingleChild<MethodDeclarationIRNode>(@class);
|
|
||||||
Children(
|
|
||||||
method,
|
|
||||||
node => CSharpCode("DefineSection(\"Header\", async (__razor_section_writer) => {", node),
|
|
||||||
node => Html(" <p>Hello World</p> ", node),
|
|
||||||
node => CSharpCode("});", node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RazorEngine CreateEngine()
|
private static RazorEngine CreateEngine()
|
||||||
|
|
@ -118,14 +79,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RazorEngine CreateDesignTimeEngine()
|
|
||||||
{
|
|
||||||
return RazorEngine.CreateDesignTime(b =>
|
|
||||||
{
|
|
||||||
SectionDirective.Register(b);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static DocumentIRNode Lower(RazorCodeDocument codeDocument, RazorEngine engine)
|
private static DocumentIRNode Lower(RazorCodeDocument codeDocument, RazorEngine engine)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < engine.Phases.Count; i++)
|
for (var i = 0; i < engine.Phases.Count; i++)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
// 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.Language.CodeGeneration;
|
||||||
|
using Microsoft.AspNetCore.Razor.Language.Legacy;
|
||||||
|
using Xunit;
|
||||||
|
using static Microsoft.AspNetCore.Razor.Language.Intermediate.RazorIRAssert;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
|
{
|
||||||
|
public class SectionTargetExtensionTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void WriteSection_WritesSectionCode()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var node = new SectionIRNode()
|
||||||
|
{
|
||||||
|
Name = "MySection"
|
||||||
|
};
|
||||||
|
|
||||||
|
var extension = new SectionTargetExtension()
|
||||||
|
{
|
||||||
|
SectionMethodName = "CreateSection"
|
||||||
|
};
|
||||||
|
|
||||||
|
var context = new CSharpRenderingContext()
|
||||||
|
{
|
||||||
|
BasicWriter = new RuntimeBasicWriter(),
|
||||||
|
TagHelperWriter = new RuntimeTagHelperWriter(),
|
||||||
|
Writer = new CSharpCodeWriter(),
|
||||||
|
Options = RazorCodeGenerationOptions.CreateDefault(),
|
||||||
|
};
|
||||||
|
|
||||||
|
context.RenderChildren = (n) =>
|
||||||
|
{
|
||||||
|
Assert.Same(node, n);
|
||||||
|
context.Writer.WriteLine(" var s = \"Inside\"");
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
extension.WriteSection(context, node);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var expected = @"CreateSection(""MySection"", async() => {
|
||||||
|
var s = ""Inside""
|
||||||
|
}
|
||||||
|
);
|
||||||
|
";
|
||||||
|
|
||||||
|
var output = context.Writer.Builder.ToString();
|
||||||
|
Assert.Equal(expected, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void WriteSection_WritesSectionCode_DesignTime()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var node = new SectionIRNode()
|
||||||
|
{
|
||||||
|
Name = "MySection"
|
||||||
|
};
|
||||||
|
|
||||||
|
var extension = new SectionTargetExtension()
|
||||||
|
{
|
||||||
|
SectionMethodName = "CreateSection"
|
||||||
|
};
|
||||||
|
|
||||||
|
var context = new CSharpRenderingContext()
|
||||||
|
{
|
||||||
|
BasicWriter = new RuntimeBasicWriter(),
|
||||||
|
TagHelperWriter = new RuntimeTagHelperWriter(),
|
||||||
|
Writer = new CSharpCodeWriter(),
|
||||||
|
Options = RazorCodeGenerationOptions.Create(false, 4, true, false),
|
||||||
|
};
|
||||||
|
|
||||||
|
context.RenderChildren = (n) =>
|
||||||
|
{
|
||||||
|
Assert.Same(node, n);
|
||||||
|
context.Writer.WriteLine(" var s = \"Inside\"");
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
extension.WriteSection(context, node);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var expected = @"CreateSection(""MySection"", async(__razor_section_writer) => {
|
||||||
|
var s = ""Inside""
|
||||||
|
}
|
||||||
|
);
|
||||||
|
";
|
||||||
|
|
||||||
|
var output = context.Writer.Builder.ToString();
|
||||||
|
Assert.Equal(expected, output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -49,13 +49,14 @@ __o = Foo(item => new Template(async(__razor_template_writer) => {
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
DefineSection("Footer", async (__razor_section_writer) => {
|
DefineSection("Footer", async(__razor_section_writer) => {
|
||||||
#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml"
|
#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml"
|
||||||
__o = bar;
|
__o = bar;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#pragma warning restore 1998
|
#pragma warning restore 1998
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,7 @@ Document -
|
||||||
RazorIRToken - (154:8,26 [2] DesignTime.cshtml) - Html - \n
|
RazorIRToken - (154:8,26 [2] DesignTime.cshtml) - Html - \n
|
||||||
RazorIRToken - (156:9,0 [4] DesignTime.cshtml) - Html - </p>
|
RazorIRToken - (156:9,0 [4] DesignTime.cshtml) - Html - </p>
|
||||||
RazorIRToken - (160:9,4 [4] DesignTime.cshtml) - Html - \n\n
|
RazorIRToken - (160:9,4 [4] DesignTime.cshtml) - Html - \n\n
|
||||||
CSharpCode -
|
Section - - Footer
|
||||||
RazorIRToken - - CSharp - DefineSection("Footer", async (__razor_section_writer) => {
|
|
||||||
HtmlContent - (181:11,17 [22] DesignTime.cshtml)
|
HtmlContent - (181:11,17 [22] DesignTime.cshtml)
|
||||||
RazorIRToken - (181:11,17 [6] DesignTime.cshtml) - Html - \n
|
RazorIRToken - (181:11,17 [6] DesignTime.cshtml) - Html - \n
|
||||||
RazorIRToken - (187:12,4 [3] DesignTime.cshtml) - Html - <p>
|
RazorIRToken - (187:12,4 [3] DesignTime.cshtml) - Html - <p>
|
||||||
|
|
@ -58,5 +57,3 @@ Document -
|
||||||
RazorIRToken - (204:13,5 [3] DesignTime.cshtml) - CSharp - bar
|
RazorIRToken - (204:13,5 [3] DesignTime.cshtml) - CSharp - bar
|
||||||
HtmlContent - (207:13,8 [2] DesignTime.cshtml)
|
HtmlContent - (207:13,8 [2] DesignTime.cshtml)
|
||||||
RazorIRToken - (207:13,8 [2] DesignTime.cshtml) - Html - \n
|
RazorIRToken - (207:13,8 [2] DesignTime.cshtml) - Html - \n
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,6 @@ Generated Location: (1508:47,1 [1] )
|
||||||
|
|
||||||
Source Location: (204:13,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml)
|
Source Location: (204:13,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml)
|
||||||
|bar|
|
|bar|
|
||||||
Generated Location: (1709:53,6 [3] )
|
Generated Location: (1708:53,6 [3] )
|
||||||
|bar|
|
|bar|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,16 +29,18 @@ global::System.Object NestedDelegates = null;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
DefineSection("Section2", async (__razor_section_writer) => {
|
DefineSection("Section2", async(__razor_section_writer) => {
|
||||||
#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
|
#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
|
||||||
__o = thing;
|
__o = thing;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
});
|
}
|
||||||
DefineSection("Section1", async (__razor_section_writer) => {
|
);
|
||||||
});
|
DefineSection("Section1", async(__razor_section_writer) => {
|
||||||
DefineSection("NestedDelegates", async (__razor_section_writer) => {
|
}
|
||||||
|
);
|
||||||
|
DefineSection("NestedDelegates", async(__razor_section_writer) => {
|
||||||
#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
|
#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
|
||||||
Func<dynamic, object> f =
|
Func<dynamic, object> f =
|
||||||
|
|
||||||
|
|
@ -57,7 +59,8 @@ global::System.Object NestedDelegates = null;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#pragma warning restore 1998
|
#pragma warning restore 1998
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,7 @@ Document -
|
||||||
RazorIRToken - (49:3,0 [2] Sections.cshtml) - Html - \n
|
RazorIRToken - (49:3,0 [2] Sections.cshtml) - Html - \n
|
||||||
RazorIRToken - (51:4,0 [5] Sections.cshtml) - Html - <div>
|
RazorIRToken - (51:4,0 [5] Sections.cshtml) - Html - <div>
|
||||||
RazorIRToken - (56:4,5 [24] Sections.cshtml) - Html - This is in the Body>\n\n
|
RazorIRToken - (56:4,5 [24] Sections.cshtml) - Html - This is in the Body>\n\n
|
||||||
CSharpCode -
|
Section - - Section2
|
||||||
RazorIRToken - - CSharp - DefineSection("Section2", async (__razor_section_writer) => {
|
|
||||||
HtmlContent - (99:6,19 [10] Sections.cshtml)
|
HtmlContent - (99:6,19 [10] Sections.cshtml)
|
||||||
RazorIRToken - (99:6,19 [6] Sections.cshtml) - Html - \n
|
RazorIRToken - (99:6,19 [6] Sections.cshtml) - Html - \n
|
||||||
RazorIRToken - (105:7,4 [4] Sections.cshtml) - Html - <div
|
RazorIRToken - (105:7,4 [4] Sections.cshtml) - Html - <div
|
||||||
|
|
@ -29,24 +28,18 @@ Document -
|
||||||
RazorIRToken - (130:7,29 [20] Sections.cshtml) - Html - This is in Section 2
|
RazorIRToken - (130:7,29 [20] Sections.cshtml) - Html - This is in Section 2
|
||||||
RazorIRToken - (150:7,49 [6] Sections.cshtml) - Html - </div>
|
RazorIRToken - (150:7,49 [6] Sections.cshtml) - Html - </div>
|
||||||
RazorIRToken - (156:7,55 [2] Sections.cshtml) - Html - \n
|
RazorIRToken - (156:7,55 [2] Sections.cshtml) - Html - \n
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
HtmlContent - (159:8,1 [4] Sections.cshtml)
|
HtmlContent - (159:8,1 [4] Sections.cshtml)
|
||||||
RazorIRToken - (159:8,1 [4] Sections.cshtml) - Html - \n\n
|
RazorIRToken - (159:8,1 [4] Sections.cshtml) - Html - \n\n
|
||||||
CSharpCode -
|
Section - - Section1
|
||||||
RazorIRToken - - CSharp - DefineSection("Section1", async (__razor_section_writer) => {
|
|
||||||
HtmlContent - (182:10,19 [39] Sections.cshtml)
|
HtmlContent - (182:10,19 [39] Sections.cshtml)
|
||||||
RazorIRToken - (182:10,19 [6] Sections.cshtml) - Html - \n
|
RazorIRToken - (182:10,19 [6] Sections.cshtml) - Html - \n
|
||||||
RazorIRToken - (188:11,4 [5] Sections.cshtml) - Html - <div>
|
RazorIRToken - (188:11,4 [5] Sections.cshtml) - Html - <div>
|
||||||
RazorIRToken - (193:11,9 [20] Sections.cshtml) - Html - This is in Section 1
|
RazorIRToken - (193:11,9 [20] Sections.cshtml) - Html - This is in Section 1
|
||||||
RazorIRToken - (213:11,29 [6] Sections.cshtml) - Html - </div>
|
RazorIRToken - (213:11,29 [6] Sections.cshtml) - Html - </div>
|
||||||
RazorIRToken - (219:11,35 [2] Sections.cshtml) - Html - \n
|
RazorIRToken - (219:11,35 [2] Sections.cshtml) - Html - \n
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
HtmlContent - (222:12,1 [4] Sections.cshtml)
|
HtmlContent - (222:12,1 [4] Sections.cshtml)
|
||||||
RazorIRToken - (222:12,1 [4] Sections.cshtml) - Html - \n\n
|
RazorIRToken - (222:12,1 [4] Sections.cshtml) - Html - \n\n
|
||||||
CSharpCode -
|
Section - - NestedDelegates
|
||||||
RazorIRToken - - CSharp - DefineSection("NestedDelegates", async (__razor_section_writer) => {
|
|
||||||
HtmlContent - (252:14,26 [6] Sections.cshtml)
|
HtmlContent - (252:14,26 [6] Sections.cshtml)
|
||||||
RazorIRToken - (252:14,26 [6] Sections.cshtml) - Html - \n
|
RazorIRToken - (252:14,26 [6] Sections.cshtml) - Html - \n
|
||||||
CSharpCode - (260:15,6 [27] Sections.cshtml)
|
CSharpCode - (260:15,6 [27] Sections.cshtml)
|
||||||
|
|
@ -60,5 +53,3 @@ Document -
|
||||||
RazorIRToken - (299:15,45 [7] Sections.cshtml) - Html - </span>
|
RazorIRToken - (299:15,45 [7] Sections.cshtml) - Html - </span>
|
||||||
CSharpCode - (306:15,52 [2] Sections.cshtml)
|
CSharpCode - (306:15,52 [2] Sections.cshtml)
|
||||||
RazorIRToken - (306:15,52 [2] Sections.cshtml) - CSharp - ;
|
RazorIRToken - (306:15,52 [2] Sections.cshtml) - CSharp - ;
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
|
|
|
||||||
|
|
@ -24,21 +24,21 @@ Generated Location: (896:26,2 [44] )
|
||||||
|
|
||||||
Source Location: (123:7,22 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
|
Source Location: (123:7,22 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
|
||||||
|thing|
|
|thing|
|
||||||
Generated Location: (1152:33,22 [5] )
|
Generated Location: (1151:33,22 [5] )
|
||||||
|thing|
|
|thing|
|
||||||
|
|
||||||
Source Location: (260:15,6 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
|
Source Location: (260:15,6 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
|
||||||
| Func<dynamic, object> f = |
|
| Func<dynamic, object> f = |
|
||||||
Generated Location: (1473:42,6 [27] )
|
Generated Location: (1498:44,6 [27] )
|
||||||
| Func<dynamic, object> f = |
|
| Func<dynamic, object> f = |
|
||||||
|
|
||||||
Source Location: (295:15,41 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
|
Source Location: (295:15,41 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
|
||||||
|item|
|
|item|
|
||||||
Generated Location: (1729:48,41 [4] )
|
Generated Location: (1758:50,41 [4] )
|
||||||
|item|
|
|item|
|
||||||
|
|
||||||
Source Location: (306:15,52 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
|
Source Location: (306:15,52 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml)
|
||||||
|; |
|
|; |
|
||||||
Generated Location: (1934:55,52 [2] )
|
Generated Location: (1971:57,52 [2] )
|
||||||
|; |
|
|; |
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n<div>This is in the Body>\r\n\r\n");
|
WriteLiteral("\r\n<div>This is in the Body>\r\n\r\n");
|
||||||
DefineSection("Section2", async () => {
|
DefineSection("Section2", async() => {
|
||||||
WriteLiteral("\r\n <div");
|
WriteLiteral("\r\n <div");
|
||||||
BeginWriteAttribute("class", " class=\"", 109, "\"", 128, 2);
|
BeginWriteAttribute("class", " class=\"", 109, "\"", 128, 2);
|
||||||
WriteAttributeValue("", 117, "some", 117, 4, true);
|
WriteAttributeValue("", 117, "some", 117, 4, true);
|
||||||
|
|
@ -25,13 +25,15 @@ WriteAttributeValue(" ", 121, thing, 122, 6, false);
|
||||||
#line hidden
|
#line hidden
|
||||||
EndWriteAttribute();
|
EndWriteAttribute();
|
||||||
WriteLiteral(">This is in Section 2</div>\r\n");
|
WriteLiteral(">This is in Section 2</div>\r\n");
|
||||||
});
|
}
|
||||||
|
);
|
||||||
WriteLiteral("\r\n");
|
WriteLiteral("\r\n");
|
||||||
DefineSection("Section1", async () => {
|
DefineSection("Section1", async() => {
|
||||||
WriteLiteral("\r\n <div>This is in Section 1</div>\r\n");
|
WriteLiteral("\r\n <div>This is in Section 1</div>\r\n");
|
||||||
});
|
}
|
||||||
|
);
|
||||||
WriteLiteral("\r\n");
|
WriteLiteral("\r\n");
|
||||||
DefineSection("NestedDelegates", async () => {
|
DefineSection("NestedDelegates", async() => {
|
||||||
WriteLiteral("\r\n");
|
WriteLiteral("\r\n");
|
||||||
#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
|
#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml"
|
||||||
Func<dynamic, object> f =
|
Func<dynamic, object> f =
|
||||||
|
|
@ -55,7 +57,8 @@ WriteAttributeValue(" ", 121, thing, 122, 6, false);
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#pragma warning restore 1998
|
#pragma warning restore 1998
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,7 @@ Document -
|
||||||
RazorIRToken - (49:3,0 [2] Sections.cshtml) - Html - \n
|
RazorIRToken - (49:3,0 [2] Sections.cshtml) - Html - \n
|
||||||
RazorIRToken - (51:4,0 [5] Sections.cshtml) - Html - <div>
|
RazorIRToken - (51:4,0 [5] Sections.cshtml) - Html - <div>
|
||||||
RazorIRToken - (56:4,5 [24] Sections.cshtml) - Html - This is in the Body>\n\n
|
RazorIRToken - (56:4,5 [24] Sections.cshtml) - Html - This is in the Body>\n\n
|
||||||
CSharpCode -
|
Section - - Section2
|
||||||
RazorIRToken - - CSharp - DefineSection("Section2", async () => {
|
|
||||||
HtmlContent - (99:6,19 [10] Sections.cshtml)
|
HtmlContent - (99:6,19 [10] Sections.cshtml)
|
||||||
RazorIRToken - (99:6,19 [6] Sections.cshtml) - Html - \n
|
RazorIRToken - (99:6,19 [6] Sections.cshtml) - Html - \n
|
||||||
RazorIRToken - (105:7,4 [4] Sections.cshtml) - Html - <div
|
RazorIRToken - (105:7,4 [4] Sections.cshtml) - Html - <div
|
||||||
|
|
@ -23,24 +22,18 @@ Document -
|
||||||
RazorIRToken - (130:7,29 [20] Sections.cshtml) - Html - This is in Section 2
|
RazorIRToken - (130:7,29 [20] Sections.cshtml) - Html - This is in Section 2
|
||||||
RazorIRToken - (150:7,49 [6] Sections.cshtml) - Html - </div>
|
RazorIRToken - (150:7,49 [6] Sections.cshtml) - Html - </div>
|
||||||
RazorIRToken - (156:7,55 [2] Sections.cshtml) - Html - \n
|
RazorIRToken - (156:7,55 [2] Sections.cshtml) - Html - \n
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
HtmlContent - (161:9,0 [2] Sections.cshtml)
|
HtmlContent - (161:9,0 [2] Sections.cshtml)
|
||||||
RazorIRToken - (161:9,0 [2] Sections.cshtml) - Html - \n
|
RazorIRToken - (161:9,0 [2] Sections.cshtml) - Html - \n
|
||||||
CSharpCode -
|
Section - - Section1
|
||||||
RazorIRToken - - CSharp - DefineSection("Section1", async () => {
|
|
||||||
HtmlContent - (182:10,19 [39] Sections.cshtml)
|
HtmlContent - (182:10,19 [39] Sections.cshtml)
|
||||||
RazorIRToken - (182:10,19 [6] Sections.cshtml) - Html - \n
|
RazorIRToken - (182:10,19 [6] Sections.cshtml) - Html - \n
|
||||||
RazorIRToken - (188:11,4 [5] Sections.cshtml) - Html - <div>
|
RazorIRToken - (188:11,4 [5] Sections.cshtml) - Html - <div>
|
||||||
RazorIRToken - (193:11,9 [20] Sections.cshtml) - Html - This is in Section 1
|
RazorIRToken - (193:11,9 [20] Sections.cshtml) - Html - This is in Section 1
|
||||||
RazorIRToken - (213:11,29 [6] Sections.cshtml) - Html - </div>
|
RazorIRToken - (213:11,29 [6] Sections.cshtml) - Html - </div>
|
||||||
RazorIRToken - (219:11,35 [2] Sections.cshtml) - Html - \n
|
RazorIRToken - (219:11,35 [2] Sections.cshtml) - Html - \n
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
HtmlContent - (224:13,0 [2] Sections.cshtml)
|
HtmlContent - (224:13,0 [2] Sections.cshtml)
|
||||||
RazorIRToken - (224:13,0 [2] Sections.cshtml) - Html - \n
|
RazorIRToken - (224:13,0 [2] Sections.cshtml) - Html - \n
|
||||||
CSharpCode -
|
Section - - NestedDelegates
|
||||||
RazorIRToken - - CSharp - DefineSection("NestedDelegates", async () => {
|
|
||||||
HtmlContent - (252:14,26 [2] Sections.cshtml)
|
HtmlContent - (252:14,26 [2] Sections.cshtml)
|
||||||
RazorIRToken - (252:14,26 [2] Sections.cshtml) - Html - \n
|
RazorIRToken - (252:14,26 [2] Sections.cshtml) - Html - \n
|
||||||
CSharpCode - (254:15,0 [4] Sections.cshtml)
|
CSharpCode - (254:15,0 [4] Sections.cshtml)
|
||||||
|
|
@ -56,5 +49,3 @@ Document -
|
||||||
RazorIRToken - (299:15,45 [7] Sections.cshtml) - Html - </span>
|
RazorIRToken - (299:15,45 [7] Sections.cshtml) - Html - </span>
|
||||||
CSharpCode - (306:15,52 [2] Sections.cshtml)
|
CSharpCode - (306:15,52 [2] Sections.cshtml)
|
||||||
RazorIRToken - (306:15,52 [2] Sections.cshtml) - CSharp - ;
|
RazorIRToken - (306:15,52 [2] Sections.cshtml) - CSharp - ;
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,12 @@ global::System.Object WriteLiteralsToInHereAlso = null;
|
||||||
#pragma warning disable 1998
|
#pragma warning disable 1998
|
||||||
public async System.Threading.Tasks.Task ExecuteAsync()
|
public async System.Threading.Tasks.Task ExecuteAsync()
|
||||||
{
|
{
|
||||||
DefineSection("WriteLiteralsToInHere", async (__razor_section_writer) => {
|
DefineSection("WriteLiteralsToInHere", async(__razor_section_writer) => {
|
||||||
});
|
}
|
||||||
DefineSection("WriteLiteralsToInHereAlso", async (__razor_section_writer) => {
|
);
|
||||||
});
|
DefineSection("WriteLiteralsToInHereAlso", async(__razor_section_writer) => {
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#pragma warning restore 1998
|
#pragma warning restore 1998
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -345,8 +345,7 @@ Document -
|
||||||
RazorIRToken - (2001:83,18 [4] StringLiterals.cshtml) - Html - </p>
|
RazorIRToken - (2001:83,18 [4] StringLiterals.cshtml) - Html - </p>
|
||||||
RazorIRToken - (2005:83,22 [4] StringLiterals.cshtml) - Html - <br>
|
RazorIRToken - (2005:83,22 [4] StringLiterals.cshtml) - Html - <br>
|
||||||
RazorIRToken - (2009:83,26 [4] StringLiterals.cshtml) - Html - \n\n
|
RazorIRToken - (2009:83,26 [4] StringLiterals.cshtml) - Html - \n\n
|
||||||
CSharpCode -
|
Section - - WriteLiteralsToInHere
|
||||||
RazorIRToken - - CSharp - DefineSection("WriteLiteralsToInHere", async (__razor_section_writer) => {
|
|
||||||
HtmlContent - (2045:85,32 [2618] StringLiterals.cshtml)
|
HtmlContent - (2045:85,32 [2618] StringLiterals.cshtml)
|
||||||
RazorIRToken - (2045:85,32 [6] StringLiterals.cshtml) - Html - \n
|
RazorIRToken - (2045:85,32 [6] StringLiterals.cshtml) - Html - \n
|
||||||
RazorIRToken - (2051:86,4 [3] StringLiterals.cshtml) - Html - <p>
|
RazorIRToken - (2051:86,4 [3] StringLiterals.cshtml) - Html - <p>
|
||||||
|
|
@ -649,8 +648,6 @@ Document -
|
||||||
RazorIRToken - (4635:160,7 [22] StringLiterals.cshtml) - Html - This is line 75 nested
|
RazorIRToken - (4635:160,7 [22] StringLiterals.cshtml) - Html - This is line 75 nested
|
||||||
RazorIRToken - (4657:160,29 [4] StringLiterals.cshtml) - Html - </p>
|
RazorIRToken - (4657:160,29 [4] StringLiterals.cshtml) - Html - </p>
|
||||||
RazorIRToken - (4661:160,33 [2] StringLiterals.cshtml) - Html - \n
|
RazorIRToken - (4661:160,33 [2] StringLiterals.cshtml) - Html - \n
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
HtmlContent - (4664:161,1 [1028] StringLiterals.cshtml)
|
HtmlContent - (4664:161,1 [1028] StringLiterals.cshtml)
|
||||||
RazorIRToken - (4664:161,1 [2] StringLiterals.cshtml) - Html - \n
|
RazorIRToken - (4664:161,1 [2] StringLiterals.cshtml) - Html - \n
|
||||||
RazorIRToken - (4666:162,0 [3] StringLiterals.cshtml) - Html - <p>
|
RazorIRToken - (4666:162,0 [3] StringLiterals.cshtml) - Html - <p>
|
||||||
|
|
@ -825,8 +822,7 @@ Document -
|
||||||
RazorIRToken - (5668:204,3 [15] StringLiterals.cshtml) - Html - This is line 43
|
RazorIRToken - (5668:204,3 [15] StringLiterals.cshtml) - Html - This is line 43
|
||||||
RazorIRToken - (5683:204,18 [4] StringLiterals.cshtml) - Html - </p>
|
RazorIRToken - (5683:204,18 [4] StringLiterals.cshtml) - Html - </p>
|
||||||
RazorIRToken - (5687:204,22 [5] StringLiterals.cshtml) - Html - hi!\n
|
RazorIRToken - (5687:204,22 [5] StringLiterals.cshtml) - Html - hi!\n
|
||||||
CSharpCode -
|
Section - - WriteLiteralsToInHereAlso
|
||||||
RazorIRToken - - CSharp - DefineSection("WriteLiteralsToInHereAlso", async (__razor_section_writer) => {
|
|
||||||
HtmlContent - (5728:205,36 [1023] StringLiterals.cshtml)
|
HtmlContent - (5728:205,36 [1023] StringLiterals.cshtml)
|
||||||
RazorIRToken - (5728:205,36 [6] StringLiterals.cshtml) - Html - \n
|
RazorIRToken - (5728:205,36 [6] StringLiterals.cshtml) - Html - \n
|
||||||
RazorIRToken - (5734:206,4 [3] StringLiterals.cshtml) - Html - <p>
|
RazorIRToken - (5734:206,4 [3] StringLiterals.cshtml) - Html - <p>
|
||||||
|
|
@ -949,7 +945,5 @@ Document -
|
||||||
RazorIRToken - (6743:235,7 [2] StringLiterals.cshtml) - Html - 30
|
RazorIRToken - (6743:235,7 [2] StringLiterals.cshtml) - Html - 30
|
||||||
RazorIRToken - (6745:235,9 [4] StringLiterals.cshtml) - Html - </p>
|
RazorIRToken - (6745:235,9 [4] StringLiterals.cshtml) - Html - </p>
|
||||||
RazorIRToken - (6749:235,13 [2] StringLiterals.cshtml) - Html - \n
|
RazorIRToken - (6749:235,13 [2] StringLiterals.cshtml) - Html - \n
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
HtmlContent - (6752:236,1 [1] StringLiterals.cshtml)
|
HtmlContent - (6752:236,1 [1] StringLiterals.cshtml)
|
||||||
RazorIRToken - (6752:236,1 [1] StringLiterals.cshtml) - Html - !
|
RazorIRToken - (6752:236,1 [1] StringLiterals.cshtml) - Html - !
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
<p>This is line 84</p><br>
|
<p>This is line 84</p><br>
|
||||||
|
|
||||||
");
|
");
|
||||||
DefineSection("WriteLiteralsToInHere", async () => {
|
DefineSection("WriteLiteralsToInHere", async() => {
|
||||||
WriteLiteral(@"
|
WriteLiteral(@"
|
||||||
<p>This is line 1 nested</p>
|
<p>This is line 1 nested</p>
|
||||||
<p>This is line 2 nested</p>
|
<p>This is line 2 nested</p>
|
||||||
|
|
@ -174,7 +174,8 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
<p>This is line 74 nested</p>
|
<p>This is line 74 nested</p>
|
||||||
<p>This is line 75 nested</p>
|
<p>This is line 75 nested</p>
|
||||||
");
|
");
|
||||||
});
|
}
|
||||||
|
);
|
||||||
WriteLiteral(@"<p>This is line 1</p>
|
WriteLiteral(@"<p>This is line 1</p>
|
||||||
<p>This is line 2</p>
|
<p>This is line 2</p>
|
||||||
<p>This is line 3</p>
|
<p>This is line 3</p>
|
||||||
|
|
@ -219,7 +220,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
<p>This is line 42</p>
|
<p>This is line 42</p>
|
||||||
<p>This is line 43</p>hi!");
|
<p>This is line 43</p>hi!");
|
||||||
WriteLiteral("\r\n");
|
WriteLiteral("\r\n");
|
||||||
DefineSection("WriteLiteralsToInHereAlso", async () => {
|
DefineSection("WriteLiteralsToInHereAlso", async() => {
|
||||||
WriteLiteral(@"
|
WriteLiteral(@"
|
||||||
<p>This is line 1 nested</p>
|
<p>This is line 1 nested</p>
|
||||||
<p>This is line 2 nested</p>
|
<p>This is line 2 nested</p>
|
||||||
|
|
@ -252,7 +253,8 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
<p>This is line 29 nested</p>
|
<p>This is line 29 nested</p>
|
||||||
<p>30</p>
|
<p>30</p>
|
||||||
");
|
");
|
||||||
});
|
}
|
||||||
|
);
|
||||||
WriteLiteral("!");
|
WriteLiteral("!");
|
||||||
}
|
}
|
||||||
#pragma warning restore 1998
|
#pragma warning restore 1998
|
||||||
|
|
|
||||||
|
|
@ -340,8 +340,7 @@ Document -
|
||||||
RazorIRToken - (2001:83,18 [4] StringLiterals.cshtml) - Html - </p>
|
RazorIRToken - (2001:83,18 [4] StringLiterals.cshtml) - Html - </p>
|
||||||
RazorIRToken - (2005:83,22 [4] StringLiterals.cshtml) - Html - <br>
|
RazorIRToken - (2005:83,22 [4] StringLiterals.cshtml) - Html - <br>
|
||||||
RazorIRToken - (2009:83,26 [4] StringLiterals.cshtml) - Html - \n\n
|
RazorIRToken - (2009:83,26 [4] StringLiterals.cshtml) - Html - \n\n
|
||||||
CSharpCode -
|
Section - - WriteLiteralsToInHere
|
||||||
RazorIRToken - - CSharp - DefineSection("WriteLiteralsToInHere", async () => {
|
|
||||||
HtmlContent - (2045:85,32 [2618] StringLiterals.cshtml)
|
HtmlContent - (2045:85,32 [2618] StringLiterals.cshtml)
|
||||||
RazorIRToken - (2045:85,32 [6] StringLiterals.cshtml) - Html - \n
|
RazorIRToken - (2045:85,32 [6] StringLiterals.cshtml) - Html - \n
|
||||||
RazorIRToken - (2051:86,4 [3] StringLiterals.cshtml) - Html - <p>
|
RazorIRToken - (2051:86,4 [3] StringLiterals.cshtml) - Html - <p>
|
||||||
|
|
@ -644,8 +643,6 @@ Document -
|
||||||
RazorIRToken - (4635:160,7 [22] StringLiterals.cshtml) - Html - This is line 75 nested
|
RazorIRToken - (4635:160,7 [22] StringLiterals.cshtml) - Html - This is line 75 nested
|
||||||
RazorIRToken - (4657:160,29 [4] StringLiterals.cshtml) - Html - </p>
|
RazorIRToken - (4657:160,29 [4] StringLiterals.cshtml) - Html - </p>
|
||||||
RazorIRToken - (4661:160,33 [2] StringLiterals.cshtml) - Html - \n
|
RazorIRToken - (4661:160,33 [2] StringLiterals.cshtml) - Html - \n
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
HtmlContent - (4666:162,0 [1026] StringLiterals.cshtml)
|
HtmlContent - (4666:162,0 [1026] StringLiterals.cshtml)
|
||||||
RazorIRToken - (4666:162,0 [3] StringLiterals.cshtml) - Html - <p>
|
RazorIRToken - (4666:162,0 [3] StringLiterals.cshtml) - Html - <p>
|
||||||
RazorIRToken - (4669:162,3 [14] StringLiterals.cshtml) - Html - This is line 1
|
RazorIRToken - (4669:162,3 [14] StringLiterals.cshtml) - Html - This is line 1
|
||||||
|
|
@ -819,8 +816,7 @@ Document -
|
||||||
RazorIRToken - (5668:204,3 [15] StringLiterals.cshtml) - Html - This is line 43
|
RazorIRToken - (5668:204,3 [15] StringLiterals.cshtml) - Html - This is line 43
|
||||||
RazorIRToken - (5683:204,18 [4] StringLiterals.cshtml) - Html - </p>
|
RazorIRToken - (5683:204,18 [4] StringLiterals.cshtml) - Html - </p>
|
||||||
RazorIRToken - (5687:204,22 [5] StringLiterals.cshtml) - Html - hi!\n
|
RazorIRToken - (5687:204,22 [5] StringLiterals.cshtml) - Html - hi!\n
|
||||||
CSharpCode -
|
Section - - WriteLiteralsToInHereAlso
|
||||||
RazorIRToken - - CSharp - DefineSection("WriteLiteralsToInHereAlso", async () => {
|
|
||||||
HtmlContent - (5728:205,36 [1023] StringLiterals.cshtml)
|
HtmlContent - (5728:205,36 [1023] StringLiterals.cshtml)
|
||||||
RazorIRToken - (5728:205,36 [6] StringLiterals.cshtml) - Html - \n
|
RazorIRToken - (5728:205,36 [6] StringLiterals.cshtml) - Html - \n
|
||||||
RazorIRToken - (5734:206,4 [3] StringLiterals.cshtml) - Html - <p>
|
RazorIRToken - (5734:206,4 [3] StringLiterals.cshtml) - Html - <p>
|
||||||
|
|
@ -943,7 +939,5 @@ Document -
|
||||||
RazorIRToken - (6743:235,7 [2] StringLiterals.cshtml) - Html - 30
|
RazorIRToken - (6743:235,7 [2] StringLiterals.cshtml) - Html - 30
|
||||||
RazorIRToken - (6745:235,9 [4] StringLiterals.cshtml) - Html - </p>
|
RazorIRToken - (6745:235,9 [4] StringLiterals.cshtml) - Html - </p>
|
||||||
RazorIRToken - (6749:235,13 [2] StringLiterals.cshtml) - Html - \n
|
RazorIRToken - (6749:235,13 [2] StringLiterals.cshtml) - Html - \n
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
HtmlContent - (6752:236,1 [1] StringLiterals.cshtml)
|
HtmlContent - (6752:236,1 [1] StringLiterals.cshtml)
|
||||||
RazorIRToken - (6752:236,1 [1] StringLiterals.cshtml) - Html - !
|
RazorIRToken - (6752:236,1 [1] StringLiterals.cshtml) - Html - !
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n");
|
WriteLiteral("\r\n");
|
||||||
DefineSection("MySection", async () => {
|
DefineSection("MySection", async() => {
|
||||||
WriteLiteral("\r\n <div>\r\n ");
|
WriteLiteral("\r\n <div>\r\n ");
|
||||||
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("mytaghelper", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => {
|
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("mytaghelper", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => {
|
||||||
WriteLiteral("\r\n In None ContentBehavior.\r\n ");
|
WriteLiteral("\r\n In None ContentBehavior.\r\n ");
|
||||||
|
|
@ -89,7 +89,8 @@ AddHtmlAttributeValue(" ", 201, DateTime.Now, 202, 13, false);
|
||||||
Write(__tagHelperExecutionContext.Output);
|
Write(__tagHelperExecutionContext.Output);
|
||||||
__tagHelperExecutionContext = __tagHelperScopeManager.End();
|
__tagHelperExecutionContext = __tagHelperScopeManager.End();
|
||||||
WriteLiteral("\r\n </div>\r\n");
|
WriteLiteral("\r\n </div>\r\n");
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#pragma warning restore 1998
|
#pragma warning restore 1998
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@ Document -
|
||||||
RazorIRToken - (37:2,2 [31] TagHelpersInSection.cshtml) - CSharp - \n var code = "some code";\n
|
RazorIRToken - (37:2,2 [31] TagHelpersInSection.cshtml) - CSharp - \n var code = "some code";\n
|
||||||
HtmlContent - (71:5,0 [2] TagHelpersInSection.cshtml)
|
HtmlContent - (71:5,0 [2] TagHelpersInSection.cshtml)
|
||||||
RazorIRToken - (71:5,0 [2] TagHelpersInSection.cshtml) - Html - \n
|
RazorIRToken - (71:5,0 [2] TagHelpersInSection.cshtml) - Html - \n
|
||||||
CSharpCode -
|
Section - - MySection
|
||||||
RazorIRToken - - CSharp - DefineSection("MySection", async () => {
|
|
||||||
HtmlContent - (93:6,20 [21] TagHelpersInSection.cshtml)
|
HtmlContent - (93:6,20 [21] TagHelpersInSection.cshtml)
|
||||||
RazorIRToken - (93:6,20 [6] TagHelpersInSection.cshtml) - Html - \n
|
RazorIRToken - (93:6,20 [6] TagHelpersInSection.cshtml) - Html - \n
|
||||||
RazorIRToken - (99:7,4 [5] TagHelpersInSection.cshtml) - Html - <div>
|
RazorIRToken - (99:7,4 [5] TagHelpersInSection.cshtml) - Html - <div>
|
||||||
|
|
@ -47,5 +46,3 @@ Document -
|
||||||
RazorIRToken - (359:11,22 [6] TagHelpersInSection.cshtml) - Html - \n
|
RazorIRToken - (359:11,22 [6] TagHelpersInSection.cshtml) - Html - \n
|
||||||
RazorIRToken - (365:12,4 [6] TagHelpersInSection.cshtml) - Html - </div>
|
RazorIRToken - (365:12,4 [6] TagHelpersInSection.cshtml) - Html - </div>
|
||||||
RazorIRToken - (371:12,10 [2] TagHelpersInSection.cshtml) - Html - \n
|
RazorIRToken - (371:12,10 [2] TagHelpersInSection.cshtml) - Html - \n
|
||||||
CSharpCode -
|
|
||||||
RazorIRToken - - CSharp - });
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,14 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Microsoft.AspNetCore.Razor.Language.Extensions;
|
||||||
using Microsoft.AspNetCore.Razor.Language.Intermediate;
|
using Microsoft.AspNetCore.Razor.Language.Intermediate;
|
||||||
using Microsoft.AspNetCore.Razor.Language.Legacy;
|
using Microsoft.AspNetCore.Razor.Language.Legacy;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
|
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
|
||||||
{
|
{
|
||||||
// Serializes single IR nodes (shallow).
|
// Serializes single IR nodes (shallow).
|
||||||
public class RazorIRNodeWriter : RazorIRNodeVisitor
|
public class RazorIRNodeWriter : RazorIRNodeVisitor, IExtensionIRNodeVisitor<SectionIRNode>
|
||||||
{
|
{
|
||||||
private readonly TextWriter _writer;
|
private readonly TextWriter _writer;
|
||||||
|
|
||||||
|
|
@ -130,6 +131,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void VisitExtension(SectionIRNode node)
|
||||||
|
{
|
||||||
|
WriteContentNode(node, node.Name);
|
||||||
|
}
|
||||||
|
|
||||||
protected void WriteBasicNode(RazorIRNode node)
|
protected void WriteBasicNode(RazorIRNode node)
|
||||||
{
|
{
|
||||||
WriteIndent();
|
WriteIndent();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue