//only supporting simple assignments (=) now, not compound assignments (ie +=, *= etc) public void genAssignmentExpression(AssignExprNode expr) { genExpression(expr.rhs); assembly.addLine("pop eax"); //rhs --> eax IdentExprNode lvar = (IdentExprNode)expr.lhs; OILNode lsym = lvar.idsym; switch (lsym.type) { case OILType.ParamDecl: uint pofs = ((CGParamDeclNode)(lsym.cgnode)).addr; assembly.addLine("mov [ebp+" + pofs + "],eax"); break; case OILType.VarDecl: uint vofs = ((CGVarDeclNode)(lsym.cgnode)).addr; assembly.addLine("mov [ebp-" + vofs + "],eax"); break; default: break; } }
public virtual TResult Visit(AssignExprNode node) => this.VisitChildren(node);
//------------------------------------------------- public AssignExprNode makeAssignExpressionNode(AssignExprNode.OPERATOR oper, ExprNode lhs, ExprNode rhs) { AssignExprNode node = new AssignExprNode(oper, lhs, rhs); return(node); }