本文整理汇总了C#中Drivers.Compiler.IL.ILPreprocessState.PositionOf方法的典型用法代码示例。如果您正苦于以下问题:C# ILPreprocessState.PositionOf方法的具体用法?C# ILPreprocessState.PositionOf怎么用?C# ILPreprocessState.PositionOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drivers.Compiler.IL.ILPreprocessState
的用法示例。
在下文中一共展示了ILPreprocessState.PositionOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformStackOperations
public override void PerformStackOperations(ILPreprocessState conversionState, ILOp theOp)
{
MethodBase methodToCall = theOp.MethodToCall;
Types.MethodInfo methodToCallInfo = conversionState.TheILLibrary.GetMethodInfo(methodToCall);
if (methodToCall is MethodInfo)
{
if (typeof(Delegate).IsAssignableFrom(((MethodInfo)methodToCall).DeclaringType))
{
List<Type> allParams = ((MethodInfo)methodToCall).GetParameters().Select(x => x.ParameterType).ToList();
Type retType = ((MethodInfo)methodToCall).ReturnType;
Types.TypeInfo retTypeInfo = conversionState.TheILLibrary.GetTypeInfo(retType);
StackItem returnItem = new StackItem()
{
isFloat = Utilities.IsFloat(retType),
sizeOnStackInBytes = retTypeInfo.SizeOnStackInBytes,
isGCManaged = retTypeInfo.IsGCManaged
};
int bytesToAdd = 4;
foreach (Type aParam in allParams)
{
conversionState.CurrentStackFrame.Stack.Pop();
bytesToAdd += conversionState.TheILLibrary.GetTypeInfo(aParam).SizeOnStackInBytes;
}
if (returnItem.sizeOnStackInBytes != 0)
{
conversionState.CurrentStackFrame.Stack.Push(returnItem);
}
}
else
{
string methodIDValueWanted = methodToCallInfo.IDValue.ToString();
int currOpPosition = conversionState.PositionOf(theOp);
Types.TypeInfo declaringTypeInfo = conversionState.TheILLibrary.GetTypeInfo(methodToCall.DeclaringType);
Type retType = ((MethodInfo)methodToCall).ReturnType;
Types.TypeInfo retTypeInfo = conversionState.TheILLibrary.GetTypeInfo(retType);
StackItem returnItem = new StackItem()
{
isFloat = Utilities.IsFloat(retType),
sizeOnStackInBytes = retTypeInfo.SizeOnStackInBytes,
isGCManaged = retTypeInfo.IsGCManaged
};
int bytesToAdd = 0;
List<Type> allParams = ((MethodInfo)methodToCall).GetParameters().Select(x => x.ParameterType).ToList();
if (!methodToCall.IsStatic)
{
allParams.Insert(0, methodToCall.DeclaringType);
}
foreach (Type aParam in allParams)
{
conversionState.CurrentStackFrame.Stack.Pop();
bytesToAdd += conversionState.TheILLibrary.GetTypeInfo(aParam).SizeOnStackInBytes;
}
if (bytesToAdd > 0)
{
if (returnItem.sizeOnStackInBytes != 0)
{
conversionState.CurrentStackFrame.Stack.Push(returnItem);
}
}
else if (returnItem.sizeOnStackInBytes != 0)
{
conversionState.CurrentStackFrame.Stack.Push(returnItem);
}
}
}
}