Rust: make Adt be generated

This commit is contained in:
Paolo Tranquilli
2025-06-20 14:35:08 +02:00
parent 3590ccaa69
commit 52c0028f85
14 changed files with 72 additions and 40 deletions

View File

@@ -385,8 +385,8 @@ struct ExtractorInfo {
}
fn enum_to_extractor_info(node: &AstEnumSrc) -> Option<ExtractorEnumInfo> {
if node.name == "VariantDef" {
// currently defined but unused
if matches!(node.name.as_str(), "VariantDef" | "Adt") {
// these are not used as types of fields, so we don't need to generate extractors for them
return None;
}
Some(ExtractorEnumInfo {
@@ -485,8 +485,6 @@ fn main() -> anyhow::Result<()> {
.expect("Failed to parse grammar");
let mut grammar = codegen::grammar::lower(&grammar);
grammar.enums.retain(|x| x.name != "Adt");
let mut super_types: BTreeMap<String, BTreeSet<String>> = BTreeMap::new();
for node in &grammar.enums {
for variant in &node.variants {