فهرست منبع

try something

Dan Korostelev 4 سال پیش
والد
کامیت
7caa491a94
2فایلهای تغییر یافته به همراه15 افزوده شده و 3 حذف شده
  1. 4 2
      src/generators/genjvm.ml
  2. 11 1
      src/typing/typer.ml

+ 4 - 2
src/generators/genjvm.ml

@@ -1780,8 +1780,10 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 			load()
 		| TTypeExpr mt ->
 			let t = type_of_module_type mt in
-			if ExtType.is_void (follow t) then jm#get_basic_type_class "Void"
-			else jm#get_class (jsignature_of_type gctx t)
+			if ExtType.is_void (follow t) then
+				code#aconst_null (jsignature_of_type gctx t)
+			else
+				jm#get_class (jsignature_of_type gctx t)
 		| TUnop(op,flag,e1) ->
 			begin match op with
 			| Not | Neg | NegBits when not (need_val ret) -> self#texpr ret e1

+ 11 - 1
src/typing/typer.ml

@@ -1554,7 +1554,17 @@ and type_call_target ctx e el with_type inline p =
 and type_call ?(mode=MGet) ctx e el (with_type:WithType.t) inline p =
 	let def () =
 		let e = type_call_target ctx e el with_type inline p in
-		build_call ~mode ctx e el with_type p;
+		let ecall = build_call ~mode ctx e el with_type p in
+		(* TEMPORARY HACK *) begin
+			match ctx.com.platform with
+			| Js | Eval -> ecall
+			| _ ->
+				if ExtType.is_void (follow ecall.etype) && with_type <> NoValue then
+					let enull = mk (TTypeExpr (match ctx.com.basic.tvoid with TAbstract (a,_) -> TAbstractDecl a | _ -> assert false)) ctx.com.basic.tvoid p in
+					{ ecall with eexpr = TBlock [ecall; enull] }
+				else
+					ecall
+		(* TEMPORARY HACK *) end
 	in
 	match e, el with
 	| (EConst (Ident "trace"),p) , e :: el ->