I just found another bug which is likely related:

The following AS:
delete range.children()[j];

Compiles (incorrectly) to the following JS:
delete range.children()[j];

While:
var childrenList:XMLList = range.children();
delete childrenList[j];

compiles (correctly) to:
var /** @type {XMLList} */ childrenList = range.children();
childrenList.removeChild(j);

It seems like XML.children() cannot be correctly inferred by the compiler as an 
XMLList type.

Harbs

> On Dec 17, 2017, at 11:17 AM, Harbs <[email protected]> wrote:
> 
> The following code:
> var range:XML;
> // etc.
> var childLen:int = range.children().length();
> 
> compiles to:
> var /** @type {XML} */ range;
> // etc.
> var /** @type {number} */ childLen = Number(range.children().length());
> 
> I don’t see why the Number() cast is being added both childLen and 
> children().length() are typed as ints.
> 
> Am I correct in assuming that this is a bug?
> 
> Harbs

Reply via email to