diff --git a/tasks/ast_codegen/src/schema.rs b/tasks/ast_codegen/src/schema.rs index a4ff8d2a554a57..9054a7c7e02376 100644 --- a/tasks/ast_codegen/src/schema.rs +++ b/tasks/ast_codegen/src/schema.rs @@ -154,9 +154,15 @@ impl RType { } pub fn set_visitable(&mut self, value: bool) -> Result<()> { + macro_rules! assign { + ($it:ident) => {{ + debug_assert!($it.meta.ast, "only ast types can be visitable!"); + $it.meta.visitable = value; + }}; + } match self { - RType::Enum(it) => it.meta.visitable = value, - RType::Struct(it) => it.meta.visitable = value, + RType::Enum(it) => assign!(it), + RType::Struct(it) => assign!(it), _ => return Err("Unsupported type!".to_string()), } Ok(())