Skip to content

Commit

Permalink
tb: coding: add case parameter to check_name
Browse files Browse the repository at this point in the history
In preparation for making error names' case UPPER_SNAKE instead of
existing UpperCamel.
  • Loading branch information
r-bk committed Jul 19, 2024
1 parent ff7a711 commit c5c9e51
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/tighterror-build/src/parser/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ pub fn check_module_ident(ident: &str, kw: &str) -> Result<(), TbError> {
}
}

fn check_name(name: &str, desc: &str) -> Result<(), TbError> {
check_ident(name, desc, Case::UpperCamel)?;
fn check_name(name: &str, desc: &str, case: Case) -> Result<(), TbError> {
check_ident(name, desc, case)?;
if kws::is_any_kw(name) {
// double check, in case any logic above changes
log::error!(
Expand All @@ -73,11 +73,11 @@ fn check_name(name: &str, desc: &str) -> Result<(), TbError> {
}

pub fn check_error_name(name: &str) -> Result<(), TbError> {
check_name(name, "ErrorObject::name")
check_name(name, "ErrorObject::name", Case::UpperCamel)
}

pub fn check_category_name(name: &str) -> Result<(), TbError> {
check_name(name, "CategoryObject::name")
check_name(name, "CategoryObject::name", Case::UpperCamel)
}

pub fn check_module_name(name: &str) -> Result<(), TbError> {
Expand Down

0 comments on commit c5c9e51

Please sign in to comment.