Skip to content

Commit bea32b9

Browse files
committed
fix typo
1 parent 0354991 commit bea32b9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compiler/compiler.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ package compiler
55

66
import (
77
"fmt"
8+
"reflect"
9+
810
"github.com/gobwas/glob/match"
911
"github.com/gobwas/glob/syntax/ast"
1012
"github.com/gobwas/glob/util/runes"
11-
"reflect"
1213
)
1314

1415
func optimizeMatcher(matcher match.Matcher) match.Matcher {
@@ -373,11 +374,11 @@ func commonChildren(nodes []*ast.Node) (commonLeft, commonRight []*ast.Node) {
373374
breakRight bool
374375
commonTotal int
375376
)
376-
for i, j := 0, treeLength-1; commonTotal < treeLength && j >= 0 && !(breakLeft && breakLeft); i, j = i+1, j-1 {
377+
for i, j := 0, treeLength-1; commonTotal < treeLength && j >= 0 && !(breakLeft && breakRight); i, j = i+1, j-1 {
377378
treeLeft := tree.Children[i]
378379
treeRight := tree.Children[j]
379380

380-
for k := 0; k < len(nodes) && !(breakLeft && breakLeft); k++ {
381+
for k := 0; k < len(nodes) && !(breakLeft && breakRight); k++ {
381382
// skip least children node
382383
if k == idx {
383384
continue

0 commit comments

Comments
 (0)