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/14 10:31:15 UTC

[1/2] git commit: [flex-falcon] [refs/heads/develop] - Created failing test for 'goog.base' for getter/setter accessors.

Updated Branches:
  refs/heads/develop 5f4c8013a -> 18634f079


Created failing test for 'goog.base' for getter/setter accessors.

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/24694bb7
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/24694bb7
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/24694bb7

Branch: refs/heads/develop
Commit: 24694bb71d331f793c2b53937c42cf62b6c03f8d
Parents: 5f4c801
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Thu Nov 14 07:34:24 2013 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Thu Nov 14 07:34:24 2013 +0100

----------------------------------------------------------------------
 .../codegen/js/flexjs/TestFlexJSProject.java    | 15 ++++++++
 .../test-files/flexjs/projects/super/Base.as    | 25 +++++++++++++
 .../flexjs/projects/super/Base_result.js        | 37 ++++++++++++++++++++
 .../test-files/flexjs/projects/super/Super.as   | 22 ++++++++++++
 .../flexjs/projects/super/Super_result.js       | 36 +++++++++++++++++++
 5 files changed, 135 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/24694bb7/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
index 7191660..b8b670b 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
@@ -67,12 +67,27 @@ public class TestFlexJSProject extends TestGoogProject
         assertProjectOut(compiledFileNames, testDirPath);
     }
 
