001    package railo.transformer.bytecode.statement.tag;
002    
003    import org.objectweb.asm.Opcodes;
004    
005    import railo.transformer.bytecode.BytecodeContext;
006    import railo.transformer.bytecode.BytecodeException;
007    import railo.transformer.bytecode.Statement;
008    import railo.transformer.bytecode.statement.FlowControl;
009    import railo.transformer.bytecode.util.ASMUtil;
010    
011    public final class TagContinue extends TagBase {
012    
013            /**
014             * Constructor of the class
015             * @param tag
016             */
017            public TagContinue(int sl) {
018                    this(sl,-1);
019            }
020            public TagContinue(int sl,int el) {
021                    super(sl,el);
022                    setHasFlowController(true);
023            }
024    
025            /**
026             *
027             * @see railo.transformer.bytecode.statement.StatementBase#_writeOut(org.objectweb.asm.commons.GeneratorAdapter)
028             */
029            public void _writeOut(BytecodeContext bc) throws BytecodeException {
030                    FlowControl ls = ASMUtil.getAncestorFlowControlStatement(this);
031                    if(ls!=null)
032                            bc.getAdapter().visitJumpInsn(Opcodes.GOTO, ls.getContinueLabel());
033                    else throw new BytecodeException("continue must be inside a loop (for,while,do-while,loop ...)",getLine());
034            }
035            
036            /**
037             *
038             * @see railo.transformer.bytecode.statement.StatementBase#setParent(railo.transformer.bytecode.Statement)
039             */
040            public void setParent(Statement parent) {
041                    super.setParent(parent);
042                    parent.setHasFlowController(true);
043            }
044    
045    }