2
0
Эх сурвалжийг харах

make Math `@:pure`

Also add special case for flash's `__int__` because that's always fun. Closes #5666
Simon Krajewski 9 жил өмнө
parent
commit
5b8bc7dd3d

+ 3 - 2
src/optimization/analyzerTexpr.ml

@@ -133,8 +133,9 @@ let rec can_be_used_as_value com e =
 let wrap_meta s e =
 	mk (TMeta((Meta.Custom s,[],e.epos),e)) e.etype e.epos
 
-let is_really_unbound v =
-	v.v_name <> "`trace" && is_unbound v
+let is_really_unbound v = match v.v_name with
+	| "`trace" | "__int__" -> false
+	| _ -> is_unbound v
 
 let r = Str.regexp "^\\([A-Za-z0-9_]\\)+$"
 let is_unbound_call_that_might_have_side_effects v el = match v.v_name,el with

+ 1 - 0
std/Math.hx

@@ -25,6 +25,7 @@
 	@see http://haxe.org/manual/std-math.html
 **/
 #if cpp @:include("hxMath.h") #end
+@:pure
 extern class Math
 {
 	/**