| 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
| Branch | True | False | Total |
| if (SvROK(sv)) { |
8 |
2 |
10 |
|
| 9 |
8 |
▶ | Array a(SvRV(sv)); |
Branch: 1 branch
| Branch | True | False | Total |
| Array a(SvRV(sv)); |
8 |
0 |
8 |
|
| 10 |
16 |
▶ | if (a) return a[key]; |
Branch: 2 branches
| Branch | True | False | Total |
| if (a) return a[key]; |
8 |
0 |
8 |
| if (a) return a[key]; |
8 |
0 |
8 |
|
| 11 |
8 |
▶ | } |
Branch: 1 branch
| Branch | True | False | Total |
| } |
0 |
8 |
8 |
|
| 12 |
2 |
▶ | throw std::invalid_argument("element is not an array reference"); |
Branch: 1 branch
| Branch | True | False | Total |
| 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
| Branch | True | False | Total |
| if (SvROK(sv)) { |
8 |
2 |
10 |
|
| 17 |
8 |
▶ | Hash h(SvRV(sv)); |
Branch: 1 branch
| Branch | True | False | Total |
| Hash h(SvRV(sv)); |
8 |
0 |
8 |
|
| 18 |
16 |
▶ | if (h) return h[key]; |
Branch: 2 branches
| Branch | True | False | Total |
| if (h) return h[key]; |
8 |
0 |
8 |
| if (h) return h[key]; |
8 |
0 |
8 |
|
| 19 |
8 |
▶ | } |
Branch: 1 branch
| Branch | True | False | Total |
| } |
0 |
8 |
8 |
|
| 20 |
2 |
▶ | throw std::invalid_argument("element is not a hash reference"); |
Branch: 1 branch
| Branch | True | False | Total |
| throw std::invalid_argument("element is not a hash reference"); |
2 |
0 |
2 |
|
| 21 |
|
| } |
| 22 |
|
| |
| 23 |
|
| } |