Expose TagHelperDescriptors on TagHelperBlock.

- This will enable tooling to determine which descriptors are relevant to which TagHelperBlocks in the syntax tree.
This commit is contained in:
N. Taylor Mullen 2014-12-11 14:19:01 -08:00
parent c680833350
commit 170b7a76fd
2 changed files with 14 additions and 0 deletions

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Internal.Web.Utils;
@ -27,6 +28,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
: base(source.Type, source.Children, source.CodeGenerator)
{
TagName = source.TagName;
Descriptors = source.Descriptors;
Attributes = new Dictionary<string, SyntaxTreeNode>(source.Attributes);
_start = source.Start;
@ -38,6 +40,11 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
}
}
/// <summary>
/// <see cref="TagHelperDescriptor"/>s for the HTML element.
/// </summary>
public IEnumerable<TagHelperDescriptor> Descriptors { get; }
/// <summary>
/// The HTML attributes.
/// </summary>

View File

@ -26,6 +26,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
: base(original)
{
TagName = original.TagName;
Descriptors = original.Descriptors;
Attributes = new Dictionary<string, SyntaxTreeNode>(original.Attributes);
}
@ -42,6 +43,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
public TagHelperBlockBuilder(string tagName, IEnumerable<TagHelperDescriptor> descriptors, Block startTag)
{
TagName = tagName;
Descriptors = descriptors;
CodeGenerator = new TagHelperCodeGenerator(descriptors);
Type = startTag.Type;
Attributes = GetTagAttributes(startTag, descriptors);
@ -67,6 +69,11 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
}
}
/// <summary>
/// <see cref="TagHelperDescriptor"/>s for the HTML element.
/// </summary>
public IEnumerable<TagHelperDescriptor> Descriptors { get; }
/// <summary>
/// The HTML attributes.
/// </summary>