Skip to content

ArrayCollection - comparison of item to null emits setProperty() #139

@yishayw

Description

@yishayw

Test case:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:mx="library://ns.apache.org/royale/mx"
		   applicationComplete="init()"
                   width="600" height="400" >

			<fx:Script>
				<![CDATA[
					import mx.collections.ArrayCollection;

					private function init():void
					{
						var myDp:ArrayCollection = new ArrayCollection();
						myDp.addItem("hello1");
						if (myDp[0] != null) // bad line
						{
							trace("ok...")
						} else
						{
							trace("not ok")
						}
					}

				]]>
			</fx:Script>
</mx:Application>

The line commented with //bad transpiles to:

if (myDp.setProperty(0, null)) {

which yields a 'not ok' result.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions