本文整理匯總了Java中org.aikodi.chameleon.oo.statement.Statement類的典型用法代碼示例。如果您正苦於以下問題:Java Statement類的具體用法?Java Statement怎麽用?Java Statement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Statement類屬於org.aikodi.chameleon.oo.statement包,在下文中一共展示了Statement類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visitBlock
import org.aikodi.chameleon.oo.statement.Statement; //導入依賴的package包/類
@Override
public Block visitBlock(BlockContext ctx) {
Block block = new Block();
for(StatementContext sctx: ctx.statement()) {
block.addStatement((Statement) visit(sctx));
}
return block;
}
示例2: analyze
import org.aikodi.chameleon.oo.statement.Statement; //導入依賴的package包/類
@Override
protected void analyze(AssignmentExpression assignment) throws LookupException {
Verification result = Valid.create();
final Method method = assignment.nearestAncestor(Method.class);
if(method != null && method.isTrue(method.language(Java7.class).PUBLIC)) {
Variable v = assignment.variable();
if(v instanceof RegularMemberVariable) {
Expression e = assignment.getValue();
if(e instanceof CrossReference) {
final Declaration rhs = ((CrossReference) e).getElement();
if(rhs instanceof FormalParameter) {
Type booleanType = assignment.view(JavaView.class).primitiveType("boolean");
if(! ((FormalParameter) rhs).getType().sameAs(booleanType)) {
boolean notMentioned = true;
Statement stat = assignment.lexical().farthestAncestor(new UniversalPredicate<Statement,Nothing>(Statement.class) {
@Override
public boolean uncheckedEval(Statement s) {
// If s.parent() == the implementation object, then we have reached the
// block of the implementation, so we have to stop before that to object
// the child statement of the block of the implementation
return (! (s.parent() instanceof Implementation)) && s.nearestAncestor(Method.class) == method;
}
});
Block b = (Block) stat.parent();
List<Statement> befores = b.statementsBefore(stat);
for(Statement before : befores) {
List<CrossReference> crefs = before.descendants(CrossReference.class, cref -> cref.getElement().sameAs(rhs));
if(! crefs.isEmpty()) {
notMentioned = false;
}
}
if(notMentioned) {
result = new NonDefensiveFieldAssignmentResult((FormalParameter)rhs,v);
}
}
}
}
}
}
setResult(result().and(result));
}
示例3: createReturn
import org.aikodi.chameleon.oo.statement.Statement; //導入依賴的package包/類
@Override
public Statement createReturn(Expression expression) {
return new ReturnStatement(expression);
}
示例4: createTryFinally
import org.aikodi.chameleon.oo.statement.Statement; //導入依賴的package包/類
@Override
public Statement createTryFinally(Statement tr, Statement fin) {
TryStatement result = new TryStatement(tr);
result.setFinallyClause(new FinallyClause(fin));
return result;
}
示例5: JavaTryStatement
import org.aikodi.chameleon.oo.statement.Statement; //導入依賴的package包/類
public JavaTryStatement(Statement statement) {
super(statement);
}