mirror of https://github.com/golang/go.git
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 <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
86cd6c2ee5
commit
93a79bbcc0
|
|
@ -108,13 +108,8 @@ func (t *Tree) nextNonSpace() (token item) {
|
|||
}
|
||||
|
||||
// peekNonSpace returns but does not consume the next non-space token.
|
||||
func (t *Tree) peekNonSpace() (token item) {
|
||||
for {
|
||||
token = t.next()
|
||||
if token.typ != itemSpace {
|
||||
break
|
||||
}
|
||||
}
|
||||
func (t *Tree) peekNonSpace() item {
|
||||
token := t.nextNonSpace()
|
||||
t.backup()
|
||||
return token
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue