Repository: groovy
Updated Branches:
  refs/heads/master d6bb5b8ff -> fbb2ae857


GROOVY-7737 Provide static methods in GeneralUtils


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

Branch: refs/heads/master
Commit: 5b3e659326dd9004e00e76bc15ea05b05ecc2afb
Parents: d6bb5b8
Author: asa <[email protected]>
Authored: Fri Jan 29 16:50:03 2016 +0100
Committer: paulk <[email protected]>
Committed: Wed Feb 3 14:47:45 2016 +1000

----------------------------------------------------------------------
 src/main/org/codehaus/groovy/ast/tools/GeneralUtils.java | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/5b3e6593/src/main/org/codehaus/groovy/ast/tools/GeneralUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/ast/tools/GeneralUtils.java 
b/src/main/org/codehaus/groovy/ast/tools/GeneralUtils.java
index 9d8508f..1236e7b 100644
--- a/src/main/org/codehaus/groovy/ast/tools/GeneralUtils.java
+++ b/src/main/org/codehaus/groovy/ast/tools/GeneralUtils.java
@@ -48,11 +48,13 @@ import 
org.codehaus.groovy.ast.expr.StaticMethodCallExpression;
 import org.codehaus.groovy.ast.expr.TernaryExpression;
 import org.codehaus.groovy.ast.expr.VariableExpression;
 import org.codehaus.groovy.ast.stmt.BlockStatement;
+import org.codehaus.groovy.ast.stmt.CatchStatement;
 import org.codehaus.groovy.ast.stmt.EmptyStatement;
 import org.codehaus.groovy.ast.stmt.ExpressionStatement;
 import org.codehaus.groovy.ast.stmt.IfStatement;
 import org.codehaus.groovy.ast.stmt.ReturnStatement;
 import org.codehaus.groovy.ast.stmt.Statement;
+import org.codehaus.groovy.ast.stmt.ThrowStatement;
 import org.codehaus.groovy.classgen.Verifier;
 import org.codehaus.groovy.control.io.ReaderSource;
 import org.codehaus.groovy.runtime.GeneratedClosure;
@@ -640,6 +642,14 @@ public class GeneralUtils {
         return new VariableExpression(name, type);
     }
 
+    public static ThrowStatement throwS(Expression expr) {
+        return new ThrowStatement(expr);
+    }
+
+    public static CatchStatement catchS(Parameter variable, Statement code) {
+        return new CatchStatement(variable, code);
+    }
+
     /**
      * This method is similar to {@link #propX(Expression, Expression)} but 
will make sure that if the property
      * being accessed is defined inside the classnode provided as a parameter, 
then a getter call is generated

Reply via email to