This PR splits the environment used by the kernel from that used by the elaborator, providing the foundation for tracking of asynchronously elaborated declarations, which will exist as a concept only in the latter. Minor changes: * kernel diagnostics are moved from an environment extension to a direct environment as they are the only extension used directly by the kernel * `initQuot` is moved from an environment header field to a direct environment as it is the only header field used by the kernel; this also makes the remaining header immutable after import
24 lines
1,008 B
C++
24 lines
1,008 B
C++
/*
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Author: Leonardo de Moura
|
|
*/
|
|
#include <string>
|
|
#include "library/elab_environment.h"
|
|
#include "library/reducible.h"
|
|
|
|
namespace lean {
|
|
extern "C" uint8 lean_get_reducibility_status(object * env, object * n);
|
|
extern "C" object * lean_set_reducibility_status(object * env, object * n, uint8 s);
|
|
|
|
elab_environment set_reducible(elab_environment const & env, name const & n, reducible_status s, bool persistent) {
|
|
if (!persistent)
|
|
throw exception("reducibility attributes must be persistent for now, we will relax this restriction in a near future");
|
|
return elab_environment(lean_set_reducibility_status(env.to_obj_arg(), n.to_obj_arg(), static_cast<uint8>(s)));
|
|
}
|
|
|
|
reducible_status get_reducible_status(elab_environment const & env, name const & n) {
|
|
return static_cast<reducible_status>(lean_get_reducibility_status(env.to_obj_arg(), n.to_obj_arg()));
|
|
}
|
|
}
|