MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / _decl_first_name

Function _decl_first_name

scripts/code_verify_rules.py:2562–2573  ·  view source on GitHub ↗

Best-effort name of the first variable declared in `node`.

(node, src: bytes)

Source from the content-addressed store, hash-verified

2560
2561
2562def _decl_first_name(node, src: bytes) -> str:
2563 """Best-effort name of the first variable declared in `node`."""
2564 for c in node.children:
2565 if c.type == "init_declarator":
2566 target = c.child_by_field_name("declarator") or c
2567 for sub in _walk(target):
2568 if sub.type == "identifier":
2569 return _node_text(sub, src)
2570 for sub in _walk(node):
2571 if sub.type == "identifier":
2572 return _node_text(sub, src)
2573 return "<constant>"
2574
2575
2576def _in_signals_section(node, src: bytes) -> bool:

Callers 1

_cpp_rulesFunction · 0.85

Calls 2

_walkFunction · 0.85
_node_textFunction · 0.85

Tested by

no test coverage detected