Пример #1
0
        //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;
            }
        }
Пример #2
0
 public virtual TResult Visit(AssignExprNode node) => this.VisitChildren(node);
Пример #3
0
        //-------------------------------------------------

        public AssignExprNode makeAssignExpressionNode(AssignExprNode.OPERATOR oper, ExprNode lhs, ExprNode rhs)
        {
            AssignExprNode node = new AssignExprNode(oper, lhs, rhs);

            return(node);
        }