From b4f1029318a76b0628aa81f21f38d30efc54ce6c Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Sat, 7 Feb 2015 17:05:29 -0800 Subject: [PATCH] refactor(library/reducible): define opaque_type_checker using default_converter --- src/library/reducible.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/library/reducible.cpp b/src/library/reducible.cpp index ed0fafa4c..c02bc32c7 100644 --- a/src/library/reducible.cpp +++ b/src/library/reducible.cpp @@ -8,6 +8,7 @@ Author: Leonardo de Moura #include "util/sstream.h" #include "kernel/environment.h" #include "kernel/type_checker.h" +#include "kernel/default_converter.h" #include "library/kernel_serializer.h" #include "library/scoped_ext.h" #include "library/reducible.h" @@ -138,12 +139,15 @@ std::unique_ptr mk_type_checker(environment const & env, bool rela return mk_type_checker(env, name_generator(*g_tmp_prefix), relax_main_opaque, rb); } +class opaque_converter : public default_converter { +public: + opaque_converter(environment const & env): default_converter(env, true, true) {} + virtual bool is_opaque(declaration const &) const { return true; } +}; + std::unique_ptr mk_opaque_type_checker(environment const & env, name_generator const & ngen) { - extra_opaque_pred pred([=](name const &) { return true; }); // everything is opaque - bool relax_main_opaque = false; - bool memoize = true; - return std::unique_ptr(new type_checker(env, ngen, mk_default_converter(env, relax_main_opaque, - memoize, pred))); + return std::unique_ptr(new type_checker(env, ngen, + std::unique_ptr(new opaque_converter(env)))); } static int mk_opaque_type_checker(lua_State * L) {