public ArgumentSyntax AsArgument(TypePositionInfo info, StubCodeContext context) { if (IsPinningPathSupported(info, context)) { string identifier = context.GetIdentifiers(info).native; return(Argument(CastExpression(AsNativeType(info), IdentifierName(identifier)))); } return(_manualMarshallingGenerator.AsArgument(info, context)); }
public override ArgumentSyntax AsArgument(TypePositionInfo info, StubCodeContext context) { ExpressionSyntax windowsExpr = _windowsMarshaller.AsArgument(info, context).Expression; ExpressionSyntax nonWindowsExpr = _nonWindowsMarshaller.AsArgument(info, context).Expression; // If the Windows and non-Windows syntax are equivalent, just return one of them. if (windowsExpr.IsEquivalentTo(nonWindowsExpr)) { return(Argument(windowsExpr)); } // OperatingSystem.IsWindows() ? << Windows code >> : << non-Windows code >> return(Argument( ConditionalExpression( IsWindows, windowsExpr, nonWindowsExpr))); }