Created
February 26, 2016 15:12
-
-
Save nanonull/ebfd66d67e15d520b05c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def methodThatCreatesAst(Statement statementToWrap) { | |
BlockStatement methodBody = new BlockStatement() | |
methodBody.addStatement(new TryCatchStatement( | |
// try | |
statementToWrap, | |
// finally | |
new ExpressionStatement( | |
new MethodCallExpression( | |
new ConstantExpression("myVar") | |
, "myMethod" | |
, new ArgumentListExpression() | |
) | |
) | |
)) | |
return methodBody | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment