This is an automated email from the ASF dual-hosted git repository. joshtynjala pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit c6672a1b00cb0f46a2ab18aea6e98d6d66658ea2 Author: Josh Tynjala <[email protected]> AuthorDate: Mon Nov 20 09:26:39 2023 -0800 Migrate all goog royale dependent tests to jsroyale --- .../resources/royale/files/call-super_result.js | 23 ++-- .../test/resources/royale/files/custom/Button.as | 34 ++++++ .../test/resources/royale/files/custom/Group.as | 32 ++++++ .../test/resources/royale/files/custom/Label.as | 34 ++++++ .../resources/royale/files/custom/MouseEvent.as | 36 +++++++ .../resources/royale/files/custom/TestEvent.as | 36 +++++++ .../royale/files/custom/TestGlobalFunction.as | 26 +++++ .../royale/files/custom/TestImplementation.as | 66 ++++++++++++ .../resources/royale/files/custom/TestInstance.as | 61 +++++++++++ .../resources/royale/files/custom/TestInterface.as | 34 ++++++ .../royale/files/custom/TestOtherInterface.as | 34 ++++++ .../resources/royale/files/custom/TestProxy.as | 34 ++++++ .../test/resources/royale/files/get-set_result.js | 50 ++++++--- .../src/test/resources/royale/files/output.js | 27 +++-- .../src/test/resources/royale/files/poc_result.js | 119 +++++++++++++-------- .../royale/files/qualify-new-object_result.js | 43 +++++--- 16 files changed, 598 insertions(+), 91 deletions(-) diff --git a/compiler-jx/src/test/resources/royale/files/call-super_result.js b/compiler-jx/src/test/resources/royale/files/call-super_result.js index c0bd57134..2062dc749 100644 --- a/compiler-jx/src/test/resources/royale/files/call-super_result.js +++ b/compiler-jx/src/test/resources/royale/files/call-super_result.js @@ -11,10 +11,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/** + * org.apache.royale.A + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + goog.provide('org.apache.royale.A'); -goog.require('custom.TestInterface'); goog.require('custom.TestImplementation'); +goog.require('custom.TestInterface'); + + /** * @constructor @@ -23,19 +33,18 @@ goog.require('custom.TestImplementation'); * @param {string} z */ org.apache.royale.A = function(z) { - var self = this; - org.apache.royale.A.base(this, 'constructor', z); + org.apache.royale.A.base(this, 'constructor', z); }; goog.inherits(org.apache.royale.A, custom.TestImplementation); + /** * @param {string} a * @param {number} b * @return {string} */ org.apache.royale.A.prototype.hasSuperCall = function(a, b) { - var self = this; - org.apache.royale.A.base(this, 'hasSuperCall', a, b, 100); - var /** @type {string} */ result = myRegularFunctionCall(-1); - return result; + org.apache.royale.A.superClass_.hasSuperCall.apply(this, [a, b, 100]); + var /** @type {string} */ result = org.apache.royale.utils.Language.string(myRegularFunctionCall(-1)); + return result; }; diff --git a/compiler-jx/src/test/resources/royale/files/custom/Button.as b/compiler-jx/src/test/resources/royale/files/custom/Button.as new file mode 100644 index 000000000..5a7aee229 --- /dev/null +++ b/compiler-jx/src/test/resources/royale/files/custom/Button.as @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package custom { + +[DefaultProperty("label")] + +/** + * @constructor + */ +public class Button extends TestInstance { + + /** + */ + public function Button() { + } + +} +} diff --git a/compiler-jx/src/test/resources/royale/files/custom/Group.as b/compiler-jx/src/test/resources/royale/files/custom/Group.as new file mode 100644 index 000000000..5503766e1 --- /dev/null +++ b/compiler-jx/src/test/resources/royale/files/custom/Group.as @@ -0,0 +1,32 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package custom { + +/** + * @constructor + */ +public class Group extends TestInstance { + + /** + */ + public function Group() { + } + +} +} diff --git a/compiler-jx/src/test/resources/royale/files/custom/Label.as b/compiler-jx/src/test/resources/royale/files/custom/Label.as new file mode 100644 index 000000000..c7596d308 --- /dev/null +++ b/compiler-jx/src/test/resources/royale/files/custom/Label.as @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package custom { + +[DefaultProperty("text")] + +/** + * @constructor + */ +public class Label extends TestInstance { + + /** + */ + public function Label() { + } + +} +} diff --git a/compiler-jx/src/test/resources/royale/files/custom/MouseEvent.as b/compiler-jx/src/test/resources/royale/files/custom/MouseEvent.as new file mode 100644 index 000000000..e937ba07d --- /dev/null +++ b/compiler-jx/src/test/resources/royale/files/custom/MouseEvent.as @@ -0,0 +1,36 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package custom { + +/** + * @constructor + */ +public class MouseEvent { + + /** + */ + public function MouseEvent() { + } + + public var localX:Number; + + public var localY:Number; + +} +} diff --git a/compiler-jx/src/test/resources/royale/files/custom/TestEvent.as b/compiler-jx/src/test/resources/royale/files/custom/TestEvent.as new file mode 100644 index 000000000..86480ef4a --- /dev/null +++ b/compiler-jx/src/test/resources/royale/files/custom/TestEvent.as @@ -0,0 +1,36 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package custom { + +/** + * @constructor + */ +public class TestEvent { + + /** + */ + public function TestEvent() { + } + + public var name:String; + + public var value:Number; + +} +} diff --git a/compiler-jx/src/test/resources/royale/files/custom/TestGlobalFunction.as b/compiler-jx/src/test/resources/royale/files/custom/TestGlobalFunction.as new file mode 100644 index 000000000..2f5558f11 --- /dev/null +++ b/compiler-jx/src/test/resources/royale/files/custom/TestGlobalFunction.as @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package custom { + +/** + * @constructor + */ +public function TestGlobalFunction():void { +} +} diff --git a/compiler-jx/src/test/resources/royale/files/custom/TestImplementation.as b/compiler-jx/src/test/resources/royale/files/custom/TestImplementation.as new file mode 100644 index 000000000..7cf7f5412 --- /dev/null +++ b/compiler-jx/src/test/resources/royale/files/custom/TestImplementation.as @@ -0,0 +1,66 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package custom { + +/** + * @constructor + */ +public class TestImplementation implements TestInterface { + + private var _name:String; + + public function get name():String + { + return _name; + } + + public function set name(value:String):void + { + _name = value; + } + + private var _value:String; + + public function get value():String + { + return _value; + } + + public function set value(value:String):void + { + _value = value; + } + + public function someFunction():void + { + } + + public function addEventListener(event:TestEvent):void + { + } + + public function removeEventListener(event:TestEvent):void + { + } + + public function dispatchEvent(event:TestEvent):void + { + } +} +} diff --git a/compiler-jx/src/test/resources/royale/files/custom/TestInstance.as b/compiler-jx/src/test/resources/royale/files/custom/TestInstance.as new file mode 100644 index 000000000..3c7c294c5 --- /dev/null +++ b/compiler-jx/src/test/resources/royale/files/custom/TestInstance.as @@ -0,0 +1,61 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package custom { + +[Event(name="complete", type="custom.TestEvent")] + +[DefaultProperty("mxmlContent")] + +/** + * @constructor + */ +public class TestInstance { + + /** + */ + public function TestInstance() { + } + + public var name:String; + + public var value:Number; + + public var label:String; + + public var text:String; + + public var id:String; + + public var color:uint; + + public var visible:Boolean; + + public var minWidth:Number; + public var minHeight:Number; + public var x:Number; + public var y:Number; + public var height:Number; + public var width:Number; + + public var mxmlContent:Array; + + public function someFunction():void { + } +} +} diff --git a/compiler-jx/src/test/resources/royale/files/custom/TestInterface.as b/compiler-jx/src/test/resources/royale/files/custom/TestInterface.as new file mode 100644 index 000000000..cd5217787 --- /dev/null +++ b/compiler-jx/src/test/resources/royale/files/custom/TestInterface.as @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package custom { + +/** + * @constructor + */ +public interface TestInterface { + + function get name():String; + function set name(value:String):void; + + function get value():String; + function set value(value:String):void; + + function someFunction():void; +} +} diff --git a/compiler-jx/src/test/resources/royale/files/custom/TestOtherInterface.as b/compiler-jx/src/test/resources/royale/files/custom/TestOtherInterface.as new file mode 100644 index 000000000..747211a48 --- /dev/null +++ b/compiler-jx/src/test/resources/royale/files/custom/TestOtherInterface.as @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package custom { + +/** + * @constructor + */ +public interface TestOtherInterface { + + function get name():String; + function set name(value:String):void; + + function get value():String; + function set value(value:String):void; + + function someFunction():void; +} +} diff --git a/compiler-jx/src/test/resources/royale/files/custom/TestProxy.as b/compiler-jx/src/test/resources/royale/files/custom/TestProxy.as new file mode 100644 index 000000000..9ff076631 --- /dev/null +++ b/compiler-jx/src/test/resources/royale/files/custom/TestProxy.as @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package custom { + +/** + * @constructor + */ +public class TestProxy { + + custom_namespace function getProperty(name:String):* + { + } + + custom_namespace function setProperty(name:String, value:*):void + { + } +} +} diff --git a/compiler-jx/src/test/resources/royale/files/get-set_result.js b/compiler-jx/src/test/resources/royale/files/get-set_result.js index 89d94aadc..e0f005d24 100644 --- a/compiler-jx/src/test/resources/royale/files/get-set_result.js +++ b/compiler-jx/src/test/resources/royale/files/get-set_result.js @@ -11,39 +11,55 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/** + * org.apache.royale.A + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + goog.provide('org.apache.royale.A'); + + /** * @constructor */ org.apache.royale.A = function() { }; + /** * @private * @type {number} */ org.apache.royale.A.prototype._a = -1; + /** + * @nocollapse + * @export * @type {number} */ org.apache.royale.A.prototype.a; -Object.defineProperty( - org.apache.royale.A.prototype, - 'a', - {get:function() { - var self = this; - return -1; - }, configurable:true} -); - -Object.defineProperty( - org.apache.royale.A.prototype, - 'a', - {set:function(value) { - var self = this; - self._a = value; - }, configurable:true} -); + +org.apache.royale.A.prototype.get__a = function() { + return -1; +}; + + +org.apache.royale.A.prototype.set__a = function(value) { + this._a = value; +}; + + +Object.defineProperties(org.apache.royale.A.prototype, /** @lends {org.apache.royale.A.prototype} */ { +/** + * @type {number} + */ +a: { +get: org.apache.royale.A.prototype.get__a, +set: org.apache.royale.A.prototype.set__a}} +); \ No newline at end of file diff --git a/compiler-jx/src/test/resources/royale/files/output.js b/compiler-jx/src/test/resources/royale/files/output.js index 258a74ffc..23a5255ca 100644 --- a/compiler-jx/src/test/resources/royale/files/output.js +++ b/compiler-jx/src/test/resources/royale/files/output.js @@ -11,10 +11,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/** + * org.apache.royale.A + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + goog.provide('org.apache.royale.A'); -goog.require('custom.TestInterface'); goog.require('custom.TestImplementation'); +goog.require('custom.TestInterface'); + + /** * @constructor @@ -22,26 +32,31 @@ goog.require('custom.TestImplementation'); * @implements {custom.TestInterface} */ org.apache.royale.A = function() { - var self = this; - org.apache.royale.A.base(this, 'constructor'); - self.trace(typeof("a")); + org.apache.royale.A.base(this, 'constructor'); + + this._a = new ArgumentError(); + org.apache.royale.utils.Language.trace(typeof("a")); }; goog.inherits(org.apache.royale.A, custom.TestImplementation); + /** + * @nocollapse * @const * @type {string} */ org.apache.royale.A.MY_CLASS_CONST = "myClassConst"; + /** * @private * @type {ArgumentError} */ -org.apache.royale.A.prototype._a = new ArgumentError(); +org.apache.royale.A.prototype._a = null; + /** * @const * @type {string} */ -org.apache.royale.A.prototype.MY_INSTANCE_CONST = "myInstanceConst"; +org.apache.royale.A.prototype.MY_INSTANCE_CONST = "myInstanceConst"; \ No newline at end of file diff --git a/compiler-jx/src/test/resources/royale/files/poc_result.js b/compiler-jx/src/test/resources/royale/files/poc_result.js index 88796b516..ac8bec115 100644 --- a/compiler-jx/src/test/resources/royale/files/poc_result.js +++ b/compiler-jx/src/test/resources/royale/files/poc_result.js @@ -11,23 +11,33 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/** + * Example + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + goog.provide('Example'); goog.require('custom.MouseEvent'); goog.require('custom.TestEvent'); goog.require('custom.TestImplementation'); + + /** * @constructor * @extends {custom.TestImplementation} */ Example = function() { - var self = this; - Example.base(this, 'constructor'); - self.init(); + Example.base(this, 'constructor'); + this.init(); }; goog.inherits(Example, custom.TestImplementation); + /** * @private * @const @@ -35,6 +45,7 @@ goog.inherits(Example, custom.TestImplementation); */ Example.BYEBYE = "Bye Bye"; + /** * @private * @const @@ -42,112 +53,126 @@ Example.BYEBYE = "Bye Bye"; */ Example.HELLOWORLD = "Hello World"; + /** * @private * @type {number} */ Example.counter = 100; + /** * @private * @type {custom.TestEvent} */ -Example.prototype._btn1; +Example.prototype._btn1 = null; + /** * @private * @type {custom.TestEvent} */ -Example.prototype._btn2; +Example.prototype._btn2 = null; + /** * @private * @type {custom.TestEvent} */ -Example.prototype._btn3; +Example.prototype._btn3 = null; + /** * @private * @type {custom.MouseEvent} */ -Example.prototype._lbl1; +Example.prototype._lbl1 = null; + /** * @private * @type {custom.MouseEvent} */ -Example.prototype._lbl2; +Example.prototype._lbl2 = null; + /** * @private * @type {custom.TestImplementation} */ -Example.prototype._et1; +Example.prototype._et1 = null; + /** * @private * @type {custom.TestImplementation} */ -Example.prototype._et2; +Example.prototype._et2 = null; + /** * @private * @type {custom.TestImplementation} */ -Example.prototype._et3; +Example.prototype._et3 = null; + +/** + */ Example.prototype.init = function() { - var self = this; - self._et1 = new custom.TestImplementation(); - self._et2 = new custom.TestImplementation(); - self._et3 = new custom.TestImplementation(); - self._lbl1 = new custom.MouseEvent(); - self._lbl1.localX = 100; - self._lbl1.localY = 25; - self._lbl1.type = Example.HELLOWORLD; - self.dispatchEvent(self._lbl1); - self._lbl2 = new custom.MouseEvent(); - self._lbl2.localX = 200; - self._lbl2.localY = 25; - self._lbl2.type = Example.counter + ""; - self.dispatchEvent(self._lbl2); - self._btn1 = new custom.TestEvent(); - self._btn1.type = "Click me"; - self._et1.addEventListener(custom.MouseEvent.CLICK, self.btn1clickHandler); - self._et1.dispatchEvent(self._btn1); - self._btn2 = new custom.TestEvent(); - self._btn2.type = "Add it"; - self._et2.addEventListener(custom.MouseEvent.CLICK, self.btn2clickHandler); - self._et2.dispatchEvent(self._btn2); - self._btn3 = new custom.TestEvent(); - self._btn3.type = "Move it"; - self._et3.addEventListener(custom.MouseEvent.CLICK, self.btn3clickHandler); - self._et3.dispatchEvent(self._btn3); + this._et1 = new custom.TestImplementation(); + this._et2 = new custom.TestImplementation(); + this._et3 = new custom.TestImplementation(); + this._lbl1 = new custom.MouseEvent(); + this._lbl1.localX = 100; + this._lbl1.localY = 25; + this._lbl1.type = Example.HELLOWORLD; + this.dispatchEvent(this._lbl1); + this._lbl2 = new custom.MouseEvent(); + this._lbl2.localX = 200; + this._lbl2.localY = 25; + this._lbl2.type = Example.counter + ""; + this.dispatchEvent(this._lbl2); + this._btn1 = new custom.TestEvent(); + this._btn1.type = "Click me"; + this._et1.addEventListener(custom.MouseEvent.CLICK, org.apache.royale.utils.Language.closure(this.btn1clickHandler, this, 'btn1clickHandler')); + this._et1.dispatchEvent(this._btn1); + this._btn2 = new custom.TestEvent(); + this._btn2.type = "Add it"; + this._et2.addEventListener(custom.MouseEvent.CLICK, org.apache.royale.utils.Language.closure(this.btn2clickHandler, this, 'btn2clickHandler')); + this._et2.dispatchEvent(this._btn2); + this._btn3 = new custom.TestEvent(); + this._btn3.type = "Move it"; + this._et3.addEventListener(custom.MouseEvent.CLICK, org.apache.royale.utils.Language.closure(this.btn3clickHandler, this, 'btn3clickHandler')); + this._et3.dispatchEvent(this._btn3); }; + /** + * @protected * @param {custom.MouseEvent} event */ Example.prototype.btn1clickHandler = function(event) { - var self = this; - if (self._lbl1.type == Example.HELLOWORLD) - self._lbl1.type = Example.BYEBYE; - else - self._lbl1.type = Example.HELLOWORLD; + if (this._lbl1.type == Example.HELLOWORLD) + this._lbl1.type = Example.BYEBYE; + else + this._lbl1.type = Example.HELLOWORLD; }; + /** + * @protected * @param {custom.MouseEvent} event */ Example.prototype.btn2clickHandler = function(event) { - var self = this; - self._lbl2.type = --Example.counter + ""; + this._lbl2.type = --Example.counter + ""; }; + /** + * @protected * @param {custom.MouseEvent} event */ Example.prototype.btn3clickHandler = function(event) { - var self = this; - self._lbl2.clientX += 10; -}; + this._lbl2.clientX += 10; +}; \ No newline at end of file diff --git a/compiler-jx/src/test/resources/royale/files/qualify-new-object_result.js b/compiler-jx/src/test/resources/royale/files/qualify-new-object_result.js index aca551d40..e277514ac 100644 --- a/compiler-jx/src/test/resources/royale/files/qualify-new-object_result.js +++ b/compiler-jx/src/test/resources/royale/files/qualify-new-object_result.js @@ -11,38 +11,53 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/** + * org.apache.royale.A + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + goog.provide('org.apache.royale.A'); goog.require('custom.TestImplementation'); + + /** * @constructor * @extends {custom.TestImplementation} */ org.apache.royale.A = function() { - var self = this; - org.apache.royale.A.base(this, 'constructor'); - self.init(); + org.apache.royale.A.base(this, 'constructor'); + this.init(); }; goog.inherits(org.apache.royale.A, custom.TestImplementation); + /** * @private * @type {custom.TestImplementation} */ -org.apache.royale.A.prototype._privateVar; +org.apache.royale.A.prototype._privateVar = null; + +/** + */ org.apache.royale.A.prototype.init = function() { - var self = this; - var /** @type {custom.TestImplementation} */ btn = new custom.TestImplementation(); - self._privateVar = new custom.TestImplementation(); - self.addEventListener("click", function() { - }); + var self = this; + var /** @type {custom.TestImplementation} */ btn = new custom.TestImplementation(); + this._privateVar = new custom.TestImplementation(); + this.addEventListener("click", function() { + }); }; + +/** + */ org.apache.royale.A.prototype.start = function() { - var self = this; - var /** @type {string} */ localVar = self._privateVar.label; - self.init(); - doIt(); -}; + var /** @type {string} */ localVar = org.apache.royale.utils.Language.string(this._privateVar.label); + this.init(); + doIt(); +}; \ No newline at end of file
