浏览代码

clean up abstract config implementation

Simon Krajewski 11 年之前
父节点
当前提交
f1f5639fae
共有 1 个文件被更改,包括 10 次插入5 次删除
  1. 10 5
      typer.ml

+ 10 - 5
typer.ml

@@ -743,17 +743,22 @@ let make_call ctx e params t p =
 			| _ -> false
 		) in
 		let config = match cl with
-			| Some ({cl_kind = KAbstractImpl _ }) when Meta.has Meta.Impl f.cf_meta ->
-				(match if fname = "_new" then
+			| Some ({cl_kind = KAbstractImpl _}) when Meta.has Meta.Impl f.cf_meta ->
+				let t = if fname = "_new" then
 					t
 				else if params = [] then
 					error "Invalid abstract implementation function" f.cf_pos
 				else
-					follow (List.hd params).etype with
+					follow (List.hd params).etype
+				in
+				begin match t with
 					| TAbstract(a,pl) ->
-						Some (a.a_types <> [] || f.cf_params <> [], fun t -> apply_params a.a_types pl (monomorphs f.cf_params t))
+						let has_params = a.a_types <> [] || f.cf_params <> [] in
+						let map_type = fun t -> apply_params a.a_types pl (monomorphs f.cf_params t) in
+						Some (has_params,map_type)
 					| _ ->
-						None);
+						None
+				end
 			| _ ->
 				None
 		in