소스 검색

[display] deal with AKMacro in acc_get

see #8737
Simon Krajewski 6 년 전
부모
커밋
0265a4e221
1개의 변경된 파일9개의 추가작업 그리고 2개의 파일을 삭제
  1. 9 2
      src/typing/calls.ml

+ 9 - 2
src/typing/calls.ml

@@ -550,8 +550,15 @@ let rec acc_get ctx g p =
 		| Var _,None ->
 			error "Recursive inline is not supported" p
 		end
-	| AKMacro _ ->
-		assert false
+	| AKMacro(e,cf) ->
+		(* If we are in display mode, we're probably hovering a macro call subject. Just generate a normal field. *)
+		if ctx.in_display then begin match e.eexpr with
+			| TTypeExpr (TClassDecl c) ->
+				mk (TField(e,FStatic(c,cf))) cf.cf_type e.epos
+			| _ ->
+				error "Invalid macro access" p
+		end else
+			error "Invalid macro access" p
 
 let rec build_call ?(mode=MGet) ctx acc el (with_type:WithType.t) p =
 	let check_assign () = if mode = MSet then invalid_assign p in