Browse Source

Use proper has_side_effect check for local dce.

Dan Korostelev 10 years ago
parent
commit
08c8ea726b
2 changed files with 2 additions and 2 deletions
  1. 1 1
      analyzer.ml
  2. 1 1
      tests/unit/src/unit/TestDCE.hx

+ 1 - 1
analyzer.ml

@@ -1244,7 +1244,7 @@ module LocalDce = struct
 			| TVar(v,None) -> is_used v
 			| TVar(v,Some e1) -> is_used v || Optimizer.has_side_effect e1
 			| TBinop(OpAssign,{eexpr = TLocal v},e2) -> is_used v || Optimizer.has_side_effect e2
-			| _ -> true
+			| _ -> Optimizer.has_side_effect e
 		in
 		let rec collect e = match e.eexpr with
 			| TLocal v ->

+ 1 - 1
tests/unit/src/unit/TestDCE.hx

@@ -1,6 +1,6 @@
 package unit;
 
-@:analyzer(no_check_has_effect)
+@:analyzer(no_check_has_effect, no_local_dce)
 class DCEClass {
 	// used statics
 	static function staticUsed() { }