depluralize print_postfix_exprs
This commit is contained in:
@@ -76,7 +76,7 @@ fn gen_command(
|
||||
util::print_intermediate_exprs(&intermediate_exprs, &mut writer)?;
|
||||
}
|
||||
GenMode::Postfix => {
|
||||
util::print_postfix_exprs(&typed_expr, &mut writer)?;
|
||||
util::print_postfix_expr(&typed_expr, &mut writer)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,18 +41,18 @@ pub fn print_intermediate_exprs(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn print_postfix_exprs(expr: &TypedExpr, writer: &mut impl io::Write) -> io::Result<()> {
|
||||
pub fn print_postfix_expr(expr: &TypedExpr, writer: &mut impl io::Write) -> io::Result<()> {
|
||||
match expr {
|
||||
TypedExpr::Int { value, .. } => write!(writer, "{} ", value)?,
|
||||
TypedExpr::Float { value, .. } => write!(writer, "{} ", value)?,
|
||||
TypedExpr::Var { name, .. } => write!(writer, "<id,{}> ", name)?,
|
||||
TypedExpr::BinOp { lhs, op, rhs, .. } => {
|
||||
print_postfix_exprs(lhs, writer)?;
|
||||
print_postfix_exprs(rhs, writer)?;
|
||||
print_postfix_expr(lhs, writer)?;
|
||||
print_postfix_expr(rhs, writer)?;
|
||||
write!(writer, "{} ", op)?;
|
||||
}
|
||||
TypedExpr::IntToFloat { value, .. } => {
|
||||
print_postfix_exprs(value, writer)?;
|
||||
print_postfix_expr(value, writer)?;
|
||||
write!(writer, "i2f ")?;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user