You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2013/11/09 02:00:03 UTC

[1/2] git commit: [flex-falcon] [refs/heads/develop] - Fixing these tests to work properly with the new-ish dependency resolving (I think, not really sure when the old behaviour changed).

Updated Branches:
  refs/heads/develop 7b3260229 -> 8e96bb9bc


Fixing these tests to work properly with the new-ish dependency resolving (I think, not really sure when the old behaviour changed).

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/e2b5a131
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/e2b5a131
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/e2b5a131

Branch: refs/heads/develop
Commit: e2b5a131e89f96b08a3e3db69ab1bf46c83e8d09
Parents: 7b32602
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Sat Nov 9 01:38:20 2013 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Sat Nov 9 01:38:20 2013 +0100

----------------------------------------------------------------------
 .../codegen/js/flexjs/TestFlexJSFile.java       |   4 +-
 .../test-files/flexjs/files/MyController.as     |  92 ---------------
 .../flexjs/files/MyController_result.js         | 112 -------------------
 .../test-files/flexjs/files/MyModel.as          |  59 ----------
 .../test-files/flexjs/files/MyModel_result.js   |  63 -----------
 .../flexjs/files/StockDataJSONItemConverter.js  |  26 +++++
 .../flexjs/files/controllers/MyController.as    |  92 +++++++++++++++
 .../files/controllers/MyController_result.js    | 112 +++++++++++++++++++
 .../test-files/flexjs/files/models/MyModel.as   |  59 ++++++++++
 .../flexjs/files/models/MyModel_result.js       |  63 +++++++++++
 10 files changed, 354 insertions(+), 328 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e2b5a131/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java
