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 for elision in if statement? #180

Open
rsperl opened this issue Jan 22, 2025 · 0 comments
Open

Support for elision in if statement? #180

rsperl opened this issue Jan 22, 2025 · 0 comments

Comments

@rsperl
Copy link

rsperl commented Jan 22, 2025

I'm trying to update the expressions in an if statement, but I'm not sure if this is supported.

I have code where the struct A has a bool property and an if statements with multiple expressions:

type A struct {
    Value: bool
}

a := A{}

if test1 && test2 && a.Value {
// do the thing
}

But Value is now a pointer to a bool, so the if statements should be transformed to

if test1 && test2 && a.Value != nil && *a.Value {
// do the thing
}

This does not match:

@@
var a identifier
@@
-if ... && a.Value
+if ... && a.Value != nil && *a.Value

but insteads gives the error

load patch "bool_to_pointer.patch": parse: bool_to_pointer.patch/5.minus.augmented:4:1: expected operand, found '}'

If this is supported, can you point me in the right direction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant