Explorar el Código

allow calling abstract function fields (closes #1993)

Simon Krajewski hace 12 años
padre
commit
6f40c159b9
Se han modificado 1 ficheros con 3 adiciones y 15 borrados
  1. 3 15
      typer.ml

+ 3 - 15
typer.ml

@@ -1202,7 +1202,7 @@ and type_field ctx e i p mode =
 			let et = type_module_type ctx (TClassDecl c) None p in
 			let field_expr f t = mk (TField (et,FStatic (c,f))) t p in
 			(match mode, f.cf_kind with
-			| MGet, Var {v_read = AccCall } ->
+			| (MGet | MCall), Var {v_read = AccCall } ->
 				(* getter call *)
 				let f = PMap.find ("get_" ^ f.cf_name) c.cl_statics in
 				let t = field_type f in
@@ -1214,21 +1214,9 @@ and type_field ctx e i p mode =
 				let t = field_type f in
 				let ef = field_expr f t in
 				AKUsing (ef,c,f,e)
-			| MCall, Var {v_read = AccCall} ->
-				error (i ^ " cannot be called") p
-			| MGet, Var {v_read = AccNever} ->
+			| (MGet | MCall), Var {v_read = AccNever} ->
 				AKNo f.cf_name
-			| MCall, _ ->
-				let t = field_type f in
-				begin match follow t with
-					| TFun((_,_,t1) :: _,_) ->
-						(match f.cf_kind with Method MethMacro -> () | _ -> unify ctx (apply_params a.a_types pl a.a_this) t1 p)
-					| _ ->
-						error (i ^ " cannot be called") p
-				end;
-				let ef = field_expr f t in
-				AKUsing (ef,c,f,e)
-			| MGet, _ ->
+			| (MGet | MCall), _ ->
 				let t = field_type f in
 				let ef = field_expr f t in
 				AKUsing (ef,c,f,e)