Package org.codehaus.groovy.classgen
Class ReturnAdder
java.lang.Object
org.codehaus.groovy.classgen.ReturnAdder
Utility class to add return statements.
Extracted from Verifier as it can be useful for some AST transformations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceListener notified when a synthetic return statement is created. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new return adder that adds return statements to methods.Creates a new return adder with a listener. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddReturnIfNeeded(MethodNode node) Deprecated.voidvisitMethod(MethodNode node) Adds return statements to given method whenever an implicit return is detected.
-
Constructor Details
-
ReturnAdder
public ReturnAdder()Creates a new return adder that adds return statements to methods. -
ReturnAdder
Creates a new return adder with a listener. Returns are not actually added when using a listener; instead, the listener is notified of what return statements would be added.- Parameters:
listener- the listener to notify of return statement additions
-
-
Method Details
-
addReturnIfNeeded
Deprecated.UsevisitMethod(MethodNode)instead.Adds return statements to a method whenever an implicit return is detected.- Parameters:
node- the method to process
-
visitMethod
Adds return statements to given method whenever an implicit return is detected.- Parameters:
node- the method node to visit and add returns to
-
visitMethod(MethodNode)instead.