MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / php_cond_decls

Function php_cond_decls

internal/cbm/doclink_php.c:772–793  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

770 * the branch runs, and the graph has their nodes. Counted for the dup flags
771 * (count) or written. */
772static 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. */

Callers 2

php_blockFunction · 0.85
php_count_namesFunction · 0.85

Calls 7

php_childrenFunction · 0.85
php_is_type_declFunction · 0.85
php_kindFunction · 0.85
php_count_nameFunction · 0.85
php_typeFunction · 0.85
php_functionFunction · 0.85
php_is_branchFunction · 0.85

Tested by

no test coverage detected