45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using System.Diagnostics;
|
|
using Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
|
|
|
internal sealed class BoundMethodInfo : BoundExpression
|
|
{
|
|
public new TypeSymbol Type => base.Type;
|
|
|
|
public MethodSymbol Method { get; }
|
|
|
|
public MethodSymbol? GetMethodFromHandle { get; }
|
|
|
|
public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type, bool hasErrors)
|
|
: base(BoundKind.MethodInfo, syntax, type, hasErrors)
|
|
{
|
|
Method = method;
|
|
GetMethodFromHandle = getMethodFromHandle;
|
|
}
|
|
|
|
public BoundMethodInfo(SyntaxNode syntax, MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
|
|
: base(BoundKind.MethodInfo, syntax, type)
|
|
{
|
|
Method = method;
|
|
GetMethodFromHandle = getMethodFromHandle;
|
|
}
|
|
|
|
[DebuggerStepThrough]
|
|
public override BoundNode? Accept(BoundTreeVisitor visitor)
|
|
{
|
|
return visitor.VisitMethodInfo(this);
|
|
}
|
|
|
|
public BoundMethodInfo Update(MethodSymbol method, MethodSymbol? getMethodFromHandle, TypeSymbol type)
|
|
{
|
|
if (!SymbolEqualityComparer.ConsiderEverything.Equals(method, Method) || !SymbolEqualityComparer.ConsiderEverything.Equals(getMethodFromHandle, GetMethodFromHandle) || !TypeSymbol.Equals(type, Type, (TypeCompareKind)0))
|
|
{
|
|
BoundMethodInfo boundMethodInfo = new BoundMethodInfo(Syntax, method, getMethodFromHandle, type, base.HasErrors);
|
|
boundMethodInfo.CopyAttributes(this);
|
|
return boundMethodInfo;
|
|
}
|
|
return this;
|
|
}
|
|
}
|