Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Flex:FalconJx

- Fixed parenthesis issue, didn't realize a flag is passed to a binary from the parser

git-svn-id: https://svn.apache.org/repos/asf/flex/falcon/trunk@1453554 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 0fea6b65b040febcb2547992021d92777665076f 1 parent c82f6a0
Michael Schmalle authored
10 compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestParenthesis.java
View
@@ -35,7 +35,7 @@ public void testParentheses_1()
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 void testParentheses_3()
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 void testParentheses_4()
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 void testParentheses_Strings2()
// 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");
}
}
10 compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java
View
@@ -74,14 +74,16 @@ public static final ITerminalNode getDefaultNode(ISwitchNode node)
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)
Please sign in to comment.
Something went wrong with that request. Please try again.