1
0

depluralize print_postfix_exprs

This commit is contained in:
2024-11-10 08:42:18 +03:00
parent 3c778abd00
commit 11abc1282d
2 changed files with 5 additions and 5 deletions

View File

@@ -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)?;
}
}

View File

@@ -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 ")?;
}
}