From 7b12e12571f344a93e731c236a826a6d65a7e0ca Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sun, 1 Jul 2018 17:09:27 +0700 Subject: [PATCH] Share loc variable Signed-off-by: Rudi Grinberg --- src/installed_dune_file.ml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/installed_dune_file.ml b/src/installed_dune_file.ml index a1afb4a6..803a4918 100644 --- a/src/installed_dune_file.ml +++ b/src/installed_dune_file.ml @@ -57,11 +57,10 @@ let load fname = | t -> loop (t :: acc) end in + let loc = Sexp.Loc.of_lexbuf lexbuf in match loop [] with - | [Lparen; Atom (A "dune"); Atom s] -> - (Sexp.Loc.of_lexbuf lexbuf, Sexp.Atom.to_string s) - | _ -> - Loc.fail (Sexp.Loc.of_lexbuf lexbuf) "%s" bad_dune_file + | [Lparen; Atom (A "dune"); Atom s] -> (loc, Sexp.Atom.to_string s) + | _ -> Loc.fail loc "%s" bad_dune_file in let (lexer, syntax) = match version with