public class GenericProc extends MethodProc
Modifier and Type | Field and Description |
---|---|
protected MethodProc[] |
methods |
argTypes, NO_MATCH, NO_MATCH_AMBIGUOUS, NO_MATCH_BAD_TYPE, NO_MATCH_TOO_FEW_ARGS, NO_MATCH_TOO_MANY_ARGS
noArgs
compilerKey, compilerXKey, validateApplyKey, validateXApplyKey
nameKey
Constructor and Description |
---|
GenericProc() |
GenericProc(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
add(MethodProc method) |
protected void |
addAll(MethodProc[] procs) |
void |
addAtEnd(MethodProc method) |
java.lang.Object |
applyN(java.lang.Object[] args) |
MethodProc |
getMethod(int i) |
int |
getMethodCount() |
int |
isApplicable(Type[] args,
Type restType)
Test if method is applicable to an invocation with given arguments.
|
static GenericProc |
make(java.lang.Object[] args)
Create a GenericProc from one or more methods, plus properties.
|
static GenericProc |
makeWithoutSorting(java.lang.Object... args) |
int |
match0(CallContext ctx)
Pass zero arguments.
|
int |
match1(java.lang.Object arg1,
CallContext ctx)
Pass one argument.
|
int |
match2(java.lang.Object arg1,
java.lang.Object arg2,
CallContext ctx)
Pass two arguments.
|
int |
match3(java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
CallContext ctx)
Pass three arguments.
|
int |
match4(java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
CallContext ctx)
Pass four arguments.
|
int |
matchN(java.lang.Object[] args,
CallContext ctx) |
int |
numArgs()
Return
minArgs()|(maxArgs<<12) . |
void |
setProperties(java.lang.Object[] args) |
void |
setProperty(Keyword key,
java.lang.Object value) |
getParameterType, matchFailAsException, mostSpecific, numParameters, overrideEquivalent, resolveParameterTypes
apply, apply, check0, check1, check2, check3, check4, checkArgCount, checkN, getReturnType, getSetter, getSourceLocation, isSideEffectFree, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation, toString
getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol
protected MethodProc[] methods
public GenericProc(java.lang.String name)
public GenericProc()
public int getMethodCount()
public MethodProc getMethod(int i)
public int numArgs()
Procedure
minArgs()|(maxArgs<<12)
.
We use a single virtual function to reduce the number of methods
in the system, as well as the number of virtual method table entries.
We shift by 12 so the number can normally be represented using a
sipush instruction, without requiring a constant pool entry.protected void addAll(MethodProc[] procs)
public void addAtEnd(MethodProc method)
public void add(MethodProc method)
public java.lang.Object applyN(java.lang.Object[] args) throws java.lang.Throwable
applyN
in class MethodProc
java.lang.Throwable
public int isApplicable(Type[] args, Type restType)
MethodProc
isApplicable
in class MethodProc
args
- array of known "single" arguments.restType
- If null, the arguments are fully specified by argTypes.
If non-null, there may be an unknown number of extra arguments
of the given restType. This is used for splices, where we usually
don't know at compile-time how many argument values we have.public int match0(CallContext ctx)
Procedure
public int match1(java.lang.Object arg1, CallContext ctx)
Procedure
public int match2(java.lang.Object arg1, java.lang.Object arg2, CallContext ctx)
Procedure
public int match3(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, CallContext ctx)
Procedure
public int match4(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, CallContext ctx)
Procedure
public int matchN(java.lang.Object[] args, CallContext ctx)
public void setProperty(Keyword key, java.lang.Object value)
public final void setProperties(java.lang.Object[] args)
public static GenericProc make(java.lang.Object[] args)
public static GenericProc makeWithoutSorting(java.lang.Object... args)