You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/06/24 12:57:20 UTC

groovy git commit: Make EmptyExpression and EmptyStatement singleton and immutatble further

Repository: groovy
Updated Branches:
  refs/heads/master aeb4184ba -> d02c15545


Make EmptyExpression and EmptyStatement singleton and immutatble further


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

Branch: refs/heads/master
Commit: d02c15545f9251a903120beee75aebc2e5446265
Parents: aeb4184
Author: sunlan <su...@apache.org>
Authored: Sat Jun 24 20:57:10 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Sat Jun 24 20:57:10 2017 +0800

----------------------------------------------------------------------
 .../codehaus/groovy/transform/tailrec/InWhileLoopWrapper.groovy  | 2 +-
 .../groovy/transform/SingletonASTTransformationTest.java         | 2 +-
 .../groovy/transform/tailrec/StatementReplacerTest.groovy        | 4 ++--
 .../transform/tailrec/VariableExpressionReplacerTest.groovy      | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/d02c1554/src/main/org/codehaus/groovy/transform/tailrec/InWhileLoopWrapper.groovy
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/transform/tailrec/InWhileLoopWrapper.groovy b/src/main/org/codehaus/groovy/transform/tailrec/InWhileLoopWrapper.groovy
index 0fe2baa..981f146 100644
--- a/src/main/org/codehaus/groovy/transform/tailrec/InWhileLoopWrapper.groovy
+++ b/src/main/org/codehaus/groovy/transform/tailrec/InWhileLoopWrapper.groovy
@@ -53,7 +53,7 @@ class InWhileLoopWrapper {
 		BlockStatement oldBody = method.code as BlockStatement
         TryCatchStatement tryCatchStatement = new TryCatchStatement(
                 oldBody,
-                new EmptyStatement()
+                EmptyStatement.INSTANCE
         )
         tryCatchStatement.addCatch(new CatchStatement(
                 new Parameter(ClassHelper.make(GotoRecurHereException), 'ignore'),

http://git-wip-us.apache.org/repos/asf/groovy/blob/d02c1554/src/test/org/codehaus/groovy/transform/SingletonASTTransformationTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/transform/SingletonASTTransformationTest.java b/src/test/org/codehaus/groovy/transform/SingletonASTTransformationTest.java
index 29f43f5..c9c748e 100644
--- a/src/test/org/codehaus/groovy/transform/SingletonASTTransformationTest.java
+++ b/src/test/org/codehaus/groovy/transform/SingletonASTTransformationTest.java
@@ -36,7 +36,7 @@ public class SingletonASTTransformationTest {
         try {
             ASTNode[] badInput = new ASTNode[]{
                     new ConstantExpression("sample"),
-                    new EmptyExpression()
+                    EmptyExpression.INSTANCE
             };
             new SingletonASTTransformation().visit(badInput, null);
             Assert.fail("Contract Failure");

http://git-wip-us.apache.org/repos/asf/groovy/blob/d02c1554/src/test/org/codehaus/groovy/transform/tailrec/StatementReplacerTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/transform/tailrec/StatementReplacerTest.groovy b/src/test/org/codehaus/groovy/transform/tailrec/StatementReplacerTest.groovy
index 6abbebe..2377ed0 100644
--- a/src/test/org/codehaus/groovy/transform/tailrec/StatementReplacerTest.groovy
+++ b/src/test/org/codehaus/groovy/transform/tailrec/StatementReplacerTest.groovy
@@ -118,7 +118,7 @@ class StatementReplacerTest {
     public void replaceIfBlock() {
         def toReplace = aReturnStatement("old")
         def replacement = aReturnStatement("new")
-        def ifStatement = new IfStatement(aBooleanExpression(true), toReplace, new EmptyStatement())
+        def ifStatement = new IfStatement(aBooleanExpression(true), toReplace, EmptyStatement.INSTANCE)
 
         replacements[toReplace] = replacement
         replacer.replaceIn(ifStatement)
@@ -130,7 +130,7 @@ class StatementReplacerTest {
     public void replaceElseBlock() {
         def toReplace = aReturnStatement("old")
         def replacement = aReturnStatement("new")
-        def ifStatement = new IfStatement(aBooleanExpression(true), new EmptyStatement(), toReplace)
+        def ifStatement = new IfStatement(aBooleanExpression(true), EmptyStatement.INSTANCE, toReplace)
 
         replacements[toReplace] = replacement
         replacer.replaceIn(ifStatement)

http://git-wip-us.apache.org/repos/asf/groovy/blob/d02c1554/src/test/org/codehaus/groovy/transform/tailrec/VariableExpressionReplacerTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/transform/tailrec/VariableExpressionReplacerTest.groovy b/src/test/org/codehaus/groovy/transform/tailrec/VariableExpressionReplacerTest.groovy
index 06cfdfe..bb7bd0f 100644
--- a/src/test/org/codehaus/groovy/transform/tailrec/VariableExpressionReplacerTest.groovy
+++ b/src/test/org/codehaus/groovy/transform/tailrec/VariableExpressionReplacerTest.groovy
@@ -182,7 +182,7 @@ class VariableExpressionReplacerTest {
 
 
     def anEmptyStatement() {
-        new EmptyStatement()
+        EmptyStatement.INSTANCE
     }
 
     def aConstant(value) {