Java 类jdk.nashorn.internal.ir.BreakNode 实例源码

项目:OpenJSharp    文件:JSONWriter.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    enterDefault(breakNode);

    type("BreakStatement");
    comma();

    final String label = breakNode.getLabelName();
    if(label != null) {
        property("label", label);
    } else {
        property("label");
        nullValue();
    }

    return leave();
}
项目:OpenJSharp    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:openjdk-jdk10    文件:JSONWriter.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    enterDefault(breakNode);

    type("BreakStatement");
    comma();

    final String label = breakNode.getLabelName();
    if(label != null) {
        property("label", label);
    } else {
        property("label");
        nullValue();
    }

    return leave();
}
项目:openjdk-jdk10    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:openjdk9    文件:JSONWriter.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    enterDefault(breakNode);

    type("BreakStatement");
    comma();

    final String label = breakNode.getLabelName();
    if(label != null) {
        property("label", label);
    } else {
        property("label");
        nullValue();
    }

    return leave();
}
项目:openjdk9    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:kaziranga    文件:JSONWriter.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    enterDefault(breakNode);

    type("BreakStatement");
    comma();

    final String label = breakNode.getLabelName();
    if(label != null) {
        property("label", label);
    } else {
        property("label");
        nullValue();
    }

    return leave();
}
项目:kaziranga    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:lookaside_java-1.8.0-openjdk    文件:JSONWriter.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    enterDefault(breakNode);

    type("BreakStatement");
    comma();

    final String label = breakNode.getLabelName();
    if(label != null) {
        property("label", label);
    } else {
        property("label");
        nullValue();
    }

    return leave();
}
项目:lookaside_java-1.8.0-openjdk    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:jdk8u_nashorn    文件:JSONWriter.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    enterDefault(breakNode);

    type("BreakStatement");
    comma();

    final String label = breakNode.getLabelName();
    if(label != null) {
        property("label", label);
    } else {
        property("label");
        nullValue();
    }

    return leave();
}
项目:jdk8u_nashorn    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:infobip-open-jdk-8    文件:JSONWriter.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    enterDefault(breakNode);

    type("BreakStatement");
    comma();

    final String label = breakNode.getLabelName();
    if(label != null) {
        property("label", label);
    } else {
        property("label");
        nullValue();
    }

    return leave();
}
项目:infobip-open-jdk-8    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:OLD-OpenJDK8    文件:JSONWriter.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    enterDefault(breakNode);

    type("BreakStatement");
    comma();

    final IdentNode label = breakNode.getLabel();
    property("label");
    if (label != null) {
        label.accept(this);
    } else {
        nullValue();
    }

    return leave();
}
项目:nashorn-backport    文件:JSONWriter.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    enterDefault(breakNode);

    type("BreakStatement");
    comma();

    final IdentNode label = breakNode.getLabel();
    property("label");
    if (label != null) {
        label.accept(this);
    } else {
        nullValue();
    }

    return leave();
}
项目:nashorn    文件:JSONWriter.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    enterDefault(breakNode);

    type("BreakStatement");
    comma();

    final IdentNode label = breakNode.getLabel();
    property("label");
    if (label != null) {
        label.accept(this);
    } else {
        nullValue();
    }

    return leave();
}
项目:OLD-OpenJDK8    文件:CodeGenerator.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    lineNumber(breakNode);

    final BreakableNode breakFrom = lc.getBreakable(breakNode.getLabel());
    for (int i = 0; i < lc.getScopeNestingLevelTo(breakFrom); i++) {
        closeWith();
    }
    method.splitAwareGoto(lc, breakFrom.getBreakLabel());

    return false;
}
项目:nashorn-backport    文件:CodeGenerator.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    lineNumber(breakNode);

    final BreakableNode breakFrom = lc.getBreakable(breakNode.getLabel());
    for (int i = 0; i < lc.getScopeNestingLevelTo(breakFrom); i++) {
        closeWith();
    }
    method.splitAwareGoto(lc, breakFrom.getBreakLabel());

    return false;
}
项目:nashorn    文件:CodeGenerator.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    lineNumber(breakNode);

    final BreakableNode breakFrom = lc.getBreakable(breakNode.getLabel());
    for (int i = 0; i < lc.getScopeNestingLevelTo(breakFrom); i++) {
        closeWith();
    }
    method.splitAwareGoto(lc, breakFrom.getBreakLabel());

    return false;
}
项目:OpenJSharp    文件:Parser.java   
/**
 * BreakStatement :
 *      break Identifier? ; // [no LineTerminator here]
 *
 * See 12.8
 *
 */
