Branch Coverage

Declare.xs
Criterion Covered Total %
branch 327 412 79.3


line true false branch
25 0 2994 if (c == -1) break;
26 2994 0 if (!isALNUM(c) && c != '_') break;
483 2511 if (!isALNUM(c) && c != '_') break;
483 0 if (!isALNUM(c) && c != '_') break;
30 0 483 if (SvCUR(buf) == 0) {
43 0 688 if (c == -1) break;
44 688 0 if (isALNUM(c) || c == '_') {
140 548 if (isALNUM(c) || c == '_') {
0 140 if (isALNUM(c) || c == '_') {
47 2 138 } else if (c == ':' && PL_parser->bufptr[0] == ':'
2 0 } else if (c == ':' && PL_parser->bufptr[0] == ':'
48 2 0 && PL_parser->bufptr[1] == ':') {
54 1 137 if (SvCUR(buf) == 0) {
66 109 4 if (c == '-' || c == '+') {
1 108 if (c == '-' || c == '+') {
72 159 96 if (c >= '0' && c <= '9') { seen_digit = 1; }
137 22 if (c >= '0' && c <= '9') { seen_digit = 1; }
73 5 113 else if (c == '.' && !seen_dot) {
5 0 else if (c == '.' && !seen_dot) {
76 5 0 char next = (PL_parser->bufptr[0] == '.') ? PL_parser->bufptr[1] : '\0';
77 4 1 if (next < '0' || next > '9') break;
4 0 if (next < '0' || next > '9') break;
80 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) {
84 1 0 if (c == '-' || c == '+') {
0 1 if (c == '-' || c == '+') {
94 0 113 if (!seen_digit) {
108 1 237 if (c == -1) croak("switch: unterminated string in case pattern");
109 2 235 if (c == '\\') {
111 0 2 if (next == -1) croak("switch: unterminated string in case pattern");
112 1 1 if (quote == '"') {
122 1 0 if (next != '\\' && next != '\'')
1 0 if (next != '\\' && next != '\'')
126 92 143 } else if (c == quote) {
161 199 201 if (t->kind == SDT_CONST)
181 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)));
214 97 30 if (t->lln_mode == LLN_CONST)
215 86 11 return newSVOP(OP_CONST, 0, boolSV(t->lln_const));
234 7 4 SETs(SvROK(sv) ? sv_2mortal(newSVpv(sv_reftype(SvRV(sv), 0), 0))
275 5 3 if (sentinel)
287 114 90 if (c == '"' || c == '\'') {
1 113 if (c == '"' || c == '\'') {
291 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 == '.') {
304 127 98 OP *cmp = newBINOP(is_num ? numop : strop, 0, sd_topic(aTHX_ t), konst);
305 127 98 if (is_num)
325 5 1 REGEXP *rx = SvRXOK(pat) ? SvRX(pat) : NULL;
327 1 5 if (!rx) { rx = pregcomp(pat, 0); owned = 1; }
328 6 0 if (rx) {
331 5 1 if (pregexec(rx, s, s + len, s, 0, str, 1))
333 1 5 if (owned) ReREFCNT_dec(rx);
335 5 1 SETs(boolSV(matched));
382 8 32 if (lex_peek_unichar(0) != '(') return NULL;
386 30 2 if (c == '"' || c == '\'')
0 30 if (c == '"' || c == '\'')
390 0 32 if (!name) croak("switch: expected a name inside (...)");
392 0 32 if (lex_peek_unichar(0) != ')') {
412 1 25 if (lex_peek_unichar(0) != '$')
416 0 25 if (!name) croak("switch: expected a variable name after '$'");
421 24 1 if (off != NOT_IN_PAD) {
428 24 0 if (pn && PadnameIsOUR(pn)) {
2 22 if (pn && PadnameIsOUR(pn)) {
431 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))
432 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));
453 44 6 if (v->off != NOT_IN_PAD) {
473 16 274 if (c == '/') {
482 1 91 if (c == -1) croak("switch: unterminated regex in case pattern");
483 5 86 if (c == '\\') {
485 0 5 if (n == -1) croak("switch: unterminated regex in case pattern");
490 15 71 if (c == '/') break;
493 8 14 while (isALPHA((c = lex_peek_unichar(0)))) {
517 11 263 if (c == '\\') {
522 1 10 if (lex_peek_unichar(0) != '&')
526 1 9 if (!name) croak("switch: expected sub name after '\\&'");
534 26 237 if (c == '[') {
541 14 12 if (lex_peek_unichar(0) == '.') {
546 1 13 if (lex_peek_unichar(0) != '.')
552 0 13 if (lex_peek_unichar(0) != ']')
566 23 11 if (lex_peek_unichar(0) == ',') lex_read_unichar(0);
568 12 22 if (lex_peek_unichar(0) == ']') { lex_read_unichar(0); break; }
582 21 216 if (c == '=') {
587 11 10 if (c2 == '=') {
598 9 1 if (c2 == '~') {
619 143 73 if (isALPHA(c) || c == '_') {
0 143 if (isALPHA(c) || c == '_') {
623 73 0 const char *wp = word ? SvPV_nolen(word) : "";
633 73 0 CV *cv = word ? get_cvn_flags(SvPVX(word), SvCUR(word), 0) : NULL;
634 6 67 SV *const_val = cv ? cv_const_sv(cv) : NULL;
637 73 0 if (word) {
645 6 67 if (is_eq) {
647 6 0 if (lex_peek_unichar(0) == '$') {
660 7 60 if (is_undef) {
666 17 43 if (is_ref) {
670 5 12 if (!type)
676 11 32 if (is_reftype) {
680 3 8 if (!type)
685 12 20 if (is_isa) {
687 0 12 if (!klass)
692 13 7 if (is_sub) {
696 1 12 if (lex_peek_unichar(0) != '{')
703 6 1 if (const_val) {
707 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);
709 4 2 if (cnum) {
726 80 62 if (!is_num) {
743 0 518 if (!o) return 0;
744 0 518 if (o->op_private & OPpLVAL_INTRO) return 1;
745 27 491 if (o->op_flags & OPf_KIDS) {
746 29 27 for (kid = cUNOPx(o)->op_first; kid; kid = OpSIBLING(kid))
56 27 for (kid = cUNOPx(o)->op_first; kid; kid = OpSIBLING(kid))
747 0 56 if (sd_has_intro(aTHX_ kid)) return 1;
758 469 0 if (block->op_type == OP_LINESEQ) {
760 469 0 if (first
761 0 469 && (first->op_type == OP_NEXTSTATE || first->op_type == OP_DBSTATE)
0 0 && (first->op_type == OP_NEXTSTATE || first->op_type == OP_DBSTATE)
762 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))
763 462 0 && !sd_has_intro(aTHX_ OpSIBLING(first))) {
462 0 && !sd_has_intro(aTHX_ OpSIBLING(first))) {
764 462 0 OP *expr = OpSIBLING(first);
806 1 207 if (lex_peek_unichar(0) != '(')
811 0 207 if (lex_peek_unichar(0) != ')')
821 41 166 if (scrutinee->op_type == OP_PADSV
822 41 0 && !(scrutinee->op_private & OPpLVAL_INTRO)) {
828 143 23 else if (scrutinee->op_type == OP_CONST) {
848 143 64 topic_maybe_undef = !(topic.kind == SDT_CONST && SvOK(topic.sv));
0 143 topic_maybe_undef = !(topic.kind == SDT_CONST && SvOK(topic.sv));
854 143 64 if (topic.kind == SDT_CONST && SvOK(topic.sv)) {
143 0 if (topic.kind == SDT_CONST && SvOK(topic.sv)) {
868 0 207 if (lex_peek_unichar(0) != '{')
876 193 483 if (c == '}') { lex_read_unichar(0); break; }
877 0 483 if (c == -1) croak("switch: unexpected end of input in switch body");
880 0 483 if (!kw) croak("switch: expected 'case' or 'default'");
882 291 192 if (strEQ(SvPV_nolen(kw), "case")) {
886 1 290 if (default_block)
888 0 290 if (narms >= MAX_ARMS)
898 114 166 if (topic_maybe_undef && !pat.undef_safe)
53 61 if (topic_maybe_undef && !pat.undef_safe)
903 1 279 if (lex_peek_unichar(0) != '{')
911 259 20 ? ((SVOP *)blk)->op_sv : NULL;
913 82 197 if (!pat.key || !vals[narms]) dispatchable = 0;
13 69 if (!pat.key || !vals[narms]) dispatchable = 0;
916 191 1 else if (strEQ(SvPV_nolen(kw), "default")) {
917 1 190 if (default_block)
920 0 190 if (lex_peek_unichar(0) != '{')
935 3 190 if (narms == 0 && !default_block)
1 2 if (narms == 0 && !default_block)
943 26 166 if (dispatchable && narms >= SD_DISPATCH_MIN) {
9 17 if (dispatchable && narms >= SD_DISPATCH_MIN) {
949 9 0 HV *hv = GvHVn(gv);
956 5 4 ? newSVpvn("\1\0Switch::Declare::undef-key\0\1", 28) : NULL;
957 36 8 for (i = 0; i < narms; i++) {
960 1 35 if (hv_exists(hv, kpv, klen)) { dup = 1; break; }
961 0 35 if (!SvOK(vals[i])) any_undef = 1;
964 8 1 if (!dup && sentinel) {
5 3 if (!dup && sentinel) {
967 0 5 if (hv_exists(hv, sp, sl)) dup = 1;
969 1 8 if (dup) {
973 1 7 : newOP(OP_UNDEF, 0);
974 0 8 if (any_undef) {
984 33 8 for (i = 0; i < narms; i++) { op_free(conds[i]); op_free(blocks[i]); }
986 5 4 if (sentinel) SvREFCNT_dec(sentinel);
990 184 8 if (!chain) {
992 3 181 : newOP(OP_UNDEF, 0);
993 245 184 for (i = narms - 1; i >= 0; i--)
997 278 192 for (i = 0; i < narms; i++)
998 82 196 if (keys[i]) SvREFCNT_dec(keys[i]);
1002 64 128 if (topic.lln_mode == LLN_PAD && topic.lln_used) {
19 45 if (topic.lln_mode == LLN_PAD && topic.lln_used) {
1010 169 23 if (topic.kind != SDT_TEMP) {
1011 128 41 if (topic.kind == SDT_CONST) SvREFCNT_dec(topic.sv);
1012 155 14 if (!lln_prelude && all_simple)
150 5 if (!lln_prelude && all_simple)
1018 14 5 if (lln_prelude) {
1044 5 18 if (lln_prelude)
1060 0 211 if (!hints) return 0;
1062 208 3 return ent && SvTRUE(*ent);
208 0 return ent && SvTRUE(*ent);
1066 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)) {
1099 6 6 RETVAL = (sv_isobject(obj)
1100 8 4 && sv_derived_from(obj, SvPV_nolen(klass))) ? 1 : 0;
6 2 && sv_derived_from(obj, SvPV_nolen(klass))) ? 1 : 0;