Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaybhargavb committed May 15, 2019
1 parent fa33195 commit b79eb81
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte
if (node.TagHelper.IsBindTagHelper() && node.AttributeName.StartsWith("bind") && node.IsParameterMatch)
{
var originalAttributeName = node.AttributeName.Split(':')[0];
if (!bindEntries.ContainsKey(originalAttributeName))
if (!bindEntries.TryGetValue(originalAttributeName, out var entry))
{
// There is no corresponding bind node. Add a diagnostic and move on.
reference.Parent.Diagnostics.Add(ComponentDiagnosticFactory.CreateBindAttributeParameter_MissingBind(
Expand All @@ -85,15 +85,16 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte
}
else if (node.BoundAttributeParameter.Name == "event")
{
bindEntries[originalAttributeName].BindEventNode = node;
entry.BindEventNode = node;
}
else if (node.BoundAttributeParameter.Name == "format")
{
bindEntries[originalAttributeName].BindFormatNode = node;
entry.BindFormatNode = node;
}
else
{
// Unsupported bind attribute parameter.
// Unsupported bind attribute parameter. This can only happen if bound attribute descriptor
// is configured to expect a parameter other than 'event' and 'format'.
}

// We've extracted what we need from the parameterized bind node. Remove it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,6 @@ public override void VisitMarkupTagHelperAttribute(MarkupTagHelperAttributeSynta
AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure,
Source = BuildSourceSpanFromNode(attributeValueNode),
IsIndexerNameMatch = TagHelperMatchingConventions.SatisfiesBoundAttributeIndexer(attributeName, associatedAttributeDescriptor),
IsParameterMatch = associatedAttributeParameterDescriptor != null,
};

_builder.Push(setTagHelperProperty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public sealed class TagHelperPropertyIntermediateNode : IntermediateNode

public bool IsIndexerNameMatch { get; set; }

public bool IsParameterMatch { get; set; }

public BoundAttributeParameterDescriptor BoundAttributeParameter { get; set; }

public bool IsParameterMatch => BoundAttributeParameter != null;

public override void Accept(IntermediateNodeVisitor visitor)
{
if (visitor == null)
Expand Down

0 comments on commit b79eb81

Please sign in to comment.