flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erikdebr...@apache.org
Subject [3/4] git commit: [flex-falcon] [refs/heads/develop] - Some more 'corrections' for whitespace emission.
Date Tue, 12 Nov 2013 11:05:16 GMT
Some more 'corrections' for whitespace emission.

Signed-off-by: Erik de Bruin <erik@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/daa6e771
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/daa6e771
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/daa6e771

Branch: refs/heads/develop
Commit: daa6e7710a6a6cc0f35bc1552e6fae617ace0c2e
Parents: c4bdbf5
Author: Erik de Bruin <erik@ixsoftware.nl>
Authored: Tue Nov 12 12:03:40 2013 +0100
Committer: Erik de Bruin <erik@ixsoftware.nl>
Committed: Tue Nov 12 12:03:40 2013 +0100

----------------------------------------------------------------------
 .../codegen/js/flexjs/TestFlexJSClass.java      | 24 +++---
 .../codegen/js/flexjs/TestFlexJSEmiter.java     |  2 +-
 .../flexjs/files/MyInitialView_result.js        | 31 ++++++++
 .../flexjs/files/models/MyModel_result.js       |  2 +-
 .../flexjs/files/wildcard_import_result.js      |  3 +
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 81 ++++++++++++++++++++
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  |  7 ++
 7 files changed, 136 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/daa6e771/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 49ce793..4a45d10 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
@@ -46,7 +46,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         IClassNode node = getClassNode("public class A extends Button {public function A()
{}}");
         asBlockWalker.visitClass(node);
