flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pan Li <Pa...@Prominic.NET>
Subject [FlexJS]variable's default access control is not complied correctly in javascript mode
Date Mon, 10 Oct 2016 04:25:21 GMT


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.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message