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.78_02~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=150f8be79166ab0b949ed4297c03107855501e60;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: