浏览代码

[analyzer] only avoid propagating toplevel-null (see #5074)

Simon Krajewski 9 年之前
父节点
当前提交
f736708e7e
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/optimization/analyzerTexpr.ml

+ 4 - 1
src/optimization/analyzerTexpr.ml

@@ -115,10 +115,13 @@ let rec can_be_used_as_value com e =
 		| TUnop((Increment | Decrement),_,_) when not (target_handles_unops com) -> raise Exit
 		| TUnop((Increment | Decrement),_,_) when not (target_handles_unops com) -> raise Exit
 		| TNew _ when com.platform = Php -> raise Exit
 		| TNew _ when com.platform = Php -> raise Exit
 		| TFunction _ -> ()
 		| TFunction _ -> ()
-		| TConst TNull when (match com.platform with Cs | Cpp | Java | Flash -> true | _ -> false) -> raise Exit
 		| _ -> Type.iter loop e
 		| _ -> Type.iter loop e
 	in
 	in
 	try
 	try
+		begin match com.platform,e.eexpr with
+			| (Cs | Cpp | Java | Flash),TConst TNull -> raise Exit
+			| _ -> ()
+		end;
 		loop e;
 		loop e;
 		true
 		true
 	with Exit ->
 	with Exit ->