Use Len too

This commit is contained in:
s.kamardin 2016-01-13 20:26:39 +03:00
parent b3ce5dedcb
commit af4b301eec
1 changed files with 12 additions and 1 deletions

View File

@ -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