diff --git a/crates/shared/src/flattened.rs b/crates/shared/src/flattened.rs index bc753c46..86fa3502 100644 --- a/crates/shared/src/flattened.rs +++ b/crates/shared/src/flattened.rs @@ -38,6 +38,7 @@ pub enum FlatExpr { }, Todo(Loc, &'static str), + Pop, Emit(Loc), TestCommand(Loc, &'static str), @@ -399,6 +400,7 @@ impl FlatExpr { | ArrayLiteral(loc, ..) => Some(*loc), FunctionCallName(..) + | Pop | YulExpr(FlatYulExpr::YulStartBlock(_)) | YulExpr(FlatYulExpr::YulEndBlock(_)) => None, } diff --git a/crates/solc-expressions/src/context_builder/flattened.rs b/crates/solc-expressions/src/context_builder/flattened.rs index f16f645b..4d8722f1 100644 --- a/crates/solc-expressions/src/context_builder/flattened.rs +++ b/crates/solc-expressions/src/context_builder/flattened.rs @@ -842,6 +842,9 @@ pub trait Flatten: }); let cmp = self.expr_stack_mut().pop().unwrap(); self.traverse_requirement(cmp, *loc); + if input_exprs.len() > 1 { + self.push_expr(FlatExpr::Pop); + } } _ => { // func(inputs) @@ -1146,6 +1149,12 @@ pub trait Flatten: // Semi useless Super(..) => unreachable!(), Parameter(_, _, _) => Ok(()), + Pop => { + let _ = ctx + .pop_n_latest_exprs(1, Loc::Implicit, self) + .into_expr_err(Loc::Implicit)?; + Ok(()) + } Emit(loc) => { let _ = ctx.pop_n_latest_exprs(1, loc, self).into_expr_err(loc)?; Ok(())