mirror of
https://github.com/golang/go.git
synced 2026-02-06 18:00:01 +00:00
go/parser: use (*Scanner).End in error testing
Updates #74958 Change-Id: I43dcbff6ec828bddf157b2e6ec80df526a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/738700 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
parent
3c924059e6
commit
15882523a1
1 changed files with 3 additions and 7 deletions
|
|
@ -81,6 +81,8 @@ func expectedErrors(fset *token.FileSet, filename string, src []byte) map[token.
|
|||
|
||||
for {
|
||||
pos, tok, lit := s.Scan()
|
||||
end := s.End()
|
||||
|
||||
switch tok {
|
||||
case token.EOF:
|
||||
return errors
|
||||
|
|
@ -104,13 +106,7 @@ func expectedErrors(fset *token.FileSet, filename string, src []byte) map[token.
|
|||
fallthrough
|
||||
default:
|
||||
prev = pos
|
||||
var l int // token length
|
||||
if tok.IsLiteral() {
|
||||
l = len(lit)
|
||||
} else {
|
||||
l = len(tok.String())
|
||||
}
|
||||
here = prev + token.Pos(l)
|
||||
here = end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue