Skip to content

Commit

Permalink
text/template/parse: remove duplication in peekNonSpace
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
a8m authored and robpike committed Oct 1, 2019
1 parent 86cd6c2 commit 93a79bb
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/text/template/parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 93a79bb

Please sign in to comment.