Esempio n. 1
0
            public override Expression Modified()
            {
                Expression res = null;

                switch (this.op.type)
                {
                case Token.Type.LBRACKET:
                    BinaryOperator bop = new BinaryOperator(new Token(Token.Type.OP_PLUS));

                    if (this.expr is Refference && ((Refference)this.expr).op.type == Token.Type.LBRACKET)
                    {
                        UnaryOperator u = new UnaryOperator(new Token(Token.Type.OP_BIT_AND));
                        this.expr.SetType(((Symbols.RefType) this.expr.GetType()).GetRefType());
                        u.SetOperand(this.expr);
                        bop.SetRightOperand(u);
                    }
                    else
                    {
                        bop.SetRightOperand(this.expr);
                    }

                    bop.SetLeftOperand(this.refference);
                    res = new UnaryOperator(new Token(Token.Type.OP_STAR));
                    ((UnaryOperator)res).SetOperand(bop);
                    break;

                case Token.Type.OP_REF:
                    UnaryOperator rop = new UnaryOperator(new Token(Token.Type.OP_STAR));
                    rop.SetOperand(this.expr);
                    res = new Refference(new Token(Token.Type.OP_DOT));
                    ((Refference)res).SetExpression(rop);
                    ((Refference)res).SetRefference(this.refference);
                    break;
                }
                return(res == null ? this : res.Modified());
            }
Esempio n. 2
0
            public override Expression Modified()
            {
                Expression res = null;
                switch (this.op.type)
                {
                    case Token.Type.LBRACKET:
                        BinaryOperator bop = new BinaryOperator(new Token(Token.Type.OP_PLUS));

                        if (this.expr is Refference && ((Refference)this.expr).op.type == Token.Type.LBRACKET)
                        {
                            UnaryOperator u = new UnaryOperator(new Token(Token.Type.OP_BIT_AND));
                            this.expr.SetType(((Symbols.RefType)this.expr.GetType()).GetRefType());
                            u.SetOperand(this.expr);
                            bop.SetRightOperand(u);
                        }
                        else
                        {
                            bop.SetRightOperand(this.expr);
                        }

                        bop.SetLeftOperand(this.refference);
                        res = new UnaryOperator(new Token(Token.Type.OP_STAR));
                        ((UnaryOperator)res).SetOperand(bop);
                        break;
                    case Token.Type.OP_REF:
                        UnaryOperator rop = new UnaryOperator(new Token(Token.Type.OP_STAR));
                        rop.SetOperand(this.expr);
                        res = new Refference(new Token(Token.Type.OP_DOT));
                        ((Refference)res).SetExpression(rop);
                        ((Refference)res).SetRefference(this.refference);
                        break;
                }
                return res == null ? this : res.Modified();
            }