public object VisitInt() { var e = new ZenArbitraryExpr <int>(); this.ArbitraryExpressions.Add(e); return(e); }
public object VisitBigInteger() { var e = new ZenArbitraryExpr <BigInteger>(); this.ArbitraryExpressions.Add(e); return(e); }
public object VisitString() { var e = new ZenArbitraryExpr <string>(); this.ArbitraryExpressions.Add(e); return(e); }
public object VisitByte() { var e = new ZenArbitraryExpr <byte>(); this.ArbitraryExpressions.Add(e); return(e); }
public object VisitUshort() { var e = new ZenArbitraryExpr <ushort>(); this.ArbitraryExpressions.Add(e); return(e); }
public Expression VisitZenArbitraryExpr <T>(ZenArbitraryExpr <T> expression, ExpressionConverterEnvironment parameter) { return(LookupOrCompute(expression, () => { return Expression.Constant(ReflectionUtilities.GetDefaultValue <T>()); })); }
public Expression VisitZenArbitraryExpr <T>(ZenArbitraryExpr <T> expression, ExpressionConverterEnvironment parameter) { return(LookupOrCompute(expression, () => { return Expression.Constant(default(T)); })); }
public ImmutableHashSet <object> VisitZenArbitraryExpr <T>(ZenArbitraryExpr <T> expression, Unit parameter) { return(LookupOrCompute(expression, () => { var result = emptySet.Add(expression); if (!this.DisjointSets.ContainsKey(expression)) { this.DisjointSets[expression] = result; } return result; })); }
/// <summary> /// Visit an ArbitraryExpr. /// </summary> /// <param name="expression">The expression.</param> /// <param name="parameter">The parameter.</param> /// <returns>The resulting symbolic value.</returns> public SymbolicValue <TModel, TVar, TBool, TInt> VisitZenArbitraryExpr <T1>(ZenArbitraryExpr <T1> expression, SymbolicEvaluationEnvironment <TModel, TVar, TBool, TInt> parameter) { return(LookupOrCompute(expression, () => { var type = typeof(T1); if (type == ReflectionUtilities.BoolType) { var(variable, expr) = this.Solver.CreateBoolVar(expression); this.Variables.Add(variable); var result = new SymbolicBool <TModel, TVar, TBool, TInt>(this.Solver, expr); this.ArbitraryVariables[expression] = variable; return result; } if (type == ReflectionUtilities.ByteType) { var(variable, expr) = this.Solver.CreateByteVar(expression); this.Variables.Add(variable); var result = new SymbolicInteger <TModel, TVar, TBool, TInt>(this.Solver, expr); this.ArbitraryVariables[expression] = variable; return result; } if (type == ReflectionUtilities.ShortType || type == ReflectionUtilities.UshortType) { var(variable, expr) = this.Solver.CreateShortVar(expression); this.Variables.Add(variable); var result = new SymbolicInteger <TModel, TVar, TBool, TInt>(this.Solver, expr); this.ArbitraryVariables[expression] = variable; return result; } if (type == ReflectionUtilities.IntType || type == ReflectionUtilities.UintType) { var(variable, expr) = this.Solver.CreateIntVar(expression); this.Variables.Add(variable); var result = new SymbolicInteger <TModel, TVar, TBool, TInt>(this.Solver, expr); this.ArbitraryVariables[expression] = variable; return result; } // long or ulong var(v, e) = this.Solver.CreateLongVar(expression); this.Variables.Add(v); var r = new SymbolicInteger <TModel, TVar, TBool, TInt>(this.Solver, e); this.ArbitraryVariables[expression] = v; return r; })); }
public SymbolicValue <TModel, TVar, TBool, TBitvec, TInt, TString> VisitZenArbitraryExpr <T1>(ZenArbitraryExpr <T1> expression, SymbolicEvaluationEnvironment <TModel, TVar, TBool, TBitvec, TInt, TString> parameter) { return(LookupOrCompute(expression, () => { var type = typeof(T1); if (type == ReflectionUtilities.BoolType) { var(variable, expr) = this.Solver.CreateBoolVar(expression); this.Variables.Add(variable); var result = new SymbolicBool <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, expr); this.ArbitraryVariables[expression] = variable; return result; } if (type == ReflectionUtilities.ByteType) { var(variable, expr) = this.Solver.CreateByteVar(expression); this.Variables.Add(variable); var result = new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, expr); this.ArbitraryVariables[expression] = variable; return result; } if (type == ReflectionUtilities.ShortType || type == ReflectionUtilities.UshortType) { var(variable, expr) = this.Solver.CreateShortVar(expression); this.Variables.Add(variable); var result = new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, expr); this.ArbitraryVariables[expression] = variable; return result; } if (type == ReflectionUtilities.IntType || type == ReflectionUtilities.UintType) { var(variable, expr) = this.Solver.CreateIntVar(expression); this.Variables.Add(variable); var result = new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, expr); this.ArbitraryVariables[expression] = variable; return result; } if (type == ReflectionUtilities.StringType) { var(variable, expr) = this.Solver.CreateStringVar(expression); this.Variables.Add(variable); var result = new SymbolicString <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, expr); this.ArbitraryVariables[expression] = variable; return result; } if (type == ReflectionUtilities.LongType || type == ReflectionUtilities.UlongType) { var(variable, expr) = this.Solver.CreateLongVar(expression); this.Variables.Add(variable); var result = new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, expr); this.ArbitraryVariables[expression] = variable; return result; } if (type == ReflectionUtilities.BigIntType) { var(variable, expr) = this.Solver.CreateBigIntegerVar(expression); this.Variables.Add(variable); var result = new SymbolicInteger <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, expr); this.ArbitraryVariables[expression] = variable; return result; } // Fixed width integer case var size = CommonUtilities.IntegerSize(type); var(v, e) = this.Solver.CreateBitvecVar(expression, (uint)size); this.Variables.Add(v); var r = new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, e); this.ArbitraryVariables[expression] = v; return r; })); }