package Mouse::Meta::TypeConstraint;
use Mouse::Util qw(:meta); # enables strict and warnings
-use Scalar::Util ();
sub new {
my $class = shift;
}
sub _as_string { $_[0]->name } # overload ""
-sub _identity { Scalar::Util::refaddr($_[0]) } # overload 0+
+sub _identity; # overload 0+
sub _unite { # overload infix:<|>
my($lhs, $rhs) = @_;
sub parent { $_[0]->{parent} }
sub message { $_[0]->{message} }
+sub _identity { Scalar::Util::refaddr($_[0]) } # overload 0+
+
sub type_parameter { $_[0]->{type_parameter} }
sub _compiled_type_constraint{ $_[0]->{compiled_type_constraint} }
sub _compiled_type_coercion { $_[0]->{_compiled_type_coercion} }
}
}
-static SV*
+STATIC_INLINE SV*
mouse_initialize_metaclass(pTHX_ SV* const klass) {
- SV* meta = get_metaclass(klass);
-
- if(!SvOK(meta)){
- meta = mcall1s(newSVpvs_flags("Mouse::Meta::Class", SVs_TEMP),
- "initialize", klass);
+ SV* const meta = get_metaclass(klass);
+ if(LIKELY(SvOK(meta))){
+ return meta;
}
-
- return meta;
+ return mcall1s(newSVpvs_flags("Mouse::Meta::Class", SVs_TEMP),
+ "initialize", klass);
}
static void
code_ref );
}
+UV
+_identity(SV* self, ...)
+CODE:
+{
+ if(!SvROK(self)) {
+ croak("Invalid object instance: '%"SVf"'", self);
+ }
+ RETVAL = PTR2UV(SvRV(self));
+}
+OUTPUT:
+ RETVAL
void
compile_type_constraint(SV* self)