flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1427026 - in /incubator/flex/whiteboard/mschmalle/falconjx: compiler.jx.tests/src/org/apache/flex/compiler/internal/js/codegen/goog/ compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/
Date Mon, 31 Dec 2012 00:31:57 GMT
Author: mschmalle
Date: Mon Dec 31 00:31:57 2012
New Revision: 1427026

URL: http://svn.apache.org/viewvc?rev=1427026&view=rev
Log:
Flex:FalconJx
- added more tests for setters in 'goog' production

Modified:
    incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/compiler/internal/js/codegen/goog/TestGoogAccessorMembers.java
    incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogEmitter.java

Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/compiler/internal/js/codegen/goog/TestGoogAccessorMembers.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/compiler/internal/js/codegen/goog/TestGoogAccessorMembers.java?rev=1427026&r1=1427025&r2=1427026&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/compiler/internal/js/codegen/goog/TestGoogAccessorMembers.java
(original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/compiler/internal/js/codegen/goog/TestGoogAccessorMembers.java
Mon Dec 31 00:31:57 2012
@@ -24,6 +24,7 @@ import org.apache.flex.compiler.internal
 import org.apache.flex.compiler.internal.js.driver.goog.GoogBackend;
 import org.apache.flex.compiler.tree.as.IAccessorNode;
 import org.apache.flex.compiler.tree.as.IGetterNode;
+import org.apache.flex.compiler.tree.as.ISetterNode;
 import org.junit.Test;
 
 /**
@@ -63,7 +64,8 @@ public class TestGoogAccessorMembers ext
     {
         IGetterNode node = (IGetterNode) getAccessor("public function get foo():int{return
-1;}");
         visitor.visitGetter(node);
-        //assertOut("");
+        assertOut("Object.defineProperty(\n\tA.prototype, \n\t'foo', "
+                + "\n\t{get:function() {\n\t\treturn -1;\n\t}, configurable:true}\n)");
     }
 
     @Override
@@ -72,6 +74,7 @@ public class TestGoogAccessorMembers ext
     {
         IAccessorNode node = getAccessor("public override function get foo():int{return -1;}");
         visitor.visitFunction(node);
+        // TODO [TestGoog] public override get
         //assertOut("");
     }
 
@@ -81,6 +84,7 @@ public class TestGoogAccessorMembers ext
     {
         IAccessorNode node = getAccessor("public static function get foo():int{return -1;}");
         visitor.visitFunction(node);
+        // TODO [TestGoog] public static get
         //assertOut("");
     }
 
@@ -88,18 +92,28 @@ public class TestGoogAccessorMembers ext
     @Test
     public void testSetAccessor()
     {
-        IAccessorNode node = getAccessor("function set foo(value:int):void{}");
-        visitor.visitFunction(node);
-        //assertOut("Object.defineProperty(A.prototype, 'foo', {set: function(value) {},
configurable: true});");
+        /*
+        Object.defineProperty(
+            A.prototype, 
+            'foo', 
+            {set:function(value) {
+            }, configurable:true}
+        )
+         */
+        ISetterNode node = (ISetterNode) getAccessor("function set foo(value:int):void{}");
+        visitor.visitSetter(node);
+        assertOut("Object.defineProperty(\n\tA.prototype, \n\t'foo', \n\t{set:function(value)"
+                + " {\n\t}, configurable:true}\n)");
     }
 
     @Override
     @Test
     public void testSetAccessor_withNamespace()
     {
-        IAccessorNode node = getAccessor("public function set foo(value:int):void{}");
-        visitor.visitFunction(node);
-        //assertOut("");
+        ISetterNode node = (ISetterNode) getAccessor("public function set foo(value:int):void{}");
+        visitor.visitSetter(node);
+        assertOut("Object.defineProperty(\n\tA.prototype, \n\t'foo', \n\t{set:function(value)"
+                + " {\n\t}, configurable:true}\n)");
     }
 
     @Override
@@ -108,6 +122,7 @@ public class TestGoogAccessorMembers ext
     {
         IAccessorNode node = getAccessor("public override function set foo(value:int):void{}");
         visitor.visitFunction(node);
+        // TODO [TestGoog] public override set
         //assertOut("");
     }
 
@@ -117,6 +132,7 @@ public class TestGoogAccessorMembers ext
     {
         IAccessorNode node = getAccessor("public static function set foo(value:int):void{}");
         visitor.visitFunction(node);
+        // TODO [TestGoog] public static set
         //assertOut("");
     }
 

Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogEmitter.java?rev=1427026&r1=1427025&r2=1427026&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogEmitter.java
(original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogEmitter.java
Mon Dec 31 00:31:57 2012
@@ -50,6 +50,7 @@ import org.apache.flex.compiler.tree.as.
 import org.apache.flex.compiler.tree.as.IPackageNode;
 import org.apache.flex.compiler.tree.as.IParameterNode;
 import org.apache.flex.compiler.tree.as.IScopedNode;
+import org.apache.flex.compiler.tree.as.ISetterNode;
 import org.apache.flex.compiler.tree.as.ITypeNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
 
@@ -300,6 +301,12 @@ public class JSGoogEmitter extends JSEmi
     {
         emitObjectDefineProperty(node);
     }
+    
+    @Override
+    public void emitSetAccessor(ISetterNode node)
+    {
+        emitObjectDefineProperty(node);
+    }
 
     @Override
     public void emitMethod(IFunctionNode node)



Mime
View raw message