Răsfoiți Sursa

print the types of Then and Else as well

Simon Krajewski 10 ani în urmă
părinte
comite
8de2f6d98a
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      type.ml

+ 1 - 1
type.ml

@@ -1128,7 +1128,7 @@ let rec s_expr_ast print_var_ids tabs s_type e =
 	| TFunction f -> tag "Function" [loop f.tf_expr]
 	| TVar (v,eo) -> var v (match eo with None -> [] | Some e -> [loop e])
 	| TBlock el -> tag "Block" (List.map loop el)
-	| TIf (e,e1,e2) -> tag "If" (loop e :: ("Then " ^ loop e1) :: (match e2 with None -> [] | Some e -> ["Else " ^ (loop e)]))
+	| TIf (e,e1,e2) -> tag "If" (loop e :: (Printf.sprintf "[Then:%s] %s" (s_type e1.etype) (loop e1)) :: (match e2 with None -> [] | Some e -> [Printf.sprintf "[Else:%s] %s" (s_type e.etype) (loop e)]))
 	| TCast (e1,None) -> tag "Cast" [loop e1]
 	| TCast (e1,Some mt) -> tag "Cast" [loop e1; module_type mt]
 	| TThrow e1 -> tag "Throw" [loop e1]