本文整理汇总了Java中spoon.reflect.code.CtStatementList类的典型用法代码示例。如果您正苦于以下问题:Java CtStatementList类的具体用法?Java CtStatementList怎么用?Java CtStatementList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CtStatementList类属于spoon.reflect.code包,在下文中一共展示了CtStatementList类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: removeAssertion
点赞 3
import spoon.reflect.code.CtStatementList; //导入依赖的package包/类
public void removeAssertion(CtInvocation<?> invocation) {
final Factory factory = invocation.getFactory();
invocation.getArguments().forEach(argument -> {
CtExpression clone = ((CtExpression) argument).clone();
if (clone instanceof CtUnaryOperator) {
clone = ((CtUnaryOperator) clone).getOperand();
}
if (clone instanceof CtStatement) {
invocation.insertBefore((CtStatement) clone);
} else if (! (clone instanceof CtLiteral || clone instanceof CtVariableRead)) {
CtTypeReference<?> typeOfParameter = clone.getType();
if (clone.getType().equals(factory.Type().NULL_TYPE)) {
typeOfParameter = factory.Type().createReference(Object.class);
}
final CtLocalVariable localVariable = factory.createLocalVariable(
typeOfParameter,
typeOfParameter.getSimpleName() + "_" + counter[0]++,
clone
);
invocation.insertBefore(localVariable);
}
});
invocation.getParent(CtStatementList.class).removeStatement(invocation);
}
开发者ID:STAMP-project,
项目名称:dspot,
代码行数:25,
代码来源:AssertionRemover.java
示例2: isLastStatementOfMethod
点赞 3
import spoon.reflect.code.CtStatementList; //导入依赖的package包/类
public static boolean isLastStatementOfMethod(CtStatement statement) {
CtElement statementParent = statement.getParent();
if (!isStatementList(statementParent)) {
return isLastStatementOfMethod((CtStatement) statementParent);
}
CtStatementList block = (CtStatementList) statementParent;
if (isLastStatementOf(block, statement)) {
CtElement blockParent = block.getParent();
if (isStatement(blockParent)) {
return isLastStatementOfMethod((CtStatement) blockParent);
} else {
return isMethod(blockParent);
}
}
return false;
}
开发者ID:SpoonLabs,
项目名称:nopol,
代码行数:17,
代码来源:SpoonStatementLibrary.java
示例3: containsOnlyReturn
点赞 2
import spoon.reflect.code.CtStatementList; //导入依赖的package包/类
protected boolean containsOnlyReturn(CtStatement stmt) {
if(stmt instanceof CtStatementList) {
CtStatementList list = (CtStatementList) stmt;
return list.getStatements().size() == 1 && list.getStatements().get(0) instanceof CtReturn;
} else {
return stmt instanceof CtReturn;
}
}
开发者ID:DIVERSIFY-project,
项目名称:sosiefier,
代码行数:9,
代码来源:JsonRemoveParameterConditionInput.java
示例4: isLastStatementOf
点赞 2
import spoon.reflect.code.CtStatementList; //导入依赖的package包/类
public static boolean isLastStatementOf(CtStatementList block, CtStatement statement) {
List<CtStatement> statements = block.getStatements();
CtStatement lastStatement = MetaList.last(statements);
return lastStatement == statement;
}
开发者ID:SpoonLabs,
项目名称:nopol,
代码行数:6,
代码来源:SpoonStatementLibrary.java
示例5: isToIgnore
点赞 1
import spoon.reflect.code.CtStatementList; //导入依赖的package包/类
/**
* Ignore some element from the AST
* @param element
* @return
*/
private boolean isToIgnore(CtElement element) {
return element.isImplicit() || element instanceof CtReference || element instanceof CtStatementList;
}
开发者ID:SpoonLabs,
项目名称:gumtree-spoon-ast-diff,
代码行数:9,
代码来源:TreeScanner.java