flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erikdebr...@apache.org
Subject [04/11] git commit: [flex-falcon] [refs/heads/develop] - Fixed old TODO: handle parsing of 'rest' parameter.
Date Tue, 05 Nov 2013 12:45:30 GMT
Fixed old TODO: handle parsing of 'rest' parameter.

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

Branch: refs/heads/develop
Commit: 15f1e13979fab1e8f20087c3cfed57a8e7ae9b59
Parents: fa7b340
Author: Erik de Bruin <erik@ixsoftware.nl>
Authored: Sun Nov 3 10:54:49 2013 +0100
Committer: Erik de Bruin <erik@ixsoftware.nl>
Committed: Tue Nov 5 07:15:07 2013 +0100

----------------------------------------------------------------------
 .../internal/codegen/as/TestMethodMembers.java  |  7 +++---
 .../compiler/internal/codegen/as/ASEmitter.java | 24 +++++++++++++-------
 2 files changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15f1e139/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestMethodMembers.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestMethodMembers.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestMethodMembers.java
index fda88cc..ce4316f 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestMethodMembers.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestMethodMembers.java
@@ -97,13 +97,12 @@ public class TestMethodMembers extends ASTestBase
         assertOut("function foo(bar:String, baz:int = null):int {\n\treturn -1;\n}");
     }
 
-    // TODO (mschmalle) handle ...rest parameter correctly
     @Test
     public void testMethod_withRestParameterTypeReturnType()
     {
-//        IFunctionNode node = getMethod("function foo(bar:String, ...rest):int{\treturn
-1;}");
-//        asBlockWalker.visitFunction(node);
-//        assertOut("function foo(bar:String, ...rest):int {\n\treturn -1;\n}");
+        IFunctionNode node = getMethod("function foo(bar:String, ...rest):int{\treturn -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("function foo(bar:String, ...rest):int {\n\treturn -1;\n}");
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15f1e139/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
index 3db6b55..f634e60 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
@@ -739,15 +739,23 @@ public class ASEmitter implements IASEmitter, IEmitter
     @Override
     public void emitParameter(IParameterNode node)
     {
-        getWalker().walk(node.getNameExpressionNode());
-        write(ASEmitterTokens.COLON);
-        getWalker().walk(node.getVariableTypeNode());
-        IExpressionNode anode = node.getAssignedValueNode();
-        if (anode != null)
+        if (node.isRest())
         {
-            write(ASEmitterTokens.SPACE);
-            writeToken(ASEmitterTokens.EQUAL);
-            getWalker().walk(anode);
+            write(ASEmitterTokens.ELLIPSIS);
+            write(node.getName());
+        }
+        else
+        {
+            getWalker().walk(node.getNameExpressionNode());
+            write(ASEmitterTokens.COLON);
+            getWalker().walk(node.getVariableTypeNode());
+            IExpressionNode anode = node.getAssignedValueNode();
+            if (anode != null)
+            {
+                write(ASEmitterTokens.SPACE);
+                writeToken(ASEmitterTokens.EQUAL);
+                getWalker().walk(anode);
+            }
         }
     }
 


Mime
View raw message