Flow类中的resolveBreaks与resolveContinues

 

 

 /** Resolve all continues of this statement. */
boolean resolveContinues(JCTree tree) {
    boolean result = false;
    List exits = pendingExits.toList();
    pendingExits = new ListBuffer();

    for (; exits.nonEmpty(); exits = exits.tail) {
        PendingExit exit = exits.head;
        if (exit.tree.getTag() == JCTree.CONTINUE &&
                 ((JCContinue) exit.tree).target == tree) {

            inits.andSet(exit.inits); // 相当于取交集
            uninits.andSet(exit.uninits);
            result = true;
        } else {
            pendingExits.append(exit);
        }
    }
    return result;
}

 调用的地方如下截图:

Flow类中的resolveBreaks与resolveContinues_第1张图片

 

 

 

/** Resolve all breaks of this statement. */
boolean resolveBreaks(JCTree tree, // tree是break的跳出目标
                      ListBuffer oldPendingExits) {
    boolean result = false;
    List exits = pendingExits.toList();
    pendingExits = oldPendingExits;
    for (; exits.nonEmpty(); exits = exits.tail) {
        PendingExit exit = exits.head;
        if (exit.tree.getTag() == JCTree.BREAK &&
                    ((JCBreak) exit.tree).target == tree) {
            inits.andSet(exit.inits);
            uninits.andSet(exit.uninits);
            result = true;
        } else {
            pendingExits.append(exit);
        }
    }
    return result;
}

调用的地方如下:  

Flow类中的resolveBreaks与resolveContinues_第2张图片

 

你可能感兴趣的:(Flow类中的resolveBreaks与resolveContinues)