当前位置: 首页>>代码示例>>Java>>正文


Java JoinPredecessorExpression.accept方法代码示例

本文整理汇总了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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:LocalVariableTypesCalculator.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:LocalVariableTypesCalculator.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:60,代码来源:LocalVariableTypesCalculator.java


注:本文中的jdk.nashorn.internal.ir.JoinPredecessorExpression.accept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。