package DX::VarRef;

use Moo;

with 'DX::Role::Ref';

has var_id => (is => 'ro', required => 1);

has derive => (is => 'ro', default => sub { $_[0] });

sub resolve {
  my ($self, $state) = @_;
  $state->resolve_value($state->by_id->{$self->var_id})->${\$self->derive};
}

1;
