1 package DX::Step::ConsiderProposition;
4 use DX::ActionBuilder::UnsetValue;
9 has proposition => (is => 'ro', isa => Proposition, required => 1);
13 my $hyp = $ss->current_hypothesis;
16 [ symbol => 'consider' ],
17 @{$self->proposition->for_deparse->[1]},
20 my $old_scope = (my $old_hyp = $ss->current_hypothesis)->scope;
21 my @old_locals = @{$old_scope->locals};
22 my $top_level = $#old_locals;
23 my $top = pop @old_locals;
24 my $top_members = $top->members;
25 my @new_names = grep !exists $top_members->{$_},
26 keys %{$self->proposition->introduced_names};
27 my $new_scope = $old_scope->but(
30 $top->but(members => {
32 map +($_ => DX::Value::Unset->new(
33 action_builder => DX::ActionBuilder::UnsetValue->new(
34 target_path => [ $top_level, $_ ],
41 %{$old_scope->lex_map},
42 map +($_ => [ $top_level, $_ ]), @new_names
45 my $new_hyp = $old_hyp->but(scope => $new_scope);
47 current_hypothesis => $new_hyp,
48 next_step => $self->proposition->resolve_for($new_scope)