forked from mirror/glob
Use Len too
This commit is contained in:
parent
b3ce5dedcb
commit
af4b301eec
13
compiler.go
13
compiler.go
|
@ -194,7 +194,18 @@ func convertMatchers(matchers []match.Matcher) []match.Matcher {
|
|||
for l := 0; l < len(matchers); l++ {
|
||||
for r := len(matchers); r > l; r-- {
|
||||
if glued := glueMatchers(matchers[l:r]); glued != nil {
|
||||
if done == nil || count < r-l {
|
||||
var swap bool
|
||||
|
||||
if done == nil {
|
||||
swap = true
|
||||
} else {
|
||||
cl, gl := done.Len(), glued.Len()
|
||||
swap = cl > -1 && gl > -1 && gl > cl
|
||||
|
||||
swap = swap || count < r-l
|
||||
}
|
||||
|
||||
if swap {
|
||||
done = glued
|
||||
left = l
|
||||
right = r
|
||||
|
|
Loading…
Reference in New Issue