+++ /dev/null
-
-package Moose::Meta::Attribute::Native::MethodProvider::Bool;
-use Moose::Role;
-
-our $VERSION = '1.14';
-$VERSION = eval $VERSION;
-our $AUTHORITY = 'cpan:STEVAN';
-
-sub set : method {
- my ( $attr, $reader, $writer ) = @_;
- return sub { $writer->( $_[0], 1 ) };
-}
-
-sub unset : method {
- my ( $attr, $reader, $writer ) = @_;
- return sub { $writer->( $_[0], 0 ) };
-}
-
-sub toggle : method {
- my ( $attr, $reader, $writer ) = @_;
- return sub { $writer->( $_[0], !$reader->( $_[0] ) ) };
-}
-
-sub not : method {
- my ( $attr, $reader, $writer ) = @_;
- return sub { !$reader->( $_[0] ) };
-}
-
-1;
-
-__END__
-
-=pod
-
-=head1 NAME
-
-Moose::Meta::Attribute::Native::MethodProvider::Bool - role providing method generators for Bool trait
-
-=head1 DESCRIPTION
-
-This is a role which provides the method generators for
-L<Moose::Meta::Attribute::Native::Trait::Bool>. Please check there for
-documentation on what methods are provided.
-
-=head1 METHODS
-
-=over 4
-
-=item B<meta>
-
-=back
-
-=head1 BUGS
-
-See L<Moose/BUGS> for details on reporting bugs.
-
-=head1 AUTHOR
-
-Jason May E<lt>jason.a.may@gmail.comE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2009 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
package Moose::Meta::Attribute::Native::Trait::Bool;
use Moose::Role;
-use Moose::Meta::Attribute::Native::MethodProvider::Bool;
our $VERSION = '1.14';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
+use Moose::Meta::Method::Accessor::Native::Bool::not;
+use Moose::Meta::Method::Accessor::Native::Bool::set;
+use Moose::Meta::Method::Accessor::Native::Bool::toggle;
+use Moose::Meta::Method::Accessor::Native::Bool::unset;
+
+
with 'Moose::Meta::Attribute::Native::Trait';
sub _default_is { 'rw' }
sub _helper_type { 'Bool' }
-has 'method_provider' => (
- is => 'ro',
- isa => 'ClassName',
- predicate => 'has_method_provider',
- default => 'Moose::Meta::Attribute::Native::MethodProvider::Bool'
-);
+sub _native_type { 'Bool' }
no Moose::Role;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Bool::Writer;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Writer';
+
+sub _new_value {q{}}
+sub _potential_value {q{}}
+
+sub _value_needs_copy {0}
+
+# The Bool type does not have any methods that take a user-provided value
+sub _inline_tc_code {q{}}
+
+1;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Bool::not;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Reader';
+
+sub _minimum_arguments { 0 }
+sub _maximum_arguments { 0 }
+
+sub _return_value {
+ my ( $self, $slot_access ) = @_;
+
+ return "! $slot_access";
+}
+
+1;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Bool::set;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Bool::Writer';
+
+sub _minimum_arguments { 0 }
+sub _maximum_arguments { 0 }
+
+sub _inline_optimized_set_new_value {
+ my ( $self, $inv, $new, $slot_access ) = @_;
+
+ return "$slot_access = 1;";
+}
+
+1;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Bool::toggle;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Bool::Writer';
+
+sub _minimum_arguments { 0 }
+sub _maximum_arguments { 0 }
+
+sub _inline_optimized_set_new_value {
+ my ( $self, $inv, $new, $slot_access ) = @_;
+
+ return "$slot_access = $slot_access ? 0 : 1;";
+}
+
+1;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Bool::unset;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Bool::Writer';
+
+sub _minimum_arguments { 0 }
+sub _maximum_arguments { 0 }
+
+sub _inline_optimized_set_new_value {
+ my ( $self, $inv, $new, $slot_access ) = @_;
+
+ return "$slot_access = 0;";
+}
+
+1;