X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FMethod%2FConstructor.pm;h=9a95e9e54722e586af83f512e70c1fb3082c0b1a;hb=7931f7dbb7c24340c20560f49e32ec258968949b;hp=ac2803cd7af56d5ee2138d37ea2ad268a3aae94a;hpb=301d65f26c8dffbce037d89208788bf21c40a7b1;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Method/Constructor.pm b/lib/Class/MOP/Method/Constructor.pm index ac2803c..9a95e9e 100644 --- a/lib/Class/MOP/Method/Constructor.pm +++ b/lib/Class/MOP/Method/Constructor.pm @@ -114,6 +114,9 @@ sub _generate_constructor_method_inline { $source .= ";\n" . (join ";\n" => map { $self->_generate_slot_initializer($_, $idx++) } @{ $self->_attributes }); + if (Class::MOP::metaclass_is_weak($self->associated_metaclass->name)) { + $source .= ";\n" . $self->associated_metaclass->_inline_set_mop_slot('$instance', 'Class::MOP::class_of($class)'); + } $source .= ";\n" . 'return $instance'; $source .= ";\n" . '}'; warn $source if $self->options->{debug};