Support parsing directive attributes - Part 2/2 (dotnet/aspnetcore-tooling#619)

* Support parsing directive attributes
\n\nCommit migrated from 5eb8ef43eb
This commit is contained in:
Ajay Bhargav Baaskaran 2019-05-26 12:43:13 -07:00 committed by GitHub
parent 68f5fec0b0
commit f25734acf4
421 changed files with 3476 additions and 1626 deletions

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using Microsoft.AspNetCore.Razor.Language.Components;
namespace Microsoft.AspNetCore.Razor.Language namespace Microsoft.AspNetCore.Razor.Language
{ {
@ -52,6 +53,18 @@ namespace Microsoft.AspNetCore.Razor.Language
builder.IndexerValueTypeName = valueTypeName; builder.IndexerValueTypeName = valueTypeName;
} }
public static bool IsDirectiveAttribute(this BoundAttributeDescriptorBuilder builder)
{
if (builder == null)
{
throw new ArgumentNullException(nameof(builder));
}
return
builder.Metadata.TryGetValue(ComponentMetadata.Common.DirectiveAttribute, out var value) &&
string.Equals(bool.TrueString, value);
}
public static void SetPropertyName(this BoundAttributeParameterDescriptorBuilder builder, string propertyName) public static void SetPropertyName(this BoundAttributeParameterDescriptorBuilder builder, string propertyName)
{ {
if (builder == null) if (builder == null)

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Linq; using Microsoft.AspNetCore.Razor.Language.Components;
namespace Microsoft.AspNetCore.Razor.Language namespace Microsoft.AspNetCore.Razor.Language
{ {
@ -51,6 +51,18 @@ namespace Microsoft.AspNetCore.Razor.Language
return isIndexerNameMatch && attribute.IsIndexerBooleanProperty; return isIndexerNameMatch && attribute.IsIndexerBooleanProperty;
} }
internal static bool IsDirectiveAttribute(this BoundAttributeDescriptor attribute)
{
if (attribute == null)
{
throw new ArgumentNullException(nameof(attribute));
}
return
attribute.Metadata.TryGetValue(ComponentMetadata.Common.DirectiveAttribute, out var value) &&
string.Equals(bool.TrueString, value);
}
public static bool IsDefaultKind(this BoundAttributeParameterDescriptor parameter) public static bool IsDefaultKind(this BoundAttributeParameterDescriptor parameter)
{ {
if (parameter == null) if (parameter == null)

View File

@ -140,9 +140,11 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
foreach (var child in node.Attributes) foreach (var child in node.Attributes)
{ {
if (child is MarkupTagHelperAttributeSyntax attribute) if (child is MarkupTagHelperAttributeSyntax ||
child is MarkupTagHelperDirectiveAttributeSyntax ||
child is MarkupMinimizedTagHelperDirectiveAttributeSyntax)
{ {
Visit(attribute); Visit(child);
} }
} }
} }
@ -169,6 +171,19 @@ namespace Microsoft.AspNetCore.Razor.Language
Visit(node.Value); Visit(node.Value);
} }
public override void VisitMarkupTagHelperDirectiveAttribute(MarkupTagHelperDirectiveAttributeSyntax node)
{
Visit(node.Transition);
Visit(node.Colon);
Visit(node.Value);
}
public override void VisitMarkupMinimizedTagHelperDirectiveAttribute(MarkupMinimizedTagHelperDirectiveAttributeSyntax node)
{
Visit(node.Transition);
Visit(node.Colon);
}
public override void VisitMarkupMinimizedAttributeBlock(MarkupMinimizedAttributeBlockSyntax node) public override void VisitMarkupMinimizedAttributeBlock(MarkupMinimizedAttributeBlockSyntax node)
{ {
WriteBlock(node, BlockKindInternal.Markup, n => WriteBlock(node, BlockKindInternal.Markup, n =>

View File

@ -139,13 +139,13 @@
<value>Specifies a format to convert the value specified by the '{0}' attribute. The format string can currently only be used with expressions of type &lt;code&gt;DateTime&lt;/code&gt;.</value> <value>Specifies a format to convert the value specified by the '{0}' attribute. The format string can currently only be used with expressions of type &lt;code&gt;DateTime&lt;/code&gt;.</value>
</data> </data>
<data name="BindTagHelper_Fallback_Documentation" xml:space="preserve"> <data name="BindTagHelper_Fallback_Documentation" xml:space="preserve">
<value>Binds the provided expression to an attribute and a change event, based on the naming of the bind attribute. For example: &lt;code&gt;bind-value="..."&lt;/code&gt; and &lt;code&gt;bind-value:event="onchange"&lt;/code&gt; will assign the current value of the expression to the 'value' attribute, and assign a delegate that attempts to set the value to the 'onchange' attribute.</value> <value>Binds the provided expression to an attribute and a change event, based on the naming of the bind attribute. For example: &lt;code&gt;@bind-value="..."&lt;/code&gt; and &lt;code&gt;@bind-value:event="onchange"&lt;/code&gt; will assign the current value of the expression to the 'value' attribute, and assign a delegate that attempts to set the value to the 'onchange' attribute.</value>
</data> </data>
<data name="BindTagHelper_Fallback_Event_Documentation" xml:space="preserve"> <data name="BindTagHelper_Fallback_Event_Documentation" xml:space="preserve">
<value>Specifies the event handler name to attach for change notifications for the value provided by the '{0}' attribute.</value> <value>Specifies the event handler name to attach for change notifications for the value provided by the '{0}' attribute.</value>
</data> </data>
<data name="BindTagHelper_Fallback_Format_Documentation" xml:space="preserve"> <data name="BindTagHelper_Fallback_Format_Documentation" xml:space="preserve">
<value>Specifies a format to convert the value specified by the corresponding bind attribute. For example: &lt;code&gt;bind-value:format="..."&lt;/code&gt; will apply a format string to the value specified in &lt;code&gt;bind-value="..."&lt;/code&gt;. The format string can currently only be used with expressions of type &lt;code&gt;DateTime&lt;/code&gt;.</value> <value>Specifies a format to convert the value specified by the corresponding bind attribute. For example: &lt;code&gt;@bind-value:format="..."&lt;/code&gt; will apply a format string to the value specified in &lt;code&gt;@bind-value="..."&lt;/code&gt;. The format string can currently only be used with expressions of type &lt;code&gt;DateTime&lt;/code&gt;.</value>
</data> </data>
<data name="ChildContentParameterName_Documentation" xml:space="preserve"> <data name="ChildContentParameterName_Documentation" xml:space="preserve">
<value>Specifies the parameter name for the '{0}' child content expression.</value> <value>Specifies the parameter name for the '{0}' child content expression.</value>

View File

@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
return; return;
} }
// For each bind *usage* we need to rewrite the tag helper node to map to basic constructs. // For each @bind *usage* we need to rewrite the tag helper node to map to basic constructs.
var references = documentNode.FindDescendantReferences<TagHelperPropertyIntermediateNode>(); var references = documentNode.FindDescendantReferences<TagHelperPropertyIntermediateNode>();
var parameterReferences = documentNode.FindDescendantReferences<TagHelperAttributeParameterIntermediateNode>(); var parameterReferences = documentNode.FindDescendantReferences<TagHelperAttributeParameterIntermediateNode>();
@ -47,10 +47,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
ProcessDuplicates(parent); ProcessDuplicates(parent);
} }
// First, collect all the non-parameterized bind or bind-* attributes. // First, collect all the non-parameterized @bind or @bind-* attributes.
// The dict key is a tuple of (parent, attributeName) to differentiate attributes with the same name in two different elements. // The dict key is a tuple of (parent, attributeName) to differentiate attributes with the same name in two different elements.
// We don't have to worry about duplicate bound attributes in the same element // We don't have to worry about duplicate bound attributes in the same element
// like, <Foo bind="bar" bind="bar" />, because IR lowering takes care of that. // like, <Foo @bind="bar" @bind="bar" />, because IR lowering takes care of that.
var bindEntries = new Dictionary<(IntermediateNode, string), BindEntry>(); var bindEntries = new Dictionary<(IntermediateNode, string), BindEntry>();
for (var i = 0; i < references.Count; i++) for (var i = 0; i < references.Count; i++)
{ {
@ -64,13 +64,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
continue; continue;
} }
if (node.TagHelper.IsBindTagHelper() && node.AttributeName.StartsWith("bind")) if (node.TagHelper.IsBindTagHelper() && node.IsDirectiveAttribute)
{ {
bindEntries[(parent, node.AttributeName)] = new BindEntry(reference); bindEntries[(parent, node.AttributeName)] = new BindEntry(reference);
} }
} }
// Now collect all the parameterized attributes and store them along with their corresponding bind or bind-* attributes. // Now collect all the parameterized attributes and store them along with their corresponding @bind or @bind-* attributes.
for (var i = 0; i < parameterReferences.Count; i++) for (var i = 0; i < parameterReferences.Count; i++)
{ {
var parameterReference = parameterReferences[i]; var parameterReference = parameterReferences[i];
@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
continue; continue;
} }
if (node.TagHelper.IsBindTagHelper() && node.AttributeName.StartsWith("bind")) if (node.TagHelper.IsBindTagHelper() && node.IsDirectiveAttribute)
{ {
// Check if this tag contains a corresponding non-parameterized bind node. // Check if this tag contains a corresponding non-parameterized bind node.
if (!bindEntries.TryGetValue((parent, node.AttributeNameWithoutParameter), out var entry)) if (!bindEntries.TryGetValue((parent, node.AttributeNameWithoutParameter), out var entry))
@ -183,7 +183,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
} }
} }
// Also treat the general <input bind="..." /> as a 'fallback' for that case and remove it. // Also treat the general <input @bind="..." /> as a 'fallback' for that case and remove it.
// This is a workaround for a limitation where you can't write a tag helper that binds only // This is a workaround for a limitation where you can't write a tag helper that binds only
// when a specific attribute is **not** present. // when a specific attribute is **not** present.
if (attribute != null && if (attribute != null &&
@ -246,10 +246,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
// For the nodes that are related to the bind-attribute rewrite them to look like a set of // For the nodes that are related to the bind-attribute rewrite them to look like a set of
// 'normal' HTML attributes similar to the following transformation. // 'normal' HTML attributes similar to the following transformation.
// //
// Input: <MyComponent bind-Value="@currentCount" /> // Input: <MyComponent @bind-Value="@currentCount" />
// Output: <MyComponent Value ="...<get the value>..." ValueChanged ="... <set the value>..." ValueExpression ="() => ...<get the value>..." /> // Output: <MyComponent Value ="...<get the value>..." ValueChanged ="... <set the value>..." ValueExpression ="() => ...<get the value>..." />
// //
// This means that the expression that appears inside of 'bind' must be an LValue or else // This means that the expression that appears inside of '@bind' must be an LValue or else
// there will be errors. In general the errors that come from C# in this case are good enough // there will be errors. In general the errors that come from C# in this case are good enough
// to understand the problem. // to understand the problem.
// //
@ -463,7 +463,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
valueAttributeName = null; valueAttributeName = null;
changeAttributeName = null; changeAttributeName = null;
if (!attributeName.StartsWith("bind")) if (!attributeName.StartsWith("@bind"))
{ {
return false; return false;
} }
@ -473,7 +473,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
changeAttributeName = GetAttributeContent(bindEntry.BindEventNode)?.Content?.Trim('"'); changeAttributeName = GetAttributeContent(bindEntry.BindEventNode)?.Content?.Trim('"');
} }
if (attributeName == "bind") if (attributeName == "@bind")
{ {
return true; return true;
} }

View File

@ -54,7 +54,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
continue; continue;
} }
if (node.TagHelper.IsEventHandlerTagHelper()) if (node.TagHelper.IsEventHandlerTagHelper() && node.IsDirectiveAttribute)
{ {
reference.Replace(RewriteUsage(reference.Parent, node)); reference.Replace(RewriteUsage(reference.Parent, node));
} }
@ -147,6 +147,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
tokens.Insert(i + 1, original[i]); tokens.Insert(i + 1, original[i]);
} }
var attributeName = node.AttributeName;
if (node.IsDirectiveAttribute && attributeName.StartsWith("@"))
{
// Directive attributes start with a "@" but we don't want that to be included in the output attribute name.
// E.g, <input @onclick="..." /> should result in the creation of 'onclick' attribute.
attributeName = attributeName.Substring(1);
}
if (parent is MarkupElementIntermediateNode) if (parent is MarkupElementIntermediateNode)
{ {
var result = new HtmlAttributeIntermediateNode() var result = new HtmlAttributeIntermediateNode()
@ -155,10 +162,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
{ {
[ComponentMetadata.Common.OriginalAttributeName] = node.AttributeName, [ComponentMetadata.Common.OriginalAttributeName] = node.AttributeName,
}, },
AttributeName = node.AttributeName, AttributeName = attributeName,
Source = node.Source, Source = node.Source,
Prefix = node.AttributeName + "=\"", Prefix = attributeName + "=\"",
Suffix = "\"", Suffix = "\"",
}; };

View File

@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
var reference = references[i]; var reference = references[i];
var node = (TagHelperPropertyIntermediateNode)reference.Node; var node = (TagHelperPropertyIntermediateNode)reference.Node;
if (node.TagHelper.IsKeyTagHelper()) if (node.TagHelper.IsKeyTagHelper() && node.IsDirectiveAttribute)
{ {
reference.Replace(RewriteUsage(reference.Parent, node)); reference.Replace(RewriteUsage(reference.Parent, node));
} }

View File

@ -50,6 +50,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
public static class Common public static class Common
{ {
public static readonly string OriginalAttributeName = "Common.OriginalAttributeName"; public static readonly string OriginalAttributeName = "Common.OriginalAttributeName";
public static readonly string DirectiveAttribute = "Common.DirectiveAttribute";
} }
public static class Bind public static class Bind

View File

@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
var reference = references[i]; var reference = references[i];
var node = (TagHelperPropertyIntermediateNode)reference.Node; var node = (TagHelperPropertyIntermediateNode)reference.Node;
if (node.TagHelper.IsRefTagHelper()) if (node.TagHelper.IsRefTagHelper() && node.IsDirectiveAttribute)
{ {
reference.Replace(RewriteUsage(@class, reference.Parent, node)); reference.Replace(RewriteUsage(@class, reference.Parent, node));
} }

View File

