Java Code Examples for spoon.reflect.code.CtReturn#getReturnedExpression()

The following examples show how to use spoon.reflect.code.CtReturn#getReturnedExpression() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReturnReplacementOperatorMetaMutator.java    From metamutator with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isToBeProcessed(CtReturn element) {
	try {
		Selector.getTopLevelClass(element);
	} catch (NullPointerException e) {
		return false;
	}
	return (element.getReturnedExpression() != null && !element.getReturnedExpression().getType().getSimpleName().equals("Boolean"));
}
 
Example 2
Source File: TransformStrategy.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public <R> void visitCtReturn(CtReturn<R> returnStatement) {
	super.visitCtReturn(returnStatement);
	
	CtExpression exper=returnStatement.getReturnedExpression();
	if (candidates.containsKey(exper)) {
		returnStatement.setReturnedExpression(candidates.get(exper));
		saveSketchAndSynthesize();
		returnStatement.setReturnedExpression(exper);
		resoreDiskFile();
	}
}