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; }
public void VisitIf(CIf cif) { if (!cif.IsElseIf) InstrumentNode(cif); visitor.VisitIf(cif); }
public void PreAcceptEndIf(CIf cif, Object objstate) { if (objstate == null) return; DbTypeInfo state = (DbTypeInfo)objstate; dbtype = state.oldtype; }