This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git


The following commit(s) were added to refs/heads/develop by this push:
     new ebedb4f  BinaryOperatorEmitter: fixed position of coercion end 
(references #74)
ebedb4f is described below

commit ebedb4f018dc4764b2ea245c7f7d1cbb28200333
Author: Josh Tynjala <[email protected]>
AuthorDate: Mon Feb 4 09:45:52 2019 -0800

    BinaryOperatorEmitter: fixed position of coercion end (references #74)
    
    The end of the coercion was incorrectly added outside of the node's 
parentheses. This didn't get noticed before my refactoring because the end of 
the coercion was always ). Now that coercion can end with a different string, 
it became obvious.
---
 .../codegen/js/jx/BinaryOperatorEmitter.java       | 27 +++++++++++-----------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
index ff09dd4..0c164d1 100644
--- 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
+++ 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
@@ -519,18 +519,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter 
implements
                                        }
                                }
             }
-            super_emitBinaryOperator(node, coercionStart);
-                       if (coercionStart != null)
-                       {
-                               if (coercionEnd != null)
-                               {
-                                       write(coercionEnd);
-                               }
-                               else
-                               {
-                                       write(")");
-                               }
-                       }
+            super_emitBinaryOperator(node, coercionStart, coercionEnd);
                
             /*
             IExpressionNode leftSide = node.getLeftOperandNode();
@@ -611,7 +600,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter 
implements
        return false;
     }
 
-    private void super_emitBinaryOperator(IBinaryOperatorNode node, String 
coercionStart)
+    private void super_emitBinaryOperator(IBinaryOperatorNode node, String 
coercionStart, String coercionEnd)
     {
         if (ASNodeUtils.hasParenOpen(node))
             write(ASEmitterTokens.PAREN_OPEN);
@@ -702,6 +691,18 @@ public class BinaryOperatorEmitter extends JSSubEmitter 
implements
                 }
         }
 
+               if (coercionStart != null)
+               {
+                       if (coercionEnd != null)
+                       {
+                               write(coercionEnd);
+                       }
+                       else
+                       {
+                               write(")");
+                       }
+               }
+
         if (ASNodeUtils.hasParenOpen(node))
             write(ASEmitterTokens.PAREN_CLOSE);
     }

Reply via email to