From: Dave Rolsky Date: Sun, 26 Sep 2010 05:20:06 +0000 (-0500) Subject: Always get inlining code from meta-attr/class, never direct from meta-instance X-Git-Tag: 1.15~71 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b6b0bb1730b53ae17474aa153da3240c695719c3;p=gitmo%2FMoose.git Always get inlining code from meta-attr/class, never direct from meta-instance --- diff --git a/lib/Moose/Meta/Method/Constructor.pm b/lib/Moose/Meta/Method/Constructor.pm index 807ea11..e271b5c 100644 --- a/lib/Moose/Meta/Method/Constructor.pm +++ b/lib/Moose/Meta/Method/Constructor.pm @@ -129,7 +129,7 @@ sub _generate_params { sub _generate_instance { my ( $self, $var, $class_var ) = @_; "my $var = " - . $self->_meta_instance->inline_create_instance($class_var) . ";\n"; + . $self->associated_metaclass->inline_create_instance($class_var) . ";\n"; } sub _generate_slot_initializers { @@ -186,10 +186,7 @@ sub _generate_triggers { . $i . ']->trigger->(' . '$instance, ' - . $self->_meta_instance->inline_get_slot_value( - '$instance', - $attr->name, - ) + . $attr->inline_get('$instance') . ', ' . ');' . "\n}"; } @@ -273,32 +270,18 @@ sub _generate_slot_assignment { my $source; - if ($attr->has_initializer) { - $source = ( - '$attrs->[' . $index . ']->set_initial_value($instance, ' . $value . ');' - ); + if ( $attr->has_initializer ) { + return + '$attrs->[' + . $index + . ']->set_initial_value($instance, ' + . $value . ');'; } else { - $source = ( - $self->_meta_instance->inline_set_slot_value( - '$instance', - $attr->name, - $value - ) . ';' - ); - } - - my $is_moose = $attr->isa('Moose::Meta::Attribute'); # XXX FIXME - - if ($is_moose && $attr->is_weak_ref) { - $source .= ( - "\n" . - $self->_meta_instance->inline_weaken_slot_value( - '$instance', - $attr->name - ) . - ' if ref ' . $value . ';' - ); + return $attr->inline_set( + '$instance', + $value + ) . ';'; } return $source;