From: gfx Date: Mon, 16 Nov 2009 08:35:22 +0000 (+0900) Subject: Revert "Change inline_constructor => 0" X-Git-Tag: 0.40_06~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7efbc77d922079f81c55e2f1535f222979fe1d96;p=gitmo%2FMouse.git Revert "Change inline_constructor => 0" This reverts commit 6423ed47a3392af0da9cd37ac8519583e51feb27. --- diff --git a/lib/Mouse.pm b/lib/Mouse.pm index a0c88d7..0765630 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -141,7 +141,7 @@ sub init_meta { }); $meta->superclasses($base_class) - unless $class->isa($base_class); + unless $meta->superclasses; # make a class type for each Mouse class Mouse::Util::TypeConstraints::class_type($class) diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index 38d3153..8183a96 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -11,7 +11,7 @@ our @ISA = qw(Mouse::Meta::Module); sub method_metaclass() { 'Mouse::Meta::Method' } sub attribute_metaclass() { 'Mouse::Meta::Attribute' } -sub constructor_class() { 'Mouse::Meta::Method::Constructor' } +sub constructor_class(); # XS sub destructor_class() { 'Mouse::Meta::Method::Destructor' } sub _construct_meta { @@ -191,7 +191,7 @@ sub clone_instance { sub make_immutable { my $self = shift; my %args = ( - inline_constructor => 0, + inline_constructor => 1, inline_destructor => 1, constructor_name => 'new', @_, diff --git a/lib/Mouse/PurePerl.pm b/lib/Mouse/PurePerl.pm index ecc61e1..e50b57a 100644 --- a/lib/Mouse/PurePerl.pm +++ b/lib/Mouse/PurePerl.pm @@ -203,6 +203,7 @@ sub add_method { package Mouse::Meta::Class; +sub constructor_class() { 'Mouse::Meta::Method::Constructor' } sub is_anon_class{ return exists $_[0]->{anon_serial_id}; diff --git a/t/001_mouse/813-compatibility-get_method_list.t b/t/001_mouse/813-compatibility-get_method_list.t index 1484384..4b5b124 100644 --- a/t/001_mouse/813-compatibility-get_method_list.t +++ b/t/001_mouse/813-compatibility-get_method_list.t @@ -15,7 +15,7 @@ use Test::More tests => 6; use Mouse; sub foo { } no Mouse; - __PACKAGE__->meta->make_immutable(inline_constructor => 1); + __PACKAGE__->meta->make_immutable(); } { package MouseRole; diff --git a/xs-src/Mouse.xs b/xs-src/Mouse.xs index e5670b2..90a0972 100644 --- a/xs-src/Mouse.xs +++ b/xs-src/Mouse.xs @@ -407,6 +407,8 @@ MODULE = Mouse PACKAGE = Mouse::Meta::Class BOOT: INSTALL_SIMPLE_READER(Class, roles); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Class, is_anon_class, anon_serial_id); + newCONSTSUB(gv_stashpvs("Mouse::Meta::Class", TRUE), "constructor_class", + newSVpvs("Mouse::Meta::Method::Constructor::XS")); void linearized_isa(SV* self) @@ -545,3 +547,16 @@ CODE: } OUTPUT: RETVAL + +MODULE = Mouse PACKAGE = Mouse::Meta::Method::Constructor::XS + +CV* +_generate_constructor(...) +CODE: +{ + RETVAL = get_cvs("Mouse::Object::new", TRUE); + SvREFCNT_inc_simple_void_NN(RETVAL); +} +OUTPUT: + RETVAL +