001    package railo.transformer.bytecode.statement;
002    
003    import org.objectweb.asm.Type;
004    import org.objectweb.asm.commons.GeneratorAdapter;
005    import org.objectweb.asm.commons.Method;
006    
007    import railo.transformer.bytecode.BytecodeContext;
008    import railo.transformer.bytecode.BytecodeException;
009    import railo.transformer.bytecode.util.Types;
010    
011    public final class Abort extends StatementBase {
012    
013            private static final Type ABORT = Type.getType(railo.runtime.exp.Abort.class);
014            
015            // ExpressionException newInstance(int)
016            private static final Method NEW_INSTANCE =  new Method(
017                            "newInstance",
018                            ABORT,
019                            new Type[]{Types.INT_VALUE});
020    
021            
022            public Abort(int line) {
023                    super(line);
024            }
025    
026            /**
027             *
028             * @see railo.transformer.bytecode.statement.StatementBase#_writeOut(railo.transformer.bytecode.BytecodeContext)
029             */
030            public void _writeOut(BytecodeContext bc) throws BytecodeException {
031                    GeneratorAdapter adapter = bc.getAdapter();
032                    adapter.push(railo.runtime.exp.Abort.SCOPE_PAGE);
033                    adapter.invokeStatic(ABORT, NEW_INSTANCE);
034                    adapter.throwException();
035                    
036            }
037    }