本文整理匯總了C#中AST.GenerateAsRight方法的典型用法代碼示例。如果您正苦於以下問題:C# AST.GenerateAsRight方法的具體用法?C# AST.GenerateAsRight怎麽用?C# AST.GenerateAsRight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AST
的用法示例。
在下文中一共展示了AST.GenerateAsRight方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GenerateBoxable
GenerateBoxable(
AST.Exp exp,
System.Type tTarget
)
{
Debug.Assert(tTarget != null);
System.Type tSource = exp.CLRType;
exp.GenerateAsRight(this);
// Check if we need to box.
// Null expressions don't have a clr type. But they're not value
// types so they don't have to be boxed.
if (tSource != null)
{
// Strip off references to look at base types
if (tSource.IsByRef)
tSource = tSource.GetElementType();
if (tTarget.IsByRef)
tTarget = tTarget.GetElementType();
if (tSource.IsValueType && !tTarget.IsValueType)
m_ilGenerator.Emit(OpCodes.Box, tSource);
}
else
{
// Make sure this really is a null and not just an unresolved type
// Note that ArgExp can be null, but can't be boxed.
Debug.Assert(AST.Exp.CanBeNullType(exp));
}
}