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 33 116 28.4


line true false branch
27 5 50 PANDA_GLOBAL_MEMBER_PTR(TypemapMarker, svt_clear_t, get, &func);
61 32 0 return mg ? mg->mg_ptr : NULL;
65 23 0 auto marker = xs::Sv::PayloadMarker::get();
66 23 0 marker->svt_clear = typemap::object::TypemapMarker::get();
71 23 0 Newx(mg, 1, MAGIC);
89 23 0 static Sv out (const TYPE& var, const Sv& proto) { return _out(var, proto, BACKREF()); }
95 32 0 for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) if (mg->mg_virtual && mg->mg_virtual->svt_clear == marker) return mg;
32 0 for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) if (mg->mg_virtual && mg->mg_virtual->svt_clear == marker) return mg;
32 0 for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) if (mg->mg_virtual && mg->mg_virtual->svt_clear == marker) return mg;
202 23 0 TYPE var = Typemap::template cast(downgraded);
203 0 23 if (!var) throw "TYPEMAP PANIC: bad object in sv";
204 23 0 Typemap::dispose(var, sv);
206 23 0 });}
302 32 0 if (!SvOBJECT(arg)) {
303 32 0 if (SvROK(arg)) {
305 0 32 if (!SvOBJECT(arg)) throw "arg is a reference to non-object";
307 0 0 else if (!SvOK(arg)) return TYPE();
0 0 else if (!SvOK(arg)) return TYPE();
0 0 else if (!SvOK(arg)) return TYPE();
311 32 0 auto ptr = IStorage::get(arg);
312 32 0 if (ptr) {
314 32 0 TYPE ret = cast(downgraded);
315 32 0 if (ret) {
316 0 32 if (!std::is_const::value && SvREADONLY(arg)) throw "cannot modify read-only object";
344 0 23 if (!var) return &PL_sv_undef;
347 0 23 if (proto) {
348 0 0 if (SvROK(proto)) { // ref to object/base
349 0 0 rv = proto;
352 0 0 else if (proto.type() <= SVt_PVMG) { // class name
353 0 0 if (SvOBJECT(proto)) {
355 0 0 rv = Sv::noinc(newRV_noinc(base));
357 0 0 base = newSV_type(SVt_PVMG);
358 0 0 rv = Sv::noinc(newRV_noinc(base));
359 0 0 sv_bless(rv, gv_stashsv(proto, GV_ADD));
0 0 sv_bless(rv, gv_stashsv(proto, GV_ADD));
363 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
364 0 0 base = newSV_type(SVt_PVMG);
365 0 0 rv = Sv::noinc(newRV_noinc(base));
366 0 0 sv_bless(rv, proto.get());
370 0 0 rv = Sv::noinc(newRV(proto));
375 23 0 base = newSV_type(SVt_PVMG);
376 23 0 rv = Sv::noinc(newRV_noinc(base));
380 0 0 if (!SvOBJECT(base)) { // not blessed -> bless to default typemap's class
382 5 18 static PERL_THREAD_LOCAL HV* stash = gv_stashpvn(Typemap::package().data(), Typemap::package().length(), GV_ADD);
5 0 static PERL_THREAD_LOCAL HV* stash = gv_stashpvn(Typemap::package().data(), Typemap::package().length(), GV_ADD);
5 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);
383 23 0 sv_bless(rv, stash); // TODO: custom faster bless
387 23 0 IStorage::set(base, const_cast(IType::out(IType::template cast(var))));
405 55 0 template static inline TO cast (FROM v) { return _cast(v, CastType()); }