瀏覽代碼

[tre] better check for static methods

Aleksandr Kuzmenko 6 年之前
父節點
當前提交
2bba946960
共有 1 個文件被更改,包括 1 次插入4 次删除
  1. 1 4
      src/filters/tre.ml

+ 1 - 4
src/filters/tre.ml

@@ -203,10 +203,7 @@ let rec has_tail_recursion is_recursive_call cancel_tre function_end e =
 let run ctx e =
 let run ctx e =
 	match e.eexpr with
 	match e.eexpr with
 	| TFunction fn ->
 	| TFunction fn ->
-		let is_tre_eligible =
-			has_class_field_flag ctx.curfield CfFinal
-			|| PMap.exists ctx.curfield.cf_name ctx.curclass.cl_statics
-		in
+		let is_tre_eligible = ctx.curfun = FunStatic || has_class_field_flag ctx.curfield CfFinal in
 		let is_recursive_call callee args =
 		let is_recursive_call callee args =
 			is_tre_eligible && is_recursive_method_call ctx.curclass ctx.curfield callee args
 			is_tre_eligible && is_recursive_method_call ctx.curclass ctx.curfield callee args
 		in
 		in