private void breakStatement() {
    // Capture BREAK token.
    final int  breakLine  = line;
    final long breakToken = token;
    // BREAK tested in caller.
    nextOrEOL();

    LabelNode labelNode = null;

    // SEMICOLON or label.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
    case EOF:
        break;

    default:
        final IdentNode ident = getIdent();
        labelNode = lc.findLabel(ident.getName());

        if (labelNode == null) {
            throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken());
        }

        break;
    }

    //either an explicit label - then get its node or just a "break" - get first breakable
    //targetNode is what we are breaking out from.
    final String labelName = labelNode == null ? null : labelNode.getLabelName();
    final BreakableNode targetNode = lc.getBreakable(labelName);
    if (targetNode == null) {
        throw error(AbstractParser.message("illegal.break.stmt"), breakToken);
    }

    endOfLine();

    // Construct and add BREAK node.
    appendStatement(new BreakNode(breakLine, breakToken, finish, labelName));
}
项目:OpenJSharp    文件:PrintVisitor.java   
@Override
public boolean enterBreakNode(final BreakNode node) {
    node.toString(sb, printTypes);
    printLocalVariableConversion(node);
    return false;
}
项目:OpenJSharp    文件:Lower.java   
/**
 * Constructor.
 */
Lower(final Compiler compiler) {
    super(new BlockLexicalContext() {

        @Override
        public List<Statement> popStatements() {
            final List<Statement> newStatements = new ArrayList<>();
            boolean terminated = false;

            final List<Statement> statements = super.popStatements();
            for (final Statement statement : statements) {
                if (!terminated) {
                    newStatements.add(statement);
                    if (statement.isTerminal() || statement instanceof BreakNode || statement instanceof ContinueNode) { //TODO hasGoto? But some Loops are hasGoto too - why?
                        terminated = true;
                    }
                } else {
                    statement.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
                        @Override
                        public boolean enterVarNode(final VarNode varNode) {
                            newStatements.add(varNode.setInit(null));
                            return false;
                        }
                    });
                }
            }
            return newStatements;
        }

        @Override
        protected Block afterSetStatements(final Block block) {
            final List<Statement> stmts = block.getStatements();
            for(final ListIterator<Statement> li = stmts.listIterator(stmts.size()); li.hasPrevious();) {
                final Statement stmt = li.previous();
                // popStatements() guarantees that the only thing after a terminal statement are uninitialized
                // VarNodes. We skip past those, and set the terminal state of the block to the value of the
                // terminal state of the first statement that is not an uninitialized VarNode.
                if(!(stmt instanceof VarNode && ((VarNode)stmt).getInit() == null)) {
                    return block.setIsTerminal(this, stmt.isTerminal());
                }
            }
            return block.setIsTerminal(this, false);
        }
    });

    this.log = initLogger(compiler.getContext());
}
项目:OpenJSharp    文件:Lower.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    addStatement(breakNode);
    return false;
}
项目:OpenJSharp    文件:SplitIntoFunctions.java   
@Override
public Node leaveBreakNode(final BreakNode breakNode) {
    return leaveJumpNode(breakNode);
}
项目:OpenJSharp    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    return enterJumpStatement(breakNode);
}
项目:OpenJSharp    文件:CodeGenerator.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    return enterJumpStatement(breakNode);
}
项目:OpenJSharp    文件:WeighNodes.java   
@Override
public Node leaveBreakNode(final BreakNode breakNode) {
    weight += BREAK_WEIGHT;
    return breakNode;
}
项目:openjdk-jdk10    文件:IRTranslator.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    curStat = new BreakTreeImpl(breakNode);
    return false;
}
项目:openjdk-jdk10    文件:BreakTreeImpl.java   
BreakTreeImpl(final BreakNode node) {
    super(node);
    this.label = node.getLabelName();
}
项目:openjdk-jdk10    文件:Parser.java   
/**
 * BreakStatement :
 *      break Identifier? ; // [no LineTerminator here]
 *
 * See 12.8
 *
 */
