From 1974f5a63ce75d5a8283753b19f70fb8d71738f8 Mon Sep 17 00:00:00 2001 From: Linda Njau Date: Fri, 16 Aug 2024 13:35:27 +0300 Subject: [PATCH] Update json_of_name to prioritize mnemonic over AST key This change ensures that when both AST and mnemonic are annoted for an instruction, the parser will prioritize the mnemonic as the key to retrieve the name from the Hashtbl. If the mnemonic is missing, the parser will fall back to using the AST as the default key. --- src/sail_json_backend/json.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sail_json_backend/json.ml b/src/sail_json_backend/json.ml index 29bee37c9..917adf61a 100644 --- a/src/sail_json_backend/json.ml +++ b/src/sail_json_backend/json.ml @@ -673,8 +673,8 @@ let json_of_function k = let json_of_name k mnemonic = let name = - match Hashtbl.find_opt names k with - | None -> begin match Hashtbl.find_opt names mnemonic with None -> "TBD" | Some s -> String.escaped s end + match Hashtbl.find_opt names mnemonic with + | None -> begin match Hashtbl.find_opt names k with None -> "TBD" | Some s -> String.escaped s end | Some s -> String.escaped s in "\"" ^ name ^ "\""