From f4db2536df32cb81981e0a4c78da879e09a3b206 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Wed, 7 Feb 2007 19:14:23 +0000 Subject: [PATCH] Actionscript, you are too strange. I thought I was casting: Function(myObject) I gotta remember that the function-looking variants do more than cast. For example: var o :Object = null; var s :String = String(o); trace(s.length); // outputs 4. (s === "null", now) Apparently Function(args) tries to evaluate the arguments as if they were code. Switched to casting like (args as Function); git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4539 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/util/MethodQueue.as | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/as/com/threerings/util/MethodQueue.as b/src/as/com/threerings/util/MethodQueue.as index 6454ccd94..4ae379123 100644 --- a/src/as/com/threerings/util/MethodQueue.as +++ b/src/as/com/threerings/util/MethodQueue.as @@ -66,12 +66,14 @@ public class MethodQueue // safely call each function for each (var arr :Array in methods) { + var fn :Function = (arr[0] as Function); + var args :Array = (arr[1] as Array); try { - Function(arr[0]).apply(null, (arr[1] as Array)); + fn.apply(null, args); } catch (e :Error) { Log.getLog(MethodQueue).warning("Error calling deferred method " + - "[e=" + e + ", fn=" + arr[0] + "]."); + "[e=" + e + ", fn=" + fn + ", args=" + args + "]."); } }