Project

General

Profile

« Previous | Next » 

Revision 2823bc51

Added by Pierre-Loïc Garoche about 6 years ago

Proper integer index for enumerated branches

View differences:

src/backends/EMF/EMF_common.ml
51 51
let reset_name id =
52 52
  "reset_" ^ id
53 53
  
54
    
54
let pp_tag_id fmt t =
55
  let typ = (Corelang.typedef_of_top (Hashtbl.find Corelang.tag_table t)) in
56
  if typ.tydef_id = "bool" then
57
    pp_print_string fmt t
58
  else
59
    let const_list = match typ.tydef_desc with Tydec_enum tl -> tl | _ -> assert false in
60
    fprintf fmt "%i" (get_idx t const_list)
61
     
55 62
let pp_emf_cst_or_var fmt v =
56 63
  match v.value_desc with
57 64
  | Cst ((Const_tag t) as c)->
......
60 67
       fprintf fmt "{@[\"type\": \"constant\",@ \"value\": \"%a\"@ @]}"
61 68
	 Printers.pp_const c
62 69
     else (
63
       let const_list = match typ.tydef_desc with Tydec_enum tl -> tl | _ -> assert false in
64
       fprintf fmt "{@[\"type\": \"constant\",@ \"value\": \"%i\",@ " 
65
	 (get_idx t const_list);
70
       fprintf fmt "{@[\"type\": \"constant\",@ \"value\": \"%a\",@ " 
71
	 pp_tag_id t;
66 72
       fprintf fmt "\"origin_type\": \"%s\",@ \"origin_value\": \"%s\"@ "
67 73
	 typ.tydef_id t;
68 74
       fprintf fmt "@]}"

Also available in: Unified diff