Пример #1
0
        public Object PreAcceptThen(CIf cif, Object objstate)
        {
            int newtype = 0;
            CExpression exp = cif.Condition;
            bool not = exp is CNot;
            if (not)
            {
                exp = ((CNot)exp).Operand;
                if (exp is CParenExpression)
                    exp = ((CParenExpression)exp).InnerExpression;
            }

            if (exp is CLogic && ((CLogic)exp).Operation.Value == "or")
            {
                CExpression lhs = ((CLogic)exp).Left;
                if (lhs is CAccess && ((CAccess)lhs).IsRootAccess &&
                    ((CAccess)lhs).ReferenceToken.Value == "g_fmssql")
                    newtype |= DbMsSql;
                exp = ((CLogic)exp).Right;
            }

            if (exp is CAccess)
            {
                CAccess acc = (CAccess)exp;
                if (acc.IsRootAccess)
                {
                    if (acc.ReferenceToken.Value == "g_fmssql")
                        newtype |= DbMsSql;
                    if (acc.ReferenceToken.Value == "g_fmysql")
                        newtype |= DbMySql;
                }
            }

            if (newtype == 0)
                return null;

            if (not)
                newtype = ~newtype;

            DbTypeInfo state;
            if (objstate == null)
            {
                state = new DbTypeInfo();
                state.oldtype = dbtype;
            }
            else
                state = (DbTypeInfo)objstate;
            state.currenttype = newtype;
            state.elsetype &= ~newtype;

            dbtype = newtype;
            return state;
        }
Пример #2
0
 public void VisitIf(CIf cif)
 {
     if (!cif.IsElseIf)
         InstrumentNode(cif);
     visitor.VisitIf(cif);
 }
Пример #3
0
        public void PreAcceptEndIf(CIf cif, Object objstate)
        {
            if (objstate == null)
                return;

            DbTypeInfo state = (DbTypeInfo)objstate;
            dbtype = state.oldtype;
        }