private void breakStatement() {
    // Capture BREAK token.
    final int  breakLine  = line;
    final long breakToken = token;
    // BREAK tested in caller.
    nextOrEOL();

    ParserContextLabelNode labelNode = null;

    // SEMICOLON or label.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
    case EOF:
        break;

    default:
        final IdentNode ident = getIdent();
        labelNode = lc.findLabel(ident.getName());

        if (labelNode == null) {
            throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken());
        }

        break;
    }

    //either an explicit label - then get its node or just a "break" - get first breakable
    //targetNode is what we are breaking out from.
    final String labelName = labelNode == null ? null : labelNode.getLabelName();
    final ParserContextBreakableNode targetNode = lc.getBreakable(labelName);

    if( targetNode instanceof ParserContextBlockNode) {
        targetNode.setFlag(Block.IS_BREAKABLE);
    }

    if (targetNode == null) {
        throw error(AbstractParser.message("illegal.break.stmt"), breakToken);
    }

    endOfLine();

    // Construct and add BREAK node.
    appendStatement(new BreakNode(breakLine, breakToken, finish, labelName));
}
项目:openjdk-jdk10    文件:PrintVisitor.java   
@Override
public boolean enterBreakNode(final BreakNode node) {
    node.toString(sb, printTypes);
    printLocalVariableConversion(node);
    return false;
}
项目:openjdk-jdk10    文件:Lower.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    addStatement(breakNode);
    return false;
}
项目:openjdk-jdk10    文件:SplitIntoFunctions.java   
@Override
public Node leaveBreakNode(final BreakNode breakNode) {
    return leaveJumpNode(breakNode);
}
项目:openjdk-jdk10    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    return enterJumpStatement(breakNode);
}
项目:openjdk-jdk10    文件:CodeGenerator.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    return enterJumpStatement(breakNode);
}
项目:openjdk-jdk10    文件:WeighNodes.java   
@Override
public Node leaveBreakNode(final BreakNode breakNode) {
    weight += BREAK_WEIGHT;
    return breakNode;
}
项目:openjdk9    文件:IRTranslator.java   
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
    curStat = new BreakTreeImpl(breakNode);
    return false;
}
项目:openjdk9    文件:BreakTreeImpl.java   
BreakTreeImpl(final BreakNode node) {
    super(node);
    this.label = node.getLabelName();
}
项目:openjdk9    文件:Parser.java   
/**
 * BreakStatement :
 *      break Identifier? ; // [no LineTerminator here]
 *
 * See 12.8
 *
 */
private void breakStatement() {
    // Capture BREAK token.
    final int  breakLine  = line;
    final long breakToken = token;
    // BREAK tested in caller.
    nextOrEOL();

    ParserContextLabelNode labelNode = null;

    // SEMICOLON or label.
    switch (type) {
    case RBRACE:
    case SEMICOLON:
    case EOL:
    case EOF:
        break;

    default:
        final IdentNode ident = getIdent();
        labelNode = lc.findLabel(ident.getName());

        if (labelNode == null) {
            throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken());
        }

        break;
    }

    //either an explicit label - then get its node or just a "break" - get first breakable
    //targetNode is what we are breaking out from.
    final String labelName = labelNode == null ? null : labelNode.getLabelName();
    final ParserContextBreakableNode targetNode = lc.getBreakable(labelName);
    if (targetNode == null) {
        throw error(AbstractParser.message("illegal.break.stmt"), breakToken);
    }

    endOfLine();

    // Construct and add BREAK node.
    appendStatement(new BreakNode(breakLine, breakToken, finish, labelName));
}