+    @Test
+    public void test_Super()
+    {
+        String testDirPath = projectDirPath + "/super";
+
+        String fileName = "Base";
+
+        List<String> compiledFileNames = compileProject(fileName, testDirPath);
+
+        assertProjectOut(compiledFileNames, testDirPath);
+    }
+
     @Override
     protected void addSourcePaths(List<File> sourcePaths)
     {
         sourcePaths.add(new File(FilenameNormalization.normalize("test-files"
                 + File.separator + projectDirPath + "/interfaces")));
 
+        sourcePaths.add(new File(FilenameNormalization.normalize("test-files"
+                + File.separator + projectDirPath + "/super")));
+
         super.addSourcePaths(sourcePaths);
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/24694bb7/compiler.jx.tests/test-files/flexjs/projects/super/Base.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/super/Base.as b/compiler.jx.tests/test-files/flexjs/projects/super/Base.as
new file mode 100644
index 0000000..22510c9
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/projects/super/Base.as
@@ -0,0 +1,25 @@
+package
+{
+	import Super;
+
+  public class Base extends Super
+  {
+    public function Base() 
+    {
+      super();
+    }; 
+
+    override public function get text():String 
+    {
+      return "A" + super.text;
+    };
+  
+    override public function set text(value:String):void 
+    {
+      if (value != super.text)
+      {
+        super.text = "B" + value;
+      }
+    };
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/24694bb7/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
new file mode 100644
index 0000000..ca387f0
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
@@ -0,0 +1,37 @@
+goog.provide('Base');
+
+goog.require('Super');
+goog.require('org.apache.flex.utils.Language');
+
+
+
+/**
+ * @constructor
+ * @extends {Super}
+ */
+Base = function() {
+  goog.base(this);
+};
+goog.inherits(Base, Super);
+
+
+/**
+ * @expose
+ * @return {string}
+ * @override
+ */
+Base.prototype.get_text = function() {
+  return "A" + goog.base(this, "get_text");
+};
+
+
+/**
+ * @expose
+ * @param {string} value
+ * @override
+ */
+Base.prototype.set_text = function(value) {
+  if (value != goog.base(this, "get_text")) {
+    goog.base(this, "set_text", "B" + value);
+  }
+};

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/24694bb7/compiler.jx.tests/test-files/flexjs/projects/super/Super.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/super/Super.as b/compiler.jx.tests/test-files/flexjs/projects/super/Super.as
new file mode 100644
index 0000000..4869541
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/projects/super/Super.as
@@ -0,0 +1,22 @@
+package
+{
+  public class Super
+  {
+    public function Super() {}; 
+
+    private var _text:String = '';
+  
+    public function get text():String 
+    {
+      return _text;
+    };
+  
+    public function set text(value:String):void 
+    {
+      if (value != _text)
+      {
+        _text = value;
+      }
+    };
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/24694bb7/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js b/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js
new file mode 100644
index 0000000..08c344c
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js
@@ -0,0 +1,36 @@
+goog.provide('Super');
+
+
+
+/**
+ * @constructor
+ */
+Super = function() {
+};
+
+
+/**
+ * @private
+ * @type {string}
+ */
+Super.prototype._text = '';
+
+
+/**
+ * @expose
+ * @return {string}
+ */
+Super.prototype.get_text = function() {
+  return this._text;
+};
+
+
+/**
+ * @expose
+ * @param {string} value
+ */
+Super.prototype.set_text = function(value) {
+  if (value != this._text) {
+    this._text = value;
+  }
+};
\ No newline at end of file


[2/2] git commit: [flex-falcon] [refs/heads/develop] - FLEX-33887 'super' is now correctly parsed to 'goog.base' in real world scenario.

Posted by er...@apache.org.
FLEX-33887 'super' is now correctly parsed to 'goog.base' in real world scenario.

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/18634f07
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/18634f07
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/18634f07

Branch: refs/heads/develop
Commit: 18634f079a875b0151587b5a5fdda5bd62c16589
Parents: 24694bb
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Thu Nov 14 10:24:10 2013 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Thu Nov 14 10:24:10 2013 +0100

----------------------------------------------------------------------
 .../flexjs/projects/super/Base_result.js        |  6 +--
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 39 ++++++++++++--------
 2 files changed, 26 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/18634f07/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
index ca387f0..7c578a1 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
@@ -21,7 +21,7 @@ goog.inherits(Base, Super);
  * @override
  */
 Base.prototype.get_text = function() {
-  return "A" + goog.base(this, "get_text");
+  return "A" + goog.base(this, 'get_text');
 };
 
 
@@ -31,7 +31,7 @@ Base.prototype.get_text = function() {
  * @override
  */
 Base.prototype.set_text = function(value) {
-  if (value != goog.base(this, "get_text")) {
-    goog.base(this, "set_text", "B" + value);
+  if (value != goog.base(this, 'get_text')) {
+    goog.base(this, 'set_text', "B" + value);
   }
 };

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/18634f07/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 f90c2b9..fe82860 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
@@ -697,27 +697,34 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                     isAssignment = false;
             }
 
-            writeGetSetPrefix(!isAssignment);
-            write(node.getName());
-            write(ASEmitterTokens.PAREN_OPEN);
-
-            IExpressionNode rightSide = null;
-
-            if (anode != null)
+            if (parentNode.getNodeID() == ASTNodeID.MemberAccessExpressionID
+                    && parentNode.getChild(0).getNodeID() == ASTNodeID.SuperID)
             {
+                write(JSGoogEmitterTokens.GOOG_BASE);
+                write(ASEmitterTokens.PAREN_OPEN);
+                write(ASEmitterTokens.THIS);
+                writeToken(ASEmitterTokens.COMMA);
+                write(ASEmitterTokens.SINGLE_QUOTE);
+                writeGetSetPrefix(!isAssignment);
+                write(nodeDef.getQualifiedName());
+                write(ASEmitterTokens.SINGLE_QUOTE);
                 if (isAssignment)
                 {
-                    rightSide = ((BinaryOperatorAssignmentNode) anode)
-                            .getRightOperandNode();
-
-                    getWalker().walk(rightSide);
-                }
-                else if (parentNode instanceof IBinaryOperatorNode)
-                {
-                    rightSide = ((IBinaryOperatorNode) parentNode)
-                            .getRightOperandNode();
+                    writeToken(ASEmitterTokens.COMMA);
                 }
             }
+            else
+            {
+                writeGetSetPrefix(!isAssignment);
+                write(node.getName());
+                write(ASEmitterTokens.PAREN_OPEN);
+            }
+
+            if (anode != null && isAssignment)
+            {
+                getWalker().walk(((BinaryOperatorAssignmentNode) anode)
+                        .getRightOperandNode());
+            }
 
             write(ASEmitterTokens.PAREN_CLOSE);
         }