Branch Coverage

src/xs/Stash.cc
Criterion Covered Total %
branch 60 110 54.5


line true false branch
19 1 12 if (!val) {
20 1 0 slot(Scalar());
24 0 12 if (SvROK(val)) val = SvRV(val);
25 1 11 if (SvTYPE(val) == SVt_PVGV) return operator=((GV*)val);
32 5 2 if (val) {
38 2 0 slot(Scalar());
39 2 0 slot(Array());
40 2 0 slot(Hash());
41 2 0 slot(Sub());
47 384 555 if (!gv || SvTYPE(gv) == SVt_PVGV) return;
348 36 if (!gv || SvTYPE(gv) == SVt_PVGV) return;
72 210 0 string ret(len+3);
73 210 0 char* dst = ret.buf();
75 3735 210 for (int i = 0; i < len; ++i) {
76 240 3495 if (*src == ':') {
88 210 0 ret.length(dst-ret.buf());
93 1 104 if (!source) throw std::invalid_argument(string("can't register module '") + name() + "': source module doesn't exist");
1 0 if (!source) throw std::invalid_argument(string("can't register module '") + name() + "': source module doesn't exist");
1 0 if (!source) throw std::invalid_argument(string("can't register module '") + name() + "': source module doesn't exist");
1 0 if (!source) throw std::invalid_argument(string("can't register module '") + name() + "': source module doesn't exist");
1 0 if (!source) throw std::invalid_argument(string("can't register module '") + name() + "': source module doesn't exist");
94 104 0 auto inc = Stash::root().hash("INC");
104 0 auto inc = Stash::root().hash("INC");
95 104 0 auto realpath = inc.fetch(source.path());
104 0 auto realpath = inc.fetch(source.path());
96 0 104 if (!realpath) throw std::invalid_argument(string("can't register module '") + name() + "': source module '" + source.name() + "' hasn't been registered");
0 0 if (!realpath) throw std::invalid_argument(string("can't register module '") + name() + "': source module '" + source.name() + "' hasn't been registered");
0 0 if (!realpath) throw std::invalid_argument(string("can't register module '") + name() + "': source module '" + source.name() + "' hasn't been registered");
0 0 if (!realpath) throw std::invalid_argument(string("can't register module '") + name() + "': source module '" + source.name() + "' hasn't been registered");
0 0 if (!realpath) throw std::invalid_argument(string("can't register module '") + name() + "': source module '" + source.name() + "' hasn't been registered");
0 0 if (!realpath) throw std::invalid_argument(string("can't register module '") + name() + "': source module '" + source.name() + "' hasn't been registered");
0 0 if (!realpath) throw std::invalid_argument(string("can't register module '") + name() + "': source module '" + source.name() + "' hasn't been registered");
97 104 0 inc.store(path(), realpath);
104 0 inc.store(path(), realpath);
101 613 0 auto ISA = array("ISA");
102 545 68 if (!ISA) { // we must create @ISA via gv_fetchpvn_flags, because perl is written like a monkey's shit
103 545 0 auto fqn = string(name()) + "::ISA";
545 0 auto fqn = string(name()) + "::ISA";
104 545 0 ISA = GvAV(gv_fetchpvn_flags(fqn.data(), fqn.length(), GV_ADD, SVt_PVAV));
545 0 ISA = GvAV(gv_fetchpvn_flags(fqn.data(), fqn.length(), GV_ADD, SVt_PVAV));
106 613 0 av_push(ISA, Simple::shared(parent.name()).detach()); // can't use ISA.push() syntax, because @ISA is a magical array, otherwise MRO cache won't be cleared
613 0 av_push(ISA, Simple::shared(parent.name()).detach()); // can't use ISA.push() syntax, because @ISA is a magical array, otherwise MRO cache won't be cleared
110 2 0 throw std::invalid_argument(panda::string("can't locate method '") + name + "' via package '" + this->name() + "'");
2 0 throw std::invalid_argument(panda::string("can't locate method '") + name + "' via package '" + this->name() + "'");
2 0 throw std::invalid_argument(panda::string("can't locate method '") + name + "' via package '" + this->name() + "'");
2 0 throw std::invalid_argument(panda::string("can't locate method '") + name + "' via package '" + this->name() + "'");
2 0 throw std::invalid_argument(panda::string("can't locate method '") + name + "' via package '" + this->name() + "'");
2 0 throw std::invalid_argument(panda::string("can't locate method '") + name + "' via package '" + this->name() + "'");
114 0 4 if (name() == parent) return TRUE;
116 4 0 const struct mro_meta*const meta = HvMROMETA((HV*)sv);
119 0 4 if (!isa) {
124 2 2 if (hv_common(isa, NULL, parent.data(), parent.length(), flags, HV_FETCH_ISEXISTS, NULL, hash)) return TRUE;
134 3 2880 if (SvROK(what)) return sv_bless(what, (HV*)sv);
139 5870 0 auto val = _val;
141 5870 0 newCONSTSUB_flags((HV*)sv, name.data(), name.length(), 0, val.detach()); // detach because newCONSTSUB doesn't increment refcnt