From: Dave Rolsky Date: Tue, 17 Mar 2009 16:02:38 +0000 (-0500) Subject: No need to pass an index to an array when we can pass the array member X-Git-Tag: 0.80_01~35 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=64adcd8deeba71253fe6cc378b49918f8e896a39;hp=660319b61906d56d4697e540c4f2ad620a71bb17;p=gitmo%2FClass-MOP.git No need to pass an index to an array when we can pass the array member directly. --- diff --git a/lib/Class/MOP/Method/Constructor.pm b/lib/Class/MOP/Method/Constructor.pm index d027938..ae5a548 100644 --- a/lib/Class/MOP/Method/Constructor.pm +++ b/lib/Class/MOP/Method/Constructor.pm @@ -102,7 +102,7 @@ sub generate_constructor_method_inline { $source .= "\n" . 'my $instance = ' . $self->meta_instance->inline_create_instance('$class'); $source .= ";\n" . (join ";\n" => map { $self->_generate_slot_initializer($_, $close_over) - } 0 .. (@{$self->attributes} - 1)); + } @{$self->attributes}); $source .= ";\n" . 'return $instance'; $source .= ";\n" . '}'; warn $source if $self->options->{debug}; @@ -118,11 +118,9 @@ sub generate_constructor_method_inline { sub _generate_slot_initializer { my $self = shift; - my $index = shift; + my $attr = shift; my $close = shift; - my $attr = $self->attributes->[$index]; - my $default; if ($attr->has_default) { # NOTE: