本文整理汇总了C#中IMethodReference类的典型用法代码示例。如果您正苦于以下问题:C# IMethodReference类的具体用法?C# IMethodReference怎么用?C# IMethodReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMethodReference类属于命名空间,在下文中一共展示了IMethodReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMethodSignature
// Put return type after the signature
public override string GetMethodSignature(IMethodReference method, NameFormattingOptions formattingOptions)
{
string baseSig = base.GetMethodSignature(method, (formattingOptions & ~NameFormattingOptions.ReturnType));
StringBuilder sb = new StringBuilder(baseSig);
AppendReturnTypeSignature(method, (formattingOptions | NameFormattingOptions.ReturnType), sb);
return sb.ToString();
}
示例2: CustomAttribute
public CustomAttribute(
IMethodReference constructor,
ITypeReference type,
ReadOnlyArray<MetadataConstant> positionalArguments) :
this(constructor, type, positionalArguments, ReadOnlyArray<IMetadataNamedArgument>.Empty)
{
}
示例3: Unspecialize
/// <summary>
/// Returns the unspecialized version of the given method reference.
/// </summary>
public static IMethodReference Unspecialize(IMethodReference method) {
var smr = method as ISpecializedMethodReference;
if (smr != null) return smr.UnspecializedVersion;
var gmir = method as IGenericMethodInstanceReference;
if (gmir != null) return gmir.GenericMethod;
return method;
}
示例4: ResolveUnspecializedMethodOrThrow
private static IMethodDefinition ResolveUnspecializedMethodOrThrow(IMethodReference methodReference) {
var resolvedMethod = Sink.Unspecialize(methodReference).ResolvedMethod;
if (resolvedMethod == Dummy.Method) { // avoid downstream errors, fail early
throw new TranslationException(ExceptionType.UnresolvedMethod, MemberHelper.GetMethodSignature(methodReference, NameFormattingOptions.None));
}
return resolvedMethod;
}
示例5: Matches
public bool Matches(IMethodReference method)
{
var sig = CreateIdentifier(method);
_log.Debug("matching: "+sig);
//AKB to rethink
return sig.MethodNameWithoutParams == _identifier.MethodNameWithoutParams;
}
示例6: AddAlternativeInvocation
private void AddAlternativeInvocation(BlockStatement block,
IMethodDefinition fakeMethod, IMethodReference originalCall)
{
var context = new ReplacementMethodConstructionContext(host, originalCall, fakeMethod, block, log, null);
var methodBuilder = context.GetMethodBuilder();
methodBuilder.BuildMethod();
}
示例7: CreateIdentifier
public static MethodIdentifier CreateIdentifier(IMethodReference method)
{
method = MemberHelper.UninstantiateAndUnspecialize(method);
return new MethodIdentifier(MemberHelper.GetMethodSignature(method,
NameFormattingOptions.Signature |
NameFormattingOptions.TypeParameters |
NameFormattingOptions.ParameterModifiers));
}
示例8: ReplacementMethodConstructionContext
public ReplacementMethodConstructionContext(IMetadataHost host, IMethodReference originalCall, IMethodDefinition fakeMethod, BlockStatement block, ILogger log, IReplaceableReference originalReference)
{
this.host = host;
this.block = block;
this.log = log;
this.originalReference = originalReference;
this.originalCall = originalCall;
fakeMethodParameters = fakeMethod.Parameters;
returnType = fakeMethod.Type;
}
示例9: ResolveMethodThrowing
public static IMethodDefinition ResolveMethodThrowing(IMethodReference method)
{
IMethodDefinition result = method.ResolvedMethod;
if (result == Dummy.Method ||
result == null)
{
throw new Exception(String.Format("Cannot resolve member '{0}'. Are all dependent assemblies loaded?", method.ToString()));
}
Debug.Assert(!result.GetType().Name.Contains("Dummy"));
return result;
}
示例10: CreateNormalizeMethodDefinition
/// <summary>
/// Creates the normalize method definition.
/// </summary>
/// <param name="methodReference">The method reference.</param>
/// <returns>A new NormalizeMethodDefinition instance, based on the input.</returns>
internal static NormalizeMethodDefinition CreateNormalizeMethodDefinition(IMethodReference methodReference)
{
if (methodReference == null)
{
throw new ArgumentNullException("methodReference");
}
ITypeReference typeReference = methodReference.DeclaringType as ITypeReference;
return new NormalizeMethodDefinition(
typeReference.Name,
typeReference.Namespace,
methodReference.Name,
BuildParameterList(methodReference.Parameters),
methodReference.ReturnType.Type.ToString(),
string.Empty);
}
示例11: Mangle
internal string Mangle(IMethodReference method) {
Contract.Requires(method != null);
method.ResolvedMethod.Dispatch(this); //compute the hash
var sb = new StringBuilder();
sb.Append('_');
sb.Append((uint)this.hash);
sb.Append('_');
this.AppendSanitizedName(sb, TypeHelper.GetTypeName(method.ContainingType));
sb.Append('_');
this.AppendSanitizedName(sb, method.Name.Value);
foreach (var par in method.Parameters) {
sb.Append('_');
this.AppendSanitizedName(sb, TypeHelper.GetTypeName(par.Type, NameFormattingOptions.OmitContainingType));
}
return sb.ToString();
}
示例12: TryGetCompatibileModifier
private static bool TryGetCompatibileModifier(IMethodDefinition resolvedMethod, out IMethodReference accessor)
{
var result = resolvedMethod.ContainingTypeDefinition.Properties
.FirstOrDefault(p => p.Setter != null && p.Setter.Name.UniqueKey != resolvedMethod.Name.UniqueKey
&& TypeHelper.ParameterListsAreEquivalent(p.Setter.Parameters, resolvedMethod.Parameters));
if (result == null)
{
accessor = null;
return false;
}
else
{
accessor = result.Setter;
return true;
}
}
示例13: AddDependencyForCalledMethod
private void AddDependencyForCalledMethod(IMethodReference method)
{
AddDependency(method.ContainingType, false);
this._methodDependents.Add(method);
}
示例14: SecurityCustomAttribute
internal SecurityCustomAttribute(SecurityAttribute containingSecurityAttribute, IMethodReference constructorReference, IMetadataNamedArgument[]/*?*/ namedArguments) {
this.ContainingSecurityAttribute = containingSecurityAttribute;
this.ConstructorReference = constructorReference;
this.NamedArguments = namedArguments;
}
示例15: CustomAttribute
internal CustomAttribute(PEFileToObjectModel peFileToObjectModel, uint attributeRowId, IMethodReference constructor,
IMetadataExpression[]/*?*/ arguments, IMetadataNamedArgument[]/*?*/ namedArguments)
: base(peFileToObjectModel) {
this.AttributeRowId = attributeRowId;
this.Constructor = constructor;
this.Arguments = arguments;
this.NamedArguments = namedArguments;
}