From fb9755ab4445fd86cdfc5b249b487629591d87a0 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Thu, 31 May 2018 09:14:47 +0000 Subject: [vernac] mk_atts: an atts record with default values --- stm/vernac_classifier.ml | 2 +- vernac/vernacentries.ml | 2 +- vernac/vernacinterp.ml | 3 +++ vernac/vernacinterp.mli | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/stm/vernac_classifier.ml b/stm/vernac_classifier.ml index 0606d27ed..6be80d29a 100644 --- a/stm/vernac_classifier.ml +++ b/stm/vernac_classifier.ml @@ -199,7 +199,7 @@ let classify_vernac e = in let rec static_control_classifier ~poly = function | VernacExpr (f, e) -> - let _, atts = Vernacentries.attributes_of_flags f Vernacinterp.{ loc = None ; locality = None ; polymorphic = poly ; program = false } in + let _, atts = Vernacentries.attributes_of_flags f Vernacinterp.(mk_atts ~polymorphic:poly ()) in let poly = atts.Vernacinterp.polymorphic in static_classifier ~poly e | VernacTimeout (_,e) -> static_control_classifier ~poly e diff --git a/vernac/vernacentries.ml b/vernac/vernacentries.ml index 135141cd4..1740c5a80 100644 --- a/vernac/vernacentries.ml +++ b/vernac/vernacentries.ml @@ -2344,7 +2344,7 @@ let interp ?(verbosely=true) ?proof ~st {CAst.loc;v=c} = let orig_program_mode = Flags.is_program_mode () in let rec control = function | VernacExpr (f, v) -> - let (polymorphism, atts) = attributes_of_flags f { loc; locality = None; polymorphic = false; program = orig_program_mode; } in + let (polymorphism, atts) = attributes_of_flags f (mk_atts ~program:orig_program_mode ()) in aux ~polymorphism ~atts v | VernacFail v -> with_fail st true (fun () -> control v) | VernacTimeout (n,v) -> diff --git a/vernac/vernacinterp.ml b/vernac/vernacinterp.ml index d4f2a753f..36b8a7e62 100644 --- a/vernac/vernacinterp.ml +++ b/vernac/vernacinterp.ml @@ -21,6 +21,9 @@ type atts = { program : bool; } +let mk_atts ?(loc=None) ?(locality=None) ?(polymorphic=false) ?(program=false) () : atts = + { loc ; locality ; polymorphic ; program } + type 'a vernac_command = 'a -> atts:atts -> st:Vernacstate.t -> Vernacstate.t type plugin_args = Genarg.raw_generic_argument list diff --git a/vernac/vernacinterp.mli b/vernac/vernacinterp.mli index 935cacf77..a24bcd40d 100644 --- a/vernac/vernacinterp.mli +++ b/vernac/vernacinterp.mli @@ -19,6 +19,9 @@ type atts = { program : bool; } +val mk_atts : ?loc: Loc.t option -> ?locality: bool option -> + ?polymorphic: bool -> ?program: bool -> unit -> atts + type 'a vernac_command = 'a -> atts:atts -> st:Vernacstate.t -> Vernacstate.t type plugin_args = Genarg.raw_generic_argument list -- cgit v1.2.3