abstract class
Bindgen::Call::HookableBody
- Bindgen::Call::HookableBody
- Bindgen::Call::Body
- Reference
- Object
Overview
A body allowing to add additional code before and after the actual code
body. This is useful to allow later processors to refine existing calls
with additional logic. An example of this is the VirtualOverride
processor, which uses this to augment #initialize methods setting the
jump-table.
Note: The pre_hook and post_hook must be manually called in your
#to_code implementation.
See CallBuilder::CrystalBinding::InvokeBody for an example of this.
Direct Known Subclasses
Defined in:
bindgen/call.crInstance Method Summary
-
#add_post_hook(hook : Body) : Nil
Adds hook to run after the
#post_hookset already, if any. -
#post_hook : Body | Nil
Code snippet ran after the body code itself.
-
#post_hook=(post_hook : Body | Nil)
Code snippet ran after the body code itself.
-
#post_hook?(type : T.class) : Bool forall T
Returns if a post-hook of type type is set, alone or in a sequence.
-
#pre_hook : Body | Nil
Code snippet ran before the body code itself.
-
#pre_hook=(pre_hook : Body | Nil)
Code snippet ran before the body code itself.
Instance methods inherited from class Bindgen::Call::Body
to_code(call : Call, platform : Graph::Platform) : String
to_code
Instance Method Detail
Adds hook to run after the #post_hook set already, if any.
Code snippet ran after the body code itself. The result value is stored
in a variable called result.
Code snippet ran after the body code itself. The result value is stored
in a variable called result.
Returns if a post-hook of type type is set, alone or in a sequence.
Code snippet ran before the body code itself. Access to the arguments of the body can be accessed directly by their name.
Code snippet ran before the body code itself. Access to the arguments of the body can be accessed directly by their name.