Emacs: repair Michelson parsing error reporting

This commit is contained in:
Benjamin Canou 2018-02-03 15:04:29 +01:00
parent c108b0cfd8
commit 0352278621

View File

@ -102,7 +102,8 @@ let commands () =
@@ Program.source_param @@ Program.source_param
@@ stop) @@ stop)
(fun (show_types, emacs_mode, no_print_source) program cctxt -> (fun (show_types, emacs_mode, no_print_source) program cctxt ->
Lwt.return @@ Micheline_parser.no_parsing_error program >>=? fun program -> match program with
| program, [] ->
typecheck_program program cctxt#block cctxt >>= fun res -> typecheck_program program cctxt#block cctxt >>= fun res ->
print_typecheck_result print_typecheck_result
~emacs:emacs_mode ~emacs:emacs_mode
@ -110,7 +111,12 @@ let commands () =
~print_source_on_error:(not no_print_source) ~print_source_on_error:(not no_print_source)
program program
res res
cctxt) ; cctxt
| res_with_errors ->
cctxt#message
"(@[<v 0>(types . ())@ (errors . %a)@])"
Michelson_v1_emacs.report_errors res_with_errors >>= fun () ->
return ()) ;
command ~group ~desc: "Ask the node to typecheck a data expression." command ~group ~desc: "Ask the node to typecheck a data expression."
(args1 no_print_source_flag) (args1 no_print_source_flag)