incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1423407 - in /incubator/flex/whiteboard/mschmalle/falconjx: compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestAccessorMembers.java compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
Date Tue, 18 Dec 2012 11:00:11 GMT
Author: mschmalle
Date: Tue Dec 18 11:00:10 2012
New Revision: 1423407

URL: http://svn.apache.org/viewvc?rev=1423407&view=rev
Log:
Flex:FalconJx
- Added a couple more tests to the accessors (override/static)

Modified:
    incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestAccessorMembers.java
    incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java

Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestAccessorMembers.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestAccessorMembers.java?rev=1423407&r1=1423406&r2=1423407&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestAccessorMembers.java
(original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestAccessorMembers.java
Tue Dec 18 11:00:10 2012
@@ -21,7 +21,6 @@ package org.apache.flex.js.internal.driv
 
 import org.apache.flex.compiler.tree.as.IAccessorNode;
 import org.apache.flex.compiler.tree.as.IFileNode;
-import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.junit.Test;
 
 /**
@@ -39,7 +38,7 @@ public class TestAccessorMembers extends
     @Test
     public void testGetAccessor()
     {
-        IFunctionNode node = getAccessor("function get foo():int{return -1;}");
+        IAccessorNode node = getAccessor("function get foo():int{return -1;}");
         visitor.visitFunction(node);
         assertOut("function get foo():int {\n\treturn -1;\n}");
     }
@@ -47,15 +46,31 @@ public class TestAccessorMembers extends
     @Test
     public void testGetAccessor_withNamespace()
     {
-        IFunctionNode node = getAccessor("public function get foo():int{return -1;}");
+        IAccessorNode node = getAccessor("public function get foo():int{return -1;}");
         visitor.visitFunction(node);
         assertOut("public function get foo():int {\n\treturn -1;\n}");
     }
 
     @Test
+    public void testGetAccessor_withNamespaceOverride()
+    {
+        IAccessorNode node = getAccessor("public override function get foo():int{return -1;}");
+        visitor.visitFunction(node);
+        assertOut("public override function get foo():int {\n\treturn -1;\n}");
+    }
+
+    @Test
+    public void testGetAccessor_withStatic()
+    {
+        IAccessorNode node = getAccessor("public static function get foo():int{return -1;}");
+        visitor.visitFunction(node);
+        assertOut("public static function get foo():int {\n\treturn -1;\n}");
+    }
+
+    @Test
     public void testSetAccessor()
     {
-        IFunctionNode node = getAccessor("function set foo(value:int):void{}");
+        IAccessorNode node = getAccessor("function set foo(value:int):void{}");
         visitor.visitFunction(node);
         assertOut("function set foo(value:int):void {\n}");
     }
@@ -63,11 +78,27 @@ public class TestAccessorMembers extends
     @Test
     public void testSetAccessor_withNamespace()
     {
-        IFunctionNode node = getAccessor("public function set foo(value:int):void{}");
+        IAccessorNode node = getAccessor("public function set foo(value:int):void{}");
         visitor.visitFunction(node);
         assertOut("public function set foo(value:int):void {\n}");
     }
 
+    @Test
+    public void testSetAccessor_withNamespaceOverride()
+    {
+        IAccessorNode node = getAccessor("public override function set foo(value:int):void{}");
+        visitor.visitFunction(node);
+        assertOut("public override function set foo(value:int):void {\n}");
+    }
+
+    @Test
+    public void testSetAccessor_withStatic()
+    {
+        IAccessorNode node = getAccessor("public override function set foo(value:int):void{}");
+        visitor.visitFunction(node);
+        assertOut("public static function set foo(value:int):void {\n}");
+    }
+
     protected IAccessorNode getAccessor(String code)
     {
         String source = "package {public class A {" + code + "}}";

Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java?rev=1423407&r1=1423406&r2=1423407&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
(original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
Tue Dec 18 11:00:10 2012
@@ -173,7 +173,20 @@ public class ASEmitter implements IASEmi
     @Override
     public void emitMethod(IFunctionNode node)
     {
-        emitMethodDocumentation(node);
+        // see below, this is temp, I don't want a bunch of duplicated code
+        // at them moment, subclasses can refine anyways, we are generalizing
+        if (node instanceof IGetterNode)
+        {
+            emitGetAccessorDocumentation((IGetterNode) node);
+        }
+        else if (node instanceof ISetterNode)
+        {
+            emitSetAccessorDocumentation((ISetterNode) node);
+        }
+        else
+        {
+            emitMethodDocumentation(node);
+        }
 
         FunctionNode fn = (FunctionNode) node;
         // XXX (mschmalle) parseFunctionBody() TEMP until I figure out the correct way to
do this



Mime
View raw message