1 16 19 20 package org.apache.xalan.xsltc.compiler.util; 21 22 import org.apache.bcel.generic.ALOAD; 23 import org.apache.bcel.generic.ASTORE; 24 import org.apache.bcel.generic.ConstantPoolGen; 25 import org.apache.bcel.generic.Instruction; 26 import org.apache.bcel.generic.InstructionList; 27 import org.apache.bcel.generic.Type; 28 29 35 public final class NamedMethodGenerator extends MethodGenerator { 36 protected static int CURRENT_INDEX = 4; 37 38 private static final int PARAM_START_INDEX = 5; 40 41 public NamedMethodGenerator(int access_flags, Type return_type, 42 Type[] arg_types, String [] arg_names, 43 String method_name, String class_name, 44 InstructionList il, ConstantPoolGen cp) { 45 super(access_flags, return_type, arg_types, arg_names, method_name, 46 class_name, il, cp); 47 } 48 49 public int getLocalIndex(String name) { 50 if (name.equals("current")) { 51 return CURRENT_INDEX; 52 } 53 return super.getLocalIndex(name); 54 } 55 56 public Instruction loadParameter(int index) { 57 return new ALOAD(index + PARAM_START_INDEX); 58 } 59 60 public Instruction storeParameter(int index) { 61 return new ASTORE(index + PARAM_START_INDEX); 62 } 63 } 64 | Popular Tags |