private BoundExpression RewriteIntPtrConversion( BoundConversion oldNode, SyntaxNode syntax, BoundExpression rewrittenOperand, Conversion conversion, bool @checked, bool explicitCastInCode, ConstantValue constantValueOpt, TypeSymbol rewrittenType) { Debug.Assert(rewrittenOperand != null); Debug.Assert((object)rewrittenType != null); TypeSymbol source = rewrittenOperand.Type; TypeSymbol target = rewrittenType; SpecialMember member = GetIntPtrConversionMethod(source: rewrittenOperand.Type, target: rewrittenType); MethodSymbol method = GetSpecialTypeMethod(syntax, member); Debug.Assert(!method.ReturnsVoid); Debug.Assert(method.ParameterCount == 1); conversion = conversion.SetConversionMethod(method); if (source.IsNullableType() && target.IsNullableType()) { Debug.Assert(target.IsNullableType()); return RewriteLiftedUserDefinedConversion(syntax, rewrittenOperand, conversion, rewrittenType); } else if (source.IsNullableType()) { rewrittenOperand = MakeConversionNode(rewrittenOperand, source.StrippedType(), @checked); } rewrittenOperand = MakeConversionNode(rewrittenOperand, method.ParameterTypes[0], @checked); var returnType = method.ReturnType; Debug.Assert((object)returnType != null); if (_inExpressionLambda) { return BoundConversion.Synthesized(syntax, rewrittenOperand, conversion, @checked, explicitCastInCode, constantValueOpt, rewrittenType); } var rewrittenCall = MakeCall( syntax: syntax, rewrittenReceiver: null, method: method, rewrittenArguments: ImmutableArray.Create(rewrittenOperand), type: returnType); return MakeConversionNode(rewrittenCall, rewrittenType, @checked); }