| File: Language\Intermediate\ComponentIntermediateNode.cs | Web Access |
| Project: Microsoft.CodeAnalysis.Razor.Compiler.csproj (Microsoft.CodeAnalysis.Razor.Compiler) |
// 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.Collections.Immutable; namespace Microsoft.AspNetCore.Razor.Language.Intermediate; public sealed class ComponentIntermediateNode : IntermediateNode { public IntermediateNodeCollection.TypedEnumerable<ComponentAttributeIntermediateNode> Attributes => new(Children); public IntermediateNodeCollection.TypedEnumerable<ReferenceCaptureIntermediateNode> Captures => new(Children); public IntermediateNodeCollection.TypedEnumerable<SetKeyIntermediateNode> SetKeys => new(Children); public IntermediateNodeCollection.TypedEnumerable<SplatIntermediateNode> Splats => new(Children); public IntermediateNodeCollection.TypedEnumerable<ComponentChildContentIntermediateNode> ChildContents => new(Children); public override IntermediateNodeCollection Children { get => field ??= []; } public TagHelperDescriptor Component { get; set; } /// <summary> /// Gets the child content parameter name (null if unset) that was applied at the component level. /// </summary> public string ChildContentParameterName { get; set; } public IntermediateNodeCollection.TypedEnumerable<ComponentTypeArgumentIntermediateNode> TypeArguments => new(Children); public ImmutableArray<ComponentTypeArgumentIntermediateNode> OrderedTypeArguments { get; set; } public string TagName { get; set; } // An optional type inference node. This will be populated (and point to a different part of the tree) // if this component call site requires type inference. public ComponentTypeInferenceMethodIntermediateNode TypeInferenceNode { get; set; } /// <summary> /// Gets a dictionary (or null) that advertises any type arguments that are available /// for use by descendants within the same tree. /// </summary> public Dictionary<string, CascadingGenericTypeParameter> ProvidesCascadingGenericTypes { get; set; } public string TypeName { get; set; } public SourceSpan StartTagSpan { get; init; } public override void Accept(IntermediateNodeVisitor visitor) { if (visitor == null) { throw new ArgumentNullException(nameof(visitor)); } visitor.VisitComponent(this); } public override void FormatNode(IntermediateNodeFormatter formatter) { formatter.WriteContent(TagName); formatter.WriteProperty(nameof(Component), Component?.DisplayName); formatter.WriteProperty(nameof(TagName), TagName); } }