@ -158,6 +158,7 @@ namespace Microsoft.AspNetCore.Razor.Language
// data-* attributes are explicitly not implemented by user agents and are not intended for use on // data-* attributes are explicitly not implemented by user agents and are not intended for use on
// the server; therefore it's invalid for TagHelpers to bind to them. // the server; therefore it's invalid for TagHelpers to bind to them.
const string DataDashPrefix = "data-"; const string DataDashPrefix = "data-";
var isDirectiveAttribute = this.IsDirectiveAttribute();
if (string.IsNullOrWhiteSpace(Name)) if (string.IsNullOrWhiteSpace(Name))
{ {
@ -182,14 +183,29 @@ namespace Microsoft.AspNetCore.Razor.Language
yield return diagnostic; yield return diagnostic;
} }
foreach (var character in Name) var name = Name;
if (isDirectiveAttribute && name.StartsWith("@"))
{
name = name.Substring(1);
}
else if (isDirectiveAttribute)
{
var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundDirectiveAttributeName(
_parent.GetDisplayName(),
GetDisplayName(),
Name);
yield return diagnostic;
}
foreach (var character in name)
{ {
if (char.IsWhiteSpace(character) || HtmlConventions.InvalidNonWhitespaceHtmlCharacters.Contains(character)) if (char.IsWhiteSpace(character) || HtmlConventions.InvalidNonWhitespaceHtmlCharacters.Contains(character))
{ {
var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributeName( var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributeName(
_parent.GetDisplayName(), _parent.GetDisplayName(),
GetDisplayName(), GetDisplayName(),
Name, name,
character); character);
yield return diagnostic; yield return diagnostic;
@ -218,14 +234,29 @@ namespace Microsoft.AspNetCore.Razor.Language
} }
else else
{ {
foreach (var character in IndexerAttributeNamePrefix) var indexerPrefix = IndexerAttributeNamePrefix;
if (isDirectiveAttribute && indexerPrefix.StartsWith("@"))
{
indexerPrefix = indexerPrefix.Substring(1);
}
else if (isDirectiveAttribute)
{
var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundDirectiveAttributePrefix(
_parent.GetDisplayName(),
GetDisplayName(),
indexerPrefix);
yield return diagnostic;
}
foreach (var character in indexerPrefix)
{ {
if (char.IsWhiteSpace(character) || HtmlConventions.InvalidNonWhitespaceHtmlCharacters.Contains(character)) if (char.IsWhiteSpace(character) || HtmlConventions.InvalidNonWhitespaceHtmlCharacters.Contains(character))
{ {
var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributePrefix( var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidBoundAttributePrefix(
_parent.GetDisplayName(), _parent.GetDisplayName(),
GetDisplayName(), GetDisplayName(),
IndexerAttributeNamePrefix, indexerPrefix,
character); character);
yield return diagnostic; yield return diagnostic;

View File

@ -1646,7 +1646,10 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
foreach (var child in node.Attributes) foreach (var child in node.Attributes)
{ {
if (child is MarkupTagHelperAttributeSyntax || child is MarkupMinimizedTagHelperAttributeSyntax) if (child is MarkupTagHelperAttributeSyntax ||
child is MarkupMinimizedTagHelperAttributeSyntax ||
child is MarkupTagHelperDirectiveAttributeSyntax ||
child is MarkupMinimizedTagHelperDirectiveAttributeSyntax)
{ {
Visit(child); Visit(child);
} }
@ -1672,30 +1675,114 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
foreach (var associatedDescriptor in associatedDescriptors) foreach (var associatedDescriptor in associatedDescriptors)
{ {
var associatedAttributeDescriptor = associatedDescriptor.BoundAttributes.First(a => if (TagHelperMatchingConventions.TryGetFirstBoundAttributeMatch(
attributeName,
associatedDescriptor,
out var associatedAttributeDescriptor,
out var indexerMatch,
out _,
out _))
{ {
return TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, a); var expectsBooleanValue = associatedAttributeDescriptor.ExpectsBooleanValue(attributeName);
});
var expectsBooleanValue = associatedAttributeDescriptor.ExpectsBooleanValue(attributeName); if (!expectsBooleanValue)
{
// We do not allow minimized non-boolean bound attributes.
return;
}
if (!expectsBooleanValue) var setTagHelperProperty = new TagHelperPropertyIntermediateNode()
{ {
// We do not allow minimized non-boolean bound attributes. AttributeName = attributeName,
return; BoundAttribute = associatedAttributeDescriptor,
TagHelper = associatedDescriptor,
AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure,
Source = null,
IsIndexerNameMatch = indexerMatch,
};
_builder.Add(setTagHelperProperty);
} }
}
}
else
{
var addHtmlAttribute = new TagHelperHtmlAttributeIntermediateNode()
{
AttributeName = attributeName,
AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure
};
var setTagHelperProperty = new TagHelperPropertyIntermediateNode() _builder.Add(addHtmlAttribute);
}
}
public override void VisitMarkupMinimizedTagHelperDirectiveAttribute(MarkupMinimizedTagHelperDirectiveAttributeSyntax node)
{
if (!_featureFlags.AllowMinimizedBooleanTagHelperAttributes)
{
// Minimized attributes are not valid for non-boolean bound attributes. TagHelperBlockRewriter
// has already logged an error if it was a non-boolean bound attribute; so we can skip.
return;
}
var element = node.FirstAncestorOrSelf<MarkupTagHelperElementSyntax>();
var descriptors = element.TagHelperInfo.BindingResult.Descriptors;
var attributeName = node.FullName;
var associatedDescriptors = descriptors.Where(descriptor =>
descriptor.BoundAttributes.Any(attributeDescriptor => TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, attributeDescriptor)));
if (associatedDescriptors.Any() && _renderedBoundAttributeNames.Add(attributeName))
{
foreach (var associatedDescriptor in associatedDescriptors)
{
if (TagHelperMatchingConventions.TryGetFirstBoundAttributeMatch(
attributeName,
associatedDescriptor,
out var associatedAttributeDescriptor,
out var indexerMatch,
out var parameterMatch,
out var associatedAttributeParameterDescriptor))
{ {
AttributeName = attributeName, var expectsBooleanValue = associatedAttributeDescriptor.ExpectsBooleanValue(attributeName);
BoundAttribute = associatedAttributeDescriptor,
TagHelper = associatedDescriptor,
AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure,
Source = null,
IsIndexerNameMatch = TagHelperMatchingConventions.SatisfiesBoundAttributeIndexer(attributeName, associatedAttributeDescriptor),
};
_builder.Add(setTagHelperProperty); if (!expectsBooleanValue)
{
// We do not allow minimized non-boolean bound attributes.
return;
}
IntermediateNode attributeNode;
if (parameterMatch &&
TagHelperMatchingConventions.TryGetBoundAttributeParameter(attributeName, out var attributeNameWithoutParameter, out _))
{
attributeNode = new TagHelperAttributeParameterIntermediateNode()
{
AttributeName = attributeName,
AttributeNameWithoutParameter = attributeNameWithoutParameter,
BoundAttributeParameter = associatedAttributeParameterDescriptor,
BoundAttribute = associatedAttributeDescriptor,
TagHelper = associatedDescriptor,
IsIndexerNameMatch = indexerMatch,
AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure,
Source = null,
};
}
else
{
attributeNode = new TagHelperPropertyIntermediateNode()
{
AttributeName = attributeName,
BoundAttribute = associatedAttributeDescriptor,
TagHelper = associatedDescriptor,
AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure,
Source = null,
IsIndexerNameMatch = indexerMatch,
};
}
_builder.Add(attributeNode);
}
} }
} }
else else
@ -1716,6 +1803,57 @@ namespace Microsoft.AspNetCore.Razor.Language
var descriptors = element.TagHelperInfo.BindingResult.Descriptors; var descriptors = element.TagHelperInfo.BindingResult.Descriptors;
var attributeName = node.Name.GetContent(); var attributeName = node.Name.GetContent();
var attributeValueNode = node.Value; var attributeValueNode = node.Value;
var associatedDescriptors = descriptors.Where(descriptor =>
descriptor.BoundAttributes.Any(attributeDescriptor => TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, attributeDescriptor)));
if (associatedDescriptors.Any() && _renderedBoundAttributeNames.Add(attributeName))
{
foreach (var associatedDescriptor in associatedDescriptors)
{
if (TagHelperMatchingConventions.TryGetFirstBoundAttributeMatch(
attributeName,
associatedDescriptor,
out var associatedAttributeDescriptor,
out var indexerMatch,
out _,
out _))
{
var setTagHelperProperty = new TagHelperPropertyIntermediateNode()
{
AttributeName = attributeName,
BoundAttribute = associatedAttributeDescriptor,
TagHelper = associatedDescriptor,
AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure,
Source = BuildSourceSpanFromNode(attributeValueNode),
IsIndexerNameMatch = indexerMatch,
};
_builder.Push(setTagHelperProperty);
VisitAttributeValue(attributeValueNode);
_builder.Pop();
}
}
}
else
{
var addHtmlAttribute = new TagHelperHtmlAttributeIntermediateNode()
{
AttributeName = attributeName,
AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure
};
_builder.Push(addHtmlAttribute);
VisitAttributeValue(attributeValueNode);
_builder.Pop();
}
}
public override void VisitMarkupTagHelperDirectiveAttribute(MarkupTagHelperDirectiveAttributeSyntax node)
{
var element = node.FirstAncestorOrSelf<MarkupTagHelperElementSyntax>();
var descriptors = element.TagHelperInfo.BindingResult.Descriptors;
var attributeName = node.FullName;
var attributeValueNode = node.Value;
var associatedDescriptors = descriptors.Where(descriptor => var associatedDescriptors = descriptors.Where(descriptor =>
descriptor.BoundAttributes.Any(attributeDescriptor => TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, attributeDescriptor))); descriptor.BoundAttributes.Any(attributeDescriptor => TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, attributeDescriptor)));
@ -1734,7 +1872,7 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
IntermediateNode attributeNode; IntermediateNode attributeNode;
if (parameterMatch && if (parameterMatch &&
TagHelperMatchingConventions.TryGetBoundAttributeParameter(attributeName, out var attributeNameWithoutParameter, out var _)) TagHelperMatchingConventions.TryGetBoundAttributeParameter(attributeName, out var attributeNameWithoutParameter, out _))
{ {
attributeNode = new TagHelperAttributeParameterIntermediateNode() attributeNode = new TagHelperAttributeParameterIntermediateNode()
{ {

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
namespace Microsoft.AspNetCore.Razor.Language namespace Microsoft.AspNetCore.Razor.Language
{ {
internal class DefaultRequiredAttributeDescriptor : RequiredAttributeDescriptor internal class DefaultRequiredAttributeDescriptor : RequiredAttributeDescriptor
@ -11,7 +13,8 @@ namespace Microsoft.AspNetCore.Razor.Language
string value, string value,
ValueComparisonMode valueComparison, ValueComparisonMode valueComparison,
string displayName, string displayName,
RazorDiagnostic[] diagnostics) RazorDiagnostic[] diagnostics,
Dictionary<string, string> metadata)
{ {
Name = name; Name = name;
NameComparison = nameComparison; NameComparison = nameComparison;
@ -19,6 +22,7 @@ namespace Microsoft.AspNetCore.Razor.Language
ValueComparison = valueComparison; ValueComparison = valueComparison;
DisplayName = displayName; DisplayName = displayName;
Diagnostics = diagnostics; Diagnostics = diagnostics;
Metadata = metadata;
} }
} }
} }

View File

@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.Razor.Language
internal class DefaultRequiredAttributeDescriptorBuilder : RequiredAttributeDescriptorBuilder internal class DefaultRequiredAttributeDescriptorBuilder : RequiredAttributeDescriptorBuilder
{ {
private RazorDiagnosticCollection _diagnostics; private RazorDiagnosticCollection _diagnostics;
private readonly Dictionary<string, string> _metadata = new Dictionary<string, string>();
public override string Name { get; set; } public override string Name { get; set; }
@ -32,6 +33,8 @@ namespace Microsoft.AspNetCore.Razor.Language
} }
} }
public override IDictionary<string, string> Metadata => _metadata;
public RequiredAttributeDescriptor Build() public RequiredAttributeDescriptor Build()
{ {
var validationDiagnostics = Validate(); var validationDiagnostics = Validate();
@ -41,18 +44,24 @@ namespace Microsoft.AspNetCore.Razor.Language
diagnostics.UnionWith(_diagnostics); diagnostics.UnionWith(_diagnostics);
} }
var displayName = NameComparisonMode == RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch ? string.Concat(Name, "...") : Name; var displayName = GetDisplayName();
var rule = new DefaultRequiredAttributeDescriptor( var rule = new DefaultRequiredAttributeDescriptor(
Name, Name,
NameComparisonMode, NameComparisonMode,
Value, Value,
ValueComparisonMode, ValueComparisonMode,
displayName, displayName,
diagnostics?.ToArray() ?? Array.Empty<RazorDiagnostic>()); diagnostics?.ToArray() ?? Array.Empty<RazorDiagnostic>(),
new Dictionary<string, string>(Metadata));
return rule; return rule;
} }
private string GetDisplayName()
{
return NameComparisonMode == RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch ? string.Concat(Name, "...") : Name;
}
private IEnumerable<RazorDiagnostic> Validate() private IEnumerable<RazorDiagnostic> Validate()
{ {
if (string.IsNullOrWhiteSpace(Name)) if (string.IsNullOrWhiteSpace(Name))
@ -63,7 +72,20 @@ namespace Microsoft.AspNetCore.Razor.Language
} }
else else
{ {
foreach (var character in Name) var name = Name;
var isDirectiveAttribute = this.IsDirectiveAttribute();
if (isDirectiveAttribute && name.StartsWith("@"))
{
name = name.Substring(1);
}
else if (isDirectiveAttribute)
{
var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InvalidRequiredDirectiveAttributeName(GetDisplayName(), Name);
yield return diagnostic;
}
foreach (var character in name)
{ {
if (char.IsWhiteSpace(character) || HtmlConventions.InvalidNonWhitespaceHtmlCharacters.Contains(character)) if (char.IsWhiteSpace(character) || HtmlConventions.InvalidNonWhitespaceHtmlCharacters.Contains(character))
{ {

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using Microsoft.AspNetCore.Razor.Language.CodeGeneration;
using Microsoft.AspNetCore.Razor.Language.Components; using Microsoft.AspNetCore.Razor.Language.Components;
namespace Microsoft.AspNetCore.Razor.Language.Intermediate namespace Microsoft.AspNetCore.Razor.Language.Intermediate
@ -42,7 +41,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
throw new ArgumentNullException(nameof(propertyNode)); throw new ArgumentNullException(nameof(propertyNode));
} }
AttributeName = propertyNode.AttributeName; var attributeName = propertyNode.AttributeName;
if (propertyNode.IsDirectiveAttribute && attributeName.StartsWith("@"))
{
// Directive attributes start with a "@" but we don't want that to be included in the output attribute name.
// E.g, <input @onclick="..." /> should result in the creation of 'onclick' attribute.
attributeName = attributeName.Substring(1);
}
AttributeName = attributeName;
AttributeStructure = propertyNode.AttributeStructure; AttributeStructure = propertyNode.AttributeStructure;
BoundAttribute = propertyNode.BoundAttribute; BoundAttribute = propertyNode.BoundAttribute;
PropertyName = propertyNode.BoundAttribute.GetPropertyName(); PropertyName = propertyNode.BoundAttribute.GetPropertyName();

View File

@ -23,6 +23,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public bool IsIndexerNameMatch { get; set; } public bool IsIndexerNameMatch { get; set; }
public bool IsDirectiveAttribute => BoundAttribute?.IsDirectiveAttribute() ?? false;
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {
if (visitor == null) if (visitor == null)
@ -41,6 +43,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
formatter.WriteProperty(nameof(AttributeStructure), AttributeStructure.ToString()); formatter.WriteProperty(nameof(AttributeStructure), AttributeStructure.ToString());
formatter.WriteProperty(nameof(BoundAttribute), BoundAttribute?.DisplayName); formatter.WriteProperty(nameof(BoundAttribute), BoundAttribute?.DisplayName);
formatter.WriteProperty(nameof(BoundAttributeParameter), BoundAttributeParameter?.DisplayName); formatter.WriteProperty(nameof(BoundAttributeParameter), BoundAttributeParameter?.DisplayName);
formatter.WriteProperty(nameof(IsDirectiveAttribute), IsDirectiveAttribute.ToString());
formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName); formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName);
} }
} }

View File

@ -19,6 +19,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
public bool IsIndexerNameMatch { get; set; } public bool IsIndexerNameMatch { get; set; }
public bool IsDirectiveAttribute => BoundAttribute?.IsDirectiveAttribute() ?? false;
public override void Accept(IntermediateNodeVisitor visitor) public override void Accept(IntermediateNodeVisitor visitor)
{ {
if (visitor == null) if (visitor == null)
@ -36,6 +38,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
formatter.WriteProperty(nameof(AttributeName), AttributeName); formatter.WriteProperty(nameof(AttributeName), AttributeName);
formatter.WriteProperty(nameof(AttributeStructure), AttributeStructure.ToString()); formatter.WriteProperty(nameof(AttributeStructure), AttributeStructure.ToString());
formatter.WriteProperty(nameof(BoundAttribute), BoundAttribute?.DisplayName); formatter.WriteProperty(nameof(BoundAttribute), BoundAttribute?.DisplayName);
formatter.WriteProperty(nameof(IsDirectiveAttribute), IsDirectiveAttribute.ToString());
formatter.WriteProperty(nameof(IsIndexerNameMatch), IsIndexerNameMatch.ToString()); formatter.WriteProperty(nameof(IsIndexerNameMatch), IsIndexerNameMatch.ToString());
formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName); formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName);
} }

View File

