]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/syntax: fix source buffer refilling
authorMatthew Dempsky <mdempsky@google.com>
Tue, 19 Sep 2017 21:28:03 +0000 (14:28 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 20 Sep 2017 17:47:26 +0000 (17:47 +0000)
commite06a64a4768445f2fcea1cb6b5a04abe0c4d9d12
treebde00cb4598ea2b5cd52c78e5b3f8ad837d3176e
parenta53e853964cc9220ebc4b35aeb81a382939fb479
cmd/compile/internal/syntax: fix source buffer refilling

The previous code seems to have an off-by-1 in it somewhere, the
consequence being that we didn't properly preserve all of the old
buffer contents that we intended to.

After spending a while looking at the existing window-shifting logic,
I wasn't able to understand exactly how it was supposed to work or
where the issue was, so I rewrote it to be (at least IMO) more
obviously correct.

Fixes #21938.

Change-Id: I1ed7bbc1e1751a52ab5f7cf0411ae289586dc345
Reviewed-on: https://go-review.googlesource.com/64830
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/syntax/scanner_test.go
src/cmd/compile/internal/syntax/source.go