flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1453554 - in /flex/falcon/trunk: compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestParenthesis.java compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java
Date Wed, 06 Mar 2013 20:56:03 GMT
Author: mschmalle
Date: Wed Mar  6 20:56:03 2013
New Revision: 1453554

URL: http://svn.apache.org/r1453554
Log:
Flex:FalconJx
- Fixed parenthesis issue, didn't realize a flag is passed to a binary from the parser

Modified:
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestParenthesis.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestParenthesis.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestParenthesis.java?rev=1453554&r1=1453553&r2=1453554&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestParenthesis.java
(original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestParenthesis.java
Wed Mar  6 20:56:03 2013
@@ -35,7 +35,7 @@ public class TestParenthesis extends AST
         IVariableNode node = (IVariableNode) getNode("var a = (a + b);",
                 IVariableNode.class);
         asBlockWalker.visitVariable(node);
-        assertOut("var a:* = a + b");
+        assertOut("var a:* = (a + b)");
     }
 
     @Test
@@ -53,7 +53,7 @@ public class TestParenthesis extends AST
         IBinaryOperatorNode node = (IBinaryOperatorNode) getNode(
                 "a = (a + b) - c + d * e;", IBinaryOperatorNode.class);
         asBlockWalker.visitBinaryOperator(node);
-        assertOut("a = (((a + b) - c) + (d * e))");
+        assertOut("a = (a + b) - c + d * e");
     }
 
     @Test
@@ -62,7 +62,7 @@ public class TestParenthesis extends AST
         IBinaryOperatorNode node = (IBinaryOperatorNode) getNode(
                 "a = ((a + b) - (c + d)) * e;", IBinaryOperatorNode.class);
         asBlockWalker.visitBinaryOperator(node);
-        assertOut("a = (((a + b) - (c + d)) * e)");
+        assertOut("a = ((a + b) - (c + d)) * e");
     }
 
     @Test
@@ -80,8 +80,8 @@ public class TestParenthesis extends AST
         // this is a whacked test but is just proves the logic that for now, 
         // we only leave out parens for String literals on the right hand side
         IBinaryOperatorNode node = (IBinaryOperatorNode) getNode(
-                "a = ('' + 2 + '' + '') * 4 ", IBinaryOperatorNode.class);
+                "a = '' + 2 + '' + '' * 4 ", IBinaryOperatorNode.class);
         asBlockWalker.visitBinaryOperator(node);
-        assertOut("a = (('' + 2) + '' + '' * 4)");
+        assertOut("a = '' + 2 + '' + '' * 4");
     }
 }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java?rev=1453554&r1=1453553&r2=1453554&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java Wed
Mar  6 20:56:03 2013
@@ -74,14 +74,16 @@ public class ASNodeUtils
 
     public static boolean hasParenOpen(IBinaryOperatorNode node)
     {
-        return node.getParent() instanceof IBinaryOperatorNode
-                && !ASNodeUtils.isString(node.getRightOperandNode());
+        return node.hasParenthesis();
+        //return node.getParent() instanceof IBinaryOperatorNode
+        //        && !ASNodeUtils.isString(node.getRightOperandNode());
     }
     
     public static boolean hasParenClose(IBinaryOperatorNode node)
     {
-        return node.getParent() instanceof IBinaryOperatorNode
-                && !ASNodeUtils.isString(node.getRightOperandNode());
+        return node.hasParenthesis();
+        //return node.getParent() instanceof IBinaryOperatorNode
+        //        && !ASNodeUtils.isString(node.getRightOperandNode());
     }
 
     public static boolean isString(IExpressionNode node)



Mime
View raw message