aboutsummaryrefslogtreecommitdiff
path: root/syntax
diff options
context:
space:
mode:
authoralandonovan <adonovan@google.com>2018-07-02 12:30:49 -0400
committerGitHub <noreply@github.com>2018-07-02 12:30:49 -0400
commita64b4113d5428f455f7ce2395ed21651fa701dc3 (patch)
tree5405031480a92f966da688b11506a8cac2bab4d8 /syntax
parentcc7dbc2bbe95ffaf3958a80556cd7e7d06d9a395 (diff)
downloadstarlark-go-a64b4113d5428f455f7ce2395ed21651fa701dc3.tar.gz
syntax: eliminate a bounds-check (#113)
Diffstat (limited to 'syntax')
-rw-r--r--syntax/scan.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/syntax/scan.go b/syntax/scan.go
index 57ca5ed..3a0239a 100644
--- a/syntax/scan.go
+++ b/syntax/scan.go
@@ -323,6 +323,7 @@ func (sc *scanner) peekRune() rune {
func (sc *scanner) readRune() rune {
if len(sc.rest) == 0 {
sc.error(sc.pos, "internal scanner error: readRune at EOF")
+ return 0 // unreachable but eliminates bounds-check below
}
// fast path: ASCII