本文整理汇总了Java中jdk.nashorn.internal.ir.JoinPredecessorExpression.accept方法的典型用法代码示例。如果您正苦于以下问题:Java JoinPredecessorExpression.accept方法的具体用法?Java JoinPredecessorExpression.accept怎么用?Java JoinPredecessorExpression.accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.nashorn.internal.ir.JoinPredecessorExpression
的用法示例。
在下文中一共展示了JoinPredecessorExpression.accept方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enterForNode
import jdk.nashorn.internal.ir.JoinPredecessorExpression; //导入方法依赖的package包/类
@Override
public boolean enterForNode(final ForNode forNode) {
if(!reachable) {
return false;
}
final Expression init = forNode.getInit();
if(forNode.isForIn()) {
final JoinPredecessorExpression iterable = forNode.getModify();
iterable.accept(this);
enterTestFirstLoop(forNode, null, init,
// If we're iterating over property names, and we can discern from the runtime environment
// of the compilation that the object being iterated over must use strings for property
// names (e.g., it is a native JS object or array), then we'll not bother trying to treat
// the property names optimistically.
!compiler.useOptimisticTypes() || (!forNode.isForEach() && compiler.hasStringPropertyIterator(iterable.getExpression())));
} else {
if(init != null) {
init.accept(this);
}
enterTestFirstLoop(forNode, forNode.getModify(), null, false);
}
return false;
}
示例2: enterDoWhileLoop
import jdk.nashorn.internal.ir.JoinPredecessorExpression; //导入方法依赖的package包/类
private void enterDoWhileLoop(final WhileNode loopNode) {
final JoinPredecessorExpression test = loopNode.getTest();
final Block body = loopNode.getBody();
final Label continueLabel = loopNode.getContinueLabel();
final Label breakLabel = loopNode.getBreakLabel();
final Map<Symbol, LvarType> beforeLoopTypes = localVariableTypes;
final Label repeatLabel = new Label("");
for(;;) {
jumpToLabel(loopNode, repeatLabel, beforeLoopTypes);
final Map<Symbol, LvarType> beforeRepeatTypes = localVariableTypes;
body.accept(this);
if(reachable) {
jumpToLabel(body, continueLabel);
}
joinOnLabel(continueLabel);
if(!reachable) {
break;
}
test.accept(this);
jumpToLabel(test, breakLabel);
if(isAlwaysFalse(test)) {
break;
}
jumpToLabel(test, repeatLabel);
joinOnLabel(repeatLabel);
if(localVariableTypes.equals(beforeRepeatTypes)) {
break;
}
resetJoinPoint(continueLabel);
resetJoinPoint(breakLabel);
resetJoinPoint(repeatLabel);
}
if(isAlwaysTrue(test)) {
doesNotContinueSequentially();
}
leaveBreakable(loopNode);
}
示例3: enterTestFirstLoop
import jdk.nashorn.internal.ir.JoinPredecessorExpression; //导入方法依赖的package包/类
private void enterTestFirstLoop(final LoopNode loopNode, final JoinPredecessorExpression modify,
final Expression iteratorValues, final boolean iteratorValuesAreObject) {
final JoinPredecessorExpression test = loopNode.getTest();
if(isAlwaysFalse(test)) {
test.accept(this);
return;
}
final Label continueLabel = loopNode.getContinueLabel();
final Label breakLabel = loopNode.getBreakLabel();
final Label repeatLabel = modify == null ? continueLabel : new Label("");
final Map<Symbol, LvarType> beforeLoopTypes = localVariableTypes;
for(;;) {
jumpToLabel(loopNode, repeatLabel, beforeLoopTypes);
final Map<Symbol, LvarType> beforeRepeatTypes = localVariableTypes;
if(test != null) {
test.accept(this);
}
if(!isAlwaysTrue(test)) {
jumpToLabel(test, breakLabel);
}
if(iteratorValues instanceof IdentNode) {
final IdentNode ident = (IdentNode)iteratorValues;
// Receives iterator values; the optimistic type of the iterator values is tracked on the
// identifier, but we override optimism if it's known that the object being iterated over will
// never have primitive property names.
onAssignment(ident, iteratorValuesAreObject ? LvarType.OBJECT :
toLvarType(compiler.getOptimisticType(ident)));
}
final Block body = loopNode.getBody();
body.accept(this);
if(reachable) {
jumpToLabel(body, continueLabel);
}
joinOnLabel(continueLabel);
if(!reachable) {
break;
}
if(modify != null) {
modify.accept(this);
jumpToLabel(modify, repeatLabel);
joinOnLabel(repeatLabel);
}
if(localVariableTypes.equals(beforeRepeatTypes)) {
break;
}
// Reset the join points and repeat the analysis
resetJoinPoint(continueLabel);
resetJoinPoint(breakLabel);
resetJoinPoint(repeatLabel);
}
if(isAlwaysTrue(test) && iteratorValues == null) {
doesNotContinueSequentially();
}
leaveBreakable(loopNode);
}