本文整理汇总了C#中Mono.Cecil.MethodDefinition.RemainsInRoleInterface方法的典型用法代码示例。如果您正苦于以下问题:C# MethodDefinition.RemainsInRoleInterface方法的具体用法?C# MethodDefinition.RemainsInRoleInterface怎么用?C# MethodDefinition.RemainsInRoleInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.MethodDefinition
的用法示例。
在下文中一共展示了MethodDefinition.RemainsInRoleInterface方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MorphMethod
private void MorphMethod(MethodDefinition method)
{
Tracer.TraceVerbose("Morph method: {0}", method.ToString());
if (method.IsConstructor && method.HasParameters) {
AddMessage(Error.RoleCannotContainParameterizedConstructor(method.DeclaringType, method));
return;
}
bool remove = !method.RemainsInRoleInterface();
if (remove) {
Defer(() => {
method.DeclaringType.Methods.Remove(method);
});
return;
}
if (method.IsFamily || method.IsFamilyOrAssembly) {
// if the method is protected, mark it as guarded
method.MarkAsGuarded(method.DeclaringType.Module);
}
method.Attributes =
MethodAttributes.Public |
MethodAttributes.HideBySig | // TODO: what about HideByName?
MethodAttributes.NewSlot |
MethodAttributes.Abstract |
//MethodAttributes.Strict | // TODO: VB.NET uses this!
MethodAttributes.Virtual;
if (method.IsPropertyAccessor() || method.IsEventAccessor()) {
method.Attributes |= MethodAttributes.SpecialName;
}
// the method body will be cleared in a wrap-up action
Defer(() => {
method.Body = null;
});
}
示例2: RemoveAccessor
private bool RemoveAccessor(MethodDefinition accessor)
{
return !accessor.RemainsInRoleInterface();
}
示例3: AdjustCalls
private void AdjustCalls(MethodDefinition sourceMethod, MethodDefinition staticMethod)
{
if (sourceMethod.IsConstructor) {
// remove base class constructor call ( : base(...) )
// other constructor calls ( : this(...) ) are not present because roles cannot have parameterized constructors
RemoveBaseClassConstructorCall(staticMethod);
}
else {
if (!sourceMethod.RemainsInRoleInterface()) {
// methods that are removed from the role interface must have their callees adjusted to call directly the method in the Code class
// constructors are an not included because calling a role constructor is an error
AdjustMethodCalls(sourceMethod, staticMethod);
}
}
}