return;
}
-sub inline_set {
+sub _inline_set_value {
my $self = shift;
- my ( $instance, $value ) = @_;
+ my ($instance, $value) = @_;
my $mi = $self->associated_class->get_meta_instance;
- my $code
- = $mi->inline_set_slot_value( $instance, $self->slots, $value ) . ";";
- $code
- .= $mi->inline_weaken_slot_value( $instance, $self->slots, $value )
- . " if ref $value;"
- if $self->is_weak_ref;
+ my @code = ($self->SUPER::_inline_set_value(@_));
- return $code;
+ push @code, (
+ $mi->inline_weaken_slot_value($instance, $self->name, $value),
+ 'if ref ' . $value . ';',
+ ) if $self->is_weak_ref;
+
+ return @code;
}
sub install_delegation {
my $self = shift;
my ($inv, $value) = @_;
- return $self->_store_value($inv, $value) . ';';
+ return $self->associated_attribute->_inline_set_value($inv, $value);
}
sub _inline_get_old_value_for_trigger {
# expressions
-sub _store_value {
- my $self = shift;
- my ($instance, $value) = @_;
-
- return $self->associated_attribute->inline_set($instance, $value) . ';';
-}
-
sub _get_value {
my ($self, $instance) = @_;
- return $self->associated_attribute->inline_get($instance);
+ return $self->associated_attribute->_inline_instance_get($instance);
}
sub _has_value {
my ($self, $instance) = @_;
- return $self->associated_attribute->inline_has($instance);
+ return $self->associated_attribute->_inline_instance_has($instance);
}
sub _auto_deref {
: $instance . '->$reader';
};
-override _store_value => sub {
+override _inline_store_value => sub {
my $self = shift;
my ($instance, $value) = @_;
return $self->_slot_access_can_be_inlined
? super()
- : $instance . '->$writer(' . $value . ')';
+ : $instance . '->$writer(' . $value . ');';
};
override _eval_environment => sub {
-excludes => [
qw(
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
]
sub _potential_value { '[]' }
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' = []';
+ return $slot_access . ' = [];';
}
sub _return_value { '' }
_minimum_arguments
_maximum_arguments
_inline_check_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
],
. '})';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return '@return = splice @{ (' . $slot_access . ') }, $_[0], 1';
+ return '@return = splice @{ (' . $slot_access . ') }, $_[0], 1;';
}
sub _return_value {
_maximum_arguments
_inline_coerce_new_values
_new_members
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
]
sub _new_members { '$_[1]' }
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return 'splice @{ (' . $slot_access . ') }, $_[0], 0, $_[1]';
+ return 'splice @{ (' . $slot_access . ') }, $_[0], 0, $_[1];';
}
sub _return_value {
-excludes => [
qw( _maximum_arguments
_inline_capture_return_value
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value )
]
};
return 'my $old = ' . $slot_access . '->[-1];';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return 'pop @{ (' . $slot_access . ') }';
+ return 'pop @{ (' . $slot_access . ') };';
}
sub _return_value {
with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => {
-excludes => [
qw(
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
]
return '[ @{ (' . $slot_access . ') }, @_ ]';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return 'push @{ (' . $slot_access . ') }, @_';
+ return 'push @{ (' . $slot_access . ') }, @_;';
}
sub _return_value {
_inline_check_arguments
_inline_coerce_new_values
_new_members
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
]
sub _new_members { '$_[1]' }
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . '->[$_[0]] = $_[1]';
+ return $slot_access . '->[$_[0]] = $_[1];';
}
sub _return_value {
qw(
_maximum_arguments
_inline_capture_return_value
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
]
return 'my $old = ' . $slot_access . '->[0];';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return 'shift @{ (' . $slot_access . ') }';
+ return 'shift @{ (' . $slot_access . ') };';
}
sub _return_value {
_minimum_arguments
_inline_process_arguments
_inline_check_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
]
. '})';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return '@return = defined $len '
- . '? (splice @{ (' . $slot_access . ') }, $idx, $len, @_) '
- . ': (splice @{ (' . $slot_access . ') }, $idx)';
+ return (
+ '@return = defined $len',
+ '? (splice @{ (' . $slot_access . ') }, $idx, $len, @_)',
+ ': (splice @{ (' . $slot_access . ') }, $idx);',
+ );
}
sub _return_value {
with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => {
-excludes => [
qw(
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
]
return '[ @_, @{ (' . $slot_access . ') } ]';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return 'unshift @{ (' . $slot_access . ') }, @_';
+ return 'unshift @{ (' . $slot_access . ') }, @_;';
}
sub _return_value {
-excludes => [
qw(
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
sub _potential_value { 1 }
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' = 1';
+ return $slot_access . ' = 1;';
}
no Moose::Role;
-excludes => [
qw(
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return $slot_access . ' ? 0 : 1';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' = ' . $slot_access . ' ? 0 : 1';
+ return $slot_access . ' = ' . $slot_access . ' ? 0 : 1;';
}
no Moose::Role;
-excludes => [
qw(
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
sub _potential_value { 0 }
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' = 0';
+ return $slot_access . ' = 0;';
}
no Moose::Role;
qw(
_minimum_arguments
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return $slot_access . ' - (defined $_[0] ? $_[0] : 1)';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' -= defined $_[0] ? $_[0] : 1';
+ return $slot_access . ' -= defined $_[0] ? $_[0] : 1;';
}
no Moose::Role;
qw(
_minimum_arguments
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return $slot_access . ' + (defined $_[0] ? $_[0] : 1)';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' += defined $_[0] ? $_[0] : 1';
+ return $slot_access . ' += defined $_[0] ? $_[0] : 1;';
}
no Moose::Role;
-excludes => [
qw(
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return '$attr->default($self)';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' = $attr->default($self)';
+ return $slot_access . ' = $attr->default($self);';
}
no Moose::Role;
qw(
_minimum_arguments
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
sub _potential_value { '$_[0]' }
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' = $_[0]';
+ return $slot_access . ' = $_[0];';
}
no Moose::Role;
-excludes => [
qw(
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
]
sub _potential_value { '{}' }
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' = {}';
+ return $slot_access . ' = {};';
}
sub _return_value { '' }
with 'Moose::Meta::Method::Accessor::Native::Hash::Writer' => {
-excludes => [
qw(
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
],
. '})';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return '@return = delete @{ (' . $slot_access . ') }{@_}';
+ return '@return = delete @{ (' . $slot_access . ') }{@_};';
}
sub _return_value {
_inline_process_arguments
_inline_check_arguments
_inline_coerce_new_values
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
],
sub _new_members { '@_[ @values_idx ]' }
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return '@{ (' . $slot_access . ') }{ @_[@keys_idx] } = @_[@values_idx]';
+ return '@{ (' . $slot_access . ') }{ @_[@keys_idx] } = @_[@values_idx];';
}
sub _return_value {
-excludes => [
qw(
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return 'abs(' . $slot_access . ')';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' = abs(' . $slot_access . ')';
+ return $slot_access . ' = abs(' . $slot_access . ');';
}
no Moose::Role;
qw(
_minimum_arguments
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return $slot_access . ' + $_[0]';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' += $_[0]';
+ return $slot_access . ' += $_[0];';
}
no Moose::Role;
qw(
_minimum_arguments
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return $slot_access . ' / $_[0]';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' /= $_[0]';
+ return $slot_access . ' /= $_[0];';
}
no Moose::Role;
qw(
_minimum_arguments
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return $slot_access . ' % $_[0]';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' %= $_[0]';
+ return $slot_access . ' %= $_[0];';
}
no Moose::Role;
qw(
_minimum_arguments
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return $slot_access . ' * $_[0]';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' *= $_[0]';
+ return $slot_access . ' *= $_[0];';
}
no Moose::Role;
qw(
_minimum_arguments
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
sub _potential_value { '$_[0]' }
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' = $_[0]';
+ return $slot_access . ' = $_[0];';
}
no Moose::Role;
qw(
_minimum_arguments
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return $slot_access . ' - $_[0]';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' -= $_[0]';
+ return $slot_access . ' -= $_[0];';
}
no Moose::Role;
qw(
_minimum_arguments
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return '( ' . $slot_access . ' . $_[0] )';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' .= $_[0]';
+ return $slot_access . ' .= $_[0];';
}
no Moose::Role;
-excludes => [
qw(
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
]
. '})';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return '@return = chomp ' . $slot_access;
+ return '@return = chomp ' . $slot_access . ';';
}
sub _return_value {
-excludes => [
qw(
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
]
. '})';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return '@return = chop ' . $slot_access;
+ return '@return = chop ' . $slot_access . ';';
}
sub _return_value {
-excludes => [
qw(
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
sub _potential_value { '""' }
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' = ""';
+ return $slot_access . ' = "";';
}
no Moose::Role;
-excludes => [
qw(
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
. '})';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . '++';
+ return $slot_access . '++;';
}
no Moose::Role;
qw(
_minimum_arguments
_maximum_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
return '$_[0] . ' . $slot_access;
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return $slot_access . ' = $_[0] . ' . $slot_access;
+ return $slot_access . ' = $_[0] . ' . $slot_access . ';';
}
no Moose::Role;
_minimum_arguments
_maximum_arguments
_inline_check_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
)
]
};
. '})';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
- return '(do { '
- . 'ref $_[1] '
- . '? ' . $slot_access . ' =~ s/$_[0]/$_[1]->()/e '
- . ': ' . $slot_access . ' =~ s/$_[0]/$_[1]/; '
- . '})';
+ return (
+ 'ref $_[1]',
+ '? ' . $slot_access . ' =~ s/$_[0]/$_[1]->()/e',
+ ': ' . $slot_access . ' =~ s/$_[0]/$_[1]/;',
+ );
}
no Moose::Role;
_maximum_arguments
_inline_process_arguments
_inline_check_arguments
- _optimized_set_new_value
+ _inline_optimized_set_new_value
_return_value
)
]
. '})';
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
my ($inv, $new, $slot_access) = @_;
return '@return = substr ' . $slot_access . ', '
- . '$offset, $length, $replacement';
+ . '$offset, $length, $replacement;';
}
sub _return_value {
sub _inline_capture_return_value { return }
-sub _set_new_value {
+sub _inline_set_new_value {
my $self = shift;
- return $self->_store_value(@_)
+ return $self->_inline_store_value(@_)
if $self->_value_needs_copy
|| !$self->_slot_access_can_be_inlined
|| !$self->_get_is_lvalue;
- return $self->_optimized_set_new_value(@_);
-}
-
-sub _inline_set_new_value {
- my $self = shift;
- return $self->_set_new_value(@_) . ';';
+ return $self->_inline_optimized_set_new_value(@_);
}
sub _get_is_lvalue {
return $self->associated_attribute->associated_class->instance_metaclass->inline_get_is_lvalue;
}
-sub _optimized_set_new_value {
+sub _inline_optimized_set_new_value {
my $self = shift;
- return $self->_store_value(@_);
+ return $self->_inline_store_value(@_);
}
sub _return_value {
'if (exists $params->{\'' . $init_arg . '\'}) {',
'$attrs->[' . $i . ']->trigger->(',
'$instance,',
- $attr->inline_get('$instance') . ',',
+ $attr->_inline_instance_get('$instance') . ',',
');',
'}';
}
}
else {
push @source, (
- $attr->inline_set('$instance', $value) . ';',
+ $attr->_inline_set_value('$instance', $value),
);
}