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)); } }