Skip to content

Commit

Permalink
feat(golang): handle method_declaration the same as function_declarat…
Browse files Browse the repository at this point in the history
…ion (#1494)
  • Loading branch information
cfabianski authored Feb 12, 2024
1 parent 9275286 commit 55532e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/languages/golang/pattern/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (*Pattern) IsAnchored(node *tree.Node) (bool, bool) {
}
}

if parent.Type() == "function_declaration" {
if slices.Contains([]string{"function_declaration", "method_declaration"}, parent.Type()) {
// parameters
if node == parent.ChildByFieldName("parameters") {
return true, false
Expand All @@ -150,6 +150,7 @@ func (*Pattern) IsAnchored(node *tree.Node) (bool, bool) {
// function declaration_list
unAnchored := []string{
"function_declaration",
"method_declaration",
"var_declaration",
"literal_value",
}
Expand Down

0 comments on commit 55532e6

Please sign in to comment.