aboutsummaryrefslogtreecommitdiffhomepage
path: root/toplevel/command.ml
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2000-12-15 11:28:03 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2000-12-15 11:28:03 +0000
commit507efdd9d57641bb5beb726a2f0f36f047b94901 (patch)
treefa923701d29fb4f06e466ca2645b70294c09afbd /toplevel/command.ml
parent97cc536d6614d344510520fa130665fe294a5d11 (diff)
Bug des locaux au premier niveau des modules qui disparaissaient de l'environnement (changement de is_section_p)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@1120 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'toplevel/command.ml')
-rw-r--r--toplevel/command.ml48
1 files changed, 22 insertions, 26 deletions
diff --git a/toplevel/command.ml b/toplevel/command.ml
index 41085d350..30d293ba9 100644
--- a/toplevel/command.ml
+++ b/toplevel/command.ml
@@ -54,30 +54,29 @@ let constr_of_constr_entry ce =
| None -> ce.const_entry_body
| Some t -> mkCast (ce.const_entry_body, t)
+let declare_global_definition ident ce n local =
+ declare_constant ident (ConstantEntry ce,n,false);
+ if local then
+ wARNING [< pr_id ident; 'sTR" is declared as a global definition" >];
+ if is_verbose() then
+ message ((string_of_id ident) ^ " is defined")
+
let definition_body_red red_option ident (local,n) com comtypeopt =
- let warning () =
- mSGERRNL [< 'sTR"Warning: "; pr_id ident;
- 'sTR" is declared as a global definition" >] in
let ce = constant_entry_of_com (com,comtypeopt) in
let ce' = red_constant_entry ce red_option in
match n with
- | NeverDischarge ->
- declare_constant ident (ConstantEntry ce',n,false);
- if local then warning ();
- if is_verbose() then message ((string_of_id ident) ^ " is defined")
+ | NeverDischarge -> declare_global_definition ident ce n local
| DischargeAt disch_sp ->
if Lib.is_section_p disch_sp then begin
let c = constr_of_constr_entry ce in
declare_variable ident (SectionLocalDef c,n,false);
if is_verbose() then message ((string_of_id ident) ^ " is defined");
if Pfedit.refining () then
- mSGERRNL [< 'sTR"Warning: Variable "; pr_id ident;
+ mSGERRNL [< 'sTR"Warning: Local definition "; pr_id ident;
'sTR" is not visible from current goals" >]
- end else begin
- declare_constant ident (ConstantEntry ce',n,false);
- warning ();
- if is_verbose() then message ((string_of_id ident) ^ " is defined")
- end
+ end
+ else
+ declare_global_definition ident ce' n true
let definition_body = definition_body_red None
@@ -93,17 +92,15 @@ let parameter_def_var ident c =
let c = interp_type Evd.empty (Global.env()) c in
declare_parameter (id_of_string ident) c;
if is_verbose() then message (ident ^ " is assumed")
-
+
+let declare_global_assumption ident c =
+ parameter_def_var ident c;
+ wARNING [< 'sTR ident; 'sTR" is declared as a parameter";
+ 'sTR" because it is at a global level" >]
+
let hypothesis_def_var is_refining ident n c =
- let warning () =
- mSGERRNL [< 'sTR"Warning: "; 'sTR ident;
- 'sTR" is declared as a parameter";
- 'sTR" because it is at a global level" >]
- in
match n with
- | NeverDischarge ->
- parameter_def_var ident c;
- warning()
+ | NeverDischarge -> declare_global_assumption ident c
| DischargeAt disch_sp ->
if Lib.is_section_p disch_sp then begin
let t = interp_type Evd.empty (Global.env()) c in
@@ -113,10 +110,9 @@ let hypothesis_def_var is_refining ident n c =
if is_refining then
mSGERRNL [< 'sTR"Warning: Variable "; 'sTR ident;
'sTR" is not visible from current goals" >]
- end else begin
- parameter_def_var ident c;
- warning()
- end
+ end
+ else
+ declare_global_assumption ident c
(* 3| Mutual Inductive definitions *)