Branch Coverage

Declare.xs
Criterion Covered Total %
branch 326 410 79.5


line true false branch
29 0 2994 if (c == -1) break;
30 2994 0 if (!isALNUM(c) && c != '_') break;
483 2511 if (!isALNUM(c) && c != '_') break;
483 0 if (!isALNUM(c) && c != '_') break;
34 0 483 if (SvCUR(buf) == 0) {
47 0 688 if (c == -1) break;
48 688 0 if (isALNUM(c) || c == '_') {
140 548 if (isALNUM(c) || c == '_') {
0 140 if (isALNUM(c) || c == '_') {
51 2 138 } else if (c == ':' && PL_parser->bufptr[0] == ':'
2 0 } else if (c == ':' && PL_parser->bufptr[0] == ':'
52 2 0 && PL_parser->bufptr[1] == ':') {
58 1 137 if (SvCUR(buf) == 0) {
70 109 4 if (c == '-' || c == '+') {
1 108 if (c == '-' || c == '+') {
76 159 96 if (c >= '0' && c <= '9') { seen_digit = 1; }
137 22 if (c >= '0' && c <= '9') { seen_digit = 1; }
77 5 113 else if (c == '.' && !seen_dot) {
5 0 else if (c == '.' && !seen_dot) {
80 5 0 char next = (PL_parser->bufptr[0] == '.') ? PL_parser->bufptr[1] : '\0';
81 4 1 if (next < '0' || next > '9') break;
4 0 if (next < '0' || next > '9') break;
84 112 1 else if ((c == 'e' || c == 'E') && seen_digit) {
0 112 else if ((c == 'e' || c == 'E') && seen_digit) {
1 0 else if ((c == 'e' || c == 'E') && seen_digit) {
88 1 0 if (c == '-' || c == '+') {
0 1 if (c == '-' || c == '+') {
98 0 113 if (!seen_digit) {
112 1 237 if (c == -1) croak("switch: unterminated string in case pattern");
113 2 235 if (c == '\\') {
115 0 2 if (next == -1) croak("switch: unterminated string in case pattern");
116 1 1 if (quote == '"') {
126 1 0 if (next != '\\' && next != '\'')
1 0 if (next != '\\' && next != '\'')
130 92 143 } else if (c == quote) {
165 199 201 if (t->kind == SDT_CONST)
185 216 0 SETs(boolSV(sv && SvOK(sv) && looks_like_number(sv)));
207 9 SETs(boolSV(sv && SvOK(sv) && looks_like_number(sv)));
205 2 SETs(boolSV(sv && SvOK(sv) && looks_like_number(sv)));
218 97 30 if (t->lln_mode == LLN_CONST)
219 86 11 return newSVOP(OP_CONST, 0, boolSV(t->lln_const));
238 7 4 SETs(SvROK(sv) ? sv_2mortal(newSVpv(sv_reftype(SvRV(sv), 0), 0))
279 5 3 if (sentinel)
291 114 90 if (c == '"' || c == '\'') {
1 113 if (c == '"' || c == '\'') {
295 108 5 if ((c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.') {
0 108 if ((c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.') {
1 4 if ((c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.') {
0 1 if ((c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.') {
0 0 if ((c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.') {
308 127 98 OP *cmp = newBINOP(is_num ? numop : strop, 0, sd_topic(aTHX_ t), konst);
309 127 98 if (is_num)
329 5 1 REGEXP *rx = SvRXOK(pat) ? SvRX(pat) : NULL;
331 1 5 if (!rx) { rx = pregcomp(pat, 0); owned = 1; }
332 6 0 if (rx) {
335 5 1 if (pregexec(rx, s, s + len, s, 0, str, 1))
337 1 5 if (owned) ReREFCNT_dec(rx);
339 5 1 SETs(boolSV(matched));
386 8 32 if (lex_peek_unichar(0) != '(') return NULL;
390 30 2 if (c == '"' || c == '\'')
0 30 if (c == '"' || c == '\'')
394 0 32 if (!name) croak("switch: expected a name inside (...)");
396 0 32 if (lex_peek_unichar(0) != ')') {
416 1 25 if (lex_peek_unichar(0) != '$')
420 0 25 if (!name) croak("switch: expected a variable name after '$'");
425 24 1 if (off != NOT_IN_PAD) {
433 2 22 if (PAD_COMPNAME_FLAGS_isOUR(off)) {
436 2 0 if (stash && HvNAME(stash))
2 0 if (stash && HvNAME(stash))
2 0 if (stash && HvNAME(stash))
0 2 if (stash && HvNAME(stash))
2 0 if (stash && HvNAME(stash))
0 2 if (stash && HvNAME(stash))
2 0 if (stash && HvNAME(stash))
437 2 0 sv_catpvf(q, "%s::", HvNAME(stash));
2 0 sv_catpvf(q, "%s::", HvNAME(stash));
0 2 sv_catpvf(q, "%s::", HvNAME(stash));
0 0 sv_catpvf(q, "%s::", HvNAME(stash));
2 0 sv_catpvf(q, "%s::", HvNAME(stash));
0 2 sv_catpvf(q, "%s::", HvNAME(stash));
458 44 6 if (v->off != NOT_IN_PAD) {
478 16 274 if (c == '/') {
487 1 91 if (c == -1) croak("switch: unterminated regex in case pattern");
488 5 86 if (c == '\\') {
490 0 5 if (n == -1) croak("switch: unterminated regex in case pattern");
495 15 71 if (c == '/') break;
498 8 14 while (isALPHA((c = lex_peek_unichar(0)))) {
522 11 263 if (c == '\\') {
527 1 10 if (lex_peek_unichar(0) != '&')
531 1 9 if (!name) croak("switch: expected sub name after '\\&'");
539 26 237 if (c == '[') {
546 14 12 if (lex_peek_unichar(0) == '.') {
551 1 13 if (lex_peek_unichar(0) != '.')
557 0 13 if (lex_peek_unichar(0) != ']')
571 23 11 if (lex_peek_unichar(0) == ',') lex_read_unichar(0);
573 12 22 if (lex_peek_unichar(0) == ']') { lex_read_unichar(0); break; }
587 21 216 if (c == '=') {
592 11 10 if (c2 == '=') {
603 9 1 if (c2 == '~') {
624 143 73 if (isALPHA(c) || c == '_') {
0 143 if (isALPHA(c) || c == '_') {
628 73 0 const char *wp = word ? SvPV_nolen(word) : "";
638 73 0 CV *cv = word ? get_cvn_flags(SvPVX(word), SvCUR(word), 0) : NULL;
639 6 67 SV *const_val = cv ? cv_const_sv(cv) : NULL;
642 73 0 if (word) {
650 6 67 if (is_eq) {
652 6 0 if (lex_peek_unichar(0) == '$') {
665 7 60 if (is_undef) {
671 17 43 if (is_ref) {
675 5 12 if (!type)
681 11 32 if (is_reftype) {
685 3 8 if (!type)
690 12 20 if (is_isa) {
692 0 12 if (!klass)
697 13 7 if (is_sub) {
701 1 12 if (lex_peek_unichar(0) != '{')
708 6 1 if (const_val) {
712 3 3 int cnum = (SvIOK(const_val) || SvNOK(const_val)) && !SvPOK(const_val);
1 2 int cnum = (SvIOK(const_val) || SvNOK(const_val)) && !SvPOK(const_val);
4 0 int cnum = (SvIOK(const_val) || SvNOK(const_val)) && !SvPOK(const_val);
714 4 2 if (cnum) {
731 80 62 if (!is_num) {
748 0 518 if (!o) return 0;
749 0 518 if (o->op_private & OPpLVAL_INTRO) return 1;
750 27 491 if (o->op_flags & OPf_KIDS) {
751 29 27 for (kid = cUNOPx(o)->op_first; kid; kid = OpSIBLING(kid))
56 27 for (kid = cUNOPx(o)->op_first; kid; kid = OpSIBLING(kid))
752 0 56 if (sd_has_intro(aTHX_ kid)) return 1;
763 469 0 if (block->op_type == OP_LINESEQ) {
765 469 0 if (first
766 0 469 && (first->op_type == OP_NEXTSTATE || first->op_type == OP_DBSTATE)
0 0 && (first->op_type == OP_NEXTSTATE || first->op_type == OP_DBSTATE)
767 469 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
469 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
469 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
7 462 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
7 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
0 7 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
768 462 0 && !sd_has_intro(aTHX_ OpSIBLING(first))) {
462 0 && !sd_has_intro(aTHX_ OpSIBLING(first))) {
769 462 0 OP *expr = OpSIBLING(first);
811 1 207 if (lex_peek_unichar(0) != '(')
816 0 207 if (lex_peek_unichar(0) != ')')
826 41 166 if (scrutinee->op_type == OP_PADSV
827 41 0 && !(scrutinee->op_private & OPpLVAL_INTRO)) {
833 143 23 else if (scrutinee->op_type == OP_CONST) {
853 143 64 topic_maybe_undef = !(topic.kind == SDT_CONST && SvOK(topic.sv));
0 143 topic_maybe_undef = !(topic.kind == SDT_CONST && SvOK(topic.sv));
859 143 64 if (topic.kind == SDT_CONST && SvOK(topic.sv)) {
143 0 if (topic.kind == SDT_CONST && SvOK(topic.sv)) {
873 0 207 if (lex_peek_unichar(0) != '{')
881 193 483 if (c == '}') { lex_read_unichar(0); break; }
882 0 483 if (c == -1) croak("switch: unexpected end of input in switch body");
885 0 483 if (!kw) croak("switch: expected 'case' or 'default'");
887 291 192 if (strEQ(SvPV_nolen(kw), "case")) {
891 1 290 if (default_block)
893 0 290 if (narms >= MAX_ARMS)
903 114 166 if (topic_maybe_undef && !pat.undef_safe)
53 61 if (topic_maybe_undef && !pat.undef_safe)
908 1 279 if (lex_peek_unichar(0) != '{')
916 259 20 ? ((SVOP *)blk)->op_sv : NULL;
918 82 197 if (!pat.key || !vals[narms]) dispatchable = 0;
13 69 if (!pat.key || !vals[narms]) dispatchable = 0;
921 191 1 else if (strEQ(SvPV_nolen(kw), "default")) {
922 1 190 if (default_block)
925 0 190 if (lex_peek_unichar(0) != '{')
940 3 190 if (narms == 0 && !default_block)
1 2 if (narms == 0 && !default_block)
948 26 166 if (dispatchable && narms >= SD_DISPATCH_MIN) {
9 17 if (dispatchable && narms >= SD_DISPATCH_MIN) {
954 9 0 HV *hv = GvHVn(gv);
961 5 4 ? newSVpvn("\1\0Switch::Declare::undef-key\0\1", 28) : NULL;
962 36 8 for (i = 0; i < narms; i++) {
965 1 35 if (hv_exists(hv, kpv, klen)) { dup = 1; break; }
966 0 35 if (!SvOK(vals[i])) any_undef = 1;
969 8 1 if (!dup && sentinel) {
5 3 if (!dup && sentinel) {
972 0 5 if (hv_exists(hv, sp, sl)) dup = 1;
974 1 8 if (dup) {
978 1 7 : newOP(OP_UNDEF, 0);
979 0 8 if (any_undef) {
989 33 8 for (i = 0; i < narms; i++) { op_free(conds[i]); op_free(blocks[i]); }
991 5 4 if (sentinel) SvREFCNT_dec(sentinel);
995 184 8 if (!chain) {
997 3 181 : newOP(OP_UNDEF, 0);
998 245 184 for (i = narms - 1; i >= 0; i--)
1002 278 192 for (i = 0; i < narms; i++)
1003 82 196 if (keys[i]) SvREFCNT_dec(keys[i]);
1007 64 128 if (topic.lln_mode == LLN_PAD && topic.lln_used) {
19 45 if (topic.lln_mode == LLN_PAD && topic.lln_used) {
1015 169 23 if (topic.kind != SDT_TEMP) {
1016 128 41 if (topic.kind == SDT_CONST) SvREFCNT_dec(topic.sv);
1017 155 14 if (!lln_prelude && all_simple)
150 5 if (!lln_prelude && all_simple)
1023 14 5 if (lln_prelude) {
1049 5 18 if (lln_prelude)
1065 0 211 if (!hints) return 0;
1067 208 3 return ent && SvTRUE(*ent);
208 0 return ent && SvTRUE(*ent);
1071 19033 99275 if (kwlen == 6 && memEQ(kw, "switch", 6) && sd_in_scope(aTHX)) {
211 18822 if (kwlen == 6 && memEQ(kw, "switch", 6) && sd_in_scope(aTHX)) {
208 3 if (kwlen == 6 && memEQ(kw, "switch", 6) && sd_in_scope(aTHX)) {
1104 6 6 RETVAL = (sv_isobject(obj)
1105 8 4 && sv_derived_from(obj, SvPV_nolen(klass))) ? 1 : 0;
6 2 && sv_derived_from(obj, SvPV_nolen(klass))) ? 1 : 0;