mirror of
https://gitlab.cern.ch/wotsubo/endcap-sl-software-ri-generator.git
synced 2025-07-16 16:39:27 +09:00
Compare commits
2 commits
122f7a4b3e
...
e62d935829
Author | SHA1 | Date | |
---|---|---|---|
|
e62d935829 | ||
|
34e1528745 |
1 changed files with 8 additions and 4 deletions
|
@ -28,8 +28,8 @@ use thiserror::Error;
|
||||||
pub enum CodeGenError {
|
pub enum CodeGenError {
|
||||||
#[error("tokenization(syn) error: {0}")]
|
#[error("tokenization(syn) error: {0}")]
|
||||||
SynError(#[from] syn::Error),
|
SynError(#[from] syn::Error),
|
||||||
#[error("failed to create file: {0}")]
|
#[error("failed to create file (name duplicated): {0}")]
|
||||||
FilePathError(String),
|
FilePathDuplicatedError(String),
|
||||||
#[error("parent is required for {module}")]
|
#[error("parent is required for {module}")]
|
||||||
ParentMissing { module: &'static str },
|
ParentMissing { module: &'static str },
|
||||||
#[error("Unsupported structure: {}", name)]
|
#[error("Unsupported structure: {}", name)]
|
||||||
|
@ -373,7 +373,9 @@ impl CodeGen for Block {
|
||||||
log::error!("path {}", out_path.display());
|
log::error!("path {}", out_path.display());
|
||||||
log::error!("old {}", old_out.to_string());
|
log::error!("old {}", old_out.to_string());
|
||||||
log::error!("new {}", out.to_string());
|
log::error!("new {}", out.to_string());
|
||||||
return Err(CodeGenError::FilePathError(snake_case_name.to_string()));
|
return Err(CodeGenError::FilePathDuplicatedError(
|
||||||
|
snake_case_name.to_string(),
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
let files = self.elements.into_iter().try_fold(files, |files, e| {
|
let files = self.elements.into_iter().try_fold(files, |files, e| {
|
||||||
|
@ -465,7 +467,9 @@ impl CodeGen for Register {
|
||||||
let (out_path, _next_parent_path) = mod_file_path(parent_path, &snake_case_name);
|
let (out_path, _next_parent_path) = mod_file_path(parent_path, &snake_case_name);
|
||||||
log::info!("{:?}", out_path);
|
log::info!("{:?}", out_path);
|
||||||
if files.insert(out_path, out).is_some() {
|
if files.insert(out_path, out).is_some() {
|
||||||
return Err(CodeGenError::FilePathError(snake_case_name.to_string()));
|
return Err(CodeGenError::FilePathDuplicatedError(
|
||||||
|
snake_case_name.to_string(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
Ok(files)
|
Ok(files)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue