@@ -261,19 +261,19 @@ let run_file ~unsafe ~optimize ~entry_point ~invoke_with_symbols filename model
261261
262262let cmd ~unsafe ~optimize ~replay_file ~source_file ~entry_point
263263 ~invoke_with_symbols =
264+ let file_ext = Fpath. get_ext replay_file in
264265 let * parse_fn =
265- let ext = Fpath. get_ext replay_file in
266- match String. lowercase_ascii ext with
266+ match String. lowercase_ascii file_ext with
267267 | ".json" -> Ok Symbol_scope. model_of_json
268268 | ".scfg" -> Ok Symbol_scope. model_of_scfg
269- | _ -> Error (`Unsupported_file_extension ext )
269+ | _ -> Error (`Unsupported_file_extension file_ext )
270270 in
271271 let * file_content = Bos.OS.File. read replay_file in
272- let * model =
272+ let * model_entry_point, model =
273273 match parse_fn file_content with
274274 | Error (`Msg msg ) -> Error (`Invalid_model msg)
275275 | Error err -> Error err
276- | Ok model ->
276+ | Ok ( entry_point , model ) ->
277277 let bindings = Smtml.Model. get_bindings model in
278278 let + model =
279279 list_map
@@ -298,8 +298,13 @@ let cmd ~unsafe ~optimize ~replay_file ~source_file ~entry_point
298298 (Fmt. str " unexpected value type: %a" Smtml.Value. pp v) ) )
299299 bindings
300300 in
301- Array. of_list model
301+ (entry_point, Array. of_list model)
302302 in
303+ let entry_point =
304+ if Option. is_none entry_point then model_entry_point else entry_point
305+ in
306+ Logs. debug (fun m -> m " %s" (Option. value ~default: " na" entry_point));
307+ Logs. debug (fun m -> m " %s" (Option. value ~default: " na" model_entry_point));
303308 let + () =
304309 run_file ~unsafe ~optimize ~entry_point ~invoke_with_symbols source_file
305310 model
0 commit comments