diff options
| author | Gaëtan Gilbert | 2019-07-03 10:40:38 +0200 |
|---|---|---|
| committer | Gaëtan Gilbert | 2019-07-03 17:05:29 +0200 |
| commit | 1cc661d18f67f71a494b525b1f82fd9133ee5a3c (patch) | |
| tree | 64da7fefd94e84f95c525f1d5fc8d63fd2e4421b | |
| parent | d76a3591e091bb0807fa974c4098b32db9e6d1ad (diff) | |
Move variable_secpath logic to dumpglob from constrintern
| -rw-r--r-- | interp/constrintern.ml | 19 | ||||
| -rw-r--r-- | interp/dumpglob.ml | 3 | ||||
| -rw-r--r-- | interp/dumpglob.mli | 1 |
3 files changed, 14 insertions, 9 deletions
diff --git a/interp/constrintern.ml b/interp/constrintern.ml index eb4cd5b35e..68ade75815 100644 --- a/interp/constrintern.ml +++ b/interp/constrintern.ml @@ -949,16 +949,17 @@ let intern_var env (ltacvars,ntnvars) namedctx loc id us = (* Is [id] a goal or section variable *) let _ = Environ.lookup_named_ctxt id namedctx in try - (* [id] a section variable *) - (* Redundant: could be done in intern_qualid *) - let ref = VarRef id in - let impls = implicits_of_global ref in - let scopes = find_arguments_scope ref in - Dumpglob.dump_reference ?loc "<>" (string_of_qualid (Decls.variable_secpath id)) "var"; - DAst.make ?loc @@ GRef (ref, us), impls, scopes, [] + (* [id] a section variable *) + (* Redundant: could be done in intern_qualid *) + let ref = VarRef id in + let impls = implicits_of_global ref in + let scopes = find_arguments_scope ref in + Dumpglob.dump_secvar ?loc id; (* this raises Not_found when not a section variable *) + (* Someday we should stop relying on Dumglob raising exceptions *) + DAst.make ?loc @@ GRef (ref, us), impls, scopes, [] with e when CErrors.noncritical e -> - (* [id] a goal variable *) - gvar (loc,id) us, [], [], [] + (* [id] a goal variable *) + gvar (loc,id) us, [], [], [] let find_appl_head_data c = match DAst.get c with diff --git a/interp/dumpglob.ml b/interp/dumpglob.ml index 482303d935..dc6a1ae180 100644 --- a/interp/dumpglob.ml +++ b/interp/dumpglob.ml @@ -166,6 +166,9 @@ let dump_reference ?loc modpath ident ty = let filepath = Names.DirPath.to_string (Lib.library_dp ()) in dump_ref ?loc filepath modpath ident ty +let dump_secvar ?loc id = + dump_reference ?loc "<>" (Libnames.string_of_qualid (Decls.variable_secpath id)) "var" + let dump_modref ?loc mp ty = let (dp, l) = Lib.split_modpath mp in let filepath = Names.DirPath.to_string dp in diff --git a/interp/dumpglob.mli b/interp/dumpglob.mli index e0308b8afc..60d62a1cb2 100644 --- a/interp/dumpglob.mli +++ b/interp/dumpglob.mli @@ -32,6 +32,7 @@ val dump_definition : Names.lident -> bool -> string -> unit val dump_moddef : ?loc:Loc.t -> Names.ModPath.t -> string -> unit val dump_modref : ?loc:Loc.t -> Names.ModPath.t -> string -> unit val dump_reference : ?loc:Loc.t -> string -> string -> string -> unit +val dump_secvar : ?loc:Loc.t -> Names.Id.t -> unit val dump_libref : ?loc:Loc.t -> Names.DirPath.t -> string -> unit val dump_notation_location : (int * int) list -> Constrexpr.notation -> (Notation.notation_location * Notation_term.scope_name option) -> unit |
