cmd/compile/internal/syntax: remove ParseBytes from API - not needed

R=go1.11

Also: Minor updates to syntax.Parse doc string.

Change-Id: I649965be9670a2f1c3de2cdb350634ed21e36ad9
Reviewed-on: https://go-review.googlesource.com/85663
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2018-01-02 13:36:38 -08:00
parent 7ac393a3f2
commit e87f2a1b70
5 changed files with 17 additions and 34 deletions

View file

@ -131,7 +131,7 @@ func verifyPrint(filename string, ast1 *File) {
panic(err)
}
ast2, err := ParseBytes(src.NewFileBase(filename, filename), buf1.Bytes(), nil, nil, nil, 0)
ast2, err := Parse(src.NewFileBase(filename, filename), &buf1, nil, nil, nil, 0)
if err != nil {
panic(err)
}
@ -155,7 +155,7 @@ func verifyPrint(filename string, ast1 *File) {
}
func TestIssue17697(t *testing.T) {
_, err := ParseBytes(nil, nil, nil, nil, nil, 0) // return with parser error, don't panic
_, err := Parse(nil, bytes.NewReader(nil), nil, nil, nil, 0) // return with parser error, don't panic
if err == nil {
t.Errorf("no error reported")
}
@ -208,7 +208,7 @@ func TestLineDirectives(t *testing.T) {
}
return name
}
_, err := ParseBytes(nil, []byte(test.src), nil, nil, fileh, 0)
_, err := Parse(nil, strings.NewReader(test.src), nil, nil, fileh, 0)
if err == nil {
t.Errorf("%s: no error reported", test.src)
continue