@ -1088,8 +1088,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
private bool TryParseAttributeName(out IEnumerable<SyntaxToken> nameTokens) private bool TryParseAttributeName(out IEnumerable<SyntaxToken> nameTokens)
{ {
nameTokens = Enumerable.Empty<SyntaxToken>(); nameTokens = Enumerable.Empty<SyntaxToken>();
if (At(SyntaxKind.Transition) || At(SyntaxKind.RazorCommentTransition)) //
// We are currently here <input |name="..." />
// If we encounter a transition (@) here, it can be parsed as CSharp or Markup depending on the feature flag.
// For example, in Components, we want to parse it as Markup so we can support directive attributes.
//
if (Context.FeatureFlags.AllowCSharpInMarkupAttributeArea &&
(At(SyntaxKind.Transition) || At(SyntaxKind.RazorCommentTransition)))
{ {
// If we get here, there is CSharp in the attribute area. Don't try to parse the name.
return false; return false;
} }

View File

@ -176,16 +176,27 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
var result = CreateTryParseResult(attributeBlock.Name.GetContent(), descriptors, processedBoundAttributeNames); var result = CreateTryParseResult(attributeBlock.Name.GetContent(), descriptors, processedBoundAttributeNames);
result.AttributeStructure = AttributeStructure.Minimized; result.AttributeStructure = AttributeStructure.Minimized;
var rewritten = SyntaxFactory.MarkupMinimizedTagHelperAttribute(
attributeBlock.NamePrefix,
attributeBlock.Name);
rewritten = rewritten.WithTagHelperAttributeInfo( if (result.IsDirectiveAttribute)
new TagHelperAttributeInfo(result.AttributeName, result.AttributeStructure, result.IsBoundAttribute)); {
// Directive attributes have a different syntax.
result.RewrittenAttribute = RewriteToMinimizedDirectiveAttribute(attributeBlock, result);
result.RewrittenAttribute = rewritten; return result;
}
else
{
var rewritten = SyntaxFactory.MarkupMinimizedTagHelperAttribute(
attributeBlock.NamePrefix,
attributeBlock.Name);
return result; rewritten = rewritten.WithTagHelperAttributeInfo(
new TagHelperAttributeInfo(result.AttributeName, parameterName: null, result.AttributeStructure, result.IsBoundAttribute, isDirectiveAttribute: false));
result.RewrittenAttribute = rewritten;
return result;
}
} }
private static TryParseResult TryParseAttribute( private static TryParseResult TryParseAttribute(
@ -238,9 +249,84 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
} }
var rewrittenValue = RewriteAttributeValue(result, attributeValue); var rewrittenValue = RewriteAttributeValue(result, attributeValue);
var rewritten = SyntaxFactory.MarkupTagHelperAttribute( if (result.IsDirectiveAttribute)
{
// Directive attributes have a different syntax.
result.RewrittenAttribute = RewriteToDirectiveAttribute(attributeBlock, result, rewrittenValue);
return result;
}
else
{
var rewritten = SyntaxFactory.MarkupTagHelperAttribute(
attributeBlock.NamePrefix,
attributeBlock.Name,
attributeBlock.NameSuffix,
attributeBlock.EqualsToken,
attributeBlock.ValuePrefix,
rewrittenValue,
attributeBlock.ValueSuffix);
rewritten = rewritten.WithTagHelperAttributeInfo(
new TagHelperAttributeInfo(result.AttributeName, parameterName: null, result.AttributeStructure, result.IsBoundAttribute, isDirectiveAttribute: false));
result.RewrittenAttribute = rewritten;
return result;
}
}
private static MarkupTagHelperDirectiveAttributeSyntax RewriteToDirectiveAttribute(
MarkupAttributeBlockSyntax attributeBlock,
TryParseResult result,
MarkupTagHelperAttributeValueSyntax rewrittenValue)
{
//
// Consider, <Foo @bind:param="..." />
// We're now going to rewrite @bind:param from a regular MarkupAttributeBlock to a MarkupTagHelperDirectiveAttribute.
// We need to split the name "@bind:param" into four parts,
// @ - Transition (MetaCode)
// bind - Name (Text)
// : - Colon (MetaCode)
// param - ParameterName (Text)
//
var attributeName = result.AttributeName;
var attributeNameSyntax = attributeBlock.Name;
var transition = SyntaxFactory.RazorMetaCode(
new SyntaxList<SyntaxToken>(SyntaxFactory.MissingToken(SyntaxKind.Transition)));
RazorMetaCodeSyntax colon = null;
MarkupTextLiteralSyntax parameterName = null;
if (attributeName.StartsWith("@"))
{
attributeName = attributeName.Substring(1);
var attributeNameToken = SyntaxFactory.Token(SyntaxKind.Text, attributeName);
attributeNameSyntax = SyntaxFactory.MarkupTextLiteral().AddLiteralTokens(attributeNameToken);
var transitionToken = SyntaxFactory.Token(SyntaxKind.Transition, "@");
transition = SyntaxFactory.RazorMetaCode(new SyntaxList<SyntaxToken>(transitionToken));
}
if (attributeName.IndexOf(':') != -1)
{
var segments = attributeName.Split(new[] { ':' }, 2);
var attributeNameToken = SyntaxFactory.Token(SyntaxKind.Text, segments[0]);
attributeNameSyntax = SyntaxFactory.MarkupTextLiteral().AddLiteralTokens(attributeNameToken);
var colonToken = SyntaxFactory.Token(SyntaxKind.Colon, ":");
colon = SyntaxFactory.RazorMetaCode(new SyntaxList<SyntaxToken>(colonToken));
var parameterNameToken = SyntaxFactory.Token(SyntaxKind.Text, segments[1]);
parameterName = SyntaxFactory.MarkupTextLiteral().AddLiteralTokens(parameterNameToken);
}
var rewritten = SyntaxFactory.MarkupTagHelperDirectiveAttribute(
attributeBlock.NamePrefix, attributeBlock.NamePrefix,
attributeBlock.Name, transition,
attributeNameSyntax,
colon,
parameterName,
attributeBlock.NameSuffix, attributeBlock.NameSuffix,
attributeBlock.EqualsToken, attributeBlock.EqualsToken,
attributeBlock.ValuePrefix, attributeBlock.ValuePrefix,
@ -248,11 +334,65 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
attributeBlock.ValueSuffix); attributeBlock.ValueSuffix);
rewritten = rewritten.WithTagHelperAttributeInfo( rewritten = rewritten.WithTagHelperAttributeInfo(
new TagHelperAttributeInfo(result.AttributeName, result.AttributeStructure, result.IsBoundAttribute)); new TagHelperAttributeInfo(result.AttributeName, parameterName?.GetContent(), result.AttributeStructure, result.IsBoundAttribute, isDirectiveAttribute: true));
result.RewrittenAttribute = rewritten; return rewritten;
}
return result; private static MarkupMinimizedTagHelperDirectiveAttributeSyntax RewriteToMinimizedDirectiveAttribute(
MarkupMinimizedAttributeBlockSyntax attributeBlock,
TryParseResult result)
{
//
// Consider, <Foo @bind:param />
// We're now going to rewrite @bind:param from a regular MarkupAttributeBlock to a MarkupTagHelperDirectiveAttribute.
// We need to split the name "@bind:param" into four parts,
// @ - Transition (MetaCode)
// bind - Name (Text)
// : - Colon (MetaCode)
// param - ParameterName (Text)
//
var attributeName = result.AttributeName;
var attributeNameSyntax = attributeBlock.Name;
var transition = SyntaxFactory.RazorMetaCode(
new SyntaxList<SyntaxToken>(SyntaxFactory.MissingToken(SyntaxKind.Transition)));
RazorMetaCodeSyntax colon = null;
MarkupTextLiteralSyntax parameterName = null;
if (attributeName.StartsWith("@"))
{
attributeName = attributeName.Substring(1);
var attributeNameToken = SyntaxFactory.Token(SyntaxKind.Text, attributeName);
attributeNameSyntax = SyntaxFactory.MarkupTextLiteral().AddLiteralTokens(attributeNameToken);
var transitionToken = SyntaxFactory.Token(SyntaxKind.Transition, "@");
transition = SyntaxFactory.RazorMetaCode(new SyntaxList<SyntaxToken>(transitionToken));
}
if (attributeName.IndexOf(':') != -1)
{
var segments = attributeName.Split(new[] { ':' }, 2);
var attributeNameToken = SyntaxFactory.Token(SyntaxKind.Text, segments[0]);
attributeNameSyntax = SyntaxFactory.MarkupTextLiteral().AddLiteralTokens(attributeNameToken);
var colonToken = SyntaxFactory.Token(SyntaxKind.Colon, ":");
colon = SyntaxFactory.RazorMetaCode(new SyntaxList<SyntaxToken>(colonToken));
var parameterNameToken = SyntaxFactory.Token(SyntaxKind.Text, segments[1]);
parameterName = SyntaxFactory.MarkupTextLiteral().AddLiteralTokens(parameterNameToken);
}
var rewritten = SyntaxFactory.MarkupMinimizedTagHelperDirectiveAttribute(
attributeBlock.NamePrefix,
transition,
attributeNameSyntax,
colon,
parameterName);
rewritten = rewritten.WithTagHelperAttributeInfo(
new TagHelperAttributeInfo(result.AttributeName, parameterName?.GetContent(), result.AttributeStructure, result.IsBoundAttribute, isDirectiveAttribute: true));
return rewritten;
} }
private static MarkupTagHelperAttributeValueSyntax RewriteAttributeValue(TryParseResult result, RazorBlockSyntax attributeValue) private static MarkupTagHelperAttributeValueSyntax RewriteAttributeValue(TryParseResult result, RazorBlockSyntax attributeValue)
@ -301,6 +441,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
var isBoundNonStringAttribute = false; var isBoundNonStringAttribute = false;
var isBoundBooleanAttribute = false; var isBoundBooleanAttribute = false;
var isMissingDictionaryKey = false; var isMissingDictionaryKey = false;
var isDirectiveAttribute = false;
foreach (var descriptor in descriptors) foreach (var descriptor in descriptors)
{ {
@ -327,6 +468,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
name.Length == firstBoundAttribute.IndexerNamePrefix.Length; name.Length == firstBoundAttribute.IndexerNamePrefix.Length;
} }
isDirectiveAttribute = firstBoundAttribute.IsDirectiveAttribute();
break; break;
} }
} }
@ -345,7 +488,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
IsBoundNonStringAttribute = isBoundNonStringAttribute, IsBoundNonStringAttribute = isBoundNonStringAttribute,
IsBoundBooleanAttribute = isBoundBooleanAttribute, IsBoundBooleanAttribute = isBoundBooleanAttribute,
IsMissingDictionaryKey = isMissingDictionaryKey, IsMissingDictionaryKey = isMissingDictionaryKey,
IsDuplicateAttribute = isDuplicateAttribute IsDuplicateAttribute = isDuplicateAttribute,
IsDirectiveAttribute = isDirectiveAttribute
}; };
} }
@ -355,6 +499,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
{ {
return tagHelperAttribute.Value?.GetContent(); return tagHelperAttribute.Value?.GetContent();
} }
else if (attributeBlock is MarkupTagHelperDirectiveAttributeSyntax directiveAttribute)
{
return directiveAttribute.Value?.GetContent();
}
else if (attributeBlock is MarkupAttributeBlockSyntax attribute) else if (attributeBlock is MarkupAttributeBlockSyntax attribute)
{ {
return attribute.Value?.GetContent(); return attribute.Value?.GetContent();
@ -666,6 +814,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
public bool IsMissingDictionaryKey { get; set; } public bool IsMissingDictionaryKey { get; set; }
public bool IsDuplicateAttribute { get; set; } public bool IsDuplicateAttribute { get; set; }
public bool IsDirectiveAttribute { get; set; }
} }
} }
} }

View File

@ -824,6 +824,64 @@ namespace Microsoft.AspNetCore.Razor.Language
return diagnostic; return diagnostic;
} }
internal static readonly RazorDiagnosticDescriptor TagHelper_InvalidBoundDirectiveAttributeName =
new RazorDiagnosticDescriptor(
$"{DiagnosticPrefix}3015",
() => Resources.TagHelper_InvalidBoundDirectiveAttributeName,
RazorDiagnosticSeverity.Error);
public static RazorDiagnostic CreateTagHelper_InvalidBoundDirectiveAttributeName(
string tagHelperDisplayName,
string propertyDisplayName,
string invalidName)
{
var diagnostic = RazorDiagnostic.Create(
TagHelper_InvalidBoundDirectiveAttributeName,
new SourceSpan(SourceLocation.Undefined, contentLength: 0),
tagHelperDisplayName,
propertyDisplayName,
invalidName);
return diagnostic;
}
internal static readonly RazorDiagnosticDescriptor TagHelper_InvalidBoundDirectiveAttributePrefix =
new RazorDiagnosticDescriptor(
$"{DiagnosticPrefix}3015",
() => Resources.TagHelper_InvalidBoundDirectiveAttributePrefix,
RazorDiagnosticSeverity.Error);
public static RazorDiagnostic CreateTagHelper_InvalidBoundDirectiveAttributePrefix(
string tagHelperDisplayName,
string propertyDisplayName,
string invalidName)
{
var diagnostic = RazorDiagnostic.Create(
TagHelper_InvalidBoundDirectiveAttributePrefix,
new SourceSpan(SourceLocation.Undefined, contentLength: 0),
tagHelperDisplayName,
propertyDisplayName,
invalidName);
return diagnostic;
}
internal static readonly RazorDiagnosticDescriptor TagHelper_InvalidRequiredDirectiveAttributeName =
new RazorDiagnosticDescriptor(
$"{DiagnosticPrefix}3016",
() => Resources.TagHelper_InvalidRequiredDirectiveAttributeName,
RazorDiagnosticSeverity.Error);
public static RazorDiagnostic CreateTagHelper_InvalidRequiredDirectiveAttributeName(
string propertyDisplayName,
string invalidName)
{
var diagnostic = RazorDiagnostic.Create(
TagHelper_InvalidRequiredDirectiveAttributeName,
new SourceSpan(SourceLocation.Undefined, contentLength: 0),
propertyDisplayName,
invalidName);
return diagnostic;
}
#endregion #endregion
#region Rewriter Errors #region Rewriter Errors

View File

@ -20,6 +20,7 @@ namespace Microsoft.AspNetCore.Razor.Language
var allowRazorInAllCodeBlocks = false; var allowRazorInAllCodeBlocks = false;
var allowUsingVariableDeclarations = false; var allowUsingVariableDeclarations = false;
var allowConditionalDataDashAttributes = false; var allowConditionalDataDashAttributes = false;
var allowCSharpInMarkupAttributeArea = true;
if (version.CompareTo(RazorLanguageVersion.Version_2_1) >= 0) if (version.CompareTo(RazorLanguageVersion.Version_2_1) >= 0)
{ {
@ -39,6 +40,7 @@ namespace Microsoft.AspNetCore.Razor.Language
if (FileKinds.IsComponent(fileKind)) if (FileKinds.IsComponent(fileKind))
{ {
allowConditionalDataDashAttributes = true; allowConditionalDataDashAttributes = true;
allowCSharpInMarkupAttributeArea = false;
} }
if (version.CompareTo(RazorLanguageVersion.Experimental) >= 0) if (version.CompareTo(RazorLanguageVersion.Experimental) >= 0)
@ -52,7 +54,8 @@ namespace Microsoft.AspNetCore.Razor.Language
allowComponentFileKind, allowComponentFileKind,
allowRazorInAllCodeBlocks, allowRazorInAllCodeBlocks,
allowUsingVariableDeclarations, allowUsingVariableDeclarations,
allowConditionalDataDashAttributes); allowConditionalDataDashAttributes,
allowCSharpInMarkupAttributeArea);
} }
public abstract bool AllowMinimizedBooleanTagHelperAttributes { get; } public abstract bool AllowMinimizedBooleanTagHelperAttributes { get; }
@ -67,6 +70,8 @@ namespace Microsoft.AspNetCore.Razor.Language
public abstract bool AllowConditionalDataDashAttributes { get; } public abstract bool AllowConditionalDataDashAttributes { get; }
public abstract bool AllowCSharpInMarkupAttributeArea { get; }
private class DefaultRazorParserFeatureFlags : RazorParserFeatureFlags private class DefaultRazorParserFeatureFlags : RazorParserFeatureFlags
{ {
public DefaultRazorParserFeatureFlags( public DefaultRazorParserFeatureFlags(
@ -75,7 +80,8 @@ namespace Microsoft.AspNetCore.Razor.Language
bool allowComponentFileKind, bool allowComponentFileKind,
bool allowRazorInAllCodeBlocks, bool allowRazorInAllCodeBlocks,
bool allowUsingVariableDeclarations, bool allowUsingVariableDeclarations,
bool allowConditionalDataDashAttributesInComponents) bool allowConditionalDataDashAttributesInComponents,
bool allowCSharpInMarkupAttributeArea)
{ {
AllowMinimizedBooleanTagHelperAttributes = allowMinimizedBooleanTagHelperAttributes; AllowMinimizedBooleanTagHelperAttributes = allowMinimizedBooleanTagHelperAttributes;
AllowHtmlCommentsInTagHelpers = allowHtmlCommentsInTagHelpers; AllowHtmlCommentsInTagHelpers = allowHtmlCommentsInTagHelpers;
@ -83,6 +89,7 @@ namespace Microsoft.AspNetCore.Razor.Language
AllowRazorInAllCodeBlocks = allowRazorInAllCodeBlocks; AllowRazorInAllCodeBlocks = allowRazorInAllCodeBlocks;
AllowUsingVariableDeclarations = allowUsingVariableDeclarations; AllowUsingVariableDeclarations = allowUsingVariableDeclarations;
AllowConditionalDataDashAttributes = allowConditionalDataDashAttributesInComponents; AllowConditionalDataDashAttributes = allowConditionalDataDashAttributesInComponents;
AllowCSharpInMarkupAttributeArea = allowCSharpInMarkupAttributeArea;
} }
public override bool AllowMinimizedBooleanTagHelperAttributes { get; } public override bool AllowMinimizedBooleanTagHelperAttributes { get; }
@ -96,6 +103,8 @@ namespace Microsoft.AspNetCore.Razor.Language
public override bool AllowUsingVariableDeclarations { get; } public override bool AllowUsingVariableDeclarations { get; }
public override bool AllowConditionalDataDashAttributes { get; } public override bool AllowConditionalDataDashAttributes { get; }
public override bool AllowCSharpInMarkupAttributeArea { get; }
} }
} }
} }

View File

@ -21,6 +21,8 @@ namespace Microsoft.AspNetCore.Razor.Language
public IReadOnlyList<RazorDiagnostic> Diagnostics { get; protected set; } public IReadOnlyList<RazorDiagnostic> Diagnostics { get; protected set; }
public IReadOnlyDictionary<string, string> Metadata { get; protected set; }
public bool HasErrors public bool HasErrors
{ {
get get

View File

@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
namespace Microsoft.AspNetCore.Razor.Language namespace Microsoft.AspNetCore.Razor.Language
{ {
public abstract class RequiredAttributeDescriptorBuilder public abstract class RequiredAttributeDescriptorBuilder
@ -14,5 +16,7 @@ namespace Microsoft.AspNetCore.Razor.Language
public abstract RequiredAttributeDescriptor.ValueComparisonMode ValueComparisonMode { get; set; } public abstract RequiredAttributeDescriptor.ValueComparisonMode ValueComparisonMode { get; set; }
public abstract RazorDiagnosticCollection Diagnostics { get; } public abstract RazorDiagnosticCollection Diagnostics { get; }
public virtual IDictionary<string, string> Metadata { get; }
} }
} }

View File

@ -0,0 +1,23 @@
// 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.Components;
namespace Microsoft.AspNetCore.Razor.Language
{
public static class RequiredAttributeDescriptorBuilderExtensions
{
internal static bool IsDirectiveAttribute(this RequiredAttributeDescriptorBuilder builder)
{
if (builder == null)
{
throw new ArgumentNullException(nameof(builder));
}
return
builder.Metadata.TryGetValue(ComponentMetadata.Common.DirectiveAttribute, out var value) &&
string.Equals(bool.TrueString, value);
}
}
}

View File

@ -0,0 +1,23 @@
// 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.Components;
namespace Microsoft.AspNetCore.Razor.Language
{
public static class RequiredAttributeDescriptorExtensions
{
public static bool IsDirectiveAttribute(this RequiredAttributeDescriptor descriptor)
{
if (descriptor == null)
{
throw new ArgumentNullException(nameof(descriptor));
}
return
descriptor.Metadata.TryGetValue(ComponentMetadata.Common.DirectiveAttribute, out var value) &&
string.Equals(bool.TrueString, value);
}
}
}

View File

@ -550,4 +550,13 @@
<data name="DirectiveExpectsCSharpAttribute" xml:space="preserve"> <data name="DirectiveExpectsCSharpAttribute" xml:space="preserve">
<value>The '{0}' directive expects a C# attribute.</value> <value>The '{0}' directive expects a C# attribute.</value>
</data> </data>
<data name="TagHelper_InvalidBoundDirectiveAttributeName" xml:space="preserve">
<value>Invalid tag helper bound directive attribute '{1}' on tag helper '{0}'. The directive attribute '{2}' should start with a '@' character.</value>
</data>
<data name="TagHelper_InvalidBoundDirectiveAttributePrefix" xml:space="preserve">
<value>Invalid tag helper bound directive attribute '{1}' on tag helper '{0}'. Tag helpers cannot bind to directive attributes with prefix '{2}' because the prefix doesn't start with a '@' character.</value>
</data>
<data name="TagHelper_InvalidRequiredDirectiveAttributeName" xml:space="preserve">
<value>Invalid tag helper required directive attribute '{0}'. The directive attribute '{1}' should start with a '@' character.</value>
</data>
</root> </root>

View File

