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

Function php_dynamic_reference_expr

internal/cbm/lsp/php_lsp.c:1321–1347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1319}
1320
1321static bool php_dynamic_reference_expr(PHPLSPContext *ctx, TSNode expr) {
1322 if (ts_node_is_null(expr)) {
1323 return false;
1324 }
1325 const char *kind = ts_node_type(expr);
1326 if (strstr(kind, "subscript") || strstr(kind, "element_access") ||
1327 strstr(kind, "index_expression") || strstr(kind, "computed")) {
1328 return true;
1329 }
1330
1331 static const char *const terminal_fields[] = {"property", "field", "attribute",
1332 "name", "method", NULL};
1333 for (int i = 0; terminal_fields[i]; i++) {
1334 TSNode terminal = ts_node_child_by_field_name(expr, terminal_fields[i],
1335 (uint32_t)strlen(terminal_fields[i]));
1336 if (ts_node_is_null(terminal)) {
1337 continue;
1338 }
1339 uint32_t start = ts_node_start_byte(terminal);
1340 uint32_t expr_start = ts_node_start_byte(expr);
1341 while (start > expr_start && isspace((unsigned char)ctx->source[start - 1])) {
1342 start--;
1343 }
1344 return start > expr_start && ctx->source[start - 1] == '[';
1345 }
1346 return false;
1347}
1348
1349static bool php_callable_reference_has_dynamic_member_name(PHPLSPContext *ctx, TSNode call) {
1350 const char *call_kind = ts_node_type(call);

Calls

no outgoing calls

Tested by

no test coverage detected