The types and functions a top-level conditional declares * (`if (!function_exists('f')) { function f() {} }`): PHP declares them when * the branch runs, and the graph has their nodes. Counted for the dup flags * (count) or written. */
| 770 | * the branch runs, and the graph has their nodes. Counted for the dup flags |
| 771 | * (count) or written. */ |
| 772 | static void php_cond_decls(php_walk_t *w, TSNode n, int depth, bool count) { |
| 773 | if (depth > PHP_COND_DEPTH) { |
| 774 | return; |
| 775 | } |
| 776 | int k = 0; |
| 777 | TSNode *kids = php_children(w, n, &k); |
| 778 | for (int i = 0; i < k && !w->sb->oom; i++) { |
| 779 | TSNode c = kids[i]; |
| 780 | bool type = php_is_type_decl(c); |
| 781 | if (type || php_kind(c, "function_definition")) { |
| 782 | if (count) { |
| 783 | php_count_name(w, c); |
| 784 | } else if (type) { |
| 785 | php_type(w, c); |
| 786 | } else { |
| 787 | php_function(w, c); |
| 788 | } |
| 789 | } else if (php_is_branch(c)) { |
| 790 | php_cond_decls(w, c, depth + SKIP_ONE, count); |
| 791 | } |
| 792 | } |
| 793 | } |
| 794 | |
| 795 | /* One namespace block: kids[from, to) are its statements. Its use imports |
| 796 | * are read first: a supertype is qualified with all of them. */ |
no test coverage detected