Rust: suppress TypeAnchor in the generator

This commit is contained in:
Paolo Tranquilli
2025-06-20 17:42:05 +02:00
parent 492b0cd2e8
commit 12aa93b578

View File

@@ -295,7 +295,7 @@ fn get_fields(node: &AstNodeSrc) -> Vec<FieldInfo> {
let name = field.method_name();
match (node.name.as_str(), name.as_str()) {
("ArrayExpr", "expr") // The ArrayExpr type also has an 'exprs' field
| ("PathSegment", "ty" | "path_type") // these are broken, handling them manually
| ("PathSegment", "type_anchor") // we flatten TypeAnchor into PathSegment in the extractor
| ("Param", "pat") | ("MacroCall", "token_tree") // handled manually to use `body`
=> continue,
_ => {}
@@ -487,6 +487,9 @@ fn main() -> anyhow::Result<()> {
grammar.enums.retain(|x| x.name != "Adt");
// we flatten TypeAnchor into PathSegment in the extractor
grammar.nodes.retain(|x| x.name != "TypeAnchor");
let mut super_types: BTreeMap<String, BTreeSet<String>> = BTreeMap::new();
for node in &grammar.enums {
for variant in &node.variants {