package MooseX::Sub::Arguments::Positional;
use warnings;
use strict;

use namespace::clean;

use base 'MooseX::Sub::Arguments::Common';

sub process_rest_args {
    my ($class, $type, $struct, $known, $arg_count, $flags, $args) = @_;
    $arg_count += $class->caller_args_start;
    return @$args[ $arg_count .. $#$args ];
}

sub process_scalar_args {
    my ($class, $struct, $flags, $args) = @_;
    my @resolved_args =
        map { $args->[ $_->[0] + $class->caller_args_start ] } @$struct;
    return @resolved_args;
}

sub process_array_arg {
    my ($class, $pos, $name, $type, $flags, $args) = @_;
    return @{ $args->[ $pos + $class->caller_args_start ] };
}

sub process_hash_arg {
    my ($class, $pos, $name, $type, $flags, $args) = @_;
    return %{ $args->[ $pos + $class->caller_args_start ] };
}

1;
