]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/commitdiff
LT::Functor: don't process the mods at all if the new set is the same as the old one
authorVincent Pit <vince@profvince.com>
Sun, 1 Aug 2010 20:34:05 +0000 (22:34 +0200)
committerVincent Pit <vince@profvince.com>
Sun, 1 Aug 2010 20:34:05 +0000 (22:34 +0200)
lib/LaTeX/TikZ/Functor.pm

index efa66a095283d48de76a5c120eded45e40946d40..4ccfd32eb289e17e93caa521e95718c892cc6153 100644 (file)
@@ -144,9 +144,10 @@ sub new {
     }
    }
   }
-  my $new_set = $rule ? $rule->handler->($self, $set, @_)
-                      : $set;
-  my $is_new  = $new_set ne $set;
+  return $set unless $rule;
+
+  my $new_set = $rule->handler->($self, $set, @_);
+  return $set if $new_set eq $set;
 
   my @new_mods;
 MOD:
@@ -163,8 +164,7 @@ MOD:
    push @new_mods, $rule ? $rule->handler->($self, $mod, @_)
                          : $mod;
   }
-
-  $new_set->mod(@new_mods) if $is_new;
+  $new_set->mod(@new_mods);
 
   return $new_set;
  }, $class;