Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support function args being passed by reference #230

Merged
merged 3 commits into from
Oct 10, 2023

Conversation

joehoyle
Copy link
Collaborator

@joehoyle joehoyle commented Feb 13, 2023

Currently it's not possible for a function to accept args by reference. This PR adds early support for doing so, by transforming any function args that are &mut T into args that are passed by reference. E.g.:

#[php_function]
fn my_function( arg: &mut Zval ) {
	arg.reference_mut().map( |zval| zval.set_bool(true) );
}

Currently it's not possible for a function to accept args by reference. This PR adds early support for doing so, by transforming any function args that are `&mut T` into args that are passed by reference. E.g.:

```
\#[php_function]
fn my_function( arg: &mut Zval ) {
	arg.reference_mut().map( |zval| zval.set_bool(true) );
}
```
@joehoyle joehoyle force-pushed the function-arg-pass-by-ref branch from b32fa61 to 614f5b4 Compare July 13, 2023 12:42
@danog danog merged commit 4dd7b8d into master Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants