groovy git commit: GROOVY-8835: AstNodeToScriptVisitor - no operation token needed in the case of an EmptyStatement

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

groovy git commit: GROOVY-8835: AstNodeToScriptVisitor - no operation token needed in the case of an EmptyStatement

paulk
Repository: groovy
Updated Branches:
  refs/heads/master d0707a2db -> 257e54588


GROOVY-8835: AstNodeToScriptVisitor - no operation token needed in the case of an EmptyStatement


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/257e5458
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/257e5458
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/257e5458

Branch: refs/heads/master
Commit: 257e54588e2836b2ca8b33cf452e4ca3b2efd93c
Parents: d0707a2
Author: Paul King <[hidden email]>
Authored: Thu Oct 11 15:24:25 2018 +1000
Committer: Paul King <[hidden email]>
Committed: Thu Oct 11 15:25:04 2018 +1000

----------------------------------------------------------------------
 .../groovy/inspect/swingui/AstNodeToScriptAdapter.groovy | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/257e5458/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstNodeToScriptAdapter.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstNodeToScriptAdapter.groovy b/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstNodeToScriptAdapter.groovy
index a0d0259..849bfb2 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstNodeToScriptAdapter.groovy
+++ b/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstNodeToScriptAdapter.groovy
@@ -97,6 +97,7 @@ import org.codehaus.groovy.control.CompilationUnit.PrimaryClassNodeOperation
 import org.codehaus.groovy.control.CompilePhase
 import org.codehaus.groovy.control.CompilerConfiguration
 import org.codehaus.groovy.control.SourceUnit
+import org.codehaus.groovy.syntax.Types
 
 import java.lang.reflect.Modifier
 import java.security.CodeSource
@@ -734,11 +735,13 @@ class AstNodeToScriptVisitor extends PrimaryClassNodeOperation implements Groovy
     @Override
     void visitBinaryExpression(BinaryExpression expression) {
         expression?.leftExpression?.visit this
-        print " $expression.operation.text "
-        expression.rightExpression.visit this
+        if (!(expression.rightExpression instanceof EmptyExpression) || expression.operation.type != Types.ASSIGN) {
+            print " $expression.operation.text "
+            expression.rightExpression.visit this
 
-        if (expression?.operation?.text == '[') {
-            print ']'
+            if (expression?.operation?.text == '[') {
+                print ']'
+            }
         }
     }