1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
use std::fmt::{Display, Formatter, Result}; use {Argument, Statement}; #[derive(Debug, Clone)] pub struct Assignment { pub lhs: Argument, pub rhs: Box<Statement>, } impl Assignment { pub fn new(lhs: Argument, rhs: Statement) -> Assignment { Assignment { lhs: lhs, rhs: Box::new(rhs), } } } impl Display for Assignment { fn fmt(&self, f: &mut Formatter) -> Result { write!(f, "{} = {}", self.lhs, self.rhs) } }