index 9e2fae4..4524844 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java
@@ -56,7 +56,7 @@ public class TestFlexJSFile extends FlexJSTestBase
     @Test
     public void testFlexJSMyController()
     {
-        String fileName = "MyController";
+        String fileName = "controllers/MyController";
 
         IFileNode node = compileAS(fileName, true,
                 "test-files"
@@ -74,7 +74,7 @@ public class TestFlexJSFile extends FlexJSTestBase
     @Test
     public void testFlexJSMyModel()
     {
-        String fileName = "MyModel";
+        String fileName = "models/MyModel";
 
         IFileNode node = compileAS(fileName, true, "test-files"
                 + File.separator + "flexjs" + File.separator + "files", false);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e2b5a131/compiler.jx.tests/test-files/flexjs/files/MyController.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/MyController.as b/compiler.jx.tests/test-files/flexjs/files/MyController.as
deleted file mode 100644
index d7b0547..0000000
--- a/compiler.jx.tests/test-files/flexjs/files/MyController.as
+++ /dev/null
@@ -1,92 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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 controllers
-{
-	import org.apache.flex.core.Application;
-	import org.apache.flex.core.IDocument;
-	import org.apache.flex.events.Event;
-	
-	
-	import models.MyModel;
-	
-	public class MyController implements IDocument
-	{
-		public function MyController(app:Application = null)
-		{
-			if (app)
-			{
-				this.app = app as FlexJSTest_again;
-				app.addEventListener("viewChanged", viewChangeHandler);
-			}
-		}
-		
-		private var queryBegin:String = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22";
-		private var queryEnd:String = "%22)%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json";
-		private var app:FlexJSTest_again;
-		
-		private function viewChangeHandler(event:Event):void
-		{
-			app.initialView.addEventListener("buttonClicked", buttonClickHandler);
-			app.initialView.addEventListener("listChanged", listChangedHandler);
-			app.initialView.addEventListener("cityListChanged", cityListChangeHandler);
-			app.initialView.addEventListener("transferClicked", transferClickHandler);
-			app.initialView.addEventListener("comboBoxChanged", comboBoxChangeHandler);
-		}
-		
-		private function buttonClickHandler(event:Event):void
-		{
-			var sym:String = MyInitialView(app.initialView).symbol;
-			app.service.url = queryBegin + sym + queryEnd;
-			app.service.send();
-			app.service.addEventListener("complete", completeHandler);
-		}
-		
-		private function completeHandler(event:Event):void
-		{
-			MyModel(app.model).labelText = app.collection.getItemAt(0) as String;
-		}
-		
-		private function listChangedHandler(event:Event):void
-		{
-			MyModel(app.model).labelText = MyInitialView(app.initialView).symbol;
-		}
-		
-		private function cityListChangeHandler(event:Event):void
-		{
-			MyModel(app.model).labelText = MyInitialView(app.initialView).city;
-		}
-		
-		private function transferClickHandler(event:Event):void
-		{
-			MyModel(app.model).labelText = MyInitialView(app.initialView).inputText;
-		}
-		
-		private function comboBoxChangeHandler(event:Event):void
-		{
-			MyModel(app.model).labelText = MyInitialView(app.initialView).comboBoxValue;
-		}
-		
-		public function setDocument(document:Object, id:String = null):void
-		{
-			this.app = document as FlexJSTest_again;
-			app.addEventListener("viewChanged", viewChangeHandler);
-		}
-		
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e2b5a131/compiler.jx.tests/test-files/flexjs/files/MyController_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/MyController_result.js b/compiler.jx.tests/test-files/flexjs/files/MyController_result.js
deleted file mode 100644
index c80f220..0000000
--- a/compiler.jx.tests/test-files/flexjs/files/MyController_result.js
+++ /dev/null
@@ -1,112 +0,0 @@
-goog.provide('controllers.MyController');
-
-/**
- * @constructor
- * @implements {org.apache.flex.core.IDocument}
- * @param {org.apache.flex.core.Application=} app
- */
-controllers.MyController = function(app) {
-	app = typeof app !== 'undefined' ? app : null;
-	if (app) {
-		this.app = org.apache.flex.utils.Language.as(app, FlexJSTest_again);
-		app.addEventListener("viewChanged", goog.bind(this.viewChangeHandler, this));
-	}
-};
-
-/**
- * @private
- * @type {string}
- */
-controllers.MyController.prototype.queryBegin = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22";
-
-/**
- * @private
- * @type {string}
- */
-controllers.MyController.prototype.queryEnd = "%22)%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json";
-
-/**
- * @private
- * @type {FlexJSTest_again}
- */
-controllers.MyController.prototype.app;
-
-/**
- * @private
- * @param {org.apache.flex.events.Event} event
- */
-controllers.MyController.prototype.viewChangeHandler = function(event) {
-	this.app.initialView.addEventListener("buttonClicked", goog.bind(this.buttonClickHandler, this));
-	this.app.initialView.addEventListener("listChanged", goog.bind(this.listChangedHandler, this));
-	this.app.initialView.addEventListener("cityListChanged", goog.bind(this.cityListChangeHandler, this));
-	this.app.initialView.addEventListener("transferClicked", goog.bind(this.transferClickHandler, this));
-	this.app.initialView.addEventListener("comboBoxChanged", goog.bind(this.comboBoxChangeHandler, this));
-};
-
-/**
- * @private
- * @param {org.apache.flex.events.Event} event
- */
-controllers.MyController.prototype.buttonClickHandler = function(event) {
-	var /** @type {string} */ sym = this.app.initialView/** Cast to MyInitialView */.get_symbol();
-	this.app.get_service().set_url(this.queryBegin + sym + this.queryEnd);
-	this.app.get_service().send();
-	this.app.get_service().addEventListener("complete", goog.bind(this.completeHandler, this));
-};
-
-/**
- * @private
- * @param {org.apache.flex.events.Event} event
- */
-controllers.MyController.prototype.completeHandler = function(event) {
-	this.app.model/** Cast to models.MyModel */.set_labelText(org.apache.flex.utils.Language.as(this.app.get_collection().getItemAt(0), String));
-};
-
-/**
- * @private
- * @param {org.apache.flex.events.Event} event
- */
-controllers.MyController.prototype.listChangedHandler = function(event) {
-	this.app.model/** Cast to models.MyModel */.set_labelText(this.app.initialView/** Cast to MyInitialView */.get_symbol());
-};
-
-/**
- * @private
- * @param {org.apache.flex.events.Event} event
- */
-controllers.MyController.prototype.cityListChangeHandler = function(event) {
-	this.app.model/** Cast to models.MyModel */.set_labelText(this.app.initialView/** Cast to MyInitialView */.get_city());
-};
-
-/**
- * @private
- * @param {org.apache.flex.events.Event} event
- */
-controllers.MyController.prototype.transferClickHandler = function(event) {
-	this.app.model/** Cast to models.MyModel */.set_labelText(this.app.initialView/** Cast to MyInitialView */.get_inputText());
-};
-
-/**
- * @private
- * @param {org.apache.flex.events.Event} event
- */
-controllers.MyController.prototype.comboBoxChangeHandler = function(event) {
-	this.app.model/** Cast to models.MyModel */.set_labelText(this.app.initialView/** Cast to MyInitialView */.get_comboBoxValue());
-};
-
-/**
- * @expose
- * @param {Object} document
- * @param {string=} id
- */
-controllers.MyController.prototype.setDocument = function(document, id) {
-	id = typeof id !== 'undefined' ? id : null;
-	this.app = org.apache.flex.utils.Language.as(document, FlexJSTest_again);
-	this.app.addEventListener("viewChanged", goog.bind(this.viewChangeHandler, this));
-};
-
-/**
- * @const
- */
-controllers.MyController.prototype.FLEXJS_CLASS_INFO = { interfaces: [org.apache.flex.core.IDocument] };
-

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e2b5a131/compiler.jx.tests/test-files/flexjs/files/MyModel.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/MyModel.as b/compiler.jx.tests/test-files/flexjs/files/MyModel.as
deleted file mode 100644
index 1dc23e6..0000000
--- a/compiler.jx.tests/test-files/flexjs/files/MyModel.as
+++ /dev/null
@@ -1,59 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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 models
-{
-	import org.apache.flex.events.Event;
-	import org.apache.flex.events.EventDispatcher;
-	
-	public class MyModel extends EventDispatcher
-	{
-		public function MyModel()
-		{
-		}
-		
-		private var _labelText:String;
-		
-		public function get labelText():String
-		{
-			return _labelText;
-		}
-		
-		public function set labelText(value:String):void
-		{
-			if (value != _labelText)
-			{
-				_labelText = value;
-				dispatchEvent(new Event("labelTextChanged"));
-			}
-		}
-        
-        private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
-        public function get strings():Array
-        {
-            return _strings;
-        }
-		
-		private var _cities:Array = ["London", "Miami", "Paris", "Sydney", "Tokyo"];
-		public function get cities():Array
-		{
-			return _cities;
-		}
-
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e2b5a131/compiler.jx.tests/test-files/flexjs/files/MyModel_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/MyModel_result.js b/compiler.jx.tests/test-files/flexjs/files/MyModel_result.js
deleted file mode 100644
index 38422d6..0000000
--- a/compiler.jx.tests/test-files/flexjs/files/MyModel_result.js
+++ /dev/null
@@ -1,63 +0,0 @@
-goog.provide('models.MyModel');
-
-/**
- * @constructor
- * @extends {org.apache.flex.events.EventDispatcher}
- */
-models.MyModel = function() {
-	goog.base(this);
-}
-goog.inherits(models.MyModel, org.apache.flex.events.EventDispatcher);
-
-/**
- * @private
- * @type {string}
- */
-models.MyModel.prototype._labelText;
-
-/**
- * @expose
- * @return {string}
- */
-models.MyModel.prototype.get_labelText = function() {
-	return this._labelText;
-};
-
-/**
- * @expose
- * @param {string} value
- */
-models.MyModel.prototype.set_labelText = function(value) {
-	if (value != this._labelText) {
-		this._labelText = value;
-		this.dispatchEvent(new org.apache.flex.events.Event("labelTextChanged"));
-	}
-};
-
-/**
- * @private
- * @type {Array}
- */
-models.MyModel.prototype._strings = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
-
-/**
- * @expose
- * @return {Array}
- */
-models.MyModel.prototype.get_strings = function() {
-	return this._strings;
-};
-
-/**
- * @private
- * @type {Array}
- */
-models.MyModel.prototype._cities = ["London", "Miami", "Paris", "Sydney", "Tokyo"];
-
-/**
- * @expose
- * @return {Array}
- */
-models.MyModel.prototype.get_cities = function() {
-	return this._cities;
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e2b5a131/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.js b/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.js
new file mode 100644
index 0000000..48b4f00
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.js
@@ -0,0 +1,26 @@
+goog.provide('StockDataJSONItemConverter');
+
+goog.require('org.apache.flex.net.JSONItemConverter');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.net.JSONItemConverter}
+ */
+StockDataJSONItemConverter = function() {
+	goog.base(this);
+}
+goog.inherits(StockDataJSONItemConverter, org.apache.flex.net.JSONItemConverter);
+
+/**
+ * @expose
+ * @param {string} data
+ * @return {Object}
+ * @override
+ */
+StockDataJSONItemConverter.prototype.convertItem = function(data) {
+	var /** @type {Object} */ obj = goog.base(this, 'convertItem', data);
+	if (obj["query"]["count"] == 0)
+		return "No Data";
+	obj = obj["query"]["results"]["quote"];
+	return obj;
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e2b5a131/compiler.jx.tests/test-files/flexjs/files/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/controllers/MyController.as b/compiler.jx.tests/test-files/flexjs/files/controllers/MyController.as
new file mode 100644
index 0000000..d7b0547
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/files/controllers/MyController.as
@@ -0,0 +1,92 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 controllers
+{
+	import org.apache.flex.core.Application;
+	import org.apache.flex.core.IDocument;
+	import org.apache.flex.events.Event;
+	
+	
+	import models.MyModel;
+	
+	public class MyController implements IDocument
+	{
+		public function MyController(app:Application = null)
+		{
+			if (app)
+			{
+				this.app = app as FlexJSTest_again;
+				app.addEventListener("viewChanged", viewChangeHandler);
+			}
+		}
+		
+		private var queryBegin:String = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22";
+		private var queryEnd:String = "%22)%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json";
+		private var app:FlexJSTest_again;
+		
+		private function viewChangeHandler(event:Event):void
+		{
+			app.initialView.addEventListener("buttonClicked", buttonClickHandler);
+			app.initialView.addEventListener("listChanged", listChangedHandler);
+			app.initialView.addEventListener("cityListChanged", cityListChangeHandler);
+			app.initialView.addEventListener("transferClicked", transferClickHandler);
+			app.initialView.addEventListener("comboBoxChanged", comboBoxChangeHandler);
+		}
+		
+		private function buttonClickHandler(event:Event):void
+		{
+			var sym:String = MyInitialView(app.initialView).symbol;
+			app.service.url = queryBegin + sym + queryEnd;
+			app.service.send();
+			app.service.addEventListener("complete", completeHandler);
+		}
+		
+		private function completeHandler(event:Event):void
+		{
+			MyModel(app.model).labelText = app.collection.getItemAt(0) as String;
+		}
+		
+		private function listChangedHandler(event:Event):void
+		{
+			MyModel(app.model).labelText = MyInitialView(app.initialView).symbol;
+		}
+		
+		private function cityListChangeHandler(event:Event):void
+		{
+			MyModel(app.model).labelText = MyInitialView(app.initialView).city;
+		}
+		
+		private function transferClickHandler(event:Event):void
+		{
+			MyModel(app.model).labelText = MyInitialView(app.initialView).inputText;
+		}
+		
+		private function comboBoxChangeHandler(event:Event):void
+		{
+			MyModel(app.model).labelText = MyInitialView(app.initialView).comboBoxValue;
+		}
+		
+		public function setDocument(document:Object, id:String = null):void
+		{
+			this.app = document as FlexJSTest_again;
+			app.addEventListener("viewChanged", viewChangeHandler);
+		}
+		
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e2b5a131/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js b/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js
new file mode 100644
index 0000000..c80f220
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js
@@ -0,0 +1,112 @@
+goog.provide('controllers.MyController');
+
+/**
+ * @constructor
+ * @implements {org.apache.flex.core.IDocument}
+ * @param {org.apache.flex.core.Application=} app
+ */
+controllers.MyController = function(app) {
+	app = typeof app !== 'undefined' ? app : null;
+	if (app) {
+		this.app = org.apache.flex.utils.Language.as(app, FlexJSTest_again);
+		app.addEventListener("viewChanged", goog.bind(this.viewChangeHandler, this));
+	}
+};
+
+/**
+ * @private
+ * @type {string}
+ */
+controllers.MyController.prototype.queryBegin = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22";
+
+/**
+ * @private
+ * @type {string}
+ */
+controllers.MyController.prototype.queryEnd = "%22)%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json";
+
+/**
+ * @private
+ * @type {FlexJSTest_again}
+ */
+controllers.MyController.prototype.app;
+
+/**
+ * @private
+ * @param {org.apache.flex.events.Event} event
+ */
+controllers.MyController.prototype.viewChangeHandler = function(event) {
+	this.app.initialView.addEventListener("buttonClicked", goog.bind(this.buttonClickHandler, this));
+	this.app.initialView.addEventListener("listChanged", goog.bind(this.listChangedHandler, this));
+	this.app.initialView.addEventListener("cityListChanged", goog.bind(this.cityListChangeHandler, this));
+	this.app.initialView.addEventListener("transferClicked", goog.bind(this.transferClickHandler, this));
+	this.app.initialView.addEventListener("comboBoxChanged", goog.bind(this.comboBoxChangeHandler, this));
+};
+
+/**
+ * @private
+ * @param {org.apache.flex.events.Event} event
+ */
+controllers.MyController.prototype.buttonClickHandler = function(event) {
+	var /** @type {string} */ sym = this.app.initialView/** Cast to MyInitialView */.get_symbol();
+	this.app.get_service().set_url(this.queryBegin + sym + this.queryEnd);
+	this.app.get_service().send();
+	this.app.get_service().addEventListener("complete", goog.bind(this.completeHandler, this));
+};
+
+/**
+ * @private
+ * @param {org.apache.flex.events.Event} event
+ */
+controllers.MyController.prototype.completeHandler = function(event) {
+	this.app.model/** Cast to models.MyModel */.set_labelText(org.apache.flex.utils.Language.as(this.app.get_collection().getItemAt(0), String));
+};
+
+/**
+ * @private
+ * @param {org.apache.flex.events.Event} event
+ */
+controllers.MyController.prototype.listChangedHandler = function(event) {
+	this.app.model/** Cast to models.MyModel */.set_labelText(this.app.initialView/** Cast to MyInitialView */.get_symbol());
+};
+
+/**
+ * @private
+ * @param {org.apache.flex.events.Event} event
+ */
+controllers.MyController.prototype.cityListChangeHandler = function(event) {
+	this.app.model/** Cast to models.MyModel */.set_labelText(this.app.initialView/** Cast to MyInitialView */.get_city());
+};
+
+/**
+ * @private
+ * @param {org.apache.flex.events.Event} event
+ */
+controllers.MyController.prototype.transferClickHandler = function(event) {
+	this.app.model/** Cast to models.MyModel */.set_labelText(this.app.initialView/** Cast to MyInitialView */.get_inputText());
+};
+
+/**
+ * @private
+ * @param {org.apache.flex.events.Event} event
+ */
+controllers.MyController.prototype.comboBoxChangeHandler = function(event) {
+	this.app.model/** Cast to models.MyModel */.set_labelText(this.app.initialView/** Cast to MyInitialView */.get_comboBoxValue());
+};
+
+/**
+ * @expose
+ * @param {Object} document
+ * @param {string=} id
+ */
+controllers.MyController.prototype.setDocument = function(document, id) {
+	id = typeof id !== 'undefined' ? id : null;
+	this.app = org.apache.flex.utils.Language.as(document, FlexJSTest_again);
+	this.app.addEventListener("viewChanged", goog.bind(this.viewChangeHandler, this));
+};
+
+/**
+ * @const
+ */
+controllers.MyController.prototype.FLEXJS_CLASS_INFO = { interfaces: [org.apache.flex.core.IDocument] };
+

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e2b5a131/compiler.jx.tests/test-files/flexjs/files/models/MyModel.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/models/MyModel.as b/compiler.jx.tests/test-files/flexjs/files/models/MyModel.as
new file mode 100644
index 0000000..1dc23e6
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/files/models/MyModel.as
@@ -0,0 +1,59 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 models
+{
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.EventDispatcher;
+	
+	public class MyModel extends EventDispatcher
+	{
+		public function MyModel()
+		{
+		}
+		
+		private var _labelText:String;
+		
+		public function get labelText():String
+		{
+			return _labelText;
+		}
+		
+		public function set labelText(value:String):void
+		{
+			if (value != _labelText)
+			{
+				_labelText = value;
+				dispatchEvent(new Event("labelTextChanged"));
+			}
+		}
+        
+        private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
+        public function get strings():Array
+        {
+            return _strings;
+        }
+		
+		private var _cities:Array = ["London", "Miami", "Paris", "Sydney", "Tokyo"];
+		public function get cities():Array
+		{
+			return _cities;
+		}
+
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e2b5a131/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js b/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
new file mode 100644
index 0000000..38422d6
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
@@ -0,0 +1,63 @@
+goog.provide('models.MyModel');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.events.EventDispatcher}
+ */
+models.MyModel = function() {
+	goog.base(this);
+}
+goog.inherits(models.MyModel, org.apache.flex.events.EventDispatcher);
+
+/**
+ * @private
+ * @type {string}
+ */
+models.MyModel.prototype._labelText;
+
+/**
+ * @expose
+ * @return {string}
+ */
+models.MyModel.prototype.get_labelText = function() {
+	return this._labelText;
+};
+
+/**
+ * @expose
+ * @param {string} value
+ */
+models.MyModel.prototype.set_labelText = function(value) {
+	if (value != this._labelText) {
+		this._labelText = value;
+		this.dispatchEvent(new org.apache.flex.events.Event("labelTextChanged"));
+	}
+};
+
+/**
+ * @private
+ * @type {Array}
+ */
+models.MyModel.prototype._strings = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
+
+/**
+ * @expose
+ * @return {Array}
+ */
+models.MyModel.prototype.get_strings = function() {
+	return this._strings;
+};
+
+/**
+ * @private
+ * @type {Array}
+ */
+models.MyModel.prototype._cities = ["London", "Miami", "Paris", "Sydney", "Tokyo"];
+
+/**
+ * @expose
+ * @return {Array}
+ */
+models.MyModel.prototype.get_cities = function() {
+	return this._cities;
+};
\ No newline at end of file


[2/2] git commit: [flex-falcon] [refs/heads/develop] - FLEX-33887 "super.foo = value; " is now correctly translated to "goog.base(this, 'set_foo', value); "

Posted by er...@apache.org.
FLEX-33887 "super.foo = value;" is now correctly translated to "goog.base(this, 'set_foo', value);"

Test cases are added and one old test case is bypassed

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/8e96bb9b
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/8e96bb9b
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/8e96bb9b

Branch: refs/heads/develop
Commit: 8e96bb9bc2bf6813f8bdc9bb68f9bce72c30ad6c
Parents: e2b5a13
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Sat Nov 9 01:59:42 2013 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Sat Nov 9 01:59:42 2013 +0100

----------------------------------------------------------------------
 .../codegen/js/flexjs/TestFlexJSClass.java      | 45 ++++++++++++++++++++
 .../js/flexjs/TestFlexJSExpressions.java        | 14 ++++++
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 40 +++++++++++++++--
 3 files changed, 96 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8e96bb9b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
index ca98a71..d710904 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
@@ -76,6 +76,51 @@ public class TestFlexJSClass extends TestGoogClass
         assertOut(expected);
     }
 
+    @Test
+    public void testMethod_override()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; override public function foo():void {};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n/**\n * @expose\n * @override\n */\norg.apache.flex.B.prototype.foo = function() {\n};";
+        assertOut(expected);
+    }
+
+    @Test
+    public void testMethod_overrideWithFunctionBody()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; override public function foo(value:Object):void {baz = ''};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n/**\n * @expose\n * @param {Object} value\n * @override\n */\norg.apache.flex.B.prototype.foo = function(value) {\n\tbaz = '';\n};";
+        assertOut(expected);
+    }
+
+    @Test
+    public void testMethod_overrideSuperCall()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; override public function foo():void {super.foo();};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n/**\n * @expose\n * @override\n */\norg.apache.flex.B.prototype.foo = function() {\n\tgoog.base(this, 'foo');\n};";
+        assertOut(expected);
+    }
+
+    @Test
+    public void testMethod_setterCall()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; public function set baz(value:Object):void {}; public function set foo(value:Object):void {baz = value;};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n/**\n * @expose\n * @param {Object} value\n */\norg.apache.flex.B.prototype.set_baz = function(value) {\n};\n\n/**\n * @expose\n * @param {Object} value\n */\norg.apache.flex.B.prototype.set_foo = function(value) {\n\tthis.set_baz(value);\n};";
+        assertOut(expected);
+    }
+
+    @Test
+    public void testMethod_overrideSetterSuperCall()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; override public function set foo(value:Object):void {super.foo = value;};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n/**\n * @expose\n * @param {Object} value\n * @override\n */\norg.apache.flex.B.prototype.set_foo = function(value) {\n\tgoog.base(this, 'set_foo', value);\n};";
+        assertOut(expected);
+    }
+
     @Override
     @Test
     public void testAccessors()

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8e96bb9b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
index 8c15248..6057016 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
@@ -29,6 +29,8 @@ import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
 import org.apache.flex.compiler.tree.as.IClassNode;
 import org.apache.flex.compiler.tree.as.IFileNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
+import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -37,6 +39,18 @@ import org.junit.Test;
 public class TestFlexJSExpressions extends TestGoogExpressions
 {
 
+    @Ignore
+    @Override
+    @Test
+    public void testVisitLanguageIdentifierNode_SuperMember()
+    {
+        // (erikdebruin) this test doesn't make sense in FlexJS context
+        IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getNode(
+                "if (a) super.foo;", IMemberAccessExpressionNode.class);
+        asBlockWalker.visitMemberAccessExpression(node);
+        assertOut("super.foo");
+    }
+
     @Override
     @Test
     public void testVisitLanguageIdentifierNode_SuperMethod_1()

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8e96bb9b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 49ab7e0..5edb70b 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -606,7 +606,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                         .getAncestorOfType(IFunctionNode.class);
         }
 
-        if (fnode.isConstructor() && !hasSuperClass(fnode))
+        if (fnode != null && fnode.isConstructor() && !hasSuperClass(fnode))
             return;
 
         write(JSGoogEmitterTokens.GOOG_BASE);
@@ -638,6 +638,23 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
 
             writeArguments = (anodes != null && anodes.length > 0);
         }
+        else if (fnode == null && node instanceof BinaryOperatorAssignmentNode)
+        {
+            BinaryOperatorAssignmentNode bnode = (BinaryOperatorAssignmentNode) node;
+            
+            IFunctionNode pnode = (IFunctionNode) bnode.getAncestorOfType(IFunctionNode.class);
+            
+            if (pnode.getNodeID() == ASTNodeID.SetterID)
+            {
+                writeToken(ASEmitterTokens.COMMA);
+                write(ASEmitterTokens.SINGLE_QUOTE);
+                writeGetSetPrefix(false);
+                getWalker().walk(bnode.getLeftOperandNode());
+                write(ASEmitterTokens.SINGLE_QUOTE);
+                writeToken(ASEmitterTokens.COMMA);
+                getWalker().walk(bnode.getRightOperandNode());
+            }
+        }
 
         if (writeArguments)
         {
@@ -728,6 +745,15 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                 def = ((IIdentifierNode) property).resolve(getWalker()
                         .getProject());
 
+            boolean isSuper = false;
+            if (leftSide.getNodeID() == ASTNodeID.MemberAccessExpressionID)
+            {
+                IASNode cnode = leftSide.getChild(0);
+                ASTNodeID cId = cnode.getNodeID();
+
+                isSuper = cId == ASTNodeID.SuperID;
+            }
+
             String op = node.getOperator().getOperatorText();
             boolean isAssignment = !(op.contains("==") || !op.contains("="));
 
@@ -735,6 +761,10 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
             {
                 getWalker().walk(leftSide);
             }
+            else if (isSuper) 
+            {
+                emitSuperCall(node, "");
+            }
             else
             {
                 if (ASNodeUtils.hasParenOpen(node))
@@ -773,8 +803,11 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
             if (!(leftNode instanceof ILanguageIdentifierNode && ((ILanguageIdentifierNode) leftNode)
                         .getKind() == ILanguageIdentifierNode.LanguageIdentifierKind.THIS))
             {
-                getWalker().walk(node.getLeftOperandNode());
-                write(node.getOperator().getOperatorText());
+                if (leftNode.getNodeID() != ASTNodeID.SuperID)
+                {
+                    getWalker().walk(node.getLeftOperandNode());
+                    write(node.getOperator().getOperatorText());
+                }
             }
             else
             {
@@ -783,6 +816,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
             }
         
         }
+        
         getWalker().walk(node.getRightOperandNode());
     }