67 lines
3.3 KiB
C#
67 lines
3.3 KiB
C#
using System.Collections.Immutable;
|
|
using System.Diagnostics;
|
|
using Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
using Microsoft.CodeAnalysis.Operations;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
|
|
|
internal sealed class BoundCollectionElementInitializer : BoundExpression, IBoundInvalidNode
|
|
{
|
|
public override Symbol ExpressionSymbol => AddMethod;
|
|
|
|
ImmutableArray<BoundNode> IBoundInvalidNode.InvalidNodeChildren => CSharpOperationFactory.CreateInvalidChildrenFromArgumentsExpression(ImplicitReceiverOpt, Arguments);
|
|
|
|
public new TypeSymbol Type => base.Type;
|
|
|
|
public MethodSymbol AddMethod { get; }
|
|
|
|
public ImmutableArray<BoundExpression> Arguments { get; }
|
|
|
|
public BoundExpression? ImplicitReceiverOpt { get; }
|
|
|
|
public bool Expanded { get; }
|
|
|
|
public ImmutableArray<int> ArgsToParamsOpt { get; }
|
|
|
|
public BitVector DefaultArguments { get; }
|
|
|
|
public bool InvokedAsExtensionMethod { get; }
|
|
|
|
public override LookupResultKind ResultKind { get; }
|
|
|
|
public BoundCollectionElementInitializer(SyntaxNode syntax, MethodSymbol addMethod, ImmutableArray<BoundExpression> arguments, BoundExpression? implicitReceiverOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, bool invokedAsExtensionMethod, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false)
|
|
: base(BoundKind.CollectionElementInitializer, syntax, type, hasErrors || arguments.HasErrors() || implicitReceiverOpt.HasErrors())
|
|
{
|
|
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
|
|
AddMethod = addMethod;
|
|
Arguments = arguments;
|
|
ImplicitReceiverOpt = implicitReceiverOpt;
|
|
Expanded = expanded;
|
|
ArgsToParamsOpt = argsToParamsOpt;
|
|
DefaultArguments = defaultArguments;
|
|
InvokedAsExtensionMethod = invokedAsExtensionMethod;
|
|
ResultKind = resultKind;
|
|
}
|
|
|
|
[DebuggerStepThrough]
|
|
public override BoundNode? Accept(BoundTreeVisitor visitor)
|
|
{
|
|
return visitor.VisitCollectionElementInitializer(this);
|
|
}
|
|
|
|
public BoundCollectionElementInitializer Update(MethodSymbol addMethod, ImmutableArray<BoundExpression> arguments, BoundExpression? implicitReceiverOpt, bool expanded, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, bool invokedAsExtensionMethod, LookupResultKind resultKind, TypeSymbol type)
|
|
{
|
|
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
|
|
if (!SymbolEqualityComparer.ConsiderEverything.Equals(addMethod, AddMethod) || arguments != Arguments || implicitReceiverOpt != ImplicitReceiverOpt || expanded != Expanded || argsToParamsOpt != ArgsToParamsOpt || defaultArguments != DefaultArguments || invokedAsExtensionMethod != InvokedAsExtensionMethod || resultKind != ResultKind || !TypeSymbol.Equals(type, Type, (TypeCompareKind)0))
|
|
{
|
|
BoundCollectionElementInitializer boundCollectionElementInitializer = new BoundCollectionElementInitializer(Syntax, addMethod, arguments, implicitReceiverOpt, expanded, argsToParamsOpt, defaultArguments, invokedAsExtensionMethod, resultKind, type, base.HasErrors);
|
|
boundCollectionElementInitializer.CopyAttributes(this);
|
|
return boundCollectionElementInitializer;
|
|
}
|
|
return this;
|
|
}
|
|
}
|