From 77e00160fdc52e347f1e0ceb4433048f996b8cc5 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Thu, 10 Jul 2008 21:08:47 +0000 Subject: [PATCH] Using appDom here booched the thane build. Work around my issue another way, which is in some ways smoother: if the object is a normal object from a normal class, get the class right off instead of even doing the by-name stuff. The appDom stuff could conceivably still be desired in the future, but this will cover just about everything and we can always re-add this extra business when need it. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5230 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/util/ClassUtil.as | 28 ++++++++----------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/src/as/com/threerings/util/ClassUtil.as b/src/as/com/threerings/util/ClassUtil.as index 72000622a..eda02bed8 100644 --- a/src/as/com/threerings/util/ClassUtil.as +++ b/src/as/com/threerings/util/ClassUtil.as @@ -21,8 +21,6 @@ package com.threerings.util { -import flash.system.ApplicationDomain; - import flash.utils.describeType; import flash.utils.getQualifiedClassName; import flash.utils.getDefinitionByName; @@ -64,9 +62,9 @@ public class ClassUtil * Return a new instance that is the same class as the specified * object. The class must have a zero-arg constructor. */ - public static function newInstance (obj :Object, appDom :ApplicationDomain = null) :Object + public static function newInstance (obj :Object) :Object { - var clazz :Class = getClass(obj, appDom); + var clazz :Class = getClass(obj); return new clazz(); } @@ -75,26 +73,18 @@ public class ClassUtil return (getQualifiedClassName(obj1) == getQualifiedClassName(obj2)); } - public static function getClass (obj :Object, appDom :ApplicationDomain = null) :Class + public static function getClass (obj :Object) :Class { - return getClassByName(getQualifiedClassName(obj), appDom); + if (obj.constructor is Class) { + return Class(obj.constructor); + } + return getClassByName(getQualifiedClassName(obj)); } - public static function getClassByName (cname :String, appDom :ApplicationDomain = null) :Class + public static function getClassByName (cname :String) :Class { try { - cname = cname.replace("::", "."); - if (appDom != null) { - try { - var c :Class = appDom.getDefinition(cname) as Class; - if (c != null) { - return c; - } - } catch (err :Error) { - // fall through - } - } - return (getDefinitionByName(cname) as Class); + return (getDefinitionByName(cname.replace("::", ".")) as Class); } catch (error :ReferenceError) { var log :Log = Log.getLog(ClassUtil);