Branch Coverage

Declare.xs
Criterion Covered Total %
branch 340 426 79.8


line true false branch
34 0 3095 if (c == -1) break;
35 3095 0 if (!isALNUM(c) && c != '_') break;
499 2596 if (!isALNUM(c) && c != '_') break;
499 0 if (!isALNUM(c) && c != '_') break;
39 0 499 if (SvCUR(buf) == 0) {
52 0 765 if (c == -1) break;
53 765 0 if (isALNUM(c) || c == '_') {
156 609 if (isALNUM(c) || c == '_') {
0 156 if (isALNUM(c) || c == '_') {
56 2 154 } else if (c == ':' && PL_parser->bufptr[0] == ':'
2 0 } else if (c == ':' && PL_parser->bufptr[0] == ':'
57 2 0 && PL_parser->bufptr[1] == ':') {
63 1 153 if (SvCUR(buf) == 0) {
75 110 4 if (c == '-' || c == '+') {
1 109 if (c == '-' || c == '+') {
81 160 97 if (c >= '0' && c <= '9') { seen_digit = 1; }
138 22 if (c >= '0' && c <= '9') { seen_digit = 1; }
82 5 114 else if (c == '.' && !seen_dot) {
5 0 else if (c == '.' && !seen_dot) {
85 5 0 char next = (PL_parser->bufptr[0] == '.') ? PL_parser->bufptr[1] : '\0';
86 4 1 if (next < '0' || next > '9') break;
4 0 if (next < '0' || next > '9') break;
89 113 1 else if ((c == 'e' || c == 'E') && seen_digit) {
0 113 else if ((c == 'e' || c == 'E') && seen_digit) {
1 0 else if ((c == 'e' || c == 'E') && seen_digit) {
93 1 0 if (c == '-' || c == '+') {
0 1 if (c == '-' || c == '+') {
103 0 114 if (!seen_digit) {
117 1 237 if (c == -1) croak("switch: unterminated string in case pattern");
118 2 235 if (c == '\\') {
120 0 2 if (next == -1) croak("switch: unterminated string in case pattern");
121 1 1 if (quote == '"') {
131 1 0 if (next != '\\' && next != '\'')
1 0 if (next != '\\' && next != '\'')
135 92 143 } else if (c == quote) {
170 201 216 if (t->kind == SDT_CONST)
190 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)));
223 97 31 if (t->lln_mode == LLN_CONST)
224 86 11 return newSVOP(OP_CONST, 0, boolSV(t->lln_const));
243 7 4 SETs(SvROK(sv) ? sv_2mortal(newSVpv(sv_reftype(SvRV(sv), 0), 0))
284 5 3 if (sentinel)
296 115 90 if (c == '"' || c == '\'') {
1 114 if (c == '"' || c == '\'') {
300 109 5 if ((c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.') {
0 109 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 == '.') {
313 128 98 OP *cmp = newBINOP(is_num ? numop : strop, 0, sd_topic(aTHX_ t), konst);
314 128 98 if (is_num)
334 5 1 REGEXP *rx = SvRXOK(pat) ? SvRX(pat) : NULL;
336 1 5 if (!rx) { rx = pregcomp(pat, 0); owned = 1; }
337 6 0 if (rx) {
340 5 1 if (pregexec(rx, s, s + len, s, 0, str, 1))
342 1 5 if (owned) ReREFCNT_dec(rx);
344 5 1 SETs(boolSV(matched));
391 8 40 if (lex_peek_unichar(0) != '(') return NULL;
395 38 2 if (c == '"' || c == '\'')
0 38 if (c == '"' || c == '\'')
399 0 40 if (!name) croak("switch: expected a name inside (...)");
401 0 40 if (lex_peek_unichar(0) != ')') {
421 1 25 if (lex_peek_unichar(0) != '$')
425 0 25 if (!name) croak("switch: expected a variable name after '$'");
430 24 1 if (off != NOT_IN_PAD) {
438 2 22 if (PAD_COMPNAME_FLAGS_isOUR(off)) {
441 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))
442 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));
463 44 6 if (v->off != NOT_IN_PAD) {
483 16 283 if (c == '/') {
492 1 91 if (c == -1) croak("switch: unterminated regex in case pattern");
493 5 86 if (c == '\\') {
495 0 5 if (n == -1) croak("switch: unterminated regex in case pattern");
500 15 71 if (c == '/') break;
503 8 14 while (isALPHA((c = lex_peek_unichar(0)))) {
527 11 272 if (c == '\\') {
532 1 10 if (lex_peek_unichar(0) != '&')
536 1 9 if (!name) croak("switch: expected sub name after '\\&'");
544 26 246 if (c == '[') {
551 14 12 if (lex_peek_unichar(0) == '.') {
556 1 13 if (lex_peek_unichar(0) != '.')
562 0 13 if (lex_peek_unichar(0) != ']')
576 23 11 if (lex_peek_unichar(0) == ',') lex_read_unichar(0);
578 12 22 if (lex_peek_unichar(0) == ']') { lex_read_unichar(0); break; }
592 21 225 if (c == '=') {
597 11 10 if (c2 == '=') {
608 9 1 if (c2 == '~') {
629 144 81 if (isALPHA(c) || c == '_') {
0 144 if (isALPHA(c) || c == '_') {
633 81 0 const char *wp = word ? SvPV_nolen(word) : "";
643 81 0 CV *cv = word ? get_cvn_flags(SvPVX(word), SvCUR(word), 0) : NULL;
644 6 75 SV *const_val = cv ? cv_const_sv(cv) : NULL;
647 81 0 if (word) {
655 6 75 if (is_eq) {
657 6 0 if (lex_peek_unichar(0) == '$') {
670 7 68 if (is_undef) {
676 25 43 if (is_ref) {
680 5 20 if (!type)
686 11 32 if (is_reftype) {
690 3 8 if (!type)
695 12 20 if (is_isa) {
697 0 12 if (!klass)
702 13 7 if (is_sub) {
706 1 12 if (lex_peek_unichar(0) != '{')
713 6 1 if (const_val) {
717 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);
719 4 2 if (cnum) {
736 80 63 if (!is_num) {
753 0 522 if (!o) return 0;
754 0 522 if (o->op_private & OPpLVAL_INTRO) return 1;
755 27 495 if (o->op_flags & OPf_KIDS) {
756 29 27 for (kid = cUNOPx(o)->op_first; kid; kid = OpSIBLING(kid))
56 27 for (kid = cUNOPx(o)->op_first; kid; kid = OpSIBLING(kid))
757 0 56 if (sd_has_intro(aTHX_ kid)) return 1;
768 473 3 if (block->op_type == OP_LINESEQ) {
770 473 0 if (first
771 0 473 && (first->op_type == OP_NEXTSTATE || first->op_type == OP_DBSTATE)
0 0 && (first->op_type == OP_NEXTSTATE || first->op_type == OP_DBSTATE)
772 473 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
473 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
473 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
7 466 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
7 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
0 7 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
773 466 0 && !sd_has_intro(aTHX_ OpSIBLING(first))) {
466 0 && !sd_has_intro(aTHX_ OpSIBLING(first))) {
774 466 0 OP *expr = OpSIBLING(first);
812 4 5 if (c != '[' && c != '{')
1 3 if (c != '[' && c != '{')
816 0 8 if (pat.shape == DD_LIST) { /* not reachable via [ / { but be explicit */
822 0 8 if (lex_peek_unichar(0) != '{') {
837 5 3 if (dd_is_listassign(&pat) && topic->kind != SDT_CONST) {
4 1 if (dd_is_listassign(&pat) && topic->kind != SDT_CONST) {
886 1 215 if (lex_peek_unichar(0) != '(')
891 0 215 if (lex_peek_unichar(0) != ')')
901 45 170 if (scrutinee->op_type == OP_PADSV
902 45 0 && !(scrutinee->op_private & OPpLVAL_INTRO)) {
908 144 26 else if (scrutinee->op_type == OP_CONST) {
928 144 71 topic_maybe_undef = !(topic.kind == SDT_CONST && SvOK(topic.sv));
0 144 topic_maybe_undef = !(topic.kind == SDT_CONST && SvOK(topic.sv));
934 144 71 if (topic.kind == SDT_CONST && SvOK(topic.sv)) {
144 0 if (topic.kind == SDT_CONST && SvOK(topic.sv)) {
948 0 215 if (lex_peek_unichar(0) != '{')
956 200 499 if (c == '}') { lex_read_unichar(0); break; }
957 0 499 if (c == -1) croak("switch: unexpected end of input in switch body");
960 0 499 if (!kw) croak("switch: expected 'case' or 'default'");
962 300 199 if (strEQ(SvPV_nolen(kw), "case")) {
966 1 299 if (default_block)
968 0 299 if (narms >= MAX_ARMS)
978 122 167 if (topic_maybe_undef && !pat.undef_safe)
53 69 if (topic_maybe_undef && !pat.undef_safe)
984 9 280 if (lex_peek_unichar(0) == '-' && PL_parser->bufptr[1] == '>') {
9 0 if (lex_peek_unichar(0) == '-' && PL_parser->bufptr[1] == '>') {
991 1 279 if (lex_peek_unichar(0) != '{')
1000 259 28 ? ((SVOP *)blk)->op_sv : NULL;
1002 82 205 if (!pat.key || !vals[narms]) dispatchable = 0;
13 69 if (!pat.key || !vals[narms]) dispatchable = 0;
1005 198 1 else if (strEQ(SvPV_nolen(kw), "default")) {
1006 1 197 if (default_block)
1009 0 197 if (lex_peek_unichar(0) != '{')
1024 3 197 if (narms == 0 && !default_block)
1 2 if (narms == 0 && !default_block)
1032 26 173 if (dispatchable && narms >= SD_DISPATCH_MIN) {
9 17 if (dispatchable && narms >= SD_DISPATCH_MIN) {
1038 9 0 HV *hv = GvHVn(gv);
1045 5 4 ? newSVpvn("\1\0Switch::Declare::undef-key\0\1", 28) : NULL;
1046 36 8 for (i = 0; i < narms; i++) {
1049 1 35 if (hv_exists(hv, kpv, klen)) { dup = 1; break; }
1050 0 35 if (!SvOK(vals[i])) any_undef = 1;
1053 8 1 if (!dup && sentinel) {
5 3 if (!dup && sentinel) {
1056 0 5 if (hv_exists(hv, sp, sl)) dup = 1;
1058 1 8 if (dup) {
1062 1 7 : newOP(OP_UNDEF, 0);
1063 0 8 if (any_undef) {
1073 33 8 for (i = 0; i < narms; i++) { op_free(conds[i]); op_free(blocks[i]); }
1075 5 4 if (sentinel) SvREFCNT_dec(sentinel);
1079 191 8 if (!chain) {
1081 3 188 : newOP(OP_UNDEF, 0);
1082 253 191 for (i = narms - 1; i >= 0; i--)
1086 286 199 for (i = 0; i < narms; i++)
1087 82 204 if (keys[i]) SvREFCNT_dec(keys[i]);
1091 70 129 if (topic.lln_mode == LLN_PAD && topic.lln_used) {
19 51 if (topic.lln_mode == LLN_PAD && topic.lln_used) {
1099 174 25 if (topic.kind != SDT_TEMP) {
1100 129 45 if (topic.kind == SDT_CONST) SvREFCNT_dec(topic.sv);
1101 160 14 if (!lln_prelude && all_simple)
150 10 if (!lln_prelude && all_simple)
1107 14 10 if (lln_prelude) {
1133 5 20 if (lln_prelude)
1149 0 219 if (!hints) return 0;
1151 216 3 return ent && SvTRUE(*ent);
216 0 return ent && SvTRUE(*ent);
1155 19896 103794 if (kwlen == 6 && memEQ(kw, "switch", 6) && sd_in_scope(aTHX)) {
219 19677 if (kwlen == 6 && memEQ(kw, "switch", 6) && sd_in_scope(aTHX)) {
216 3 if (kwlen == 6 && memEQ(kw, "switch", 6) && sd_in_scope(aTHX)) {
1196 6 6 RETVAL = (sv_isobject(obj)
1197 8 4 && sv_derived_from(obj, SvPV_nolen(klass))) ? 1 : 0;
6 2 && sv_derived_from(obj, SvPV_nolen(klass))) ? 1 : 0;