From: gfx Date: Sun, 12 Jul 2009 03:54:02 +0000 (+0900) Subject: Remove method object generation stuff, which is no longer required X-Git-Tag: 0.90~19^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c2310a31813d069ab9c12ff55de27817a3899b61;p=gitmo%2FClass-MOP.git Remove method object generation stuff, which is no longer required --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index f5ca01a..0530739 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -742,26 +742,24 @@ sub get_method { my $method_map = $self->_method_map; my $method_object = $method_map->{$method_name}; + my $code = $self->get_package_symbol({ + name => $method_name, + sigil => '&', + type => 'CODE', + }); - if(!($method_object && $method_object->_is_valid_generation)){ - my $code = $self->get_package_symbol({ - name => $method_name, - sigil => '&', - type => 'CODE', - }); - - if(!($code && $self->_code_is_mine($code))){ - delete $method_map->{$method_name}; - return undef; - } - if(!($method_object && $method_object->body == $code)){ + if (!($method_object && $method_object->body == ($code || 0))){ + if ($code && $self->_code_is_mine($code)) { $method_object = $method_map->{$method_name} = $self->wrap_method_body( body => $code, name => $method_name, associated_metaclass => $self, ); - } - $method_object->_update_generation(); + } + else { + delete $method_map->{$method_name}; + return undef; + } } return $method_object; diff --git a/lib/Class/MOP/Method.pm b/lib/Class/MOP/Method.pm index c6e7afc..ea580ab 100644 --- a/lib/Class/MOP/Method.pm +++ b/lib/Class/MOP/Method.pm @@ -57,25 +57,6 @@ sub _new { sub associated_metaclass { shift->{'associated_metaclass'} } -sub _is_valid_generation{ - my($self) = @_; - my $metaclass = $self->associated_metaclass; - - if($metaclass){ - return( ($self->{_generation} || 0) == Class::MOP::check_package_cache_flag($metaclass->name) ); - } - else{ - return 1; - } -} - -sub _update_generation { - my($self) = @_; - my $metaclass = $self->associated_metaclass - or confess("No metaclass associated to the method " . $self->name); - $self->{_generation} = Class::MOP::check_package_cache_flag($metaclass->name); -} - sub attach_to_class { my ( $self, $class ) = @_; $self->{associated_metaclass} = $class;