INNER CODE UNIT · Python
_collect_strings
uber/NullAway · scripts/nullaway-suppression-remover/src/suppression_remover/core.py:167
def _collect_strings(node: ts.Node, results: list[str]) -> None:
if node.type == "string_literal" and node.text:
text = node.text.decode()
if len(text) >= 2 and text[0] == '"' and text[-1] == '"':
results.append(text[1:-1])
return
for child in node.children:
_collect_strings(child, results)
def _string_literal_nodes(node: ts.Node) -> list[ts.Node]:
"""Return the string-literal descendants of *node* in source order."""
results: list[ts.Node] = []
def collect(current: ts.Node) -> None:
if current.type == "string_literal":
results.append(current)
return