mirror of
https://github.com/github/codeql.git
synced 2026-05-14 19:29:28 +02:00
Yeast: Skip unnamed tokens in AST dump output
Unnamed tokens (keywords, operators, punctuation) in the unnamed children bucket are no longer shown in dump output. They still appear if they are inside a named field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -100,10 +100,14 @@ fn dump_node(ast: &Ast, id: usize, source: &str, options: &DumpOptions, indent:
|
||||
}
|
||||
}
|
||||
|
||||
// Unnamed children
|
||||
// Unnamed children — skip unnamed tokens (keywords, punctuation)
|
||||
if let Some(children) = node.fields.get(&CHILD_FIELD) {
|
||||
for &child_id in children {
|
||||
dump_node(ast, child_id, source, options, indent + 1, out);
|
||||
if let Some(child) = ast.get_node(child_id) {
|
||||
if child.is_named() {
|
||||
dump_node(ast, child_id, source, options, indent + 1, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user