Search in sources :

Example 1 with FlowControlContinue

use of lucee.transformer.bytecode.statement.FlowControlContinue in project Lucee by lucee.

the class ASMUtil method getAncestorFCStatement.

private static FlowControl getAncestorFCStatement(Statement stat, List<FlowControlFinal> finallyLabels, int flowType, String label) {
    Statement parent = stat;
    FlowControlFinal fcf;
    while (true) {
        parent = parent.getParent();
        if (parent == null)
            return null;
        if (((flowType == FlowControl.RETRY && parent instanceof FlowControlRetry) || (flowType == FlowControl.CONTINUE && parent instanceof FlowControlContinue) || (flowType == FlowControl.BREAK && parent instanceof FlowControlBreak)) && labelMatch((FlowControl) parent, label)) {
            if (parent instanceof ScriptBody) {
                List<FlowControlFinal> _finallyLabels = finallyLabels == null ? null : new ArrayList<FlowControlFinal>();
                FlowControl scriptBodyParent = getAncestorFCStatement(parent, _finallyLabels, flowType, label);
                if (scriptBodyParent != null) {
                    if (finallyLabels != null) {
                        Iterator<FlowControlFinal> it = _finallyLabels.iterator();
                        while (it.hasNext()) {
                            finallyLabels.add(it.next());
                        }
                    }
                    return scriptBodyParent;
                }
                return (FlowControl) parent;
            }
            return (FlowControl) parent;
        }
        // only if not last
        if (finallyLabels != null) {
            fcf = parent.getFlowControlFinal();
            if (fcf != null) {
                finallyLabels.add(fcf);
            }
        }
    }
}
Also used : FlowControlContinue(lucee.transformer.bytecode.statement.FlowControlContinue) FlowControl(lucee.transformer.bytecode.statement.FlowControl) Statement(lucee.transformer.bytecode.Statement) ScriptBody(lucee.transformer.bytecode.ScriptBody) FlowControlFinal(lucee.transformer.bytecode.statement.FlowControlFinal) FlowControlBreak(lucee.transformer.bytecode.statement.FlowControlBreak) FlowControlRetry(lucee.transformer.bytecode.statement.FlowControlRetry)

Aggregations

ScriptBody (lucee.transformer.bytecode.ScriptBody)1 Statement (lucee.transformer.bytecode.Statement)1 FlowControl (lucee.transformer.bytecode.statement.FlowControl)1 FlowControlBreak (lucee.transformer.bytecode.statement.FlowControlBreak)1 FlowControlContinue (lucee.transformer.bytecode.statement.FlowControlContinue)1 FlowControlFinal (lucee.transformer.bytecode.statement.FlowControlFinal)1 FlowControlRetry (lucee.transformer.bytecode.statement.FlowControlRetry)1