소스 검색

recurse into TCall when handling display

Properties might be typed as calls to their accessors, so we get information for them this way. It would be nice to also respect the actual property, but that's not so easy to do.
Simon Krajewski 9 년 전
부모
커밋
5c580a7b8e
1개의 변경된 파일9개의 추가작업 그리고 3개의 파일을 삭제
  1. 9 3
      src/typing/typer.ml

+ 9 - 3
src/typing/typer.ml

@@ -3771,7 +3771,7 @@ and handle_display ctx e_ast iscall with_type p =
 	| DMType ->
 	| DMType ->
 		raise (DisplayTypes [match e.eexpr with TVar(v,_) -> v.v_type | _ -> e.etype])
 		raise (DisplayTypes [match e.eexpr with TVar(v,_) -> v.v_type | _ -> e.etype])
 	| DMUsage ->
 	| DMUsage ->
-		begin match e.eexpr with
+		let rec loop e = match e.eexpr with
 		| TField(_,FEnum(_,ef)) ->
 		| TField(_,FEnum(_,ef)) ->
 			ef.ef_meta <- (Meta.Usage,[],p) :: ef.ef_meta;
 			ef.ef_meta <- (Meta.Usage,[],p) :: ef.ef_meta;
 		| TField(_,(FAnon cf | FInstance (_,_,cf) | FStatic (_,cf) | FClosure (_,cf))) ->
 		| TField(_,(FAnon cf | FInstance (_,_,cf) | FStatic (_,cf) | FClosure (_,cf))) ->
@@ -3788,12 +3788,15 @@ and handle_display ctx e_ast iscall with_type p =
 			with Not_found ->
 			with Not_found ->
 				()
 				()
 			end
 			end
+		| TCall(e1,_) ->
+			loop e1
 		| _ ->
 		| _ ->
 			()
 			()
-		end;
+		in
+		loop e;
 		e
 		e
 	| DMPosition ->
 	| DMPosition ->
-		let pl = match e.eexpr with
+		let rec loop e = match e.eexpr with
 		| TField(_,FEnum(_,ef)) -> [ef.ef_pos]
 		| TField(_,FEnum(_,ef)) -> [ef.ef_pos]
 		| TField(_,(FAnon cf | FInstance (_,_,cf) | FStatic (_,cf) | FClosure (_,cf))) -> [cf.cf_pos]
 		| TField(_,(FAnon cf | FInstance (_,_,cf) | FStatic (_,cf) | FClosure (_,cf))) -> [cf.cf_pos]
 		| TLocal v | TVar(v,_) -> [v.v_pos]
 		| TLocal v | TVar(v,_) -> [v.v_pos]
@@ -3805,9 +3808,12 @@ and handle_display ctx e_ast iscall with_type p =
 			with Not_found ->
 			with Not_found ->
 				[]
 				[]
 			end
 			end
+		| TCall(e1,_) ->
+			loop e1
 		| _ ->
 		| _ ->
 			[]
 			[]
 		in
 		in
+		let pl = loop e in
 		raise (DisplayPosition pl);
 		raise (DisplayPosition pl);
 	| DMToplevel ->
 	| DMToplevel ->
 		collect_toplevel_identifiers ctx;
 		collect_toplevel_identifiers ctx;