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,15 +102,21 @@ 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
typecheck_program program cctxt#block cctxt >>= fun res -> | program, [] ->
print_typecheck_result typecheck_program program cctxt#block cctxt >>= fun res ->
~emacs:emacs_mode print_typecheck_result
~show_types ~emacs:emacs_mode
~print_source_on_error:(not no_print_source) ~show_types
program ~print_source_on_error:(not no_print_source)
res program
cctxt) ; res
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)