Hmmm... odd. However, I'm not sure that it's actually treated differently
from other warnings.

If I create a variable without a type, like this:

var zzz;

I also see the warning at the end, after the success message, like this:

The project 'RoyaleClosureThisWarning' has been successfully compiled.
RoyaleClosureThisWarning.as(26): col: 8 Warning: variable 'zzz' has no type
declaration.

I can see that MXMLJSCRoyale doesn't print the error/warnings until after
the MXMLRoyalePublisher.publish() returns, and that's where the success
message is printed. It seems like maybe MXMLRoyalePublisher shouldn't be
printing that success message, and it should let something further up the
chain report success or failure.

--
Josh Tynjala
Bowler Hat LLC <https://bowlerhat.dev>


On Mon, Dec 9, 2019 at 2:28 AM Harbs <[email protected]> wrote:

> Why does this warning show up at the very end of the console output
> (different than all other errors and warnings)?
>
> > On Dec 4, 2019, at 1:29 AM, Josh Tynjala <[email protected]>
> wrote:
> >
> > It's not possible at this time.
> >
> > Java has an annotation for suppressing warnings locally:
> >
> > @SuppressWarnings({"unchecked", "deprecated"})
> >
> > More info: https://www.baeldung.com/java-suppresswarnings
> >
> > It might be interesting to allow something similar in AS3:
> >
> > [SuppressWarnings(this-within-closure,assignment-within-conditional)]
> >
> > I'm not sure if dashes are allowed in AS3 metadata attributes, but
> > basically, the idea is to have the attribute names match the existing
> > compiler options for each type of warning that can be suppressed.
> >
> > --
> > Josh Tynjala
> > Bowler Hat LLC <https://bowlerhat.dev>
> >
> >
> > On Tue, Dec 3, 2019 at 10:09 AM Harbs <[email protected]> wrote:
> >
> >> What about locally?
> >>
> >>> On Dec 3, 2019, at 7:39 PM, Josh Tynjala <[email protected]>
> >> wrote:
> >>>
> >>> You can turn it off with the following compiler option:
> >>> -warn-this-within-closure=false
> >>>
> >>> --
> >>> Josh Tynjala
> >>> Bowler Hat LLC <https://bowlerhat.dev>
> >>>
> >>>
> >>> On Tue, Dec 3, 2019 at 9:36 AM Harbs <[email protected]> wrote:
> >>>
> >>>> I recently started getting some of these warnings:
> >>>>
> >>>> Warning: Encountered this keyword within closure. Value of this will
> not
> >>>> be the same as enclosing scope.
> >>>>
> >>>> I understand the desire to have this warning, but I think it either
> >> needs
> >>>> to be smarter or be easily turned off.
> >>>>
> >>>> I have a case where I have Object.defineProperty which takes a
> function
> >>>> that needs to refer to “this”. That’s a valid use of this within a
> >>>> “closure”, and I can’t find an easy way of turning the warning off for
> >> that
> >>>> use case.
> >>>>
> >>>> Harbs
> >>
> >>
>
>

Reply via email to