Files
PURErat-crack-scode/decompiled/Libraries/microsoft.codeanalysis.csharp/Microsoft.CodeAnalysis.CSharp/BoundCollectionExpressionBase.cs
T

34 lines
999 B
C#
Raw Normal View History

2026-08-27 10:56:38 -06:00
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CSharp.Symbols;
namespace Microsoft.CodeAnalysis.CSharp;
internal abstract class BoundCollectionExpressionBase : BoundExpression
{
public ImmutableArray<BoundExpression> Elements { get; }
internal bool HasSpreadElements(out int numberIncludingLastSpread, out bool hasKnownLength)
{
hasKnownLength = true;
numberIncludingLastSpread = 0;
for (int i = 0; i < Elements.Length; i++)
{
if (Elements[i] is BoundCollectionExpressionSpreadElement boundCollectionExpressionSpreadElement)
{
numberIncludingLastSpread = i + 1;
if (boundCollectionExpressionSpreadElement.LengthOrCount == null)
{
hasKnownLength = false;
}
}
}
return numberIncludingLastSpread > 0;
}
protected BoundCollectionExpressionBase(BoundKind kind, SyntaxNode syntax, ImmutableArray<BoundExpression> elements, TypeSymbol? type, bool hasErrors = false)
: base(kind, syntax, type, hasErrors)
{
Elements = elements;
}
}