File: ConvertLinq\ConvertForEachToLinqQuery\ExtendedSyntaxNode.cs
Web Access
Project: src\src\roslyn\src\Features\Core\Portable\Microsoft.CodeAnalysis.Features.csproj (Microsoft.CodeAnalysis.Features)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Shared.Extensions;

namespace Microsoft.CodeAnalysis.ConvertLinq.ConvertForEachToLinqQuery;

internal readonly struct ExtendedSyntaxNode(
    SyntaxNode node,
    IEnumerable<SyntaxTrivia> extraLeadingComments,
    IEnumerable<SyntaxTrivia> extraTrailingComments)
{
    public SyntaxNode Node { get; } = node;

    public ImmutableArray<SyntaxTrivia> ExtraLeadingComments { get; } = [.. extraLeadingComments];

    public ImmutableArray<SyntaxTrivia> ExtraTrailingComments { get; } = [.. extraTrailingComments];

    public ExtendedSyntaxNode(
        SyntaxNode node,
        IEnumerable<SyntaxToken> extraLeadingTokens,
        IEnumerable<SyntaxToken> extraTrailingTokens)
        : this(node, extraLeadingTokens.GetTrivia(), extraTrailingTokens.GetTrivia())
    {
    }
}