Skip to content

Commit

Permalink
Add a bit of logging to ConstantEvaluator. (#2488)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimblandy authored Sep 19, 2023
1 parent 9a4db9b commit 02001d0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/proc/constant_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ impl ConstantEvaluator<'_> {
Ok(self.constants[c].init)
}
}
_ => Err(ConstantEvaluatorError::SubexpressionsAreNotConstant),
_ => {
log::debug!("check_and_get: SubexpressionsAreNotConstant");
Err(ConstantEvaluatorError::SubexpressionsAreNotConstant)
}
}
}

Expand All @@ -139,6 +142,7 @@ impl ConstantEvaluator<'_> {
expr: &Expression,
span: Span,
) -> Result<Handle<Expression>, ConstantEvaluatorError> {
log::trace!("try_eval_and_append: {:?}", expr);
match *expr {
Expression::Literal(_) | Expression::ZeroValue(_) | Expression::Constant(_) => {
Ok(self.register_constant(expr.clone(), span))
Expand Down Expand Up @@ -807,7 +811,10 @@ impl ConstantEvaluator<'_> {
let value = self.copy_from(value, expressions)?;
Ok(self.register_constant(Expression::Splat { size, value }, span))
}
_ => Err(ConstantEvaluatorError::SubexpressionsAreNotConstant),
_ => {
log::debug!("copy_from: SubexpressionsAreNotConstant");
Err(ConstantEvaluatorError::SubexpressionsAreNotConstant)
}
}
}

Expand Down

0 comments on commit 02001d0

Please sign in to comment.