Browse Source

print type of TConst too

Simon Krajewski 9 years ago
parent
commit
f6ea138d36
1 changed files with 3 additions and 3 deletions
  1. 3 3
      type.ml

+ 3 - 3
type.ml

@@ -1127,12 +1127,12 @@ let rec s_expr_ast print_var_ids tabs s_type e =
 		sprintf "[%s:%s]%s" s st (tag_args (tabs ^ extra_tabs) sl)
 		sprintf "[%s:%s]%s" s st (tag_args (tabs ^ extra_tabs) sl)
 	in
 	in
 	let var_id v = if print_var_ids then v.v_id else 0 in
 	let var_id v = if print_var_ids then v.v_id else 0 in
-	let const c = sprintf "[Const %s]" (s_const c) in
+	let const c t = tag "Const" ~t [s_const c] in
 	let local v = sprintf "[Local %s(%i):%s]" v.v_name (var_id v) (s_type v.v_type) in
 	let local v = sprintf "[Local %s(%i):%s]" v.v_name (var_id v) (s_type v.v_type) in
 	let var v sl = sprintf "[Var %s(%i):%s]%s" v.v_name (var_id v) (s_type v.v_type) (tag_args tabs sl) in
 	let var v sl = sprintf "[Var %s(%i):%s]%s" v.v_name (var_id v) (s_type v.v_type) (tag_args tabs sl) in
 	let module_type mt = sprintf "[TypeExpr %s:%s]" (s_type_path (t_path mt)) (s_type e.etype) in
 	let module_type mt = sprintf "[TypeExpr %s:%s]" (s_type_path (t_path mt)) (s_type e.etype) in
 	match e.eexpr with
 	match e.eexpr with
-	| TConst c -> const c
+	| TConst c -> const c (Some e.etype)
 	| TLocal v -> local v
 	| TLocal v -> local v
 	| TArray (e1,e2) -> tag "Array" [loop e1; loop e2]
 	| TArray (e1,e2) -> tag "Array" [loop e1; loop e2]
 	| TBinop (op,e1,e2) -> tag "Binop" [loop e1; s_binop op; loop e2]
 	| TBinop (op,e1,e2) -> tag "Binop" [loop e1; s_binop op; loop e2]
@@ -1156,7 +1156,7 @@ let rec s_expr_ast print_var_ids tabs s_type e =
 	| TNew (c,tl,el) -> tag "New" ((s_type (TInst(c,tl))) :: (List.map loop el))
 	| TNew (c,tl,el) -> tag "New" ((s_type (TInst(c,tl))) :: (List.map loop el))
 	| TFunction f ->
 	| TFunction f ->
 		let arg (v,cto) =
 		let arg (v,cto) =
-			tag "Arg" ~t:(Some v.v_type) ~extra_tabs:"\t" (match cto with None -> [local v] | Some ct -> [local v;const ct])
+			tag "Arg" ~t:(Some v.v_type) ~extra_tabs:"\t" (match cto with None -> [local v] | Some ct -> [local v;const ct None])
 		in
 		in
 		tag "Function" ((List.map arg f.tf_args) @ [loop f.tf_expr])
 		tag "Function" ((List.map arg f.tf_args) @ [loop f.tf_expr])
 	| TVar (v,eo) -> var v (match eo with None -> [] | Some e -> [loop e])
 	| TVar (v,eo) -> var v (match eo with None -> [] | Some e -> [loop e])