aboutsummaryrefslogtreecommitdiff
path: root/checker/safe_checking.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2018-11-07 11:42:38 +0100
committerPierre-Marie Pédrot2018-11-07 11:42:38 +0100
commit19b7ce2f39eaf37e48d1d12ef73defab3c9fbdb2 (patch)
treea55af313e25a17382c94a60805b95e82f02ef6c6 /checker/safe_checking.ml
parente857efb2e61c29a5b0b29702ca8d746ea2580ca6 (diff)
parent7f2946157797ba7da3ed8712c10f5a0302b36d49 (diff)
Merge PR #8773: [checker] Refactor by sharing code with the kernel
Diffstat (limited to 'checker/safe_checking.ml')
-rw-r--r--checker/safe_checking.ml23
1 files changed, 23 insertions, 0 deletions
diff --git a/checker/safe_checking.ml b/checker/safe_checking.ml
new file mode 100644
index 0000000000..6dc2953060
--- /dev/null
+++ b/checker/safe_checking.ml
@@ -0,0 +1,23 @@
+(************************************************************************)
+(* * The Coq Proof Assistant / The Coq Development Team *)
+(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
+(* <O___,, * (see CREDITS file for the list of authors) *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(* * (see LICENSE file for the text of the license) *)
+(************************************************************************)
+
+open Declarations
+open Environ
+
+let import senv clib univs digest =
+ let mb = Safe_typing.module_of_library clib in
+ let env = Safe_typing.env_of_safe_env senv in
+ let env = push_context_set ~strict:true mb.mod_constraints env in
+ let env = push_context_set ~strict:true univs env in
+ Mod_checking.check_module env mb.mod_mp mb;
+ let (_,senv) = Safe_typing.import clib univs digest senv in senv
+
+let unsafe_import senv clib univs digest =
+ let (_,senv) = Safe_typing.import clib univs digest senv in senv