Skip to content

Commit fa19c88

Browse files
committed
pattern: handle matching non-List node against slice of fields
1 parent c5590e0 commit fa19c88

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pattern/match.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,13 @@ func matchNodeAST(m *Matcher, a Node, b interface{}) (interface{}, bool) {
305305
// 'a' is not a List or we'd be using its Match
306306
// implementation.
307307

308+
if len(b) != 1 {
309+
return nil, false
310+
}
311+
return match(m, a, b[0])
312+
case []*ast.Field:
313+
// 'a' is not a List or we'd be using its Match
314+
// implementation
308315
if len(b) != 1 {
309316
return nil, false
310317
}

0 commit comments

Comments
 (0)