001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.transformer.bytecode.statement.udf;
020
021import lucee.transformer.bytecode.Body;
022import lucee.transformer.bytecode.BytecodeContext;
023import lucee.transformer.bytecode.BytecodeException;
024import lucee.transformer.bytecode.Literal;
025import lucee.transformer.bytecode.Page;
026import lucee.transformer.bytecode.Position;
027import lucee.transformer.bytecode.expression.Expression;
028
029public final class Closure extends Function {
030
031        public Closure(Page page,Expression name, Expression returnType, Expression returnFormat, Expression output,Expression bufferOutput,
032                        int access, Expression displayName, Expression description,Expression hint, Expression secureJson, Expression verifyClient,
033                        Expression localMode,
034                        Literal cachedWithin, boolean _abstract, boolean _final,
035                        Body body, Position start,Position end) {
036                super(page,name, returnType, returnFormat, output,bufferOutput, access, displayName,description, hint, secureJson, verifyClient,
037                                localMode,cachedWithin,_abstract,_final,body, start, end);
038                
039        }
040        
041
042        public Closure(Page page, String name, int access, String returnType, Body body,Position start,Position end) {
043                super(page,name, access, returnType, body, start, end);
044        }
045
046        public final void _writeOut(BytecodeContext bc, int pageType) throws BytecodeException{
047                //GeneratorAdapter adapter = bc.getAdapter();
048                
049                ////Page page = bc.getPage();
050                ////if(page==null)page=ASMUtil.getAncestorPage(this);
051                //int index=page.addFunction(this);
052
053                /*if(pageType==PAGE_TYPE_INTERFACE) {
054                        adapter.loadArg(0);
055                }
056                else if(pageType==PAGE_TYPE_COMPONENT) {
057                        adapter.loadArg(1);
058                }
059                else {
060                        adapter.loadArg(0);
061                        adapter.invokeVirtual(Types.PAGE_CONTEXT, VARIABLE_SCOPE);
062                }
063                */
064                createUDF(bc, valueIndex,true);
065                
066                
067        }
068        
069}