-        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n */\norg.apache.flex.A
= function() {\n  goog.base(this);\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n */\norg.apache.flex.A
= function() {\n  goog.base(this);\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
     }
 
     @Override
@@ -55,7 +55,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         IClassNode node = getClassNode("public class A extends Button implements IEventDispatcher
{public function A() {}}");
         asBlockWalker.visitClass(node);
-        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements
{flash.events.IEventDispatcher}\n */\norg.apache.flex.A = function() {\n  goog.base(this);\n}\ngoog.inherits(org.apache.flex.A,
spark.components.Button);");
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements
{flash.events.IEventDispatcher}\n */\norg.apache.flex.A = function() {\n  goog.base(this);\n};\ngoog.inherits(org.apache.flex.A,
spark.components.Button);");
     }
 
     @Override
@@ -64,7 +64,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         IClassNode node = getClassNode("public class A extends Button implements IEventDispatcher,
ILogger {public function A() {}}");
         asBlockWalker.visitClass(node);
-        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements
{flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A
= function() {\n  goog.base(this);\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements
{flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A
= function() {\n  goog.base(this);\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
     }
 
     @Override
@@ -73,7 +73,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         IClassNode node = getClassNode("public final class A extends Button implements IEventDispatcher,
ILogger {public function A() {}}");
         asBlockWalker.visitClass(node);
-        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements
{flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A
= function() {\n  goog.base(this);\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements
{flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A
= function() {\n  goog.base(this);\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
     }
 
     @Override
@@ -82,7 +82,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         IClassNode node = getClassNode("public class A extends spark.components.Button implements
flash.events.IEventDispatcher, mx.logging.ILogger {public function A() {}}");
         asBlockWalker.visitClass(node);
-        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements
{flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A
= function() {\n  goog.base(this);\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements
{flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A
= function() {\n  goog.base(this);\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
     }
 
     @Override
@@ -91,7 +91,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         IClassNode node = getClassNode("public class A extends spark.components.Button {
public function A() { super('foo', 42);}}");
         asBlockWalker.visitClass(node);
-        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n */\norg.apache.flex.A
= function() {\n  goog.base(this, 'foo', 42);\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n */\norg.apache.flex.A
= function() {\n  goog.base(this, 'foo', 42);\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
     }
 
     @Test
@@ -126,7 +126,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         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};";
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n\n/**\n
* @expose\n * @override\n */\norg.apache.flex.B.prototype.foo = function() {\n};";
         assertOut(expected);
     }
 
@@ -135,7 +135,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         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};";
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n\n/**\n
* @expose\n * @param {Object} value\n * @override\n */\norg.apache.flex.B.prototype.foo =
function(value) {\n  baz = '';\n};";
         assertOut(expected);
     }
 
@@ -144,7 +144,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         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};";
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n\n/**\n
* @expose\n * @override\n */\norg.apache.flex.B.prototype.foo = function() {\n  goog.base(this,
'foo');\n};";
         assertOut(expected);
     }
 
@@ -153,7 +153,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         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};";
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n\n/**\n
* @expose\n * @param {Object} value\n */\norg.apache.flex.B.prototype.set_baz = function(value)
{\n};\n\n\n/**\n * @expose\n * @param {Object} value\n */\norg.apache.flex.B.prototype.set_foo
= function(value) {\n  this.set_baz(value);\n};";
         assertOut(expected);
     }
 
@@ -162,7 +162,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         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};";
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n};\n\n\n/**\n
* @expose\n * @param {Object} value\n * @override\n */\norg.apache.flex.B.prototype.set_foo
= function(value) {\n  goog.base(this, 'set_foo', value);\n};";
         assertOut(expected);
     }
 
@@ -172,7 +172,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         IClassNode node = getClassNode("public class A extends spark.components.Button {public
function A(arg1:String, arg2:int) {}}");
         asBlockWalker.visitClass(node);
-        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @param
{string} arg1\n * @param {number} arg2\n */\norg.apache.flex.A = function(arg1, arg2) {\n
 goog.base(this, arg1, arg2);\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @param
{string} arg1\n * @param {number} arg2\n */\norg.apache.flex.A = function(arg1, arg2) {\n
 goog.base(this, arg1, arg2);\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/daa6e771/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
index 5ede669..c2fa6c9 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
@@ -54,7 +54,7 @@ public class TestFlexJSEmiter extends TestGoogEmiter
                 + "return \"Don't \" + _privateVar + value; }";
         IFileNode node = compileAS(code);
         asBlockWalker.visitFile(node);
-        assertOut("goog.provide('com.example.components.MyTextButton');\n\n\n\n/**\n * @constructor\n
* @extends {spark.components.Button}\n */\ncom.example.components.MyTextButton = function()
{\n  goog.base(this);\n  if (foo() != 42) {\n    bar();\n  }\n}\ngoog.inherits(com.example.components.MyTextButton,
spark.components.Button);\n\n\n/**\n * @private\n * @type {string}\n */\ncom.example.components.MyTextButton.prototype._privateVar
= \"do \";\n\n\n/**\n * @type {number}\n */\ncom.example.components.MyTextButton.prototype.publicProperty
= 100;\n\n\n/**\n * @expose\n * @param {string} value\n * @return {string}\n */\ncom.example.components.MyTextButton.prototype.myFunction
= function(value) {\n  return \"Don't \" + this._privateVar + value;\n};");
+        assertOut("goog.provide('com.example.components.MyTextButton');\n\n\n\n/**\n * @constructor\n
* @extends {spark.components.Button}\n */\ncom.example.components.MyTextButton = function()
{\n  goog.base(this);\n  if (foo() != 42) {\n    bar();\n  }\n};\ngoog.inherits(com.example.components.MyTextButton,
spark.components.Button);\n\n\n/**\n * @private\n * @type {string}\n */\ncom.example.components.MyTextButton.prototype._privateVar
= \"do \";\n\n\n/**\n * @type {number}\n */\ncom.example.components.MyTextButton.prototype.publicProperty
= 100;\n\n\n/**\n * @expose\n * @param {string} value\n * @return {string}\n */\ncom.example.components.MyTextButton.prototype.myFunction
= function(value) {\n  return \"Don't \" + this._privateVar + value;\n};");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/daa6e771/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js b/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
index 5ef10ba..0f29b72 100644
--- a/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
@@ -16,6 +16,8 @@ goog.require('org.apache.flex.events.CustomEvent');
 goog.require('org.apache.flex.events.Event');
 goog.require('org.apache.flex.utils.Timer');
 
+
+
 /**
  * @constructor
  * @extends {org.apache.flex.core.ViewBase}
@@ -175,12 +177,14 @@ MyInitialView = function() {
 };
 goog.inherits(MyInitialView, org.apache.flex.core.ViewBase);
 
+
 /**
  * @private
  * @type {org.apache.flex.utils.org.apache.flex.utils.Timer}
  */
 MyInitialView.prototype.timer;
 
+
 /**
  * @expose
  * @return {string}
@@ -189,6 +193,7 @@ MyInitialView.prototype.get_symbol = function() {
   return org.apache.flex.utils.Language.as(this.get_list().get_selectedItem(), String);
 };
 
+
 /**
  * @expose
  * @return {string}
@@ -197,6 +202,7 @@ MyInitialView.prototype.get_city = function() {
   return org.apache.flex.utils.Language.as(this.get_cityList().get_selectedItem(), String);
 };
 
+
 /**
  * @expose
  * @return {string}
@@ -205,6 +211,7 @@ MyInitialView.prototype.get_inputText = function() {
   return this.get_input().get_text();
 };
 
+
 /**
  * @expose
  * @return {string}
@@ -213,6 +220,7 @@ MyInitialView.prototype.get_comboBoxValue = function() {
   return String(this.get_comboBox().get_selectedItem());
 };
 
+
 /**
  * @expose
  * @param {org.apache.flex.events.org.apache.flex.events.Event} event
@@ -223,6 +231,7 @@ MyInitialView.prototype.startTimer = function(event) {
   this.timer.start();
 };
 
+
 /**
  * @expose
  * @param {org.apache.flex.events.org.apache.flex.events.Event} event
@@ -231,6 +240,7 @@ MyInitialView.prototype.timerHandler = function(event) {
   this.get_timerLabel().set_text(this.timer.get_currentCount().toString());
 };
 
+
 /**
  * @this {MyInitialView}
  * @expose
@@ -241,6 +251,7 @@ MyInitialView.prototype.$EH0 = function(event)
   this.startTimer(event);
 };
 
+
 /**
  * @this {MyInitialView}
  * @expose
@@ -252,6 +263,7 @@ MyInitialView.prototype.$EH1 = function(event)
   this.timer.stop();
 };
 
+
 /**
  * @this {MyInitialView}
  * @expose
@@ -262,6 +274,7 @@ MyInitialView.prototype.$EH2 = function(event)
   this.dispatchEvent(new org.apache.flex.events.CustomEvent('cityListChanged'));
 };
 
+
 /**
  * @this {MyInitialView}
  * @expose
@@ -272,6 +285,7 @@ MyInitialView.prototype.$EH3 = function(event)
   this.dispatchEvent(new org.apache.flex.events.CustomEvent('transferClicked'));
 };
 
+
 /**
  * @this {MyInitialView}
  * @expose
@@ -282,6 +296,7 @@ MyInitialView.prototype.$EH4 = function(event)
   this.dispatchEvent(new org.apache.flex.events.CustomEvent('listChanged'));
 };
 
+
 /**
  * @this {MyInitialView}
  * @expose
@@ -292,6 +307,7 @@ MyInitialView.prototype.$EH5 = function(event)
   this.dispatchEvent(new org.apache.flex.events.CustomEvent('buttonClicked'));
 };
 
+
 /**
  * @this {MyInitialView}
  * @expose
@@ -302,6 +318,7 @@ MyInitialView.prototype.$EH6 = function(event)
   this.dispatchEvent(new org.apache.flex.events.CustomEvent('comboBoxChanged'));
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -312,6 +329,7 @@ MyInitialView.prototype.get_lbl = function()
   return this.lbl;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -323,6 +341,7 @@ MyInitialView.prototype.set_lbl = function(value)
     this.lbl = value;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -333,6 +352,7 @@ MyInitialView.prototype.get_timerLabel = function()
   return this.timerLabel;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -344,6 +364,7 @@ MyInitialView.prototype.set_timerLabel = function(value)
     this.timerLabel = value;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -354,6 +375,7 @@ MyInitialView.prototype.get_cityList = function()
   return this.cityList;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -365,6 +387,7 @@ MyInitialView.prototype.set_cityList = function(value)
     this.cityList = value;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -375,6 +398,7 @@ MyInitialView.prototype.get_input = function()
   return this.input;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -386,6 +410,7 @@ MyInitialView.prototype.set_input = function(value)
     this.input = value;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -396,6 +421,7 @@ MyInitialView.prototype.get_checkbox = function()
   return this.checkbox;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -407,6 +433,7 @@ MyInitialView.prototype.set_checkbox = function(value)
     this.checkbox = value;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -417,6 +444,7 @@ MyInitialView.prototype.get_list = function()
   return this.list;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -428,6 +456,7 @@ MyInitialView.prototype.set_list = function(value)
     this.list = value;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -438,6 +467,7 @@ MyInitialView.prototype.get_comboBox = function()
   return this.comboBox;
 };
 
+
 /**
  * @expose
  * @this {MyInitialView}
@@ -449,6 +479,7 @@ MyInitialView.prototype.set_comboBox = function(value)
     this.comboBox = value;
 };
 
+
 /**
  * @override
  * @this {MyInitialView}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/daa6e771/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
index eb9c7a2..c87ffe9 100644
--- a/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
@@ -8,7 +8,7 @@ goog.provide('models.MyModel');
  */
 models.MyModel = function() {
   goog.base(this);
-}
+};
 goog.inherits(models.MyModel, org.apache.flex.events.EventDispatcher);
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/daa6e771/compiler.jx.tests/test-files/flexjs/files/wildcard_import_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/wildcard_import_result.js b/compiler.jx.tests/test-files/flexjs/files/wildcard_import_result.js
index 3edfc62..f9900ab 100644
--- a/compiler.jx.tests/test-files/flexjs/files/wildcard_import_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/wildcard_import_result.js
@@ -34,3 +34,6 @@ wildcard_import.prototype.tmp = function() {
   var /** @type {Button} */ myButton;
   myButton = new org.apache.flex.html.staticControls.Button();
 };
+
+
+

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/daa6e771/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 e8a2e62..f90c2b9 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
@@ -60,6 +60,7 @@ import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
 import org.apache.flex.compiler.internal.tree.as.ParameterNode;
 import org.apache.flex.compiler.internal.tree.as.RegExpLiteralNode;
+import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.scopes.IASScope;
 import org.apache.flex.compiler.tree.ASTNodeID;
@@ -312,6 +313,71 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
     }
 
     @Override
+    public void emitMethod(IFunctionNode node)
+    {
+        FunctionNode fn = (FunctionNode) node;
+        fn.parseFunctionBody(new ArrayList<ICompilerProblem>());
+
+        ICompilerProject project = getWalker().getProject();
+
+        getDoc().emitMethodDoc(node, project);
+
+        boolean isConstructor = node.isConstructor();
+
+        String qname = getTypeDefinition(node).getQualifiedName();
+        if (qname != null && !qname.equals(""))
+        {
+            write(qname);
+            if (!isConstructor)
+            {
+                write(ASEmitterTokens.MEMBER_ACCESS);
+                if (!fn.hasModifier(ASModifier.STATIC))
+                {
+                    write(JSEmitterTokens.PROTOTYPE);
+                    write(ASEmitterTokens.MEMBER_ACCESS);
+                }
+            }
+        }
+
+        if (!isConstructor)
+            emitMemberName(node);
+
+        write(ASEmitterTokens.SPACE);
+        writeToken(ASEmitterTokens.EQUAL);
+        write(ASEmitterTokens.FUNCTION);
+
+        emitParameters(node.getParameterNodes());
+
+        boolean hasSuperClass = hasSuperClass(node);
+
+        if (isConstructor && node.getScopedNode().getChildCount() == 0)
+        {
+            write(ASEmitterTokens.SPACE);
+            write(ASEmitterTokens.BLOCK_OPEN);
+            if (hasSuperClass)
+                emitSuperCall(node, CONSTRUCTOR_EMPTY);
+            writeNewline();
+            write(ASEmitterTokens.BLOCK_CLOSE);
+        }
+
+        if (!isConstructor || node.getScopedNode().getChildCount() > 0)
+            emitMethodScope(node.getScopedNode());
+
+        if (isConstructor && hasSuperClass)
+        {
+            writeNewline(ASEmitterTokens.SEMICOLON);
+            write(JSGoogEmitterTokens.GOOG_INHERITS);
+            write(ASEmitterTokens.PAREN_OPEN);
+            write(qname);
+            writeToken(ASEmitterTokens.COMMA);
+            String sname = getSuperClassDefinition(node, project)
+                    .getQualifiedName();
+            write(sname);
+            write(ASEmitterTokens.PAREN_CLOSE);
+        }
+    }
+
+    @Override
     public void emitFunctionCall(IFunctionCallNode node)
     {
         IASNode cnode = node.getChild(0);
@@ -963,6 +1029,21 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
         getWalker().walk(node.getRightOperandNode());
     }
 
+    private static ITypeDefinition getTypeDefinition(IDefinitionNode node)
+    {
+        ITypeNode tnode = (ITypeNode) node.getAncestorOfType(ITypeNode.class);
+        return (ITypeDefinition) tnode.getDefinition();
+    }
+
+    private static IClassDefinition getSuperClassDefinition(
+            IDefinitionNode node, ICompilerProject project)
+    {
+        IClassDefinition parent = (IClassDefinition) node.getDefinition()
+                .getParent();
+        IClassDefinition superClass = parent.resolveBaseClass(project);
+        return superClass;
+    }
+
     @Override
     protected void emitObjectDefineProperty(IAccessorNode node)
     {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/daa6e771/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index cd7aad7..d05067e 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -222,6 +222,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         write(ASEmitterTokens.PAREN_CLOSE);
         writeNewline(ASEmitterTokens.SEMICOLON);
         writeNewline();
+        writeNewline();
     }
 
     //--------------------------------------------------------------------------
@@ -543,7 +544,9 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             String output = script.output();
 
             if (!output.equals(""))
+            {
                 writeNewline(output);
+            }
         }
     }
 
@@ -568,6 +571,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             write(ASEmitterTokens.BLOCK_CLOSE);
             writeNewline(";");
             writeNewline();
+            writeNewline();
         }
     }
 
@@ -593,6 +597,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                 writeNewline("return this." + instance.id + ";");
                 writeNewline("};");
                 writeNewline();
+                writeNewline();
                 writeNewline("/**");
                 writeNewline(" * @expose");
                 writeNewline(" * @this {" + cname + "}");
@@ -610,6 +615,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                 writeNewline("this." + instance.id + " = value;");
                 writeNewline("};");
                 writeNewline();
+                writeNewline();
             }
         }
     }
@@ -1255,6 +1261,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                         indentPop();
 
                     sb.append(nl);
+                    sb.append(nl);
 
                     scriptSpecifier.fragment = sb.toString();
 


Mime
View raw message