Package gnu.mapping
Class Procedure
java.lang.Object
gnu.mapping.PropertySet
gnu.mapping.Procedure
- All Implemented Interfaces:
Named
- Direct Known Subclasses:
AutoloadProcedure,Expression,Invoke,LangObjType.ArgListBuilder,Procedure0,Procedure0or1,Procedure1,Procedure1or2,Procedure2,Procedure3,Procedure4,ProcedureN
The abstract parent for all Scheme functions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MethodTypestatic final MethodHandleprotected MethodHandlestatic final MethodHandleprotected MethodHandleA static method with signature ??apply(Procedure,CallContext)static final LazyPropertyKey<?> static final Symbolstatic final Symbolstatic final SymbolKey for a property used by gnu.expr.Inlinecalls.static final SymbolSame as validateApplyKey but handles splice args.Fields inherited from class gnu.mapping.PropertySet
nameKey -
Constructor Summary
ConstructorsConstructorDescriptionProcedure(boolean resultGoesToConsumer, MethodHandle applyMethod) Procedure(boolean resultGoesToConsumer, MethodHandle applyMethod, String n) -
Method Summary
Modifier and TypeMethodDescriptionapply0()static ObjectapplyToConsumerDefault(Procedure proc, CallContext ctx) static ObjectapplyToObjectDefault(Procedure proc, CallContext ctx) static voidcheckArgCount(Procedure proc, int argCount) Check that the number of arguments in a call is valid.voidcheckBadCode(CallContext ctx) final MethodHandlefinal MethodHandlegetReturnType(Expression[] args) Semi-deprecated - instead should be set at Inline time.booleanTrue if this Procedure (definitely) has no side-effects.static MethodHandlelookupApplyHandle(Class clas, String mname) final intmaxArgs()Maximum number of arguments allowed, or -1 for unlimited.static intmaxArgs(int num) Extract maximum number of arguments fromnumArgs()encoding.final intminArgs()Minimum number of arguments required.static intminArgs(int num) Extract minimum number of arguments fromnumArgs()encoding.intnumArgs()ReturnminArgs()|(maxArgs<<12).voidIf HasSetter, the Procedure is called in the LHS of an assignment.voidvoidvoidvoidsetSourceLocation(String file, int line) toString()Methods inherited from class gnu.mapping.PropertySet
getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol
-
Field Details
-
applyToObjectMethod
A static method with signature ??apply(Procedure,CallContext) -
applyToConsumerMethod
-
validateApplyKey
Key for a property used by gnu.expr.Inlinecalls. The property value is either a String of the form "CLASSNAME:METHODNAME", or a java.lang.reflect.Method (or FUTURE: MethodHandle) for a static method whose parameters are(ApplyExp exp, InlineCalls visitor, Type required, Procedure proc)and returns a re-written/validatedExpression. -
validateXApplyKey
Same as validateApplyKey but handles splice args. -
compilerXKey
-
inlineIfConstantSymbol
-
compilerKey
-
applyMethodType
-
applyToObjectDefault
-
applyToConsumerDefault
-
-
Constructor Details
-
Procedure
public Procedure() -
Procedure
-
Procedure
-
Procedure
-
-
Method Details
-
setSourceLocation
-
getSourceLocation
-
getApplyToConsumerMethod
-
getApplyToObjectMethod
-
applyToConsumerDefault
- Throws:
Throwable
-
applyToObjectDefault
- Throws:
Throwable
-
getApplyMethod
-
checkBadCode
-
applyL
- Throws:
Throwable
-
applyN
- Throws:
Throwable
-
apply0
- Throws:
Throwable
-
apply1
- Throws:
Throwable
-
apply2
- Throws:
Throwable
-
apply3
- Throws:
Throwable
-
apply4
- Throws:
Throwable
-
minArgs
public final int minArgs()Minimum number of arguments required. -
maxArgs
public final int maxArgs()Maximum number of arguments allowed, or -1 for unlimited. (May also return -1 if there are keyword arguments, for implementation reasons - FIXME.) -
numArgs
public int numArgs()ReturnminArgs()|(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. -
minArgs
public static int minArgs(int num) Extract minimum number of arguments fromnumArgs()encoding. -
maxArgs
public static int maxArgs(int num) Extract maximum number of arguments fromnumArgs()encoding. -
checkArgCount
Check that the number of arguments in a call is valid.- Parameters:
proc- the Procedure being calledargCount- the number of arguments in the call- Throws:
WrongArguments- there are too many or too few actual arguments
-
getSetter
-
setSetter
-
set0
If HasSetter, the Procedure is called in the LHS of an assignment.- Throws:
Throwable
-
set1
- Throws:
Throwable
-
setN
- Throws:
Throwable
-
isSideEffectFree
public boolean isSideEffectFree()True if this Procedure (definitely) has no side-effects. Note side-effect-free does not imply idempotent if this allocates an object with "identity". -
getReturnType
Semi-deprecated - instead should be set at Inline time. FIXME -
toString
-
lookupApplyHandle
-