public boolean createInstruction()

in src/main/java/com/ql/util/express/instruction/BlockInstructionFactory.java [14:38]


    public boolean createInstruction(ExpressRunner expressRunner, InstructionSet result,
        Stack<ForRelBreakContinue> forStack, ExpressNode node, boolean isRoot) throws Exception {
        if (node.isTypeEqualsOrChild("STAT_SEMICOLON") && result.getCurrentPoint() >= 0 && !(result.getInstruction(
            result.getCurrentPoint()) instanceof InstructionClearDataStack)) {
            result.addInstruction(new InstructionClearDataStack().setLine(node.getLine()));
        }

        boolean needOpenNewArea = !isRoot && "STAT_BLOCK".equals(node.getNodeType().getName());
        if (needOpenNewArea) {
            result.addInstruction(new InstructionOpenNewArea().setLine(node.getLine()));
        }
        boolean returnVal;
        boolean hasDef = false;
        for (ExpressNode tmpNode : node.getChildrenArray()) {
            boolean tmpHas = expressRunner.createInstructionSetPrivate(result, forStack, tmpNode, false);
            hasDef = hasDef || tmpHas;
        }
        if (needOpenNewArea) {
            result.addInstruction(new InstructionCloseNewArea().setLine(node.getLine()));
            returnVal = false;
        } else {
            returnVal = hasDef;
        }
        return returnVal;
    }