本文整理汇总了Java中japa.parser.ast.stmt.ReturnStmt类的典型用法代码示例。如果您正苦于以下问题:Java ReturnStmt类的具体用法?Java ReturnStmt怎么用?Java ReturnStmt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReturnStmt类属于japa.parser.ast.stmt包,在下文中一共展示了ReturnStmt类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addStatement
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
/**
* Add a statement to the given state.
*/
void addStatement(int state, Statement stmt) {
List<Statement> stmts = this.states.get(state).getStmts();
if (stmts.size() > 0) {
Statement lastStmt = stmts.get(stmts.size() - 1);
// Preemptively eliminate dead code.
if (lastStmt.getClass().equals(ReturnStmt.class) ||
lastStmt.getClass().equals(ThrowStmt.class) ||
lastStmt.getClass().equals(BreakStmt.class) ||
lastStmt.getClass().equals(ContinueStmt.class)) {
return;
}
}
stmts.add(stmt);
}
开发者ID:rfw,项目名称:genja,代码行数:20,代码来源:Generator.java
示例2: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的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
示例3: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
public Boolean visit(ReturnStmt n1, Node arg) {
ReturnStmt n2 = (ReturnStmt) arg;
if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:EqualsVisitor.java
示例4: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
public void visit(ReturnStmt n, Object arg) {
printer.print("return");
if (n.getExpr() != null) {
printer.print(" ");
n.getExpr().accept(this, arg);
}
printer.print(";");
}
开发者ID:rfw,项目名称:genja,代码行数:9,代码来源:DumpVisitor.java
示例5: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
@Override
public MethodDeclaration visit(MethodDeclaration n, Void arg) {
if (!n.isGenerator()) {
throw new UnsupportedOperationException("cannot transform non-generator");
}
// Desugar ALL the loops!
n.accept(new LoopDesugarTransform(), null);
if (CompilerSettings.dumpDesugar) {
System.err.println(n);
}
Generator g = new Generator();
Map<String, TypedVariableDeclarator> vars = new HashMap<String, TypedVariableDeclarator>();
// Mangle all our scope variables.
n.accept(new ScopeMangleTransform(), vars);
if (CompilerSettings.dumpMangle) {
System.err.println(n);
}
// Generate the body.
n.accept(new LinearizeTransform(), g);
List<BodyDeclaration> generatorBody = new ArrayList<BodyDeclaration>();
// Add the fields to the generator body.
for (Map.Entry<String, TypedVariableDeclarator> kv : vars.entrySet()) {
VariableDeclarator decl = new VariableDeclarator(new VariableDeclaratorId(kv.getKey()), null);
generatorBody.add(new FieldDeclaration(ModifierSet.PRIVATE, kv.getValue().type, decl));
}
// Add the moveNext method to the generator body.
generatorBody.add(new MethodDeclaration(0, 0, 0, 0, null, ModifierSet.PROTECTED,
null, null, new PrimitiveType(Primitive.Boolean),
"moveNext", null, 0, null, false,
new BlockStmt(g.generate())));
ObjectCreationExpr o = new ObjectCreationExpr(0, 0, 0, 0, null, makeRtGeneratorType(n.getType()), null, null, generatorBody);
List<Statement> methodBody = new ArrayList<Statement>();
methodBody.add(new ReturnStmt(o));
MethodDeclaration n2 = new MethodDeclaration(n.getBeginLine(),
n.getBeginColumn(),
n.getEndLine(),
n.getEndColumn(),
n.getJavaDoc(),
n.getModifiers(),
n.getAnnotations(),
n.getTypeParameters(),
makeRtGeneratorType(n.getType()),
n.getName(),
n.getParameters(),
n.getArrayCount(),
n.getThrows(),
false,
new BlockStmt(methodBody));
return n2;
}
开发者ID:rfw,项目名称:genja,代码行数:60,代码来源:GeneratorTransform.java
示例6: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
@Override
public Boolean visit(ReturnStmt n, Void arg) {
NodeAnnotation nodeAnnotation = new NodeAnnotation(true);
n.setData(nodeAnnotation);
return true;
}
开发者ID:rfw,项目名称:genja,代码行数:7,代码来源:NodeAnnotator.java
示例7: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
@Override
public void visit(ReturnStmt n, Scope arg) {
super.visit(n, arg);
n.setData(arg);
}
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:ScopeCollector.java
示例8: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
public R visit(ReturnStmt n, A arg) {
if (n.getExpr() != null) {
n.getExpr().accept(this, arg);
}
return null;
}
开发者ID:rfw,项目名称:genja,代码行数:7,代码来源:GenericVisitorAdapter.java
示例9: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
public void visit(ReturnStmt n, A arg) {
if (n.getExpr() != null) {
n.getExpr().accept(this, arg);
}
}
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:VoidVisitorAdapter.java
示例10: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
public Node visit(ReturnStmt n, A arg) {
if (n.getExpr() != null) {
n.setExpr((Expression) n.getExpr().accept(this, arg));
}
return n;
}
开发者ID:rfw,项目名称:genja,代码行数:7,代码来源:ModifierVisitorAdapter.java
示例11: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
@Override
public void visit(ReturnStmt n, Object arg) {
doTest(source, n);
super.visit(n, arg);
}
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:TestNodePositions.java
示例12: visitPre
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
@Override
public void visitPre(ReturnStmt n, A arg) {
}
开发者ID:kuali,项目名称:kc-rice,代码行数:5,代码来源:VoidVisitorHelperBase.java
示例13: visitPost
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
@Override
public void visitPost(ReturnStmt n, A arg) {
}
开发者ID:kuali,项目名称:kc-rice,代码行数:5,代码来源:VoidVisitorHelperBase.java
示例14: visitPre
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
void visitPre(ReturnStmt n, A arg);
开发者ID:kuali,项目名称:kc-rice,代码行数:2,代码来源:VoidVisitorHelper.java
示例15: visitPost
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
void visitPost(ReturnStmt n, A arg);
开发者ID:kuali,项目名称:kc-rice,代码行数:2,代码来源:VoidVisitorHelper.java
示例16: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
public R visit(ReturnStmt n, A arg);
开发者ID:rfw,项目名称:genja,代码行数:2,代码来源:GenericVisitor.java
示例17: visit
import japa.parser.ast.stmt.ReturnStmt; //导入依赖的package包/类
public void visit(ReturnStmt n, A arg);
开发者ID:rfw,项目名称:genja,代码行数:2,代码来源:VoidVisitor.java
注:本文中的japa.parser.ast.stmt.ReturnStmt类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论