本文整理汇总了Java中japa.parser.ast.stmt.ExpressionStmt类的典型用法代码示例。如果您正苦于以下问题:Java ExpressionStmt类的具体用法?Java ExpressionStmt怎么用?Java ExpressionStmt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpressionStmt类属于japa.parser.ast.stmt包,在下文中一共展示了ExpressionStmt类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: extractFixtureCalls
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
private ArrayList<FixtureCall> extractFixtureCalls(UseCase useCase,MethodDeclaration methodDeclaration) {
ArrayList<FixtureCall> fixtureCalls = new ArrayList<FixtureCall>();
if( methodDeclaration.getBody().getStmts() == null){
System.err.println("In class "+javaClass.getCanonicalName()+" method " + methodDeclaration.getName() + " don't have any fixture call.");
return fixtureCalls;
}
int line = methodDeclaration.getBody().getBeginLine();
for (Statement stmt : methodDeclaration.getBody().getStmts()) {
if (stmt instanceof ExpressionStmt) {
Expression expr = ((ExpressionStmt) stmt).getExpression();
if (expr instanceof MethodCallExpr) {
final int emptyLines = stmt.getBeginLine() - 1 - line;
fixtureCalls.add(extractFixtureCall(useCase, (MethodCallExpr) expr,emptyLines));
line= stmt.getBeginLine();
}
}
}
return fixtureCalls;
}
开发者ID:slezier,项目名称:SimpleFunctionalTest,代码行数:20,代码来源:UseCaseJavaParser.java
示例2: findRootAssignExpr
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
private static AssignExpr findRootAssignExpr(BlockStmt body) {
if (body.getStmts() != null) {
for (Statement s : body.getStmts()) {
if (s instanceof ExpressionStmt) {
ExpressionStmt est = (ExpressionStmt) s;
if (est.getExpression() instanceof AssignExpr) {
AssignExpr ass = (AssignExpr) est.getExpression();
if (ass.getTarget() instanceof FieldAccessExpr) {
FieldAccessExpr fae = (FieldAccessExpr) ass.getTarget();
if ("root".equals(fae.getField())) {
return ass;
}
}
}
}
}
}
return null;
}
开发者ID:ahn,项目名称:mideaas,代码行数:20,代码来源:JavaUtil.java
示例3: addAttachSkeleton
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
private void addAttachSkeleton() {
List<Parameter> params = Collections.emptyList();
MethodDeclaration method = new MethodDeclaration(
ModifierSet.PUBLIC, new VoidType(), "attach", params);
AnnotationExpr override = new MarkerAnnotationExpr(new NameExpr("Override"));
method.setAnnotations(Collections.singletonList(override));
BlockStmt block = new BlockStmt();
Expression e = new MethodCallExpr(new SuperExpr(), "attach");
List<Statement> sts = Collections.singletonList((Statement)new ExpressionStmt(e));
block.setStmts(sts);
method.setBody(block);
if (getType().getMembers()==null) {
getType().setMembers(new LinkedList<BodyDeclaration>());
}
getType().getMembers().add(method);
}
开发者ID:ahn,项目名称:mideaas,代码行数:19,代码来源:ControllerCode.java
示例4: addOnBecomingVisibleMethod
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
@SuppressWarnings("unused")
private void addOnBecomingVisibleMethod() {
List<Parameter> params = Collections.emptyList();
MethodDeclaration method = new MethodDeclaration(
ModifierSet.PUBLIC, new VoidType(), "onBecomingVisible", params);
AnnotationExpr override = new MarkerAnnotationExpr(new NameExpr("Override"));
method.setAnnotations(Collections.singletonList(override));
BlockStmt block = new BlockStmt();
Expression e = new MethodCallExpr(new SuperExpr(), "onBecomingVisible");
List<Statement> sts = Collections.singletonList((Statement)new ExpressionStmt(e));
block.setStmts(sts);
method.setBody(block);
if (getType().getMembers()==null) {
getType().setMembers(new LinkedList<BodyDeclaration>());
}
getType().getMembers().add(method);
}
开发者ID:ahn,项目名称:mideaas,代码行数:20,代码来源:ControllerCode.java
示例5: visit
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
/**
* Transform a yield.
*/
@Override
public void visit(YieldStmt n, Generator s) {
// Remember the state to add the deferred jump to.
int entryState = s.getCurrentState();
s.newState();
s.addStatement(entryState, Generator.generateDeferredJump(s.getCurrentState()));
s.addStatement(entryState, new ExpressionStmt(new AssignExpr(Generator.CURRENT_VAR,
n.getExpr(),
AssignExpr.Operator.assign)));
s.addStatement(entryState, new ReturnStmt(new BooleanLiteralExpr(true)));
}
开发者ID:rfw,项目名称:genja,代码行数:16,代码来源:LinearizeTransform.java
示例6: visit
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
@Override
public Node visit(ExpressionStmt n, Map<String, TypedVariableDeclarator> arg) {
Node r = n.getExpression().accept(this, arg);
if (n.getExpression() instanceof VariableDeclarationExpr) {
// Rewrite variable declarations -- we have to turn them into
// sepcial things.
VariableDeclarationExpr expr = (VariableDeclarationExpr) n.getExpression();
List<Statement> assigns = new ArrayList<Statement>();
for (VariableDeclarator d : expr.getVars()) {
if (d.getInit() != null){
assigns.add(new ExpressionStmt(new AssignExpr(new NameExpr(this.block.getScopePrefix() + d.getId().getName()),
d.getInit(),
AssignExpr.Operator.assign)));
}
}
if (assigns.size() == 0) {
return null;
}
if (assigns.size() == 1) {
return assigns.get(0);
}
return new BlockStmt(assigns);
}
if (r == null) {
return null;
}
return new ExpressionStmt((Expression) r);
}
开发者ID:rfw,项目名称:genja,代码行数:35,代码来源:ScopeMangleTransform.java
示例7: visit
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
public Boolean visit(ExpressionStmt n1, Node arg) {
ExpressionStmt n2 = (ExpressionStmt) arg;
if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:EqualsVisitor.java
示例8: addNotification
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
private void addNotification(MethodDeclaration method, String text) {
MethodCallExpr e = new MethodCallExpr(new NameExpr("Notification"), "show");
e.setArgs(Collections.singletonList((Expression)new StringLiteralExpr(text)));
Statement statement = new ExpressionStmt(e);
addToMethod(method, statement);
ensureImport("com.vaadin.ui.Notification");
}
开发者ID:ahn,项目名称:mideaas,代码行数:8,代码来源:ControllerCode.java
示例9: visit
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
@Override
public Boolean visit(ExpressionStmt n, Void arg) {
return false;
}
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:NodeAnnotator.java
示例10: generateDeferredJump
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
/**
* Generate a deferred jump. This sets the state to a given state number, but doesn't perform
* the jump.
*/
public static Statement generateDeferredJump(int state) {
return new ExpressionStmt(new AssignExpr(STATE_VAR,
new IntegerLiteralExpr("" + state),
AssignExpr.Operator.assign));
}
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:Generator.java
示例11: visit
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
@Override
public void visit(ExpressionStmt n, Scope arg) {
super.visit(n, arg);
n.setData(arg);
}
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:ScopeCollector.java
示例12: visit
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
@Override
public void visit(ExpressionStmt n, Void arg) {
n.getExpression().accept(new ExpressionAnalysis(), null);
}
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:SemanticAnalysis.java
示例13: visit
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
public R visit(ExpressionStmt n, A arg) {
n.getExpression().accept(this, arg);
return null;
}
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:GenericVisitorAdapter.java
示例14: visit
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
public void visit(ExpressionStmt n, Object arg) {
n.getExpression().accept(this, arg);
printer.print(";");
}
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:DumpVisitor.java
示例15: visit
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
public void visit(ExpressionStmt n, A arg) {
n.getExpression().accept(this, arg);
}
开发者ID:rfw,项目名称:genja,代码行数:4,代码来源:VoidVisitorAdapter.java
示例16: visit
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
public Node visit(ExpressionStmt n, A arg) {
n.setExpression((Expression) n.getExpression().accept(this, arg));
return n;
}
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:ModifierVisitorAdapter.java
示例17: visit
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
@Override
public void visit(ExpressionStmt n, Object arg) {
doTest(source, n);
super.visit(n, arg);
}
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:TestNodePositions.java
示例18: visitPre
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
@Override
public void visitPre(ExpressionStmt n, A arg) {
}
开发者ID:kuali,项目名称:kc-rice,代码行数:5,代码来源:VoidVisitorHelperBase.java
示例19: visitPost
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
@Override
public void visitPost(ExpressionStmt n, A arg) {
}
开发者ID:kuali,项目名称:kc-rice,代码行数:5,代码来源:VoidVisitorHelperBase.java
示例20: addStmt
import japa.parser.ast.stmt.ExpressionStmt; //导入依赖的package包/类
/**
* Adds the given expression to the specified block. The list of statements
* will be initialized if it is <code>null</code>.
*
* @param block
* @param stmt
*/
public static void addStmt(BlockStmt block, Expression expr) {
addStmt(block, new ExpressionStmt(expr));
}
开发者ID:rfw,项目名称:genja,代码行数:11,代码来源:ASTHelper.java
注:本文中的japa.parser.ast.stmt.ExpressionStmt类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论