refactor(library): merge exception modules

This commit is contained in:
Leonardo de Moura 2016-09-06 09:12:26 -07:00
parent f354b6e430
commit a0b8766ffb
14 changed files with 28 additions and 38 deletions

View file

@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#include "library/generic_exception.h"
#include "library/exception.h"
#include "frontends/lean/old_elaborator_exception.h"
namespace lean {

View file

@ -22,7 +22,7 @@ Author: Leonardo de Moura
#include "kernel/instantiate.h"
#include "kernel/error_msgs.h"
#include "library/trace.h"
#include "library/parser_nested_exception.h"
#include "library/exception.h"
#include "library/aliases.h"
#include "library/constants.h"
#include "library/private.h"

View file

@ -6,7 +6,7 @@ add_library(library OBJECT deep_copy.cpp expr_lt.cpp io_state.cpp
explicit.cpp num.cpp string.cpp head_map.cpp definition_cache.cpp
declaration_index.cpp class.cpp util.cpp print.cpp annotation.cpp quote.cpp
typed_expr.cpp protected.cpp reducible.cpp init_module.cpp
generic_exception.cpp fingerprint.cpp flycheck.cpp hott_kernel.cpp pp_options.cpp
exception.cpp fingerprint.cpp flycheck.cpp hott_kernel.cpp pp_options.cpp
unfold_macros.cpp app_builder.cpp projection.cpp relation_manager.cpp
export.cpp user_recursors.cpp idx_metavar.cpp noncomputable.cpp
aux_recursors.cpp norm_num.cpp trace.cpp

View file

@ -17,7 +17,7 @@ Author: Leonardo de Moura
#include "library/reducible.h"
#include "library/class.h"
#include "library/old_local_context.h"
#include "library/generic_exception.h"
#include "library/exception.h"
#include "library/io_state_stream.h"
#include "library/replace_visitor.h"
#include "library/constants.h"

View file

@ -15,7 +15,7 @@ Author: Leonardo de Moura
#include "library/num.h"
#include "library/string.h"
#include "library/pp_options.h"
#include "library/generic_exception.h"
#include "library/exception.h"
#include "library/util.h"
#include "library/locals.h"
#include "library/app_builder.h"

View file

@ -17,7 +17,7 @@ Author: Leonardo de Moura
#include "kernel/for_each_fn.h"
#include "kernel/find_fn.h"
#include "kernel/replace_fn.h"
#include "library/generic_exception.h"
#include "library/exception.h"
#include "library/kernel_serializer.h"
#include "library/io_state_stream.h"
#include "library/annotation.h"

View file

@ -17,7 +17,7 @@ Author: Leonardo de Moura
#include "kernel/for_each_fn.h"
#include "kernel/find_fn.h"
#include "kernel/replace_fn.h"
#include "library/generic_exception.h"
#include "library/exception.h"
#include "library/kernel_serializer.h"
#include "library/io_state_stream.h"
#include "library/annotation.h"

View file

@ -11,7 +11,7 @@ Author: Leonardo de Moura
#include "kernel/for_each_fn.h"
#include "library/io_state_stream.h"
#include "library/unifier.h"
#include "library/parser_nested_exception.h"
#include "library/exception.h"
#include "library/flycheck.h"
#include "library/pp_options.h"
#include "library/error_handling.h"

View file

@ -5,7 +5,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#include <string>
#include "library/generic_exception.h"
#include "library/exception.h"
namespace lean {

View file

@ -8,6 +8,7 @@ Author: Leonardo de Moura
#include <string>
#include "util/sstream.h"
#include "kernel/ext_exception.h"
#include "kernel/pos_info_provider.h"
namespace lean {
class generic_exception : public ext_exception {
@ -34,4 +35,19 @@ public:
[[ noreturn ]] void throw_generic_exception(char const * msg, expr const & m, pp_fn const & fn);
[[ noreturn ]] void throw_generic_exception(optional<expr> const & m, pp_fn const & fn);
[[ noreturn ]] void throw_generic_exception(expr const & m, pp_fn const & fn);
/** \brief Lean exception occurred when parsing file. */
class parser_nested_exception : public exception {
std::shared_ptr<throwable> m_exception;
std::shared_ptr<pos_info_provider> m_provider;
public:
parser_nested_exception(std::shared_ptr<throwable> const & ex, std::shared_ptr<pos_info_provider> const & pr):
exception("parser exception"), m_exception(ex), m_provider(pr) {}
virtual ~parser_nested_exception() {}
virtual throwable * clone() const { return new parser_nested_exception(m_exception, m_provider); }
virtual void rethrow() const { throw *this; }
virtual char const * what() const noexcept { return m_exception->what(); }
throwable const & get_exception() const { return *(m_exception.get()); }
pos_info_provider const & get_provider() const { return *(m_provider.get()); }
};
}

View file

@ -9,7 +9,7 @@ Author: Leonardo de Moura
#include "kernel/environment.h"
#include "kernel/ext_exception.h"
#include "kernel/abstract_type_context.h"
#include "library/generic_exception.h"
#include "library/exception.h"
#include "library/io_state.h"
#include "library/constraint.h"

View file

@ -21,7 +21,7 @@ Author: Leonardo de Moura
#include "library/old_type_context.h"
#include "library/pp_options.h"
#include "library/reducible.h"
#include "library/generic_exception.h"
#include "library/exception.h"
#include "library/class.h"
#include "library/constants.h"
#include "library/unification_hint.h"

View file

@ -1,26 +0,0 @@
/*
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#include <memory>
#include "util/exception.h"
#include "kernel/pos_info_provider.h"
namespace lean {
/** \brief Lean exception occurred when parsing file. */
class parser_nested_exception : public exception {
std::shared_ptr<throwable> m_exception;
std::shared_ptr<pos_info_provider> m_provider;
public:
parser_nested_exception(std::shared_ptr<throwable> const & ex, std::shared_ptr<pos_info_provider> const & pr):
exception("parser exception"), m_exception(ex), m_provider(pr) {}
virtual ~parser_nested_exception() {}
virtual throwable * clone() const { return new parser_nested_exception(m_exception, m_provider); }
virtual void rethrow() const { throw *this; }
virtual char const * what() const noexcept { return m_exception->what(); }
throwable const & get_exception() const { return *(m_exception.get()); }
pos_info_provider const & get_provider() const { return *(m_provider.get()); }
};
}

View file

@ -13,7 +13,7 @@ Author: Leonardo de Moura
#include "kernel/abstract.h"
#include "library/unfold_macros.h"
#include "library/replace_visitor.h"
#include "library/generic_exception.h"
#include "library/exception.h"
namespace lean {
class unfold_untrusted_macros_fn {