001    /* MBEL: The Microsoft Bytecode Engineering Library
002     * Copyright (C) 2003 The University of Arizona
003     * http://www.cs.arizona.edu/mbel/license.html
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, write to the Free Software
017     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
018     */
019    
020    
021    
022    package edu.arizona.cs.mbel.mbel;
023    
024    /** Represents a method reference for a CALLI instruction, 
025      * which has a callsite method signature. This is only used when 
026      * the called method has a VARARGS signature, so the caller must 
027      * specify the exact list of arguments.
028      * @author Michael Stepp
029      */
030    public class VarargsMethodRef extends MethodRef{
031       private Method method;
032      
033       /** Creates a VarargsMethodRef for the given method, with the given callsite method signature.
034         * The signature should have the VARARG calling convention.
035         */
036       public VarargsMethodRef(Method meth, edu.arizona.cs.mbel.signature.MethodSignature callsig){
037          super(meth.getName(), meth.getParent(), callsig);
038          method = meth;
039       }
040    
041       /** Overrides MemberRef.getParent() so that this will always return the 
042         * parent of the underlying Method object.
043         */
044       public AbstractTypeReference getParent(){
045          return method.getParent();
046       }
047       
048       /** Returns a reference to the method in this methodref
049         */
050       public Method getMethod(){
051          return method;
052       }
053       /** Sets the method for this methodref
054         */
055       public void setMethod(Method meth){
056          method = meth;
057          setName(method.getName());
058          setParent(method.getParent());
059       }
060       
061    /*
062       public void output(){
063          System.out.print("VarargsMethodRef[");
064          method.output();
065          System.out.print("]");
066       }
067    */
068    }