Przeglądaj źródła

that's not how you write a bottom up mapping (closes #5509)

Simon Krajewski 8 lat temu
rodzic
commit
13c7b9e054

+ 2 - 1
src/optimization/analyzer.ml

@@ -969,7 +969,8 @@ module Run = struct
 		back_again actx is_real_function
 
 	let rec reduce_control_flow ctx e =
-		Type.map_expr (reduce_control_flow ctx) (Optimizer.reduce_control_flow ctx e)
+		let e = Type.map_expr (reduce_control_flow ctx) e in
+		Optimizer.reduce_control_flow ctx e
 
 	let run_on_field ctx config c cf = match cf.cf_expr with
 		| Some e when not (is_ignored cf.cf_meta) && not (Typecore.is_removable_field ctx cf) ->

+ 14 - 0
tests/optimization/src/issues/Issue5509.hx

@@ -0,0 +1,14 @@
+package issues;
+
+class Issue5509 {
+	@:js('
+		issues_Issue5509["use"]();
+	')
+	static function test() {
+        var v = "some";
+        if (v != null)
+			use();
+	}
+
+	@:pure(false) static function use() { }
+}