57 lines
1.5 KiB
C#
57 lines
1.5 KiB
C#
using System.Linq;
|
|
using Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
|
|
|
internal struct UnaryOperatorSignature
|
|
{
|
|
public static UnaryOperatorSignature Error;
|
|
|
|
public readonly MethodSymbol Method;
|
|
|
|
public readonly TypeSymbol ConstrainedToTypeOpt;
|
|
|
|
public readonly TypeSymbol OperandType;
|
|
|
|
public readonly TypeSymbol ReturnType;
|
|
|
|
public readonly UnaryOperatorKind Kind;
|
|
|
|
public RefKind RefKind
|
|
{
|
|
get
|
|
{
|
|
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
|
|
if ((object)Method == null || Method.ParameterRefKinds.IsDefaultOrEmpty)
|
|
{
|
|
return (RefKind)0;
|
|
}
|
|
return Method.ParameterRefKinds.Single();
|
|
}
|
|
}
|
|
|
|
public UnaryOperatorSignature(UnaryOperatorKind kind, TypeSymbol operandType, TypeSymbol returnType)
|
|
{
|
|
Kind = kind;
|
|
OperandType = operandType;
|
|
ReturnType = returnType;
|
|
Method = null;
|
|
ConstrainedToTypeOpt = null;
|
|
}
|
|
|
|
public UnaryOperatorSignature(UnaryOperatorKind kind, TypeSymbol operandType, TypeSymbol returnType, MethodSymbol method, TypeSymbol constrainedToTypeOpt)
|
|
{
|
|
Kind = kind;
|
|
OperandType = operandType;
|
|
ReturnType = returnType;
|
|
Method = method;
|
|
ConstrainedToTypeOpt = constrainedToTypeOpt;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
|
|
return string.Format("kind: {0} operandType: {1} operandRefKind: {2} return: {3}", new object[4] { Kind, OperandType, RefKind, ReturnType });
|
|
}
|
|
}
|