當前位置: 首頁>>代碼示例>>Java>>正文


Java Statement類代碼示例

本文整理匯總了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;
}
 
開發者ID:markovandooren,項目名稱:jlo,代碼行數:9,代碼來源:JLoConvertor.java

示例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));
}
 
開發者ID:markovandooren,項目名稱:jnome,代碼行數:42,代碼來源:NonDefensiveFieldAssignment.java

示例3: createReturn

import org.aikodi.chameleon.oo.statement.Statement; //導入依賴的package包/類
@Override
public Statement createReturn(Expression expression) {
	return new ReturnStatement(expression);
}
 
開發者ID:markovandooren,項目名稱:jnome,代碼行數:5,代碼來源:Java7Factory.java

示例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;
}
 
開發者ID:markovandooren,項目名稱:jnome,代碼行數:7,代碼來源:Java7Factory.java

示例5: JavaTryStatement

import org.aikodi.chameleon.oo.statement.Statement; //導入依賴的package包/類
public JavaTryStatement(Statement statement) {
	super(statement);
}
 
開發者ID:markovandooren,項目名稱:jnome,代碼行數:4,代碼來源:JavaTryStatement.java


注:本文中的org.aikodi.chameleon.oo.statement.Statement類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。