diff options
author | Koichi Sasada <ko1@atdot.net> | 2019-11-11 16:38:46 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2019-11-11 16:47:50 +0900 |
commit | 31416423809f64d4b5ea6b9651cced3179cc5ced (patch) | |
tree | 5cf4b7d9b19019d5f665ca0b0c3902f8100cd597 /lib/abbrev.rb | |
parent | 05a5c69e1a06a3853afb3744fa9925910b78904f (diff) | |
download | ruby-31416423809f64d4b5ea6b9651cced3179cc5ced.tar.gz |
__builtin_inline!
Add an experimental `__builtin_inline!(c_expression)` special intrinsic
which run a C code snippet.
In `c_expression`, you can access the following variables:
* ec (rb_execution_context_t *)
* self (const VALUE)
* local variables (const VALUE)
Not that you can read these variables, but you can not write them.
You need to return from this expression and return value will be a
result of __builtin_inline!().
Examples:
`def foo(x) __builtin_inline!('return rb_p(x);'); end` calls `p(x)`.
`def double(x) __builtin_inline!('return INT2NUM(NUM2INT(x) * 2);')`
returns x*2.
Diffstat (limited to 'lib/abbrev.rb')
0 files changed, 0 insertions, 0 deletions