Explorar el Código

don't type methods when requesting only fields completion

Nicolas Cannasse hace 13 años
padre
commit
848631c763
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  1. 8 1
      typer.ml

+ 8 - 1
typer.ml

@@ -1701,8 +1701,15 @@ and type_expr ctx ?(need_val=true) (e,p) =
 		let fields = (match follow e.etype with
 		let fields = (match follow e.etype with
 			| TInst (c,params) ->
 			| TInst (c,params) ->
 				let priv = is_parent c ctx.curclass in
 				let priv = is_parent c ctx.curclass in
+				let opt_field f =
+					match f.cf_type with
+					| TLazy _ ->
+						(* this is not yet typed, let's put a fake method : this will speedup results *)
+						{ f with cf_type = TFun ([],ctx.t.tvoid) }
+					| _ -> f
+				in
 				let merge ?(cond=(fun _ -> true)) a b =
 				let merge ?(cond=(fun _ -> true)) a b =
-					PMap.foldi (fun k f m -> if cond f then PMap.add k f m else m) a b
+					PMap.foldi (fun k f m -> if cond f then PMap.add k (opt_field f) m else m) a b
 				in
 				in
 				let rec loop c params =
 				let rec loop c params =
 					let m = List.fold_left (fun m (i,params) ->
 					let m = List.fold_left (fun m (i,params) ->