namespace Prexonite.Commands.Core.PartialApplication;

public class PartialTypecast : PartialApplicationBase
{
    readonly PType _ptype;

    public PartialTypecast(int[] mappings, PValue[] closedArguments, PType ptype)
        : base(mappings, closedArguments, 1)
    {
        _ptype = ptype;
    }

    protected override PValue Invoke(StackContext sctx, PValue[] nonArguments, PValue[] arguments)
    {
        return nonArguments[0].ConvertTo(sctx, _ptype, true);
    }
}
