diff options
author | Raja R Harinath <harinath@acm.org> | 2003-08-12 23:32:59 +0000 |
---|---|---|
committer | Raja R Harinath <harinath@acm.org> | 2003-08-12 23:32:59 +0000 |
commit | 206ac50a2a2a6a66b090eba7a32c667caf821add (patch) | |
tree | 5f73e635427615a71becd9b1f54250f747a34bae | |
parent | c5548fdc28d66ad8894a5c3e13f8a74cd2f6234a (diff) | |
download | automake-206ac50a2a2a6a66b090eba7a32c667caf821add.tar.gz |
* lib/Automake/Condition.pm (strip): Replace loop with 'grep'.
(not): Replace loop with 'map'.
* lib/Automake/DisjConditions.pm (sub_conditions): Likewise.
* lib/Automake/Item.pm (not_alwasy_defined_in_cond):
Don't 'simplify' result of 'invert', since it's already in
canonical form.
* lib/Automake/Rule.pm (define): Replace loop with
'not_always_defined_in_cond'.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | lib/Automake/Condition.pm | 13 | ||||
-rw-r--r-- | lib/Automake/DisjConditions.pm | 7 | ||||
-rw-r--r-- | lib/Automake/Item.pm | 3 | ||||
-rw-r--r-- | lib/Automake/Rule.pm | 7 |
5 files changed, 17 insertions, 22 deletions
@@ -1,5 +1,14 @@ 2003-08-12 Raja R Harinath <harinath@acm.org> + * lib/Automake/Condition.pm (strip): Replace loop with 'grep'. + (not): Replace loop with 'map'. + * lib/Automake/DisjConditions.pm (sub_conditions): Likewise. + * lib/Automake/Item.pm (not_alwasy_defined_in_cond): + Don't 'simplify' result of 'invert', since it's already in + canonical form. + * lib/Automake/Rule.pm (define): Replace loop with + 'not_always_defined_in_cond'. + * lib/Automake/DisjConditions.pm (ambiguous_p): Typo in comment. * lib/Automake/Rule.pm (accept_extensions, msg_cond_rule): Likewise. (define): Reword comment slightly. diff --git a/lib/Automake/Condition.pm b/lib/Automake/Condition.pm index a9a3cb600..34f443efb 100644 --- a/lib/Automake/Condition.pm +++ b/lib/Automake/Condition.pm @@ -251,11 +251,7 @@ except those of C<$minuscond>. This is the opposite of C<merge>. sub strip ($$) { my ($self, $minus) = @_; - my @res; - foreach my $cond ($self->conds) - { - push @res, $cond unless $minus->has ($cond); - } + my @res = grep { not $minus->has ($_) } $self->conds; return new Automake::Condition @res; } @@ -486,11 +482,8 @@ sub not ($ ) { my ($self) = @_; return @{$self->{'not'}} if defined $self->{'not'}; - my @res; - for my $cond ($self->conds) - { - push @res, new Automake::Condition &conditional_negate ($cond); - } + my @res = + map { new Automake::Condition &conditional_negate ($_) } $self->conds; $self->{'not'} = [@res]; return @res; } diff --git a/lib/Automake/DisjConditions.pm b/lib/Automake/DisjConditions.pm index e5743f551..9204b76bf 100644 --- a/lib/Automake/DisjConditions.pm +++ b/lib/Automake/DisjConditions.pm @@ -433,11 +433,8 @@ sub sub_conditions ($$) my @prodconds = $subcond->multiply ($self->conds); # Now, strip $subcond from the remaining (i.e., non-false) Conditions. - my @res; - foreach my $c (@prodconds) - { - push @res, $c->strip ($subcond) unless $c->false; - } + my @res = map { $_->false ? () : $_->strip ($subcond) } @prodconds; + return new Automake::DisjConditions @res; } diff --git a/lib/Automake/Item.pm b/lib/Automake/Item.pm index f95154c83..02ea8dea7 100644 --- a/lib/Automake/Item.pm +++ b/lib/Automake/Item.pm @@ -180,8 +180,7 @@ sub not_always_defined_in_cond ($$) $self->conditions ->sub_conditions ($cond) ->invert - ->simplify - ->multiply ($cond); + ->multiply ($cond); } diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm index 4bef2b4cb..fd6471d45 100644 --- a/lib/Automake/Rule.pm +++ b/lib/Automake/Rule.pm @@ -740,11 +740,8 @@ sub define ($$$$$) # was already defined in condition COND1 and we want to define # it in condition TRUE, then define it only in condition !COND1. # (See cond14.test and cond15.test for some test cases.) - @conds = (); - for my $undefined_cond ($rule->conditions->invert->conds) - { - push @conds, $cond->merge ($undefined_cond); - } + @conds = $rule->not_always_defined_in_cond ($cond)->conds; + # No conditions left to define the rule. # Warn, because our workaround is meaningless in this case. if (scalar @conds == 0) |