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