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.Globalization;
using System.Linq; using System.Linq;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.Internal.Web.Utils; using Microsoft.Internal.Web.Utils;
@ -27,6 +28,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
: base(source.Type, source.Children, source.CodeGenerator) : base(source.Type, source.Children, source.CodeGenerator)
{ {
TagName = source.TagName; TagName = source.TagName;
Descriptors = source.Descriptors;
Attributes = new Dictionary<string, SyntaxTreeNode>(source.Attributes); Attributes = new Dictionary<string, SyntaxTreeNode>(source.Attributes);
_start = source.Start; _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> /// <summary>
/// The HTML attributes. /// The HTML attributes.
/// </summary> /// </summary>

View File

@ -26,6 +26,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
: base(original) : base(original)
{ {
TagName = original.TagName; TagName = original.TagName;
Descriptors = original.Descriptors;
Attributes = new Dictionary<string, SyntaxTreeNode>(original.Attributes); 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) public TagHelperBlockBuilder(string tagName, IEnumerable<TagHelperDescriptor> descriptors, Block startTag)
{ {
TagName = tagName; TagName = tagName;
Descriptors = descriptors;
CodeGenerator = new TagHelperCodeGenerator(descriptors); CodeGenerator = new TagHelperCodeGenerator(descriptors);
Type = startTag.Type; Type = startTag.Type;
Attributes = GetTagAttributes(startTag, descriptors); 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> /// <summary>
/// The HTML attributes. /// The HTML attributes.
/// </summary> /// </summary>