minor refactor
This commit is contained in:
parent
6fa272bd34
commit
af90b38bf8
|
@ -475,35 +475,29 @@ impl<'a> CodeGenerator<'a> {
|
|||
let air_value = self.build(value, module_name);
|
||||
|
||||
let msg_func = match self.tracing {
|
||||
TraceLevel::Silent => None,
|
||||
TraceLevel::Verbose | TraceLevel::Compact => {
|
||||
if kind.is_expect() {
|
||||
let msg = match self.tracing {
|
||||
TraceLevel::Silent => unreachable!("excluded from pattern guards"),
|
||||
TraceLevel::Compact => get_line_columns_by_span(
|
||||
module_name,
|
||||
location,
|
||||
&self.module_src,
|
||||
)
|
||||
.to_string(),
|
||||
TraceLevel::Verbose => {
|
||||
get_src_code_by_span(module_name, location, &self.module_src)
|
||||
}
|
||||
};
|
||||
TraceLevel::Verbose | TraceLevel::Compact if kind.is_expect() => {
|
||||
let msg = match self.tracing {
|
||||
TraceLevel::Silent => unreachable!("excluded from pattern guards"),
|
||||
TraceLevel::Compact => {
|
||||
get_line_columns_by_span(module_name, location, &self.module_src)
|
||||
.to_string()
|
||||
}
|
||||
TraceLevel::Verbose => {
|
||||
get_src_code_by_span(module_name, location, &self.module_src)
|
||||
}
|
||||
};
|
||||
|
||||
let msg_func_name = msg.split_whitespace().join("");
|
||||
let msg_func_name = msg.split_whitespace().join("");
|
||||
|
||||
self.special_functions.insert_new_function(
|
||||
msg_func_name.clone(),
|
||||
Term::string(msg),
|
||||
string(),
|
||||
);
|
||||
self.special_functions.insert_new_function(
|
||||
msg_func_name.clone(),
|
||||
Term::string(msg),
|
||||
string(),
|
||||
);
|
||||
|
||||
Some(self.special_functions.use_function_msg(msg_func_name))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
Some(self.special_functions.use_function_msg(msg_func_name))
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
|
||||
self.assignment(
|
||||
|
|
Loading…
Reference in New Issue