FlexJS Issue with multiple assignment

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

FlexJS Issue with multiple assignment

Harbs
I just ran into the following issue:

I have some code which looks like this:
ID = _rawStoryXML.@Self = UIDUtil.createUID();

It gets cross-compiled in JS to this:
this.ID = org.apache.flex.utils.Language.string(this._rawStoryXML.setAttribute('Self', org.apache.flex.utils.UIDUtil.createUID()));

The problem is that both ID and _rawStoryXML.@Self should both be assigned the result of UIDUtil.createUID().

Instead, ID is being assigned the result of this._rawStoryXML.setAttribute('Self', org.apache.flex.utils.UIDUtil.createUID()) which happens to be null.

I’m not sure how to fix this issue. Maybe it’s necessary to assign a temporary variable and then assign both values separately:

var tempVal = org.apache.flex.utils.UIDUtil.createUID();
this._rawStoryXML.setAttribute('Self', tempVal);
this.ID = tempVal;

(or something like that)

Harbs
Reply | Threaded
Open this post in threaded view
|

Re: FlexJS Issue with multiple assignment

after24
Bonjour,

En congés jusqu'au 4 septembre, je prendrais connaissance de votre message à mon retour.

Cordialement,

Vincent/AFTER24



Reply | Threaded
Open this post in threaded view
|

Re: FlexJS Issue with multiple assignment

Alex Harui-2
In reply to this post by Harbs
setAttribute is not showing up in the spec for me.  Is it one of the
methods internal to the implementation?  If so, can it return the value it
receives instead of null?

-Alex

On 8/26/17, 11:41 AM, "Harbs" <[hidden email]> wrote:

>I just ran into the following issue:
>
>I have some code which looks like this:
>ID = _rawStoryXML.@Self = UIDUtil.createUID();
>
>It gets cross-compiled in JS to this:
>this.ID =
>org.apache.flex.utils.Language.string(this._rawStoryXML.setAttribute('Self
>', org.apache.flex.utils.UIDUtil.createUID()));
>
>The problem is that both ID and _rawStoryXML.@Self should both be
>assigned the result of UIDUtil.createUID().
>
>Instead, ID is being assigned the result of
>this._rawStoryXML.setAttribute('Self',
>org.apache.flex.utils.UIDUtil.createUID()) which happens to be null.
>
>I’m not sure how to fix this issue. Maybe it’s necessary to assign a
>temporary variable and then assign both values separately:
>
>var tempVal = org.apache.flex.utils.UIDUtil.createUID();
>this._rawStoryXML.setAttribute('Self', tempVal);
>this.ID = tempVal;
>
>(or something like that)
>
>Harbs

Reply | Threaded
Open this post in threaded view
|

Re: FlexJS Issue with multiple assignment

Harbs
Yes. We added it. I suppose we can return the parameter.

> On Aug 27, 2017, at 8:18 AM, Alex Harui <[hidden email]> wrote:
>
> setAttribute is not showing up in the spec for me.  Is it one of the
> methods internal to the implementation?  If so, can it return the value it
> receives instead of null?
>
> -Alex
>
> On 8/26/17, 11:41 AM, "Harbs" <[hidden email]> wrote:
>
>> I just ran into the following issue:
>>
>> I have some code which looks like this:
>> ID = _rawStoryXML.@Self = UIDUtil.createUID();
>>
>> It gets cross-compiled in JS to this:
>> this.ID =
>> org.apache.flex.utils.Language.string(this._rawStoryXML.setAttribute('Self
>> ', org.apache.flex.utils.UIDUtil.createUID()));
>>
>> The problem is that both ID and _rawStoryXML.@Self should both be
>> assigned the result of UIDUtil.createUID().
>>
>> Instead, ID is being assigned the result of
>> this._rawStoryXML.setAttribute('Self',
>> org.apache.flex.utils.UIDUtil.createUID()) which happens to be null.
>>
>> I’m not sure how to fix this issue. Maybe it’s necessary to assign a
>> temporary variable and then assign both values separately:
>>
>> var tempVal = org.apache.flex.utils.UIDUtil.createUID();
>> this._rawStoryXML.setAttribute('Self', tempVal);
>> this.ID = tempVal;
>>
>> (or something like that)
>>
>> Harbs
>

Reply | Threaded
Open this post in threaded view
|

Re: FlexJS Issue with multiple assignment

Harbs
Done. Thanks for the suggestion.

> On Aug 27, 2017, at 10:33 AM, Harbs <[hidden email]> wrote:
>
> Yes. We added it. I suppose we can return the parameter.
>
>> On Aug 27, 2017, at 8:18 AM, Alex Harui <[hidden email]> wrote:
>>
>> setAttribute is not showing up in the spec for me.  Is it one of the
>> methods internal to the implementation?  If so, can it return the value it
>> receives instead of null?
>>
>> -Alex
>>
>> On 8/26/17, 11:41 AM, "Harbs" <[hidden email]> wrote:
>>
>>> I just ran into the following issue:
>>>
>>> I have some code which looks like this:
>>> ID = _rawStoryXML.@Self = UIDUtil.createUID();
>>>
>>> It gets cross-compiled in JS to this:
>>> this.ID =
>>> org.apache.flex.utils.Language.string(this._rawStoryXML.setAttribute('Self
>>> ', org.apache.flex.utils.UIDUtil.createUID()));
>>>
>>> The problem is that both ID and _rawStoryXML.@Self should both be
>>> assigned the result of UIDUtil.createUID().
>>>
>>> Instead, ID is being assigned the result of
>>> this._rawStoryXML.setAttribute('Self',
>>> org.apache.flex.utils.UIDUtil.createUID()) which happens to be null.
>>>
>>> I’m not sure how to fix this issue. Maybe it’s necessary to assign a
>>> temporary variable and then assign both values separately:
>>>
>>> var tempVal = org.apache.flex.utils.UIDUtil.createUID();
>>> this._rawStoryXML.setAttribute('Self', tempVal);
>>> this.ID = tempVal;
>>>
>>> (or something like that)
>>>
>>> Harbs
>>
>