Class SpreadBlock
- All Implemented Interfaces:
Block,Serializable
SpreadExpression similarly to the way that SpreadMapBlock handles SpreadMapExpression,
but with a groovy-cps-specific SpreadBlock.SpreadList marker class.
We use a marker class because we cannot easily mimic the way that Groovy normally handles SpreadExpression.
To do so, we would need modifications to CpsTransformer for list and argument list visitors akin to AsmClassGenerator.despreadList,
a new implementation of Block that would fix those expressions and then call ScriptBytecodeAdapter.despreadList(java.lang.Object[], java.lang.Object[], int[]),
and a variant of FunctionCallBlock that takes a single Block which is expected to evaluate to Object[]
(rather than a Block[]) so that the result of despreadList can be used directly as the arguments array
for the function call.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.cloudbees.groovy.cps.Block
Block.Noop -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object[]despreadList(Object[] list) eval(Env e, Continuation k) Executes this expression, then pass the result to the given continuation when it's available.
-
Constructor Details
-
SpreadBlock
-
-
Method Details
-
eval
Description copied from interface:BlockExecutes this expression, then pass the result to the given continuation when it's available.To be more precise, this method does not evaluate the expression by itself synchronously. Instead, the evaluation is done by the caller by repeatedly step executing the resulting
Nextobject. -
despreadList
-