Skip to content

Commit 12aa93b

Browse files
committed
Rust: suppress TypeAnchor in the generator
1 parent 492b0cd commit 12aa93b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rust/ast-generator/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ fn get_fields(node: &AstNodeSrc) -> Vec<FieldInfo> {
295295
let name = field.method_name();
296296
match (node.name.as_str(), name.as_str()) {
297297
("ArrayExpr", "expr") // The ArrayExpr type also has an 'exprs' field
298-
| ("PathSegment", "ty" | "path_type") // these are broken, handling them manually
298+
| ("PathSegment", "type_anchor") // we flatten TypeAnchor into PathSegment in the extractor
299299
| ("Param", "pat") | ("MacroCall", "token_tree") // handled manually to use `body`
300300
=> continue,
301301
_ => {}
@@ -487,6 +487,9 @@ fn main() -> anyhow::Result<()> {
487487

488488
grammar.enums.retain(|x| x.name != "Adt");
489489

490+
// we flatten TypeAnchor into PathSegment in the extractor
491+
grammar.nodes.retain(|x| x.name != "TypeAnchor");
492+
490493
let mut super_types: BTreeMap<String, BTreeSet<String>> = BTreeMap::new();
491494
for node in &grammar.enums {
492495
for variant in &node.variants {

0 commit comments

Comments
 (0)