File: Language\Intermediate\PropertyDeclarationIntermediateNode.cs
Web Access
Project: src\roslyn\src\Razor\src\Compiler\Microsoft.CodeAnalysis.Razor.Compiler\src\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.

using System.Collections.Immutable;
using Microsoft.CodeAnalysis;

namespace Microsoft.AspNetCore.Razor.Language.Intermediate;

public sealed class PropertyDeclarationIntermediateNode : MemberDeclarationIntermediateNode
{
    public required string Name { get; init; }
    public required IntermediateToken Type { get; init; }
    public required string ExpressionBody { get; init; }
    public ImmutableArray<string> Modifiers { get; init => field = value.NullToEmpty(); } = [];

    public override IntermediateNodeCollection Children => IntermediateNodeCollection.ReadOnly;

    public override void Accept(IntermediateNodeVisitor visitor)
        => visitor.VisitPropertyDeclaration(this);

    protected override IntermediateNode CloneNode()
    {
        var clone = new PropertyDeclarationIntermediateNode
        {
            Name = Name,
            Type = (IntermediateToken)Type.Clone(),
            ExpressionBody = ExpressionBody,
            Modifiers = Modifiers,
            IsSynthesizedHelper = IsSynthesizedHelper,
        };

        return clone;
    }
}