cas_compiler/expr/
binary.rs

1use cas_error::Error;
2use cas_parser::parser::ast::binary::Binary;
3use crate::{Compile, Compiler, InstructionKind};
4
5impl Compile for Binary {
6    fn compile(&self, compiler: &mut Compiler) -> Result<(), Error> {
7        self.lhs.compile(compiler)?;
8        self.rhs.compile(compiler)?;
9        compiler.add_instr_with_spans(
10            InstructionKind::Binary(self.op.kind),
11            vec![self.lhs.span(), self.op.span.clone(), self.rhs.span()],
12        );
13        Ok(())
14    }
15}