Ejemplo n.º 1
0
 public void VisitIf(CIf cif)
 {
     if (!cif.IsElseIf)
     {
         InstrumentNode(cif);
     }
     visitor.VisitIf(cif);
 }
Ejemplo n.º 2
0
    public override EqCompiler.CFunction CreateInstance(ArrayList alValues)
    {
        CIf oIf = new CIf();

        oIf.SetValue(alValues);

        return(oIf);
    }
Ejemplo n.º 3
0
        public void PreAcceptEndIf(CIf cif, Object objstate)
        {
            if (objstate == null)
            {
                return;
            }

            DbTypeInfo state = (DbTypeInfo)objstate;

            dbtype = state.oldtype;
        }
Ejemplo n.º 4
0
        public void PrintSimpleFunctionTest()
        {
            var ifStatement = new CIf((CExpression)5 != 3.2f, new CBlock(
                                          new CLabel("Start"),
                                          new CWhile(true),
                                          new CGoto("Start"),
                                          CExpression.Assign(new CVariable("Something")[5], "Thing")
                                          ));
            var procedure = new CMethod("test_a", (new CType("void", true), "a"), (new CType("int"), "b"))
            {
                IsStatic = true,
                Body     = new CBlock(ifStatement)
            };

            Console.WriteLine(procedure);
        }
    }
Ejemplo n.º 5
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);
        }