You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Hugo Ferreira <hf...@gmail.com> on 2020/09/15 22:20:04 UTC

Royale compiler does not work with super

Example 1, using super to use the base base variable

public class MyBaseClass
{
    protected var myProtectedVar:String;
}

public class MyExtendedClass
{
    public function MyExtendedClass
    {
        super.myProtecedVar = "Hello World"; // this will throw an JS error
at runtime
    }
}

Example 2, using super at an event

call a remote AMF service to a resultHandler event:

private function resultHandler(event:ResultEvent):void
{
    super.entities = event.data as ArrayList; // this will throw an
internal JS error that will stop the result event and fire the AMF fault
event
}

Re: Royale compiler does not work with super

Posted by Hugo Ferreira <hf...@gmail.com>.
Yes, it's not a blocker issue.
I can avoid using super.

Meanwhile, I filled a bug on github.

Greg Dove <gr...@gmail.com> escreveu no dia terça, 15/09/2020 à(s)
23:29:

> That looks like it probably needs a compiler fix.
> But it also seems avoidable for now.
> Because they are vars and not methods or accessors that are overridden,
> can't you just avoid using super?
>
>
>
> On Wed, Sep 16, 2020 at 10:20 AM Hugo Ferreira <hf...@gmail.com>
> wrote:
>
> > Example 1, using super to use the base base variable
> >
> > public class MyBaseClass
> > {
> >     protected var myProtectedVar:String;
> > }
> >
> > public class MyExtendedClass
> > {
> >     public function MyExtendedClass
> >     {
> >         super.myProtecedVar = "Hello World"; // this will throw an JS
> error
> > at runtime
> >     }
> > }
> >
> > Example 2, using super at an event
> >
> > call a remote AMF service to a resultHandler event:
> >
> > private function resultHandler(event:ResultEvent):void
> > {
> >     super.entities = event.data as ArrayList; // this will throw an
> > internal JS error that will stop the result event and fire the AMF fault
> > event
> > }
> >
>

Re: Royale compiler does not work with super

Posted by Greg Dove <gr...@gmail.com>.
That looks like it probably needs a compiler fix.
But it also seems avoidable for now.
Because they are vars and not methods or accessors that are overridden,
can't you just avoid using super?



On Wed, Sep 16, 2020 at 10:20 AM Hugo Ferreira <hf...@gmail.com>
wrote:

> Example 1, using super to use the base base variable
>
> public class MyBaseClass
> {
>     protected var myProtectedVar:String;
> }
>
> public class MyExtendedClass
> {
>     public function MyExtendedClass
>     {
>         super.myProtecedVar = "Hello World"; // this will throw an JS error
> at runtime
>     }
> }
>
> Example 2, using super at an event
>
> call a remote AMF service to a resultHandler event:
>
> private function resultHandler(event:ResultEvent):void
> {
>     super.entities = event.data as ArrayList; // this will throw an
> internal JS error that will stop the result event and fire the AMF fault
> event
> }
>