You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In addition to the issue with replacing only the first instance of the matching statement (described in #10), this has the problem that the statement is only matched at the "top level" of the function. It will not affect the following versions, for example:
func foo() {
for x := range y {
err := bar(x)
if err != nil {
log.Fatal(err)
}
}
}
We need a means of specifying that given some previously matched context, we want to apply a "sub transformation" to the entire tree inside that context.
I've been referring to this concept as contextual matching but there may be a better term.
Borrowing from Coccinelle, one possible syntax here is <..., ...>. For example,
Which I'm roughly translating to "given that matched context, apply this match/transformation to everything inside it." The "match all" nature of this syntax might also help address #10.
The text was updated successfully, but these errors were encountered:
Patches currently apply at matching "levels" in the AST.
For example, consider the following patch.
In addition to the issue with replacing only the first instance of the matching statement (described in #10), this has the problem that the statement is only matched at the "top level" of the function. It will not affect the following versions, for example:
We need a means of specifying that given some previously matched context, we want to apply a "sub transformation" to the entire tree inside that context.
I've been referring to this concept as contextual matching but there may be a better term.
Borrowing from Coccinelle, one possible syntax here is
<...
,...>
. For example,Which I'm roughly translating to "given that matched context, apply this match/transformation to everything inside it." The "match all" nature of this syntax might also help address #10.
The text was updated successfully, but these errors were encountered: