60 lines
2.6 KiB
C#
60 lines
2.6 KiB
C#
using System.Collections.Immutable;
|
|
using Microsoft.Cci;
|
|
using Microsoft.CodeAnalysis.CSharp.Emit.NoPia;
|
|
using Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
using Microsoft.CodeAnalysis.Emit;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Emit;
|
|
|
|
internal abstract class MethodReference : TypeMemberReference, IMethodReference, ISignature, ITypeMemberReference, IReference, INamedEntity
|
|
{
|
|
protected readonly MethodSymbol UnderlyingMethod;
|
|
|
|
protected override Symbol UnderlyingSymbol => UnderlyingMethod;
|
|
|
|
bool IMethodReference.AcceptsExtraArguments => UnderlyingMethod.IsVararg;
|
|
|
|
ushort IMethodReference.GenericParameterCount => (ushort)UnderlyingMethod.Arity;
|
|
|
|
bool IMethodReference.IsGeneric => UnderlyingMethod.IsGenericMethod;
|
|
|
|
ushort ISignature.ParameterCount => (ushort)UnderlyingMethod.ParameterCount;
|
|
|
|
ImmutableArray<IParameterTypeInformation> IMethodReference.ExtraParameters => ImmutableArray<IParameterTypeInformation>.Empty;
|
|
|
|
CallingConvention ISignature.CallingConvention => UnderlyingMethod.CallingConvention;
|
|
|
|
ImmutableArray<ICustomModifier> ISignature.ReturnValueCustomModifiers => ImmutableArray<ICustomModifier>.CastUp<CustomModifier>(UnderlyingMethod.ReturnTypeWithAnnotations.CustomModifiers);
|
|
|
|
ImmutableArray<ICustomModifier> ISignature.RefCustomModifiers => ImmutableArray<ICustomModifier>.CastUp<CustomModifier>(UnderlyingMethod.RefCustomModifiers);
|
|
|
|
bool ISignature.ReturnValueIsByRef => UnderlyingMethod.RefKind.IsManagedReference();
|
|
|
|
public virtual IGenericMethodInstanceReference AsGenericMethodInstanceReference => null;
|
|
|
|
public virtual ISpecializedMethodReference AsSpecializedMethodReference => null;
|
|
|
|
public MethodReference(MethodSymbol underlyingMethod)
|
|
{
|
|
UnderlyingMethod = underlyingMethod;
|
|
}
|
|
|
|
IMethodDefinition IMethodReference.GetResolvedMethod(EmitContext context)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
ImmutableArray<IParameterTypeInformation> ISignature.GetParameters(EmitContext context)
|
|
{
|
|
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
|
|
return ((PEModuleBuilder)(object)context.Module).Translate(UnderlyingMethod.Parameters);
|
|
}
|
|
|
|
ITypeReference ISignature.GetType(EmitContext context)
|
|
{
|
|
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
|
|
return ((PEModuleBuilder<CSharpCompilation, SourceModuleSymbol, AssemblySymbol, TypeSymbol, NamedTypeSymbol, MethodSymbol, SyntaxNode, EmbeddedTypesManager, ModuleCompilationState>)(PEModuleBuilder)(object)context.Module).Translate(UnderlyingMethod.ReturnType, (SyntaxNode)(object)(CSharpSyntaxNode)(object)((EmitContext)(ref context)).SyntaxNode, context.Diagnostics);
|
|
}
|
|
}
|