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

Handle nullable parameters for callbacks as well #742

Merged
merged 1 commit into from Mar 13, 2019

Conversation

Projects
None yet
3 participants
@GuillaumeGomez
Copy link
Member

commented Mar 13, 2019

Fixes #741.

You can see the result here: gtk-rs/gtk#798

cc @EPashkin @sdroege

s.push(format!("{}{}",
if is_fundamental { "" } else { "&" },
if x != "GString" { x } else { "&str".to_owned() }));
if y != "GString" { x } else {

This comment has been minimized.

Copy link
@EPashkin

EPashkin Mar 13, 2019

Member

Maybe just !ends_with("GString") ?

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Mar 13, 2019

Author Member

I don't think this is a good idea: if we ever have a type that for any reason ends with "GString" (because why not?), well, debugging will be complicated. :)

s.push(format!("{}{}",
if is_fundamental { "" } else { "&" },
if x != "GString" { x } else { "&str".to_owned() }));
if y != "GString" { x } else {
if *p.nullable {

This comment has been minimized.

Copy link
@EPashkin

EPashkin Mar 13, 2019

Member

Please else if without { between

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Mar 13, 2019

Author Member

Good point!

@EPashkin

This comment has been minimized.

Copy link
Member

commented Mar 13, 2019

@GuillaumeGomez Thanks, looks good but there some small nits

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:nullable-closure-params branch from d9f5deb to 452cff4 Mar 13, 2019

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

commented Mar 13, 2019

Updated.

closure_kind,
s.join(", "),
if y != "GString" { &x } else {
if *f.ret.nullable {

This comment has been minimized.

Copy link
@EPashkin

EPashkin Mar 13, 2019

Member

Here else if too please

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Mar 13, 2019

Author Member

Woups, fixed as well!

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:nullable-closure-params branch from 452cff4 to 017c498 Mar 13, 2019

@sdroege

This comment has been minimized.

Copy link
Member

commented Mar 13, 2019

The generated code looks good to me. Thanks for working on this :)

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

commented Mar 13, 2019

I made the error, I fix it. Sounds reasonable. :)

@EPashkin

This comment has been minimized.

Copy link
Member

commented Mar 13, 2019

Thanks

@EPashkin EPashkin merged commit 1ae7210 into gtk-rs:master Mar 13, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@GuillaumeGomez GuillaumeGomez deleted the GuillaumeGomez:nullable-closure-params branch Mar 13, 2019

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

commented Mar 13, 2019

I'll send the regen PRs tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.