public object VisitShort() { return(ZenConstantExpr <short> .Create(0)); }
public object VisitLong() { return(ZenConstantExpr <long> .Create(0)); }
public object VisitBigInteger() { return(ZenConstantExpr <BigInteger> .Create(new BigInteger(0))); }
public object VisitByte() { return(ZenConstantExpr <byte> .Create(0)); }
public object VisitInt() { return(ZenConstantExpr <int> .Create(0)); }
public object VisitBool() { return(ZenConstantExpr <bool> .Create(false)); }
// FIXME: default value for a c# string is null, not empty. How to represent null strings? public object VisitString() { return(ZenConstantExpr <string> .Create("")); }
public ImmutableHashSet <object> VisitZenConstantExpr <T>(ZenConstantExpr <T> expression, Unit parameter) { return(emptySet); }
public Expression VisitZenConstantExpr <T>(ZenConstantExpr <T> expression, ExpressionConverterEnvironment parameter) { return(Expression.Constant(expression.Value)); }
public SymbolicValue <TModel, TVar, TBool, TBitvec, TInt, TString> VisitZenConstantExpr <T>(ZenConstantExpr <T> expression, SymbolicEvaluationEnvironment <TModel, TVar, TBool, TBitvec, TInt, TString> parameter) { return(LookupOrCompute(expression, () => { var type = typeof(T); if (type == ReflectionUtilities.BigIntType) { var bi = this.Solver.CreateBigIntegerConst((BigInteger)(object)expression.Value); return new SymbolicInteger <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, bi); } if (type == ReflectionUtilities.BoolType) { var b = (bool)(object)expression.Value ? this.Solver.True() : this.Solver.False(); return new SymbolicBool <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, b); } if (type == ReflectionUtilities.ByteType) { var bv = this.Solver.CreateByteConst((byte)(object)expression.Value); return new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, bv); } if (type == ReflectionUtilities.ShortType) { var bv = this.Solver.CreateShortConst((short)(object)expression.Value); return new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, bv); } if (type == ReflectionUtilities.UshortType) { var bv = this.Solver.CreateShortConst((short)(ushort)(object)expression.Value); return new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, bv); } if (type == ReflectionUtilities.IntType) { var bv = this.Solver.CreateIntConst((int)(object)expression.Value); return new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, bv); } if (type == ReflectionUtilities.UintType) { var bv = this.Solver.CreateIntConst((int)(uint)(object)expression.Value); return new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, bv); } if (type == ReflectionUtilities.LongType) { var bv = this.Solver.CreateLongConst((long)(object)expression.Value); return new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, bv); } if (type == ReflectionUtilities.UlongType) { var bv = this.Solver.CreateLongConst((long)(ulong)(object)expression.Value); return new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, bv); } if (ReflectionUtilities.IsFixedIntegerType(type)) { var bv = this.Solver.CreateBitvecConst(((dynamic)expression.Value).GetBits()); return new SymbolicBitvec <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, bv); } // string type. var s = CommonUtilities.ConvertCSharpStringToZ3((string)(object)expression.Value); var v = this.Solver.CreateStringConst(s); return new SymbolicString <TModel, TVar, TBool, TBitvec, TInt, TString>(this.Solver, v); })); }