Branch Coverage

/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/XS/Framework.x/i/xs/typemap/object.h
Criterion Covered Total %
branch 32 110 29.0


line true false branch
26 2 6179 PANDA_GLOBAL_MEMBER_PTR(TypemapMarker, svt_clear_t, get, &func);
58 4925 0 return mg ? mg->mg_ptr : NULL;
62 1256 0 auto marker = xs::Sv::PayloadMarker::get();
63 1256 0 marker->svt_clear = typemap::object::TypemapMarker::get();
68 1256 0 Newx(mg, 1, MAGIC);
86 1256 0 static Sv out (const TYPE& var, const Sv& proto) { return _out(var, proto, BACKREF()); }
92 4925 0 for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) if (mg->mg_virtual && mg->mg_virtual->svt_clear == marker) return mg;
4925 0 for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) if (mg->mg_virtual && mg->mg_virtual->svt_clear == marker) return mg;
4925 0 for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) if (mg->mg_virtual && mg->mg_virtual->svt_clear == marker) return mg;
199 1256 0 TYPE var = Typemap::template cast(downgraded);
200 0 1256 if (!var) throw "TYPEMAP PANIC: bad object in sv";
201 1256 0 Typemap::dispose(var, sv);
203 1256 0 });}
299 4925 0 if (!SvOBJECT(arg)) {
300 4925 0 if (SvROK(arg)) {
302 0 4925 if (!SvOBJECT(arg)) throw "arg is a reference to non-object";
304 0 0 else if (!SvOK(arg)) return TYPE();
0 0 else if (!SvOK(arg)) return TYPE();
0 0 else if (!SvOK(arg)) return TYPE();
309 4925 0 if (ptr) {
312 4925 0 if (ret) {
337 0 1256 if (!var) return &PL_sv_undef;
340 0 1256 if (proto) {
341 0 0 if (SvROK(proto)) { // ref to object/base
342 0 0 rv = proto;
345 0 0 else if (proto.type() < SVt_PVMG) { // class name
346 0 0 base = newSV_type(SVt_PVMG);
347 0 0 rv = Sv::noinc(newRV_noinc(base));
348 0 0 sv_bless(rv, gv_stashsv(proto, GV_ADD));
0 0 sv_bless(rv, gv_stashsv(proto, GV_ADD));
351 0 0 else if (proto.type() == SVt_PVHV && HvNAME(proto)) { // stash
0 0 else if (proto.type() == SVt_PVHV && HvNAME(proto)) { // stash
0 0 else if (proto.type() == SVt_PVHV && HvNAME(proto)) { // stash
0 0 else if (proto.type() == SVt_PVHV && HvNAME(proto)) { // stash
0 0 else if (proto.type() == SVt_PVHV && HvNAME(proto)) { // stash
0 0 else if (proto.type() == SVt_PVHV && HvNAME(proto)) { // stash
0 0 else if (proto.type() == SVt_PVHV && HvNAME(proto)) { // stash
0 0 else if (proto.type() == SVt_PVHV && HvNAME(proto)) { // stash
0 0 else if (proto.type() == SVt_PVHV && HvNAME(proto)) { // stash
352 0 0 base = newSV_type(SVt_PVMG);
353 0 0 rv = Sv::noinc(newRV_noinc(base));
354 0 0 sv_bless(rv, proto.get());
358 0 0 rv = Sv::noinc(newRV(proto));
363 1256 0 base = newSV_type(SVt_PVMG);
364 1256 0 rv = Sv::noinc(newRV_noinc(base));
368 0 0 if (!SvOBJECT(base)) { // not blessed -> bless to default typemap's class
370 2 1254 static PERL_THREAD_LOCAL HV* stash = gv_stashpvn(Typemap::package().data(), Typemap::package().length(), GV_ADD);
2 0 static PERL_THREAD_LOCAL HV* stash = gv_stashpvn(Typemap::package().data(), Typemap::package().length(), GV_ADD);
2 0 static PERL_THREAD_LOCAL HV* stash = gv_stashpvn(Typemap::package().data(), Typemap::package().length(), GV_ADD);
2 0 static PERL_THREAD_LOCAL HV* stash = gv_stashpvn(Typemap::package().data(), Typemap::package().length(), GV_ADD);
2 0 static PERL_THREAD_LOCAL HV* stash = gv_stashpvn(Typemap::package().data(), Typemap::package().length(), GV_ADD);
0 0 static PERL_THREAD_LOCAL HV* stash = gv_stashpvn(Typemap::package().data(), Typemap::package().length(), GV_ADD);
371 1256 0 sv_bless(rv, stash); // TODO: custom faster bless
375 1256 0 IStorage::set(base, const_cast(IType::out(IType::template cast(var))));
393 6181 0 template static inline TO cast (FROM v) { return _cast(v, CastType()); }