You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Harbs <ha...@gmail.com> on 2017/08/26 18:41:58 UTC

FlexJS Issue with multiple assignment

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

Re: FlexJS Issue with multiple assignment

Posted by Harbs <ha...@gmail.com>.
Done. Thanks for the suggestion.

> On Aug 27, 2017, at 10:33 AM, Harbs <ha...@gmail.com> wrote:
> 
> Yes. We added it. I suppose we can return the parameter.
> 
>> On Aug 27, 2017, at 8:18 AM, Alex Harui <ah...@adobe.com.INVALID> 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" <ha...@gmail.com> 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
>> 
> 


Re: FlexJS Issue with multiple assignment

Posted by Harbs <ha...@gmail.com>.
Yes. We added it. I suppose we can return the parameter.

> On Aug 27, 2017, at 8:18 AM, Alex Harui <ah...@adobe.com.INVALID> 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" <ha...@gmail.com> 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
> 


Re: FlexJS Issue with multiple assignment

Posted by Alex Harui <ah...@adobe.com.INVALID>.
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" <ha...@gmail.com> 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