Method
apply2
(
exprs: &mut Vec<Expr>,
pos: LineCol,
f: fn(Box<BinaryOpSpan>) -> Expr,
)
Source from the content-addressed store, hash-verified
| 217 | } |
| 218 | |
| 219 | fn apply2( |
| 220 | exprs: &mut Vec<Expr>, |
| 221 | pos: LineCol, |
| 222 | f: fn(Box<BinaryOpSpan>) -> Expr, |
| 223 | ) -> Result<()> { |
| 224 | if exprs.len() < 2 { |
| 225 | return Err(Error::Bad(pos, "Not enough values to apply operator".to_owned())); |
| 226 | } |
| 227 | let rhs = exprs.pop().unwrap(); |
| 228 | let lhs = exprs.pop().unwrap(); |
| 229 | exprs.push(f(Box::from(BinaryOpSpan { lhs, rhs, pos }))); |
| 230 | Ok(()) |
| 231 | } |
| 232 | |
| 233 | match self.op { |
| 234 | ExprOp::Add => apply2(exprs, self.pos, Expr::Add), |
Callers
nothing calls this directly
Tested by
no test coverage detected