You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Alex Harui (JIRA)" <ji...@apache.org> on 2015/12/23 07:04:46 UTC
[jira] [Assigned] (FLEX-34991) Problem with setter/getter in .as
file with multiple classes
[ https://issues.apache.org/jira/browse/FLEX-34991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alex Harui reassigned FLEX-34991:
---------------------------------
Assignee: Alex Harui
> 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
> Assignee: Alex Harui
> 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)