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