/** * Get the last argument type. * * @return the last argument type */ public Class<?> lastArgType() { return argType(methodType.parameterCount() - 1); }
public static final Type[] typesFromSignature(Signature signature) { Type[] types = new Type[signature.argCount()]; for (int i = 0; i < signature.argCount(); i++) { types[i] = Type.getType(signature.argType(i)); } return types; }
private static final Type[] typesFromSignature(Signature signature) { Type[] types = new Type[signature.argCount()]; for (int i = 0; i < signature.argCount(); i++) { types[i] = Type.getType(signature.argType(i)); } return types; }
public static final Type[] typesFromSignature(Signature signature) { Type[] types = new Type[signature.argCount()]; for (int i = 0; i < signature.argCount(); i++) { types[i] = Type.getType(signature.argType(i)); } return types; }
private static final Type[] typesFromSignature(Signature signature) { Type[] types = new Type[signature.argCount()]; for (int i = 0; i < signature.argCount(); i++) { types[i] = Type.getType(signature.argType(i)); } return types; }
gatherCount++; newType = newType.dropParameterTypes(newCount, newCount + 1); Class<?> argType = argType(i); if (start == -1) start = i; if (type == null) {
public MethodData(IRBytecodeAdapter method, IRScope scope, Signature signature, int specificArity) { this.method = method; this.scope = scope; this.signature = signature; this.specificArity = specificArity; // incoming arguments for (int i = 0; i < signature.argCount(); i++) { local("$" + signature.argName(i), Type.getType(signature.argType(i))); } // TODO: this should go into the PushBinding instruction local("$dynamicScope"); }
/** * Filter the arguments matching the given pattern using the given filter function. * * @param pattern the regular expression pattern to match arguments * @param filter the MethodHandle to use to filter the arguments * @return a new SmartBinder with the filter applied */ public SmartBinder filter(String pattern, MethodHandle filter) { String[] argNames = signature().argNames(); Pattern pat = Pattern.compile(pattern); Binder newBinder = binder(); Signature newSig = signature(); for (int i = 0; i < argNames.length; i++) { if (pat.matcher(argNames[i]).matches()) { newBinder = newBinder.filter(i, filter); newSig = newSig.argType(i, filter.type().returnType()); } } return new SmartBinder(newSig, newBinder); }
public MethodData(IRBytecodeAdapter method, IRScope scope, Signature signature, int specificArity) { this.method = method; this.scope = scope; this.signature = signature; this.specificArity = specificArity; // incoming arguments for (int i = 0; i < signature.argCount(); i++) { local("$" + signature.argName(i), Type.getType(signature.argType(i))); } // TODO: this should go into the PushBinding instruction local("$dynamicScope"); }
/** * Collect arguments matching namePattern into an trailing array argument * named outName. * * The namePattern is a standard regular expression. * * @param outName the name of the new array argument * @param namePattern a pattern with which to match arguments for collecting * @return a new SmartBinder with the collect applied */ public SmartBinder collect(String outName, String namePattern) { int index = signature().argOffsets(namePattern); assert index >= 0 : "no arguments matching " + namePattern + " found in signature " + signature(); Signature newSignature = signature().collect(outName, namePattern); return new SmartBinder(this, newSignature, binder.collect(index, signature().argCount() - (newSignature.argCount() - 1), Array.newInstance(signature().argType(index), 0).getClass())); }