Skip to content

Commit

Permalink
add pop after require (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
brockelmore authored Aug 2, 2024
1 parent 95bd97d commit 53b2b17
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/shared/src/flattened.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub enum FlatExpr {
},

Todo(Loc, &'static str),
Pop,

Emit(Loc),
TestCommand(Loc, &'static str),
Expand Down Expand Up @@ -399,6 +400,7 @@ impl FlatExpr {
| ArrayLiteral(loc, ..) => Some(*loc),

FunctionCallName(..)
| Pop
| YulExpr(FlatYulExpr::YulStartBlock(_))
| YulExpr(FlatYulExpr::YulEndBlock(_)) => None,
}
Expand Down
9 changes: 9 additions & 0 deletions crates/solc-expressions/src/context_builder/flattened.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,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)
Expand Down Expand Up @@ -1173,6 +1176,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(())
Expand Down

0 comments on commit 53b2b17

Please sign in to comment.