forked from mirror/glob
Optimize list
This commit is contained in:
parent
41a0d4481c
commit
b3c56781e2
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"github.com/gobwas/glob/match"
|
||||
"reflect"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
func optimize(matcher match.Matcher) match.Matcher {
|
||||
|
@ -21,6 +22,13 @@ func optimize(matcher match.Matcher) match.Matcher {
|
|||
|
||||
return m
|
||||
|
||||
case match.List:
|
||||
if m.Not == false && utf8.RuneCountInString(m.List) == 1 {
|
||||
return match.NewText(m.List)
|
||||
}
|
||||
|
||||
return m
|
||||
|
||||
case match.BTree:
|
||||
m.Left = optimize(m.Left)
|
||||
m.Right = optimize(m.Right)
|
||||
|
|
Loading…
Reference in New Issue