Branch Coverage

src/xs/export.cc
Criterion Covered Total %
branch 84 194 43.3


line true false branch
11 3 0 static PERL_ITHREADS_LOCAL struct {
17 3 0 xs::at_perl_destroy([]{
20 3 0 });
25 0 0 static void throw_noname (Stash s) { throw std::logic_error(string("Export::XS: can't define a constant with an empty name in '") + s.name() + "'"); }
0 0 static void throw_noname (Stash s) { throw std::logic_error(string("Export::XS: can't define a constant with an empty name in '") + s.name() + "'"); }
0 0 static void throw_noname (Stash s) { throw std::logic_error(string("Export::XS: can't define a constant with an empty name in '") + s.name() + "'"); }
0 0 static void throw_noname (Stash s) { throw std::logic_error(string("Export::XS: can't define a constant with an empty name in '") + s.name() + "'"); }
28 3 7 if (!tls.clists) tls.clists = Hash::create();
3 0 if (!tls.clists) tls.clists = Hash::create();
29 10 0 auto clist = tls.clists[stash.name()];
30 3 7 if (!clist.defined()) clist = Ref::create(Array::create());
3 0 if (!clist.defined()) clist = Ref::create(Array::create());
3 0 if (!clist.defined()) clist = Ref::create(Array::create());
3 0 if (!clist.defined()) clist = Ref::create(Array::create());
31 10 0 return Array(clist);
35 0 17 if (!name.length()) throw_noname(stash);
0 0 if (!name.length()) throw_noname(stash);
36 0 17 if (!clist) clist = constants_list(stash);
37 17 0 clist.push(Simple(name));
41 0 0 register_export_impl(stash, name, {});
45 0 18 if (!c.name.length()) throw_noname(stash);
0 0 if (!c.name.length()) throw_noname(stash);
48 1 17 if (stash.sub(c.name)) throw std::logic_error(string("Export::XS: can't create constant '") + stash.name() + "::" + c.name + "' - symbol already exists");
1 0 if (stash.sub(c.name)) throw std::logic_error(string("Export::XS: can't create constant '") + stash.name() + "::" + c.name + "' - symbol already exists");
1 0 if (stash.sub(c.name)) throw std::logic_error(string("Export::XS: can't create constant '") + stash.name() + "::" + c.name + "' - symbol already exists");
1 0 if (stash.sub(c.name)) throw std::logic_error(string("Export::XS: can't create constant '") + stash.name() + "::" + c.name + "' - symbol already exists");
1 0 if (stash.sub(c.name)) throw std::logic_error(string("Export::XS: can't create constant '") + stash.name() + "::" + c.name + "' - symbol already exists");
1 0 if (stash.sub(c.name)) throw std::logic_error(string("Export::XS: can't create constant '") + stash.name() + "::" + c.name + "' - symbol already exists");
1 0 if (stash.sub(c.name)) throw std::logic_error(string("Export::XS: can't create constant '") + stash.name() + "::" + c.name + "' - symbol already exists");
51 17 0 register_export_impl(stash, c.name, clist);
55 0 0 create_constant_impl(stash, c, {});
59 0 0 auto clist = constants_list(stash);
60 0 0 for (auto& c : list) create_constant_impl(stash, c, clist);
0 0 for (auto& c : list) create_constant_impl(stash, c, clist);
0 0 for (auto& c : list) create_constant_impl(stash, c, clist);
64 3 0 auto clist = constants_list(stash);
65 3 0 for (const auto& row : hash) create_constant_impl(stash, Constant(row.key(), row.value()), clist);
13 2 for (const auto& row : hash) create_constant_impl(stash, Constant(row.key(), row.value()), clist);
13 0 for (const auto& row : hash) create_constant_impl(stash, Constant(row.key(), row.value()), clist);
13 0 for (const auto& row : hash) create_constant_impl(stash, Constant(row.key(), row.value()), clist);
13 0 for (const auto& row : hash) create_constant_impl(stash, Constant(row.key(), row.value()), clist);
12 1 for (const auto& row : hash) create_constant_impl(stash, Constant(row.key(), row.value()), clist);
69 4 0 if (!list || !items) return;
0 4 if (!list || !items) return;
70 4 0 auto clist = constants_list(stash);
71 6 3 for (size_t i = 0; i < items - 1; i += 2) {
72 5 1 Simple name = *list++;
74 5 0 create_constant_impl(stash, Constant(name, value), clist);
5 0 create_constant_impl(stash, Constant(name, value), clist);
5 0 create_constant_impl(stash, Constant(name, value), clist);
5 0 create_constant_impl(stash, Constant(name, value), clist);
79 31 0 auto gv = from.fetch(name);
80 31 0 if (!gv.sub()) throw std::logic_error(string("Export::XS: can't export unexisting symbol '") + from.name() + "::" + name + "'");
1 30 if (!gv.sub()) throw std::logic_error(string("Export::XS: can't export unexisting symbol '") + from.name() + "::" + name + "'");
1 0 if (!gv.sub()) throw std::logic_error(string("Export::XS: can't export unexisting symbol '") + from.name() + "::" + name + "'");
1 0 if (!gv.sub()) throw std::logic_error(string("Export::XS: can't export unexisting symbol '") + from.name() + "::" + name + "'");
1 0 if (!gv.sub()) throw std::logic_error(string("Export::XS: can't export unexisting symbol '") + from.name() + "::" + name + "'");
1 0 if (!gv.sub()) throw std::logic_error(string("Export::XS: can't export unexisting symbol '") + from.name() + "::" + name + "'");
1 0 if (!gv.sub()) throw std::logic_error(string("Export::XS: can't export unexisting symbol '") + from.name() + "::" + name + "'");
1 0 if (!gv.sub()) throw std::logic_error(string("Export::XS: can't export unexisting symbol '") + from.name() + "::" + name + "'");
81 30 0 to[name] = gv; // "to[name] = sub" leads to "used once once" warning. setting the whole glob supresses the warning
30 0 to[name] = gv; // "to[name] = sub" leads to "used once once" warning. setting the whole glob supresses the warning
85 3 0 auto clist = constants_list(from);
86 3 0 for (const auto& elem : clist) export_sub(from, to, Simple(elem));
3 0 for (const auto& elem : clist) export_sub(from, to, Simple(elem));
23 3 for (const auto& elem : clist) export_sub(from, to, Simple(elem));
23 0 for (const auto& elem : clist) export_sub(from, to, Simple(elem));
23 0 for (const auto& elem : clist) export_sub(from, to, Simple(elem));
23 0 for (const auto& elem : clist) export_sub(from, to, Simple(elem));
23 0 for (const auto& elem : clist) export_sub(from, to, Simple(elem));
23 0 for (const auto& elem : clist) export_sub(from, to, Simple(elem));
90 2 0 auto gv = tls.self_stash["import"];
91 2 0 auto dsub = stash.sub("import");
92 1 1 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
1 0 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
1 0 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 1 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 0 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 0 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 0 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 0 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 0 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 2 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 2 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
1 1 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 2 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 0 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 0 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
0 0 if (dsub && dsub != gv.sub() && (!dsub.stash() || dsub.stash().name() != "UNIVERSAL")) {
93 0 0 throw std::logic_error(string("Export::XS: can't make autoexport for stash '") + stash.name() + "' - you already have import() sub");
0 0 throw std::logic_error(string("Export::XS: can't make autoexport for stash '") + stash.name() + "' - you already have import() sub");
0 0 throw std::logic_error(string("Export::XS: can't make autoexport for stash '") + stash.name() + "' - you already have import() sub");
0 0 throw std::logic_error(string("Export::XS: can't make autoexport for stash '") + stash.name() + "' - you already have import() sub");
95 2 0 stash["import"] = gv;
2 0 stash["import"] = gv;
98 3 0 }}
3 0 }}