本文整理汇总了C#中IMethodReference类的典型用法代码示例。如果您正苦于以下问题:C# IMethodReference类的具体用法?C# IMethodReference怎么用?C# IMethodReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMethodReference类属于命名空间,在下文中一共展示了IMethodReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:dsgouda,项目名称:buildtools,代码行数:8,代码来源:ModelSigFormatter.cs
示例2: CustomAttribute
public CustomAttribute(
IMethodReference constructor,
ITypeReference type,
ReadOnlyArray<MetadataConstant> positionalArguments) :
this(constructor, type, positionalArguments, ReadOnlyArray<IMetadataNamedArgument>.Empty)
{
}
开发者ID:EkardNT,项目名称:Roslyn,代码行数:7,代码来源:CustomAttribute.cs
示例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;
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:10,代码来源:MethodHelper.cs
示例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;
}
开发者ID:lleraromero,项目名称:bytecodetranslator,代码行数:7,代码来源:ExpressionTraverser.cs
示例5: Matches
public bool Matches(IMethodReference method)
{
var sig = CreateIdentifier(method);
_log.Debug("matching: "+sig);
//AKB to rethink
return sig.MethodNameWithoutParams == _identifier.MethodNameWithoutParams;
}
开发者ID:Refresh06,项目名称:visualmutator,代码行数:7,代码来源:CciMethodMatcher.cs
示例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();
}
开发者ID:jamarchist,项目名称:SharpMock,代码行数:8,代码来源:AddInterceptionTargetsToAssembly.cs
示例7: CreateIdentifier
public static MethodIdentifier CreateIdentifier(IMethodReference method)
{
method = MemberHelper.UninstantiateAndUnspecialize(method);
return new MethodIdentifier(MemberHelper.GetMethodSignature(method,
NameFormattingOptions.Signature |
NameFormattingOptions.TypeParameters |
NameFormattingOptions.ParameterModifiers));
}
开发者ID:Refresh06,项目名称:visualmutator,代码行数:8,代码来源:CciMethodMatcher.cs
示例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;
}
开发者ID:jamarchist,项目名称:SharpMock,代码行数:11,代码来源:ReplacementMethodConstructionContext.cs
示例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;
}
开发者ID:dsgouda,项目名称:buildtools,代码行数:12,代码来源:Util.cs
示例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);
}
开发者ID:WrongDog,项目名称:Sequence,代码行数:22,代码来源:ReflectorHelper.cs
示例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();
}
开发者ID:mestriga,项目名称:Microsoft.CciSamples,代码行数:17,代码来源:Mangler.cs
示例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;
}
}
开发者ID:Refresh06,项目名称:visualmutator,代码行数:17,代码来源:EMM_ModiferMethodChange.cs
示例13: AddDependencyForCalledMethod
private void AddDependencyForCalledMethod(IMethodReference method)
{
AddDependency(method.ContainingType, false);
this._methodDependents.Add(method);
}
开发者ID:pgavlin,项目名称:ApiTools,代码行数:6,代码来源:TypeDependencies.cs
示例14: SecurityCustomAttribute
internal SecurityCustomAttribute(SecurityAttribute containingSecurityAttribute, IMethodReference constructorReference, IMetadataNamedArgument[]/*?*/ namedArguments) {
this.ContainingSecurityAttribute = containingSecurityAttribute;
this.ConstructorReference = constructorReference;
this.NamedArguments = namedArguments;
}
开发者ID:RUB-SysSec,项目名称:Probfuscator,代码行数:5,代码来源:Attributes.cs
示例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;
}
开发者ID:RUB-SysSec,项目名称:Probfuscator,代码行数:8,代码来源:Attributes.cs
示例16: CustomAttributeDecoder
internal CustomAttributeDecoder(PEFileToObjectModel peFileToObjectModel, MemoryReader signatureMemoryReader, uint customAttributeRowId,
IMethodReference attributeConstructor)
: base(peFileToObjectModel, signatureMemoryReader) {
this.CustomAttribute = Dummy.CustomAttribute;
ushort prolog = this.SignatureMemoryReader.ReadUInt16();
if (prolog != SerializationType.CustomAttributeStart) return;
int len = attributeConstructor.ParameterCount;
IMetadataExpression[]/*?*/ exprList = len == 0 ? null : new IMetadataExpression[len];
int i = 0;
foreach (var parameter in attributeConstructor.Parameters) {
var parameterType = parameter.Type;
if (parameterType is Dummy) {
// Error...
return;
}
ExpressionBase/*?*/ argument = this.ReadSerializedValue(parameterType);
if (argument == null) {
// Error...
this.decodeFailed = true;
return;
}
exprList[i++] = argument;
}
IMetadataNamedArgument[]/*?*/ namedArgumentArray = null;
if (2 <= (int)this.SignatureMemoryReader.RemainingBytes) {
ushort numOfNamedArgs = this.SignatureMemoryReader.ReadUInt16();
if (numOfNamedArgs > 0) {
namedArgumentArray = new IMetadataNamedArgument[numOfNamedArgs];
for (i = 0; i < numOfNamedArgs; ++i) {
if (0 >= (int)this.SignatureMemoryReader.RemainingBytes) break;
bool isField = this.SignatureMemoryReader.ReadByte() == SerializationType.Field;
ITypeReference/*?*/ memberType = this.GetFieldOrPropType();
if (memberType == null) {
// Error...
return;
}
string/*?*/ memberStr = this.GetSerializedString();
if (memberStr == null)
return;
IName memberName = this.PEFileToObjectModel.NameTable.GetNameFor(memberStr);
ExpressionBase/*?*/ value = this.ReadSerializedValue(memberType);
if (value == null) {
// Error...
return;
}
ITypeReference/*?*/ moduleTypeRef = attributeConstructor.ContainingType;
if (moduleTypeRef == null) {
// Error...
return;
}
FieldOrPropertyNamedArgumentExpression namedArg = new FieldOrPropertyNamedArgumentExpression(memberName, moduleTypeRef, isField, memberType, value);
namedArgumentArray[i] = namedArg;
}
}
}
this.CustomAttribute = peFileToObjectModel.ModuleReader.metadataReaderHost.Rewrite(peFileToObjectModel.Module,
new CustomAttribute(peFileToObjectModel, customAttributeRowId, attributeConstructor, exprList, namedArgumentArray));
}
开发者ID:RUB-SysSec,项目名称:Probfuscator,代码行数:58,代码来源:Attributes.cs
示例17: TraverseChildren
public override void TraverseChildren(IMethodReference methodReference) {
base.TraverseChildren(methodReference);
}
开发者ID:Refresh06,项目名称:visualmutator,代码行数:3,代码来源:ExpressionSourceEmitter.cs
示例18: Visit
/// <summary>
/// Performs some computation with the given method reference.
/// </summary>
public void Visit(IMethodReference methodReference)
{
}
开发者ID:rasiths,项目名称:visual-profiler,代码行数:6,代码来源:Validator.cs
示例19: lock
uint IInternFactory.GetMethodInternedKey(IMethodReference methodReference) {
lock (GlobalLock.LockingObject) {
return this.GetMethodReferenceInternedId(methodReference);
}
}
开发者ID:Refresh06,项目名称:visualmutator,代码行数:5,代码来源:Core.cs
示例20: GetGenericMethodParameterReferenceInternId
/// <summary>
/// Returns the interned key for the generic method parameter constructed with the given index
/// </summary>
/// <param name="definingMethodReference">A reference to the method defining the referenced generic parameter.</param>
/// <param name="index">The index of the referenced generic parameter. This is an index rather than a name because metadata in CLR
/// PE files contain only the index, not the name.</param>
uint GetGenericMethodParameterReferenceInternId(IMethodReference definingMethodReference, uint index) {
Contract.Requires(definingMethodReference != null);
if (!(this.CurrentMethodReference is Dummy)) {
//this happens when the defining method reference contains a type in its signature which either is, or contains,
//a reference to this generic method type parameter. In that case we break the cycle by just using the index of
//the generic parameter. Only method references that refer to their own type parameters will ever
//get this version of the interned id.
return index+1000000; //provide a big offset to minimize the chances of a structural type in the
//signature of the method interning onto some other type that is parameterized by a type whose intern key is index.
}
this.CurrentMethodReference = definingMethodReference; //short circuit recursive calls back to this method
uint definingMethodReferenceInternId = this.GetMethodReferenceInternedId(definingMethodReference);
this.CurrentMethodReference = Dummy.MethodReference;
uint value = this.GenericMethodTypeParameterHashTable.Find(definingMethodReferenceInternId, index);
if (value == 0) {
value = this.CurrentTypeInternValue++;
this.GenericMethodTypeParameterHashTable.Add(definingMethodReferenceInternId, index, value);
}
return value;
}
开发者ID:Refresh06,项目名称:visualmutator,代码行数:27,代码来源:Core.cs
注:本文中的IMethodReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论