This repository has been archived by the owner on Dec 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved HtmlContentIRNode from renderer to writer
- Loading branch information
1 parent
ea3b7b0
commit fe60c24
Showing
12 changed files
with
254 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/RedirectedRuntimeTagHelperWriter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// 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; | ||
|
||
namespace Microsoft.AspNetCore.Razor.Evolution.CodeGeneration | ||
{ | ||
internal class RedirectedRuntimeTagHelperWriter : RuntimeTagHelperWriter | ||
{ | ||
private readonly string _textWriter; | ||
|
||
public RedirectedRuntimeTagHelperWriter(string textWriter) | ||
{ | ||
_textWriter = textWriter; | ||
} | ||
|
||
public new string WriteTagHelperOutputMethod { get; set; } = "WriteTo"; | ||
|
||
public override void WriteExecuteTagHelpers(CSharpRenderingContext context, ExecuteTagHelpersIRNode node) | ||
{ | ||
context.Writer | ||
.Write("await ") | ||
.WriteStartInstanceMethodInvocation( | ||
RunnerVariableName, | ||
RunnerRunAsyncMethodName) | ||
.Write(ExecutionContextVariableName) | ||
.WriteEndMethodInvocation(); | ||
|
||
var tagHelperOutputAccessor = $"{ExecutionContextVariableName}.{ExecutionContextOutputPropertyName}"; | ||
|
||
context.Writer | ||
.Write("if (!") | ||
.Write(tagHelperOutputAccessor) | ||
.Write(".") | ||
.Write(TagHelperOutputIsContentModifiedPropertyName) | ||
.WriteLine(")"); | ||
|
||
using (context.Writer.BuildScope()) | ||
{ | ||
context.Writer | ||
.Write("await ") | ||
.WriteInstanceMethodInvocation( | ||
ExecutionContextVariableName, | ||
ExecutionContextSetOutputContentAsyncMethodName); | ||
} | ||
|
||
context.Writer | ||
.WriteStartMethodInvocation(WriteTagHelperOutputMethod) | ||
.Write(_textWriter) | ||
.WriteParameterSeparator() | ||
.Write(tagHelperOutputAccessor) | ||
.WriteEndMethodInvocation() | ||
.WriteStartAssignment(ExecutionContextVariableName) | ||
.WriteInstanceMethodInvocation( | ||
ScopeManagerVariableName, | ||
ScopeManagerEndMethodName); | ||
} | ||
} | ||
} |
108 changes: 0 additions & 108 deletions
108
src/Microsoft.AspNetCore.Razor.Evolution/CodeGeneration/RedirectedTagHelperWriter.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.