@ -2376,6 +2376,301 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax
} }
} }
internal sealed partial class MarkupTagHelperDirectiveAttributeSyntax : MarkupSyntaxNode
{
private readonly MarkupTextLiteralSyntax _namePrefix;
private readonly RazorMetaCodeSyntax _transition;
private readonly MarkupTextLiteralSyntax _name;
private readonly RazorMetaCodeSyntax _colon;
private readonly MarkupTextLiteralSyntax _parameterName;
private readonly MarkupTextLiteralSyntax _nameSuffix;
private readonly SyntaxToken _equalsToken;
private readonly MarkupTextLiteralSyntax _valuePrefix;
private readonly MarkupTagHelperAttributeValueSyntax _value;
private readonly MarkupTextLiteralSyntax _valueSuffix;
internal MarkupTagHelperDirectiveAttributeSyntax(SyntaxKind kind, MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName, MarkupTextLiteralSyntax nameSuffix, SyntaxToken equalsToken, MarkupTextLiteralSyntax valuePrefix, MarkupTagHelperAttributeValueSyntax value, MarkupTextLiteralSyntax valueSuffix, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations)
: base(kind, diagnostics, annotations)
{
SlotCount = 10;
if (namePrefix != null)
{
AdjustFlagsAndWidth(namePrefix);
_namePrefix = namePrefix;
}
AdjustFlagsAndWidth(transition);
_transition = transition;
AdjustFlagsAndWidth(name);
_name = name;
if (colon != null)
{
AdjustFlagsAndWidth(colon);
_colon = colon;
}
if (parameterName != null)
{
AdjustFlagsAndWidth(parameterName);
_parameterName = parameterName;
}
if (nameSuffix != null)
{
AdjustFlagsAndWidth(nameSuffix);
_nameSuffix = nameSuffix;
}
AdjustFlagsAndWidth(equalsToken);
_equalsToken = equalsToken;
if (valuePrefix != null)
{
AdjustFlagsAndWidth(valuePrefix);
_valuePrefix = valuePrefix;
}
AdjustFlagsAndWidth(value);
_value = value;
if (valueSuffix != null)
{
AdjustFlagsAndWidth(valueSuffix);
_valueSuffix = valueSuffix;
}
}
internal MarkupTagHelperDirectiveAttributeSyntax(SyntaxKind kind, MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName, MarkupTextLiteralSyntax nameSuffix, SyntaxToken equalsToken, MarkupTextLiteralSyntax valuePrefix, MarkupTagHelperAttributeValueSyntax value, MarkupTextLiteralSyntax valueSuffix)
: base(kind)
{
SlotCount = 10;
if (namePrefix != null)
{
AdjustFlagsAndWidth(namePrefix);
_namePrefix = namePrefix;
}
AdjustFlagsAndWidth(transition);
_transition = transition;
AdjustFlagsAndWidth(name);
_name = name;
if (colon != null)
{
AdjustFlagsAndWidth(colon);
_colon = colon;
}
if (parameterName != null)
{
AdjustFlagsAndWidth(parameterName);
_parameterName = parameterName;
}
if (nameSuffix != null)
{
AdjustFlagsAndWidth(nameSuffix);
_nameSuffix = nameSuffix;
}
AdjustFlagsAndWidth(equalsToken);
_equalsToken = equalsToken;
if (valuePrefix != null)
{
AdjustFlagsAndWidth(valuePrefix);
_valuePrefix = valuePrefix;
}
AdjustFlagsAndWidth(value);
_value = value;
if (valueSuffix != null)
{
AdjustFlagsAndWidth(valueSuffix);
_valueSuffix = valueSuffix;
}
}
public MarkupTextLiteralSyntax NamePrefix { get { return _namePrefix; } }
public RazorMetaCodeSyntax Transition { get { return _transition; } }
public MarkupTextLiteralSyntax Name { get { return _name; } }
public RazorMetaCodeSyntax Colon { get { return _colon; } }
public MarkupTextLiteralSyntax ParameterName { get { return _parameterName; } }
public MarkupTextLiteralSyntax NameSuffix { get { return _nameSuffix; } }
public SyntaxToken EqualsToken { get { return _equalsToken; } }
public MarkupTextLiteralSyntax ValuePrefix { get { return _valuePrefix; } }
public MarkupTagHelperAttributeValueSyntax Value { get { return _value; } }
public MarkupTextLiteralSyntax ValueSuffix { get { return _valueSuffix; } }
internal override GreenNode GetSlot(int index)
{
switch (index)
{
case 0: return _namePrefix;
case 1: return _transition;
case 2: return _name;
case 3: return _colon;
case 4: return _parameterName;
case 5: return _nameSuffix;
case 6: return _equalsToken;
case 7: return _valuePrefix;
case 8: return _value;
case 9: return _valueSuffix;
default: return null;
}
}
internal override SyntaxNode CreateRed(SyntaxNode parent, int position)
{
return new Syntax.MarkupTagHelperDirectiveAttributeSyntax(this, parent, position);
}
public override TResult Accept<TResult>(SyntaxVisitor<TResult> visitor)
{
return visitor.VisitMarkupTagHelperDirectiveAttribute(this);
}
public override void Accept(SyntaxVisitor visitor)
{
visitor.VisitMarkupTagHelperDirectiveAttribute(this);
}
public MarkupTagHelperDirectiveAttributeSyntax Update(MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName, MarkupTextLiteralSyntax nameSuffix, SyntaxToken equalsToken, MarkupTextLiteralSyntax valuePrefix, MarkupTagHelperAttributeValueSyntax value, MarkupTextLiteralSyntax valueSuffix)
{
if (namePrefix != NamePrefix || transition != Transition || name != Name || colon != Colon || parameterName != ParameterName || nameSuffix != NameSuffix || equalsToken != EqualsToken || valuePrefix != ValuePrefix || value != Value || valueSuffix != ValueSuffix)
{
var newNode = SyntaxFactory.MarkupTagHelperDirectiveAttribute(namePrefix, transition, name, colon, parameterName, nameSuffix, equalsToken, valuePrefix, value, valueSuffix);
var diags = GetDiagnostics();
if (diags != null && diags.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations != null && annotations.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics)
{
return new MarkupTagHelperDirectiveAttributeSyntax(Kind, _namePrefix, _transition, _name, _colon, _parameterName, _nameSuffix, _equalsToken, _valuePrefix, _value, _valueSuffix, diagnostics, GetAnnotations());
}
internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations)
{
return new MarkupTagHelperDirectiveAttributeSyntax(Kind, _namePrefix, _transition, _name, _colon, _parameterName, _nameSuffix, _equalsToken, _valuePrefix, _value, _valueSuffix, GetDiagnostics(), annotations);
}
}
internal sealed partial class MarkupMinimizedTagHelperDirectiveAttributeSyntax : MarkupSyntaxNode
{
private readonly MarkupTextLiteralSyntax _namePrefix;
private readonly RazorMetaCodeSyntax _transition;
private readonly MarkupTextLiteralSyntax _name;
private readonly RazorMetaCodeSyntax _colon;
private readonly MarkupTextLiteralSyntax _parameterName;
internal MarkupMinimizedTagHelperDirectiveAttributeSyntax(SyntaxKind kind, MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations)
: base(kind, diagnostics, annotations)
{
SlotCount = 5;
if (namePrefix != null)
{
AdjustFlagsAndWidth(namePrefix);
_namePrefix = namePrefix;
}
AdjustFlagsAndWidth(transition);
_transition = transition;
AdjustFlagsAndWidth(name);
_name = name;
if (colon != null)
{
AdjustFlagsAndWidth(colon);
_colon = colon;
}
if (parameterName != null)
{
AdjustFlagsAndWidth(parameterName);
_parameterName = parameterName;
}
}
internal MarkupMinimizedTagHelperDirectiveAttributeSyntax(SyntaxKind kind, MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName)
: base(kind)
{
SlotCount = 5;
if (namePrefix != null)
{
AdjustFlagsAndWidth(namePrefix);
_namePrefix = namePrefix;
}
AdjustFlagsAndWidth(transition);
_transition = transition;
AdjustFlagsAndWidth(name);
_name = name;
if (colon != null)
{
AdjustFlagsAndWidth(colon);
_colon = colon;
}
if (parameterName != null)
{
AdjustFlagsAndWidth(parameterName);
_parameterName = parameterName;
}
}
public MarkupTextLiteralSyntax NamePrefix { get { return _namePrefix; } }
public RazorMetaCodeSyntax Transition { get { return _transition; } }
public MarkupTextLiteralSyntax Name { get { return _name; } }
public RazorMetaCodeSyntax Colon { get { return _colon; } }
public MarkupTextLiteralSyntax ParameterName { get { return _parameterName; } }
internal override GreenNode GetSlot(int index)
{
switch (index)
{
case 0: return _namePrefix;
case 1: return _transition;
case 2: return _name;
case 3: return _colon;
case 4: return _parameterName;
default: return null;
}
}
internal override SyntaxNode CreateRed(SyntaxNode parent, int position)
{
return new Syntax.MarkupMinimizedTagHelperDirectiveAttributeSyntax(this, parent, position);
}
public override TResult Accept<TResult>(SyntaxVisitor<TResult> visitor)
{
return visitor.VisitMarkupMinimizedTagHelperDirectiveAttribute(this);
}
public override void Accept(SyntaxVisitor visitor)
{
visitor.VisitMarkupMinimizedTagHelperDirectiveAttribute(this);
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax Update(MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName)
{
if (namePrefix != NamePrefix || transition != Transition || name != Name || colon != Colon || parameterName != ParameterName)
{
var newNode = SyntaxFactory.MarkupMinimizedTagHelperDirectiveAttribute(namePrefix, transition, name, colon, parameterName);
var diags = GetDiagnostics();
if (diags != null && diags.Length > 0)
newNode = newNode.WithDiagnosticsGreen(diags);
var annotations = GetAnnotations();
if (annotations != null && annotations.Length > 0)
newNode = newNode.WithAnnotationsGreen(annotations);
return newNode;
}
return this;
}
internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics)
{
return new MarkupMinimizedTagHelperDirectiveAttributeSyntax(Kind, _namePrefix, _transition, _name, _colon, _parameterName, diagnostics, GetAnnotations());
}
internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations)
{
return new MarkupMinimizedTagHelperDirectiveAttributeSyntax(Kind, _namePrefix, _transition, _name, _colon, _parameterName, GetDiagnostics(), annotations);
}
}
internal abstract partial class CSharpSyntaxNode : RazorSyntaxNode internal abstract partial class CSharpSyntaxNode : RazorSyntaxNode
{ {
internal CSharpSyntaxNode(SyntaxKind kind, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) internal CSharpSyntaxNode(SyntaxKind kind, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations)
@ -3675,6 +3970,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax
return DefaultVisit(node); return DefaultVisit(node);
} }
public virtual TResult VisitMarkupTagHelperDirectiveAttribute(MarkupTagHelperDirectiveAttributeSyntax node)
{
return DefaultVisit(node);
}
public virtual TResult VisitMarkupMinimizedTagHelperDirectiveAttribute(MarkupMinimizedTagHelperDirectiveAttributeSyntax node)
{
return DefaultVisit(node);
}
public virtual TResult VisitCSharpCodeBlock(CSharpCodeBlockSyntax node) public virtual TResult VisitCSharpCodeBlock(CSharpCodeBlockSyntax node)
{ {
return DefaultVisit(node); return DefaultVisit(node);
@ -3869,6 +4174,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax
DefaultVisit(node); DefaultVisit(node);
} }
public virtual void VisitMarkupTagHelperDirectiveAttribute(MarkupTagHelperDirectiveAttributeSyntax node)
{
DefaultVisit(node);
}
public virtual void VisitMarkupMinimizedTagHelperDirectiveAttribute(MarkupMinimizedTagHelperDirectiveAttributeSyntax node)
{
DefaultVisit(node);
}
public virtual void VisitCSharpCodeBlock(CSharpCodeBlockSyntax node) public virtual void VisitCSharpCodeBlock(CSharpCodeBlockSyntax node)
{ {
DefaultVisit(node); DefaultVisit(node);
@ -4130,6 +4445,31 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax
return node.Update(children); return node.Update(children);
} }
public override GreenNode VisitMarkupTagHelperDirectiveAttribute(MarkupTagHelperDirectiveAttributeSyntax node)
{
var namePrefix = (MarkupTextLiteralSyntax)Visit(node.NamePrefix);
var transition = (RazorMetaCodeSyntax)Visit(node.Transition);
var name = (MarkupTextLiteralSyntax)Visit(node.Name);
var colon = (RazorMetaCodeSyntax)Visit(node.Colon);
var parameterName = (MarkupTextLiteralSyntax)Visit(node.ParameterName);
var nameSuffix = (MarkupTextLiteralSyntax)Visit(node.NameSuffix);
var equalsToken = (SyntaxToken)Visit(node.EqualsToken);
var valuePrefix = (MarkupTextLiteralSyntax)Visit(node.ValuePrefix);
var value = (MarkupTagHelperAttributeValueSyntax)Visit(node.Value);
var valueSuffix = (MarkupTextLiteralSyntax)Visit(node.ValueSuffix);
return node.Update(namePrefix, transition, name, colon, parameterName, nameSuffix, equalsToken, valuePrefix, value, valueSuffix);
}
public override GreenNode VisitMarkupMinimizedTagHelperDirectiveAttribute(MarkupMinimizedTagHelperDirectiveAttributeSyntax node)
{
var namePrefix = (MarkupTextLiteralSyntax)Visit(node.NamePrefix);
var transition = (RazorMetaCodeSyntax)Visit(node.Transition);
var name = (MarkupTextLiteralSyntax)Visit(node.Name);
var colon = (RazorMetaCodeSyntax)Visit(node.Colon);
var parameterName = (MarkupTextLiteralSyntax)Visit(node.ParameterName);
return node.Update(namePrefix, transition, name, colon, parameterName);
}
public override GreenNode VisitCSharpCodeBlock(CSharpCodeBlockSyntax node) public override GreenNode VisitCSharpCodeBlock(CSharpCodeBlockSyntax node)
{ {
var children = VisitList(node.Children); var children = VisitList(node.Children);
@ -4663,6 +5003,37 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax
return result; return result;
} }
public static MarkupTagHelperDirectiveAttributeSyntax MarkupTagHelperDirectiveAttribute(MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName, MarkupTextLiteralSyntax nameSuffix, SyntaxToken equalsToken, MarkupTextLiteralSyntax valuePrefix, MarkupTagHelperAttributeValueSyntax value, MarkupTextLiteralSyntax valueSuffix)
{
if (transition == null)
throw new ArgumentNullException(nameof(transition));
if (name == null)
throw new ArgumentNullException(nameof(name));
if (equalsToken == null)
throw new ArgumentNullException(nameof(equalsToken));
switch (equalsToken.Kind)
{
case SyntaxKind.Equals:
break;
default:
throw new ArgumentException("equalsToken");
}
if (value == null)
throw new ArgumentNullException(nameof(value));
return new MarkupTagHelperDirectiveAttributeSyntax(SyntaxKind.MarkupTagHelperDirectiveAttribute, namePrefix, transition, name, colon, parameterName, nameSuffix, equalsToken, valuePrefix, value, valueSuffix);
}
public static MarkupMinimizedTagHelperDirectiveAttributeSyntax MarkupMinimizedTagHelperDirectiveAttribute(MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName)
{
if (transition == null)
throw new ArgumentNullException(nameof(transition));
if (name == null)
throw new ArgumentNullException(nameof(name));
return new MarkupMinimizedTagHelperDirectiveAttributeSyntax(SyntaxKind.MarkupMinimizedTagHelperDirectiveAttribute, namePrefix, transition, name, colon, parameterName);
}
public static CSharpCodeBlockSyntax CSharpCodeBlock(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList<RazorSyntaxNode> children) public static CSharpCodeBlockSyntax CSharpCodeBlock(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList<RazorSyntaxNode> children)
{ {
var result = new CSharpCodeBlockSyntax(SyntaxKind.CSharpCodeBlock, children.Node); var result = new CSharpCodeBlockSyntax(SyntaxKind.CSharpCodeBlock, children.Node);
@ -4838,6 +5209,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax
typeof(MarkupTagHelperAttributeSyntax), typeof(MarkupTagHelperAttributeSyntax),
typeof(MarkupMinimizedTagHelperAttributeSyntax), typeof(MarkupMinimizedTagHelperAttributeSyntax),
typeof(MarkupTagHelperAttributeValueSyntax), typeof(MarkupTagHelperAttributeValueSyntax),
typeof(MarkupTagHelperDirectiveAttributeSyntax),
typeof(MarkupMinimizedTagHelperDirectiveAttributeSyntax),
typeof(CSharpCodeBlockSyntax), typeof(CSharpCodeBlockSyntax),
typeof(CSharpTransitionSyntax), typeof(CSharpTransitionSyntax),
typeof(CSharpStatementLiteralSyntax), typeof(CSharpStatementLiteralSyntax),

View File

@ -155,6 +155,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax
return DefaultVisit(node); return DefaultVisit(node);
} }
/// <summary>Called when the visitor visits a MarkupTagHelperDirectiveAttributeSyntax node.</summary>
public virtual TResult VisitMarkupTagHelperDirectiveAttribute(MarkupTagHelperDirectiveAttributeSyntax node)
{
return DefaultVisit(node);
}
/// <summary>Called when the visitor visits a MarkupMinimizedTagHelperDirectiveAttributeSyntax node.</summary>
public virtual TResult VisitMarkupMinimizedTagHelperDirectiveAttribute(MarkupMinimizedTagHelperDirectiveAttributeSyntax node)
{
return DefaultVisit(node);
}
/// <summary>Called when the visitor visits a CSharpCodeBlockSyntax node.</summary> /// <summary>Called when the visitor visits a CSharpCodeBlockSyntax node.</summary>
public virtual TResult VisitCSharpCodeBlock(CSharpCodeBlockSyntax node) public virtual TResult VisitCSharpCodeBlock(CSharpCodeBlockSyntax node)
{ {
@ -386,6 +398,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax
DefaultVisit(node); DefaultVisit(node);
} }
/// <summary>Called when the visitor visits a MarkupTagHelperDirectiveAttributeSyntax node.</summary>
public virtual void VisitMarkupTagHelperDirectiveAttribute(MarkupTagHelperDirectiveAttributeSyntax node)
{
DefaultVisit(node);
}
/// <summary>Called when the visitor visits a MarkupMinimizedTagHelperDirectiveAttributeSyntax node.</summary>
public virtual void VisitMarkupMinimizedTagHelperDirectiveAttribute(MarkupMinimizedTagHelperDirectiveAttributeSyntax node)
{
DefaultVisit(node);
}
/// <summary>Called when the visitor visits a CSharpCodeBlockSyntax node.</summary> /// <summary>Called when the visitor visits a CSharpCodeBlockSyntax node.</summary>
public virtual void VisitCSharpCodeBlock(CSharpCodeBlockSyntax node) public virtual void VisitCSharpCodeBlock(CSharpCodeBlockSyntax node)
{ {
@ -661,6 +685,31 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax
return node.Update(children); return node.Update(children);
} }
public override SyntaxNode VisitMarkupTagHelperDirectiveAttribute(MarkupTagHelperDirectiveAttributeSyntax node)
{
var namePrefix = (MarkupTextLiteralSyntax)Visit(node.NamePrefix);
var transition = (RazorMetaCodeSyntax)Visit(node.Transition);
var name = (MarkupTextLiteralSyntax)Visit(node.Name);
var colon = (RazorMetaCodeSyntax)Visit(node.Colon);
var parameterName = (MarkupTextLiteralSyntax)Visit(node.ParameterName);
var nameSuffix = (MarkupTextLiteralSyntax)Visit(node.NameSuffix);
var equalsToken = (SyntaxToken)VisitToken(node.EqualsToken);
var valuePrefix = (MarkupTextLiteralSyntax)Visit(node.ValuePrefix);
var value = (MarkupTagHelperAttributeValueSyntax)Visit(node.Value);
var valueSuffix = (MarkupTextLiteralSyntax)Visit(node.ValueSuffix);
return node.Update(namePrefix, transition, name, colon, parameterName, nameSuffix, equalsToken, valuePrefix, value, valueSuffix);
}
public override SyntaxNode VisitMarkupMinimizedTagHelperDirectiveAttribute(MarkupMinimizedTagHelperDirectiveAttributeSyntax node)
{
var namePrefix = (MarkupTextLiteralSyntax)Visit(node.NamePrefix);
var transition = (RazorMetaCodeSyntax)Visit(node.Transition);
var name = (MarkupTextLiteralSyntax)Visit(node.Name);
var colon = (RazorMetaCodeSyntax)Visit(node.Colon);
var parameterName = (MarkupTextLiteralSyntax)Visit(node.ParameterName);
return node.Update(namePrefix, transition, name, colon, parameterName);
}
public override SyntaxNode VisitCSharpCodeBlock(CSharpCodeBlockSyntax node) public override SyntaxNode VisitCSharpCodeBlock(CSharpCodeBlockSyntax node)
{ {
var children = VisitList(node.Children); var children = VisitList(node.Children);
@ -1280,6 +1329,53 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax
return SyntaxFactory.MarkupTagHelperAttributeValue(default(SyntaxList<RazorSyntaxNode>)); return SyntaxFactory.MarkupTagHelperAttributeValue(default(SyntaxList<RazorSyntaxNode>));
} }
/// <summary>Creates a new MarkupTagHelperDirectiveAttributeSyntax instance.</summary>
public static MarkupTagHelperDirectiveAttributeSyntax MarkupTagHelperDirectiveAttribute(MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName, MarkupTextLiteralSyntax nameSuffix, SyntaxToken equalsToken, MarkupTextLiteralSyntax valuePrefix, MarkupTagHelperAttributeValueSyntax value, MarkupTextLiteralSyntax valueSuffix)
{
if (transition == null)
throw new ArgumentNullException(nameof(transition));
if (name == null)
throw new ArgumentNullException(nameof(name));
switch (equalsToken.Kind)
{
case SyntaxKind.Equals:
break;
default:
throw new ArgumentException("equalsToken");
}
if (value == null)
throw new ArgumentNullException(nameof(value));
return (MarkupTagHelperDirectiveAttributeSyntax)InternalSyntax.SyntaxFactory.MarkupTagHelperDirectiveAttribute(namePrefix == null ? null : (InternalSyntax.MarkupTextLiteralSyntax)namePrefix.Green, transition == null ? null : (InternalSyntax.RazorMetaCodeSyntax)transition.Green, name == null ? null : (InternalSyntax.MarkupTextLiteralSyntax)name.Green, colon == null ? null : (InternalSyntax.RazorMetaCodeSyntax)colon.Green, parameterName == null ? null : (InternalSyntax.MarkupTextLiteralSyntax)parameterName.Green, nameSuffix == null ? null : (InternalSyntax.MarkupTextLiteralSyntax)nameSuffix.Green, (Syntax.InternalSyntax.SyntaxToken)equalsToken.Green, valuePrefix == null ? null : (InternalSyntax.MarkupTextLiteralSyntax)valuePrefix.Green, value == null ? null : (InternalSyntax.MarkupTagHelperAttributeValueSyntax)value.Green, valueSuffix == null ? null : (InternalSyntax.MarkupTextLiteralSyntax)valueSuffix.Green).CreateRed();
}
/// <summary>Creates a new MarkupTagHelperDirectiveAttributeSyntax instance.</summary>
public static MarkupTagHelperDirectiveAttributeSyntax MarkupTagHelperDirectiveAttribute(MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName, MarkupTextLiteralSyntax nameSuffix, MarkupTextLiteralSyntax valuePrefix, MarkupTagHelperAttributeValueSyntax value, MarkupTextLiteralSyntax valueSuffix)
{
return SyntaxFactory.MarkupTagHelperDirectiveAttribute(namePrefix, transition, name, colon, parameterName, nameSuffix, SyntaxFactory.Token(SyntaxKind.Equals), valuePrefix, value, valueSuffix);
}
/// <summary>Creates a new MarkupTagHelperDirectiveAttributeSyntax instance.</summary>
public static MarkupTagHelperDirectiveAttributeSyntax MarkupTagHelperDirectiveAttribute()
{
return SyntaxFactory.MarkupTagHelperDirectiveAttribute(default(MarkupTextLiteralSyntax), SyntaxFactory.RazorMetaCode(), SyntaxFactory.MarkupTextLiteral(), default(RazorMetaCodeSyntax), default(MarkupTextLiteralSyntax), default(MarkupTextLiteralSyntax), SyntaxFactory.Token(SyntaxKind.Equals), default(MarkupTextLiteralSyntax), SyntaxFactory.MarkupTagHelperAttributeValue(), default(MarkupTextLiteralSyntax));
}
/// <summary>Creates a new MarkupMinimizedTagHelperDirectiveAttributeSyntax instance.</summary>
public static MarkupMinimizedTagHelperDirectiveAttributeSyntax MarkupMinimizedTagHelperDirectiveAttribute(MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName)
{
if (transition == null)
throw new ArgumentNullException(nameof(transition));
if (name == null)
throw new ArgumentNullException(nameof(name));
return (MarkupMinimizedTagHelperDirectiveAttributeSyntax)InternalSyntax.SyntaxFactory.MarkupMinimizedTagHelperDirectiveAttribute(namePrefix == null ? null : (InternalSyntax.MarkupTextLiteralSyntax)namePrefix.Green, transition == null ? null : (InternalSyntax.RazorMetaCodeSyntax)transition.Green, name == null ? null : (InternalSyntax.MarkupTextLiteralSyntax)name.Green, colon == null ? null : (InternalSyntax.RazorMetaCodeSyntax)colon.Green, parameterName == null ? null : (InternalSyntax.MarkupTextLiteralSyntax)parameterName.Green).CreateRed();
}
/// <summary>Creates a new MarkupMinimizedTagHelperDirectiveAttributeSyntax instance.</summary>
public static MarkupMinimizedTagHelperDirectiveAttributeSyntax MarkupMinimizedTagHelperDirectiveAttribute()
{
return SyntaxFactory.MarkupMinimizedTagHelperDirectiveAttribute(default(MarkupTextLiteralSyntax), SyntaxFactory.RazorMetaCode(), SyntaxFactory.MarkupTextLiteral(), default(RazorMetaCodeSyntax), default(MarkupTextLiteralSyntax));
}
/// <summary>Creates a new CSharpCodeBlockSyntax instance.</summary> /// <summary>Creates a new CSharpCodeBlockSyntax instance.</summary>
public static CSharpCodeBlockSyntax CSharpCodeBlock(SyntaxList<RazorSyntaxNode> children) public static CSharpCodeBlockSyntax CSharpCodeBlock(SyntaxList<RazorSyntaxNode> children)
{ {

View File

@ -2548,6 +2548,427 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax
} }
} }
internal sealed partial class MarkupTagHelperDirectiveAttributeSyntax : MarkupSyntaxNode
{
private MarkupTextLiteralSyntax _namePrefix;
private RazorMetaCodeSyntax _transition;
private MarkupTextLiteralSyntax _name;
private RazorMetaCodeSyntax _colon;
private MarkupTextLiteralSyntax _parameterName;
private MarkupTextLiteralSyntax _nameSuffix;
private SyntaxToken _equalsToken;
private MarkupTextLiteralSyntax _valuePrefix;
private MarkupTagHelperAttributeValueSyntax _value;
private MarkupTextLiteralSyntax _valueSuffix;
internal MarkupTagHelperDirectiveAttributeSyntax(GreenNode green, SyntaxNode parent, int position)
: base(green, parent, position)
{
}
public MarkupTextLiteralSyntax NamePrefix
{
get
{
return GetRedAtZero(ref _namePrefix);
}
}
public RazorMetaCodeSyntax Transition
{
get
{
return GetRed(ref _transition, 1);
}
}
public MarkupTextLiteralSyntax Name
{
get
{
return GetRed(ref _name, 2);
}
}
public RazorMetaCodeSyntax Colon
{
get
{
return GetRed(ref _colon, 3);
}
}
public MarkupTextLiteralSyntax ParameterName
{
get
{
return GetRed(ref _parameterName, 4);
}
}
public MarkupTextLiteralSyntax NameSuffix
{
get
{
return GetRed(ref _nameSuffix, 5);
}
}
public SyntaxToken EqualsToken
{
get
{
return GetRed(ref _equalsToken, 6);
}
}
public MarkupTextLiteralSyntax ValuePrefix
{
get
{
return GetRed(ref _valuePrefix, 7);
}
}
public MarkupTagHelperAttributeValueSyntax Value
{
get
{
return GetRed(ref _value, 8);
}
}
public MarkupTextLiteralSyntax ValueSuffix
{
get
{
return GetRed(ref _valueSuffix, 9);
}
}
internal override SyntaxNode GetNodeSlot(int index)
{
switch (index)
{
case 0: return GetRedAtZero(ref _namePrefix);
case 1: return GetRed(ref _transition, 1);
case 2: return GetRed(ref _name, 2);
case 3: return GetRed(ref _colon, 3);
case 4: return GetRed(ref _parameterName, 4);
case 5: return GetRed(ref _nameSuffix, 5);
case 6: return GetRed(ref _equalsToken, 6);
case 7: return GetRed(ref _valuePrefix, 7);
case 8: return GetRed(ref _value, 8);
case 9: return GetRed(ref _valueSuffix, 9);
default: return null;
}
}
internal override SyntaxNode GetCachedSlot(int index)
{
switch (index)
{
case 0: return _namePrefix;
case 1: return _transition;
case 2: return _name;
case 3: return _colon;
case 4: return _parameterName;
case 5: return _nameSuffix;
case 6: return _equalsToken;
case 7: return _valuePrefix;
case 8: return _value;
case 9: return _valueSuffix;
default: return null;
}
}
public override TResult Accept<TResult>(SyntaxVisitor<TResult> visitor)
{
return visitor.VisitMarkupTagHelperDirectiveAttribute(this);
}
public override void Accept(SyntaxVisitor visitor)
{
visitor.VisitMarkupTagHelperDirectiveAttribute(this);
}
public MarkupTagHelperDirectiveAttributeSyntax Update(MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName, MarkupTextLiteralSyntax nameSuffix, SyntaxToken equalsToken, MarkupTextLiteralSyntax valuePrefix, MarkupTagHelperAttributeValueSyntax value, MarkupTextLiteralSyntax valueSuffix)
{
if (namePrefix != NamePrefix || transition != Transition || name != Name || colon != Colon || parameterName != ParameterName || nameSuffix != NameSuffix || equalsToken != EqualsToken || valuePrefix != ValuePrefix || value != Value || valueSuffix != ValueSuffix)
{
var newNode = SyntaxFactory.MarkupTagHelperDirectiveAttribute(namePrefix, transition, name, colon, parameterName, nameSuffix, equalsToken, valuePrefix, value, valueSuffix);
var diagnostics = GetDiagnostics();
if (diagnostics != null && diagnostics.Length > 0)
newNode = newNode.WithDiagnostics(diagnostics);
var annotations = GetAnnotations();
if (annotations != null && annotations.Length > 0)
return newNode.WithAnnotations(annotations);
return newNode;
}
return this;
}
public MarkupTagHelperDirectiveAttributeSyntax WithNamePrefix(MarkupTextLiteralSyntax namePrefix)
{
return Update(namePrefix, Transition, Name, Colon, ParameterName, NameSuffix, EqualsToken, ValuePrefix, Value, ValueSuffix);
}
public MarkupTagHelperDirectiveAttributeSyntax WithTransition(RazorMetaCodeSyntax transition)
{
return Update(NamePrefix, transition, Name, Colon, ParameterName, NameSuffix, EqualsToken, ValuePrefix, Value, ValueSuffix);
}
public MarkupTagHelperDirectiveAttributeSyntax WithName(MarkupTextLiteralSyntax name)
{
return Update(NamePrefix, Transition, name, Colon, ParameterName, NameSuffix, EqualsToken, ValuePrefix, Value, ValueSuffix);
}
public MarkupTagHelperDirectiveAttributeSyntax WithColon(RazorMetaCodeSyntax colon)
{
return Update(NamePrefix, Transition, Name, colon, ParameterName, NameSuffix, EqualsToken, ValuePrefix, Value, ValueSuffix);
}
public MarkupTagHelperDirectiveAttributeSyntax WithParameterName(MarkupTextLiteralSyntax parameterName)
{
return Update(NamePrefix, Transition, Name, Colon, parameterName, NameSuffix, EqualsToken, ValuePrefix, Value, ValueSuffix);
}
public MarkupTagHelperDirectiveAttributeSyntax WithNameSuffix(MarkupTextLiteralSyntax nameSuffix)
{
return Update(NamePrefix, Transition, Name, Colon, ParameterName, nameSuffix, EqualsToken, ValuePrefix, Value, ValueSuffix);
}
public MarkupTagHelperDirectiveAttributeSyntax WithEqualsToken(SyntaxToken equalsToken)
{
return Update(NamePrefix, Transition, Name, Colon, ParameterName, NameSuffix, equalsToken, ValuePrefix, Value, ValueSuffix);
}
public MarkupTagHelperDirectiveAttributeSyntax WithValuePrefix(MarkupTextLiteralSyntax valuePrefix)
{
return Update(NamePrefix, Transition, Name, Colon, ParameterName, NameSuffix, EqualsToken, valuePrefix, Value, ValueSuffix);
}
public MarkupTagHelperDirectiveAttributeSyntax WithValue(MarkupTagHelperAttributeValueSyntax value)
{
return Update(NamePrefix, Transition, Name, Colon, ParameterName, NameSuffix, EqualsToken, ValuePrefix, value, ValueSuffix);
}
public MarkupTagHelperDirectiveAttributeSyntax WithValueSuffix(MarkupTextLiteralSyntax valueSuffix)
{
return Update(NamePrefix, Transition, Name, Colon, ParameterName, NameSuffix, EqualsToken, ValuePrefix, Value, valueSuffix);
}
public MarkupTagHelperDirectiveAttributeSyntax AddNamePrefixLiteralTokens(params SyntaxToken[] items)
{
var _namePrefix = this.NamePrefix ?? SyntaxFactory.MarkupTextLiteral();
return this.WithNamePrefix(_namePrefix.WithLiteralTokens(_namePrefix.LiteralTokens.AddRange(items)));
}
public MarkupTagHelperDirectiveAttributeSyntax AddTransitionMetaCode(params SyntaxToken[] items)
{
return this.WithTransition(this.Transition.WithMetaCode(this.Transition.MetaCode.AddRange(items)));
}
public MarkupTagHelperDirectiveAttributeSyntax AddNameLiteralTokens(params SyntaxToken[] items)
{
return this.WithName(this.Name.WithLiteralTokens(this.Name.LiteralTokens.AddRange(items)));
}
public MarkupTagHelperDirectiveAttributeSyntax AddColonMetaCode(params SyntaxToken[] items)
{
var _colon = this.Colon ?? SyntaxFactory.RazorMetaCode();
return this.WithColon(_colon.WithMetaCode(_colon.MetaCode.AddRange(items)));
}
public MarkupTagHelperDirectiveAttributeSyntax AddParameterNameLiteralTokens(params SyntaxToken[] items)
{
var _parameterName = this.ParameterName ?? SyntaxFactory.MarkupTextLiteral();
return this.WithParameterName(_parameterName.WithLiteralTokens(_parameterName.LiteralTokens.AddRange(items)));
}
public MarkupTagHelperDirectiveAttributeSyntax AddNameSuffixLiteralTokens(params SyntaxToken[] items)
{
var _nameSuffix = this.NameSuffix ?? SyntaxFactory.MarkupTextLiteral();
return this.WithNameSuffix(_nameSuffix.WithLiteralTokens(_nameSuffix.LiteralTokens.AddRange(items)));
}
public MarkupTagHelperDirectiveAttributeSyntax AddValuePrefixLiteralTokens(params SyntaxToken[] items)
{
var _valuePrefix = this.ValuePrefix ?? SyntaxFactory.MarkupTextLiteral();
return this.WithValuePrefix(_valuePrefix.WithLiteralTokens(_valuePrefix.LiteralTokens.AddRange(items)));
}
public MarkupTagHelperDirectiveAttributeSyntax AddValueChildren(params RazorSyntaxNode[] items)
{
return this.WithValue(this.Value.WithChildren(this.Value.Children.AddRange(items)));
}
public MarkupTagHelperDirectiveAttributeSyntax AddValueSuffixLiteralTokens(params SyntaxToken[] items)
{
var _valueSuffix = this.ValueSuffix ?? SyntaxFactory.MarkupTextLiteral();
return this.WithValueSuffix(_valueSuffix.WithLiteralTokens(_valueSuffix.LiteralTokens.AddRange(items)));
}
}
internal sealed partial class MarkupMinimizedTagHelperDirectiveAttributeSyntax : MarkupSyntaxNode
{
private MarkupTextLiteralSyntax _namePrefix;
private RazorMetaCodeSyntax _transition;
private MarkupTextLiteralSyntax _name;
private RazorMetaCodeSyntax _colon;
private MarkupTextLiteralSyntax _parameterName;
internal MarkupMinimizedTagHelperDirectiveAttributeSyntax(GreenNode green, SyntaxNode parent, int position)
: base(green, parent, position)
{
}
public MarkupTextLiteralSyntax NamePrefix
{
get
{
return GetRedAtZero(ref _namePrefix);
}
}
public RazorMetaCodeSyntax Transition
{
get
{
return GetRed(ref _transition, 1);
}
}
public MarkupTextLiteralSyntax Name
{
get
{
return GetRed(ref _name, 2);
}
}
public RazorMetaCodeSyntax Colon
{
get
{
return GetRed(ref _colon, 3);
}
}
public MarkupTextLiteralSyntax ParameterName
{
get
{
return GetRed(ref _parameterName, 4);
}
}
internal override SyntaxNode GetNodeSlot(int index)
{
switch (index)
{
case 0: return GetRedAtZero(ref _namePrefix);
case 1: return GetRed(ref _transition, 1);
case 2: return GetRed(ref _name, 2);
case 3: return GetRed(ref _colon, 3);
case 4: return GetRed(ref _parameterName, 4);
default: return null;
}
}
internal override SyntaxNode GetCachedSlot(int index)
{
switch (index)
{
case 0: return _namePrefix;
case 1: return _transition;
case 2: return _name;
case 3: return _colon;
case 4: return _parameterName;
default: return null;
}
}
public override TResult Accept<TResult>(SyntaxVisitor<TResult> visitor)
{
return visitor.VisitMarkupMinimizedTagHelperDirectiveAttribute(this);
}
public override void Accept(SyntaxVisitor visitor)
{
visitor.VisitMarkupMinimizedTagHelperDirectiveAttribute(this);
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax Update(MarkupTextLiteralSyntax namePrefix, RazorMetaCodeSyntax transition, MarkupTextLiteralSyntax name, RazorMetaCodeSyntax colon, MarkupTextLiteralSyntax parameterName)
{
if (namePrefix != NamePrefix || transition != Transition || name != Name || colon != Colon || parameterName != ParameterName)
{
var newNode = SyntaxFactory.MarkupMinimizedTagHelperDirectiveAttribute(namePrefix, transition, name, colon, parameterName);
var diagnostics = GetDiagnostics();
if (diagnostics != null && diagnostics.Length > 0)
newNode = newNode.WithDiagnostics(diagnostics);
var annotations = GetAnnotations();
if (annotations != null && annotations.Length > 0)
return newNode.WithAnnotations(annotations);
return newNode;
}
return this;
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax WithNamePrefix(MarkupTextLiteralSyntax namePrefix)
{
return Update(namePrefix, Transition, Name, Colon, ParameterName);
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax WithTransition(RazorMetaCodeSyntax transition)
{
return Update(NamePrefix, transition, Name, Colon, ParameterName);
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax WithName(MarkupTextLiteralSyntax name)
{
return Update(NamePrefix, Transition, name, Colon, ParameterName);
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax WithColon(RazorMetaCodeSyntax colon)
{
return Update(NamePrefix, Transition, Name, colon, ParameterName);
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax WithParameterName(MarkupTextLiteralSyntax parameterName)
{
return Update(NamePrefix, Transition, Name, Colon, parameterName);
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax AddNamePrefixLiteralTokens(params SyntaxToken[] items)
{
var _namePrefix = this.NamePrefix ?? SyntaxFactory.MarkupTextLiteral();
return this.WithNamePrefix(_namePrefix.WithLiteralTokens(_namePrefix.LiteralTokens.AddRange(items)));
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax AddTransitionMetaCode(params SyntaxToken[] items)
{
return this.WithTransition(this.Transition.WithMetaCode(this.Transition.MetaCode.AddRange(items)));
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax AddNameLiteralTokens(params SyntaxToken[] items)
{
return this.WithName(this.Name.WithLiteralTokens(this.Name.LiteralTokens.AddRange(items)));
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax AddColonMetaCode(params SyntaxToken[] items)
{
var _colon = this.Colon ?? SyntaxFactory.RazorMetaCode();
return this.WithColon(_colon.WithMetaCode(_colon.MetaCode.AddRange(items)));
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax AddParameterNameLiteralTokens(params SyntaxToken[] items)
{
var _parameterName = this.ParameterName ?? SyntaxFactory.MarkupTextLiteral();
return this.WithParameterName(_parameterName.WithLiteralTokens(_parameterName.LiteralTokens.AddRange(items)));
}
}
internal abstract partial class CSharpSyntaxNode : RazorSyntaxNode internal abstract partial class CSharpSyntaxNode : RazorSyntaxNode
{ {
internal CSharpSyntaxNode(GreenNode green, SyntaxNode parent, int position) internal CSharpSyntaxNode(GreenNode green, SyntaxNode parent, int position)

View File

@ -0,0 +1,46 @@
// 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.Collections.Generic;
namespace Microsoft.AspNetCore.Razor.Language.Syntax
{
internal sealed partial class MarkupMinimizedTagHelperDirectiveAttributeSyntax
{
private static readonly string TagHelperAttributeInfoKey = typeof(TagHelperAttributeInfo).Name;
public TagHelperAttributeInfo TagHelperAttributeInfo
{
get
{
var tagHelperAttributeInfo = this.GetAnnotationValue(TagHelperAttributeInfoKey) as TagHelperAttributeInfo;
return tagHelperAttributeInfo;
}
}
public string FullName
{
get
{
var fullName = string.Concat(
Transition.GetContent(),
Name.GetContent(),
Colon?.GetContent() ?? string.Empty,
ParameterName?.GetContent() ?? string.Empty);
return fullName;
}
}
public MarkupMinimizedTagHelperDirectiveAttributeSyntax WithTagHelperAttributeInfo(TagHelperAttributeInfo info)
{
var annotations = new List<SyntaxAnnotation>(GetAnnotations())
{
new SyntaxAnnotation(TagHelperAttributeInfoKey, info)
};
var newGreen = Green.WithAnnotationsGreen(annotations.ToArray());
return (MarkupMinimizedTagHelperDirectiveAttributeSyntax)newGreen.CreateRed(Parent, Position);
}
}
}

View File

@ -0,0 +1,46 @@
// 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.Collections.Generic;
namespace Microsoft.AspNetCore.Razor.Language.Syntax
{
internal sealed partial class MarkupTagHelperDirectiveAttributeSyntax
{
private static readonly string TagHelperAttributeInfoKey = typeof(TagHelperAttributeInfo).Name;
public TagHelperAttributeInfo TagHelperAttributeInfo
{
get
{
var tagHelperAttributeInfo = this.GetAnnotationValue(TagHelperAttributeInfoKey) as TagHelperAttributeInfo;
return tagHelperAttributeInfo;
}
}
public string FullName
{
get
{
var fullName = string.Concat(
Transition.GetContent(),
Name.GetContent(),
Colon?.GetContent() ?? string.Empty,
ParameterName?.GetContent() ?? string.Empty);
return fullName;
}
}
public MarkupTagHelperDirectiveAttributeSyntax WithTagHelperAttributeInfo(TagHelperAttributeInfo info)
{
var annotations = new List<SyntaxAnnotation>(GetAnnotations())
{
new SyntaxAnnotation(TagHelperAttributeInfoKey, info)
};
var newGreen = Green.WithAnnotationsGreen(annotations.ToArray());
return (MarkupTagHelperDirectiveAttributeSyntax)newGreen.CreateRed(Parent, Position);
}
}
}

View File

@ -205,6 +205,29 @@
<Kind Name="MarkupTagHelperAttributeValue" /> <Kind Name="MarkupTagHelperAttributeValue" />
<Field Name="Children" Type="SyntaxList&lt;RazorSyntaxNode&gt;" Override="true" /> <Field Name="Children" Type="SyntaxList&lt;RazorSyntaxNode&gt;" Override="true" />
</Node> </Node>
<Node Name="MarkupTagHelperDirectiveAttributeSyntax" Base="MarkupSyntaxNode">
<Kind Name="MarkupTagHelperDirectiveAttribute" />
<Field Name="NamePrefix" Type="MarkupTextLiteralSyntax" Optional="true" />
<Field Name="Transition" Type="RazorMetaCodeSyntax" />
<Field Name="Name" Type="MarkupTextLiteralSyntax" />
<Field Name="Colon" Type="RazorMetaCodeSyntax" Optional="true" />
<Field Name="ParameterName" Type="MarkupTextLiteralSyntax" Optional="true" />
<Field Name="NameSuffix" Type="MarkupTextLiteralSyntax" Optional="true" />
<Field Name="EqualsToken" Type="SyntaxToken">
<Kind Name="Equals" />
</Field>
<Field Name="ValuePrefix" Type="MarkupTextLiteralSyntax" Optional="true" />
<Field Name="Value" Type="MarkupTagHelperAttributeValueSyntax" />
<Field Name="ValueSuffix" Type="MarkupTextLiteralSyntax" Optional="true" />
</Node>
<Node Name="MarkupMinimizedTagHelperDirectiveAttributeSyntax" Base="MarkupSyntaxNode">
<Kind Name="MarkupMinimizedTagHelperDirectiveAttribute" />
<Field Name="NamePrefix" Type="MarkupTextLiteralSyntax" Optional="true" />
<Field Name="Transition" Type="RazorMetaCodeSyntax" />
<Field Name="Name" Type="MarkupTextLiteralSyntax" />
<Field Name="Colon" Type="RazorMetaCodeSyntax" Optional="true" />
<Field Name="ParameterName" Type="MarkupTextLiteralSyntax" Optional="true" />
</Node>
<!-- CSharp --> <!-- CSharp -->
<AbstractNode Name="CSharpSyntaxNode" Base="RazorSyntaxNode" /> <AbstractNode Name="CSharpSyntaxNode" Base="RazorSyntaxNode" />

View File

@ -35,6 +35,8 @@ namespace Microsoft.AspNetCore.Razor.Language
MarkupTagHelperEndTag, MarkupTagHelperEndTag,
MarkupTagHelperAttribute, MarkupTagHelperAttribute,
MarkupMinimizedTagHelperAttribute, MarkupMinimizedTagHelperAttribute,
MarkupTagHelperDirectiveAttribute,
MarkupMinimizedTagHelperDirectiveAttribute,
MarkupTagHelperAttributeValue, MarkupTagHelperAttributeValue,
// CSharp // CSharp

View File

@ -7,18 +7,26 @@ namespace Microsoft.AspNetCore.Razor.Language
{ {
public TagHelperAttributeInfo( public TagHelperAttributeInfo(
string name, string name,
string parameterName,
AttributeStructure attributeStructure, AttributeStructure attributeStructure,
bool bound) bool bound,
bool isDirectiveAttribute)
{ {
Name = name; Name = name;
ParameterName = parameterName;
AttributeStructure = attributeStructure; AttributeStructure = attributeStructure;
Bound = bound; Bound = bound;
IsDirectiveAttribute = isDirectiveAttribute;
} }
public string Name { get; } public string Name { get; }
public string ParameterName { get; }
public AttributeStructure AttributeStructure { get; } public AttributeStructure AttributeStructure { get; }
public bool Bound { get; } public bool Bound { get; }
public bool IsDirectiveAttribute { get; }
} }
} }

View File

@ -32,7 +32,7 @@ namespace Test
// Act // Act
var result = CompileToCSharp(@" var result = CompileToCSharp(@"
<div bind-value=""@ParentValue"" /> <div @bind-value=""@ParentValue"" />
@functions { @functions {
public string ParentValue { get; set; } = ""hi""; public string ParentValue { get; set; } = ""hi"";
}"); }");
@ -41,7 +41,7 @@ namespace Test
var diagnostic = Assert.Single(result.Diagnostics); var diagnostic = Assert.Single(result.Diagnostics);
Assert.Equal("RZ9989", diagnostic.Id); Assert.Equal("RZ9989", diagnostic.Id);
Assert.Equal( Assert.Equal(
"The attribute 'bind-value' was matched by multiple bind attributes. Duplicates:" + Environment.NewLine + "The attribute '@bind-value' was matched by multiple bind attributes. Duplicates:" + Environment.NewLine +
"Test.BindAttributes" + Environment.NewLine + "Test.BindAttributes" + Environment.NewLine +
"Test.BindAttributes", "Test.BindAttributes",
diagnostic.GetMessage()); diagnostic.GetMessage());
@ -52,7 +52,7 @@ namespace Test
{ {
// Arrange & Act // Arrange & Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input type=""text"" bind-first-second-third=""Text"" /> <input type=""text"" @bind-first-second-third=""Text"" />
@functions { @functions {
public string Text { get; set; } = ""text""; public string Text { get; set; } = ""text"";
}"); }");
@ -67,7 +67,7 @@ namespace Test
{ {
// Arrange & Act // Arrange & Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input type=""text"" bind-first-=""Text"" /> <input type=""text"" @bind-first-=""Text"" />
@functions { @functions {
public string Text { get; set; } = ""text""; public string Text { get; set; } = ""text"";
}"); }");
@ -83,7 +83,7 @@ namespace Test
// We're looking for VS crash issues. Meaning if the parser returns // We're looking for VS crash issues. Meaning if the parser returns
// diagnostics we don't want to throw. // diagnostics we don't want to throw.
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input type=""text"" bind=""@page"" /> <input type=""text"" @bind=""@page"" />
@functions { @functions {
public string page { get; set; } = ""text""; public string page { get; set; } = ""text"";
}", throwOnFailure: false); }", throwOnFailure: false);

View File

@ -424,7 +424,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Value=""ParentValue"" /> <MyComponent @bind-Value=""ParentValue"" />
@code { @code {
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
}"); }");
@ -469,7 +469,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<InputText bind-Value=""person.Name"" /> <InputText @bind-Value=""person.Name"" />
@functions @functions
{ {
@ -504,7 +504,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Value=""ParentValue"" /> <MyComponent @bind-Value=""ParentValue"" />
@code { @code {
public string ParentValue { get; set; } = ""42""; public string ParentValue { get; set; } = ""42"";
}"); }");
@ -543,7 +543,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Value=""ParentValue"" /> <MyComponent @bind-Value=""ParentValue"" />
@code { @code {
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
}"); }");
@ -576,7 +576,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Value=""ParentValue"" /> <MyComponent @bind-Value=""ParentValue"" />
@code { @code {
public string ParentValue { get; set; } = ""42""; public string ParentValue { get; set; } = ""42"";
}"); }");
@ -613,7 +613,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Value=""ParentValue"" /> <MyComponent @bind-Value=""ParentValue"" />
@code { @code {
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
}"); }");
@ -645,7 +645,7 @@ namespace Test
}")); }"));
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Value=""ParentValue"" bind-Value:event=""OnChanged"" /> <MyComponent @bind-Value=""ParentValue"" @bind-Value:event=""OnChanged"" />
@code { @code {
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
}"); }");
@ -675,7 +675,7 @@ namespace Test
}")); }"));
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Value=""ParentValue"" bind-Value:event=""OnChanged"" /> <MyComponent @bind-Value=""ParentValue"" @bind-Value:event=""OnChanged"" />
@code { @code {
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
}"); }");
@ -712,7 +712,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Value=""ParentValue"" /> <MyComponent @bind-Value=""ParentValue"" />
@code { @code {
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
}"); }");
@ -749,7 +749,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Value=""ParentValue"" /> <MyComponent @bind-Value=""ParentValue"" />
@code { @code {
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
}"); }");
@ -786,7 +786,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Value=""ParentValue"" /> <MyComponent @bind-Value=""ParentValue"" />
@code { @code {
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
}"); }");
@ -825,7 +825,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-SomeParam=""ParentValue"" /> <MyComponent @bind-SomeParam=""ParentValue"" />
@code { @code {
public DateTime ParentValue { get; set; } = DateTime.Now; public DateTime ParentValue { get; set; } = DateTime.Now;
}"); }");
@ -862,7 +862,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-SomeParam=""ParentValue"" /> <MyComponent @bind-SomeParam=""ParentValue"" />
@code { @code {
public DateTime ParentValue { get; set; } = DateTime.Now; public DateTime ParentValue { get; set; } = DateTime.Now;
}"); }");
@ -891,7 +891,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<div bind=""@ParentValue"" /> <div @bind=""@ParentValue"" />
@code { @code {
public string ParentValue { get; set; } = ""hi""; public string ParentValue { get; set; } = ""hi"";
}"); }");
@ -919,7 +919,7 @@ namespace Test
}")); }"));
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<div bind-value=""ParentValue"" /> <div @bind-value=""ParentValue"" />
@code { @code {
public string ParentValue { get; set; } = ""hi""; public string ParentValue { get; set; } = ""hi"";
}"); }");
@ -947,7 +947,7 @@ namespace Test
}")); }"));
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<div bind-value=""@ParentValue"" /> <div @bind-value=""@ParentValue"" />
@code { @code {
public string ParentValue { get; set; } = ""hi""; public string ParentValue { get; set; } = ""hi"";
}"); }");
@ -965,7 +965,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input bind=""@ParentValue"" /> <input @bind=""@ParentValue"" />
@code { @code {
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
}"); }");
@ -983,7 +983,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input type=""text"" bind=""@CurrentDate"" bind:format=""MM/dd/yyyy""/> <input type=""text"" @bind=""@CurrentDate"" @bind:format=""MM/dd/yyyy""/>
@code { @code {
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
}"); }");
@ -1001,7 +1001,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input type=""text"" bind=""@CurrentDate"" bind:format=""@Format""/> <input type=""text"" @bind=""@CurrentDate"" @bind:format=""@Format""/>
@code { @code {
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
@ -1021,7 +1021,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input type=""text"" bind=""@ParentValue"" /> <input type=""text"" @bind=""@ParentValue"" />
@code { @code {
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
}"); }");
@ -1039,7 +1039,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input type=""checkbox"" bind=""@Enabled"" /> <input type=""checkbox"" @bind=""@Enabled"" />
@code { @code {
public bool Enabled { get; set; } public bool Enabled { get; set; }
}"); }");
@ -1057,7 +1057,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input type=""text"" bind-value=""@ParentValue"" bind-value:event=""onchange"" /> <input type=""text"" @bind-value=""@ParentValue"" @bind-value:event=""onchange"" />
@code { @code {
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
}"); }");
@ -1075,7 +1075,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input type=""text"" bind-value=""@CurrentDate"" bind-value:event=""onchange"" bind-value:format=""MM/dd"" /> <input type=""text"" @bind-value=""@CurrentDate"" @bind-value:event=""onchange"" @bind-value:format=""MM/dd"" />
@code { @code {
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
}"); }");
@ -2118,7 +2118,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<DynamicElement onclick=""@OnClick"" /> <DynamicElement @onclick=""@OnClick"" />
@code { @code {
private Action<UIMouseEventArgs> OnClick { get; set; } private Action<UIMouseEventArgs> OnClick { get; set; }
@ -2172,7 +2172,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input onclick=""foo"" />"); <input @onclick=""foo"" />");
// Assert // Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument); AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
@ -2187,7 +2187,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input onclick=""@(() => { })"" />"); <input @onclick=""@(() => { })"" />");
// Assert // Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument); AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
@ -2202,7 +2202,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input onclick=""@(x => { })"" />"); <input @onclick=""@(x => { })"" />");
// Assert // Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument); AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
@ -2217,7 +2217,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input onclick=""@OnClick"" /> <input @onclick=""@OnClick"" />
@code { @code {
void OnClick() { void OnClick() {
} }
@ -2236,7 +2236,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input onclick=""@OnClick"" /> <input @onclick=""@OnClick"" />
@code { @code {
void OnClick(UIMouseEventArgs e) { void OnClick(UIMouseEventArgs e) {
} }
@ -2255,7 +2255,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input onclick=""@OnClick"" /> <input @onclick=""@OnClick"" />
@code { @code {
void OnClick(UIEventArgs e) { void OnClick(UIEventArgs e) {
} }
@ -2275,7 +2275,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
@using System.Threading.Tasks @using System.Threading.Tasks
<input onclick=""@OnClick"" /> <input @onclick=""@OnClick"" />
@code { @code {
Task OnClick() Task OnClick()
{ {
@ -2297,7 +2297,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
@using System.Threading.Tasks @using System.Threading.Tasks
<input onclick=""@OnClick"" /> <input @onclick=""@OnClick"" />
@code { @code {
Task OnClick(UIMouseEventArgs e) Task OnClick(UIMouseEventArgs e)
{ {
@ -2319,7 +2319,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
@using System.Threading.Tasks @using System.Threading.Tasks
<input onclick=""@(async () => await Task.Delay(10))"" /> <input @onclick=""@(async () => await Task.Delay(10))"" />
"); ");
// Assert // Assert
@ -2336,7 +2336,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
@using System.Threading.Tasks @using System.Threading.Tasks
<input onclick=""@(async (e) => await Task.Delay(10))"" /> <input @onclick=""@(async (e) => await Task.Delay(10))"" />
"); ");
// Assert // Assert
@ -2352,7 +2352,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input onclick=""@(x => { })"" />"); <input @onclick=""@(x => { })"" />");
// Assert // Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument); AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
@ -2367,7 +2367,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input onclick=""@OnClick"" /> <input @onclick=""@OnClick"" />
@code { @code {
void OnClick(UIMouseEventArgs e) { void OnClick(UIMouseEventArgs e) {
} }
@ -2538,7 +2538,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent TItem=string bind-Item=Value/> <MyComponent TItem=string @bind-Item=Value/>
@code { @code {
string Value; string Value;
}"); }");
@ -2572,8 +2572,8 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Item=Value/> <MyComponent @bind-Item=Value/>
<MyComponent bind-Item=Value/> <MyComponent @bind-Item=Value/>
@code { @code {
string Value; string Value;
}"); }");
@ -2602,7 +2602,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent TItem=string bind-Item=Value/> <MyComponent TItem=string @bind-Item=Value/>
@code { @code {
string Value; string Value;
}"); }");
@ -2632,7 +2632,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Item=Value Value=@(18)/> <MyComponent @bind-Item=Value Value=@(18)/>
@code { @code {
string Value; string Value;
}"); }");
@ -2867,7 +2867,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent TItem=int Item=""3"" key=""_someKey"" /> <MyComponent TItem=int Item=""3"" @key=""_someKey"" />
@code { @code {
private object _someKey = new object(); private object _someKey = new object();
@ -2898,7 +2898,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent Item=""3"" key=""_someKey"" /> <MyComponent Item=""3"" @key=""_someKey"" />
@code { @code {
private object _someKey = new object(); private object _someKey = new object();
@ -2929,7 +2929,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent TItem=int Item=""3"" ref=""_my"" /> <MyComponent TItem=int Item=""3"" @ref=""_my"" />
@code { @code {
private MyComponent<int> _my; private MyComponent<int> _my;
@ -2961,7 +2961,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent Item=""3"" ref=""_my"" /> <MyComponent Item=""3"" @ref=""_my"" />
@code { @code {
private MyComponent<int> _my; private MyComponent<int> _my;
@ -3025,7 +3025,7 @@ namespace Test.Shared
{ {
// Arrange/Act // Arrange/Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<elem attributebefore=""before"" key=""someObject"" attributeafter=""after"">Hello</elem> <elem attributebefore=""before"" @key=""someObject"" attributeafter=""after"">Hello</elem>
@code { @code {
private object someObject = new object(); private object someObject = new object();
@ -3043,7 +3043,7 @@ namespace Test.Shared
{ {
// Arrange/Act // Arrange/Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input type=""text"" data-slider-min=""@Min"" key=""@someObject"" /> <input type=""text"" data-slider-min=""@Min"" @key=""@someObject"" />
@code { @code {
private object someObject = new object(); private object someObject = new object();
@ -3075,7 +3075,7 @@ namespace Test
// Arrange/Act // Arrange/Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent ParamBefore=""before"" key=""someDate.Day"" ParamAfter=""after"" /> <MyComponent ParamBefore=""before"" @key=""someDate.Day"" ParamAfter=""after"" />
@code { @code {
private DateTime someDate = DateTime.Now; private DateTime someDate = DateTime.Now;
@ -3105,7 +3105,7 @@ namespace Test
// Arrange/Act // Arrange/Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent key=""123 + 456"" SomeProp=""val""> <MyComponent @key=""123 + 456"" SomeProp=""val"">
Some <el>further</el> content Some <el>further</el> content
</MyComponent> </MyComponent>
"); ");
@ -3125,7 +3125,7 @@ namespace Test
{ {
// Arrange/Act // Arrange/Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<elem attributebefore=""before"" ref=""myElem"" attributeafter=""after"">Hello</elem> <elem attributebefore=""before"" @ref=""myElem"" attributeafter=""after"">Hello</elem>
@code { @code {
private Microsoft.AspNetCore.Components.ElementRef myElem; private Microsoft.AspNetCore.Components.ElementRef myElem;
@ -3144,7 +3144,7 @@ namespace Test
{ {
// Arrange/Act // Arrange/Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input type=""text"" data-slider-min=""@Min"" ref=""@_element"" /> <input type=""text"" data-slider-min=""@Min"" @ref=""@_element"" />
@code { @code {
private ElementRef _element; private ElementRef _element;
@ -3177,7 +3177,7 @@ namespace Test
// Arrange/Act // Arrange/Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent ParamBefore=""before"" ref=""myInstance"" ParamAfter=""after"" /> <MyComponent ParamBefore=""before"" @ref=""myInstance"" ParamAfter=""after"" />
@code { @code {
private Test.MyComponent myInstance; private Test.MyComponent myInstance;
@ -3208,7 +3208,7 @@ namespace Test
// Arrange/Act // Arrange/Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent ref=""myInstance"" SomeProp=""val""> <MyComponent @ref=""myInstance"" SomeProp=""val"">
Some <el>further</el> content Some <el>further</el> content
</MyComponent> </MyComponent>
@ -3816,8 +3816,6 @@ namespace New.Test
Assert.Same(ComponentDiagnosticFactory.DuplicateMarkupAttribute.Id, diagnostic.Id); Assert.Same(ComponentDiagnosticFactory.DuplicateMarkupAttribute.Id, diagnostic.Id);
} }
// Right now this is almost indistinguishable from the previous case, but when we add the @ for directive attributes
// it won't be. This is a placeholder to be updated when that change goes in.
[Fact] [Fact]
public void DuplicateMarkupAttributes_IsAnError_EventHandler() public void DuplicateMarkupAttributes_IsAnError_EventHandler()
{ {
@ -3826,7 +3824,7 @@ namespace New.Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<div> <div>
<a onclick=""test()"" onclick=""@(() => {})"">Learn the ten cool tricks your compiler author will hate!</a> <a @onclick=""test()"" onclick=""@(() => {})"">Learn the ten cool tricks your compiler author will hate!</a>
</div>"); </div>");
// Assert // Assert
@ -3866,7 +3864,7 @@ namespace New.Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<div> <div>
<input type=""text"" value=""17"" bind=""@text""></input> <input type=""text"" value=""17"" @bind=""@text""></input>
</div> </div>
@functions { @functions {
private string text = ""hi""; private string text = ""hi"";
@ -3890,7 +3888,7 @@ namespace New.Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<div> <div>
<input type=""text"" bind-value=""@text"" bind-value:event=""oninput"" oninput=""@(() => {})""></input> <input type=""text"" @bind-value=""@text"" @bind-value:event=""oninput"" @oninput=""@(() => {})""></input>
</div> </div>
@functions { @functions {
private string text = ""hi""; private string text = ""hi"";
@ -4015,7 +4013,7 @@ namespace Test
")); "));
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent Message=""@message"" bind-Message=""@message"" /> <MyComponent Message=""@message"" @bind-Message=""@message"" />
@functions { @functions {
string message = ""hi""; string message = ""hi"";
} }
@ -4050,7 +4048,7 @@ namespace Test
")); "));
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent MessageChanged=""@((s) => {})"" bind-Message=""@message"" /> <MyComponent MessageChanged=""@((s) => {})"" @bind-Message=""@message"" />
@functions { @functions {
string message = ""hi""; string message = ""hi"";
} }
@ -4085,7 +4083,7 @@ namespace Test
")); "));
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<MyComponent bind-Message=""@message"" MessageExpression=""@((s) => {})"" /> <MyComponent @bind-Message=""@message"" MessageExpression=""@((s) => {})"" />
@functions { @functions {
string message = ""hi""; string message = ""hi"";
} }
@ -4136,7 +4134,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<Counter bind-v=""y"" /> <Counter @bind-v=""y"" />
@code { @code {
string y = null; string y = null;
} }
@ -4170,7 +4168,7 @@ namespace Test
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<User bind-Name=""@UserName"" bind-IsActive=""@UserIsActive"" /> <User @bind-Name=""@UserName"" @bind-IsActive=""@UserIsActive"" />
@code { @code {
public string UserName { get; set; } public string UserName { get; set; }
@ -4262,7 +4260,7 @@ Welcome to your new app.
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<p onmouseover=""@OnComponentHover"" style=""background: @ParentBgColor;"" /> <p @onmouseover=""@OnComponentHover"" style=""background: @ParentBgColor;"" />
@code { @code {
public string ParentBgColor { get; set; } = ""#FFFFFF""; public string ParentBgColor { get; set; } = ""#FFFFFF"";
@ -4283,7 +4281,7 @@ Welcome to your new app.
{ {
// Act // Act
var generated = CompileToCSharp(@" var generated = CompileToCSharp(@"
<input onfocus='alert(""Test"");' /> <input @onfocus='alert(""Test"");' />
"); ");
// Assert // Assert

View File

@ -248,5 +248,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
{ {
ParseDocumentTest("@{<span data-foo=@foo ></span>}"); ParseDocumentTest("@{<span data-foo=@foo ></span>}");
} }
[Fact]
public void ComponentFileKind_ParsesDirectiveAttributesAsMarkup()
{
ParseDocumentTest("<span @class='@foo'></span>", fileKind: FileKinds.Component);
}
[Fact]
public void ComponentFileKind_ParsesDirectiveAttributesWithParameterAsMarkup()
{
ParseDocumentTest("<span @class:param='@foo'></span>", fileKind: FileKinds.Component);
}
} }
} }

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.Razor.Language.Components;
using Xunit; using Xunit;
namespace Microsoft.AspNetCore.Razor.Language.Legacy namespace Microsoft.AspNetCore.Razor.Language.Legacy
@ -2153,6 +2154,94 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
EvaluateData(descriptors, document, featureFlags: featureFlags); EvaluateData(descriptors, document, featureFlags: featureFlags);
} }
[Fact]
public void Rewrites_ComponentDirectiveAttributes()
{
// Arrange
var document = @"<input @bind-value=""Message"" @bind-value:event=""onchange"" />";
var descriptors = new TagHelperDescriptor[]
{
TagHelperDescriptorBuilder.Create(ComponentMetadata.Bind.TagHelperKind, "Bind", ComponentsApi.AssemblyName)
.AddMetadata(ComponentMetadata.SpecialKindKey, ComponentMetadata.Bind.TagHelperKind)
.AddMetadata(TagHelperMetadata.Common.ClassifyAttributesOnly, bool.TrueString)
.AddMetadata(TagHelperMetadata.Runtime.Name, ComponentMetadata.Bind.RuntimeName)
.TypeName("Microsoft.AspNetCore.Components.Bind")
.AddMetadata(ComponentMetadata.Bind.FallbackKey, bool.TrueString)
.TagMatchingRuleDescriptor(rule =>
rule
.RequireTagName("*")
.RequireAttributeDescriptor(r =>
{
r.Name = "@bind-";
r.NameComparisonMode = RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch;
r.Metadata.Add(ComponentMetadata.Common.DirectiveAttribute, bool.TrueString);
}))
.BoundAttributeDescriptor(attribute =>
attribute
.Name("@bind-...")
.PropertyName("Bind")
.AsDictionaryAttribute("@bind-", typeof(object).FullName)
.TypeName("System.Collections.Generic.Dictionary<string, object>")
.AddMetadata(ComponentMetadata.Common.DirectiveAttribute, bool.TrueString)
.BindAttributeParameter(p =>
{
p.Name = "event";
p.TypeName = typeof(string).FullName;
p.SetPropertyName("Event");
}))
.Build(),
};
var featureFlags = new TestRazorParserFeatureFlags(allowCSharpInMarkupAttributeArea: false);
// Act & Assert
EvaluateData(descriptors, document, featureFlags: featureFlags);
}
[Fact]
public void Rewrites_MinimizedComponentDirectiveAttributes()
{
// Arrange
var document = @"<input @bind-foo @bind-foo:param />";
var descriptors = new TagHelperDescriptor[]
{
TagHelperDescriptorBuilder.Create(ComponentMetadata.Bind.TagHelperKind, "Bind", ComponentsApi.AssemblyName)
.AddMetadata(ComponentMetadata.SpecialKindKey, ComponentMetadata.Bind.TagHelperKind)
.AddMetadata(TagHelperMetadata.Common.ClassifyAttributesOnly, bool.TrueString)
.AddMetadata(TagHelperMetadata.Runtime.Name, ComponentMetadata.Bind.RuntimeName)
.TypeName("Microsoft.AspNetCore.Components.Bind")
.AddMetadata(ComponentMetadata.Bind.FallbackKey, bool.TrueString)
.TagMatchingRuleDescriptor(rule =>
rule
.RequireTagName("*")
.RequireAttributeDescriptor(r =>
{
r.Name = "@bind-";
r.NameComparisonMode = RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch;
r.Metadata.Add(ComponentMetadata.Common.DirectiveAttribute, bool.TrueString);
}))
.BoundAttributeDescriptor(attribute =>
attribute
.Name("@bind-...")
.PropertyName("Bind")
.AsDictionaryAttribute("@bind-", typeof(object).FullName)
.TypeName("System.Collections.Generic.Dictionary<string, object>")
.AddMetadata(ComponentMetadata.Common.DirectiveAttribute, bool.TrueString)
.BindAttributeParameter(p =>
{
p.Name = "param";
p.TypeName = typeof(string).FullName;
p.SetPropertyName("Param");
}))
.Build(),
};
var featureFlags = new TestRazorParserFeatureFlags(allowCSharpInMarkupAttributeArea: false);
// Act & Assert
EvaluateData(descriptors, document, featureFlags: featureFlags);
}
private class TestRazorParserFeatureFlags : RazorParserFeatureFlags private class TestRazorParserFeatureFlags : RazorParserFeatureFlags
{ {
public TestRazorParserFeatureFlags( public TestRazorParserFeatureFlags(
@ -2161,7 +2250,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
bool allowComponentFileKind = false, bool allowComponentFileKind = false,
bool allowRazorInCodeBlockDirectives = false, bool allowRazorInCodeBlockDirectives = false,
bool allowUsingVariableDeclarations = false, bool allowUsingVariableDeclarations = false,
bool allowConditionalDataDashAttributesInComponents = false) bool allowConditionalDataDashAttributesInComponents = false,
bool allowCSharpInMarkupAttributeArea = true)
{ {
AllowMinimizedBooleanTagHelperAttributes = allowMinimizedBooleanTagHelperAttributes; AllowMinimizedBooleanTagHelperAttributes = allowMinimizedBooleanTagHelperAttributes;
AllowHtmlCommentsInTagHelpers = allowHtmlCommentsInTagHelper; AllowHtmlCommentsInTagHelpers = allowHtmlCommentsInTagHelper;
@ -2169,6 +2259,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
AllowRazorInAllCodeBlocks = allowRazorInCodeBlockDirectives; AllowRazorInAllCodeBlocks = allowRazorInCodeBlockDirectives;
AllowUsingVariableDeclarations = allowUsingVariableDeclarations; AllowUsingVariableDeclarations = allowUsingVariableDeclarations;
AllowConditionalDataDashAttributes = allowConditionalDataDashAttributesInComponents; AllowConditionalDataDashAttributes = allowConditionalDataDashAttributesInComponents;
AllowCSharpInMarkupAttributeArea = allowCSharpInMarkupAttributeArea;
} }
public override bool AllowMinimizedBooleanTagHelperAttributes { get; } public override bool AllowMinimizedBooleanTagHelperAttributes { get; }
@ -2182,6 +2273,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
public override bool AllowUsingVariableDeclarations { get; } public override bool AllowUsingVariableDeclarations { get; }
public override bool AllowConditionalDataDashAttributes { get; } public override bool AllowConditionalDataDashAttributes { get; }
public override bool AllowCSharpInMarkupAttributeArea { get; }
} }
} }
} }

View File

@ -29,7 +29,7 @@ using System.Threading.Tasks;
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore #nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" #line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
async (e) => await Task.Delay(10) async (e) => await Task.Delay(10)
#line default #line default
#line hidden #line hidden

View File

@ -16,11 +16,11 @@ Document -
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
MarkupElement - (31:1,0 [56] x:\dir\subdir\Test\TestComponent.cshtml) - input MarkupElement - (31:1,0 [57] x:\dir\subdir\Test\TestComponent.cshtml) - input
HtmlAttribute - (47:1,16 [36] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - " HtmlAttribute - (48:1,17 [36] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
IntermediateToken - (49:1,18 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - async (e) => await Task.Delay(10) IntermediateToken - (50:1,19 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - async (e) => await Task.Delay(10)
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
HtmlContent - (87:1,56 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (88:1,57 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (87:1,56 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (88:1,57 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n

View File

@ -3,8 +3,8 @@ Source Location: (1:0,1 [28] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (285:11,0 [28] ) Generated Location: (285:11,0 [28] )
|using System.Threading.Tasks| |using System.Threading.Tasks|
Source Location: (49:1,18 [33] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (50:1,19 [33] x:\dir\subdir\Test\TestComponent.cshtml)
|async (e) => await Task.Delay(10)| |async (e) => await Task.Delay(10)|
Generated Location: (1114:31,18 [33] ) Generated Location: (1115:31,19 [33] )
|async (e) => await Task.Delay(10)| |async (e) => await Task.Delay(10)|

View File

@ -29,7 +29,7 @@ using System.Threading.Tasks;
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore #nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" #line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
OnClick OnClick
#line default #line default
#line hidden #line hidden

View File

@ -16,13 +16,13 @@ Document -
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
MarkupElement - (31:1,0 [28] x:\dir\subdir\Test\TestComponent.cshtml) - input MarkupElement - (31:1,0 [29] x:\dir\subdir\Test\TestComponent.cshtml) - input
HtmlAttribute - (47:1,16 [8] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - " HtmlAttribute - (48:1,17 [8] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
IntermediateToken - (48:1,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - OnClick IntermediateToken - (49:1,18 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - OnClick
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
HtmlContent - (59:1,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (60:1,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (59:1,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (60:1,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (68:2,7 [91] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (69:2,7 [91] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (68:2,7 [91] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n Task OnClick(UIMouseEventArgs e) \n {\n return Task.CompletedTask;\n }\n IntermediateToken - (69:2,7 [91] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n Task OnClick(UIMouseEventArgs e) \n {\n return Task.CompletedTask;\n }\n

View File

@ -3,19 +3,19 @@ Source Location: (1:0,1 [28] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (285:11,0 [28] ) Generated Location: (285:11,0 [28] )
|using System.Threading.Tasks| |using System.Threading.Tasks|
Source Location: (48:1,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (49:1,18 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|OnClick| |OnClick|
Generated Location: (1113:31,17 [7] ) Generated Location: (1114:31,18 [7] )
|OnClick| |OnClick|
Source Location: (68:2,7 [91] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (69:2,7 [91] x:\dir\subdir\Test\TestComponent.cshtml)
| |
Task OnClick(UIMouseEventArgs e) Task OnClick(UIMouseEventArgs e)
{ {
return Task.CompletedTask; return Task.CompletedTask;
} }
| |
Generated Location: (1314:41,7 [91] ) Generated Location: (1315:41,7 [91] )
| |
Task OnClick(UIMouseEventArgs e) Task OnClick(UIMouseEventArgs e)
{ {

View File

@ -29,7 +29,7 @@ using System.Threading.Tasks;
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore #nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" #line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
async () => await Task.Delay(10) async () => await Task.Delay(10)
#line default #line default
#line hidden #line hidden

View File

@ -16,11 +16,11 @@ Document -
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
MarkupElement - (31:1,0 [55] x:\dir\subdir\Test\TestComponent.cshtml) - input MarkupElement - (31:1,0 [56] x:\dir\subdir\Test\TestComponent.cshtml) - input
HtmlAttribute - (47:1,16 [35] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - " HtmlAttribute - (48:1,17 [35] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
IntermediateToken - (49:1,18 [32] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - async () => await Task.Delay(10) IntermediateToken - (50:1,19 [32] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - async () => await Task.Delay(10)
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
HtmlContent - (86:1,55 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (87:1,56 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (86:1,55 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (87:1,56 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n

View File

@ -3,8 +3,8 @@ Source Location: (1:0,1 [28] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (285:11,0 [28] ) Generated Location: (285:11,0 [28] )
|using System.Threading.Tasks| |using System.Threading.Tasks|
Source Location: (49:1,18 [32] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (50:1,19 [32] x:\dir\subdir\Test\TestComponent.cshtml)
|async () => await Task.Delay(10)| |async () => await Task.Delay(10)|
Generated Location: (1114:31,18 [32] ) Generated Location: (1115:31,19 [32] )
|async () => await Task.Delay(10)| |async () => await Task.Delay(10)|

View File

@ -29,7 +29,7 @@ using System.Threading.Tasks;
__o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, __o = Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
#nullable restore #nullable restore
#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" #line 2 "x:\dir\subdir\Test\TestComponent.cshtml"
OnClick OnClick
#line default #line default
#line hidden #line hidden

View File

@ -16,13 +16,13 @@ Document -
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (29:0,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
MarkupElement - (31:1,0 [28] x:\dir\subdir\Test\TestComponent.cshtml) - input MarkupElement - (31:1,0 [29] x:\dir\subdir\Test\TestComponent.cshtml) - input
HtmlAttribute - (47:1,16 [8] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - " HtmlAttribute - (48:1,17 [8] x:\dir\subdir\Test\TestComponent.cshtml) - onclick=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this, IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.UIMouseEventArgs>(this,
IntermediateToken - (48:1,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - OnClick IntermediateToken - (49:1,18 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - OnClick
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
HtmlContent - (59:1,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (60:1,29 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (59:1,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (60:1,29 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (68:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (69:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (68:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n Task OnClick() \n {\n return Task.CompletedTask;\n }\n IntermediateToken - (69:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n Task OnClick() \n {\n return Task.CompletedTask;\n }\n

View File

@ -3,19 +3,19 @@ Source Location: (1:0,1 [28] x:\dir\subdir\Test\TestComponent.cshtml)
Generated Location: (285:11,0 [28] ) Generated Location: (285:11,0 [28] )
|using System.Threading.Tasks| |using System.Threading.Tasks|
Source Location: (48:1,17 [7] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (49:1,18 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|OnClick| |OnClick|
Generated Location: (1113:31,17 [7] ) Generated Location: (1114:31,18 [7] )
|OnClick| |OnClick|
Source Location: (68:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (69:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml)
| |
Task OnClick() Task OnClick()
{ {
return Task.CompletedTask; return Task.CompletedTask;
} }
| |
Generated Location: (1314:41,7 [73] ) Generated Location: (1315:41,7 [73] )
| |
Task OnClick() Task OnClick()
{ {

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,19 +14,19 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [40] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent Component - (0:0,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue) IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueExpression - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueExpression - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - () => ParentValue IntermediateToken - - CSharp - () => ParentValue
HtmlContent - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n IntermediateToken - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n

View File

@ -1,13 +1,13 @@
Source Location: (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (1012:25,25 [11] ) Generated Location: (1013:25,26 [11] )
|ParentValue| |ParentValue|
Source Location: (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (2033:48,7 [50] ) Generated Location: (2034:48,7 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -23,7 +23,7 @@ namespace Test
__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, -1, -1, Microsoft.AspNetCore.Components.BindMethods.GetValue( __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, -1, -1, Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,22 +14,22 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [44] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent Component - (0:0,0 [45] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (29:0,29 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParam - AttributeStructure.DoubleQuotes ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParam - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (29:0,29 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (29:0,29 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue) IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)
ComponentAttribute - (29:0,29 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamExpression - AttributeStructure.DoubleQuotes ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamExpression - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - () => ParentValue IntermediateToken - - CSharp - () => ParentValue
HtmlContent - (44:0,44 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (45:0,45 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (44:0,44 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (45:0,45 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (53:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (54:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (53:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime ParentValue { get; set; } = DateTime.Now;\n IntermediateToken - (54:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime ParentValue { get; set; } = DateTime.Now;\n
NamespaceDeclaration - - __Blazor.Test.TestComponent NamespaceDeclaration - - __Blazor.Test.TestComponent
ClassDeclaration - - internal static - TypeInference - - ClassDeclaration - - internal static - TypeInference - -
ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0

View File

@ -1,13 +1,13 @@
Source Location: (29:0,29 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (1018:25,29 [11] ) Generated Location: (1019:25,30 [11] )
|ParentValue| |ParentValue|
Source Location: (53:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (54:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public DateTime ParentValue { get; set; } = DateTime.Now; public DateTime ParentValue { get; set; } = DateTime.Now;
| |
Generated Location: (1606:43,7 [65] ) Generated Location: (1607:43,7 [65] )
| |
public DateTime ParentValue { get; set; } = DateTime.Now; public DateTime ParentValue { get; set; } = DateTime.Now;
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,16 +14,16 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [40] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent Component - (0:0,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue) IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)
HtmlContent - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n IntermediateToken - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n

View File

@ -1,13 +1,13 @@
Source Location: (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (1012:25,25 [11] ) Generated Location: (1013:25,26 [11] )
|ParentValue| |ParentValue|
Source Location: (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1874:47,7 [50] ) Generated Location: (1875:47,7 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,16 +14,16 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [40] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent Component - (0:0,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue) IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateInferred(this, __value => ParentValue = __value, ParentValue)
HtmlContent - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (49:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (49:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "42";\n IntermediateToken - (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "42";\n

View File

@ -1,13 +1,13 @@
Source Location: (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (1012:25,25 [11] ) Generated Location: (1013:25,26 [11] )
|ParentValue| |ParentValue|
Source Location: (49:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public string ParentValue { get; set; } = "42"; public string ParentValue { get; set; } = "42";
| |
Generated Location: (1874:47,7 [55] ) Generated Location: (1875:47,7 [55] )
| |
public string ParentValue { get; set; } = "42"; public string ParentValue { get; set; } = "42";
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,16 +14,16 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [69] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent Component - (0:0,0 [71] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - OnChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - OnChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - __value => ParentValue = __value IntermediateToken - - CSharp - __value => ParentValue = __value
HtmlContent - (69:0,69 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (71:0,71 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (69:0,69 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (71:0,71 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (78:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (78:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n IntermediateToken - (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n

View File

@ -1,13 +1,13 @@
Source Location: (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (1012:25,25 [11] ) Generated Location: (1013:25,26 [11] )
|ParentValue| |ParentValue|
Source Location: (78:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1617:47,7 [50] ) Generated Location: (1618:47,7 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,16 +14,16 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [69] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent Component - (0:0,0 [71] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - OnChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - OnChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue) IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)
HtmlContent - (69:0,69 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (71:0,71 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (69:0,69 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (71:0,71 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (78:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (78:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n IntermediateToken - (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n

View File

@ -1,13 +1,13 @@
Source Location: (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (941:25,25 [11] ) Generated Location: (942:25,26 [11] )
|ParentValue| |ParentValue|
Source Location: (78:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1585:46,7 [50] ) Generated Location: (1586:46,7 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,19 +14,19 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [40] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent Component - (0:0,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - __value => ParentValue = __value IntermediateToken - - CSharp - __value => ParentValue = __value
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueExpression - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueExpression - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - () => ParentValue IntermediateToken - - CSharp - () => ParentValue
HtmlContent - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n IntermediateToken - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n

View File

@ -1,13 +1,13 @@
Source Location: (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (1012:25,25 [11] ) Generated Location: (1013:25,26 [11] )
|ParentValue| |ParentValue|
Source Location: (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1776:48,7 [50] ) Generated Location: (1777:48,7 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -23,7 +23,7 @@ namespace Test
__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, -1, -1, Microsoft.AspNetCore.Components.BindMethods.GetValue( __Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(builder, -1, -1, Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,22 +14,22 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [44] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent Component - (0:0,0 [45] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (29:0,29 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParam - AttributeStructure.DoubleQuotes ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParam - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (29:0,29 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (29:0,29 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - __value => ParentValue = __value IntermediateToken - - CSharp - __value => ParentValue = __value
ComponentAttribute - (29:0,29 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamExpression - AttributeStructure.DoubleQuotes ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamExpression - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - () => ParentValue IntermediateToken - - CSharp - () => ParentValue
HtmlContent - (44:0,44 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (45:0,45 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (44:0,44 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (45:0,45 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (53:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (54:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (53:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime ParentValue { get; set; } = DateTime.Now;\n IntermediateToken - (54:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime ParentValue { get; set; } = DateTime.Now;\n
NamespaceDeclaration - - __Blazor.Test.TestComponent NamespaceDeclaration - - __Blazor.Test.TestComponent
ClassDeclaration - - internal static - TypeInference - - ClassDeclaration - - internal static - TypeInference - -
ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0

View File

@ -1,13 +1,13 @@
Source Location: (29:0,29 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (1018:25,29 [11] ) Generated Location: (1019:25,30 [11] )
|ParentValue| |ParentValue|
Source Location: (53:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (54:1,7 [65] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public DateTime ParentValue { get; set; } = DateTime.Now; public DateTime ParentValue { get; set; } = DateTime.Now;
| |
Generated Location: (1449:43,7 [65] ) Generated Location: (1450:43,7 [65] )
| |
public DateTime ParentValue { get; set; } = DateTime.Now; public DateTime ParentValue { get; set; } = DateTime.Now;
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,16 +14,16 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [40] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent Component - (0:0,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - __value => ParentValue = __value IntermediateToken - - CSharp - __value => ParentValue = __value
HtmlContent - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n IntermediateToken - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n

View File

@ -1,13 +1,13 @@
Source Location: (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (1012:25,25 [11] ) Generated Location: (1013:25,26 [11] )
|ParentValue| |ParentValue|
Source Location: (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1617:47,7 [50] ) Generated Location: (1618:47,7 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,16 +14,16 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [40] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent Component - (0:0,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue) IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)
HtmlContent - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n IntermediateToken - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n

View File

@ -1,13 +1,13 @@
Source Location: (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (941:25,25 [11] ) Generated Location: (942:25,26 [11] )
|ParentValue| |ParentValue|
Source Location: (49:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1585:46,7 [50] ) Generated Location: (1586:46,7 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.Int32>(Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,16 +14,16 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [40] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent Component - (0:0,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - __value => ParentValue = __value IntermediateToken - - CSharp - __value => ParentValue = __value
HtmlContent - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (40:0,40 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (49:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (49:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "42";\n IntermediateToken - (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "42";\n

View File

@ -1,13 +1,13 @@
Source Location: (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (1012:25,25 [11] ) Generated Location: (1013:25,26 [11] )
|ParentValue| |ParentValue|
Source Location: (49:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public string ParentValue { get; set; } = "42"; public string ParentValue { get; set; } = "42";
| |
Generated Location: (1617:47,7 [55] ) Generated Location: (1618:47,7 [55] )
| |
public string ParentValue { get; set; } = "42"; public string ParentValue { get; set; } = "42";
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.String>(Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.String>(Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
person.Name person.Name
#line default #line default
#line hidden #line hidden

View File

@ -14,16 +14,16 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
Component - (0:0,0 [38] x:\dir\subdir\Test\TestComponent.cshtml) - InputText Component - (0:0,0 [39] x:\dir\subdir\Test\TestComponent.cshtml) - InputText
ComponentAttribute - (23:0,23 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes ComponentAttribute - (24:0,24 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (23:0,23 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name IntermediateToken - (24:0,24 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - person.Name
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
ComponentAttribute - (23:0,23 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes ComponentAttribute - (24:0,24 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - AttributeStructure.DoubleQuotes
CSharpExpression - CSharpExpression -
IntermediateToken - - CSharp - __value => person.Name = __value IntermediateToken - - CSharp - __value => person.Name = __value
HtmlContent - (38:0,38 [4] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (39:0,39 [4] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (38:0,38 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n IntermediateToken - (39:0,39 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n
CSharpCode - (56:3,1 [37] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (57:3,1 [37] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (56:3,1 [37] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n Person person = new Person();\n IntermediateToken - (57:3,1 [37] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n Person person = new Person();\n

View File

@ -1,13 +1,13 @@
Source Location: (23:0,23 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (24:0,24 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|person.Name| |person.Name|
Generated Location: (1011:25,23 [11] ) Generated Location: (1012:25,24 [11] )
|person.Name| |person.Name|
Source Location: (56:3,1 [37] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (57:3,1 [37] x:\dir\subdir\Test\TestComponent.cshtml)
| |
Person person = new Person(); Person person = new Person();
| |
Generated Location: (1609:47,1 [37] ) Generated Location: (1610:47,1 [37] )
| |
Person person = new Person(); Person person = new Person();
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
CurrentDate CurrentDate
#line default #line default
#line hidden #line hidden

View File

@ -14,21 +14,21 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [101] x:\dir\subdir\Test\TestComponent.cshtml) - input MarkupElement - (0:0,0 [104] x:\dir\subdir\Test\TestComponent.cshtml) - input
HtmlAttribute - - type=" - " HtmlAttribute - - type=" - "
HtmlAttributeValue - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml) - HtmlAttributeValue - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - text IntermediateToken - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - text
HtmlAttribute - (31:0,31 [12] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - " HtmlAttribute - (32:0,32 [12] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (32:0,32 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CurrentDate IntermediateToken - (33:0,33 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CurrentDate
IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ,
IntermediateToken - - CSharp - "MM/dd" IntermediateToken - - CSharp - "MM/dd"
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
HtmlAttribute - (31:0,31 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " HtmlAttribute - (32:0,32 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd") IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, "MM/dd")
HtmlContent - (101:0,101 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (104:0,104 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (101:0,101 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (104:0,104 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (110:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (113:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (110:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);\n IntermediateToken - (113:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);\n

View File

@ -1,13 +1,13 @@
Source Location: (32:0,32 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (33:0,33 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|CurrentDate| |CurrentDate|
Generated Location: (948:25,32 [11] ) Generated Location: (949:25,33 [11] )
|CurrentDate| |CurrentDate|
Source Location: (110:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (113:1,7 [77] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
| |
Generated Location: (1311:36,7 [77] ) Generated Location: (1312:36,7 [77] )
| |
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,19 +14,19 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - input MarkupElement - (0:0,0 [77] x:\dir\subdir\Test\TestComponent.cshtml) - input
HtmlAttribute - - type=" - " HtmlAttribute - - type=" - "
HtmlAttributeValue - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml) - HtmlAttributeValue - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml) -
IntermediateToken - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - text IntermediateToken - (13:0,13 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - text
HtmlAttribute - (31:0,31 [12] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - " HtmlAttribute - (32:0,32 [12] x:\dir\subdir\Test\TestComponent.cshtml) - value=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (32:0,32 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (33:0,33 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
HtmlAttribute - (31:0,31 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " HtmlAttribute - (32:0,32 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue) IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)
HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (86:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n IntermediateToken - (86:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n

View File

@ -1,13 +1,13 @@
Source Location: (32:0,32 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (33:0,33 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (948:25,32 [11] ) Generated Location: (949:25,33 [11] )
|ParentValue| |ParentValue|
Source Location: (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (86:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |
Generated Location: (1293:36,7 [50] ) Generated Location: (1294:36,7 [50] )
| |
public int ParentValue { get; set; } = 42; public int ParentValue { get; set; } = 42;
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,16 +14,16 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [33] x:\dir\subdir\Test\TestComponent.cshtml) - div MarkupElement - (0:0,0 [34] x:\dir\subdir\Test\TestComponent.cshtml) - div
HtmlAttribute - (17:0,17 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (18:0,18 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (19:0,19 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
HtmlAttribute - (17:0,17 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue) IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)
HtmlContent - (33:0,33 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (34:0,34 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (33:0,33 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (34:0,34 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (42:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (43:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (42:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n IntermediateToken - (43:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n

View File

@ -1,13 +1,13 @@
Source Location: (18:0,18 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (19:0,19 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (934:25,18 [11] ) Generated Location: (935:25,19 [11] )
|ParentValue| |ParentValue|
Source Location: (42:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (43:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |
Generated Location: (1279:36,7 [55] ) Generated Location: (1280:36,7 [55] )
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,16 +14,16 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [32] x:\dir\subdir\Test\TestComponent.cshtml) - div MarkupElement - (0:0,0 [33] x:\dir\subdir\Test\TestComponent.cshtml) - div
HtmlAttribute - (17:0,17 [11] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " HtmlAttribute - (18:0,18 [11] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (17:0,17 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (18:0,18 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
HtmlAttribute - (17:0,17 [11] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " HtmlAttribute - (18:0,18 [11] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue) IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)
HtmlContent - (32:0,32 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (33:0,33 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (32:0,32 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (33:0,33 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (41:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (42:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (41:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n IntermediateToken - (42:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n

View File

@ -1,13 +1,13 @@
Source Location: (17:0,17 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (18:0,18 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (933:25,17 [11] ) Generated Location: (934:25,18 [11] )
|ParentValue| |ParentValue|
Source Location: (41:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (42:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |
Generated Location: (1278:36,7 [55] ) Generated Location: (1279:36,7 [55] )
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |

View File

@ -23,7 +23,7 @@ namespace Test
__o = Microsoft.AspNetCore.Components.BindMethods.GetValue( __o = Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore #nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" #line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
ParentValue ParentValue
#line default #line default
#line hidden #line hidden

View File

@ -14,16 +14,16 @@ Document -
CSharpCode - CSharpCode -
IntermediateToken - - CSharp - #pragma warning restore 0414 IntermediateToken - - CSharp - #pragma warning restore 0414
MethodDeclaration - - protected override - void - BuildRenderTree MethodDeclaration - - protected override - void - BuildRenderTree
MarkupElement - (0:0,0 [27] x:\dir\subdir\Test\TestComponent.cshtml) - div MarkupElement - (0:0,0 [28] x:\dir\subdir\Test\TestComponent.cshtml) - div
HtmlAttribute - (11:0,11 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue( IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.BindMethods.GetValue(
IntermediateToken - (12:0,12 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue IntermediateToken - (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue
IntermediateToken - - CSharp - ) IntermediateToken - - CSharp - )
HtmlAttribute - (11:0,11 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - "
CSharpExpressionAttributeValue - - CSharpExpressionAttributeValue - -
IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue) IntermediateToken - - CSharp - Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)
HtmlContent - (27:0,27 [2] x:\dir\subdir\Test\TestComponent.cshtml) HtmlContent - (28:0,28 [2] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (27:0,27 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n IntermediateToken - (28:0,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
CSharpCode - (36:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) CSharpCode - (37:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
IntermediateToken - (36:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n IntermediateToken - (37:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n

View File

@ -1,13 +1,13 @@
Source Location: (12:0,12 [11] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|ParentValue| |ParentValue|
Generated Location: (928:25,12 [11] ) Generated Location: (929:25,13 [11] )
|ParentValue| |ParentValue|
Source Location: (36:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) Source Location: (37:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |
Generated Location: (1273:36,7 [55] ) Generated Location: (1274:36,7 [55] )
| |
public string ParentValue { get; set; } = "hi"; public string ParentValue { get; set; } = "hi";
| |

Some files were not shown because too many files have changed in this diff Show More