本文整理汇总了C#中Internal.TypeSystem.MethodDesc.DetectSpecialMethodKind方法的典型用法代码示例。如果您正苦于以下问题:C# MethodDesc.DetectSpecialMethodKind方法的具体用法?C# MethodDesc.DetectSpecialMethodKind怎么用?C# MethodDesc.DetectSpecialMethodKind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Internal.TypeSystem.MethodDesc
的用法示例。
在下文中一共展示了MethodDesc.DetectSpecialMethodKind方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompileMethod
public void CompileMethod(MethodDesc method)
{
_compilation.Log.WriteLine("Compiling " + method.ToString());
SpecialMethodKind kind = method.DetectSpecialMethodKind();
if (kind != SpecialMethodKind.Unknown)
{
string specialMethodCode = CompileSpecialMethod(method, kind);
_compilation.GetRegisteredMethod(method).MethodCode = specialMethodCode;
return;
}
var methodIL = _compilation.GetMethodIL(method);
if (methodIL == null)
return;
string methodCode;
try
{
var ilImporter = new ILImporter(_compilation, this, method, methodIL);
CompilerTypeSystemContext typeSystemContext = _compilation.TypeSystemContext;
if (!_compilation.Options.NoLineNumbers)
{
IEnumerable<ILSequencePoint> sequencePoints = typeSystemContext.GetSequencePointsForMethod(method);
if (sequencePoints != null)
ilImporter.SetSequencePoints(sequencePoints);
}
IEnumerable<LocalVariable> localVariables = typeSystemContext.GetLocalVariableNamesForMethod(method);
if (localVariables != null)
ilImporter.SetLocalVariables(localVariables);
IEnumerable<string> parameters = typeSystemContext.GetParameterNamesForMethod(method);
if (parameters != null)
ilImporter.SetParameterNames(parameters);
methodCode = ilImporter.Compile();
}
catch (Exception e)
{
_compilation.Log.WriteLine(e.Message + " (" + method + ")");
methodCode = GetCppMethodDeclaration(method, true) + " { throw 0xC000C000; }" + Environment.NewLine;
}
_compilation.GetRegisteredMethod(method).MethodCode = methodCode;
}
示例2: PInvokeMethodNode
public PInvokeMethodNode(MethodDesc target)
{
Debug.Assert(target.DetectSpecialMethodKind() == SpecialMethodKind.PInvoke);
_target = target;
}