flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Dufilie (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLEX-34991) Problem with setter/getter in .as file with multiple classes
Date Fri, 11 Dec 2015 21:28:47 GMT
Andy Dufilie created FLEX-34991:
-----------------------------------

             Summary: Problem with setter/getter in .as file with multiple classes
                 Key: FLEX-34991
                 URL: https://issues.apache.org/jira/browse/FLEX-34991
             Project: Apache Flex
          Issue Type: Bug
          Components: Falcon, FlexJS
    Affects Versions: Apache FlexJS 0.5.0
            Reporter: Andy Dufilie
            Priority: Minor


Internal classes local to another class (defined outside the package definition) get cross-compiled
incorrectly when there are setter/getters in the main class. Notice in the example below that
the PublicClass setter/getter are included in the InternalClass prototype at the bottom.

AS input:
{code}
package foo.bar {
	public class PublicClass {
		public function get publicVar():String {
			return _publicVar;
		}
		public function set publicVar(value:String):void {
			_publicVar = value;
		}
		
		private var _publicVar:String = "from public class";
	}
}

internal class InternalClass {
	public function get internalVar():String {
		return _internalVar;
	}
	public function set internalVar(value:String):void {
		_internalVar = value;
	}
	
	private var _internalVar:String = "from internal class";
}
{code}

Incorrect JS output:
{code}
/**
 * Generated by Apache Flex Cross-Compiler from foo\bar\PublicClass.as
 * foo.bar.PublicClass
 *
 * @fileoverview
 *
 * @suppress {checkTypes}
 */

goog.provide('foo.bar.PublicClass');



/**
 * @constructor
 */
foo.bar.PublicClass = function() {
};


/**
 * @private
 * @type {string}
 */
foo.bar.PublicClass.prototype._publicVar = "from public class";


Object.defineProperties(foo.bar.PublicClass.prototype, /** @lends {foo.bar.PublicClass.prototype}
*/ {
/** @export */
publicVar: {
get: /** @this {foo.bar.PublicClass} */ function() {
  return this._publicVar;
},
set: /** @this {foo.bar.PublicClass} */ function(value) {
  this._publicVar = value;
}}}
);


/**
 * Metadata
 *
 * @type {Object.<string, Array.<Object>>}
 */
foo.bar.PublicClass.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'PublicClass', qName:
'foo.bar.PublicClass'}] };



/**
 * @constructor
 */
InternalClass = function() {
};


/**
 * @private
 * @type {string}
 */
InternalClass.prototype._internalVar = "from internal class";


Object.defineProperties(InternalClass.prototype, /** @lends {InternalClass.prototype} */ {
/** @export */
publicVar: {
get: /** @this {InternalClass} */ function() {
  return this._publicVar;
},
set: /** @this {InternalClass} */ function(value) {
  this._publicVar = value;
}},
/** @export */
internalVar: {
get: /** @this {InternalClass} */ function() {
  return this._internalVar;
},
set: /** @this {InternalClass} */ function(value) {
  this._internalVar = value;
}}}
);
{code}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message