src/xs/KeyProxy.cc

filter: Statementstmt 100% 12 / 12 Branchbran 58.3% 14 / 24 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 72.2% 26 / 36 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« src/xs/Simple.cc ↑ Summary src/xs/Scope.cc »
1 #include <xs/KeyProxy.h>
2 #include <xs/Hash.h>
3 #include <xs/Array.h>
4  
5 namespace xs {
6  
7 10 KeyProxy KeyProxy::_geti (size_t key) {
8 10 ▶ if (SvROK(sv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (SvROK(sv)) { 8 2 10
9 8 ▶ Array a(SvRV(sv));
Branch: 1 branch
BranchTrueFalseTotal
Array a(SvRV(sv)); 8 0 8
10 16 ▶ if (a) return a[key];
Branch: 2 branches
BranchTrueFalseTotal
if (a) return a[key]; 8 0 8
if (a) return a[key]; 8 0 8
11 8 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
} 0 8 8
12 2 ▶ throw std::invalid_argument("element is not an array reference");
Branch: 1 branch
BranchTrueFalseTotal
throw std::invalid_argument("element is not an array reference"); 2 0 2
13 }
14  
15 10 KeyProxy KeyProxy::operator[] (const panda::string_view& key) {
16 10 ▶ if (SvROK(sv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (SvROK(sv)) { 8 2 10
17 8 ▶ Hash h(SvRV(sv));
Branch: 1 branch
BranchTrueFalseTotal
Hash h(SvRV(sv)); 8 0 8
18 16 ▶ if (h) return h[key];
Branch: 2 branches
BranchTrueFalseTotal
if (h) return h[key]; 8 0 8
if (h) return h[key]; 8 0 8
19 8 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
} 0 8 8
20 2 ▶ throw std::invalid_argument("element is not a hash reference");
Branch: 1 branch
BranchTrueFalseTotal
throw std::invalid_argument("element is not a hash reference"); 2 0 2
21 }
22  
23 }
« src/xs/Simple.cc ↑ Summary src/xs/Scope.cc »