You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Pan Li <Pa...@Prominic.NET> on 2016/10/10 04:25:21 UTC
[FlexJS]variable's default access control is not complied correctly in
javascript mode
Actionscript document defines that internal (default) variable means: (the
variable is )Visible to references inside the same package.
But it doesn't compile correctly in FlexJS javascript mode in 0.7 and 0.6,
it does build but the created javascript is broken:
here is one simple class to reproduce the probelm:
package
{
public class SomeClass
{
var field:String = "hello";
public function doSomething():String
{
return field;
}
}
}
the code runs perfectly in Flex and runs perfectly in FlexJS awf mode, but
in javascript mode the created javascript looks like:
/**
* @export
* @type {string}
*/
SomeClass.prototype.field = "hello";
/**
* @export
* @return {string}
*/
SomeClass.prototype.doSomething = function() {
return field;
};
above code fails in javascript
If I use private or any other access control keyword:
package
{
public class SomeClass
{
private var field:String = "hello";
public function doSomething():String
{
return field;
}
}
}
the produced javascript is:
/**
* @private
* @type {string}
*/
SomeClass.prototype.field = "hello";
/**
* @export
* @return {string}
*/
SomeClass.prototype.doSomething = function() {
return this.field;
};
We had lots of existing Flex code which will be migrated to FlexJS, the
default access control is used everywhere. If FlexJS changes syntax of
actionscript, then there should be a document listing the difference, if
syntax is not changed, then this is a bug needs to be fixed
Thank you
Pan Li
My Apache Flex community contribution is working on the open source
Moonshine-IDE.com for FlexJS.
Re: [FlexJS]variable's default access control is not complied
correctly in javascript mode
Posted by OK <po...@olafkrueger.net>.
Alex Harui wrote
> IMO, it is a bug if you have to add a 'this' that isn't required in
> ActionScript. I think I fixed this particular scenario. Let us know what
> else you f ind.
Yes you're right it should classified as a bug but I've not take the time
to figure out in which cases it happens and to build a simplified test case.
Probably it's better to immedeately create a JIRA in future instead of
collecting these kind of issues by myself until I find time to track it ;-)
Thanks,
Olaf
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-variable-s-default-access-control-is-not-complied-correctly-in-javascript-mode-tp55683p55691.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS]variable's default access control is not complied
correctly in javascript mode
Posted by Alex Harui <ah...@adobe.com>.
On 10/10/16, 12:18 PM, "OK" <po...@olafkrueger.net> wrote:
>
>While working with FlexJS I've noticed that sometimes it seems to be
>crucial
>to use the "this" keyword:
>E.g.; return this.field;
>But I'm not sure if I remember it correctly...
IMO, it is a bug if you have to add a 'this' that isn't required in
ActionScript. I think I fixed this particular scenario. Let us know what
else you f ind.
Thanks,
Alex
Re: [FlexJS]variable's default access control is not complied
correctly in javascript mode
Posted by OK <po...@olafkrueger.net>.
pan Li wrote
> package
> {
> public class SomeClass
> {
> var field:String = "hello";
> public function doSomething():String
> {
> return field;
> }
> }
> }
While working with FlexJS I've noticed that sometimes it seems to be crucial
to use the "this" keyword:
E.g.; return this.field;
But I'm not sure if I remember it correctly...
Maybe this helps,
Olaf
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-variable-s-default-access-control-is-not-complied-correctly-in-javascript-mode-tp55683p55688.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS]variable's default access control is not complied
correctly in javascript mode
Posted by Alex Harui <ah...@adobe.com>.
I'll look into it. We haven't done much work with package internal.
-Alex
On 10/9/16, 9:25 PM, "Pan Li" <Pa...@Prominic.NET> wrote:
>
>
>Actionscript document defines that internal (default) variable means: (the
>variable is )Visible to references inside the same package.
>
>But it doesn't compile correctly in FlexJS javascript mode in 0.7 and 0.6,
>it does build but the created javascript is broken:
>here is one simple class to reproduce the probelm:
>package
>{
> public class SomeClass
> {
> var field:String = "hello";
> public function doSomething():String
> {
> return field;
> }
> }
>}
>
>the code runs perfectly in Flex and runs perfectly in FlexJS awf mode, but
>in javascript mode the created javascript looks like:
>
>/**
> * @export
> * @type {string}
> */
>SomeClass.prototype.field = "hello";
>
>
>/**
> * @export
> * @return {string}
> */
>SomeClass.prototype.doSomething = function() {
> return field;
>};
>above code fails in javascript
>
>
>If I use private or any other access control keyword:
>package
>{
> public class SomeClass
> {
> private var field:String = "hello";
> public function doSomething():String
> {
> return field;
> }
> }
>}
>
>the produced javascript is:
>
>/**
> * @private
> * @type {string}
> */
>SomeClass.prototype.field = "hello";
>
>
>/**
> * @export
> * @return {string}
> */
>SomeClass.prototype.doSomething = function() {
> return this.field;
>};
>
>
>
>We had lots of existing Flex code which will be migrated to FlexJS, the
>default access control is used everywhere. If FlexJS changes syntax of
>actionscript, then there should be a document listing the difference, if
>syntax is not changed, then this is a bug needs to be fixed
>
>
>Thank you
>Pan Li
>My Apache Flex community contribution is working on the open source
>Moonshine-IDE.com for FlexJS.