예제 #1
0
        public virtual T VisitAugAssignNode(AugAssignNode n)
        {
            T a = n.lhs.Accept(this);
            T b = n.rhs.Accept(this);

            return(default(T));
        }
예제 #2
0
        public object VisitAugAssignNode(AugAssignNode n)
        {
            WriteLine(n.kind + " - " + n.op);
            Indent();
            Visit(n.lhs);
            Visit(n.rhs);
            Dedent();

            return(null);
        }
예제 #3
0
        public override MIPSRegister VisitAugAssignNode(AugAssignNode n)
        {
            var lhs = Gen(n.lhs);
            var rhs = Gen(n.rhs);

            switch (n.op)
            {
            case "*=":
            {
                emit.Emit("mul", lhs, lhs, rhs);
            }
            break;

            case "/=":
            {
                emit.Emit("quo", lhs, lhs, rhs);
            }
            break;

            case "%=":
            {
                emit.Emit("rem", lhs, lhs, rhs);
            }
            break;

            case "+=":
            {
                emit.Emit("add", lhs, lhs, rhs);
            }
            break;

            case "-=":
            {
                emit.Emit("sub", lhs, lhs, rhs);
            }
            break;

            case "<<=":
            {
                emit.Emit("sllv", lhs, lhs, rhs);
            }
            break;

            case ">>=":
            {
                emit.Emit("srav", lhs, lhs, rhs);
            }
            break;

            case "&=":
            {
                emit.Emit("and", lhs, lhs, rhs);
            }
            break;

            case "^=":
            {
                emit.Emit("xor", lhs, lhs, rhs);
            }
            break;

            case "|=":
            {
                emit.Emit("or", lhs, lhs, rhs);
            }
            break;
            }

            return(null);
        }
예제 #4
0
 public override LLVMRegister VisitAugAssignNode(AugAssignNode n)
 {
     throw new NotImplementedException();
 }
예제 #5
0
 public override object VisitAugAssignNode(AugAssignNode n)
 {
     Visit(n.lhs);
     Visit(n.rhs);
     return(null);
 }
예제 #6
0
 public override object VisitAugAssignNode(AugAssignNode n)
 {
     Visit(n.lhs); Visit(n.rhs);
     semanticChecker.CheckAndReport(n.lhs.Type.Match(n.rhs.Type), n.sourceLoc, "Type mismatch - AugAssign");
     return(null);
 }
예제 #7
0
            public override LData VisitAugAssignNode(AugAssignNode n)
            {
                LData lhs = Visit(n.lhs);
                LData rhs = Visit(n.rhs);

                switch (n.op)
                {
                case "*=":
                {
                    dynamic newval = lhs.GetValue() * rhs.GetValue();
                    lhs.SetValue(newval);
                }
                break;

                case "/=":
                {
                    dynamic newval = lhs.GetValue() / rhs.GetValue();
                    lhs.SetValue(newval);
                }
                break;

                case "%=":
                {
                    dynamic newval = lhs.GetValue() % rhs.GetValue();
                    lhs.SetValue(newval);
                }
                break;

                case "+=":
                {
                    dynamic newval = lhs.GetValue() + rhs.GetValue();
                    lhs.SetValue(newval);
                }
                break;

                case "-=":
                {
                    dynamic newval = lhs.GetValue() - rhs.GetValue();
                    lhs.SetValue(newval);
                }
                break;

                case "<<=":
                {
                    dynamic newval = lhs.GetValue() << rhs.GetValue();
                    lhs.SetValue(newval);
                }
                break;

                case ">>=":
                {
                    dynamic newval = lhs.GetValue() >> rhs.GetValue();
                    lhs.SetValue(newval);
                }
                break;

                case "&=":
                {
                    dynamic newval = lhs.GetValue() & rhs.GetValue();
                    lhs.SetValue(newval);
                }
                break;

                case "^=":
                {
                    dynamic newval = lhs.GetValue() ^ rhs.GetValue();
                    lhs.SetValue(newval);
                }
                break;

                case "|=":
                {
                    dynamic newval = lhs.GetValue() | rhs.GetValue();
                    lhs.SetValue(newval);
                }
                break;
                }

                return(lhs);
            }