fn expr_instr(
        &mut self,
        rhs: bool,
        expr: &Expr<'src>,
        block: &mut InstructionBlock<'src>,
    ) -> Address<'src> {
        let rval = self.address_expr(&expr);
        if let Some(rval) = rval {
            return rval;
        }

        let e = self.expr(rhs, expr, block);

        if let Expression::Copy(a) = e {
            return a;
        }

        // void functions should be assigned to an empty address
        if let Expression::Call {
            ret_type: Type::Simple(Simple::Void),
            ..
        } = e
        {
            return self.assign(Address::Empty, e, block);
        }

        let temp = self.temp();
        let ty = expr.clone_ty().unwrap();
        block.push(Instruction::Decl(temp.clone(), ty));
        self.assign(temp, e, block)
    }
/// Splits an expression and returns an address to the result
Splits an expression and returns an address to the result
Splits an expression and returns an address to the result
fn expr_instr(
        &mut self,
        rhs: bool,
        expr: &Expr<'src>,
        block: &mut InstructionBlock<'src>,
    ) -> Address<'src> {
        let rval = self.address_expr(&expr);
        if let Some(rval) = rval {
            return rval;
        }
        let e = self.expr(rhs, expr, block);
        if let Expression::Copy(a) = e {
            return a;
        }
        // void functions should be assigned to an empty address
        if let Expression::Call {
            ret_type: Type::Simple(Simple::Void),
            ..
        } = e
        {
            return self.assign(Address::Empty, e, block);
        }
        let temp = self.temp();
        let ty = expr.clone_ty().unwrap();
        block.push(Instruction::Decl(temp.clone(), ty));
        self.assign(temp, e, block)
    }
fn expr_instr ( & mut self , rhs : bool , expr : & Expr < ' src > , block : & mut InstructionBlock < ' src > , ) -> Address < ' src > { let rval = self . address_expr ( & expr ) ; if let Some ( rval ) = rval { return rval ; } let e = self . expr ( rhs , expr , block ) ; if let Expression :: Copy ( a ) = e { return a ; } // void functions should be assigned to an empty address if let Expression :: Call { ret_type : Type :: Simple ( Simple :: Void ) , .. } = e { return self . assign ( Address :: Empty , e , block ) ; } let temp = self . temp ( ) ; let ty = expr . clone_ty ( ) . unwrap ( ) ; block . push ( Instruction :: Decl ( temp . clone ( ) , ty ) ) ; self . assign ( temp , e , block ) }
Splits an expression and returns an address to the result
Splits an expression and returns an address to the result
&mut self
rhs
bool
expr
&Expr<'src>
block
&mut InstructionBlock<'src>
&mut self
rhs
bool
expr
&Expr<'src>
block
&mut InstructionBlock<'src>