internal static AST Create(Context ctx, IntPtr obj)
{
Contract.Requires(ctx != null);
Contract.Ensures(Contract.Result<AST>() != null);
switch ((Z3_ast_kind)Native.Z3_get_ast_kind(ctx.nCtx, obj))
{
case Z3_ast_kind.Z3_FUNC_DECL_AST: return new FuncDecl(ctx, obj);
case Z3_ast_kind.Z3_QUANTIFIER_AST: return new Quantifier(ctx, obj);
case Z3_ast_kind.Z3_SORT_AST: return Sort.Create(ctx, obj);
case Z3_ast_kind.Z3_APP_AST:
case Z3_ast_kind.Z3_NUMERAL_AST:
case Z3_ast_kind.Z3_VAR_AST: return Expr.Create(ctx, obj);
default:
throw new Z3Exception("Unknown AST kind");
}
}