Parcourir la source

hl fixes (close #5702)

Nicolas Cannasse il y a 9 ans
Parent
commit
272ee78818

+ 1 - 1
src/generators/hlinterp.ml

@@ -643,7 +643,7 @@ let interp code =
 		| VVirtual v ->
 			to_virtual v.vvalue vp
 		| _ ->
-			error ("Invalid ToVirtual " ^ vstr_d v ^ " : " ^ tstr (HVirtual vp))
+			throw_msg ("Invalid ToVirtual " ^ vstr_d v ^ " : " ^ tstr (HVirtual vp))
 
 	and call f args =
 		let regs = Array.create (Array.length f.regs) VUndef in

+ 1 - 1
src/optimization/analyzer.ml

@@ -1164,7 +1164,7 @@ module Run = struct
 				| TReturn (Some e) -> e
 				| TFunction tf when first ->
 					begin match loop false tf.tf_expr with
-						| {eexpr = TBlock _ | TIf _ | TSwitch _ | TTry _} when actx.com.platform = Cpp ->
+						| {eexpr = TBlock _ | TIf _ | TSwitch _ | TTry _} when actx.com.platform = Cpp || actx.com.platform = Hl ->
 							mk (TCall(e,[])) tf.tf_type e.epos
 						| e ->
 							e

+ 1 - 2
tests/unit/src/unit/issues/Issue5358.hx

@@ -2,7 +2,6 @@ package unit.issues;
 
 class Issue5358 extends unit.Test {
 
-	#if !hl
 	static var example = if (veryRandom() > 0.5) 1 else 2;
 
 	function test() {
@@ -12,5 +11,5 @@ class Issue5358 extends unit.Test {
 	static function veryRandom() {
 		return 4;
 	}
-	#end
+
 }