本文整理汇总了Java中jdk.nashorn.internal.ir.ReturnNode.getExpression方法的典型用法代码示例。如果您正苦于以下问题:Java ReturnNode.getExpression方法的具体用法?Java ReturnNode.getExpression怎么用?Java ReturnNode.getExpression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.nashorn.internal.ir.ReturnNode
的用法示例。
在下文中一共展示了ReturnNode.getExpression方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enterReturnNode
import jdk.nashorn.internal.ir.ReturnNode; //导入方法依赖的package包/类
@Override
public boolean enterReturnNode(final ReturnNode returnNode) {
enterDefault(returnNode);
type("ReturnStatement");
comma();
final Node arg = returnNode.getExpression();
property("argument");
if (arg != null) {
arg.accept(this);
} else {
nullValue();
}
return leave();
}
示例2: enterReturnNode
import jdk.nashorn.internal.ir.ReturnNode; //导入方法依赖的package包/类
@Override
public boolean enterReturnNode(final ReturnNode returnNode) {
if(!reachable) {
return false;
}
final Expression returnExpr = returnNode.getExpression();
final Type returnExprType;
if(returnExpr != null) {
returnExpr.accept(this);
returnExprType = getType(returnExpr);
} else {
returnExprType = Type.UNDEFINED;
}
returnType = Type.widestReturnType(returnType, returnExprType);
doesNotContinueSequentially();
return false;
}
示例3: enterReturnNode
import jdk.nashorn.internal.ir.ReturnNode; //导入方法依赖的package包/类
@Override
public boolean enterReturnNode(final ReturnNode returnNode) {
if(!method.isReachable()) {
return false;
}
enterStatement(returnNode);
method.registerReturn();
final Type returnType = lc.getCurrentFunction().getReturnType();
final Expression expression = returnNode.getExpression();
if (expression != null) {
loadExpressionUnbounded(expression);
} else {
method.loadUndefined(returnType);
}
method._return(returnType);
return false;
}
示例4: enterReturnNode
import jdk.nashorn.internal.ir.ReturnNode; //导入方法依赖的package包/类
@Override
public boolean enterReturnNode(final ReturnNode returnNode) {
if(!reachable) {
return false;
}
final Expression returnExpr = returnNode.getExpression();
final Type returnExprType;
if(returnExpr != null) {
returnExprType = visitExpressionOnEmptyStack(returnExpr).type;
} else {
assertTypeStackIsEmpty();
returnExprType = Type.UNDEFINED;
}
returnType = Type.widestReturnType(returnType, returnExprType);
doesNotContinueSequentially();
return false;
}
示例5: enterReturnNode
import jdk.nashorn.internal.ir.ReturnNode; //导入方法依赖的package包/类
@Override
public boolean enterReturnNode(final ReturnNode returnNode) {
if(!method.isReachable()) {
return false;
}
enterStatement(returnNode);
final Type returnType = lc.getCurrentFunction().getReturnType();
final Expression expression = returnNode.getExpression();
if (expression != null) {
loadExpressionUnbounded(expression);
} else {
method.loadUndefined(returnType);
}
method._return(returnType);
return false;
}
示例6: leaveReturnNode
import jdk.nashorn.internal.ir.ReturnNode; //导入方法依赖的package包/类
@Override
public Node leaveReturnNode(final ReturnNode returnNode) {
final Expression expr = returnNode.getExpression();
final Type returnType;
if (expr != null) {
//we can't do parameter specialization if we return something that hasn't been typed yet
final Symbol symbol = expr.getSymbol();
if (expr.getType().isUnknown() && symbol.isParam()) {
symbol.setType(Type.OBJECT);
}
returnType = widestReturnType(returnTypes.pop(), symbol.getSymbolType());
} else {
returnType = Type.OBJECT; //undefined
}
LOG.info("Returntype is now ", returnType);
returnTypes.push(returnType);
end(returnNode);
return returnNode;
}
示例7: enterReturnNode
import jdk.nashorn.internal.ir.ReturnNode; //导入方法依赖的package包/类
@Override
public boolean enterReturnNode(final ReturnNode returnNode) {
lineNumber(returnNode);
method.registerReturn();
final Type returnType = lc.getCurrentFunction().getReturnType();
final Expression expression = returnNode.getExpression();
if (expression != null) {
load(expression);
} else {
method.loadUndefined(returnType);
}
method._return(returnType);
return false;
}
示例8: leaveReturnNode
import jdk.nashorn.internal.ir.ReturnNode; //导入方法依赖的package包/类
@Override
public Node leaveReturnNode(final ReturnNode returnNode) {
final Expression expr = returnNode.getExpression();
final Type returnType;
if (expr != null) {
//we can't do parameter specialization if we return something that hasn't been typed yet
final Symbol symbol = expr.getSymbol();
if (expr.getType().isUnknown() && symbol.isParam()) {
symbol.setType(Type.OBJECT);
}
returnType = Type.widest(returnTypes.pop(), symbol.getSymbolType());
} else {
returnType = Type.OBJECT; //undefined
}
LOG.info("Returntype is now ", returnType);
returnTypes.push(returnType);
end(returnNode);
return returnNode;
}
示例9: leaveReturnNode
import jdk.nashorn.internal.ir.ReturnNode; //导入方法依赖的package包/类
@Override
public Node leaveReturnNode(final ReturnNode returnNode) {
final Expression expr = returnNode.getExpression();
if (expr != null) {
return returnNode.setExpression(convert(expr, lc.getCurrentFunction().getReturnType()));
}
return returnNode;
}