diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/BoundAttributeDescriptorBuilderExtensions.cs b/src/Microsoft.AspNetCore.Razor.Language/src/BoundAttributeDescriptorBuilderExtensions.cs index 658811eaa..a4efdd39d 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/BoundAttributeDescriptorBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/BoundAttributeDescriptorBuilderExtensions.cs @@ -82,6 +82,16 @@ public static void SetPropertyName(this BoundAttributeParameterDescriptorBuilder builder.Metadata[TagHelperMetadata.Common.PropertyName] = propertyName; } + public static void SetBindAttributeGetSet(this BoundAttributeParameterDescriptorBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + builder.Metadata[ComponentMetadata.Bind.BindAttributeGetSet] = bool.TrueString; + } + public static string GetPropertyName(this BoundAttributeParameterDescriptorBuilder builder) { if (builder == null) diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/ComponentResources.resx b/src/Microsoft.AspNetCore.Razor.Language/src/ComponentResources.resx index 86084bc5b..3046d987f 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/ComponentResources.resx +++ b/src/Microsoft.AspNetCore.Razor.Language/src/ComponentResources.resx @@ -129,6 +129,9 @@ Binds the provided expression to the '{0}' property and a change event delegate to the '{1}' property of the component. + + Specifies an action to run after the new value has been set. + Specifies the culture to use for conversions. @@ -141,6 +144,12 @@ Specifies a format to convert the value specified by the '{0}' attribute. The format string can currently only be used with expressions of type <code>DateTime</code>. + + Specifies the expression to use for binding the value to the attribute. + + + Specifies the expression to use for updating the bound value when a new value is available. + Binds the provided expression to an attribute and a change event, based on the naming of the bind attribute. For example: <code>@bind-value="..."</code> and <code>@bind-value:event="onchange"</code> 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. diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentBindLoweringPass.cs b/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentBindLoweringPass.cs index fd8060b77..3084c5cb1 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentBindLoweringPass.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentBindLoweringPass.cs @@ -14,6 +14,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Components; internal class ComponentBindLoweringPass : ComponentIntermediateNodePassBase, IRazorOptimizationPass { + private readonly bool _bindGetSetSupported; + + public ComponentBindLoweringPass(bool bindGetSetSupported) + { + _bindGetSetSupported = bindGetSetSupported; + } + // Run after event handler pass public override int Order => 100; @@ -74,6 +81,41 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte } } + // Do a pass to look for (@bind:get, @bind:set) pairs as this alternative form might have been used + // to define the binding. + for (var i = 0; i < parameterReferences.Count; i++) + { + var reference = parameterReferences[i]; + var parent = reference.Parent; + var node = (TagHelperDirectiveAttributeParameterIntermediateNode)reference.Node; + + if (!parent.Children.Contains(node)) + { + // This node was removed as a duplicate, skip it. + continue; + } + + if (node.BoundAttributeParameter.Metadata.ContainsKey(ComponentMetadata.Bind.BindAttributeGetSet)) + { + if (!_bindGetSetSupported) + { + node.Diagnostics.Add(ComponentDiagnosticFactory.CreateBindAttributeParameter_UnsupportedSyntaxBindGetSet( + node.Source, + node.AttributeName)); + } + if (!bindEntries.TryGetValue((reference.Parent, node.AttributeNameWithoutParameter), out var existingEntry)) + { + bindEntries[(reference.Parent, node.AttributeNameWithoutParameter)] = new BindEntry(reference); + } + else + { + existingEntry.BindNode.Diagnostics.Add(ComponentDiagnosticFactory.CreateBindAttributeParameter_InvalidSyntaxBindAndBindGet( + node.Source, + existingEntry.BindNode.AttributeName)); + } + } + } + // 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++) { @@ -92,10 +134,20 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte // Check if this tag contains a corresponding non-parameterized bind node. if (!bindEntries.TryGetValue((parent, node.AttributeNameWithoutParameter), out var entry)) { - // There is no corresponding bind node. Add a diagnostic and move on. - parameterReference.Parent.Diagnostics.Add(ComponentDiagnosticFactory.CreateBindAttributeParameter_MissingBind( - node.Source, - node.AttributeName)); + if (node.BoundAttributeParameter.Name != "set") + { + // There is no corresponding bind node. Add a diagnostic and move on. + parameterReference.Parent.Diagnostics.Add(ComponentDiagnosticFactory.CreateBindAttributeParameter_MissingBind( + node.Source, + node.AttributeName)); + } + else + { + // There is no corresponding bind node. Add a diagnostic and move on. + parameterReference.Parent.Diagnostics.Add(ComponentDiagnosticFactory.CreateBindAttributeParameter_MissingBindGet( + node.Source, + node.AttributeNameWithoutParameter)); + } } else if (node.BoundAttributeParameter.Name == "event") { @@ -109,6 +161,25 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte { entry.BindCultureNode = node; } + else if (node.BoundAttributeParameter.Name == "after") + { + entry.BindAfterNode = node; + } + else if (node.BoundAttributeParameter.Name == "get") + { + // Avoid removing the reference since it will be processed later on. + continue; + } + else if (node.BoundAttributeParameter.Name == "set") + { + if (entry.BindNode != null) + { + parameterReference.Parent.Diagnostics.Add(ComponentDiagnosticFactory.CreateBindAttributeParameter_UseBindGet( + node.Source, + node.BoundAttribute.Name)); + } + entry.BindSetNode = node; + } else { // Unsupported bind attribute parameter. This can only happen if bound attribute descriptor @@ -124,6 +195,13 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte foreach (var entry in bindEntries) { var reference = entry.Value.BindNodeReference; + if (entry.Value.BindSetNode != null && entry.Value.BindAfterNode != null) + { + var afterNode = entry.Value.BindAfterNode; + entry.Key.Item1.Diagnostics.Add(ComponentDiagnosticFactory.CreateBindAttributeParameter_InvalidSyntaxBindSetAfter( + afterNode.Source, + afterNode.AttributeNameWithoutParameter)); + } var rewritten = RewriteUsage(reference.Parent, entry.Value); reference.Remove(); @@ -272,6 +350,7 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE // multiple passes handle 'special' tag helpers. We have another pass that translates // a tag helper node back into 'regular' element when it doesn't have an associated component var node = bindEntry.BindNode; + var getNode = bindEntry.BindGetNode; if (!TryComputeAttributeNames( parent, bindEntry, @@ -285,18 +364,29 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE { // Skip anything we can't understand. It's important that we don't crash, that will bring down // the build. - node.Diagnostics.Add(ComponentDiagnosticFactory.CreateBindAttribute_InvalidSyntax( - node.Source, - node.AttributeName)); - return new[] { node }; + if (node != null) + { + node.Diagnostics.Add(ComponentDiagnosticFactory.CreateBindAttribute_InvalidSyntax( + node.Source, + node.AttributeName)); + return new[] { node }; + } + else + { + getNode.Diagnostics.Add(ComponentDiagnosticFactory.CreateBindAttribute_MissingBindSet( + getNode.Source, + getNode.AttributeName, + $"{getNode.AttributeNameWithoutParameter}:set")); + return new[] { getNode }; + } } - var original = GetAttributeContent(node); + var original = GetAttributeContent(bindEntry.GetEffectiveBindNode()); if (string.IsNullOrEmpty(original.Content)) { // This can happen in error cases, the parser will already have flagged this // as an error, so ignore it. - return new[] { node }; + return new[] { bindEntry.GetEffectiveBindNode() }; } // Look for a format. If we find one then we need to pass the format into the @@ -306,13 +396,13 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE { format = GetAttributeContent(bindEntry.BindFormatNode); } - else if (node.TagHelper?.GetFormat() != null) + else if (bindEntry.GetEffectiveNodeTagHelperDescriptor()?.GetFormat() != null) { // We may have a default format if one is associated with the field type. format = new IntermediateToken() { Kind = TokenKind.CSharp, - Content = "\"" + node.TagHelper.GetFormat() + "\"", + Content = "\"" + bindEntry.GetEffectiveNodeTagHelperDescriptor().GetFormat() + "\"", }; } @@ -323,7 +413,7 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE { culture = GetAttributeContent(bindEntry.BindCultureNode); } - else if (node.TagHelper?.IsInvariantCultureBindTagHelper() == true) + else if (bindEntry.GetEffectiveNodeTagHelperDescriptor()?.IsInvariantCultureBindTagHelper() == true) { // We may have a default invariant culture if one is associated with the field type. culture = new IntermediateToken() @@ -333,6 +423,20 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE }; } + // Look for an after event. If we find one then we need to pass the event into the + // CreateBinder call we generate. + IntermediateToken after = null; + if (bindEntry.BindAfterNode != null) + { + after = GetAttributeContent(bindEntry.BindAfterNode); + } + + IntermediateToken setter = null; + if (bindEntry.BindSetNode != null) + { + setter = GetAttributeContent(bindEntry.BindSetNode); + } + var valueExpressionTokens = new List(); var changeExpressionTokens = new List(); @@ -344,6 +448,9 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE { RewriteNodesForComponentDelegateBind( original, + setter, + after, + changeAttribute.IsDelegateWithAwaitableResult(), valueExpressionTokens, changeExpressionTokens); } @@ -351,6 +458,8 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE { RewriteNodesForComponentEventCallbackBind( original, + setter, + after, valueExpressionTokens, changeExpressionTokens); } @@ -360,28 +469,32 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE original, format, culture, + setter, + after, valueExpressionTokens, changeExpressionTokens); } + var targetNode = bindEntry.GetEffectiveBindNode(); + if (parent is MarkupElementIntermediateNode) { var valueNode = new HtmlAttributeIntermediateNode() { Annotations = { - [ComponentMetadata.Common.OriginalAttributeName] = node.OriginalAttributeName, + [ComponentMetadata.Common.OriginalAttributeName] = bindEntry.GetOriginalAttributeName(), }, AttributeName = valueAttributeName, - Source = node.Source, + Source = targetNode.Source, Prefix = valueAttributeName + "=\"", Suffix = "\"", }; - for (var i = 0; i < node.Diagnostics.Count; i++) + for (var i = 0; i < targetNode.Diagnostics.Count; i++) { - valueNode.Diagnostics.Add(node.Diagnostics[i]); + valueNode.Diagnostics.Add(targetNode.Diagnostics[i]); } valueNode.Children.Add(new CSharpExpressionAttributeValueIntermediateNode()); @@ -394,11 +507,11 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE { Annotations = { - [ComponentMetadata.Common.OriginalAttributeName] = node.OriginalAttributeName, + [ComponentMetadata.Common.OriginalAttributeName] = bindEntry.GetOriginalAttributeName(), }, AttributeName = changeAttributeName, AttributeNameExpression = changeAttributeNode, - Source = node.Source, + Source = targetNode.Source, Prefix = changeAttributeName + "=\"", Suffix = "\"", @@ -416,18 +529,13 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE } else { - var valueNode = new ComponentAttributeIntermediateNode(node) - { - Annotations = - { - [ComponentMetadata.Common.OriginalAttributeName] = node.OriginalAttributeName, - }, - AttributeName = valueAttributeName, - BoundAttribute = valueAttribute, // Might be null if it doesn't match a component attribute - PropertyName = valueAttribute?.GetPropertyName(), - TagHelper = valueAttribute == null ? null : node.TagHelper, - TypeName = valueAttribute?.IsWeaklyTyped() == false ? valueAttribute.TypeName : null, - }; + ComponentAttributeIntermediateNode valueNode = node != null ? new ComponentAttributeIntermediateNode(node) : new ComponentAttributeIntermediateNode(getNode); + valueNode.Annotations[ComponentMetadata.Common.OriginalAttributeName] = bindEntry.GetOriginalAttributeName(); + valueNode.AttributeName = valueAttributeName; + valueNode.BoundAttribute = valueAttribute; // Might be null if it doesn't match a component attribute + valueNode.PropertyName = valueAttribute?.GetPropertyName(); + valueNode.TagHelper = valueAttribute == null ? null : bindEntry.GetEffectiveNodeTagHelperDescriptor(); + valueNode.TypeName = valueAttribute?.IsWeaklyTyped() == false ? valueAttribute.TypeName : null; valueNode.Children.Clear(); valueNode.Children.Add(new CSharpExpressionIntermediateNode()); @@ -436,18 +544,13 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE valueNode.Children[0].Children.Add(valueExpressionTokens[i]); } - var changeNode = new ComponentAttributeIntermediateNode(node) - { - Annotations = - { - [ComponentMetadata.Common.OriginalAttributeName] = node.OriginalAttributeName, - }, - AttributeName = changeAttributeName, - BoundAttribute = changeAttribute, // Might be null if it doesn't match a component attribute - PropertyName = changeAttribute?.GetPropertyName(), - TagHelper = changeAttribute == null ? null : node.TagHelper, - TypeName = changeAttribute?.IsWeaklyTyped() == false ? changeAttribute.TypeName : null, - }; + var changeNode = node != null ? new ComponentAttributeIntermediateNode(node) : new ComponentAttributeIntermediateNode(getNode); + changeNode.Annotations[ComponentMetadata.Common.OriginalAttributeName] = bindEntry.GetOriginalAttributeName(); + changeNode.AttributeName = changeAttributeName; + changeNode.BoundAttribute = changeAttribute; // Might be null if it doesn't match a component attribute + changeNode.PropertyName = changeAttribute?.GetPropertyName(); + changeNode.TagHelper = changeAttribute == null ? null : bindEntry.GetEffectiveNodeTagHelperDescriptor(); + changeNode.TypeName = changeAttribute?.IsWeaklyTyped() == false ? changeAttribute.TypeName : null; changeNode.Children.Clear(); changeNode.Children.Add(new CSharpExpressionIntermediateNode()); @@ -461,18 +564,13 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE ComponentAttributeIntermediateNode expressionNode = null; if (expressionAttribute != null) { - expressionNode = new ComponentAttributeIntermediateNode(node) - { - Annotations = - { - [ComponentMetadata.Common.OriginalAttributeName] = node.OriginalAttributeName, - }, - AttributeName = expressionAttributeName, - BoundAttribute = expressionAttribute, - PropertyName = expressionAttribute.GetPropertyName(), - TagHelper = node.TagHelper, - TypeName = expressionAttribute.IsWeaklyTyped() ? null : expressionAttribute.TypeName, - }; + expressionNode = node != null ? new ComponentAttributeIntermediateNode(node) : new ComponentAttributeIntermediateNode(getNode); + expressionNode.Annotations[ComponentMetadata.Common.OriginalAttributeName] = bindEntry.GetOriginalAttributeName(); + expressionNode.AttributeName = expressionAttributeName; + expressionNode.BoundAttribute = expressionAttribute; + expressionNode.PropertyName = expressionAttribute.GetPropertyName(); + expressionNode.TagHelper = bindEntry.GetEffectiveNodeTagHelperDescriptor(); + expressionNode.TypeName = expressionAttribute.IsWeaklyTyped() ? null : expressionAttribute.TypeName; expressionNode.Children.Clear(); expressionNode.Children.Add(new CSharpExpressionIntermediateNode()); @@ -491,7 +589,7 @@ private IntermediateNode[] RewriteUsage(IntermediateNode parent, BindEntry bindE private bool TryParseBindAttribute(BindEntry bindEntry, out string valueAttributeName) { - var attributeName = bindEntry.BindNode.AttributeName; + var attributeName = bindEntry.GetEffectiveBindNodeAttributeName(); valueAttributeName = null; if (attributeName == "bind") @@ -533,8 +631,7 @@ private bool TryComputeAttributeNames( // generated to match a specific tag and has metadata that identify the attributes. // // We expect 1 bind tag helper per-node. - var node = bindEntry.BindNode; - var attributeName = node.AttributeName; + var attributeName = bindEntry.GetEffectiveBindNodeAttributeName(); // Even though some of our 'bind' tag helpers specify the attribute names, they // should still satisfy one of the valid syntaxes. @@ -543,14 +640,14 @@ private bool TryComputeAttributeNames( return false; } - valueAttributeName = node.TagHelper.GetValueAttributeName() ?? valueAttributeName; + valueAttributeName = bindEntry.GetEffectiveNodeTagHelperDescriptor()?.GetValueAttributeName() ?? valueAttributeName; // If there an attribute that specifies the event like @bind:event="oninput", // that should be preferred. Otherwise, use the one from the tag helper. if (bindEntry.BindEventNode == null) { // @bind:event not specified - changeAttributeName = node.TagHelper.GetChangeAttributeName(); + changeAttributeName = bindEntry.GetEffectiveBindNodeChangeAttributeName(); } else if (TryExtractEventNodeStaticText(bindEntry.BindEventNode, out var text)) { @@ -563,7 +660,7 @@ private bool TryComputeAttributeNames( changeAttributeNode = ExtractEventNodeExpression(bindEntry.BindEventNode); } - expressionAttributeName = node.TagHelper.GetExpressionAttributeName(); + expressionAttributeName = bindEntry.GetEffectiveBindNodeExpressionAttributeName(); // We expect 0-1 components per-node. var componentTagHelper = (parent as ComponentIntermediateNode)?.Component; @@ -639,6 +736,9 @@ static CSharpExpressionIntermediateNode ExtractEventNodeExpression(TagHelperDire private void RewriteNodesForComponentDelegateBind( IntermediateToken original, + IntermediateToken setter, + IntermediateToken after, + bool awaitable, List valueExpressionTokens, List changeExpressionTokens) { @@ -647,19 +747,77 @@ private void RewriteNodesForComponentDelegateBind( // - create a delegate to handle changes valueExpressionTokens.Add(original); + // Since we have to support setters and after, there are a few things to consider: + // If we are provided with a setter, we can cast it to the change attribute type, like + // (Action)(value => { }) or (Func)(value => Task.CompletedTask) and use that. + // If we are provided with an 'after' we'll need to generate a callback where we invoke the 'after' expression + // after the regular setter. In this case, unfortunately we can't rely on EventCallbackFactory to normalize things + // since the target attribute type is a delegate and not an EventCallback. + // For that reason, we at least captured whether the attribute has an awaitable result, and we'll use that information + // during code generation. + // For example, with a synchronous 'after' method we will generate code as follows: + // (TargetAttributeType)(__value => = __value; RuntimeHelpers.InferSynchronousDelegate(after)(); } + // With an asynchronous 'after' method we will generate code as follows: + // (TargetAttributeType)(__value => = __value; return RuntimeHelpers.InferAsynchronousDelegate(after)(); } + // Now rewrite the content of the change-handler node. Since it's a component attribute, // we don't use the 'BindMethods' wrapper. We expect component attributes to always 'match' on type. // // __value => = __value - changeExpressionTokens.Add(new IntermediateToken() + + if (setter == null && after == null) { - Content = $"__value => {original.Content} = __value", - Kind = TokenKind.CSharp, - }); + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $"__value => {original.Content} = __value", + Kind = TokenKind.CSharp, + }); + } + else if (setter != null && after == null) + { + changeExpressionTokens.Add(new IntermediateToken() + { + Content = setter.Content, + Kind = TokenKind.CSharp, + }); + } + else if (after != null && setter == null) + { + if (!awaitable) + { + var syncAfterExpression = $"{ComponentsApi.RuntimeHelpers.InvokeSynchronousDelegate}({after.Content});"; + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $"__value => {{ {original.Content} = __value; {syncAfterExpression} }}", + Kind = TokenKind.CSharp, + }); + } + else + { + var asyncAfterExpression = $"{ComponentsApi.RuntimeHelpers.InvokeAsynchronousDelegate}({after.Content});"; + changeExpressionTokens.Add(new IntermediateToken() + { + // Figure out the type check + Content = $"async __value => {{ {original.Content} = __value; await {asyncAfterExpression} }}", + Kind = TokenKind.CSharp, + }); + } + } + else + { + // Treat this as the original case, since we don't support bind:set and bind:after simultaneously, we will produce an error. + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $"__value => {original.Content} = __value", + Kind = TokenKind.CSharp, + }); + } } private void RewriteNodesForComponentEventCallbackBind( IntermediateToken original, + IntermediateToken setter, + IntermediateToken after, List valueExpressionTokens, List changeExpressionTokens) { @@ -668,9 +826,57 @@ private void RewriteNodesForComponentEventCallbackBind( // - create a delegate to handle changes valueExpressionTokens.Add(original); + // This is largely the same as the one for elements as we can invoke CreateInferredCallback all the way to victory changeExpressionTokens.Add(new IntermediateToken() { - Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, __value => {original.Content} = __value, {original.Content})", + Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, ", + Kind = TokenKind.CSharp + }); + + if (setter == null && after == null) + { + // no bind:set nor bind:after, assign to the bound expression + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $"__value => {original.Content} = __value", + Kind = TokenKind.CSharp + }); + + } + else if (setter != null && after == null) + { + // bind:set only + changeExpressionTokens.Add(new IntermediateToken() + { + Content = setter.Content, + Kind = TokenKind.CSharp + }); + } + else if (setter == null && after != null) + { + // bind:after only + var afterToEventCallback = $"global::{ComponentsApi.EventCallback.FactoryAccessor}.{ComponentsApi.EventCallbackFactory.CreateMethod}(this, callback: {after.Content})"; + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: __value => {{ {original.Content} = __value; return {afterToEventCallback}.InvokeAsync(); }}, value: {original.Content})", + Kind = TokenKind.CSharp + }); + } + else + { + // bind:set and bind:after create the code even though we disallow this combination through a diagnostic + var setToEventCallback = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: {setter.Content}, value: {original.Content})"; + var afterToEventCallback = $"global::{ComponentsApi.EventCallback.FactoryAccessor}.{ComponentsApi.EventCallbackFactory.CreateMethod}(this, callback: {after.Content})"; + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: async __value => {{ await {setToEventCallback}.InvokeAsync(); await {afterToEventCallback}.InvokeAsync(); }}, value: {original.Content})", + Kind = TokenKind.CSharp + }); + } + + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $", {original.Content})", Kind = TokenKind.CSharp }); } @@ -679,6 +885,8 @@ private void RewriteNodesForElementEventCallbackBind( IntermediateToken original, IntermediateToken format, IntermediateToken culture, + IntermediateToken setter, + IntermediateToken after, List valueExpressionTokens, List changeExpressionTokens) { @@ -740,7 +948,53 @@ private void RewriteNodesForElementEventCallbackBind( // Note that the linemappings here are applied to the value attribute, not the change attribute. changeExpressionTokens.Add(new IntermediateToken() { - Content = $"global::{ComponentsApi.EventCallback.FactoryAccessor}.{ComponentsApi.EventCallbackFactory.CreateBinderMethod}(this, __value => {original.Content} = __value, ", + Content = $"global::{ComponentsApi.EventCallback.FactoryAccessor}.{ComponentsApi.EventCallbackFactory.CreateBinderMethod}(this, ", + Kind = TokenKind.CSharp + }); + + if (setter == null && after == null) + { + // no bind:set nor bind:after, , assign to the bound expression + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $"__value => {original.Content} = __value", + Kind = TokenKind.CSharp + }); + } + else if (setter != null && after == null) + { + // bind:set only + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: {setter.Content}, value: {original.Content})", + Kind = TokenKind.CSharp + }); + } + else if (setter == null && after != null) + { + // bind:after only + var afterToEventCallback = $"global::{ComponentsApi.EventCallback.FactoryAccessor}.{ComponentsApi.EventCallbackFactory.CreateMethod}(this, callback: {after.Content})"; + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: __value => {{ {original.Content} = __value; return {afterToEventCallback}.InvokeAsync(); }}, value: {original.Content})", + Kind = TokenKind.CSharp + }); + } + else + { + // bind:set and bind:after create the code even though we disallow this combination through a diagnostic + var setToEventCallback = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: {setter.Content}, value: {original.Content})"; + var afterToEventCallback = $"global::{ComponentsApi.EventCallback.FactoryAccessor}.{ComponentsApi.EventCallbackFactory.CreateMethod}(this, callback: {after.Content})"; + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: async __value => {{ await {setToEventCallback}.InvokeAsync(); await {afterToEventCallback}.InvokeAsync(); }}, value: {original.Content})", + Kind = TokenKind.CSharp + }); + } + + changeExpressionTokens.Add(new IntermediateToken() + { + Content = $", ", Kind = TokenKind.CSharp }); @@ -826,7 +1080,8 @@ private class BindEntry public BindEntry(IntermediateNodeReference bindNodeReference) { BindNodeReference = bindNodeReference; - BindNode = (TagHelperDirectiveAttributeIntermediateNode)bindNodeReference.Node; + BindNode = bindNodeReference.Node as TagHelperDirectiveAttributeIntermediateNode; + BindGetNode = BindNodeReference.Node as TagHelperDirectiveAttributeParameterIntermediateNode; } public IntermediateNodeReference BindNodeReference { get; } @@ -838,5 +1093,24 @@ public BindEntry(IntermediateNodeReference bindNodeReference) public TagHelperDirectiveAttributeParameterIntermediateNode BindFormatNode { get; set; } public TagHelperDirectiveAttributeParameterIntermediateNode BindCultureNode { get; set; } + + public TagHelperDirectiveAttributeParameterIntermediateNode BindGetNode { get; set; } + + public TagHelperDirectiveAttributeParameterIntermediateNode BindSetNode { get; set; } + + public TagHelperDirectiveAttributeParameterIntermediateNode BindAfterNode { get; set; } + + public IntermediateNode GetEffectiveBindNode() => (IntermediateNode)BindNode ?? BindGetNode; + + public TagHelperDescriptor GetEffectiveNodeTagHelperDescriptor() => BindNode?.TagHelper ?? BindGetNode?.TagHelper; + + public string GetOriginalAttributeName() => BindNode?.OriginalAttributeName ?? BindGetNode?.OriginalAttributeName; + + // Return the attribute name, for @bind it's the attribute, for @bind:get is the attribute without the parameter part. + public string GetEffectiveBindNodeAttributeName() => BindNode?.AttributeName ?? BindGetNode?.AttributeNameWithoutParameter; + + public string GetEffectiveBindNodeChangeAttributeName() => BindNode?.TagHelper.GetChangeAttributeName() ?? BindGetNode?.TagHelper.GetChangeAttributeName(); + + public string GetEffectiveBindNodeExpressionAttributeName() => BindNode?.TagHelper.GetExpressionAttributeName() ?? BindGetNode?.TagHelper.GetExpressionAttributeName(); } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentDiagnosticFactory.cs b/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentDiagnosticFactory.cs index 990dd1f5c..e9876a725 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentDiagnosticFactory.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentDiagnosticFactory.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #nullable disable @@ -456,4 +456,97 @@ public static RazorDiagnostic CreateEventHandlerParameter_Duplicates(SourceSpan? Environment.NewLine + string.Join(Environment.NewLine, attributes.Select(p => p.TagHelper.DisplayName))); return diagnostic; } + + public static readonly RazorDiagnosticDescriptor BindAttributeParameter_UseBindGet = + new RazorDiagnosticDescriptor( + $"{DiagnosticPrefix}10015", + () => "Attribute '{0}:get' must be used with attribute '{0}:set'.", + RazorDiagnosticSeverity.Error); + + + public static RazorDiagnostic CreateBindAttributeParameter_UseBindGet(SourceSpan? source, string attribute) + { + var diagnostic = RazorDiagnostic.Create( + BindAttributeParameter_UseBindGet, + source ?? SourceSpan.Undefined, + attribute); + return diagnostic; + } + + public static readonly RazorDiagnosticDescriptor BindAttributeParameter_MissingBindGet = + new RazorDiagnosticDescriptor( + $"{DiagnosticPrefix}10016", + () => "Attribute '{0}:set' was used but no attribute '{0}:get' was found.", + RazorDiagnosticSeverity.Error); + + + public static RazorDiagnostic CreateBindAttributeParameter_MissingBindGet(SourceSpan? source, string attribute) + { + var diagnostic = RazorDiagnostic.Create( + BindAttributeParameter_MissingBindGet, + source ?? SourceSpan.Undefined, + attribute); + return diagnostic; + } + + public static readonly RazorDiagnosticDescriptor BindAttribute_MissingBindSet = + new RazorDiagnosticDescriptor( + $"{DiagnosticPrefix}10017", + () => "The attribute '{0}' must have a companion '{1}' attribute.", + RazorDiagnosticSeverity.Error); + + public static RazorDiagnostic CreateBindAttribute_MissingBindSet(SourceSpan? source, string attributeGet, string attributeSet) + { + var diagnostic = RazorDiagnostic.Create( + BindAttribute_MissingBindSet, + source ?? SourceSpan.Undefined, + attributeGet, + attributeSet); + return diagnostic; + } + + public static readonly RazorDiagnosticDescriptor BindAttributeParameter_InvalidSyntaxBindAndBindGet = + new RazorDiagnosticDescriptor( + $"{DiagnosticPrefix}10018", + () => "Attribute '{0}' can't be used in conjunction with '{0}:get'.", + RazorDiagnosticSeverity.Error); + + public static RazorDiagnostic CreateBindAttributeParameter_InvalidSyntaxBindAndBindGet(SourceSpan? source, string attribute) + { + var diagnostic = RazorDiagnostic.Create( + BindAttributeParameter_InvalidSyntaxBindAndBindGet, + source ?? SourceSpan.Undefined, + attribute); + return diagnostic; + } + + public static readonly RazorDiagnosticDescriptor BindAttributeParameter_InvalidSyntaxBindSetAfter = + new RazorDiagnosticDescriptor( + $"{DiagnosticPrefix}10019", + () => "Attribute '{0}:after' can not be used with '{0}:set'. Invoke the code in '{0}:after' inside '{0}:set' instead.", + RazorDiagnosticSeverity.Error); + + public static RazorDiagnostic CreateBindAttributeParameter_InvalidSyntaxBindSetAfter(SourceSpan? source, string attribute) + { + var diagnostic = RazorDiagnostic.Create( + BindAttributeParameter_InvalidSyntaxBindSetAfter, + source ?? SourceSpan.Undefined, + attribute); + return diagnostic; + } + + public static readonly RazorDiagnosticDescriptor BindAttributeParameter_UnsupportedSyntaxBindGetSet = + new RazorDiagnosticDescriptor( + $"{DiagnosticPrefix}10020", + () => "Attribute '{0}' can only be used with RazorLanguageVersion 7.0 or higher.", + RazorDiagnosticSeverity.Error); + + public static RazorDiagnostic CreateBindAttributeParameter_UnsupportedSyntaxBindGetSet(SourceSpan? source, string attribute) + { + var diagnostic = RazorDiagnostic.Create( + BindAttributeParameter_UnsupportedSyntaxBindGetSet, + source ?? SourceSpan.Undefined, + attribute); + return diagnostic; + } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentMetadata.cs b/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentMetadata.cs index 2688b1d18..564c9c516 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentMetadata.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentMetadata.cs @@ -49,6 +49,8 @@ public static class Bind public const string TagHelperKind = "Components.Bind"; + public const string BindAttributeGetSet = "Components.Bind.AlternativeNotation"; + public const string FallbackKey = "Components.Bind.Fallback"; public const string TypeAttribute = "Components.Bind.TypeAttribute"; @@ -91,6 +93,8 @@ public static class Component public const string DelegateSignatureKey = "Components.DelegateSignature"; + public const string DelegateWithAwaitableResultKey = "Components.IsDelegateAwaitableResult"; + public const string EventCallbackKey = "Components.EventCallback"; public const string WeaklyTypedKey = "Components.IsWeaklyTyped"; diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentsApi.cs b/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentsApi.cs index 001d81210..ba139148b 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentsApi.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentsApi.cs @@ -109,6 +109,8 @@ public static class RuntimeHelpers { public const string TypeCheck = "global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck"; public const string CreateInferredEventCallback = "global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback"; + public const string InvokeSynchronousDelegate = "global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate"; + public const string InvokeAsynchronousDelegate = "global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate"; } public static class RouteAttribute diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/Components/TagHelperBoundAttributeDescriptorExtensions.cs b/src/Microsoft.AspNetCore.Razor.Language/src/Components/TagHelperBoundAttributeDescriptorExtensions.cs index 54fefbbb7..9ca7feaab 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/Components/TagHelperBoundAttributeDescriptorExtensions.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/Components/TagHelperBoundAttributeDescriptorExtensions.cs @@ -17,6 +17,14 @@ public static bool IsDelegateProperty(this BoundAttributeDescriptor attribute) string.Equals(value, bool.TrueString); } + public static bool IsDelegateWithAwaitableResult(this BoundAttributeDescriptor attribute) + { + var key = ComponentMetadata.Component.DelegateWithAwaitableResultKey; + return + attribute.Metadata.TryGetValue(key, out var value) && + string.Equals(value, bool.TrueString); + } + /// /// Gets a value indicating whether the attribute is of type EventCallback or /// EventCallback{T} diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/Components/TagHelperDescriptorExtensions.cs b/src/Microsoft.AspNetCore.Razor.Language/src/Components/TagHelperDescriptorExtensions.cs index 885d38395..13935efb8 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/Components/TagHelperDescriptorExtensions.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/Components/TagHelperDescriptorExtensions.cs @@ -44,7 +44,7 @@ public static bool IsInputElementBindTagHelper(this TagHelperDescriptor tagHelpe { return tagHelper.IsBindTagHelper() && - tagHelper.TagMatchingRules.Count == 1 && + tagHelper.TagMatchingRules.Count == 2 && string.Equals("input", tagHelper.TagMatchingRules[0].TagName); } diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/Intermediate/IntermediateNode.cs b/src/Microsoft.AspNetCore.Razor.Language/src/Intermediate/IntermediateNode.cs index 7d2c57d01..45542ecf9 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/Intermediate/IntermediateNode.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/Intermediate/IntermediateNode.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #nullable disable @@ -58,7 +58,7 @@ private string Tree } } - private string DebuggerToString() + internal string DebuggerToString() { var formatter = new DebuggerDisplayFormatter(); formatter.FormatNode(this); diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/Intermediate/IntermediateNodeReference.cs b/src/Microsoft.AspNetCore.Razor.Language/src/Intermediate/IntermediateNodeReference.cs index 390d14941..0760212fa 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/Intermediate/IntermediateNodeReference.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/Intermediate/IntermediateNodeReference.cs @@ -1,13 +1,15 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #nullable disable using System; using System.Collections.Generic; +using System.Diagnostics; namespace Microsoft.AspNetCore.Razor.Language.Intermediate; +[DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")] public struct IntermediateNodeReference { public IntermediateNodeReference(IntermediateNode parent, IntermediateNode node) @@ -207,4 +209,9 @@ public IntermediateNodeReference Replace(IntermediateNode node) Parent.Children[index] = node; return new IntermediateNodeReference(Parent, node); } + + private string GetDebuggerDisplay() + { + return $"ref: {Parent.DebuggerToString()} - {Node.DebuggerToString()}"; + } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/RazorLanguageVersion.cs b/src/Microsoft.AspNetCore.Razor.Language/src/RazorLanguageVersion.cs index 0b68336f7..5e1a2d37d 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/RazorLanguageVersion.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/RazorLanguageVersion.cs @@ -26,7 +26,9 @@ public sealed class RazorLanguageVersion : IEquatable, ICo public static readonly RazorLanguageVersion Version_6_0 = new RazorLanguageVersion(6, 0); - public static readonly RazorLanguageVersion Latest = Version_6_0; + public static readonly RazorLanguageVersion Version_7_0 = new RazorLanguageVersion(7, 0); + + public static readonly RazorLanguageVersion Latest = Version_7_0; public static readonly RazorLanguageVersion Experimental = new RazorLanguageVersion(1337, 1337); @@ -47,6 +49,11 @@ public static bool TryParse(string languageVersion, out RazorLanguageVersion ver version = Experimental; return true; } + else if (languageVersion == "7.0") + { + version = Version_7_0; + return true; + } else if (languageVersion == "6.0") { version = Version_6_0; diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/RazorProjectEngine.cs b/src/Microsoft.AspNetCore.Razor.Language/src/RazorProjectEngine.cs index 40c42b46f..1b7cb85cd 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/RazorProjectEngine.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/RazorProjectEngine.cs @@ -254,7 +254,7 @@ private static void AddComponentFeatures(RazorProjectEngineBuilder builder, Razo builder.Features.Add(new ComponentKeyLoweringPass()); builder.Features.Add(new ComponentReferenceCaptureLoweringPass()); builder.Features.Add(new ComponentSplatLoweringPass()); - builder.Features.Add(new ComponentBindLoweringPass()); + builder.Features.Add(new ComponentBindLoweringPass(razorLanguageVersion.CompareTo(RazorLanguageVersion.Version_7_0) >= 0)); builder.Features.Add(new ComponentCssScopePass()); builder.Features.Add(new ComponentTemplateDiagnosticPass()); builder.Features.Add(new ComponentGenericTypePass()); diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/TagHelperDescriptor.cs b/src/Microsoft.AspNetCore.Razor.Language/src/TagHelperDescriptor.cs index 43c040dca..7f1d983c1 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/TagHelperDescriptor.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/TagHelperDescriptor.cs @@ -5,10 +5,12 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; namespace Microsoft.AspNetCore.Razor.Language; +[DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")] public abstract class TagHelperDescriptor : IEquatable { private IEnumerable _allDiagnostics; @@ -137,4 +139,9 @@ public ParsedTypeInformation(bool success, StringSegment @namespace, StringSegme public StringSegment Namespace { get; } public StringSegment TypeName { get; } } + + private string GetDebuggerDisplay() + { + return $"{DisplayName} - {string.Join(" | ", TagMatchingRules.Select(r => r.GetDebuggerDisplay()))}"; + } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/src/TagMatchingRuleDescriptor.cs b/src/Microsoft.AspNetCore.Razor.Language/src/TagMatchingRuleDescriptor.cs index 0ae02029d..1535d9185 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/src/TagMatchingRuleDescriptor.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/src/TagMatchingRuleDescriptor.cs @@ -5,10 +5,12 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; namespace Microsoft.AspNetCore.Razor.Language; +[DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")] public abstract class TagMatchingRuleDescriptor : IEquatable { private int? _hashCode; @@ -65,4 +67,29 @@ public override int GetHashCode() _hashCode ??= TagMatchingRuleDescriptorComparer.Default.GetHashCode(this); return _hashCode.Value; } + + internal string GetDebuggerDisplay() + { + var tagName = TagName ?? "*"; + tagName += TagStructure == TagStructure.WithoutEndTag ? "/" : ""; + return $"{TagName ?? "*"}[{string.Join(", ", Attributes.Select(a => DescribeAttribute(a)))}]"; + static string DescribeAttribute(RequiredAttributeDescriptor attribute) + { + var name = attribute.Name switch + { + null => "*", + var prefix when attribute.NameComparison == RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch => $"^{prefix}", + var full => full, + }; + + var value = attribute.Value switch + { + null => "", + var prefix when attribute.ValueComparison == RequiredAttributeDescriptor.ValueComparisonMode.PrefixMatch => $"^={prefix}", + var suffix when attribute.ValueComparison == RequiredAttributeDescriptor.ValueComparisonMode.SuffixMatch => $"$={suffix}", + var full => $"={full}", + }; + return name + value; + } + } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs b/src/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs index a4e482452..7c51f2efc 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs @@ -3,6 +3,7 @@ #nullable disable +using System; using System.Globalization; using System.Linq; using Microsoft.AspNetCore.Razor.Language.Components; @@ -1614,7 +1615,7 @@ public static class BindAttributes } [Fact] - public void BindToElement_WithStringAttribute_WritesAttributes() + public void BindToElement_WithBindAfterAndSuffix() { // Arrange AdditionalSyntaxTrees.Add(Parse(@" @@ -1623,16 +1624,23 @@ public void BindToElement_WithStringAttribute_WritesAttributes() namespace Test { - [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] + [BindElement(""div"", ""myvalue"", ""myvalue"", ""myevent"")] public static class BindAttributes { } }")); + // Act var generated = CompileToCSharp(@" -
+
+
@code { public string ParentValue { get; set; } = ""hi""; + + Task DoSomething() + { + return Task.CompletedTask; + } }"); // Assert @@ -1642,7 +1650,7 @@ public static class BindAttributes } [Fact] - public void BindToElementWithSuffix_WritesAttributes() + public void BindToElement_WithGetSetAndSuffix() { // Arrange AdditionalSyntaxTrees.Add(Parse(@" @@ -1651,16 +1659,23 @@ public void BindToElementWithSuffix_WritesAttributes() namespace Test { - [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] + [BindElement(""div"", ""myvalue"", ""myvalue"", ""myevent"")] public static class BindAttributes { } }")); + // Act var generated = CompileToCSharp(@" -
+
+
@code { public string ParentValue { get; set; } = ""hi""; + + Task ValueChanged(string value) + { + return Task.CompletedTask; + } }"); // Assert @@ -1670,25 +1685,33 @@ public static class BindAttributes } [Fact] - public void BindToElementWithSuffix_OverridesEvent() + public void BindToComponent_WithGetSet_TaskReturningDelegate() { // Arrange AdditionalSyntaxTrees.Add(Parse(@" using System; +using System.Threading.Tasks; using Microsoft.AspNetCore.Components; namespace Test { - [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] - public static class BindAttributes + public class MyComponent : ComponentBase { + [Parameter] + public int Value { get; set; } + + [Parameter] + public Func ValueChanged { get; set; } } }")); + // Act var generated = CompileToCSharp(@" -
+ @code { - public string ParentValue { get; set; } = ""hi""; + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } }"); // Assert @@ -1698,26 +1721,31 @@ public static class BindAttributes } [Fact] - public void BindToElement_WithEventAsExpression() + public void BindToComponent_WithGetSet_TaskReturningLambda() { // Arrange AdditionalSyntaxTrees.Add(Parse(@" using System; +using System.Threading.Tasks; using Microsoft.AspNetCore.Components; namespace Test { - [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] - public static class BindAttributes + public class MyComponent : ComponentBase { + [Parameter] + public int Value { get; set; } + + [Parameter] + public Func ValueChanged { get; set; } } }")); + // Act var generated = CompileToCSharp(@" -@{ var x = ""anotherevent""; } -
+ { ParentValue = value; return Task.CompletedTask; }"" /> @code { - public string ParentValue { get; set; } = ""hi""; + public int ParentValue { get; set; } = 42; }"); // Assert @@ -1727,7 +1755,7 @@ public static class BindAttributes } [Fact] - public void BindToElement_WithEventAsExplicitExpression() + public void BindToComponent_WithGetSet_Action() { // Arrange AdditionalSyntaxTrees.Add(Parse(@" @@ -1736,17 +1764,23 @@ public void BindToElement_WithEventAsExplicitExpression() namespace Test { - [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] - public static class BindAttributes + public class MyComponent : ComponentBase { + [Parameter] + public int Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } } }")); + // Act var generated = CompileToCSharp(@" -@{ var x = ""anotherevent""; } -
+ @code { - public string ParentValue { get; set; } = ""hi""; + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; }"); // Assert @@ -1756,13 +1790,28 @@ public static class BindAttributes } [Fact] - public void BuiltIn_BindToInputWithoutType_WritesAttributes() + public void BindToComponent_WithGetSet_ActionLambda() { // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } + } +}")); // Act var generated = CompileToCSharp(@" - + ParentValue = value"" /> @code { public int ParentValue { get; set; } = 42; }"); @@ -1774,15 +1823,32 @@ public void BuiltIn_BindToInputWithoutType_WritesAttributes() } [Fact] - public void BuiltIn_BindToInputWithoutType_IsCaseSensitive() + public void BindToComponent_WithGetSet_EventCallback() { // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); // Act var generated = CompileToCSharp(@" - + @code { public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } }"); // Assert @@ -1792,15 +1858,36 @@ public void BuiltIn_BindToInputWithoutType_IsCaseSensitive() } [Fact] - public void BuiltIn_BindToInputText_WithFormat_WritesAttributes() + public void BindToGenericComponent_InferredType_WithGetSet_EventCallback() { // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } + + public class CustomValue + { + } +}")); // Act var generated = CompileToCSharp(@" - + @code { - public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } }"); // Assert @@ -1810,17 +1897,36 @@ public void BuiltIn_BindToInputText_WithFormat_WritesAttributes() } [Fact] - public void BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes() + public void BindToGenericComponent_ExplicitType_WithGetSet_EventCallback() { // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } + + public class CustomValue + { + } +}")); // Act var generated = CompileToCSharp(@" - + @code { - public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); + public CustomValue ParentValue { get; set; } = new CustomValue(); - public string Format { get; set; } = ""MM/dd/yyyy""; + public EventCallback UpdateValue { get; set; } }"); // Assert @@ -1830,15 +1936,33 @@ public void BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes() } [Fact] - public void BuiltIn_BindToInputText_WritesAttributes() + public void GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback() { // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); // Act var generated = CompileToCSharp(@" - +@typeparam TParam + @code { - public int ParentValue { get; set; } = 42; + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } }"); // Assert @@ -1848,15 +1972,33 @@ public void BuiltIn_BindToInputText_WritesAttributes() } [Fact] - public void BuiltIn_BindToInputCheckbox_WritesAttributes() + public void GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback() { // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); // Act var generated = CompileToCSharp(@" - +@typeparam TParam + @code { - public bool Enabled { get; set; } + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } }"); // Assert @@ -1866,13 +2008,28 @@ public void BuiltIn_BindToInputCheckbox_WritesAttributes() } [Fact] - public void BindToElementFallback_WritesAttributes() + public void BindToComponent_WithGetSet_EventCallback_ReceivesAction() { // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); // Act var generated = CompileToCSharp(@" - + ParentValue = value"" /> @code { public int ParentValue { get; set; } = 42; }"); @@ -1884,15 +2041,32 @@ public void BindToElementFallback_WritesAttributes() } [Fact] - public void BindToElementFallback_WithFormat_WritesAttributes() + public void BindToComponent_WithGetSet_EventCallback_ReceivesFunction() { // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); // Act var generated = CompileToCSharp(@" - + @code { - public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } }"); // Assert @@ -1902,16 +2076,33 @@ public void BindToElementFallback_WithFormat_WritesAttributes() } [Fact] - public void BindToElementFallback_WithCulture() + public void BindToComponent_WithAfter_TaskReturningDelegate() { // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + + [Parameter] + public Func ValueChanged { get; set; } + } +}")); // Act var generated = CompileToCSharp(@" -@using System.Globalization -
+ @code { - public string ParentValue { get; set; } = ""hi""; + public int ParentValue { get; set; } = 42; + + public Task Update() => Task.CompletedTask; }"); // Assert @@ -1921,26 +2112,31 @@ @using System.Globalization } [Fact] - public void BindToElementWithCulture() + public void BindToComponent_WithAfter_TaskReturningLambda() { // Arrange AdditionalSyntaxTrees.Add(Parse(@" using System; +using System.Threading.Tasks; using Microsoft.AspNetCore.Components; namespace Test { - [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] - public static class BindAttributes + public class MyComponent : ComponentBase { + [Parameter] + public int Value { get; set; } + + [Parameter] + public Func ValueChanged { get; set; } } }")); + // Act var generated = CompileToCSharp(@" -@using System.Globalization -
+ { return Task.CompletedTask; }"" /> @code { - public string ParentValue { get; set; } = ""hi""; + public int ParentValue { get; set; } = 42; }"); // Assert @@ -1950,27 +2146,32 @@ @using System.Globalization } [Fact] - public void BindToInputElementWithDefaultCulture() + public void BindToComponent_WithAfter_Action() { // Arrange AdditionalSyntaxTrees.Add(Parse(@" using System; using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Web; namespace Test { - [BindInputElement(""custom"", null, ""value"", ""onchange"", isInvariantCulture: true, format: null)] - public static class BindAttributes + public class MyComponent : ComponentBase { + [Parameter] + public int Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } } }")); + // Act var generated = CompileToCSharp(@" -@using System.Globalization - + @code { - public int ParentValue { get; set; } + public int ParentValue { get; set; } = 42; + + public void Update() { } }"); // Assert @@ -1980,18 +2181,699 @@ @using System.Globalization } [Fact] - public void BindToInputElementWithDefaultCulture_Override() + public void BindToGenericComponent_InferredType_WithAfter_Action() { // Arrange AdditionalSyntaxTrees.Add(Parse(@" using System; using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Web; namespace Test { - [BindInputElement(""custom"", null, ""value"", ""onchange"", isInvariantCulture: true, format: null)] - public static class BindAttributes + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; + + public void Update() { } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToGenericComponent_ExplicitType_WithAfter_Action() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; + + public void Update() { } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void GenericComponentBindToGenericComponent_InferredType_WithAfter_Action() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" +@typeparam TParam + +@code { + public TParam ParentValue { get; set; } + + public void Update() { } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" +@typeparam TParam + +@code { + public TParam ParentValue { get; set; } + + public void Update() { } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToComponent_WithAfter_ActionLambda() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" + { }"" /> +@code { + public int ParentValue { get; set; } = 42; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToComponent_WithAfter_EventCallback() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToComponent_WithAfter_EventCallback_ReceivesAction() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" + { }"" /> +@code { + public int ParentValue { get; set; } = 42; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToComponent_WithAfter_EventCallback_ReceivesFunction() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; + + public Task UpdateValue() => Task.CompletedTask; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToComponent_WithAfter_AsyncLambdaProducesError() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" + { ParentValue = value; return Task.CompletedTask; })"" /> +@code { + public int ParentValue { get; set; } = 42; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + var assembly = CompileToAssembly(generated, throwOnFailure: false); + // This has some errors + Assert.Collection( + assembly.Diagnostics.OrderBy(d => d.Id), + d => Assert.Equal("CS8030", d.Id)); + } + + [Fact] + public void BindToElement_WithStringAttribute_WritesAttributes() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +
+@code { + public string ParentValue { get; set; } = ""hi""; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToElementWithSuffix_WritesAttributes() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +
+@code { + public string ParentValue { get; set; } = ""hi""; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToElementWithSuffix_OverridesEvent() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +
+@code { + public string ParentValue { get; set; } = ""hi""; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToElement_WithEventAsExpression() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +@{ var x = ""anotherevent""; } +
+@code { + public string ParentValue { get; set; } = ""hi""; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToElement_WithEventAsExplicitExpression() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +@{ var x = ""anotherevent""; } +
+@code { + public string ParentValue { get; set; } = ""hi""; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BuiltIn_BindToInputWithoutType_WritesAttributes() + { + // Arrange + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BuiltIn_BindToInputWithoutType_IsCaseSensitive() + { + // Arrange + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BuiltIn_BindToInputText_WithFormat_WritesAttributes() + { + // Arrange + + // Act + var generated = CompileToCSharp(@" + +@code { + public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttributes() + { + // Arrange + + // Act + var generated = CompileToCSharp(@" + +@code { + public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); + + public string Format { get; set; } = ""MM/dd/yyyy""; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BuiltIn_BindToInputText_WritesAttributes() + { + // Arrange + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BuiltIn_BindToInputCheckbox_WritesAttributes() + { + // Arrange + + // Act + var generated = CompileToCSharp(@" + +@code { + public bool Enabled { get; set; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToElementFallback_WritesAttributes() + { + // Arrange + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToElementFallback_WithFormat_WritesAttributes() + { + // Arrange + + // Act + var generated = CompileToCSharp(@" + +@code { + public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1); +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToElementFallback_WithCulture() + { + // Arrange + + // Act + var generated = CompileToCSharp(@" +@using System.Globalization +
+@code { + public string ParentValue { get; set; } = ""hi""; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToElementWithCulture() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +@using System.Globalization +
+@code { + public string ParentValue { get; set; } = ""hi""; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToInputElementWithDefaultCulture() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Web; + +namespace Test +{ + [BindInputElement(""custom"", null, ""value"", ""onchange"", isInvariantCulture: true, format: null)] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +@using System.Globalization + +@code { + public int ParentValue { get; set; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void BindToInputElementWithDefaultCulture_Override() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Web; + +namespace Test +{ + [BindInputElement(""custom"", null, ""value"", ""onchange"", isInvariantCulture: true, format: null)] + public static class BindAttributes { } }")); @@ -2009,6 +2891,236 @@ @using System.Globalization CompileToAssembly(generated); } + [Fact] + public void BindToElement_MixingBindAndParamBindSet() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +
+@code { + public string ParentValue { get; set; } = ""hi""; + + public void UpdateValue(string value) => ParentValue = value; +}", throwOnFailure: false); + + // Assert + Assert.Collection(generated.Diagnostics, + diagnostic => Assert.Equal("RZ10015", diagnostic.Id)); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + } + + [Fact] + public void BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", null, ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +
+@code { + public string ParentValue { get; set; } = ""hi""; + + public void UpdateValue(string value) => ParentValue = value; +}", throwOnFailure: false); + + // Assert + Assert.Collection(generated.Diagnostics, + diagnostic => Assert.Equal("RZ10016", diagnostic.Id)); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + } + + [Fact] + public void BindToElement_MixingBindValueWithGetSet() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", null, ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +
+@code { + public string ParentValue { get; set; } = ""hi""; + + public void UpdateValue(string value) => ParentValue = value; +}", throwOnFailure: false); + + // Assert + Assert.Collection(generated.Diagnostics, + diagnostic => Assert.Equal("RZ10018", diagnostic.Id), + diagnostic => Assert.Equal("RZ10015", diagnostic.Id)); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + } + + [Fact] + public void BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions() + { + _configuration = RazorConfiguration.Create( + RazorLanguageVersion.Version_6_0, + "unnamed", + Array.Empty(), + false); + + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; +}", throwOnFailure: false); + + // Assert + Assert.Collection(generated.Diagnostics, + diagnostic => Assert.Equal("RZ10020", diagnostic.Id)); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + } + + [Fact] + public void BindToElement_MixingSetWithAfter() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", null, ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +
+@code { + public string ParentValue { get; set; } = ""hi""; + + public void UpdateValue(string value) => ParentValue = value; + public void AfterUpdate() { } +}", throwOnFailure: false); + + // Assert + Assert.Collection(generated.Diagnostics, + diagnostic => Assert.Equal("RZ10019", diagnostic.Id)); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + } + + [Fact] + public void BindToElement_MissingBindGet() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +
+@code { + public string ParentValue { get; set; } = ""hi""; + + public void UpdateValue(string value) => ParentValue = value; +}", throwOnFailure: false); + + // Assert + Assert.Collection(generated.Diagnostics, + diagnostic => Assert.Equal("RZ10016", diagnostic.Id)); + } + + [Fact] + public void BindToElement_MissingBindSet() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + [BindElement(""div"", ""value"", ""myvalue"", ""myevent"")] + public static class BindAttributes + { + } +}")); + // Act + var generated = CompileToCSharp(@" +
+@code { + public string ParentValue { get; set; } = ""hi""; + + public void UpdateValue(string value) => ParentValue = value; +}", throwOnFailure: false); + + // Assert + Assert.Collection(generated.Diagnostics, + diagnostic => Assert.Equal("RZ10017", diagnostic.Id)); + } [Fact] public void BuiltIn_BindToInputText_CanOverrideEvent() diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/RazorLanguageVersionTest.cs b/src/Microsoft.AspNetCore.Razor.Language/test/RazorLanguageVersionTest.cs index 2c38efba6..7d858df56 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/RazorLanguageVersionTest.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/test/RazorLanguageVersionTest.cs @@ -123,6 +123,20 @@ public void TryParse60() Assert.Same(RazorLanguageVersion.Version_6_0, version); } + [Fact] + public void TryParse70() + { + // Arrange + var value = "7.0"; + + // Act + var result = RazorLanguageVersion.TryParse(value, out var version); + + // Assert + Assert.True(result); + Assert.Same(RazorLanguageVersion.Version_7_0, version); + } + [Fact] public void TryParseLatest() { @@ -134,7 +148,7 @@ public void TryParseLatest() // Assert Assert.True(result); - Assert.Same(RazorLanguageVersion.Version_6_0, version); + Assert.Same(RazorLanguageVersion.Version_7_0, version); } [Fact] diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.ir.txt index ccbea200e..bfe510c64 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.ir.txt @@ -20,7 +20,9 @@ Document - LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueExpression - ValueExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => ParentValue diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.ir.txt index 6b2d5134b..55e09dc4c 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.ir.txt @@ -20,7 +20,9 @@ Document - LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamChanged - SomeParamChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamExpression - SomeParamExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => ParentValue diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_NestedGeneric/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_NestedGeneric/TestComponent.ir.txt index 107143df5..bedb00e74 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_NestedGeneric/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_NestedGeneric/TestComponent.ir.txt @@ -20,7 +20,9 @@ Document - LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamChanged - SomeParamChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamExpression - SomeParamExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => ParentValue diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.ir.txt index cb80fb4de..aa747e021 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.ir.txt @@ -20,7 +20,9 @@ Document - LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) HtmlContent - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n CSharpCode - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.ir.txt index 30a067c1b..7a3e38f4d 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.ir.txt @@ -20,7 +20,9 @@ Document - LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) HtmlContent - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n CSharpCode - (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.ir.txt index c08cd6a1a..f9795bb61 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.ir.txt @@ -20,7 +20,9 @@ Document - LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - OnChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) HtmlContent - (71:0,71 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (71:0,71 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n CSharpCode - (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.ir.txt index 2a38c699b..9068e3bc8 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.ir.txt @@ -20,7 +20,9 @@ Document - LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) HtmlContent - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n CSharpCode - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..f6e47b085 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Action( + __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); }); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public void Update() { } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.ir.txt new file mode 100644 index 000000000..663e62244 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [72] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); } + HtmlContent - (72:0,72 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (72:0,72 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public void Update() { }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..52d7b1a9f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| +Generated Location: (1771:47,7 [82] ) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs new file mode 100644 index 000000000..c3b17feb8 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs @@ -0,0 +1,56 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Action( + __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(() => { }); }); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.ir.txt new file mode 100644 index 000000000..6caa4f6c7 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(() => { }); } + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt new file mode 100644 index 000000000..d2a2e09ce --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt @@ -0,0 +1,14 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1774:47,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs new file mode 100644 index 000000000..bb74374cd --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs @@ -0,0 +1,56 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Action( + (value => { ParentValue = value; return Task.CompletedTask; })); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.ir.txt new file mode 100644 index 000000000..5e2ec891d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [126] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - (value => { ParentValue = value; return Task.CompletedTask; }) + HtmlContent - (126:0,126 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (126:0,126 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (135:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (135:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt new file mode 100644 index 000000000..c2d001008 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt @@ -0,0 +1,14 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (135:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1689:47,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..53932078b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue), ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..f424f87ce --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt @@ -0,0 +1,29 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [77] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..260a23e98 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (2258:47,7 [104] ) +| + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs new file mode 100644 index 000000000..97cb480e8 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs @@ -0,0 +1,56 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: () => { }).InvokeAsync(); }, value: ParentValue), ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt new file mode 100644 index 000000000..c071da3ae --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt @@ -0,0 +1,29 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: () => { }).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt new file mode 100644 index 000000000..56e31e228 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt @@ -0,0 +1,14 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (2256:47,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs new file mode 100644 index 000000000..fd6cec9e9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue), ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public Task UpdateValue() => Task.CompletedTask; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt new file mode 100644 index 000000000..a2a7f400c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt @@ -0,0 +1,29 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [77] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (86:1,7 [106] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (86:1,7 [106] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public Task UpdateValue() => Task.CompletedTask;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt new file mode 100644 index 000000000..a9594edf5 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (86:1,7 [106] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue() => Task.CompletedTask; +| +Generated Location: (2258:47,7 [106] ) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue() => Task.CompletedTask; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs new file mode 100644 index 000000000..759245ab9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Func( + async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(Update); }); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public Task Update() => Task.CompletedTask; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.ir.txt new file mode 100644 index 000000000..a7b468fe2 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [72] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(Update); } + HtmlContent - (72:0,72 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (72:0,72 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (81:1,7 [101] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (81:1,7 [101] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public Task Update() => Task.CompletedTask;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt new file mode 100644 index 000000000..6a6e993e2 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (81:1,7 [101] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public Task Update() => Task.CompletedTask; +| +Generated Location: (1811:47,7 [101] ) +| + public int ParentValue { get; set; } = 42; + + public Task Update() => Task.CompletedTask; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs new file mode 100644 index 000000000..d4903a54a --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs @@ -0,0 +1,56 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Func( + async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(() => { return Task.CompletedTask; }); }); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.ir.txt new file mode 100644 index 000000000..061b5eb56 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [102] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(() => { return Task.CompletedTask; }); } + HtmlContent - (102:0,102 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (102:0,102 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (111:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (111:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt new file mode 100644 index 000000000..e3a41e7fc --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt @@ -0,0 +1,14 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (111:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1841:47,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..dfb767b60 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Action( + UpdateValue); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 000000000..073dd9baa --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - UpdateValue + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public void UpdateValue(int value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..fe537597e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; +| +Generated Location: (1638:47,7 [116] ) +| + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs new file mode 100644 index 000000000..3d9df4195 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs @@ -0,0 +1,56 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Action( + value => ParentValue = value); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.ir.txt new file mode 100644 index 000000000..b8f2eb661 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [92] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - value => ParentValue = value + HtmlContent - (92:0,92 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (92:0,92 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt new file mode 100644 index 000000000..bd269df90 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt @@ -0,0 +1,14 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1655:47,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..cd399bc92 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..3a9543d1d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt @@ -0,0 +1,29 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..20a9e8fce --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (1975:47,7 [109] ) +| + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.codegen.cs new file mode 100644 index 000000000..f8f5bad6f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.codegen.cs @@ -0,0 +1,56 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, value => ParentValue = value, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.ir.txt new file mode 100644 index 000000000..738d496c1 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.ir.txt @@ -0,0 +1,29 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [92] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - value => ParentValue = value + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (92:0,92 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (92:0,92 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.mappings.txt new file mode 100644 index 000000000..8cd6e5680 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.mappings.txt @@ -0,0 +1,14 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1992:47,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.codegen.cs new file mode 100644 index 000000000..f75214ce7 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.codegen.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.ir.txt new file mode 100644 index 000000000..bb5d897a9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.ir.txt @@ -0,0 +1,29 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.mappings.txt new file mode 100644 index 000000000..77e0d1319 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1975:47,7 [144] ) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs new file mode 100644 index 000000000..dfb767b60 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Action( + UpdateValue); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.diagnostics.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.diagnostics.txt new file mode 100644 index 000000000..37f16c4b0 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.diagnostics.txt @@ -0,0 +1 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,31): Error RZ10020: Attribute 'bind-Value:get' can only be used with RazorLanguageVersion 7.0 or higher. diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.ir.txt new file mode 100644 index 000000000..073dd9baa --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - UpdateValue + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public void UpdateValue(int value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt new file mode 100644 index 000000000..fe537597e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; +| +Generated Location: (1638:47,7 [116] ) +| + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs new file mode 100644 index 000000000..ec733b332 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Func( + UpdateValue); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.ir.txt new file mode 100644 index 000000000..41d475b56 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - UpdateValue + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt new file mode 100644 index 000000000..ba8a97169 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1665:47,7 [144] ) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs new file mode 100644 index 000000000..787f89ba6 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs @@ -0,0 +1,56 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Func( + value => { ParentValue = value; return Task.CompletedTask; }); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.ir.txt new file mode 100644 index 000000000..37a51274c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [124] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - value => { ParentValue = value; return Task.CompletedTask; } + HtmlContent - (124:0,124 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (124:0,124 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (133:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (133:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt new file mode 100644 index 000000000..1fa7b3068 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt @@ -0,0 +1,14 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1022:25,30 [11] ) +|ParentValue| + +Source Location: (133:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1714:47,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithCulture/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithCulture/TestComponent.ir.txt index f07545a68..a53b29f50 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithCulture/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithCulture/TestComponent.ir.txt @@ -27,7 +27,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (47:1,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - , culture: CultureInfo.InvariantCulture IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.ir.txt index a8f77c4c9..538938c11 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.ir.txt @@ -27,7 +27,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (32:0,32 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.ir.txt index 5b4792da0..110d1d5d1 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.ir.txt @@ -25,7 +25,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (32:0,32 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) HtmlContent - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithCulture/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithCulture/TestComponent.ir.txt index 299fe67b0..40bf9b02a 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithCulture/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithCulture/TestComponent.ir.txt @@ -27,7 +27,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (47:1,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - anotherevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - , culture: CultureInfo.InvariantCulture IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_OverridesEvent/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_OverridesEvent/TestComponent.ir.txt index 1c39e7c11..ae0d2970b 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_OverridesEvent/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_OverridesEvent/TestComponent.ir.txt @@ -22,7 +22,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - anotherevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) HtmlContent - (67:0,67 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.ir.txt index 73f6a4cc7..4c696a2ac 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.ir.txt @@ -22,7 +22,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) HtmlContent - (34:0,34 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs new file mode 100644 index 000000000..c3e96e6ea --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs @@ -0,0 +1,47 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue), ParentValue); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.diagnostics.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.diagnostics.txt new file mode 100644 index 000000000..33089ffaa --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.diagnostics.txt @@ -0,0 +1 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,50): Error RZ10015: Attribute '@bind-value:get' must be used with attribute '@bind-value:set'. diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt new file mode 100644 index 000000000..dc9345adc --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt @@ -0,0 +1,33 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [64] x:\dir\subdir\Test\TestComponent.cshtml) - div + HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (19:0,19 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue) + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlContent - (64:0,64 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (64:0,64 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (73:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (73:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n public void UpdateValue(string value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt new file mode 100644 index 000000000..2f591a81c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (19:0,19 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (973:25,19 [11] ) +|ParentValue| + +Source Location: (73:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| +Generated Location: (1442:36,7 [124] ) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs new file mode 100644 index 000000000..ae0050a47 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs @@ -0,0 +1,54 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + __o = ParentValue; + +#line default +#line hidden +#nullable disable + __o = global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue), ParentValue); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.diagnostics.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.diagnostics.txt new file mode 100644 index 000000000..d5b6177cf --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.diagnostics.txt @@ -0,0 +1,2 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,38): Error RZ10018: Attribute 'bind' can't be used in conjunction with 'bind:get'. +x:\dir\subdir\Test\TestComponent.cshtml(1,63): Error RZ10015: Attribute '@bind:get' must be used with attribute '@bind:set'. diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt new file mode 100644 index 000000000..31c170b4c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt @@ -0,0 +1,36 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [77] x:\dir\subdir\Test\TestComponent.cshtml) - div + TagHelperDirectiveAttributeParameter - (37:0,37 [12] x:\dir\subdir\Test\TestComponent.cshtml) - bind:get - HtmlAttributeValueStyle.DoubleQuotes + CSharpExpression - (38:0,38 [11] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (38:0,38 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue) + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlContent - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (86:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (86:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n public void UpdateValue(string value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt new file mode 100644 index 000000000..93de31d63 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (38:0,38 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (906:24,38 [11] ) +|ParentValue| + +Source Location: (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1139:32,13 [11] ) +|ParentValue| + +Source Location: (86:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| +Generated Location: (1608:43,7 [124] ) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Element_WithSplatImplictExpression/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.codegen.cs similarity index 55% rename from src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Element_WithSplatImplictExpression/TestComponent.codegen.cs rename to src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.codegen.cs index 412b7925a..5cfd50ab3 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Element_WithSplatImplictExpression/TestComponent.codegen.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.codegen.cs @@ -8,7 +8,7 @@ namespace Test using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; - public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { @@ -18,32 +18,26 @@ private void __RazorDirectiveTokenHelpers__() { private static System.Object __o = null; #pragma warning restore 0414 #pragma warning disable 1998 - protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { - __o = + __o = global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" - someAttributes + ParentValue #line default #line hidden #nullable disable - ; - __o = -#nullable restore -#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" - "after" - -#line default -#line hidden -#nullable disable - ; + ); + __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue); } #pragma warning restore 1998 #nullable restore -#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" - private Dictionary someAttributes = new Dictionary(); + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; #line default #line hidden diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.diagnostics.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.diagnostics.txt new file mode 100644 index 000000000..0afd0a4e0 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.diagnostics.txt @@ -0,0 +1 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,44): Error RZ10016: Attribute 'bind-value:set' was used but no attribute 'bind-value:get' was found. diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.ir.txt new file mode 100644 index 000000000..0c8b63d10 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.ir.txt @@ -0,0 +1,33 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [58] x:\dir\subdir\Test\TestComponent.cshtml) - div + HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlContent - (58:0,58 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (58:0,58 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (67:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (67:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n public void UpdateValue(string value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.mappings.txt new file mode 100644 index 000000000..a43ef8b40 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (967:25,13 [11] ) +|ParentValue| + +Source Location: (67:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| +Generated Location: (1320:36,7 [124] ) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs new file mode 100644 index 000000000..d72073724 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs @@ -0,0 +1,48 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue).InvokeAsync(); await global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: AfterUpdate).InvokeAsync(); }, value: ParentValue), ParentValue); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; + public void AfterUpdate() { } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.diagnostics.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.diagnostics.txt new file mode 100644 index 000000000..90d2bf3bc --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.diagnostics.txt @@ -0,0 +1 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,68): Error RZ10019: Attribute 'bind:after' can not be used with 'bind:set'. Invoke the code in 'bind:after' inside 'bind:set' instead. diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt new file mode 100644 index 000000000..07024aaa7 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt @@ -0,0 +1,33 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [82] x:\dir\subdir\Test\TestComponent.cshtml) - div + HtmlAttribute - (16:0,16 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (17:0,17 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (16:0,16 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue).InvokeAsync(); await global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: AfterUpdate).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlContent - (82:0,82 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (82:0,82 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (91:1,7 [159] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (91:1,7 [159] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n public void UpdateValue(string value) => ParentValue = value;\n public void AfterUpdate() { }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt new file mode 100644 index 000000000..617b1b7c3 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt @@ -0,0 +1,20 @@ +Source Location: (17:0,17 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (971:25,17 [11] ) +|ParentValue| + +Source Location: (91:1,7 [159] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; + public void AfterUpdate() { } +| +Generated Location: (1738:36,7 [159] ) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; + public void AfterUpdate() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs new file mode 100644 index 000000000..d3daef859 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: DoSomething).InvokeAsync(); }, value: ParentValue), ParentValue); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public string ParentValue { get; set; } = "hi"; + + Task DoSomething() + { + return Task.CompletedTask; + } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt new file mode 100644 index 000000000..1078a7b86 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt @@ -0,0 +1,35 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [76] x:\dir\subdir\Test\TestComponent.cshtml) - div + HtmlContent - (68:0,68 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (68:0,68 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: DoSomething).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlContent - (76:1,6 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (76:1,6 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (85:2,7 [131] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (85:2,7 [131] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n Task DoSomething()\n {\n return Task.CompletedTask;\n }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt new file mode 100644 index 000000000..6d6041ab7 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt @@ -0,0 +1,24 @@ +Source Location: (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (975:25,21 [11] ) +|ParentValue| + +Source Location: (85:2,7 [131] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + Task DoSomething() + { + return Task.CompletedTask; + } +| +Generated Location: (1590:36,7 [131] ) +| + public string ParentValue { get; set; } = "hi"; + + Task DoSomething() + { + return Task.CompletedTask; + } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithEventAsExplicitExpression/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithEventAsExplicitExpression/TestComponent.ir.txt index cf68d913a..74f0ee504 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithEventAsExplicitExpression/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithEventAsExplicitExpression/TestComponent.ir.txt @@ -24,7 +24,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (48:1,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - =" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) HtmlContent - (100:1,70 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithEventAsExpression/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithEventAsExpression/TestComponent.ir.txt index fce90b29a..bc2141f61 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithEventAsExpression/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithEventAsExpression/TestComponent.ir.txt @@ -24,7 +24,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (48:1,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - =" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) HtmlContent - (87:1,57 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs new file mode 100644 index 000000000..abdf3d431 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: ValueChanged, value: ParentValue), ParentValue); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public string ParentValue { get; set; } = "hi"; + + Task ValueChanged(string value) + { + return Task.CompletedTask; + } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt new file mode 100644 index 000000000..cb53a16d9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt @@ -0,0 +1,35 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [79] x:\dir\subdir\Test\TestComponent.cshtml) - div + HtmlContent - (71:0,71 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (71:0,71 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + HtmlAttribute - (24:0,24 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (24:0,24 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: ValueChanged, value: ParentValue) + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlContent - (79:1,6 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (79:1,6 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (88:2,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (88:2,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n Task ValueChanged(string value)\n {\n return Task.CompletedTask;\n }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt new file mode 100644 index 000000000..dcb360bcd --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt @@ -0,0 +1,24 @@ +Source Location: (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (979:25,25 [11] ) +|ParentValue| + +Source Location: (88:2,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + Task ValueChanged(string value) + { + return Task.CompletedTask; + } +| +Generated Location: (1449:36,7 [144] ) +| + public string ParentValue { get; set; } = "hi"; + + Task ValueChanged(string value) + { + return Task.CompletedTask; + } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.ir.txt index 9a4b310c4..74850727a 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.ir.txt @@ -22,7 +22,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (18:0,18 [11] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) HtmlContent - (33:0,33 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.ir.txt index 59b0be0a0..16eb2fe23 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.ir.txt @@ -22,7 +22,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) HtmlContent - (28:0,28 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..654fac836 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs @@ -0,0 +1,67 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + int + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Action( + __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); }); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public void Update() { } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt new file mode 100644 index 000000000..f85ffaf1e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt @@ -0,0 +1,29 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [85] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - int + ComponentAttribute - (43:0,43 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (43:0,43 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (43:0,43 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); } + HtmlContent - (85:0,85 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (85:0,85 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (94:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (94:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public void Update() { }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..a16ab777b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (21:0,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) +|int| +Generated Location: (916:25,21 [3] ) +|int| + +Source Location: (43:0,43 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1207:34,43 [11] ) +|ParentValue| + +Source Location: (94:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| +Generated Location: (1949:56,7 [82] ) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..b3a829287 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,67 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + CustomValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..9b4a2f850 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -0,0 +1,31 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CustomValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..394b5e1eb --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|CustomValue| +Generated Location: (916:25,21 [11] ) +|CustomValue| + +Source Location: (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1231:34,51 [11] ) +|ParentValue| + +Source Location: (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (2168:56,7 [140] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..4d03da6f0 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs @@ -0,0 +1,68 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, + __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); }); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public void Update() { } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::System.Action __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt new file mode 100644 index 000000000..3eab3137c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt @@ -0,0 +1,30 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [72] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); } + HtmlContent - (72:0,72 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (72:0,72 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public void Update() { }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..05b7a7fe4 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1001:25,30 [11] ) +|ParentValue| + +Source Location: (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| +Generated Location: (1533:43,7 [82] ) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..c14eaa14e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,68 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..f4b4071e7 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -0,0 +1,32 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public EventCallback UpdateValue { get; set; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..ee94de2b5 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1001:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (1596:43,7 [140] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToInputElementWithDefaultCulture/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToInputElementWithDefaultCulture/TestComponent.ir.txt index 06989ddc4..d22873d24 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToInputElementWithDefaultCulture/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToInputElementWithDefaultCulture/TestComponent.ir.txt @@ -28,7 +28,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (63:1,34 [12] x:\dir\subdir\Test\TestComponent.cshtml) - anotherevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) HtmlContent - (112:1,83 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToInputElementWithDefaultCulture_Override/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToInputElementWithDefaultCulture_Override/TestComponent.ir.txt index 1f698de1c..14dc57fa6 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToInputElementWithDefaultCulture_Override/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToInputElementWithDefaultCulture_Override/TestComponent.ir.txt @@ -30,7 +30,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (63:1,34 [12] x:\dir\subdir\Test\TestComponent.cshtml) - anotherevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - , culture: CultureInfo.CurrentCulture IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_CanOverrideEvent/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_CanOverrideEvent/TestComponent.ir.txt index 3e04cf944..a99100add 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_CanOverrideEvent/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputText_CanOverrideEvent/TestComponent.ir.txt @@ -27,7 +27,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (58:1,14 [12] x:\dir\subdir\Test\TestComponent.cshtml) - oninput=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultCultureAndDefaultFormat_Override/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultCultureAndDefaultFormat_Override/TestComponent.ir.txt index a312a4ebb..6d2dd19f5 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultCultureAndDefaultFormat_Override/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultCultureAndDefaultFormat_Override/TestComponent.ir.txt @@ -29,7 +29,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (28:0,28 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd/yyyy" IntermediateToken - - CSharp - , culture: global::System.Globalization.CultureInfo.InvariantCulture diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat/TestComponent.ir.txt index 16bc17b8d..69413be93 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat/TestComponent.ir.txt @@ -27,7 +27,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (28:0,28 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat_Override/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat_Override/TestComponent.ir.txt index b5fc94060..7d10d90af 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat_Override/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat_Override/TestComponent.ir.txt @@ -27,7 +27,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (28:0,28 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd/yyyy" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix/TestComponent.ir.txt index 16e99042b..d9c9bc1bf 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix/TestComponent.ir.txt @@ -27,7 +27,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (64:1,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix_CanOverrideEvent/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix_CanOverrideEvent/TestComponent.ir.txt index 3937d7999..20f887fea 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix_CanOverrideEvent/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix_CanOverrideEvent/TestComponent.ir.txt @@ -24,7 +24,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - oninput=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.ir.txt index f6aa894a2..143bf2960 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.ir.txt @@ -22,7 +22,9 @@ Document - LazyIntermediateToken - (37:0,37 [5] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - Value ComponentAttribute - (37:0,37 [5] x:\dir\subdir\Test\TestComponent.cshtml) - ItemChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => Value = __value, Value) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => Value = __value + IntermediateToken - - CSharp - , Value) HtmlContent - (44:0,44 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (44:0,44 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n CSharpCode - (53:1,7 [21] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.ir.txt index b6e627df3..876e2df76 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.ir.txt @@ -23,7 +23,9 @@ Document - LazyIntermediateToken - (24:0,24 [5] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - Value ComponentAttribute - (24:0,24 [5] x:\dir\subdir\Test\TestComponent.cshtml) - ItemChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => Value = __value, Value) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => Value = __value + IntermediateToken - - CSharp - , Value) HtmlContent - (43:0,43 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (43:0,43 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n CSharpCode - (52:1,7 [21] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_WithCssScope/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_WithCssScope/TestComponent.ir.txt index be3ed6136..2be0850e6 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_WithCssScope/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_WithCssScope/TestComponent.ir.txt @@ -91,7 +91,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (589:13,30 [10] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => myVariable = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => myVariable = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - myVariable IntermediateToken - - CSharp - ) CSharpCode - (637:13,78 [3] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.ir.txt index a7fa31e2f..3f258ab61 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.ir.txt @@ -23,7 +23,9 @@ Document - LazyIntermediateToken - (48:0,48 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - message ComponentAttribute - (47:0,47 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageChanged - MessageChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => message = __value + IntermediateToken - - CSharp - , message) ComponentAttribute - (47:0,47 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageExpression - MessageExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => message diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.ir.txt index 4dccc4373..3aa80022f 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.ir.txt @@ -23,7 +23,9 @@ Document - LazyIntermediateToken - (59:0,59 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - message ComponentAttribute - (58:0,58 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageChanged - MessageChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => message = __value + IntermediateToken - - CSharp - , message) ComponentAttribute - (58:0,58 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageExpression - MessageExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => message diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.ir.txt index f4d88a67f..c22f7d11e 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.ir.txt @@ -23,7 +23,9 @@ Document - LazyIntermediateToken - (29:0,29 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - message ComponentAttribute - (28:0,28 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageChanged - MessageChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => message = __value + IntermediateToken - - CSharp - , message) ComponentAttribute - (28:0,28 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageExpression - MessageExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => message diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_DifferentCasing_IsAnError_BindValue/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_DifferentCasing_IsAnError_BindValue/TestComponent.ir.txt index 19278677c..27ad7d517 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_DifferentCasing_IsAnError_BindValue/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_DifferentCasing_IsAnError_BindValue/TestComponent.ir.txt @@ -34,7 +34,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (90:2,39 [5] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => text = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => text = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - text IntermediateToken - - CSharp - ) HtmlContent - (105:2,54 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindOnInput/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindOnInput/TestComponent.ir.txt index 546f5fbed..6e245411e 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindOnInput/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindOnInput/TestComponent.ir.txt @@ -36,7 +36,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (85:2,34 [5] x:\dir\subdir\Test\TestComponent.cshtml) - oninput=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => text = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => text = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - text IntermediateToken - - CSharp - ) HtmlContent - (148:2,97 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindValue/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindValue/TestComponent.ir.txt index 7df8a7965..dd7af8971 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindValue/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindValue/TestComponent.ir.txt @@ -34,7 +34,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (90:2,39 [5] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => text = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => text = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - text IntermediateToken - - CSharp - ) HtmlContent - (105:2,54 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Element_WithSplatImplictExpression/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Element_WithSplatImplictExpression/TestComponent.ir.txt deleted file mode 100644 index 9102ec0b5..000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Element_WithSplatImplictExpression/TestComponent.ir.txt +++ /dev/null @@ -1,34 +0,0 @@ -Document - - NamespaceDeclaration - - Test - UsingDirective - (3:1,1 [12] ) - System - UsingDirective - (18:2,1 [32] ) - System.Collections.Generic - UsingDirective - (53:3,1 [17] ) - System.Linq - UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks - UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components - ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Components.ComponentBase - - DesignTimeDirective - - CSharpCode - - IntermediateToken - - CSharp - #pragma warning disable 0414 - CSharpCode - - IntermediateToken - - CSharp - private static System.Object __o = null; - CSharpCode - - IntermediateToken - - CSharp - #pragma warning restore 0414 - MethodDeclaration - - protected override - void - BuildRenderTree - MarkupElement - (0:0,0 [101] x:\dir\subdir\Test\TestComponent.cshtml) - elem - HtmlContent - (89:0,89 [5] x:\dir\subdir\Test\TestComponent.cshtml) - IntermediateToken - (89:0,89 [5] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello - HtmlAttribute - - attributebefore=" - " - HtmlAttributeValue - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - - IntermediateToken - (23:0,23 [6] x:\dir\subdir\Test\TestComponent.cshtml) - Html - before - HtmlAttribute - (44:0,44 [15] x:\dir\subdir\Test\TestComponent.cshtml) - - - CSharpExpressionAttributeValue - - - IntermediateToken - (45:0,45 [14] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - someAttributes - HtmlAttribute - - attributeafter=" - " - CSharpExpressionAttributeValue - (77:0,77 [10] x:\dir\subdir\Test\TestComponent.cshtml) - - IntermediateToken - (79:0,79 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "after" - HtmlContent - (101:0,101 [4] x:\dir\subdir\Test\TestComponent.cshtml) - IntermediateToken - (101:0,101 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n - HtmlContent - (206:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - IntermediateToken - (206:4,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n - CSharpCode - (112:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - IntermediateToken - (112:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private Dictionary someAttributes = new Dictionary();\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Element_WithSplatImplictExpression/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Element_WithSplatImplictExpression/TestComponent.mappings.txt deleted file mode 100644 index 50bff7758..000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Element_WithSplatImplictExpression/TestComponent.mappings.txt +++ /dev/null @@ -1,19 +0,0 @@ -Source Location: (45:0,45 [14] x:\dir\subdir\Test\TestComponent.cshtml) -|someAttributes| -Generated Location: (908:25,45 [14] ) -|someAttributes| - -Source Location: (79:0,79 [7] x:\dir\subdir\Test\TestComponent.cshtml) -|"after"| -Generated Location: (1158:34,79 [7] ) -|"after"| - -Source Location: (112:2,7 [93] x:\dir\subdir\Test\TestComponent.cshtml) -| - private Dictionary someAttributes = new Dictionary(); -| -Generated Location: (1358:44,7 [93] ) -| - private Dictionary someAttributes = new Dictionary(); -| - diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..b21bfc9e9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,77 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + TParam + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..90a5ddb3a --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -0,0 +1,32 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..1a08445a5 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,28 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (1143:35,21 [6] ) +|TParam| + +Source Location: (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1443:44,46 [11] ) +|ParentValue| + +Source Location: (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (2370:66,7 [120] ) +| + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..cda55e41e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs @@ -0,0 +1,77 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + TParam + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Action( + __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); }); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } + + public void Update() { } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt new file mode 100644 index 000000000..a73d5c79a --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt @@ -0,0 +1,30 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [88] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); } + HtmlContent - (107:1,88 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (107:1,88 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (116:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (116:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; }\n\n public void Update() { }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..595dd57ae --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt @@ -0,0 +1,28 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (1143:35,21 [6] ) +|TParam| + +Source Location: (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1443:44,46 [11] ) +|ParentValue| + +Source Location: (116:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } + + public void Update() { } +| +Generated Location: (2188:66,7 [79] ) +| + public TParam ParentValue { get; set; } + + public void Update() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..49ab855b6 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs @@ -0,0 +1,78 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, + __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); }); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } + + public void Update() { } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::System.Action __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt new file mode 100644 index 000000000..bcd19fe87 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt @@ -0,0 +1,31 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [72] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); } + HtmlContent - (91:1,72 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (91:1,72 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (100:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (100:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; }\n\n public void Update() { }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..d4d73911d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1228:35,30 [11] ) +|ParentValue| + +Source Location: (100:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } + + public void Update() { } +| +Generated Location: (1760:53,7 [79] ) +| + public TParam ParentValue { get; set; } + + public void Update() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..c0cca4047 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,78 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static System.Object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..2a9526e96 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -0,0 +1,33 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [12] ) - System + UsingDirective - (18:2,1 [32] ) - System.Collections.Generic + UsingDirective - (53:3,1 [17] ) - System.Linq + UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static System.Object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public EventCallback UpdateValue { get; set; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..dac382f49 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1228:35,30 [11] ) +|ParentValue| + +Source Location: (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (1823:53,7 [120] ) +| + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_597/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_597/TestComponent.ir.txt index 12d8110f3..ec9b4b0a4 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_597/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_597/TestComponent.ir.txt @@ -20,7 +20,9 @@ Document - LazyIntermediateToken - (18:0,18 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - y ComponentAttribute - (18:0,18 [1] x:\dir\subdir\Test\TestComponent.cshtml) - vChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => y = __value, y) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => y = __value + IntermediateToken - - CSharp - , y) HtmlContent - (23:0,23 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (23:0,23 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n HtmlContent - (57:3,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_609/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_609/TestComponent.ir.txt index a0c578fc0..05908cc6e 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_609/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Regression_609/TestComponent.ir.txt @@ -20,13 +20,17 @@ Document - LazyIntermediateToken - (19:0,19 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - UserName ComponentAttribute - (18:0,18 [9] x:\dir\subdir\Test\TestComponent.cshtml) - NameChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => UserName = __value, UserName) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => UserName = __value + IntermediateToken - - CSharp - , UserName) ComponentAttribute - (45:0,45 [13] x:\dir\subdir\Test\TestComponent.cshtml) - IsActive - - AttributeStructure.DoubleQuotes CSharpExpression - LazyIntermediateToken - (46:0,46 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - UserIsActive ComponentAttribute - (45:0,45 [13] x:\dir\subdir\Test\TestComponent.cshtml) - IsActiveChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => UserIsActive = __value, UserIsActive) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => UserIsActive = __value + IntermediateToken - - CSharp - , UserIsActive) HtmlContent - (62:0,62 [4] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (62:0,62 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n HtmlContent - (162:5,1 [2] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.ir.txt index c015eaa27..af01968d8 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.ir.txt @@ -13,7 +13,9 @@ Document - LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueExpression - ValueExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => ParentValue diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.ir.txt index c4ed3a8b9..45e62c5a0 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_Generic/TestComponent.ir.txt @@ -13,7 +13,9 @@ Document - LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamChanged - SomeParamChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamExpression - SomeParamExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => ParentValue diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_NestedGeneric/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_NestedGeneric/TestComponent.ir.txt index 54585cf84..87bffa8a1 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_NestedGeneric/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression_NestedGeneric/TestComponent.ir.txt @@ -13,7 +13,9 @@ Document - LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamChanged - SomeParamChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - SomeParamExpression - SomeParamExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => ParentValue diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.ir.txt index 79fdeabc6..b75ec7eed 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.ir.txt @@ -13,6 +13,8 @@ Document - LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) CSharpCode - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.ir.txt index dd8e73e84..aec6490ed 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_TypeChecked_WithMatchingProperties/TestComponent.ir.txt @@ -13,6 +13,8 @@ Document - LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) CSharpCode - (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "42";\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.ir.txt index c5205de2b..010d4c247 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.ir.txt @@ -13,6 +13,8 @@ Document - LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - OnChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) CSharpCode - (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.ir.txt index 2045e2f59..2b7fb6405 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.ir.txt @@ -13,6 +13,8 @@ Document - LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , ParentValue) CSharpCode - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..f3b492d17 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Action)(__value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); })); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public void Update() { } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.ir.txt new file mode 100644 index 000000000..5654e78b1 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.ir.txt @@ -0,0 +1,18 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [72] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); } + CSharpCode - (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public void Update() { }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..8135f3040 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| +Generated Location: (1338:31,7 [82] ) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs new file mode 100644 index 000000000..63c1343c4 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs @@ -0,0 +1,40 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Action)(__value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(() => { }); })); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.ir.txt new file mode 100644 index 000000000..878d9ea11 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.ir.txt @@ -0,0 +1,18 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(() => { }); } + CSharpCode - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt new file mode 100644 index 000000000..704c75161 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt @@ -0,0 +1,9 @@ +Source Location: (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1341:31,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs new file mode 100644 index 000000000..ee851dc36 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs @@ -0,0 +1,40 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Action)((value => { ParentValue = value; return Task.CompletedTask; }))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.ir.txt new file mode 100644 index 000000000..7aa8a5072 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.ir.txt @@ -0,0 +1,18 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [126] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - (value => { ParentValue = value; return Task.CompletedTask; }) + CSharpCode - (135:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (135:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt new file mode 100644 index 000000000..7b3d6713e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt @@ -0,0 +1,9 @@ +Source Location: (135:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1256:31,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..177efc27b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue), ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..d08ff8458 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [77] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..a9f99d1f9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (1827:31,7 [104] ) +| + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs new file mode 100644 index 000000000..b4df1c8eb --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs @@ -0,0 +1,40 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: () => { }).InvokeAsync(); }, value: ParentValue), ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt new file mode 100644 index 000000000..8ef052b4b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: () => { }).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt new file mode 100644 index 000000000..4af886e41 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt @@ -0,0 +1,9 @@ +Source Location: (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1825:31,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs new file mode 100644 index 000000000..97526fe14 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue), ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public Task UpdateValue() => Task.CompletedTask; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt new file mode 100644 index 000000000..18ff54c41 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [77] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (86:1,7 [106] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (86:1,7 [106] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public Task UpdateValue() => Task.CompletedTask;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt new file mode 100644 index 000000000..6f73b7dc1 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (86:1,7 [106] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue() => Task.CompletedTask; +| +Generated Location: (1827:31,7 [106] ) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue() => Task.CompletedTask; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs new file mode 100644 index 000000000..47e51c471 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Func)(async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(Update); })); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public Task Update() => Task.CompletedTask; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.ir.txt new file mode 100644 index 000000000..2095a9f65 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.ir.txt @@ -0,0 +1,18 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [72] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(Update); } + CSharpCode - (81:1,7 [101] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (81:1,7 [101] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public Task Update() => Task.CompletedTask;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt new file mode 100644 index 000000000..5b61d456e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (81:1,7 [101] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public Task Update() => Task.CompletedTask; +| +Generated Location: (1378:31,7 [101] ) +| + public int ParentValue { get; set; } = 42; + + public Task Update() => Task.CompletedTask; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs new file mode 100644 index 000000000..bc68a0b7d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs @@ -0,0 +1,40 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Func)(async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(() => { return Task.CompletedTask; }); })); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.ir.txt new file mode 100644 index 000000000..4d6587422 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.ir.txt @@ -0,0 +1,18 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [102] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(() => { return Task.CompletedTask; }); } + CSharpCode - (111:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (111:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt new file mode 100644 index 000000000..82696bec9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt @@ -0,0 +1,9 @@ +Source Location: (111:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1408:31,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..8b4cd7490 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Action)(UpdateValue)); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 000000000..11abda08c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,18 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - UpdateValue + CSharpCode - (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public void UpdateValue(int value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..25810998e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; +| +Generated Location: (1205:31,7 [116] ) +| + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs new file mode 100644 index 000000000..63e0971b1 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs @@ -0,0 +1,40 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Action)(value => ParentValue = value)); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.ir.txt new file mode 100644 index 000000000..66284cced --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.ir.txt @@ -0,0 +1,18 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [92] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - value => ParentValue = value + CSharpCode - (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt new file mode 100644 index 000000000..89a142c61 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt @@ -0,0 +1,9 @@ +Source Location: (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1222:31,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..84fb66772 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..f0ad6a1c2 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..b5f0f6c8d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (1544:31,7 [109] ) +| + public int ParentValue { get; set; } = 42; + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.codegen.cs new file mode 100644 index 000000000..c6a2f0191 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.codegen.cs @@ -0,0 +1,40 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, value => ParentValue = value, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.ir.txt new file mode 100644 index 000000000..159c6c183 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [92] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - value => ParentValue = value + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.mappings.txt new file mode 100644 index 000000000..514906b92 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.mappings.txt @@ -0,0 +1,9 @@ +Source Location: (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1561:31,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.codegen.cs new file mode 100644 index 000000000..867d317bc --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.ir.txt new file mode 100644 index 000000000..c3aaf5e0d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.mappings.txt new file mode 100644 index 000000000..472b7d18b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1544:31,7 [144] ) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs new file mode 100644 index 000000000..8b4cd7490 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Action)(UpdateValue)); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.diagnostics.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.diagnostics.txt new file mode 100644 index 000000000..37f16c4b0 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.diagnostics.txt @@ -0,0 +1 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,31): Error RZ10020: Attribute 'bind-Value:get' can only be used with RazorLanguageVersion 7.0 or higher. diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.ir.txt new file mode 100644 index 000000000..11abda08c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.ir.txt @@ -0,0 +1,18 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - UpdateValue + CSharpCode - (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public void UpdateValue(int value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt new file mode 100644 index 000000000..25810998e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; +| +Generated Location: (1205:31,7 [116] ) +| + public int ParentValue { get; set; } = 42; + + public void UpdateValue(int value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs new file mode 100644 index 000000000..665a822a9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Func)(UpdateValue)); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.ir.txt new file mode 100644 index 000000000..5d14f2a99 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.ir.txt @@ -0,0 +1,18 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - UpdateValue + CSharpCode - (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt new file mode 100644 index 000000000..d8fc489a8 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1232:31,7 [144] ) +| + public int ParentValue { get; set; } = 42; + + public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs new file mode 100644 index 000000000..b4b19ac0c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs @@ -0,0 +1,40 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Func)(value => { ParentValue = value; return Task.CompletedTask; })); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.ir.txt new file mode 100644 index 000000000..42840198e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.ir.txt @@ -0,0 +1,18 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [124] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - value => { ParentValue = value; return Task.CompletedTask; } + CSharpCode - (133:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (133:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt new file mode 100644 index 000000000..21addfc02 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt @@ -0,0 +1,9 @@ +Source Location: (133:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1281:31,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithCulture/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithCulture/TestComponent.ir.txt index 111837dcd..b818ce55c 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithCulture/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithCulture/TestComponent.ir.txt @@ -18,7 +18,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (47:1,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - , culture: CultureInfo.InvariantCulture IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.ir.txt index be8083f1c..197aca5a6 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.ir.txt @@ -20,7 +20,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (32:0,32 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.ir.txt index 22d37a669..6c7f7c991 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.ir.txt @@ -18,7 +18,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (32:0,32 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) CSharpCode - (86:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithCulture/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithCulture/TestComponent.ir.txt index be36f3585..37d707216 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithCulture/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithCulture/TestComponent.ir.txt @@ -18,7 +18,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (47:1,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - anotherevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - , culture: CultureInfo.InvariantCulture IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_OverridesEvent/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_OverridesEvent/TestComponent.ir.txt index 001abce27..42fee1611 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_OverridesEvent/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_OverridesEvent/TestComponent.ir.txt @@ -15,7 +15,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - anotherevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) CSharpCode - (76:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.ir.txt index 1c3afc063..954d3ac59 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.ir.txt @@ -15,7 +15,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) CSharpCode - (43:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs new file mode 100644 index 000000000..8ad953adf --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs @@ -0,0 +1,43 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenElement(0, "div"); + __builder.AddAttribute(1, "myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue), ParentValue)); + __builder.SetUpdatesAttributeName("myvalue"); + __builder.CloseElement(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.diagnostics.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.diagnostics.txt new file mode 100644 index 000000000..33089ffaa --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.diagnostics.txt @@ -0,0 +1 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,50): Error RZ10015: Attribute '@bind-value:get' must be used with attribute '@bind-value:set'. diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt new file mode 100644 index 000000000..c34e4887d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt @@ -0,0 +1,24 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [64] x:\dir\subdir\Test\TestComponent.cshtml) - div + HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (19:0,19 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue) + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + CSharpCode - (73:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (73:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n public void UpdateValue(string value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt new file mode 100644 index 000000000..bcdcdec4f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (73:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| +Generated Location: (1382:32,7 [124] ) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs new file mode 100644 index 000000000..baff0c05d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenElement(0, "div"); + __builder.AddAttribute(1, "myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue), ParentValue)); + __builder.SetUpdatesAttributeName("myvalue"); +#nullable restore +#line (1,39)-(1,50) 24 "x:\dir\subdir\Test\TestComponent.cshtml" +__builder.AddContent(3, ParentValue); + +#line default +#line hidden +#nullable disable + __builder.CloseElement(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.diagnostics.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.diagnostics.txt new file mode 100644 index 000000000..d5b6177cf --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.diagnostics.txt @@ -0,0 +1,2 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,38): Error RZ10018: Attribute 'bind' can't be used in conjunction with 'bind:get'. +x:\dir\subdir\Test\TestComponent.cshtml(1,63): Error RZ10015: Attribute '@bind:get' must be used with attribute '@bind:set'. diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt new file mode 100644 index 000000000..e647ba231 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [77] x:\dir\subdir\Test\TestComponent.cshtml) - div + TagHelperDirectiveAttributeParameter - (37:0,37 [12] x:\dir\subdir\Test\TestComponent.cshtml) - bind:get - HtmlAttributeValueStyle.DoubleQuotes + CSharpExpression - (38:0,38 [11] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (38:0,38 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue) + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + CSharpCode - (86:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (86:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n public void UpdateValue(string value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt new file mode 100644 index 000000000..9fae1fac0 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (86:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| +Generated Location: (1550:39,7 [124] ) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.codegen.cs new file mode 100644 index 000000000..a7b078b5b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.codegen.cs @@ -0,0 +1,43 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenElement(0, "div"); + __builder.AddAttribute(1, "myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)); + __builder.SetUpdatesAttributeName("myvalue"); + __builder.CloseElement(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.diagnostics.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.diagnostics.txt new file mode 100644 index 000000000..0afd0a4e0 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.diagnostics.txt @@ -0,0 +1 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,44): Error RZ10016: Attribute 'bind-value:set' was used but no attribute 'bind-value:get' was found. diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.ir.txt new file mode 100644 index 000000000..e6c11d0c8 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.ir.txt @@ -0,0 +1,24 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [58] x:\dir\subdir\Test\TestComponent.cshtml) - div + HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + CSharpCode - (67:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (67:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n public void UpdateValue(string value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.mappings.txt new file mode 100644 index 000000000..08f055fc6 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindWithoutSuffixAndParamBindSetWithSuffix/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (67:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| +Generated Location: (1260:32,7 [124] ) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs new file mode 100644 index 000000000..1acaefc38 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs @@ -0,0 +1,44 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenElement(0, "div"); + __builder.AddAttribute(1, "myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue).InvokeAsync(); await global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: AfterUpdate).InvokeAsync(); }, value: ParentValue), ParentValue)); + __builder.SetUpdatesAttributeName("myvalue"); + __builder.CloseElement(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; + public void AfterUpdate() { } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.diagnostics.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.diagnostics.txt new file mode 100644 index 000000000..90d2bf3bc --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.diagnostics.txt @@ -0,0 +1 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,68): Error RZ10019: Attribute 'bind:after' can not be used with 'bind:set'. Invoke the code in 'bind:after' inside 'bind:set' instead. diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt new file mode 100644 index 000000000..ab5cbb159 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt @@ -0,0 +1,24 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [82] x:\dir\subdir\Test\TestComponent.cshtml) - div + HtmlAttribute - (16:0,16 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (17:0,17 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (16:0,16 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue).InvokeAsync(); await global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: AfterUpdate).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + CSharpCode - (91:1,7 [159] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (91:1,7 [159] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n public void UpdateValue(string value) => ParentValue = value;\n public void AfterUpdate() { }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt new file mode 100644 index 000000000..8d6028113 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt @@ -0,0 +1,15 @@ +Source Location: (91:1,7 [159] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; + public void AfterUpdate() { } +| +Generated Location: (1678:32,7 [159] ) +| + public string ParentValue { get; set; } = "hi"; + + public void UpdateValue(string value) => ParentValue = value; + public void AfterUpdate() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_StartEndTag/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_StartEndTag/TestComponent.mappings.txt deleted file mode 100644 index 6ed1154bc..000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_StartEndTag/TestComponent.mappings.txt +++ /dev/null @@ -1,9 +0,0 @@ -Source Location: (45:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) -| - public string ParentValue { get; set; } = "hi"; -| -Generated Location: (932:30,7 [55] ) -| - public string ParentValue { get; set; } = "hi"; -| - diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs new file mode 100644 index 000000000..827d8a220 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenElement(0, "div"); + __builder.AddAttribute(1, "myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: DoSomething).InvokeAsync(); }, value: ParentValue), ParentValue)); + __builder.SetUpdatesAttributeName("myvalue"); + __builder.CloseElement(); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public string ParentValue { get; set; } = "hi"; + + Task DoSomething() + { + return Task.CompletedTask; + } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt new file mode 100644 index 000000000..a0fd4e682 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt @@ -0,0 +1,24 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [76] x:\dir\subdir\Test\TestComponent.cshtml) - div + HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: DoSomething).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + CSharpCode - (85:2,7 [131] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (85:2,7 [131] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n Task DoSomething()\n {\n return Task.CompletedTask;\n }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt new file mode 100644 index 000000000..be455fc79 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt @@ -0,0 +1,19 @@ +Source Location: (85:2,7 [131] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + Task DoSomething() + { + return Task.CompletedTask; + } +| +Generated Location: (1530:32,7 [131] ) +| + public string ParentValue { get; set; } = "hi"; + + Task DoSomething() + { + return Task.CompletedTask; + } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithEventAsExplicitExpression/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithEventAsExplicitExpression/TestComponent.ir.txt index 0bd40bac9..353cebbf0 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithEventAsExplicitExpression/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithEventAsExplicitExpression/TestComponent.ir.txt @@ -17,7 +17,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (48:1,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - =" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) CSharpCode - (109:2,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithEventAsExpression/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithEventAsExpression/TestComponent.ir.txt index ca784e306..5780379e3 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithEventAsExpression/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithEventAsExpression/TestComponent.ir.txt @@ -17,7 +17,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (48:1,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - =" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) CSharpCode - (96:2,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs new file mode 100644 index 000000000..53e1f4a82 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenElement(0, "div"); + __builder.AddAttribute(1, "myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: ValueChanged, value: ParentValue), ParentValue)); + __builder.SetUpdatesAttributeName("myvalue"); + __builder.CloseElement(); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public string ParentValue { get; set; } = "hi"; + + Task ValueChanged(string value) + { + return Task.CompletedTask; + } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt new file mode 100644 index 000000000..bbbedfe59 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt @@ -0,0 +1,24 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + MarkupElement - (0:0,0 [79] x:\dir\subdir\Test\TestComponent.cshtml) - div + HtmlAttribute - (24:0,24 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myvalue=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( + LazyIntermediateToken - (25:0,25 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + IntermediateToken - - CSharp - ) + HtmlAttribute - (24:0,24 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " + CSharpExpressionAttributeValue - - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: ValueChanged, value: ParentValue) + IntermediateToken - - CSharp - , + IntermediateToken - - CSharp - ParentValue + IntermediateToken - - CSharp - ) + CSharpCode - (88:2,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (88:2,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string ParentValue { get; set; } = "hi";\n\n Task ValueChanged(string value)\n {\n return Task.CompletedTask;\n }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt new file mode 100644 index 000000000..fed5b9609 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt @@ -0,0 +1,19 @@ +Source Location: (88:2,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) +| + public string ParentValue { get; set; } = "hi"; + + Task ValueChanged(string value) + { + return Task.CompletedTask; + } +| +Generated Location: (1389:32,7 [144] ) +| + public string ParentValue { get; set; } = "hi"; + + Task ValueChanged(string value) + { + return Task.CompletedTask; + } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.ir.txt index 4944584b0..42d4cb08d 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.ir.txt @@ -15,7 +15,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (18:0,18 [11] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) CSharpCode - (42:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.ir.txt index 74751a555..8a1debd24 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.ir.txt @@ -15,7 +15,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) CSharpCode - (37:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..cc3ad96a8 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Action)(__value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); })); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public void Update() { } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt new file mode 100644 index 000000000..e5fe73e4b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [85] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [3] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - int + ComponentAttribute - (43:0,43 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (43:0,43 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (43:0,43 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); } + CSharpCode - (94:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (94:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public void Update() { }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..5695b67eb --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (94:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| +Generated Location: (1330:31,7 [82] ) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..b23ea6186 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..649e9ffee --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -0,0 +1,22 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CustomValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..95784a6d0 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (1551:31,7 [140] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..410a07f61 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); }); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + + public void Update() { } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::System.Action __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt new file mode 100644 index 000000000..124e318b8 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt @@ -0,0 +1,21 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [72] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); } + CSharpCode - (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public void Update() { }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..b3bfc4704 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| +Generated Location: (1085:28,7 [82] ) +| + public int ParentValue { get; set; } = 42; + + public void Update() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..398fc4b19 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..6c64a686c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -0,0 +1,23 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public EventCallback UpdateValue { get; set; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..6b9fc8079 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (1148:28,7 [140] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToInputElementWithDefaultCulture/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToInputElementWithDefaultCulture/TestComponent.ir.txt index 332f5d09e..4a6580537 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToInputElementWithDefaultCulture/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToInputElementWithDefaultCulture/TestComponent.ir.txt @@ -19,7 +19,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (63:1,34 [12] x:\dir\subdir\Test\TestComponent.cshtml) - anotherevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) CSharpCode - (121:2,7 [44] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToInputElementWithDefaultCulture_Override/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToInputElementWithDefaultCulture_Override/TestComponent.ir.txt index 41209c989..b72916186 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToInputElementWithDefaultCulture_Override/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToInputElementWithDefaultCulture_Override/TestComponent.ir.txt @@ -21,7 +21,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (63:1,34 [12] x:\dir\subdir\Test\TestComponent.cshtml) - anotherevent=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => ParentValue = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - , culture: CultureInfo.CurrentCulture IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_CanOverrideEvent/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_CanOverrideEvent/TestComponent.ir.txt index 493504cd6..c59f56929 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_CanOverrideEvent/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputText_CanOverrideEvent/TestComponent.ir.txt @@ -18,7 +18,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (58:1,14 [12] x:\dir\subdir\Test\TestComponent.cshtml) - oninput=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultCultureAndDefaultFormat_Override/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultCultureAndDefaultFormat_Override/TestComponent.ir.txt index 138ab3f68..b4c6f36b6 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultCultureAndDefaultFormat_Override/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultCultureAndDefaultFormat_Override/TestComponent.ir.txt @@ -22,7 +22,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (28:0,28 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd/yyyy" IntermediateToken - - CSharp - , culture: global::System.Globalization.CultureInfo.InvariantCulture diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat/TestComponent.ir.txt index da99767ad..efe33321d 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat/TestComponent.ir.txt @@ -20,7 +20,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (28:0,28 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat_Override/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat_Override/TestComponent.ir.txt index 2f237e863..455668136 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat_Override/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithDefaultFormat_Override/TestComponent.ir.txt @@ -20,7 +20,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (28:0,28 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd/yyyy" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix/TestComponent.ir.txt index 3326d1424..d25cdd864 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix/TestComponent.ir.txt @@ -18,7 +18,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (64:1,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix_CanOverrideEvent/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix_CanOverrideEvent/TestComponent.ir.txt index 882c91a05..1017f5af1 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix_CanOverrideEvent/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BuiltIn_BindToInputWithSuffix_CanOverrideEvent/TestComponent.ir.txt @@ -17,7 +17,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - oninput=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => CurrentDate = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - CurrentDate IntermediateToken - - CSharp - , format: "MM/dd" IntermediateToken - - CSharp - ) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.ir.txt index bdb3d3b59..c00a617cb 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped/TestComponent.ir.txt @@ -15,6 +15,8 @@ Document - LazyIntermediateToken - (37:0,37 [5] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - Value ComponentAttribute - (37:0,37 [5] x:\dir\subdir\Test\TestComponent.cshtml) - ItemChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => Value = __value, Value) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => Value = __value + IntermediateToken - - CSharp - , Value) CSharpCode - (53:1,7 [21] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (53:1,7 [21] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n string Value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.ir.txt index 3b774af48..ede98a79d 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_GenericBindWeaklyTyped_TypeInference/TestComponent.ir.txt @@ -16,7 +16,9 @@ Document - LazyIntermediateToken - (24:0,24 [5] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - Value ComponentAttribute - (24:0,24 [5] x:\dir\subdir\Test\TestComponent.cshtml) - ItemChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => Value = __value, Value) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => Value = __value + IntermediateToken - - CSharp - , Value) CSharpCode - (52:1,7 [21] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (52:1,7 [21] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n string Value;\n NamespaceDeclaration - - __Blazor.Test.TestComponent diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.ir.txt index dc6f5578b..e6eda3f6c 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithCssScope/TestComponent.ir.txt @@ -49,7 +49,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (589:13,30 [10] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => myVariable = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => myVariable = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - myVariable IntermediateToken - - CSharp - ) HtmlAttribute - - TestCssScope - diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.ir.txt index 17b0ba586..cca299c05 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.ir.txt @@ -16,7 +16,9 @@ Document - LazyIntermediateToken - (48:0,48 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - message ComponentAttribute - (47:0,47 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageChanged - MessageChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => message = __value + IntermediateToken - - CSharp - , message) ComponentAttribute - (47:0,47 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageExpression - MessageExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => message diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.ir.txt index a515250cf..9218e903b 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.ir.txt @@ -16,7 +16,9 @@ Document - LazyIntermediateToken - (59:0,59 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - message ComponentAttribute - (58:0,58 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageChanged - MessageChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => message = __value + IntermediateToken - - CSharp - , message) ComponentAttribute - (58:0,58 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageExpression - MessageExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => message diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.ir.txt index 21c25b2da..cfcec4f31 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.ir.txt @@ -16,7 +16,9 @@ Document - LazyIntermediateToken - (29:0,29 [7] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - message ComponentAttribute - (28:0,28 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageChanged - MessageChanged - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => message = __value + IntermediateToken - - CSharp - , message) ComponentAttribute - (28:0,28 [8] x:\dir\subdir\Test\TestComponent.cshtml) - MessageExpression - MessageExpression - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - () => message diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_DifferentCasing_IsAnError_BindValue/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_DifferentCasing_IsAnError_BindValue/TestComponent.ir.txt index d664170d7..758de1b45 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_DifferentCasing_IsAnError_BindValue/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_DifferentCasing_IsAnError_BindValue/TestComponent.ir.txt @@ -23,7 +23,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (90:2,39 [5] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => text = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => text = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - text IntermediateToken - - CSharp - ) CSharpCode - (127:4,12 [35] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindOnInput/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindOnInput/TestComponent.ir.txt index 7600964cf..7894be672 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindOnInput/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindOnInput/TestComponent.ir.txt @@ -25,7 +25,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (85:2,34 [5] x:\dir\subdir\Test\TestComponent.cshtml) - oninput=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => text = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => text = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - text IntermediateToken - - CSharp - ) CSharpCode - (170:4,12 [35] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindValue/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindValue/TestComponent.ir.txt index fd41b818e..4a4e36c47 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindValue/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateMarkupAttributes_IsAnError_BindValue/TestComponent.ir.txt @@ -23,7 +23,9 @@ Document - IntermediateToken - - CSharp - ) HtmlAttribute - (90:2,39 [5] x:\dir\subdir\Test\TestComponent.cshtml) - onchange=" - " CSharpExpressionAttributeValue - - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => text = __value, + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, + IntermediateToken - - CSharp - __value => text = __value + IntermediateToken - - CSharp - , IntermediateToken - - CSharp - text IntermediateToken - - CSharp - ) CSharpCode - (127:4,12 [35] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..18d4a01c9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..00dda9fbf --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -0,0 +1,22 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..fd9ab4215 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (1534:31,7 [120] ) +| + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..3d99bb148 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", (global::System.Action)(__value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); })); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } + + public void Update() { } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt new file mode 100644 index 000000000..145c23ba4 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [88] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); } + CSharpCode - (116:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (116:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; }\n\n public void Update() { }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..978b33d5f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (116:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } + + public void Update() { } +| +Generated Location: (1350:31,7 [79] ) +| + public TParam ParentValue { get; set; } + + public void Update() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs new file mode 100644 index 000000000..04182db2f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); }); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } + + public void Update() { } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::System.Action __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt new file mode 100644 index 000000000..14fa5b3a6 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.ir.txt @@ -0,0 +1,21 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [72] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(Update); } + CSharpCode - (100:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (100:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; }\n\n public void Update() { }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt new file mode 100644 index 000000000..0b2c3090f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithAfter_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (100:2,7 [79] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } + + public void Update() { } +| +Generated Location: (1093:28,7 [79] ) +| + public TParam ParentValue { get; set; } + + public void Update() { } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs new file mode 100644 index 000000000..0ee61ee1a --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line hidden + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using Microsoft.AspNetCore.Components; + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt new file mode 100644 index 000000000..685c03a36 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -0,0 +1,23 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [14] ) - System + UsingDirective - (18:2,1 [34] ) - System.Collections.Generic + UsingDirective - (53:3,1 [19] ) - System.Linq + UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks + UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public EventCallback UpdateValue { get; set; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt new file mode 100644 index 000000000..172dd783a --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } +| +Generated Location: (1156:28,7 [120] ) +| + public TParam ParentValue { get; set; } = default; + + public EventCallback UpdateValue { get; set; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.ir.txt index 76e1eafdc..f074fa5c9 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_597/TestComponent.ir.txt @@ -13,6 +13,8 @@ Document - LazyIntermediateToken - (18:0,18 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - y ComponentAttribute - (18:0,18 [1] x:\dir\subdir\Test\TestComponent.cshtml) - vChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => y = __value, y) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => y = __value + IntermediateToken - - CSharp - , y) CSharpCode - (32:1,7 [24] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (32:1,7 [24] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n string y = null;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.ir.txt index d540e3cc9..7a0083580 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.ir.txt +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Regression_609/TestComponent.ir.txt @@ -13,12 +13,16 @@ Document - LazyIntermediateToken - (19:0,19 [8] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - UserName ComponentAttribute - (18:0,18 [9] x:\dir\subdir\Test\TestComponent.cshtml) - NameChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => UserName = __value, UserName) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => UserName = __value + IntermediateToken - - CSharp - , UserName) ComponentAttribute - (45:0,45 [13] x:\dir\subdir\Test\TestComponent.cshtml) - IsActive - - AttributeStructure.DoubleQuotes CSharpExpression - LazyIntermediateToken - (46:0,46 [12] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - UserIsActive ComponentAttribute - (45:0,45 [13] x:\dir\subdir\Test\TestComponent.cshtml) - IsActiveChanged - - AttributeStructure.DoubleQuotes CSharpExpression - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => UserIsActive = __value, UserIsActive) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => UserIsActive = __value + IntermediateToken - - CSharp - , UserIsActive) CSharpCode - (73:2,7 [88] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (73:2,7 [88] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public string UserName { get; set; }\n public bool UserIsActive { get; set; }\n diff --git a/src/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs b/src/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs index 3af01dd16..d0efb3cde 100644 --- a/src/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs +++ b/src/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using System.Linq; using Microsoft.AspNetCore.Razor.Language; @@ -109,7 +110,7 @@ public void Execute(TagHelperDescriptorProviderContext context) return; } - // Tag Helper defintion for case #1. This is the most general case. + // Tag Helper definition for case #1. This is the most general case. context.Results.Add(CreateFallbackBindTagHelper()); // For case #2 & #3 we have a whole bunch of attribute entries on BindMethods that we can use @@ -198,6 +199,35 @@ private TagHelperDescriptor CreateFallbackBindTagHelper() parameter.SetPropertyName("Culture"); }); + + attribute.BindAttributeParameter(parameter => + { + parameter.Name = "get"; + parameter.TypeName = typeof(object).FullName; + parameter.Documentation = ComponentResources.BindTagHelper_Element_Get_Documentation; + + parameter.SetPropertyName("Get"); + + parameter.SetBindAttributeGetSet(); + }); + + attribute.BindAttributeParameter(parameter => + { + parameter.Name = "set"; + parameter.TypeName = typeof(Delegate).FullName; + parameter.Documentation = ComponentResources.BindTagHelper_Element_Set_Documentation; + + parameter.SetPropertyName("Set"); + }); + + attribute.BindAttributeParameter(parameter => + { + parameter.Name = "after"; + parameter.TypeName = typeof(Delegate).FullName; + parameter.Documentation = ComponentResources.BindTagHelper_Element_After_Documentation; + + parameter.SetPropertyName("After"); + }); }); return builder.Build(); @@ -366,6 +396,35 @@ private List CreateElementBindTagHelpers(List + { + rule.TagName = entry.Element; + if (entry.TypeAttribute != null) + { + rule.Attribute(a => + { + a.Name = "type"; + a.NameComparisonMode = RequiredAttributeDescriptor.NameComparisonMode.FullMatch; + a.Value = entry.TypeAttribute; + a.ValueComparisonMode = RequiredAttributeDescriptor.ValueComparisonMode.FullMatch; + }); + } + + rule.Attribute(a => + { + a.Name = $"{attributeName}:get"; + a.NameComparisonMode = RequiredAttributeDescriptor.NameComparisonMode.FullMatch; + a.Metadata[ComponentMetadata.Common.DirectiveAttribute] = bool.TrueString; + }); + + rule.Attribute(a => + { + a.Name = $"{attributeName}:set"; + a.NameComparisonMode = RequiredAttributeDescriptor.NameComparisonMode.FullMatch; + a.Metadata[ComponentMetadata.Common.DirectiveAttribute] = bool.TrueString; + }); + }); + builder.BindAttribute(a => { a.Metadata[ComponentMetadata.Common.DirectiveAttribute] = bool.TrueString; @@ -408,6 +467,34 @@ private List CreateElementBindTagHelpers(List + { + parameter.Name = "get"; + parameter.TypeName = typeof(object).FullName; + parameter.Documentation = ComponentResources.BindTagHelper_Element_Get_Documentation; + + parameter.SetPropertyName("Get"); + parameter.SetBindAttributeGetSet(); + }); + + a.BindAttributeParameter(parameter => + { + parameter.Name = "set"; + parameter.TypeName = typeof(Delegate).FullName; + parameter.Documentation = ComponentResources.BindTagHelper_Element_Set_Documentation; + + parameter.SetPropertyName("Set"); + }); + + a.BindAttributeParameter(parameter => + { + parameter.Name = "after"; + parameter.TypeName = typeof(Delegate).FullName; + parameter.Documentation = ComponentResources.BindTagHelper_Element_After_Documentation; + + parameter.SetPropertyName("After"); + }); }); // This is no longer supported. This is just here so we can add a diagnostic later on when this matches. @@ -526,6 +613,23 @@ private List CreateComponentBindTagHelpers(ICollection + { + rule.TagName = tagHelper.TagMatchingRules.Single().TagName; + rule.Attribute(attribute => + { + attribute.Name = "@bind-" + valueAttribute.Name + ":get"; + attribute.NameComparisonMode = RequiredAttributeDescriptor.NameComparisonMode.FullMatch; + attribute.Metadata[ComponentMetadata.Common.DirectiveAttribute] = bool.TrueString; + }); + rule.Attribute(attribute => + { + attribute.Name = "@bind-" + valueAttribute.Name + ":set"; + attribute.NameComparisonMode = RequiredAttributeDescriptor.NameComparisonMode.FullMatch; + attribute.Metadata[ComponentMetadata.Common.DirectiveAttribute] = bool.TrueString; + }); + }); + builder.BindAttribute(attribute => { attribute.Metadata[ComponentMetadata.Common.DirectiveAttribute] = bool.TrueString; @@ -539,11 +643,40 @@ private List CreateComponentBindTagHelpers(ICollection + { + parameter.Name = "get"; + parameter.TypeName = typeof(object).FullName; + parameter.Documentation = ComponentResources.BindTagHelper_Element_Get_Documentation; + + parameter.SetPropertyName("Get"); + parameter.SetBindAttributeGetSet(); + }); + + attribute.BindAttributeParameter(parameter => + { + parameter.Name = "set"; + parameter.TypeName = typeof(Delegate).FullName; + parameter.Documentation = ComponentResources.BindTagHelper_Element_Set_Documentation; + + parameter.SetPropertyName("Set"); + }); + + attribute.BindAttributeParameter(parameter => + { + parameter.Name = "after"; + parameter.TypeName = typeof(Delegate).FullName; + parameter.Documentation = ComponentResources.BindTagHelper_Element_After_Documentation; + + parameter.SetPropertyName("After"); + }); }); + if (tagHelper.IsComponentFullyQualifiedNameMatch()) { builder.Metadata[ComponentMetadata.Component.NameMatchKey] = ComponentMetadata.Component.FullyQualifiedNameMatch; @@ -556,6 +689,7 @@ private List CreateComponentBindTagHelpers(ICollection a.IsParameterizedChildContentProperty()) && @@ -175,7 +176,7 @@ private TagHelperDescriptorBuilder CreateDescriptorBuilder(ComponentSymbols symb return builder; } - private void CreateProperty(TagHelperDescriptorBuilder builder, IPropertySymbol property, PropertyKind kind) + private void CreateProperty(TagHelperDescriptorBuilder builder, IPropertySymbol property, PropertyKind kind, ComponentSymbols symbols) { builder.BindAttribute(pb => { @@ -202,6 +203,7 @@ private void CreateProperty(TagHelperDescriptorBuilder builder, IPropertySymbol if (kind == PropertyKind.Delegate) { pb.Metadata.Add(ComponentMetadata.Component.DelegateSignatureKey, bool.TrueString); + pb.Metadata.Add(ComponentMetadata.Component.DelegateWithAwaitableResultKey, IsAwaitable(property)); } if (HasTypeParameter(property.Type)) @@ -263,6 +265,57 @@ bool HasTypeParameter(ITypeSymbol type) } } + private static string IsAwaitable(IPropertySymbol prop) + { + var methodSymbol = ((INamedTypeSymbol)prop.Type).DelegateInvokeMethod; + if (methodSymbol.ReturnsVoid) + { + return bool.FalseString; + } + else + { + var members = methodSymbol.ReturnType.GetMembers(); + for (var i = 0; i < members.Length; i++) + { + var candidate = members[i]; + if (candidate is not IMethodSymbol method || !string.Equals(candidate.Name, "GetAwaiter", StringComparison.Ordinal)) + { + continue; + } + if (!VerifyGetAwaiter(method)) + { + continue; + } + + return bool.TrueString; + } + return methodSymbol.IsAsync ? bool.TrueString : bool.FalseString; + + static bool VerifyGetAwaiter(IMethodSymbol getAwaiter) + { + var returnType = getAwaiter.ReturnType; + if (returnType == null) + { + return false; + } + + if (!returnType.GetMembers().OfType().Any(p => p.Name == WellKnownMemberNames.IsCompleted && p.Type.SpecialType == SpecialType.System_Boolean && p.GetMethod != null)) + { + return false; + } + + var methods = returnType.GetMembers().OfType(); + + if (!methods.Any(x => x.Name == WellKnownMemberNames.OnCompleted && x.ReturnsVoid && x.Parameters.Length == 1 && x.Parameters.First().Type.TypeKind == TypeKind.Delegate)) + { + return false; + } + + return methods.Any(m => m.Name == WellKnownMemberNames.GetResult && !m.Parameters.Any()); + } + } + } + private void CreateTypeParameterProperty(TagHelperDescriptorBuilder builder, ITypeParameterSymbol typeParameter, bool cascade) { builder.BindAttribute(pb => diff --git a/src/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs b/src/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs index fd1a6dbd7..aa58a273f 100644 --- a/src/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs +++ b/src/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs @@ -97,20 +97,51 @@ public Task SetParametersAsync(ParameterView parameters) Assert.Equal("Test.MyComponent", bind.DisplayName); Assert.Equal("Test.MyComponent", bind.GetTypeName()); - var rule = Assert.Single(bind.TagMatchingRules); - Assert.Empty(rule.Diagnostics); - Assert.False(rule.HasErrors); - Assert.Null(rule.ParentTag); - Assert.Equal("MyComponent", rule.TagName); - Assert.Equal(TagStructure.Unspecified, rule.TagStructure); - - var requiredAttribute = Assert.Single(rule.Attributes); - Assert.Empty(requiredAttribute.Diagnostics); - Assert.Equal("@bind-MyProperty", requiredAttribute.DisplayName); - Assert.Equal("@bind-MyProperty", requiredAttribute.Name); - Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); - Assert.Null(requiredAttribute.Value); - Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); + Assert.Collection(bind.TagMatchingRules.OrderBy(r => r.Attributes.Count), + rule => + { + Assert.Empty(rule.Diagnostics); + Assert.False(rule.HasErrors); + Assert.Null(rule.ParentTag); + Assert.Equal("MyComponent", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + var requiredAttribute = Assert.Single(rule.Attributes); + Assert.Empty(requiredAttribute.Diagnostics); + Assert.Equal("@bind-MyProperty", requiredAttribute.DisplayName); + Assert.Equal("@bind-MyProperty", requiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); + Assert.Null(requiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); + }, + rule => + { + Assert.Empty(rule.Diagnostics); + Assert.False(rule.HasErrors); + Assert.Null(rule.ParentTag); + Assert.Equal("MyComponent", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + Assert.Collection(rule.Attributes.OrderBy(a => a.Name), + requiredAttribute => + { + Assert.Empty(requiredAttribute.Diagnostics); + Assert.Equal("@bind-MyProperty:get", requiredAttribute.DisplayName); + Assert.Equal("@bind-MyProperty:get", requiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); + Assert.Null(requiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); + }, + requiredAttribute => + { + Assert.Empty(requiredAttribute.Diagnostics); + Assert.Equal("@bind-MyProperty:set", requiredAttribute.DisplayName); + Assert.Equal("@bind-MyProperty:set", requiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); + Assert.Null(requiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); + }); + }); var attribute = Assert.Single(bind.BoundAttributes); @@ -218,20 +249,51 @@ public Task SetParametersAsync(ParameterView parameters) Assert.Equal("Test.MyComponent", bind.DisplayName); Assert.Equal("Test.MyComponent", bind.GetTypeName()); - var rule = Assert.Single(bind.TagMatchingRules); - Assert.Empty(rule.Diagnostics); - Assert.False(rule.HasErrors); - Assert.Null(rule.ParentTag); - Assert.Equal("MyComponent", rule.TagName); - Assert.Equal(TagStructure.Unspecified, rule.TagStructure); - - var requiredAttribute = Assert.Single(rule.Attributes); - Assert.Empty(requiredAttribute.Diagnostics); - Assert.Equal("@bind-MyProperty", requiredAttribute.DisplayName); - Assert.Equal("@bind-MyProperty", requiredAttribute.Name); - Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); - Assert.Null(requiredAttribute.Value); - Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); + Assert.Collection(bind.TagMatchingRules.OrderBy(o => o.Attributes.Count), + rule => + { + Assert.Empty(rule.Diagnostics); + Assert.False(rule.HasErrors); + Assert.Null(rule.ParentTag); + Assert.Equal("MyComponent", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + var requiredAttribute = Assert.Single(rule.Attributes); + Assert.Empty(requiredAttribute.Diagnostics); + Assert.Equal("@bind-MyProperty", requiredAttribute.DisplayName); + Assert.Equal("@bind-MyProperty", requiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); + Assert.Null(requiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); + }, + rule => + { + Assert.Empty(rule.Diagnostics); + Assert.False(rule.HasErrors); + Assert.Null(rule.ParentTag); + Assert.Equal("MyComponent", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + Assert.Collection(rule.Attributes.OrderBy(a => a.Name), + requiredAttribute => + { + Assert.Empty(requiredAttribute.Diagnostics); + Assert.Equal("@bind-MyProperty:get", requiredAttribute.DisplayName); + Assert.Equal("@bind-MyProperty:get", requiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); + Assert.Null(requiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); + }, + requiredAttribute => + { + Assert.Empty(requiredAttribute.Diagnostics); + Assert.Equal("@bind-MyProperty:set", requiredAttribute.DisplayName); + Assert.Equal("@bind-MyProperty:set", requiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); + Assert.Null(requiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); + }); + }); var attribute = Assert.Single(bind.BoundAttributes); @@ -374,93 +436,200 @@ public class BindAttributes Assert.Equal("Test.BindAttributes", bind.GetTypeName()); // The tag matching rule for a bind-Component is always the component name + the attribute name - var rule = Assert.Single(bind.TagMatchingRules); - Assert.Empty(rule.Diagnostics); - Assert.False(rule.HasErrors); - Assert.Null(rule.ParentTag); - Assert.Equal("div", rule.TagName); - Assert.Equal(TagStructure.Unspecified, rule.TagStructure); - - var requiredAttribute = Assert.Single(rule.Attributes); - Assert.Empty(requiredAttribute.Diagnostics); - Assert.Equal("@bind", requiredAttribute.DisplayName); - Assert.Equal("@bind", requiredAttribute.Name); - Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); - Assert.Null(requiredAttribute.Value); - Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); - - var attribute = Assert.Single(bind.BoundAttributes, a => a.Name.StartsWith("@bind", StringComparison.Ordinal)); - - // Invariants - Assert.Empty(attribute.Diagnostics); - Assert.False(attribute.HasErrors); - Assert.Equal(ComponentMetadata.Bind.TagHelperKind, attribute.Kind); - Assert.False(attribute.IsDefaultKind()); - Assert.False(attribute.HasIndexer); - Assert.Null(attribute.IndexerNamePrefix); - Assert.Null(attribute.IndexerTypeName); - Assert.False(attribute.IsIndexerBooleanProperty); - Assert.False(attribute.IsIndexerStringProperty); - - Assert.Equal( - "Binds the provided expression to the 'myprop' attribute and a change event " + - "delegate to the 'myevent' attribute.", - attribute.Documentation); - - Assert.Equal("@bind", attribute.Name); - Assert.Equal("Bind", attribute.GetPropertyName()); - Assert.Equal("object Test.BindAttributes.Bind", attribute.DisplayName); - - // Defined from the property type - Assert.Equal("System.Object", attribute.TypeName); - Assert.False(attribute.IsStringProperty); - Assert.False(attribute.IsBooleanProperty); - Assert.False(attribute.IsEnum); - - var parameter = Assert.Single(attribute.BoundAttributeParameters, a => a.Name.Equals("format")); - - // Invariants - Assert.Empty(parameter.Diagnostics); - Assert.False(parameter.HasErrors); - Assert.Equal(ComponentMetadata.Bind.TagHelperKind, parameter.Kind); - Assert.False(parameter.IsDefaultKind()); - - Assert.Equal( - "Specifies a format to convert the value specified by the '@bind' attribute. " + - "The format string can currently only be used with expressions of type DateTime.", - parameter.Documentation); - - Assert.Equal("format", parameter.Name); - Assert.Equal("Format_myprop", parameter.GetPropertyName()); - Assert.Equal(":format", parameter.DisplayName); - - // Defined from the property type - Assert.Equal("System.String", parameter.TypeName); - Assert.True(parameter.IsStringProperty); - Assert.False(parameter.IsBooleanProperty); - Assert.False(parameter.IsEnum); - - parameter = Assert.Single(attribute.BoundAttributeParameters, a => a.Name.Equals("culture")); - - // Invariants - Assert.Empty(parameter.Diagnostics); - Assert.False(parameter.HasErrors); - Assert.Equal(ComponentMetadata.Bind.TagHelperKind, parameter.Kind); - Assert.False(parameter.IsDefaultKind()); - - Assert.Equal( - "Specifies the culture to use for conversions.", - parameter.Documentation); - - Assert.Equal("culture", parameter.Name); - Assert.Equal("Culture", parameter.GetPropertyName()); - Assert.Equal(":culture", parameter.DisplayName); + Assert.Collection(bind.TagMatchingRules.OrderBy(o => o.Attributes.Count), + rule => + { + Assert.Empty(rule.Diagnostics); + Assert.False(rule.HasErrors); + Assert.Null(rule.ParentTag); + Assert.Equal("div", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + var requiredAttribute = Assert.Single(rule.Attributes); + Assert.Empty(requiredAttribute.Diagnostics); + Assert.Equal("@bind", requiredAttribute.DisplayName); + Assert.Equal("@bind", requiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); + Assert.Null(requiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); + + var attribute = Assert.Single(bind.BoundAttributes, a => a.Name.StartsWith("@bind", StringComparison.Ordinal)); + AssertAttribute(attribute); + }, + rule => + { + Assert.Empty(rule.Diagnostics); + Assert.False(rule.HasErrors); + Assert.Null(rule.ParentTag); + Assert.Equal("div", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + Assert.Collection(rule.Attributes.OrderBy(a => a.Name), + requiredAttribute => + { + Assert.Empty(requiredAttribute.Diagnostics); + Assert.Equal("@bind:get", requiredAttribute.DisplayName); + Assert.Equal("@bind:get", requiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); + Assert.Null(requiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); + + var attribute = Assert.Single(bind.BoundAttributes, a => a.Name.StartsWith("@bind", StringComparison.Ordinal)); + AssertAttribute(attribute); + }, + requiredAttribute => + { + Assert.Empty(requiredAttribute.Diagnostics); + Assert.Equal("@bind:set", requiredAttribute.DisplayName); + Assert.Equal("@bind:set", requiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, requiredAttribute.NameComparison); + Assert.Null(requiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, requiredAttribute.ValueComparison); + + var attribute = Assert.Single(bind.BoundAttributes, a => a.Name.StartsWith("@bind", StringComparison.Ordinal)); + AssertAttribute(attribute); + }); + }); - // Defined from the property type - Assert.Equal("System.Globalization.CultureInfo", parameter.TypeName); - Assert.False(parameter.IsStringProperty); - Assert.False(parameter.IsBooleanProperty); - Assert.False(parameter.IsEnum); + static void AssertAttribute(BoundAttributeDescriptor attribute) + { + // Invariants + Assert.Empty(attribute.Diagnostics); + Assert.False(attribute.HasErrors); + Assert.Equal(ComponentMetadata.Bind.TagHelperKind, attribute.Kind); + Assert.False(attribute.IsDefaultKind()); + Assert.False(attribute.HasIndexer); + Assert.Null(attribute.IndexerNamePrefix); + Assert.Null(attribute.IndexerTypeName); + Assert.False(attribute.IsIndexerBooleanProperty); + Assert.False(attribute.IsIndexerStringProperty); + + Assert.Equal( + "Binds the provided expression to the 'myprop' attribute and a change event " + + "delegate to the 'myevent' attribute.", + attribute.Documentation); + + Assert.Equal("@bind", attribute.Name); + Assert.Equal("Bind", attribute.GetPropertyName()); + Assert.Equal("object Test.BindAttributes.Bind", attribute.DisplayName); + + // Defined from the property type + Assert.Equal("System.Object", attribute.TypeName); + Assert.False(attribute.IsStringProperty); + Assert.False(attribute.IsBooleanProperty); + Assert.False(attribute.IsEnum); + + var parameter = Assert.Single(attribute.BoundAttributeParameters, a => a.Name.Equals("format")); + + // Invariants + Assert.Empty(parameter.Diagnostics); + Assert.False(parameter.HasErrors); + Assert.Equal(ComponentMetadata.Bind.TagHelperKind, parameter.Kind); + Assert.False(parameter.IsDefaultKind()); + + Assert.Equal( + "Specifies a format to convert the value specified by the '@bind' attribute. " + + "The format string can currently only be used with expressions of type DateTime.", + parameter.Documentation); + + Assert.Equal("format", parameter.Name); + Assert.Equal("Format_myprop", parameter.GetPropertyName()); + Assert.Equal(":format", parameter.DisplayName); + + // Defined from the property type + Assert.Equal("System.String", parameter.TypeName); + Assert.True(parameter.IsStringProperty); + Assert.False(parameter.IsBooleanProperty); + Assert.False(parameter.IsEnum); + + parameter = Assert.Single(attribute.BoundAttributeParameters, a => a.Name.Equals("culture")); + + // Invariants + Assert.Empty(parameter.Diagnostics); + Assert.False(parameter.HasErrors); + Assert.Equal(ComponentMetadata.Bind.TagHelperKind, parameter.Kind); + Assert.False(parameter.IsDefaultKind()); + + Assert.Equal( + "Specifies the culture to use for conversions.", + parameter.Documentation); + + Assert.Equal("culture", parameter.Name); + Assert.Equal("Culture", parameter.GetPropertyName()); + Assert.Equal(":culture", parameter.DisplayName); + + // Defined from the property type + Assert.Equal("System.Globalization.CultureInfo", parameter.TypeName); + Assert.False(parameter.IsStringProperty); + Assert.False(parameter.IsBooleanProperty); + Assert.False(parameter.IsEnum); + + parameter = Assert.Single(attribute.BoundAttributeParameters, a => a.Name.Equals("get")); + + // Invariants + Assert.Empty(parameter.Diagnostics); + Assert.False(parameter.HasErrors); + Assert.Equal(ComponentMetadata.Bind.TagHelperKind, parameter.Kind); + Assert.False(parameter.IsDefaultKind()); + + Assert.Equal( + "Specifies the expression to use for binding the value to the attribute.", + parameter.Documentation); + + Assert.Equal("get", parameter.Name); + Assert.Equal("Get", parameter.GetPropertyName()); + Assert.Equal(":get", parameter.DisplayName); + + // Defined from the property type + Assert.Equal("System.Object", parameter.TypeName); + Assert.False(parameter.IsStringProperty); + Assert.False(parameter.IsBooleanProperty); + Assert.False(parameter.IsEnum); + + parameter = Assert.Single(attribute.BoundAttributeParameters, a => a.Name.Equals("set")); + + // Invariants + Assert.Empty(parameter.Diagnostics); + Assert.False(parameter.HasErrors); + Assert.Equal(ComponentMetadata.Bind.TagHelperKind, parameter.Kind); + Assert.False(parameter.IsDefaultKind()); + + Assert.Equal( + "Specifies the expression to use for updating the bound value when a new value is available.", + parameter.Documentation); + + Assert.Equal("set", parameter.Name); + Assert.Equal("Set", parameter.GetPropertyName()); + Assert.Equal(":set", parameter.DisplayName); + + // Defined from the property type + Assert.Equal("System.Delegate", parameter.TypeName); + Assert.False(parameter.IsStringProperty); + Assert.False(parameter.IsBooleanProperty); + Assert.False(parameter.IsEnum); + + parameter = Assert.Single(attribute.BoundAttributeParameters, a => a.Name.Equals("after")); + + // Invariants + Assert.Empty(parameter.Diagnostics); + Assert.False(parameter.HasErrors); + Assert.Equal(ComponentMetadata.Bind.TagHelperKind, parameter.Kind); + Assert.False(parameter.IsDefaultKind()); + + Assert.Equal( + "Specifies an action to run after the new value has been set.", + parameter.Documentation); + + Assert.Equal("after", parameter.Name); + Assert.Equal("After", parameter.GetPropertyName()); + Assert.Equal(":after", parameter.DisplayName); + + // Defined from the property type + Assert.Equal("System.Delegate", parameter.TypeName); + Assert.False(parameter.IsStringProperty); + Assert.False(parameter.IsBooleanProperty); + Assert.False(parameter.IsEnum); + } } [Fact] @@ -499,13 +668,43 @@ public class BindAttributes Assert.False(bind.IsInputElementBindTagHelper()); Assert.False(bind.IsInputElementFallbackBindTagHelper()); - var rule = Assert.Single(bind.TagMatchingRules); - Assert.Equal("div", rule.TagName); - Assert.Equal(TagStructure.Unspecified, rule.TagStructure); - - var requiredAttribute = Assert.Single(rule.Attributes); - Assert.Equal("@bind-myprop", requiredAttribute.DisplayName); - Assert.Equal("@bind-myprop", requiredAttribute.Name); + Assert.Collection(bind.TagMatchingRules.OrderBy(o => o.Attributes.Count), + rule => + { + Assert.Equal("div", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + var requiredAttribute = Assert.Single(rule.Attributes); + Assert.Equal("@bind-myprop", requiredAttribute.DisplayName); + Assert.Equal("@bind-myprop", requiredAttribute.Name); + + var attribute = Assert.Single(bind.BoundAttributes, a => a.Name.StartsWith("@bind", StringComparison.Ordinal)); + Assert.Equal("@bind-myprop", attribute.Name); + Assert.Equal("Bind_myprop", attribute.GetPropertyName()); + Assert.Equal("object Test.BindAttributes.Bind_myprop", attribute.DisplayName); + + attribute = Assert.Single(bind.BoundAttributes, a => a.Name.StartsWith("format", StringComparison.Ordinal)); + Assert.Equal("format-myprop", attribute.Name); + Assert.Equal("Format_myprop", attribute.GetPropertyName()); + Assert.Equal("string Test.BindAttributes.Format_myprop", attribute.DisplayName); + }, + rule => + { + Assert.Equal("div", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + Assert.Collection(rule.Attributes.OrderBy(a => a.Name), + requiredAttribute => + { + Assert.Equal("@bind-myprop:get", requiredAttribute.DisplayName); + Assert.Equal("@bind-myprop:get", requiredAttribute.Name); + }, + requiredAttribute => + { + Assert.Equal("@bind-myprop:set", requiredAttribute.DisplayName); + Assert.Equal("@bind-myprop:set", requiredAttribute.Name); + }); + }); var attribute = Assert.Single(bind.BoundAttributes, a => a.Name.StartsWith("@bind", StringComparison.Ordinal)); Assert.Equal("@bind-myprop", attribute.Name); @@ -555,13 +754,33 @@ public class BindAttributes Assert.True(bind.IsInputElementBindTagHelper()); Assert.True(bind.IsInputElementFallbackBindTagHelper()); - var rule = Assert.Single(bind.TagMatchingRules); - Assert.Equal("input", rule.TagName); - Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + Assert.Collection(bind.TagMatchingRules.OrderBy(r => r.Attributes.Count), + rule => + { + Assert.Equal("input", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); - var requiredAttribute = Assert.Single(rule.Attributes); - Assert.Equal("@bind", requiredAttribute.DisplayName); - Assert.Equal("@bind", requiredAttribute.Name); + var requiredAttribute = Assert.Single(rule.Attributes); + Assert.Equal("@bind", requiredAttribute.DisplayName); + Assert.Equal("@bind", requiredAttribute.Name); + }, + rule => + { + Assert.Equal("input", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + Assert.Collection(rule.Attributes.OrderBy(o => o.Name), + requiredAttribute => + { + Assert.Equal("@bind:get", requiredAttribute.DisplayName); + Assert.Equal("@bind:get", requiredAttribute.Name); + }, + requiredAttribute => + { + Assert.Equal("@bind:set", requiredAttribute.DisplayName); + Assert.Equal("@bind:set", requiredAttribute.Name); + }); + }); var attribute = Assert.Single(bind.BoundAttributes, a => a.Name.StartsWith("@bind", StringComparison.Ordinal)); Assert.Equal("@bind", attribute.Name); @@ -611,24 +830,53 @@ public class BindAttributes Assert.True(bind.IsInputElementBindTagHelper()); Assert.False(bind.IsInputElementFallbackBindTagHelper()); - var rule = Assert.Single(bind.TagMatchingRules); - Assert.Equal("input", rule.TagName); - Assert.Equal(TagStructure.Unspecified, rule.TagStructure); - - Assert.Collection( - rule.Attributes, - a => + Assert.Collection(bind.TagMatchingRules.OrderBy(r => r.Attributes.Count), + rule => { - Assert.Equal("type", a.DisplayName); - Assert.Equal("type", a.Name); - Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, a.NameComparison); - Assert.Equal("checkbox", a.Value); - Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.FullMatch, a.ValueComparison); + Assert.Equal("input", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + Assert.Collection( + rule.Attributes, + a => + { + Assert.Equal("type", a.DisplayName); + Assert.Equal("type", a.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, a.NameComparison); + Assert.Equal("checkbox", a.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.FullMatch, a.ValueComparison); + }, + a => + { + Assert.Equal("@bind", a.DisplayName); + Assert.Equal("@bind", a.Name); + }); }, - a => + rule => { - Assert.Equal("@bind", a.DisplayName); - Assert.Equal("@bind", a.Name); + Assert.Equal("input", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + Assert.Collection( + rule.Attributes, + a => + { + Assert.Equal("type", a.DisplayName); + Assert.Equal("type", a.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, a.NameComparison); + Assert.Equal("checkbox", a.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.FullMatch, a.ValueComparison); + }, + a => + { + Assert.Equal("@bind:get", a.DisplayName); + Assert.Equal("@bind:get", a.Name); + }, + a => + { + Assert.Equal("@bind:set", a.DisplayName); + Assert.Equal("@bind:set", a.Name); + }); }); var attribute = Assert.Single(bind.BoundAttributes, a => a.Name.StartsWith("@bind", StringComparison.Ordinal)); @@ -681,24 +929,53 @@ public class BindAttributes Assert.False(bind.IsInvariantCultureBindTagHelper()); Assert.Null(bind.GetFormat()); - var rule = Assert.Single(bind.TagMatchingRules); - Assert.Equal("input", rule.TagName); - Assert.Equal(TagStructure.Unspecified, rule.TagStructure); - - Assert.Collection( - rule.Attributes, - a => + Assert.Collection(bind.TagMatchingRules.OrderBy(o => o.Attributes.Count), + rule => { - Assert.Equal("type", a.DisplayName); - Assert.Equal("type", a.Name); - Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, a.NameComparison); - Assert.Equal("checkbox", a.Value); - Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.FullMatch, a.ValueComparison); + Assert.Equal("input", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + Assert.Collection( + rule.Attributes, + a => + { + Assert.Equal("type", a.DisplayName); + Assert.Equal("type", a.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, a.NameComparison); + Assert.Equal("checkbox", a.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.FullMatch, a.ValueComparison); + }, + a => + { + Assert.Equal("@bind-somevalue", a.DisplayName); + Assert.Equal("@bind-somevalue", a.Name); + }); }, - a => + rule => { - Assert.Equal("@bind-somevalue", a.DisplayName); - Assert.Equal("@bind-somevalue", a.Name); + Assert.Equal("input", rule.TagName); + Assert.Equal(TagStructure.Unspecified, rule.TagStructure); + + Assert.Collection( + rule.Attributes, + a => + { + Assert.Equal("type", a.DisplayName); + Assert.Equal("type", a.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, a.NameComparison); + Assert.Equal("checkbox", a.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.FullMatch, a.ValueComparison); + }, + a => + { + Assert.Equal("@bind-somevalue:get", a.DisplayName); + Assert.Equal("@bind-somevalue:get", a.Name); + }, + a => + { + Assert.Equal("@bind-somevalue:set", a.DisplayName); + Assert.Equal("@bind-somevalue:set", a.Name); + }); }); var attribute = Assert.Single(bind.BoundAttributes, a => a.Name.StartsWith("@bind", StringComparison.Ordinal)); diff --git a/src/RazorSdk/SourceGenerators/Diagnostics/RazorSourceGeneratorResources.resx b/src/RazorSdk/SourceGenerators/Diagnostics/RazorSourceGeneratorResources.resx index 3609a5757..0b33e3d77 100644 --- a/src/RazorSdk/SourceGenerators/Diagnostics/RazorSourceGeneratorResources.resx +++ b/src/RazorSdk/SourceGenerators/Diagnostics/RazorSourceGeneratorResources.resx @@ -121,7 +121,7 @@ Invalid RazorLangVersion - Invalid value '{0}'' for RazorLangVersion. Valid values include 'Latest' or a valid version in range 1.0 to 5.0. + Invalid value '{0}'' for RazorLangVersion. Valid values include 'Latest' or a valid version in range 1.0 to 7.0. Recomputing tag helpers diff --git a/src/RazorSdk/Targets/Sdk.Razor.CurrentVersion.targets b/src/RazorSdk/Targets/Sdk.Razor.CurrentVersion.targets index fd259e30e..043250e42 100644 --- a/src/RazorSdk/Targets/Sdk.Razor.CurrentVersion.targets +++ b/src/RazorSdk/Targets/Sdk.Razor.CurrentVersion.targets @@ -44,6 +44,16 @@ Copyright (c) .NET Foundation. All rights reserved. + + + <_TargetingNETCoreApp30OrLater>true + <_TargetingNET50OrLater>true + <_TargetingNET60OrLater>true + <_TargetingNET70OrLater>true + true + 7.0 + + <_TargetingNETCoreApp30OrLater>true diff --git a/src/test/Microsoft.AspNetCore.Razor.Test.Common/Language/RazorProjectEngineTestBase.cs b/src/test/Microsoft.AspNetCore.Razor.Test.Common/Language/RazorProjectEngineTestBase.cs index 85332e2ae..b41b6f07e 100644 --- a/src/test/Microsoft.AspNetCore.Razor.Test.Common/Language/RazorProjectEngineTestBase.cs +++ b/src/test/Microsoft.AspNetCore.Razor.Test.Common/Language/RazorProjectEngineTestBase.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #nullable disable diff --git a/src/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs b/src/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs index 8c3f32f51..493dca1af 100644 --- a/src/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs +++ b/src/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs @@ -141,6 +141,7 @@ public readonly partial struct EventCallback public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent receiver, System.MulticastDelegate @delegate) { throw null; } public bool HasDelegate { get { throw null; } } public System.Threading.Tasks.Task InvokeAsync(object arg) { throw null; } + public System.Threading.Tasks.Task InvokeAsync() { throw null; } } public sealed partial class EventCallbackFactory { @@ -167,27 +168,49 @@ public EventCallbackFactory() { } public static partial class EventCallbackFactoryBinderExtensions { public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; } } public static partial class EventCallbackFactoryEventArgsExtensions { @@ -389,7 +412,11 @@ namespace Microsoft.AspNetCore.Components.CompilerServices { public static partial class RuntimeHelpers { + public static void InvokeSynchronousDelegate(System.Action callback) { throw null; } + public static System.Threading.Tasks.Task InvokeAsynchronousDelegate(System.Action callback) { throw null; } + public static System.Threading.Tasks.Task InvokeAsynchronousDelegate(System.Func callback) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateInferredEventCallback(object receiver, System.Action callback, T value) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateInferredEventCallback(object receiver, Microsoft.AspNetCore.Components.EventCallback callback, T value) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateInferredEventCallback(object receiver, System.Func callback, T value) { throw null; } public static T TypeCheck(T value) { throw null; } }