Shared: Nicer panic message if node kind is missing

Still panics, just with a better message
This commit is contained in:
Asger F
2026-05-07 23:40:18 +02:00
parent b027ac3658
commit 638dc9380c

View File

@@ -479,13 +479,14 @@ impl<'a> Visitor<'a> {
let (id, _, child_nodes) = self.stack.pop().expect("Vistor: empty stack");
let loc = location_for(self, self.file_label, node);
let loc_label = location_label(self.trap_writer, loc);
let type_name = TypeName {
kind: node.kind().to_owned(),
named: node.is_named(),
};
let table = self
.schema
.get(&TypeName {
kind: node.kind().to_owned(),
named: node.is_named(),
})
.unwrap();
.get(&type_name)
.unwrap_or_else(|| panic!("missing extractor schema entry for {:?}", type_name));
let mut valid = true;
let parent_info = match self.stack.last_mut() {
Some(p) if !node.is_extra() => {