Skip to content

Commit 93a79bb

Browse files
a8mrobpike
authored andcommitted
text/template/parse: remove duplication in peekNonSpace
nextNonSpace has an identical code except the call to backup at the end. Change-Id: Iefa5b13950007da38323a800fb6b0ce3d436254b Reviewed-on: https://go-review.googlesource.com/c/go/+/198277 Run-TryBot: Rob Pike <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Rob Pike <[email protected]>
1 parent 86cd6c2 commit 93a79bb

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/text/template/parse/parse.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,8 @@ func (t *Tree) nextNonSpace() (token item) {
108108
}
109109

110110
// peekNonSpace returns but does not consume the next non-space token.
111-
func (t *Tree) peekNonSpace() (token item) {
112-
for {
113-
token = t.next()
114-
if token.typ != itemSpace {
115-
break
116-
}
117-
}
111+
func (t *Tree) peekNonSpace() item {
112+
token := t.nextNonSpace()
118113
t.backup()
119114
return token
120115
}

0 commit comments

Comments
 (0)