public final class ELambda extends AExpression
This can currently only be the direct argument of a call (method/constructor). When the argument is of a known type, it uses Java's lambda translation. However, if its a def call, then we don't have enough information, and have to defer this until link time. In that case a placeholder and all captures are pushed onto the stack and folded into the signature of the parent call.
For example:
def list = new ArrayList(); int capture = 0; list.sort((x,y) -> x - y + capture)
is converted into a call (pseudocode) such as:
sort(list, lambda$0, capture)
At link time, when we know the interface type, this is decomposed with MethodHandle
combinators back into (pseudocode):
sort(list, lambda$0(capture))
| Constructor and Description |
|---|
ELambda(java.lang.String name,
SFunction.FunctionReserved reserved,
Location location,
java.util.List<java.lang.String> paramTypes,
java.util.List<java.lang.String> paramNames,
java.util.List<AStatement> statements) |
| Modifier and Type | Method and Description |
|---|---|
default int |
getCaptureCount()
Returns the number of captured parameters
|
org.objectweb.asm.Type[] |
getCaptures()
Returns the types of captured parameters.
|
java.lang.String |
getPointer()
Returns reference to resolve at link-time
|
java.lang.String |
toString()
Subclasses should implement this with a method like
ANode.singleLineToString(Object...) or
ANode.multilineToString(Collection, Collection). |
joinWithName, multilineToString, pairwiseToString, singleLineToString, singleLineToString, singleLineToStringWithOptionalArgspublic ELambda(java.lang.String name,
SFunction.FunctionReserved reserved,
Location location,
java.util.List<java.lang.String> paramTypes,
java.util.List<java.lang.String> paramNames,
java.util.List<AStatement> statements)
public java.lang.String getPointer()
public org.objectweb.asm.Type[] getCaptures()
public java.lang.String toString()
ANodeANode.singleLineToString(Object...) or
ANode.multilineToString(Collection, Collection).public int getCaptureCount()