瀏覽代碼

add overloads to call display

Simon Krajewski 9 年之前
父節點
當前提交
8ace1eb61f
共有 1 個文件被更改,包括 10 次插入6 次删除
  1. 10 6
      src/typing/typer.ml

+ 10 - 6
src/typing/typer.ml

@@ -3820,15 +3820,19 @@ and handle_display ctx e_ast iscall with_type p =
 		collect_toplevel_identifiers ctx;
 	| DMDefault | DMNone | DMDocumentSymbols ->
 		let opt_args args ret = TFun(List.map(fun (n,o,t) -> n,true,t) args,ret) in
-		let e = match e.eexpr with
+		let e,tl_overloads = match e.eexpr with
 			| TField (e1,fa) ->
+				let tl = match extract_field fa with
+					| Some cf when iscall -> List.map (fun cf -> cf.cf_type) cf.cf_overloads
+					| _ -> []
+				in
 				if field_name fa = "bind" then (match follow e1.etype with
-					| TFun(args,ret) -> {e1 with etype = opt_args args ret}
-					| _ -> e)
+					| TFun(args,ret) -> {e1 with etype = opt_args args ret},tl
+					| _ -> e,tl)
 				else
-					e
+					e,tl
 			| _ ->
-				e
+				e,[]
 		in
 		let opt_type t =
 			match t with
@@ -4003,7 +4007,7 @@ and handle_display ctx e_ast iscall with_type p =
 		in
 		(match follow t with
 		| TMono _ | TDynamic _ when ctx.in_macro -> mk (TConst TNull) t p
-		| _ -> raise (Display.DisplayTypes [t]))
+		| _ -> raise (Display.DisplayTypes (t :: tl_overloads)))
 
 and maybe_type_against_enum ctx f with_type p =
 	try