Re: XML.conversion

2022-07-04 Thread Greg Dove
I have most of it working: public function testEmptyListCoercion():void{ var node:XML = 2; var list:XMLList = node.@name; var str:String = list; assertTrue(str == ''); str = 'test'+list; assertTrue(str == 'test');

Re: Apache Royale: Emulated Components (Other components are missing)

2022-07-04 Thread Edward Stangler
There's mx.dummy.ContextMenuItem: frameworks/projects/MXRoyale/src/main/royale/mx/dummy/ContextMenuItem.as Which others are you looking for? If you're on Windows, you can find things like this: dir /s/b ContextMenuItem.as findstr /s /m /c:"class ContextMenuItem" *.as On 7/4/2022

Re: XML.conversion

2022-07-04 Thread Greg Dove
I will look into it today. Unfortunately the instance level 'plus' method is not suitable for the general case, because an XMLList reference can also be null which would cause an error in the generated js code that would not be present in AVM, although this is an edge case. But it does mean that

Re: XML.conversion

2022-07-04 Thread Harbs
It looks like BinaryOperatorEmitter is supposed to be emitting .plus(), but it doesn’t seem to be doing so… Harbs > On Jul 4, 2022, at 6:32 PM, Harbs wrote: > > The logic should be something like this in pseudocode: > > if(isPlus && (isXMLish(righthand) || isXMLish(leftHand){ > if(isXM

Re: XML.conversion

2022-07-04 Thread Harbs
The logic should be something like this in pseudocode: if(isPlus && (isXMLish(righthand) || isXMLish(leftHand){ if(isXM On Jul 4, 2022, at 6:25 PM, Harbs wrote: > > I think the compiler should be using the “plus” XML method for string > concatenation of XML. > >> On Jul 4, 2022, at 5:36 PM,

Re: XML.conversion

2022-07-04 Thread Harbs
I think the compiler should be using the “plus” XML method for string concatenation of XML. > On Jul 4, 2022, at 5:36 PM, Greg Dove wrote: > > (it does equal undefined), but it > seems it does concatenate as an empty string.

Re: XML.conversion

2022-07-04 Thread Harbs
That also depends on the targetObject and targetProperty values. It’s only undefined if there’s no targetObject OR there IS a targetProperty. > On Jul 4, 2022, at 5:36 PM, Greg Dove wrote: > > An empty > XMLList does not equal an empty string (it does equal undefined)

Re: XML.conversion

2022-07-04 Thread Greg Dove
Yes the first one of those is the reason that it is tricky. An empty XMLList does not equal an empty string (it does equal undefined), but it seems it does concatenate as an empty string. I will look at this tomorrow, we do have some client code that relies on the undefined equality behavior and

Re: XML.conversion

2022-07-04 Thread Harbs
The spec says that valueOf is supposed to return the XML object, so maybe comparison uses valueOf, but string concatenation then uses toString()? > On Jul 4, 2022, at 5:24 PM, Harbs wrote: > > OK. Here’s something to look at: > >xml = ; >var props:XMLList =

Re: XML.conversion

2022-07-04 Thread Harbs
OK. Here’s something to look at: xml = ; var props:XMLList = xml.Properties; var bar:XMLList = xml.Bar; This assert fails in Flash assertEquals(bar , "","bar should evaluate to an empty string”); with:

Re: XML.conversion

2022-07-04 Thread Harbs
But that case seems to fail in Flash, so it’s likely correct... > On Jul 4, 2022, at 5:14 PM, Harbs wrote: > > My test case covered what I found (assertEquals("" + xml.Baz.text(), "","An > empty node should return an empty string”);) > > Here’s another case which I did not retest after my

Apache Royale: Emulated Components (Other components are missing)

2022-07-04 Thread Leila Asadi
I can't seem to find ContextMenuItem and others in the Flex code. What do I do?

Re: XML.conversion

2022-07-04 Thread Harbs
My test case covered what I found (assertEquals("" + xml.Baz.text(), "","An empty node should return an empty string”);) Here’s another case which I did not retest after my changes: var xml = ; var props:XMLList = xml.Properties; trace(props.length())// 1 var bar:XMLList = xml.Bar; if(bar &&

Re: XML.conversion

2022-07-04 Thread Greg Dove
Thanks Harbs. By coincidence, I was actually intending to work on exactly the same thing tomorrow local time, because Yishay encountered something similar and I also wanted to create a failing test to fix. It's definitely a bit tricky. iirc it was something like this: var list:XMLList; list ==

Re: XML.conversion

2022-07-04 Thread Harbs
I just made a commit which should do the right thing vis a vis both undefined and empty strings. I added a test for the additional case and all existing tests still pass... > On Jul 4, 2022, at 2:28 PM, Harbs wrote: > > It’s because valueOf of XMLList was changed. > > For reference, this

Re: XML.conversion

2022-07-04 Thread Harbs
It’s because valueOf of XMLList was changed. For reference, this passed in Flash and fails in JS: public function emptyStringify():void{ var xml:XML = ; assertEquals("" + xml.Baz.text(), "","An empty node should return an empty string"); } > On Jul 4,

Re: XML.conversion

2022-07-04 Thread Harbs
There’s more xml problems. Coercing empty xml to a string used to result in an empty string. It now results in “undefined”. i.e. var xml:XML = ; '' + xml.Baz.text() I believe we used to get “”, and now we get “undefined”. > On Jun 27, 2022, at 6:44 AM, Greg Dove wrote: > > Sorry about