What’s the problem with computing it at compile time?

On Apr 26, 2016, at 6:31 PM, Alex Harui <aha...@adobe.com> wrote:

> It calls Language.superGetter
> 
> static public function superGetter(clazz:Object, pthis:Object,
> prop:String):Object
>               {
>                       var superClass:Object = clazz.superClass_;
>                       var superdesc:Object = 
> Object.getOwnPropertyDescriptor(superClass,
> prop);
> 
>                       while (superdesc == null)
>                       {
>                               superClass = superClass.constructor;
>                superClass = superClass.superClass_;
>                               superdesc = 
> Object.getOwnPropertyDescriptor(superClass, prop);
>                       }
>                       return superdesc.get.call(pthis);
>               }
> 
> 
> The problem is that if the base class has both a getter and a setter and
> the subclass only defines an override of a setter, you can't just
> Object.defineProperty a setter on the subclass.  You must also define a
> function for the getter that calls the base class getter.  But, the base
> class may not actually have a getter, the getter may actually be defined
> on some class further up the chain of base classes.  So,
> Language.superGetter and superSetter try to look up the function to call
> at runtime.
> 
> If we are sure we can compute the function to call at compile time, we
> might be able to avoid the runtime lookup.
> 
> -Alex
> 
> On 4/26/16, 6:04 AM, "Harbs" <harbs.li...@gmail.com> wrote:
> 
>> What’s the Javascript output in this case?
>> 
>> On Apr 25, 2016, at 6:02 PM, Alex Harui <aha...@adobe.com> wrote:
>> 
>>> Do you have a better way to do it?
>>> 
>>> -Alex
>>> 
>>> On 4/25/16, 1:46 AM, "lizhi" <s...@qq.com> wrote:
>>> 
>>>> just see
>>>> 
>>>> https://github.com/matrix3d/spriteflexjs/blob/master/test/src/SuperTest.
>>>> as
>>>> 
>>>> and see the s1.as s2.as s3.as s4.as
>>>> 
>>>> thanks.
>>>> 
>>>> 
>>>> 
>>>> --
>>>> View this message in context:
>>>> 
>>>> http://apache-flex-development.2333347.n4.nabble.com/superGetter-very-ve
>>>> ry
>>>> -slow-tp52574.html
>>>> Sent from the Apache Flex Development mailing list archive at
>>>> Nabble.com.
>>> 
>> 
> 

Reply via email to