Skip to content

Commit

Permalink
test: add assertion for non ast visitable(which is wrong!)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Jul 20, 2024
1 parent 9003248 commit efbd58f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tasks/ast_codegen/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down

0 comments on commit efbd58f

Please sign in to comment.